21 #include "pism/icemodel/IceModel.hh"
23 #include "pism/energy/BedThermalUnit.hh"
24 #include "pism/util/Grid.hh"
25 #include "pism/util/ConfigInterface.hh"
26 #include "pism/util/error_handling.hh"
27 #include "pism/coupler/SurfaceModel.hh"
28 #include "pism/util/EnthalpyConverter.hh"
29 #include "pism/util/Profiling.hh"
31 #include "pism/energy/EnergyModel.hh"
54 profiling.
begin(
"btu");
90 const bool sub_gl = (
m_config->get_flag(
"geometry.grounded_cell_fraction") and
91 m_config->get_flag(
"energy.basal_melt.use_grounded_cell_fraction"));
94 &grounded_basal_melt_rate, &shelf_base_mass_flux, &result};
99 double ice_density =
m_config->get_number(
"constants.ice.density");
101 for (
auto p =
m_grid->points(); p; p.next()) {
102 const int i = p.i(), j = p.j();
107 M_shelf_base = shelf_base_mass_flux(i,j) / ice_density;
116 result(i,j) = lambda * grounded_basal_melt_rate(i, j) + (1.0 - lambda) * M_shelf_base;
129 auto grid = result.
grid();
130 auto config = grid->ctx()->config();
133 T0 = config->get_number(
"constants.fresh_water.melting_point_temperature"),
134 beta_CC_grad_sea_water = (config->get_number(
"constants.ice.beta_Clausius_Clapeyron") *
135 config->get_number(
"constants.sea_water.density") *
136 config->get_number(
"constants.standard_gravity"));
141 &ice_surface_temperature, &basal_enthalpy, &result};
144 for (
auto p = grid->points(); p; p.next()) {
145 const int i = p.i(), j = p.j();
149 result(i,j) = ice_surface_temperature(i,j);
151 const double pressure = EC->pressure(ice_thickness(i,j));
152 result(i,j) = EC->temperature(basal_enthalpy(i,j), pressure);
155 result(i,j) = T0 - (sea_level(i, j) - bed_topography(i,j)) * beta_CC_grad_sea_water;
std::shared_ptr< EnthalpyConverter > Ptr
array::Scalar1 sea_level_elevation
array::Scalar cell_grounded_fraction
array::CellType2 cell_type
array::Scalar2 ice_thickness
array::Scalar2 bed_elevation
virtual energy::Inputs energy_model_inputs()
const Geometry & geometry() const
virtual void energy_step()
Manage the solution of the energy equation, and related parallel communication.
std::shared_ptr< surface::SurfaceModel > m_surface
const Config::Ptr m_config
Configuration flags and parameters.
const std::shared_ptr< Context > m_ctx
Execution context.
array::Scalar m_bedtoptemp
temperature at the top surface of the bedrock thermal layer
std::vector< std::shared_ptr< array::Scalar2 > > m_work2d
std::string m_stdout_flags
virtual void combine_basal_melt_rate(const Geometry &geometry, const array::Scalar &shelf_base_mass_flux, const array::Scalar &grounded_basal_melt_rate, array::Scalar &result)
Combine basal melt rate in grounded and floating areas.
virtual void bedrock_thermal_model_step()
std::shared_ptr< energy::BedThermalUnit > m_btu
double t_TempAge
time of last update for enthalpy/temperature
double dt_TempAge
enthalpy/temperature and age time-steps
std::shared_ptr< energy::EnergyModel > m_energy_model
const std::shared_ptr< Grid > m_grid
Computational grid.
void failed()
Indicates a failure of a parallel section.
void begin(const char *name) const
void end(const char *name) const
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void add(double alpha, const Array2D< T > &x)
std::shared_ptr< const Grid > grid() const
bool ice_free(int i, int j) const
bool ocean(int i, int j) const
bool grounded(int i, int j) const
"Cell type" mask. Adds convenience methods to array::Scalar.
void extract_surface(const Array3D &data, double z, Scalar &output)
Copies a horizontal slice at level z of an Array3D into output.
void bedrock_surface_temperature(const array::Scalar &sea_level, const array::CellType &cell_type, const array::Scalar &bed_topography, const array::Scalar &ice_thickness, const array::Scalar &basal_enthalpy, const array::Scalar &ice_surface_temperature, array::Scalar &result)
Compute the temperature seen by the top of the bedrock thermal layer.