PISM, A Parallel Ice Sheet Model  stable v2.0.6 committed by Constantine Khrulev on 2023-01-23 15:14:38 -0900
StressBalance.hh
Go to the documentation of this file.
1 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 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/iceModelVec.hh"
26 #include "pism/stressbalance/timestepping.hh"
27 
28 namespace pism {
29 
30 class IceModelVec2CellType;
31 class Geometry;
32 
33 namespace rheology {
34 class FlowLaw;
35 } // end of namespace rheology
36 
37 //! Stress balance models and related diagnostics.
38 namespace stressbalance {
39 
40 class ShallowStressBalance;
41 class SSB_Modifier;
42 
43 class Inputs {
44 public:
45  Inputs();
46 
49 
54 
56  const IceModelVec3 *age;
57 
60 
61  // inputs used by regional stress balance models
65 
66  void dump(const char *filename) const;
67 };
68 
69 //! The class defining PISM's interface to the shallow stress balance code.
70 /*!
71  Generally all the nontrivial fields are updated by a call to update(). The rest
72  of the methods generally provide access to precomputed results. The following
73  diagram shows where these results are generally used in the rest of PISM. (It
74  does not show the call graph, as would doxygen.)
75 
76  \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."
77 
78  this command fails: \dotfile stressbalance-out.dot
79 */
80 class StressBalance : public Component
81 {
82 public:
84  std::shared_ptr<ShallowStressBalance> sb,
85  std::shared_ptr<SSB_Modifier> ssb_mod);
86  virtual ~StressBalance();
87 
88  //! \brief Initialize the StressBalance object.
89  void init();
90 
91  //! \brief Update all the fields if (full_update), only update diffusive flux
92  //! and max. diffusivity otherwise.
93  void update(const Inputs &inputs, bool full_update);
94 
95  //! \brief Get the thickness-advective (SSA) 2D velocity.
96  const IceModelVec2V& advective_velocity() const;
97 
98  //! \brief Get the diffusive (SIA) vertically-averaged flux on the staggered grid.
99  const IceModelVec2Stag& diffusive_flux() const;
100 
101  //! \brief Get the max diffusivity (for the adaptive time-stepping).
102  double max_diffusivity() const;
103 
106 
107  // for the energy/age time step:
108 
109  //! \brief Get components of the the 3D velocity field.
110  const IceModelVec3& velocity_u() const;
111  const IceModelVec3& velocity_v() const;
112  const IceModelVec3& velocity_w() const;
113 
114  //! \brief Get the basal frictional heating.
116 
118 
119  //! \brief Produce a report string for the standard output.
120  std::string stdout_report() const;
121 
122  //! \brief Returns a pointer to a shallow stress balance solver implementation.
123  const ShallowStressBalance* shallow() const;
124 
125  //! \brief Returns a pointer to a stress balance modifier implementation.
126  const SSB_Modifier* modifier() const;
127 protected:
128  virtual DiagnosticList diagnostics_impl() const;
129  virtual TSDiagnosticList ts_diagnostics_impl() const;
130 
131  virtual void define_model_state_impl(const File &output) const;
132  virtual void write_model_state_impl(const File &output) const;
133 
134  virtual void compute_vertical_velocity(const IceModelVec2CellType &mask,
135  const IceModelVec3 &u,
136  const IceModelVec3 &v,
137  const IceModelVec2S *bmr,
138  IceModelVec3 &result);
139  virtual void compute_volumetric_strain_heating(const Inputs &inputs);
140 
142 
144 
145  std::shared_ptr<ShallowStressBalance> m_shallow_stress_balance;
146  std::shared_ptr<SSB_Modifier> m_modifier;
147 };
148 
149 std::shared_ptr<StressBalance> create(const std::string &model_name,
150  IceGrid::ConstPtr grid,
151  bool regional);
152 
154  const IceModelVec2CellType &mask,
155  IceModelVec3 &result);
156 
157 void compute_2D_stresses(const rheology::FlowLaw &flow_law,
158  const IceModelVec2V &velocity,
159  const IceModelVec2S &hardness,
160  const IceModelVec2CellType &cell_type,
161  IceModelVec3 &result);
162 
163 } // end of namespace stressbalance
164 } // end of namespace pism
165 
166 #endif /* _PISMSTRESSBALANCE_H_ */
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:101
High-level PISM I/O class.
Definition: File.hh:51
std::shared_ptr< const IceGrid > ConstPtr
Definition: IceGrid.hh:233
"Cell type" mask. Adds convenience methods to IceModelVec2Int.
A simple class "hiding" the fact that the mask is stored as floating-point scalars (instead of intege...
Definition: iceModelVec.hh:389
A class for storing and accessing internal staggered-grid 2D fields. Uses dof=2 storage....
Definition: iceModelVec.hh:449
A virtual class collecting methods common to ice and bedrock 3D fields.
Definition: iceModelVec.hh:404
const IceModelVec2S * no_model_ice_thickness
const IceModelVec2S * water_column_pressure
const IceModelVec3 * enthalpy
void dump(const char *filename) const
const IceModelVec2S * fracture_density
const IceModelVec2S * basal_yield_stress
const IceModelVec2S * no_model_surface_elevation
const IceModelVec3 * age
const IceModelVec2V * bc_values
const IceModelVec2Int * bc_mask
const IceModelVec2S * basal_melt_rate
const IceModelVec2Int * no_model_mask
Shallow stress balance modifier (such as the non-sliding SIA).
Definition: SSB_Modifier.hh:39
Shallow stress balance (such as the SSA).
const IceModelVec3 & velocity_u() const
Get components of the the 3D velocity field.
StressBalance(IceGrid::ConstPtr g, std::shared_ptr< ShallowStressBalance > sb, std::shared_ptr< SSB_Modifier > ssb_mod)
std::shared_ptr< SSB_Modifier > m_modifier
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
const IceModelVec2S & basal_frictional_heating() const
Get the basal frictional heating.
const IceModelVec3 & volumetric_strain_heating() const
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
const IceModelVec2V & advective_velocity() const
Get the thickness-advective (SSA) 2D velocity.
const SSB_Modifier * modifier() const
Returns a pointer to a stress balance modifier implementation.
virtual TSDiagnosticList ts_diagnostics_impl() const
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 IceModelVec2CellType &mask, const IceModelVec3 &u, const IceModelVec3 &v, const IceModelVec2S *bmr, IceModelVec3 &result)
Compute vertical velocity using incompressibility of the ice.
void init()
Initialize the StressBalance object.
virtual DiagnosticList diagnostics_impl() const
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 IceModelVec2Stag & diffusive_flux() const
Get the diffusive (SIA) vertically-averaged flux on the staggered grid.
const IceModelVec3 & velocity_v() const
const IceModelVec3 & velocity_w() const
The class defining PISM's interface to the shallow stress balance code.
std::shared_ptr< StressBalance > create(const std::string &model, IceGrid::ConstPtr grid, bool regional)
Definition: factory.cc:38
void compute_2D_stresses(const rheology::FlowLaw &flow_law, const IceModelVec2V &velocity, const IceModelVec2S &hardness, const IceModelVec2CellType &cell_type, IceModelVec3 &result)
Compute 2D deviatoric stresses.
void compute_2D_principal_strain_rates(const IceModelVec2V &V, const IceModelVec2CellType &mask, IceModelVec3 &result)
Compute eigenvalues of the horizontal, vertically-integrated strain rate tensor.
static const double g
Definition: exactTestP.cc:39
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
Definition: Diagnostic.hh:346
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:117