20 #include "pism/frontretreat/calving/HayhurstCalving.hh"
22 #include "pism/util/Grid.hh"
23 #include "pism/util/error_handling.hh"
24 #include "pism/util/array/CellType.hh"
31 m_calving_rate(grid,
"hayhurst_calving_rate")
34 .
long_name(
"horizontal calving rate due to Hayhurst calving")
42 "* Initializing the 'Hayhurst calving' mechanism...\n");
51 " Hayhurst calving threshold: %3.3f MPa.\n",
56 "-calving hayhurst_calving using a non-square grid cell is not implemented (yet);\n"
57 "dx = %f, dy = %f, relative difference = %f",
72 ice_density =
m_config->get_number(
"constants.ice.density"),
73 water_density =
m_config->get_number(
"constants.sea_water.density"),
74 gravity =
m_config->get_number(
"constants.standard_gravity"),
81 for (
auto pt =
m_grid->points(); pt; pt.next()) {
82 const int i = pt.i(), j = pt.j();
84 double water_depth = sea_level(i, j) - bed_elevation(i, j);
86 if (cell_type.
icy(i, j) and water_depth > 0.0) {
88 assert(ice_thickness(i, j) > 0);
90 double H = ice_thickness(i, j);
94 double omega = water_depth / H;
99 if (omega > ice_density / water_density) {
101 double freeboard = (1.0 - ice_density / water_density) * H;
102 H = water_depth + freeboard;
103 omega = water_depth / H;
107 double sigma_0 = (0.4 - 0.45 * pow(omega - 0.065, 2.0)) * ice_density * gravity * H;
114 (1.0 - pow(omega, 2.8)) *
127 for (
auto p =
m_grid->points(); p; p.next()) {
128 const int i = p.i(), j = p.j();
133 auto M = cell_type.
star(i, j);
const units::System::Ptr m_sys
unit system used by this component
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
A class defining a common interface for most PISM sub-models.
static Ptr wrap(const T &input)
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.
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.
bool next_to_ice(int i, int j) const
Ice-free margin (at least one of four neighbors has ice).
bool ice_free(int i, int j) const
bool icy(int i, int j) const
const array::Scalar & calving_rate() const
array::Scalar1 m_calving_rate
DiagnosticList diagnostics_impl() const
HayhurstCalving(std::shared_ptr< const Grid > grid)
void update(const array::CellType1 &cell_type, const array::Scalar &ice_thickness, const array::Scalar &sea_level, const array::Scalar &bed_elevation)
#define PISM_ERROR_LOCATION
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
double min(const array::Scalar &input)
Finds minimum over all the values in an array::Scalar object. Ignores ghosts.
bool icy(int M)
Ice-filled cell (grounded or floating).
double convert(System::Ptr system, double input, const std::string &spec1, const std::string &spec2)
Convert a quantity from unit1 to unit2.
std::map< std::string, Diagnostic::Ptr > DiagnosticList