20 #include <gsl/gsl_math.h>
22 #include "pism/coupler/OceanModel.hh"
23 #include "pism/util/MaxTimestep.hh"
24 #include "pism/util/pism_utilities.hh"
25 #include "pism/geometry/Geometry.hh"
32 auto result = std::make_shared<array::Scalar>(
g,
"shelfbtemp");
34 .long_name(
"ice temperature at the bottom of floating ice")
40 auto result = std::make_shared<array::Scalar>(
g,
"shelfbmassflux");
43 .long_name(
"shelf base mass flux")
45 .output_units(
"kg m-2 year-1");
50 auto result = std::make_shared<array::Scalar>(
g,
"average_water_column_pressure");
52 result->metadata(0).long_name(
"vertically-averaged water column pressure").units(
"Pa");
80 double ice_density =
m_config->get_number(
"constants.ice.density"),
81 water_density =
m_config->get_number(
"constants.sea_water.density"),
82 g =
m_config->get_number(
"constants.standard_gravity");
157 namespace diagnostics {
164 m_vars[0].long_name(
"ice temperature at the basal surface of ice shelves").units(
"Kelvin");
169 auto result = allocate<array::Scalar>(
"shelfbtemp");
171 result->copy_from(
model->shelf_base_temperature());
183 m_vars[0].long_name(
"mass flux at the basal surface of ice shelves").units(
"kg m-2 s-1");
188 auto result = allocate<array::Scalar>(
"shelfbmassflux");
190 result->copy_from(
model->shelf_base_mass_flux());
229 for (
auto p =
grid->points(); p; p.next()) {
230 const int i = p.i(), j = p.j();
std::shared_ptr< const Grid > grid() const
const Config::ConstPtr m_config
configuration database used by this component
DiagnosticList diagnostics() const
A class defining a common interface for most PISM sub-models.
A template derived from Diagnostic, adding a "Model".
const units::System::Ptr m_sys
the unit system
std::vector< SpatialVariableMetadata > m_vars
metadata corresponding to NetCDF variables
std::shared_ptr< Diagnostic > Ptr
High-level PISM I/O class.
array::Scalar1 sea_level_elevation
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.
std::shared_ptr< const Grid > grid() const
std::shared_ptr< OceanModel > m_input_model
virtual MaxTimestep max_timestep_impl(double t) const
const array::Scalar & shelf_base_mass_flux() const
std::shared_ptr< array::Scalar > m_water_column_pressure
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
static std::shared_ptr< array::Scalar > allocate_shelf_base_temperature(std::shared_ptr< const Grid > g)
static std::shared_ptr< array::Scalar > allocate_shelf_base_mass_flux(std::shared_ptr< const Grid > g)
const array::Scalar & average_water_column_pressure() const
static std::shared_ptr< array::Scalar > allocate_water_column_pressure(std::shared_ptr< const Grid > g)
virtual DiagnosticList diagnostics_impl() const
virtual TSDiagnosticList ts_diagnostics_impl() const
void update(const Geometry &geometry, double t, double dt)
virtual const array::Scalar & shelf_base_temperature_impl() const
virtual const array::Scalar & shelf_base_mass_flux_impl() const
virtual void init_impl(const Geometry &geometry)
void init(const Geometry &geometry)
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
OceanModel(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > input)
virtual void update_impl(const Geometry &geometry, double t, double dt)
virtual const array::Scalar & average_water_column_pressure_impl() const
const array::Scalar & shelf_base_temperature() const
A very rudimentary PISM ocean model.
PO_shelf_base_mass_flux(const OceanModel *m)
std::shared_ptr< array::Array > compute_impl() const
std::shared_ptr< array::Array > compute_impl() const
PO_shelf_base_temperature(const OceanModel *m)
#define PISM_ERROR_LOCATION
bool ocean(int M)
An ocean cell (floating ice or ice-free).
void compute_average_water_column_pressure(const Geometry &geometry, double ice_density, double water_density, double g, array::Scalar &result)
double average_water_column_pressure(double ice_thickness, double bed, double floatation_level, double rho_ice, double rho_water, double g)
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
std::map< std::string, Diagnostic::Ptr > DiagnosticList
T combine(const T &a, const T &b)