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"
27#include "pism/util/io/IO_Flags.hh"
30namespace stressbalance {
34 m_basal_sliding_law(NULL),
36 m_EC(
g->ctx()->enthalpy_converter()),
37 m_velocity(m_grid,
"bar"),
38 m_basal_frictional_heating(m_grid,
"bfrict"),
42 if (
m_config->get_flag(
"basal_resistance.pseudo_plastic.enabled")) {
44 }
else if (
m_config->get_flag(
"basal_resistance.regularized_coulomb.enabled")) {
51 .
long_name(
"thickness-advective ice velocity (x-component)")
54 .
long_name(
"thickness-advective ice velocity (y-component)")
115 if(
m_config->get_flag(
"output.ISMIP6")) {
129 m_config->get_number(
"stress_balance.sia.Glen_exponent"));
158 for (
auto p :
m_grid->points()) {
159 const int i = p.i(), j = p.j();
161 if (mask.
ocean(i,j)) {
166 basal_stress_x = - C * V(i,j).u,
167 basal_stress_y = - C * V(i,j).v;
168 result(i,j) = - basal_stress_x * V(i,j).u - basal_stress_y * V(i,j).v;
179 m_vars[0].long_name(
"X-component of the driving shear stress at the base of ice");
180 m_vars[1].long_name(
"Y-component of the driving shear stress at the base of ice");
184 v[
"comment"] =
"this field is purely diagnostic (not used by the model)";
195 auto result = allocate<array::Vector>(
"taud");
200 double standard_gravity =
m_config->get_number(
"constants.standard_gravity"),
201 ice_density =
m_config->get_number(
"constants.ice.density");
205 for (
auto p :
m_grid->points()) {
206 const int i = p.i(), j = p.j();
208 double pressure = ice_density * standard_gravity * (*thickness)(i, j);
209 if (pressure <= 0.0) {
210 (*result)(i, j).u = 0.0;
211 (*result)(i, j).v = 0.0;
213 (*result)(i, j).u = -pressure * diff_x_p(*surface, i, j);
214 (*result)(i, j).v = -pressure * diff_y_p(*surface, i, j);
224 .long_name(
"magnitude of the gravitational driving stress at the base of ice")
226 m_vars[0][
"comment"] =
"this field is purely diagnostic (not used by the model)";
230 auto result = allocate<array::Scalar>(
"taud_mag");
233 compute_magnitude(*taud, *result);
241 m_vars[0].long_name(
"X-component of the shear stress at the base of ice");
242 m_vars[1].long_name(
"Y-component of the shear stress at the base of ice");
246 v[
"comment"] =
"this field is purely diagnostic (not used by the model)";
253 auto result = allocate<array::Vector>(
"taub");
255 const auto &velocity =
model->velocity();
256 const auto *tauc =
m_grid->variables().get_2d_scalar(
"tauc");
257 const auto &mask = *
m_grid->variables().get_2d_cell_type(
"mask");
262 for (
auto p :
m_grid->points()) {
263 const int i = p.i(), j = p.j();
265 if (mask.grounded_ice(i, j)) {
266 double beta = basal_sliding_law->
drag((*tauc)(i, j), velocity(i, j).u, velocity(i, j).v);
267 (*result)(i, j) = -beta * velocity(i, j);
269 (*result)(i, j) = 0.0;
278 auto ismip6 =
m_config->get_flag(
"output.ISMIP6");
282 .long_name(
"magnitude of the basal shear stress at the base of ice")
283 .standard_name(
"land_ice_basal_drag")
285 m_vars[0][
"comment"] =
"this field is purely diagnostic (not used by the model)";
289 auto result = allocate<array::Scalar>(
"taub_mag");
293 compute_magnitude(*taub, *result);
318 auto input_filename =
m_config->get_string(
"stress_balance.prescribed_sliding.file");
320 if (input_filename.empty()) {
329 m_vars[0].long_name(
"basal drag coefficient").units(
"Pa s / m");
333 auto result = allocate<array::Scalar>(
"beta");
342 for (
auto p :
m_grid->points()) {
343 const int i = p.i(), j = p.j();
345 (*result)(i,j) = basal_sliding_law->
drag((*tauc)(i,j), velocity(i,j).u, velocity(i,j).v);
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
A class defining a common interface for most PISM sub-models.
const ShallowStressBalance * model
A template derived from Diagnostic, adding a "Model".
std::vector< VariableMetadata > m_vars
metadata corresponding to NetCDF variables
const units::System::Ptr m_sys
the unit system
std::shared_ptr< const Config > m_config
Configuration flags and parameters.
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.
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)
VariableMetadata & metadata(unsigned int N=0)
Returns a reference to the VariableMetadata 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(const std::string &type_name, double exponent)
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
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
virtual DiagnosticList spatial_diagnostics_impl() const
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).
std::shared_ptr< EnthalpyConverter > m_EC
std::shared_ptr< EnthalpyConverter > 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
std::map< std::string, Diagnostic::Ptr > DiagnosticList