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"
25#include "pism/util/Logger.hh"
32 m_calving_rate(grid,
"hayhurst_calving_rate")
35 .
long_name(
"horizontal calving rate due to Hayhurst calving")
43 "* Initializing the 'Hayhurst calving' mechanism...\n");
52 " Hayhurst calving threshold: %3.3f MPa.\n",
57 "-calving hayhurst_calving using a non-square grid cell is not implemented (yet);\n"
58 "dx = %f, dy = %f, relative difference = %f",
73 ice_density =
m_config->get_number(
"constants.ice.density"),
74 water_density =
m_config->get_number(
"constants.sea_water.density"),
75 gravity =
m_config->get_number(
"constants.standard_gravity"),
77 unit_scaling = pow(1e-6,
m_exponent_r) * convert(
m_sys, 1.0,
"m year-1",
"m second-1");
82 for (
auto pt :
m_grid->points()) {
83 const int i = pt.i(), j = pt.j();
85 double water_depth = sea_level(i, j) - bed_elevation(i, j);
87 if (cell_type.
icy(i, j) and water_depth > 0.0) {
89 assert(ice_thickness(i, j) > 0);
91 double H = ice_thickness(i, j);
95 double omega = water_depth / H;
100 if (omega > ice_density / water_density) {
102 double freeboard = (1.0 - ice_density / water_density) * H;
103 H = water_depth + freeboard;
104 omega = water_depth / H;
108 double sigma_0 = (0.4 - 0.45 * pow(omega - 0.065, 2.0)) * ice_density * gravity * H;
115 (1.0 - pow(omega, 2.8)) *
128 for (
auto p :
m_grid->points()) {
129 const int i = p.i(), j = p.j();
134 auto M = cell_type.
star(i, j);
const units::System::Ptr m_sys
unit system used by this component
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)
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.
VariableMetadata & metadata(unsigned int N=0)
Returns a reference to the VariableMetadata 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 spatial_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
bool icy(int M)
Ice-filled cell (grounded or floating).
std::map< std::string, Diagnostic::Ptr > DiagnosticList