19 #include "pism/stressbalance/ShallowStressBalance.hh"
20 #include "pism/basalstrength/basal_resistance.hh"
21 #include "pism/rheology/FlowLawFactory.hh"
22 #include "pism/stressbalance/SSB_diagnostics.hh"
23 #include "pism/util/Context.hh"
24 #include "pism/util/Vars.hh"
25 #include "pism/util/array/CellType.hh"
26 #include "pism/util/error_handling.hh"
29 namespace stressbalance {
33 m_basal_sliding_law(NULL),
35 m_EC(
g->ctx()->enthalpy_converter()),
36 m_velocity(m_grid,
"bar"),
37 m_basal_frictional_heating(m_grid,
"bfrict"),
41 if (
m_config->get_flag(
"basal_resistance.pseudo_plastic.enabled")) {
43 }
else if (
m_config->get_flag(
"basal_resistance.regularized_coulomb.enabled")) {
50 .
long_name(
"thickness-advective ice velocity (x-component)")
53 .
long_name(
"thickness-advective ice velocity (y-component)")
114 if(
m_config->get_flag(
"output.ISMIP6")) {
156 for (
auto p =
m_grid->points(); p; p.next()) {
157 const int i = p.i(), j = p.j();
159 if (mask.
ocean(i,j)) {
164 basal_stress_x = -
C * V(i,j).u,
165 basal_stress_y = -
C * V(i,j).v;
166 result(i,j) = - basal_stress_x * V(i,j).u - basal_stress_y * V(i,j).v;
177 m_vars[0].long_name(
"X-component of the driving shear stress at the base of ice");
178 m_vars[1].long_name(
"Y-component of the driving shear stress at the base of ice");
182 v[
"comment"] =
"this field is purely diagnostic (not used by the model)";
193 auto result = allocate<array::Vector>(
"taud");
198 double standard_gravity =
m_config->get_number(
"constants.standard_gravity"),
199 ice_density =
m_config->get_number(
"constants.ice.density");
203 for (
auto p =
m_grid->points(); p; p.next()) {
204 const int i = p.i(), j = p.j();
206 double pressure = ice_density * standard_gravity * (*thickness)(i, j);
207 if (pressure <= 0.0) {
208 (*result)(i, j).u = 0.0;
209 (*result)(i, j).v = 0.0;
211 (*result)(i, j).u = -pressure *
diff_x_p(*surface, i, j);
212 (*result)(i, j).v = -pressure *
diff_y_p(*surface, i, j);
222 .long_name(
"magnitude of the gravitational driving stress at the base of ice")
224 m_vars[0][
"comment"] =
"this field is purely diagnostic (not used by the model)";
228 auto result = allocate<array::Scalar>(
"taud_mag");
239 m_vars[0].long_name(
"X-component of the shear stress at the base of ice");
240 m_vars[1].long_name(
"Y-component of the shear stress at the base of ice");
244 v[
"comment"] =
"this field is purely diagnostic (not used by the model)";
251 auto result = allocate<array::Vector>(
"taub");
253 const auto &velocity =
model->velocity();
254 const auto *tauc =
m_grid->variables().get_2d_scalar(
"tauc");
255 const auto &mask = *
m_grid->variables().get_2d_cell_type(
"mask");
260 for (
auto p =
m_grid->points(); p; p.next()) {
261 const int i = p.i(), j = p.j();
263 if (mask.grounded_ice(i, j)) {
264 double beta = basal_sliding_law->
drag((*tauc)(i, j), velocity(i, j).u, velocity(i, j).v);
265 (*result)(i, j) = -beta * velocity(i, j);
267 (*result)(i, j) = 0.0;
276 auto ismip6 =
m_config->get_flag(
"output.ISMIP6");
278 m_vars = { {
m_sys, ismip6 ?
"strbasemag" :
"taub_mag" } };
280 .long_name(
"magnitude of the basal shear stress at the base of ice")
281 .standard_name(
"land_ice_basal_drag")
283 m_vars[0][
"comment"] =
"this field is purely diagnostic (not used by the model)";
287 auto result = allocate<array::Scalar>(
"taub_mag");
316 auto input_filename =
m_config->get_string(
"stress_balance.prescribed_sliding.file");
318 if (input_filename.empty()) {
327 m_vars[0].long_name(
"basal drag coefficient").units(
"Pa s / m");
331 auto result = allocate<array::Scalar>(
"beta");
340 for (
auto p =
m_grid->points(); p; p.next()) {
341 const int i = p.i(), j = p.j();
343 (*result)(i,j) = basal_sliding_law->
drag((*tauc)(i,j), velocity(i,j).u, velocity(i,j).v);
const Config::ConstPtr m_config
configuration database used by this component
const std::shared_ptr< const Grid > m_grid
grid used by this component
A class defining a common interface for most PISM sub-models.
const ShallowStressBalance * model
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
std::shared_ptr< const Grid > m_grid
the grid
std::shared_ptr< array::Array > compute() const
Compute a diagnostic quantity and return a pointer to a newly-allocated Array.
const Config::ConstPtr m_config
Configuration flags and parameters.
std::shared_ptr< EnthalpyConverter > Ptr
virtual double drag(double tauc, double vx, double vy) const
Compute the drag coefficient for the basal shear stress.
Class containing physical constants and the constitutive relation describing till for SSA.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void set(double c)
Result: v[j] <- c for all j.
void regrid(const std::string &filename, io::Default default_value)
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
bool ocean(int i, int j) const
"Cell type" mask. Adds convenience methods to array::Scalar.
std::shared_ptr< FlowLaw > create()
PrescribedSliding(std::shared_ptr< const Grid > g)
virtual void update(const Inputs &inputs, bool full_update)
Update the trivial shallow stress balance object.
virtual std::shared_ptr< array::Array > compute_impl() const
SSB_beta(const ShallowStressBalance *m)
SSB_taub_mag(const ShallowStressBalance *m)
virtual std::shared_ptr< array::Array > compute_impl() const
Computes the magnitude of the basal shear stress (diagnostically).
SSB_taub(const ShallowStressBalance *m)
virtual std::shared_ptr< array::Array > compute_impl() const
Computes the basal shear stress .
virtual std::shared_ptr< array::Array > compute_impl() const
SSB_taud_mag(const ShallowStressBalance *m)
Computes the magnitude of the gravitational driving stress (diagnostically).
virtual std::shared_ptr< array::Array > compute_impl() const
SSB_taud(const ShallowStressBalance *m)
Computes the gravitational driving stress (diagnostically).
const array::Vector1 & velocity() const
Get the thickness-advective 2D velocity.
void compute_basal_frictional_heating(const array::Vector &velocity, const array::Scalar &tauc, const array::CellType &mask, array::Scalar &result) const
Compute the basal frictional heating.
array::Scalar m_basal_frictional_heating
std::shared_ptr< const rheology::FlowLaw > flow_law() const
virtual DiagnosticList diagnostics_impl() const
double m_e_factor
flow enhancement factor
double flow_enhancement_factor() const
ShallowStressBalance(std::shared_ptr< const Grid > g)
std::shared_ptr< rheology::FlowLaw > m_flow_law
IceBasalResistancePlasticLaw * m_basal_sliding_law
const IceBasalResistancePlasticLaw * sliding_law() const
virtual ~ShallowStressBalance()
virtual std::string stdout_report() const
Produce a report string for the standard output.
const array::Scalar & basal_frictional_heating()
Get the basal frictional heating (for the adaptive energy time-stepping).
EnthalpyConverter::Ptr m_EC
EnthalpyConverter::Ptr enthalpy_converter() const
array::Vector2 m_velocity
Shallow stress balance (such as the SSA).
virtual void update(const Inputs &inputs, bool full_update)
Update the trivial shallow stress balance object.
ZeroSliding(std::shared_ptr< const Grid > g)
Returns zero velocity field, zero friction heating, and zero for D^2.
#define PISM_ERROR_LOCATION
double diff_x_p(const array::Scalar &array, int i, int j)
Returns the x-derivative at i,j approximated using centered finite differences. Respects grid periodi...
void compute_magnitude(const array::Vector &input, array::Scalar &result)
double diff_y_p(const array::Scalar &array, int i, int j)
Returns the y-derivative at i,j approximated using centered finite differences. Respects grid periodi...
std::map< std::string, Diagnostic::Ptr > DiagnosticList