20 #include "pism/coupler/FrontalMelt.hh"
21 #include "pism/util/MaxTimestep.hh"
22 #include "pism/util/pism_utilities.hh"
23 #include "pism/geometry/Geometry.hh"
24 #include "pism/geometry/part_grid_threshold_thickness.hh"
25 #include "pism/util/Mask.hh"
35 namespace frontalmelt {
58 ice_density =
m_config->get_number(
"constants.ice.density"),
59 alpha = ice_density /
m_config->get_number(
"constants.sea_water.density");
62 &bed_elevation, &surface_elevation, &ice_thickness, &result};
66 for (
auto p =
m_grid->points(); p; p.next()) {
67 const int i = p.i(), j = p.j();
71 bed = bed_elevation(i, j),
72 sea_level = sea_level_elevation(i, j);
74 auto H = ice_thickness.star(i, j);
75 auto h = surface_elevation.star(i, j);
80 int m = gc.
mask(sea_level, bed, H_threshold);
100 m_input_model(input),
101 m_retreat_rate(m_grid,
"retreat_rate_due_to_frontal_melt") {
104 .
long_name(
"retreat rate due to frontal melt")
174 namespace diagnostics {
187 .long_name(
"frontal melt rate")
189 .output_units(
"m day-1");
190 m_vars[0][
"cell_methods"] =
"time: mean";
196 return model->frontal_melt_rate();
208 m_vars = { {
m_sys,
"frontal_melt_retreat_rate" } };
210 .long_name(
"retreat rate due to frontal melt")
212 .output_units(
"m year-1");
213 m_vars[0][
"cell_methods"] =
"time: mean";
215 m_vars[0][
"comment"] =
"takes into account what part of the front is submerged";
220 return model->retreat_rate();
230 {
"frontal_melt_retreat_rate",
Diagnostic::Ptr(
new FrontalMeltRetreatRate(
this))}
const Config::ConstPtr m_config
configuration database used by this component
const std::shared_ptr< const Grid > m_grid
grid used by this component
DiagnosticList diagnostics() const
A class defining a common interface for most PISM sub-models.
array::Scalar m_accumulator
double m_fill_value
fill value (used often enough to justify storing it)
const units::System::Ptr m_sys
the unit system
double to_internal(double x) const
std::vector< SpatialVariableMetadata > m_vars
metadata corresponding to NetCDF variables
std::shared_ptr< Diagnostic > Ptr
High-level PISM I/O class.
int mask(double sea_level, double bed, double thickness) const
array::Scalar1 sea_level_elevation
array::Scalar2 ice_surface_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...
void failed()
Indicates a failure of a parallel section.
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
bool next_to_ice(int i, int j) const
Ice-free margin (at least one of four neighbors has ice).
stencils::Star< int > star_int(int i, int j) const
bool next_to_grounded_ice(int i, int j) const
bool ice_free_ocean(int i, int j) const
bool grounded_ice(int i, int j) const
bool icy(int i, int j) const
virtual const array::Scalar & frontal_melt_rate_impl() const =0
virtual MaxTimestep max_timestep_impl(double t) const
void init(const Geometry &geometry)
void update(const FrontalMeltInputs &inputs, double t, double dt)
void compute_retreat_rate(const Geometry &geometry, const array::Scalar &frontal_melt_rate, array::Scalar &result) const
std::shared_ptr< FrontalMelt > m_input_model
virtual DiagnosticList diagnostics_impl() const
virtual void update_impl(const FrontalMeltInputs &inputs, double t, double dt)
const array::Scalar & retreat_rate() const
bool apply(const array::CellType1 &M, int i, int j) const
FrontalMelt(std::shared_ptr< const Grid > g, std::shared_ptr< FrontalMelt > input)
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
const array::Scalar & frontal_melt_rate() const
virtual TSDiagnosticList ts_diagnostics_impl() const
bool m_include_floating_ice
virtual void init_impl(const Geometry &geometry)
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
array::Scalar m_retreat_rate
A very rudimentary PISM frontal melt model.
const array::Scalar & model_input()
FrontalMeltRate(const FrontalMelt *m)
Report frontal melt rate.
FrontalMeltRetreatRate(const FrontalMelt *m)
const array::Scalar & model_input()
Report retreat rate due to frontal melt.
#define PISM_ERROR_LOCATION
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
bool grounded(int M)
Grounded cell (grounded ice or ice-free).
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
std::map< std::string, Diagnostic::Ptr > DiagnosticList
double part_grid_threshold_thickness(stencils::Star< int > cell_type, stencils::Star< double > ice_thickness, stencils::Star< double > surface_elevation, double bed_elevation)
Compute threshold thickness used when deciding if a partially-filled cell should be considered 'full'...
T combine(const T &a, const T &b)