tYieldStress.cc - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tYieldStress.cc (3725B)
---
1 /* Copyright (C) 2015, 2016, 2017, 2018, 2019 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
27 YieldStressInputs::YieldStressInputs() {
28 geometry = nullptr;
29 no_model_mask = nullptr;
30 till_water_thickness = nullptr;
31 subglacial_water_thickness = nullptr;
32 }
33
34 YieldStress::YieldStress(IceGrid::ConstPtr g)
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 YieldStress::~YieldStress() {
46 // empty
47 }
48
49 /*!
50 * Restart a yield stress model from an input file.
51 */
52 void YieldStress::restart(const File &input_file, int record) {
53 m_log->message(2, "Initializing the %s...\n", name().c_str());
54
55 this->restart_impl(input_file, record);
56 }
57
58 /*!
59 * Bootstrap a yield stress model using incomplete inputs.
60 */
61 void YieldStress::bootstrap(const File &input_file, const YieldStressInputs &inputs) {
62 m_log->message(2, "Initializing the %s...\n", name().c_str());
63
64 this->bootstrap_impl(input_file, inputs);
65 }
66
67 /*!
68 * Initialize a yield stress model using inputs from other models and configuration
69 * parameters.
70 */
71 void YieldStress::init(const YieldStressInputs &inputs) {
72 m_log->message(2, "Initializing the %s...\n", name().c_str());
73
74 this->init_impl(inputs);
75 }
76
77 /*!
78 * Update a yield stress model.
79 */
80 void YieldStress::update(const YieldStressInputs &inputs, double t, double dt) {
81 this->update_impl(inputs, t, dt);
82 }
83
84 const IceModelVec2S& YieldStress::basal_material_yield_stress() {
85 return m_basal_yield_stress;
86 }
87
88 /*!
89 * Define model state variables.
90 *
91 * All yield stress models have to write basal yield stress to output files and read it
92 * from and input file during initialization because yield stress may be used by PISM's
93 * stress balance model. The stress balance code has to be executed early during an update
94 * of the model because its output (ice velocity) is used to compute the maximum allowed
95 * time step.
96 *
97 * Now that PISM's yield stress models are time-dependent YieldStress::update() will be
98 * called *after* the maximum time step is found. This means that during the first time
99 * step basal_material_yield_stress() gets called before update().
100 */
101 void YieldStress::define_model_state_impl(const File &output) const {
102 m_basal_yield_stress.define(output);
103 }
104
105 void YieldStress::write_model_state_impl(const File &output) const {
106 m_basal_yield_stress.write(output);
107 }
108
109 DiagnosticList YieldStress::diagnostics_impl() const {
110 return {{"tauc", Diagnostic::wrap(m_basal_yield_stress)}};
111 }
112
113 std::string YieldStress::name() const {
114 return m_name;
115 }
116
117 } // end of namespace pism