19 #include "pism/coupler/frontalmelt/DischargeRouting.hh"
21 #include "pism/util/Grid.hh"
22 #include "pism/geometry/Geometry.hh"
23 #include "pism/coupler/util/options.hh"
24 #include "pism/coupler/frontalmelt/FrontalMeltPhysics.hh"
25 #include "pism/util/array/Forcing.hh"
28 namespace frontalmelt {
32 m_frontal_melt_rate(grid,
"frontal_melt_rate") {
39 m_log->message(2,
"* Initializing the frontal melt model\n"
40 " using the Rignot/Xu parameterization\n"
41 " and routing of subglacial discharge\n");
52 unsigned int buffer_size =
m_config->get_number(
"input.forcing.buffer_size");
62 .long_name(
"potential temperature of the adjacent ocean")
92 double seconds_per_day = 86400, grid_spacing = 0.5 * (
m_grid->dx() +
m_grid->dy());
94 for (
auto p =
m_grid->points(); p; p.next()) {
95 const int i = p.i(), j = p.j();
97 if (cell_type.icy(i, j)) {
100 double TF = (*m_theta_ocean)(i, j);
102 double water_depth =
std::max(sea_level_elevation(i, j) - bed_elevation(i, j), 0.0),
103 submerged_front_area = water_depth * grid_spacing;
113 double Q_sg = water_flux(i, j) * grid_spacing;
114 double q_sg = Q_sg / submerged_front_area * seconds_per_day;
130 for (
auto p =
m_grid->points(); p; p.next()) {
131 const int i = p.i(), j = p.j();
133 if (
apply(cell_type, i, j) and cell_type.ice_free(i, j)) {
136 auto M = cell_type.star_int(i, j);
163 return {dt.value(),
"frontal_melt routing"};
166 return {
"frontal_melt routing"};
std::shared_ptr< const Grid > grid() const
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
High-level PISM I/O class.
array::Scalar1 sea_level_elevation
array::CellType2 cell_type
array::Scalar2 ice_thickness
array::Scalar2 bed_elevation
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
stencils::Star< T > star(int i, int j) const
void update_ghosts()
Updates ghost points.
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
static std::shared_ptr< Forcing > Constant(std::shared_ptr< const Grid > grid, const std::string &short_name, double value)
void update_impl(const FrontalMeltInputs &inputs, double t, double dt)
MaxTimestep max_timestep_impl(double t) const
DischargeRouting(std::shared_ptr< const Grid > g)
array::Scalar1 m_frontal_melt_rate
const array::Scalar & frontal_melt_rate_impl() const
void init_impl(const Geometry &geometry)
void initialize(const array::Scalar &theta)
std::shared_ptr< array::Forcing > m_theta_ocean
double frontal_melt_from_undercutting(double ice_thickness, double discharge_flux, double potential_temperature) const
bool apply(const array::CellType1 &M, int i, int j) const
bool m_include_floating_ice
A very rudimentary PISM frontal melt model.
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
@ PISM_READONLY
open an existing file for reading only
bool icy(int M)
Ice-filled cell (grounded or floating).