20 #include "pism/coupler/surface/NoGLRetreat.hh"
22 #include "pism/geometry/Geometry.hh"
23 #include "pism/util/Diagnostic.hh"
24 #include "pism/util/pism_utilities.hh"
30 std::shared_ptr<SurfaceModel> input)
32 m_smb_adjustment(grid,
"smb_adjustment"),
33 m_min_ice_thickness(grid,
"minimum_ice_thickness") {
47 "* Initializing a SMB adjustment preventing grounding line retreat...\n");
53 double rho_i =
m_config->get_number(
"constants.ice.density");
54 double rho_w =
m_config->get_number(
"constants.sea_water.density");
55 double eps =
m_config->get_number(
"geometry.ice_free_thickness_standard");
60 for (
auto p =
m_grid->points(); p; p.next()) {
61 const int i = p.i(), j = p.j();
64 if (sea_level(i, j) > bed(i, j)) {
66 H_min = (sea_level(i, j) - bed(i, j)) * (rho_w / rho_i) + eps;
70 if (ice_thickness(i, j) < H_min) {
87 double rho_i =
m_config->get_number(
"constants.ice.density");
95 for (
auto p =
m_grid->points(); p; p.next()) {
96 const int i = p.i(), j = p.j();
99 double SMB_new = SMB_old;
103 double H = ice_thickness(i, j);
104 double dH =
mass_flux(i, j) * (dt / rho_i);
105 double H_new = H + dH;
107 if (H_min > 0.0 and H_new < H_min) {
108 SMB_new = (H_min - H) * (rho_i / dt);
111 (*m_mass_flux)(i, j) = SMB_new;
140 namespace diagnostics {
147 "no_gl_retreat_smb_adjustment",
152 m_vars = { {
m_sys,
"no_gl_retreat_smb_adjustment" } };
154 .long_name(
"SMB adjustment needed to maintain grounded ice extent")
156 .output_units(
"kg m-2 year-1");
157 m_vars[0][
"cell_methods"] =
"time: mean";
163 return model->smb_adjustment();
170 return combine({{
"no_gl_retreat_smb_adjustment",
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
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
array::Scalar1 sea_level_elevation
array::Scalar2 ice_thickness
array::Scalar2 bed_elevation
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.
DiagnosticList diagnostics_impl() const
array::Scalar m_min_ice_thickness
std::shared_ptr< array::Scalar > m_mass_flux
NoGLRetreat(std::shared_ptr< const Grid > g, std::shared_ptr< SurfaceModel > input)
const array::Scalar & runoff_impl() const
const array::Scalar & melt_impl() const
void update_impl(const Geometry &geometry, double t, double dt)
const array::Scalar & accumulation_impl() const
const array::Scalar & mass_flux_impl() const
array::Scalar m_smb_adjustment
const array::Scalar & smb_adjustment() const
void init_impl(const Geometry &geometry)
static std::shared_ptr< array::Scalar > allocate_runoff(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_mass_flux(std::shared_ptr< const Grid > grid)
void dummy_accumulation(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< array::Scalar > m_melt
const array::Scalar & mass_flux() const
static std::shared_ptr< array::Scalar > allocate_accumulation(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_melt(std::shared_ptr< const Grid > grid)
std::shared_ptr< array::Scalar > m_runoff
void dummy_melt(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< SurfaceModel > m_input_model
std::shared_ptr< array::Scalar > m_accumulation
void dummy_runoff(const array::Scalar &smb, array::Scalar &result)
The interface of PISM's surface models.
const array::Scalar & model_input()
SMBAdjustment(const NoGLRetreat *m)
std::map< std::string, Diagnostic::Ptr > DiagnosticList
T combine(const T &a, const T &b)