tStressBalance.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch) (HTM) git clone git://src.adamsgaard.dk/pism (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- tStressBalance.hh (5879B) --- 1 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 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 "pism/util/Component.hh" // derives from Component 23 #include "pism/util/iceModelVec.hh" 24 #include "pism/stressbalance/timestepping.hh" 25 26 namespace pism { 27 28 class IceModelVec2CellType; 29 class Geometry; 30 31 namespace rheology { 32 class FlowLaw; 33 } // end of namespace rheology 34 35 //! Stress balance models and related diagnostics. 36 namespace stressbalance { 37 38 class ShallowStressBalance; 39 class SSB_Modifier; 40 41 class Inputs { 42 public: 43 Inputs(); 44 45 const Geometry *geometry; 46 bool new_bed_elevation; 47 48 const IceModelVec2S *basal_melt_rate; 49 const IceModelVec2S *basal_yield_stress; 50 const IceModelVec2S *melange_back_pressure; 51 const IceModelVec2S *fracture_density; 52 53 const IceModelVec3 *enthalpy; 54 const IceModelVec3 *age; 55 56 const IceModelVec2Int *bc_mask; 57 const IceModelVec2V *bc_values; 58 59 // inputs used by regional stress balance models 60 const IceModelVec2Int *no_model_mask; 61 const IceModelVec2S *no_model_ice_thickness; 62 const IceModelVec2S *no_model_surface_elevation; 63 64 void dump(const char *filename) const; 65 }; 66 67 //! The class defining PISM's interface to the shallow stress balance code. 68 /*! 69 Generally all the nontrivial fields are updated by a call to update(). The rest 70 of the methods generally provide access to precomputed results. The following 71 diagram shows where these results are generally used in the rest of PISM. (It 72 does not show the call graph, as would doxygen.) 73 74 \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." 75 76 this command fails: \dotfile stressbalance-out.dot 77 */ 78 class StressBalance : public Component 79 { 80 public: 81 StressBalance(IceGrid::ConstPtr g, ShallowStressBalance *sb, SSB_Modifier *ssb_mod); 82 virtual ~StressBalance(); 83 84 //! \brief Initialize the StressBalance object. 85 void init(); 86 87 //! \brief Update all the fields if (full_update), only update diffusive flux 88 //! and max. diffusivity otherwise. 89 void update(const Inputs &inputs, bool full_update); 90 91 //! \brief Get the thickness-advective (SSA) 2D velocity. 92 const IceModelVec2V& advective_velocity() const; 93 94 //! \brief Get the diffusive (SIA) vertically-averaged flux on the staggered grid. 95 const IceModelVec2Stag& diffusive_flux() const; 96 97 //! \brief Get the max diffusivity (for the adaptive time-stepping). 98 double max_diffusivity() const; 99 100 CFLData max_timestep_cfl_2d() const; 101 CFLData max_timestep_cfl_3d() const; 102 103 // for the energy/age time step: 104 105 //! \brief Get components of the the 3D velocity field. 106 const IceModelVec3& velocity_u() const; 107 const IceModelVec3& velocity_v() const; 108 const IceModelVec3& velocity_w() const; 109 110 //! \brief Get the basal frictional heating. 111 const IceModelVec2S& basal_frictional_heating() const; 112 113 const IceModelVec3& volumetric_strain_heating() const; 114 115 //! \brief Produce a report string for the standard output. 116 std::string stdout_report() const; 117 118 //! \brief Returns a pointer to a shallow stress balance solver implementation. 119 const ShallowStressBalance* shallow() const; 120 121 //! \brief Returns a pointer to a stress balance modifier implementation. 122 const SSB_Modifier* modifier() const; 123 protected: 124 virtual DiagnosticList diagnostics_impl() const; 125 virtual TSDiagnosticList ts_diagnostics_impl() const; 126 127 virtual void define_model_state_impl(const File &output) const; 128 virtual void write_model_state_impl(const File &output) const; 129 130 virtual void compute_vertical_velocity(const IceModelVec2CellType &mask, 131 const IceModelVec3 &u, 132 const IceModelVec3 &v, 133 const IceModelVec2S *bmr, 134 IceModelVec3 &result); 135 virtual void compute_volumetric_strain_heating(const Inputs &inputs); 136 137 CFLData m_cfl_2d, m_cfl_3d; 138 139 IceModelVec3 m_w, m_strain_heating; 140 141 ShallowStressBalance *m_shallow_stress_balance; 142 SSB_Modifier *m_modifier; 143 }; 144 145 std::shared_ptr<StressBalance> create(const std::string &model_name, 146 IceGrid::ConstPtr grid, 147 bool regional); 148 149 void compute_2D_principal_strain_rates(const IceModelVec2V &velocity, 150 const IceModelVec2CellType &mask, 151 IceModelVec2 &result); 152 153 void compute_2D_stresses(const rheology::FlowLaw &flow_law, 154 const IceModelVec2V &velocity, 155 const IceModelVec2S &hardness, 156 const IceModelVec2CellType &cell_type, 157 IceModelVec2 &result); 158 159 } // end of namespace stressbalance 160 } // end of namespace pism 161 162 #endif /* _PISMSTRESSBALANCE_H_ */ 163