19 #include "pism/earth/BedDef.hh"
20 #include "pism/util/Grid.hh"
21 #include "pism/util/ConfigInterface.hh"
22 #include "pism/util/Context.hh"
29 m_wide_stencil(m_config->get_number(
"grid.max_stencil_width")),
30 m_topg(m_grid,
"topg"),
31 m_topg_last(m_grid,
"topg"),
32 m_uplift(m_grid,
"dbdt")
78 this->
init_impl(opts, ice_thickness, sea_level_elevation);
85 this->
bootstrap_impl(bed_elevation, bed_uplift, ice_thickness, sea_level_elevation);
96 (void)sea_level_elevation;
100 double t,
double dt) {
101 this->
update_impl(ice_thickness, sea_level_elevation, t, dt);
108 (void)sea_level_elevation;
113 m_log->message(2,
" reading bed topography and uplift from %s ... \n",
137 std::string uplift_file =
m_config->get_string(
"bed_deformation.bed_uplift_file");
138 if (not uplift_file.empty()) {
139 m_log->message(2,
" reading bed uplift from %s ... \n", uplift_file.c_str());
143 std::string correction_file =
m_config->get_string(
"bed_deformation.bed_topography_delta_file");
144 if (not correction_file.empty()) {
156 m_log->message(2,
" Adding a bed topography correction read in from %s...\n", filename.c_str());
169 bed.
add(-1, bed_last, result);
171 result.
scale(1.0 / dt);
174 double compute_load(
double bed,
double ice_thickness,
double sea_level,
175 double ice_density,
double ocean_density) {
178 ice_load = ice_thickness,
179 ocean_depth =
std::max(sea_level - bed, 0.0),
180 ocean_load = (ocean_density / ice_density) * ocean_depth;
183 return ice_load > ocean_load ? ice_load : 0.0;
197 ice_density = config->get_number(
"constants.ice.density"),
198 ocean_density = config->get_number(
"constants.sea_water.density");
200 array::AccessScope list{&bed_elevation, &ice_thickness, &sea_level_elevation, &result};
202 for (
auto p = result.
grid()->points(); p; p.next()) {
203 const int i = p.i(), j = p.j();
207 sea_level_elevation(i, j),
208 ice_density, ocean_density);
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
const std::shared_ptr< const Grid > m_grid
grid used by this component
void regrid(const std::string &module_name, array::Array &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS)
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.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void copy_from(const Array2D< T > &source)
void add(double alpha, const Array2D< T > &x)
void read(const std::string &filename, unsigned int time)
void define(const File &file, io::Type default_type) const
Define variables corresponding to an Array in a file opened using file.
void write(const std::string &filename) const
void scale(double alpha)
Result: v <- v * alpha. Calls VecScale.
std::shared_ptr< const Grid > grid() const
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.
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
virtual DiagnosticList diagnostics_impl() const
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
virtual void bootstrap_impl(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
virtual void update_impl(const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double t, double dt)=0
void init(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
array::Scalar2 m_topg_last
bed elevation at the time of the last update
void update(const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double t, double dt)
void bootstrap(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize using provided bed elevation and uplift.
array::Scalar2 m_topg
current bed elevation
virtual void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize from the context (input file and the "variables" database).
BedDef(std::shared_ptr< const Grid > g)
virtual void apply_topg_offset(const std::string &filename)
array::Scalar m_uplift
bed uplift rate
const array::Scalar & uplift() const
const array::Scalar & bed_elevation() const
void compute_uplift(const array::Scalar &bed, const array::Scalar &bed_last, double dt, array::Scalar &result)
Compute bed uplift (dt is in seconds).
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
double compute_load(double bed, double ice_thickness, double sea_level, double ice_density, double ocean_density)
std::map< std::string, Diagnostic::Ptr > DiagnosticList