PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
StressBalance.hh
Go to the documentation of this file.
1 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021, 2022 Constantine Khroulev and Ed Bueler
2 //
3 // This file is part of PISM.
4 //
5 // PISM is free software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the Free Software
7 // Foundation; either version 3 of the License, or (at your option) any later
8 // version.
9 //
10 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with PISM; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef _PISMSTRESSBALANCE_H_
20 #define _PISMSTRESSBALANCE_H_
21 
22 #include <memory> // std::shared_ptr
23 
24 #include "pism/util/Component.hh" // derives from Component
25 #include "pism/util/array/Array3D.hh"
26 #include "pism/stressbalance/timestepping.hh"
27 
28 namespace pism {
29 
30 namespace rheology {
31 class FlowLaw;
32 } // end of namespace rheology
33 
34 //! Stress balance models and related diagnostics.
35 namespace stressbalance {
36 
37 class ShallowStressBalance;
38 class SSB_Modifier;
39 
40 class Inputs {
41 public:
42  Inputs();
43 
46 
51 
54 
57 
58  // inputs used by regional stress balance models
62 
63  void dump(const char *filename) const;
64 };
65 
66 //! The class defining PISM's interface to the shallow stress balance code.
67 /*!
68  Generally all the nontrivial fields are updated by a call to update(). The rest
69  of the methods generally provide access to precomputed results. The following
70  diagram shows where these results are generally used in the rest of PISM. (It
71  does not show the call graph, as would doxygen.)
72 
73  \image html stressbalance-out.png "\b Methods of StressBalance, and the uses of their results. Dotted edges show scalars and dashed edges show fields. Dashed boxes inside the StressBalance object are important methods which may be present in shallow cases. The age time step has inputs which are a strict subset of the inputs of the energy time step."
74 
75  this command fails: \dotfile stressbalance-out.dot
76 */
77 class StressBalance : public Component
78 {
79 public:
80  StressBalance(std::shared_ptr<const Grid> g,
81  std::shared_ptr<ShallowStressBalance> sb,
82  std::shared_ptr<SSB_Modifier> ssb_mod);
83  virtual ~StressBalance();
84 
85  //! \brief Initialize the StressBalance object.
86  void init();
87 
88  //! \brief Update all the fields if (full_update), only update diffusive flux
89  //! and max. diffusivity otherwise.
90  void update(const Inputs &inputs, bool full_update);
91 
92  //! \brief Get the thickness-advective (SSA) 2D velocity.
93  const array::Vector& advective_velocity() const;
94 
95  //! \brief Get the diffusive (SIA) vertically-averaged flux on the staggered grid.
96  const array::Staggered& diffusive_flux() const;
97 
98  //! \brief Get the max diffusivity (for the adaptive time-stepping).
99  double max_diffusivity() const;
100 
103 
104  // for the energy/age time step:
105 
106  //! \brief Get components of the the 3D velocity field.
107  const array::Array3D& velocity_u() const;
108  const array::Array3D& velocity_v() const;
109  const array::Array3D& velocity_w() const;
110 
111  //! \brief Get the basal frictional heating.
113 
115 
116  //! \brief Produce a report string for the standard output.
117  std::string stdout_report() const;
118 
119  //! \brief Returns a pointer to a shallow stress balance solver implementation.
120  const ShallowStressBalance* shallow() const;
121 
122  //! \brief Returns a pointer to a stress balance modifier implementation.
123  const SSB_Modifier* modifier() const;
124 protected:
125  virtual DiagnosticList diagnostics_impl() const;
126  virtual TSDiagnosticList ts_diagnostics_impl() const;
127 
128  virtual void define_model_state_impl(const File &output) const;
129  virtual void write_model_state_impl(const File &output) const;
130 
131  virtual void compute_vertical_velocity(const array::CellType1 &mask,
132  const array::Array3D &u,
133  const array::Array3D &v,
134  const array::Scalar *bmr,
135  array::Array3D &result);
136  virtual void compute_volumetric_strain_heating(const Inputs &inputs);
137 
139 
141 
142  std::shared_ptr<ShallowStressBalance> m_shallow_stress_balance;
143  std::shared_ptr<SSB_Modifier> m_modifier;
144 };
145 
146 std::shared_ptr<StressBalance> create(const std::string &model_name,
147  std::shared_ptr<const Grid> grid,
148  bool regional);
149 
151  double eigen1;
152  double eigen2;
153 };
154 
156  const array::CellType1 &mask,
158 
160  double xx;
161  double yy;
162  double xy;
163 };
164 
165 void compute_2D_stresses(const rheology::FlowLaw &flow_law,
166  const array::Vector1 &velocity,
167  const array::Scalar &hardness,
168  const array::CellType1 &cell_type,
170 
171 } // end of namespace stressbalance
172 } // end of namespace pism
173 
174 #endif /* _PISMSTRESSBALANCE_H_ */
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:118
High-level PISM I/O class.
Definition: File.hh:56
A storage vector combining related fields in a struct.
Definition: Array2D.hh:32
A virtual class collecting methods common to ice and bedrock 3D fields.
Definition: Array3D.hh:33
A class for storing and accessing internal staggered-grid 2D fields. Uses dof=2 storage....
Definition: Staggered.hh:35
const array::Scalar * basal_yield_stress
const array::Scalar * bc_mask
const array::Array3D * age
void dump(const char *filename) const
const array::Scalar * no_model_ice_thickness
const array::Scalar2 * no_model_surface_elevation
const array::Scalar * water_column_pressure
const array::Array3D * enthalpy
const array::Scalar2 * no_model_mask
const array::Scalar * fracture_density
const array::Scalar * basal_melt_rate
const array::Vector * bc_values
Shallow stress balance modifier (such as the non-sliding SIA).
Definition: SSB_Modifier.hh:39
Shallow stress balance (such as the SSA).
std::shared_ptr< SSB_Modifier > m_modifier
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
const array::Array3D & velocity_w() const
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
const SSB_Modifier * modifier() const
Returns a pointer to a stress balance modifier implementation.
virtual TSDiagnosticList ts_diagnostics_impl() const
const array::Array3D & velocity_u() const
Get components of the the 3D velocity field.
virtual void compute_volumetric_strain_heating(const Inputs &inputs)
Computes the volumetric strain heating using horizontal velocity.
std::shared_ptr< ShallowStressBalance > m_shallow_stress_balance
double max_diffusivity() const
Get the max diffusivity (for the adaptive time-stepping).
virtual void compute_vertical_velocity(const array::CellType1 &mask, const array::Array3D &u, const array::Array3D &v, const array::Scalar *bmr, array::Array3D &result)
Compute vertical velocity using incompressibility of the ice.
void init()
Initialize the StressBalance object.
const array::Vector & advective_velocity() const
Get the thickness-advective (SSA) 2D velocity.
virtual DiagnosticList diagnostics_impl() const
const array::Staggered & diffusive_flux() const
Get the diffusive (SIA) vertically-averaged flux on the staggered grid.
const ShallowStressBalance * shallow() const
Returns a pointer to a shallow stress balance solver implementation.
std::string stdout_report() const
Produce a report string for the standard output.
void update(const Inputs &inputs, bool full_update)
Update all the fields if (full_update), only update diffusive flux and max. diffusivity otherwise.
const array::Scalar & basal_frictional_heating() const
Get the basal frictional heating.
const array::Array3D & velocity_v() const
const array::Array3D & volumetric_strain_heating() const
StressBalance(std::shared_ptr< const Grid > g, std::shared_ptr< ShallowStressBalance > sb, std::shared_ptr< SSB_Modifier > ssb_mod)
The class defining PISM's interface to the shallow stress balance code.
void compute_2D_principal_strain_rates(const array::Vector1 &V, const array::CellType1 &mask, array::Array2D< PrincipalStrainRates > &result)
Compute eigenvalues of the horizontal, vertically-integrated strain rate tensor.
std::shared_ptr< StressBalance > create(const std::string &model, std::shared_ptr< const Grid > grid, bool regional)
Definition: factory.cc:38
void compute_2D_stresses(const rheology::FlowLaw &flow_law, const array::Vector1 &velocity, const array::Scalar &hardness, const array::CellType1 &cell_type, array::Array2D< DeviatoricStresses > &result)
Compute 2D deviatoric stresses.
static const double g
Definition: exactTestP.cc:36
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
Definition: Diagnostic.hh:343
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:125