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"
26#include "pism/util/Logger.hh"
27#include "pism/util/io/IO_Flags.hh"
30namespace frontalmelt {
33 :
FrontalMelt(grid, nullptr), m_frontal_melt_rate(grid,
"frontal_melt_rate") {
40 m_log->message(2,
"* Initializing the frontal melt model\n"
54 unsigned int buffer_size =
m_config->get_number(
"input.forcing.buffer_size");
68 .long_name(
"potential temperature of the adjacent ocean")
69 .units(
"degree_Celsius");
74 .long_name(
"subglacial discharge")
75 .units(
"kg m^-2 s^-1")
76 .output_units(
"kg m^-2 year^-1");
106 &sea_level_elevation,
111 double water_density =
m_config->get_number(
"constants.fresh_water.density"),
112 seconds_per_day = 86400;
114 for (
auto p :
m_grid->points()) {
115 const int i = p.i(), j = p.j();
117 if (cell_type.icy(i, j)) {
120 double TF = (*m_theta_ocean)(i, j);
129 double q_sg = ((*m_subglacial_discharge)(i, j) / water_density) * seconds_per_day;
131 double water_depth = sea_level_elevation(i, j) - bed_elevation(i, j);
147 for (
auto p :
m_grid->points()) {
148 const int i = p.i(), j = p.j();
150 if (
apply(cell_type, i, j) and cell_type.ice_free(i, j)) {
153 auto M = cell_type.star_int(i, j);
180 return {dt.value(),
"frontal_melt discharge_given"};
183 return {
"frontal_melt discharge_given"};
std::shared_ptr< const Grid > grid() const
std::shared_ptr< const Config > m_config
configuration database used by this component
const std::shared_ptr< const Grid > m_grid
grid used by this component
std::shared_ptr< const Logger > m_log
logger (for easy access)
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.
VariableMetadata & metadata(unsigned int N=0)
Returns a reference to the VariableMetadata 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.
@ PISM_READONLY
open an existing file for reading only
bool icy(int M)
Ice-filled cell (grounded or floating).