PISM, A Parallel Ice Sheet Model  stable v2.0.4 committed by Constantine Khrulev on 2022-05-25 12:02:27 -0800
YieldStress.cc
Go to the documentation of this file.
1 /* Copyright (C) 2015, 2016, 2017, 2018, 2019, 2021 PISM Authors
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 
20 #include "YieldStress.hh"
21 
22 #include "pism/util/ConfigInterface.hh"
23 #include "pism/util/Logger.hh"
24 
25 namespace pism {
26 
28  geometry = nullptr;
29  no_model_mask = nullptr;
30  till_water_thickness = nullptr;
32 }
33 
35  : Component(g),
36  m_basal_yield_stress(m_grid, "tauc", WITH_GHOSTS,
37  m_config->get_number("grid.max_stencil_width")) {
38 
39  // PROPOSED standard_name = land_ice_basal_material_yield_stress
40  m_basal_yield_stress.set_attrs("model_state",
41  "yield stress for basal till (plastic or pseudo-plastic model)",
42  "Pa", "Pa", "", 0);
43 }
44 
45 /*!
46  * Restart a yield stress model from an input file.
47  */
48 void YieldStress::restart(const File &input_file, int record) {
49  m_log->message(2, "* Initializing the %s...\n", name().c_str());
50 
51  this->restart_impl(input_file, record);
52 }
53 
54 /*!
55  * Bootstrap a yield stress model using incomplete inputs.
56  */
57 void YieldStress::bootstrap(const File &input_file, const YieldStressInputs &inputs) {
58  m_log->message(2, "Initializing the %s...\n", name().c_str());
59 
60  this->bootstrap_impl(input_file, inputs);
61 }
62 
63 /*!
64  * Initialize a yield stress model using inputs from other models and configuration
65  * parameters.
66  */
67 void YieldStress::init(const YieldStressInputs &inputs) {
68  m_log->message(2, "Initializing the %s...\n", name().c_str());
69 
70  this->init_impl(inputs);
71 }
72 
73 /*!
74  * Update a yield stress model.
75  */
76 void YieldStress::update(const YieldStressInputs &inputs, double t, double dt) {
77  this->update_impl(inputs, t, dt);
78 }
79 
81  return m_basal_yield_stress;
82 }
83 
84 /*!
85  * Define model state variables.
86  *
87  * All yield stress models have to write basal yield stress to output files and read it
88  * from and input file during initialization because yield stress may be used by PISM's
89  * stress balance model. The stress balance code has to be executed early during an update
90  * of the model because its output (ice velocity) is used to compute the maximum allowed
91  * time step.
92  *
93  * Now that PISM's yield stress models are time-dependent YieldStress::update() will be
94  * called *after* the maximum time step is found. This means that during the first time
95  * step basal_material_yield_stress() gets called before update().
96  */
97 void YieldStress::define_model_state_impl(const File &output) const {
99 }
100 
101 void YieldStress::write_model_state_impl(const File &output) const {
102  m_basal_yield_stress.write(output);
103 }
104 
106  return {{"tauc", Diagnostic::wrap(m_basal_yield_stress)}};
107 }
108 
109 std::string YieldStress::name() const {
110  return m_name;
111 }
112 
113 } // end of namespace pism
const Logger::ConstPtr m_log
logger (for easy access)
Definition: Component.hh:142
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:101
static Ptr wrap(const T &input)
Definition: Diagnostic.hh:155
High-level PISM I/O class.
Definition: File.hh:51
std::shared_ptr< const IceGrid > ConstPtr
Definition: IceGrid.hh:233
void set_attrs(const std::string &pism_intent, const std::string &long_name, const std::string &units, const std::string &glaciological_units, const std::string &standard_name, unsigned int component)
Sets NetCDF attributes of an IceModelVec object.
Definition: iceModelVec.cc:399
void define(const File &file, IO_Type default_type=PISM_DOUBLE) const
Define variables corresponding to an IceModelVec in a file opened using file.
Definition: iceModelVec.cc:523
void write(const std::string &filename) const
Definition: iceModelVec.cc:822
const IceModelVec2S * till_water_thickness
Definition: YieldStress.hh:35
const IceModelVec2Int * no_model_mask
Definition: YieldStress.hh:40
const IceModelVec2S * subglacial_water_thickness
Definition: YieldStress.hh:37
const Geometry * geometry
Definition: YieldStress.hh:33
std::string m_name
Definition: YieldStress.hh:77
void bootstrap(const File &input_file, const YieldStressInputs &inputs)
Definition: YieldStress.cc:57
virtual void init_impl(const YieldStressInputs &inputs)=0
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: YieldStress.cc:101
const IceModelVec2S & basal_material_yield_stress()
Definition: YieldStress.cc:80
void update(const YieldStressInputs &inputs, double t, double dt)
Definition: YieldStress.cc:76
virtual void restart_impl(const File &input_file, int record)=0
std::string name() const
Definition: YieldStress.cc:109
YieldStress(IceGrid::ConstPtr g)
Definition: YieldStress.cc:34
IceModelVec2S m_basal_yield_stress
Definition: YieldStress.hh:75
DiagnosticList diagnostics_impl() const
Definition: YieldStress.cc:105
virtual void bootstrap_impl(const File &input_file, const YieldStressInputs &inputs)=0
void init(const YieldStressInputs &inputs)
Definition: YieldStress.cc:67
virtual void define_model_state_impl(const File &output) const
Definition: YieldStress.cc:97
void restart(const File &input_file, int record)
Definition: YieldStress.cc:48
virtual void update_impl(const YieldStressInputs &inputs, double t, double dt)=0
static const double g
Definition: exactTestP.cc:39
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:117
@ WITH_GHOSTS
Definition: iceModelVec.hh:49