PISM, A Parallel Ice Sheet Model 2.2.1-cd005eec8 committed by Constantine Khrulev on 2025-03-07
Loading...
Searching...
No Matches
EnergyModel.hh
Go to the documentation of this file.
1/* Copyright (C) 2016, 2017, 2018, 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#ifndef ENERGYMODEL_H
21#define ENERGYMODEL_H
22
23#include "pism/util/Component.hh"
24
25#include "pism/util/array/Scalar.hh"
26#include "pism/util/array/Array3D.hh"
27#include "pism/util/array/CellType.hh"
28#include <memory>
29
30namespace pism {
31
32namespace stressbalance {
33class StressBalance;
34}
35
36namespace energy {
37
60
62public:
64
66
67 void sum(MPI_Comm com);
68
69 unsigned int bulge_counter;
73};
74
75class EnergyModel : public Component {
76public:
77 EnergyModel(std::shared_ptr<const Grid> grid,
78 std::shared_ptr<const stressbalance::StressBalance> stress_balance);
79
80 void restart(const File &input_file, int record);
81
82 /*! @brief Bootstrapping using heuristics. */
83 /*!
84 * Bootstrap by reading 2d fields (currently the basal melt rate) from a file and filling 3D
85 * fields using heuristics.
86 */
87 void bootstrap(const File &input_file,
88 const array::Scalar &ice_thickness,
89 const array::Scalar &surface_temperature,
90 const array::Scalar &climatic_mass_balance,
91 const array::Scalar &basal_heat_flux);
92
93 /*! @brief Initialize using formulas (for runs using synthetic data). */
95 const array::Scalar &ice_thickness,
96 const array::Scalar &surface_temperature,
97 const array::Scalar &climatic_mass_balance,
98 const array::Scalar &basal_heat_flux);
99
100 void update(double t, double dt, const Inputs &inputs);
101
102 const EnergyModelStats& stats() const;
103
104 const array::Array3D & enthalpy() const;
105 const array::Scalar & basal_melt_rate() const;
106
107 const std::string& stdout_flags() const;
108protected:
109
110 virtual MaxTimestep max_timestep_impl(double t) const;
111
112 virtual void restart_impl(const File &input_file, int record) = 0;
113
114 virtual void bootstrap_impl(const File &input_file,
115 const array::Scalar &ice_thickness,
116 const array::Scalar &surface_temperature,
117 const array::Scalar &climatic_mass_balance,
118 const array::Scalar &basal_heat_flux) = 0;
119
121 const array::Scalar &ice_thickness,
122 const array::Scalar &surface_temperature,
123 const array::Scalar &climatic_mass_balance,
124 const array::Scalar &basal_heat_flux) = 0;
125
126 virtual void update_impl(double t, double dt, const Inputs &inputs) = 0;
127
128 virtual void define_model_state_impl(const File &output) const = 0;
129 virtual void write_model_state_impl(const File &output) const = 0;
130
131 virtual DiagnosticList diagnostics_impl() const;
133
134 /*! @brief Initialize enthalpy by reading it from a file, or by reading temperature and liquid
135 water fraction, or by reading the temperature field alone. */
136 void init_enthalpy(const File &input_file, bool regrid, int record);
137
138 /*! @brief Regrid enthalpy from the -regrid_file. */
139 void regrid_enthalpy();
140protected:
144
146
147private:
148 std::string m_stdout_flags;
149 std::shared_ptr<const stressbalance::StressBalance> m_stress_balance;
150};
151
152/*!
153 * Return true if the grid point (i,j) is near the margin of the ice.
154 */
155bool marginal(const array::Scalar1 &thickness, int i, int j, double threshold);
156
157} // end of namespace energy
158} // end of namespace pism
159
160
161#endif /* ENERGYMODEL_H */
std::shared_ptr< const Grid > grid() const
Definition Component.cc:105
void regrid(const std::string &module_name, array::Array &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS)
Definition Component.cc:159
A class defining a common interface for most PISM sub-models.
Definition Component.hh:118
High-level PISM I/O class.
Definition File.hh:55
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
A virtual class collecting methods common to ice and bedrock 3D fields.
Definition Array3D.hh:33
"Cell type" mask. Adds convenience methods to array::Scalar.
Definition CellType.hh:30
EnergyModelStats & operator+=(const EnergyModelStats &other)
void init_enthalpy(const File &input_file, bool regrid, int record)
Initialize enthalpy by reading it from a file, or by reading temperature and liquid water fraction,...
const EnergyModelStats & stats() const
void update(double t, double dt, const Inputs &inputs)
const array::Array3D & enthalpy() const
void bootstrap(const File &input_file, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)
Bootstrapping using heuristics.
void initialize(const array::Scalar &basal_melt_rate, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)
Initialize using formulas (for runs using synthetic data).
virtual MaxTimestep max_timestep_impl(double t) const
EnergyModelStats m_stats
virtual void define_model_state_impl(const File &output) const =0
The default (empty implementation).
std::shared_ptr< const stressbalance::StressBalance > m_stress_balance
const std::string & stdout_flags() const
virtual void initialize_impl(const array::Scalar &basal_melt_rate, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)=0
void restart(const File &input_file, int record)
virtual void restart_impl(const File &input_file, int record)=0
virtual DiagnosticList diagnostics_impl() const
const array::Scalar & basal_melt_rate() const
Basal melt rate in grounded areas. (It is set to zero elsewhere.)
array::Array3D m_ice_enthalpy
virtual void bootstrap_impl(const File &input_file, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)=0
virtual void write_model_state_impl(const File &output) const =0
The default (empty implementation).
virtual void update_impl(double t, double dt, const Inputs &inputs)=0
virtual TSDiagnosticList ts_diagnostics_impl() const
array::Scalar m_basal_melt_rate
void regrid_enthalpy()
Regrid enthalpy from the -regrid_file.
const array::Scalar * surface_liquid_fraction
const array::Scalar1 * ice_thickness
const array::Array3D * w3
const array::Array3D * v3
const array::Scalar * shelf_base_temp
const array::Scalar * basal_heat_flux
const array::Scalar * basal_frictional_heating
const array::Scalar * till_water_thickness
const array::Scalar * no_model_mask
const array::Array3D * u3
const array::Scalar * surface_temp
const array::CellType * cell_type
const array::Array3D * volumetric_heating_rate
bool marginal(const array::Scalar1 &thickness, int i, int j, double threshold)
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
std::map< std::string, Diagnostic::Ptr > DiagnosticList