20 #include "pism/regional/IceRegionalModel.hh"
21 #include "pism/coupler/SurfaceModel.hh"
22 #include "pism/energy/BedThermalUnit.hh"
23 #include "pism/energy/CHSystem.hh"
24 #include "pism/energy/utilities.hh"
25 #include "pism/hydrology/Hydrology.hh"
26 #include "pism/regional/EnthalpyModel_Regional.hh"
27 #include "pism/regional/RegionalYieldStress.hh"
28 #include "pism/stressbalance/StressBalance.hh"
29 #include "pism/util/array/Forcing.hh"
30 #include "pism/util/io/File.hh"
36 m_no_model_mask(m_grid,
"no_model_mask"),
37 m_usurf_stored(m_grid,
"usurfstore"),
38 m_thk_stored(m_grid,
"thkstore") {
41 if (
m_config->get_flag(
"energy.ch_warming.enabled")) {
52 m_log->message(2,
" creating IceRegionalModel vecs ...\n");
56 .
long_name(
"mask: zeros (modeling domain) and ones (no-model buffer near grid edges)")
67 "saved surface elevation for use to keep surface gradient constant in no_model strip")
72 .
long_name(
"saved ice thickness for use to keep driving stress constant in no_model strip")
91 if (
m_config->get_flag(
"regional.zero_gradient")) {
105 std::unique_ptr<File> input_file;
107 if (use_input_file) {
111 switch (input.
type) {
138 m_log->message(2,
"# Allocating the geometry evolution model (regional version)...\n");
151 m_log->message(2,
"# Allocating an energy balance model...\n");
153 if (
m_config->get_flag(
"energy.enabled")) {
154 if (
m_config->get_flag(
"energy.temperature_based")) {
156 "pismr -regional does not support the '-energy cold' mode.");
166 if (
m_config->get_flag(
"energy.ch_warming.enabled") and
169 m_log->message(2,
"# Allocating the cryo-hydrologic warming model...\n");
182 bool regional =
true;
224 double strip_width =
m_config->get_number(
"regional.no_model_strip",
"meters");
232 if (
m_config->get_flag(
"stress_balance.ssa.dirichlet_bc")) {
236 for (
auto p =
m_grid->points(); p; p.next()) {
237 const int i = p.i(), j = p.j();
275 m_config->get_number(
"energy.ch_warming.average_channel_spacing"),
318 m_vars[0].long_name(
"temperature of the cryo-hydrologic system").units(
"Kelvin");
329 result->metadata(0) =
m_vars[0];
344 m_vars[0].long_name(
"liquid water fraction in the cryo-hydrologic system").units(
"1");
355 result->metadata(0) =
m_vars[0];
369 m_vars[0].long_name(
"rate of cryo-hydrologic warming").units(
"W m-3");
376 result->metadata(0) =
m_vars[0];
379 m_config->get_number(
"energy.ch_warming.average_channel_spacing"),
414 }
else if (
m_config->get_flag(
"hydrology.surface_input_from_runoff")) {
std::shared_ptr< array::Array > compute_impl() const
CHHeatFlux(const IceRegionalModel *m)
Report rate of cryo-hydrologic warming.
std::shared_ptr< array::Array > compute_impl() const
CHLiquidWaterFraction(const IceRegionalModel *m)
Report liquid water fraction in the cryo-hydrologic system.
CHTemperature(const IceRegionalModel *m)
std::shared_ptr< array::Array > compute_impl() const
Report temperature of the cryo-hydrologic system.
const IceRegionalModel * model
A template derived from Diagnostic, adding a "Model".
const units::System::Ptr m_sys
the unit system
std::vector< SpatialVariableMetadata > m_vars
metadata corresponding to NetCDF variables
std::shared_ptr< Diagnostic > Ptr
std::shared_ptr< const Grid > m_grid
the grid
const Config::ConstPtr m_config
Configuration flags and parameters.
VariableLookupData find_variable(const std::string &short_name, const std::string &std_name) const
Find a variable using its standard name and/or short name.
High-level PISM I/O class.
array::Scalar2 ice_surface_elevation
array::Scalar2 ice_thickness
std::map< std::string, const Component * > m_submodels
the list of sub-models, for writing model states and obtaining diagnostics
virtual energy::Inputs energy_model_inputs()
const Geometry & geometry() const
virtual void model_state_setup()
Sets the starting values of model state variables.
std::shared_ptr< stressbalance::StressBalance > m_stress_balance
virtual void energy_step()
Manage the solution of the energy equation, and related parallel communication.
std::shared_ptr< surface::SurfaceModel > m_surface
const Config::Ptr m_config
Configuration flags and parameters.
virtual stressbalance::Inputs stress_balance_inputs()
virtual void bootstrap_2d(const File &input_file)
const Time::Ptr m_time
Time manager.
std::shared_ptr< YieldStress > m_basal_yield_stress_model
array::Scalar m_basal_melt_rate
rate of production of basal meltwater (ice-equivalent); no ghosts
const std::shared_ptr< Context > m_ctx
Execution context.
const Logger::Ptr m_log
Logger.
std::shared_ptr< array::Forcing > m_surface_input_for_hydrology
const energy::EnergyModel * energy_balance_model() const
std::vector< std::shared_ptr< array::Scalar2 > > m_work2d
virtual void allocate_storage()
Allocate all Arrays defined in IceModel.
array::Scalar2 m_velocity_bc_mask
mask to determine Dirichlet boundary locations for the sliding velocity
virtual void allocate_basal_yield_stress()
Decide which basal yield stress model to use.
std::string m_stdout_flags
std::unique_ptr< GeometryEvolution > m_geometry_evolution
virtual void bedrock_thermal_model_step()
std::shared_ptr< energy::BedThermalUnit > m_btu
std::set< array::Array * > m_model_state
array::Scalar1 m_ice_thickness_bc_mask
Mask prescribing locations where ice thickness is held constant.
double t_TempAge
time of last update for enthalpy/temperature
std::map< std::string, Diagnostic::Ptr > m_diagnostics
Requested spatially-variable diagnostics.
virtual YieldStressInputs yield_stress_inputs()
virtual void init_diagnostics()
std::unique_ptr< hydrology::Hydrology > m_subglacial_hydrology
double dt_TempAge
enthalpy/temperature and age time-steps
double m_dt
mass continuity time step, s
std::shared_ptr< energy::EnergyModel > m_energy_model
const std::shared_ptr< Grid > m_grid
Computational grid.
void allocate_energy_model()
energy::Inputs energy_model_inputs()
void energy_step()
Manage the solution of the energy equation, and related parallel communication.
void allocate_stressbalance()
Decide which stress balance model to use.
void allocate_storage()
Allocate all Arrays defined in IceModel.
const energy::CHSystem * cryo_hydrologic_system() const
void allocate_basal_yield_stress()
Decide which basal yield stress model to use.
void allocate_geometry_evolution()
array::Scalar2 m_usurf_stored
std::shared_ptr< array::Array3D > m_ch_warming_flux
void model_state_setup()
Sets the starting values of model state variables.
stressbalance::Inputs stress_balance_inputs()
IceRegionalModel(std::shared_ptr< Grid > g, std::shared_ptr< Context > c)
array::Scalar2 m_no_model_mask
array::Scalar1 m_thk_stored
virtual void bootstrap_2d(const File &input_file)
Bootstrap a "regional" model.
std::shared_ptr< energy::CHSystem > m_ch_system
YieldStressInputs yield_stress_inputs()
A version of the PISM core class (IceModel) which knows about the no_model_mask and its semantics.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void copy_from(const Array2D< T > &source)
A virtual class collecting methods common to ice and bedrock 3D fields.
void set_interpolation_type(InterpolationType type)
void scale(double alpha)
Result: v <- v * alpha. Calls VecScale.
void set(double c)
Result: v[j] <- c for all j.
void regrid(const std::string &filename, io::Default default_value)
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
const array::Array3D & enthalpy() const
#define PISM_ERROR_LOCATION
void compute_magnitude(const array::Vector &input, array::Scalar &result)
void compute_liquid_water_fraction(const array::Array3D &enthalpy, const array::Scalar &ice_thickness, array::Array3D &result)
Compute the liquid fraction corresponding to enthalpy and ice_thickness.
void cryo_hydrologic_warming_flux(double k, double R, const array::Scalar &ice_thickness, const array::Array3D &ice_enthalpy, const array::Array3D &ch_enthalpy, array::Array3D &result)
void compute_temperature(const array::Array3D &enthalpy, const array::Scalar &ice_thickness, array::Array3D &result)
@ PISM_READONLY
open an existing file for reading only
std::shared_ptr< StressBalance > create(const std::string &model, std::shared_ptr< const Grid > grid, bool regional)
void set_no_model_strip(const Grid &grid, double width, array::Scalar &result)
Set no_model_mask variable to have value 1 in strip of width 'strip' m around edge of computational d...
InputOptions process_input_options(MPI_Comm com, Config::ConstPtr config)