PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
YieldStress.cc
Go to the documentation of this file.
1 /* Copyright (C) 2015, 2016, 2017, 2018, 2019, 2021, 2022, 2023 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 "pism/basalstrength/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 
34 YieldStress::YieldStress(std::shared_ptr<const Grid> g)
35  : Component(g),
36  m_basal_yield_stress(m_grid, "tauc") {
37 
38  // PROPOSED standard_name = land_ice_basal_material_yield_stress
40  .long_name("yield stress for basal till (plastic or pseudo-plastic model)")
41  .units("Pa");
42 }
43 
44 /*!
45  * Restart a yield stress model from an input file.
46  */
47 void YieldStress::restart(const File &input_file, int record) {
48  m_log->message(2, "* Initializing the %s...\n", name().c_str());
49 
50  this->restart_impl(input_file, record);
51 }
52 
53 /*!
54  * Bootstrap a yield stress model using incomplete inputs.
55  */
56 void YieldStress::bootstrap(const File &input_file, const YieldStressInputs &inputs) {
57  m_log->message(2, "Initializing the %s...\n", name().c_str());
58 
59  this->bootstrap_impl(input_file, inputs);
60 }
61 
62 /*!
63  * Initialize a yield stress model using inputs from other models and configuration
64  * parameters.
65  */
66 void YieldStress::init(const YieldStressInputs &inputs) {
67  m_log->message(2, "Initializing the %s...\n", name().c_str());
68 
69  this->init_impl(inputs);
70 }
71 
72 /*!
73  * Update a yield stress model.
74  */
75 void YieldStress::update(const YieldStressInputs &inputs, double t, double dt) {
76  this->update_impl(inputs, t, dt);
77 }
78 
80  return m_basal_yield_stress;
81 }
82 
83 /*!
84  * Define model state variables.
85  *
86  * All yield stress models have to write basal yield stress to output files and read it
87  * from and input file during initialization because yield stress may be used by PISM's
88  * stress balance model. The stress balance code has to be executed early during an update
89  * of the model because its output (ice velocity) is used to compute the maximum allowed
90  * time step.
91  *
92  * Now that PISM's yield stress models are time-dependent YieldStress::update() will be
93  * called *after* the maximum time step is found. This means that during the first time
94  * step basal_material_yield_stress() gets called before update().
95  */
96 void YieldStress::define_model_state_impl(const File &output) const {
98 }
99 
100 void YieldStress::write_model_state_impl(const File &output) const {
101  m_basal_yield_stress.write(output);
102 }
103 
105  return {{"tauc", Diagnostic::wrap(m_basal_yield_stress)}};
106 }
107 
108 std::string YieldStress::name() const {
109  return m_name;
110 }
111 
112 } // end of namespace pism
const Logger::ConstPtr m_log
logger (for easy access)
Definition: Component.hh:162
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:118
static Ptr wrap(const T &input)
Definition: Diagnostic.hh:160
High-level PISM I/O class.
Definition: File.hh:56
VariableMetadata & long_name(const std::string &input)
VariableMetadata & units(const std::string &input)
const array::Scalar * till_water_thickness
Definition: YieldStress.hh:34
const array::Scalar * subglacial_water_thickness
Definition: YieldStress.hh:36
const Geometry * geometry
Definition: YieldStress.hh:32
const array::Scalar * no_model_mask
Definition: YieldStress.hh:39
std::string m_name
Definition: YieldStress.hh:76
YieldStress(std::shared_ptr< const Grid > g)
Definition: YieldStress.cc:34
void bootstrap(const File &input_file, const YieldStressInputs &inputs)
Definition: YieldStress.cc:56
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:100
const array::Scalar & basal_material_yield_stress()
Definition: YieldStress.cc:79
void update(const YieldStressInputs &inputs, double t, double dt)
Definition: YieldStress.cc:75
virtual void restart_impl(const File &input_file, int record)=0
std::string name() const
Definition: YieldStress.cc:108
DiagnosticList diagnostics_impl() const
Definition: YieldStress.cc:104
virtual void bootstrap_impl(const File &input_file, const YieldStressInputs &inputs)=0
void init(const YieldStressInputs &inputs)
Definition: YieldStress.cc:66
virtual void define_model_state_impl(const File &output) const
Definition: YieldStress.cc:96
array::Scalar2 m_basal_yield_stress
Definition: YieldStress.hh:74
void restart(const File &input_file, int record)
Definition: YieldStress.cc:47
virtual void update_impl(const YieldStressInputs &inputs, double t, double dt)=0
void define(const File &file, io::Type default_type) const
Define variables corresponding to an Array in a file opened using file.
Definition: Array.cc:540
void write(const std::string &filename) const
Definition: Array.cc:800
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
Definition: Array.cc:553
@ PISM_DOUBLE
Definition: IO_Flags.hh:52
static const double g
Definition: exactTestP.cc:36
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:125