20 #include "pism/util/pism_utilities.hh"
21 #include "pism/util/Time.hh"
22 #include "pism/util/Vars.hh"
23 #include "pism/util/IceGrid.hh"
24 #include "pism/util/ConfigInterface.hh"
25 #include "pism/util/Context.hh"
32 m_wide_stencil(m_config->get_number(
"grid.max_stencil_width")),
33 m_topg(m_grid,
"topg",
WITH_GHOSTS, m_wide_stencil),
34 m_topg_last(m_grid,
"topg",
WITH_GHOSTS, m_wide_stencil),
39 "m",
"m",
"bedrock_altitude", 0);
42 "m",
"m",
"bedrock_altitude", 0);
45 "m s-1",
"mm year-1",
"tendency_of_bedrock_altitude", 0);
78 this->
init_impl(opts, ice_thickness, sea_level_elevation);
86 this->
bootstrap_impl(bed_elevation, bed_uplift, ice_thickness, sea_level_elevation);
98 (void) sea_level_elevation;
103 double t,
double dt) {
104 this->
update_impl(ice_thickness, sea_level_elevation, t, dt);
110 (void) ice_thickness;
111 (void) sea_level_elevation;
117 " reading bed topography and uplift from %s ... \n",
126 m_config->get_number(
"bootstrapping.defaults.bed"));
128 m_config->get_number(
"bootstrapping.defaults.uplift"));
143 std::string uplift_file =
m_config->get_string(
"bed_deformation.bed_uplift_file");
144 if (not uplift_file.empty()) {
146 " reading bed uplift from %s ... \n",
147 uplift_file.c_str());
151 std::string correction_file =
m_config->get_string(
"bed_deformation.bed_topography_delta_file");
152 if (not correction_file.empty()) {
164 m_log->message(2,
" Adding a bed topography correction read in from %s...\n",
168 topg_delta.
set_attrs(
"internal",
"bed topography correction",
169 "meters",
"meters",
"", 0);
179 bed.
add(-1, bed_last, result);
181 result.
scale(1.0 / dt);
184 double compute_load(
double bed,
double ice_thickness,
double sea_level,
185 double ice_density,
double ocean_density) {
188 ice_load = ice_thickness,
189 ocean_depth =
std::max(sea_level - bed, 0.0),
190 ocean_load = (ocean_density / ice_density) * ocean_depth;
193 return ice_load > ocean_load ? ice_load : 0.0;
207 ice_density = config->get_number(
"constants.ice.density"),
208 ocean_density = config->get_number(
"constants.sea_water.density");
213 const int i = p.i(), j = p.j();
217 sea_level_elevation(i, j),
218 ice_density, ocean_density);
Makes sure that we call begin_access() and end_access() for all accessed IceModelVecs.
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
virtual void regrid(const std::string &module_name, IceModelVec &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS)
const IceGrid::ConstPtr m_grid
grid used by this component
A class defining a common interface for most PISM sub-models.
std::shared_ptr< const Config > ConstPtr
static Ptr wrap(const T &input)
High-level PISM I/O class.
std::shared_ptr< const IceGrid > ConstPtr
void add(double alpha, const IceModelVec2S &x)
void copy_from(const IceModelVec2S &source)
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.
void regrid(const std::string &filename, RegriddingFlag flag, double default_value=0.0)
void scale(double alpha)
Result: v <- v * alpha. Calls VecScale.
void read(const std::string &filename, unsigned int time)
IceGrid::ConstPtr grid() const
void define(const File &file, IO_Type default_type=PISM_DOUBLE) const
Define variables corresponding to an IceModelVec in a file opened using file.
void write(const std::string &filename) const
virtual void init_impl(const InputOptions &opts, const IceModelVec2S &ice_thickness, const IceModelVec2S &sea_level_elevation)
Initialize from the context (input file and the "variables" database).
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
virtual DiagnosticList diagnostics_impl() const
void update(const IceModelVec2S &ice_thickness, const IceModelVec2S &sea_level_elevation, double t, double dt)
const IceModelVec2S & uplift() const
virtual void update_impl(const IceModelVec2S &ice_thickness, const IceModelVec2S &sea_level_elevation, double t, double dt)=0
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
IceModelVec2S m_topg
current bed elevation
void init(const InputOptions &opts, const IceModelVec2S &ice_thickness, const IceModelVec2S &sea_level_elevation)
BedDef(IceGrid::ConstPtr g)
virtual void bootstrap_impl(const IceModelVec2S &bed_elevation, const IceModelVec2S &bed_uplift, const IceModelVec2S &ice_thickness, const IceModelVec2S &sea_level_elevation)
void compute_uplift(const IceModelVec2S &bed, const IceModelVec2S &bed_last, double dt, IceModelVec2S &result)
Compute bed uplift (dt is in seconds).
IceModelVec2S m_uplift
bed uplift rate
IceModelVec2S m_topg_last
bed elevation at the time of the last update
virtual void apply_topg_offset(const std::string &filename)
const IceModelVec2S & bed_elevation() const
void bootstrap(const IceModelVec2S &bed_elevation, const IceModelVec2S &bed_uplift, const IceModelVec2S &ice_thickness, const IceModelVec2S &sea_level_elevation)
Initialize using provided bed elevation and uplift.
double compute_load(double bed, double ice_thickness, double sea_level, double ice_density, double ocean_density)
double max(const IceModelVec2S &input)
Finds maximum over all the values in an IceModelVec2S object. Ignores ghosts.
std::map< std::string, Diagnostic::Ptr > DiagnosticList