19 #include "pism/coupler/frontalmelt/DischargeGiven.hh"
21 #include "pism/coupler/frontalmelt/FrontalMeltPhysics.hh"
22 #include "pism/coupler/util/options.hh"
23 #include "pism/geometry/Geometry.hh"
24 #include "pism/util/Grid.hh"
25 #include "pism/util/array/Forcing.hh"
28 namespace frontalmelt {
31 :
FrontalMelt(grid, nullptr), m_frontal_melt_rate(grid,
"frontal_melt_rate") {
38 m_log->message(2,
"* Initializing the frontal melt model\n"
52 unsigned int buffer_size =
m_config->get_number(
"input.forcing.buffer_size");
66 .long_name(
"potential temperature of the adjacent ocean")
72 .long_name(
"subglacial discharge")
74 .output_units(
"kg m-2 year-1");
104 &sea_level_elevation,
109 double water_density =
m_config->get_number(
"constants.fresh_water.density"),
110 seconds_per_day = 86400;
112 for (
auto p =
m_grid->points(); p; p.next()) {
113 const int i = p.i(), j = p.j();
115 if (cell_type.icy(i, j)) {
118 double TF = (*m_theta_ocean)(i, j);
127 double q_sg = ((*m_subglacial_discharge)(i, j) / water_density) * seconds_per_day;
129 double water_depth = sea_level_elevation(i, j) - bed_elevation(i, j);
145 for (
auto p =
m_grid->points(); p; p.next()) {
146 const int i = p.i(), j = p.j();
148 if (
apply(cell_type, i, j) and cell_type.ice_free(i, j)) {
151 auto M = cell_type.star_int(i, j);
178 return {dt.value(),
"frontal_melt discharge_given"};
181 return {
"frontal_melt discharge_given"};
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 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)
const array::Scalar & frontal_melt_rate_impl() const
MaxTimestep max_timestep_impl(double t) const
void update_impl(const FrontalMeltInputs &inputs, double t, double dt)
std::shared_ptr< array::Forcing > m_subglacial_discharge
DischargeGiven(std::shared_ptr< const Grid > g)
void initialize(const array::Scalar &theta, const array::Scalar &sgl)
std::shared_ptr< array::Forcing > m_theta_ocean
void init_impl(const Geometry &geometry)
array::Scalar1 m_frontal_melt_rate
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 min(const array::Scalar &input)
Finds minimum 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).