19 #include "pism/rheology/FlowLaw.hh"
23 #include "pism/util/EnthalpyConverter.hh"
24 #include "pism/util/array/Scalar.hh"
25 #include "pism/util/array/Array3D.hh"
27 #include "pism/util/ConfigInterface.hh"
28 #include "pism/util/Grid.hh"
30 #include "pism/util/error_handling.hh"
60 schoofLen = config.
get_number(
"flow_law.Schoof_regularizing_length",
"m"),
61 schoofVel = config.
get_number(
"flow_law.Schoof_regularizing_velocity",
"m second-1");
89 double pressure,
double grain_size)
const {
90 return this->
flow_impl(stress, enthalpy, pressure, grain_size);
94 double pressure,
double )
const {
95 return softness(enthalpy, pressure) * pow(stress,
m_n-1);
99 const double *pressure,
const double *grainsize,
100 unsigned int n,
double *result)
const {
101 this->
flow_n_impl(stress, enthalpy, pressure, grainsize,
n, result);
105 const double *pressure,
const double *grainsize,
106 unsigned int n,
double *result)
const {
107 for (
unsigned int k = 0;
k <
n; ++
k) {
108 result[
k] = this->
flow(stress[
k], enthalpy[
k], pressure[
k], grainsize[
k]);
122 unsigned int n,
double *result)
const {
127 unsigned int n,
double *result)
const {
128 for (
unsigned int k = 0;
k <
n; ++
k) {
129 result[
k] = this->
hardness(enthalpy[
k], pressure[
k]);
163 double *nu,
double *dnu)
const {
168 double *nu,
double *dnu)
const {
172 if (PetscLikely(nu != NULL)) {
176 if (PetscLikely(dnu != NULL)) {
186 const Grid &grid = *thickness.
grid();
193 const int i = p.i(), j = p.j();
196 double H = thickness(i,j);
197 const double *enthColumn = enthalpy.
get_column(i, j);
199 grid.
z().data(), enthColumn);
215 unsigned int kbelowH,
216 const double *zlevels,
217 const double *enthalpy) {
220 const auto &EC = *ice.
EC();
225 p0 = EC.pressure(thickness),
229 for (
unsigned int i = 1; i <= kbelowH; ++i) {
231 p1 = EC.pressure(thickness - zlevels[i]),
236 B += (zlevels[i] - zlevels[i-1]) * (
h0 + h1);
248 depth = thickness - zlevels[kbelowH],
249 p = EC.pressure(depth);
251 B += depth * ice.
hardness(enthalpy[kbelowH], p);
264 static const double gs[] = {1e-4, 1e-3, 1e-2, 1}, s=1e4, E=400000, p=1e6;
265 double ref = flow_law.
flow(s, E, p, gs[0]);
266 for (
int i=1; i<4; i++) {
267 if (flow_law.
flow(s, E, p, gs[i]) != ref) {
double get_number(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
A class for storing and accessing PISM configuration flags and parameters.
std::shared_ptr< EnthalpyConverter > Ptr
unsigned int kBelowHeight(double height) const
Return the index k into zlevels[] so that zlevels[k] <= height < zlevels[k+1] and k < Mz.
PointsWithGhosts points(unsigned int stencil_width=0) const
const std::vector< double > & z() const
Z-coordinates within the ice.
Describes the PISM grid and the distribution of data across processors.
void failed()
Indicates a failure of a parallel section.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
double * get_column(int i, int j)
A virtual class collecting methods common to ice and bedrock 3D fields.
std::shared_ptr< const Grid > grid() const
void update_ghosts()
Updates ghost points.
double m_crit_temp
critical temperature (cold – warm transition)
double softness_paterson_budd(double T_pa) const
Return the softness parameter A(T) for a given temperature T.
double m_schoofReg
regularization parameter for
virtual double hardness_impl(double E, double p) const
double m_A_warm
Paterson-Budd softness, warm case.
double m_A_cold
Paterson-Budd softness, cold case.
double m_Q_cold
Activation energy, cold case.
double m_standard_gravity
acceleration due to gravity
double m_viscosity_power
; used to compute viscosity
void flow_n(const double *stress, const double *E, const double *pressure, const double *grainsize, unsigned int n, double *result) const
virtual void hardness_n_impl(const double *enthalpy, const double *pressure, unsigned int n, double *result) const
void effective_viscosity(double hardness, double gamma, double *nu, double *dnu) const
Computes the regularized effective viscosity and its derivative with respect to the second invariant ...
void hardness_n(const double *enthalpy, const double *pressure, unsigned int n, double *result) const
FlowLaw(const std::string &prefix, const Config &config, EnthalpyConverter::Ptr EC)
double softness(double E, double p) const
virtual double softness_impl(double E, double p) const =0
double m_hardness_power
; used to compute hardness
double m_melting_point_temp
melting point temperature (for water, 273.15 K)
EnthalpyConverter::Ptr EC() const
double m_beta_CC_grad
Clausius-Clapeyron gradient.
double flow(double stress, double enthalpy, double pressure, double grain_size) const
The flow law itself.
double m_ideal_gas_constant
ideal gas constant
virtual double flow_impl(double stress, double E, double pressure, double grainsize) const
double m_Q_warm
Activation energy, warm case.
double m_n
power law exponent
double hardness(double E, double p) const
EnthalpyConverter::Ptr m_EC
virtual void flow_n_impl(const double *stress, const double *E, const double *pressure, const double *grainsize, unsigned int n, double *result) const
#define PISM_ERROR_LOCATION
void averaged_hardness_vec(const FlowLaw &ice, const array::Scalar &thickness, const array::Array3D &enthalpy, array::Scalar &result)
double averaged_hardness(const FlowLaw &ice, double thickness, unsigned int kbelowH, const double *zlevels, const double *enthalpy)
Computes vertical average of B(E, p) ice hardness, namely .
bool FlowLawUsesGrainSize(const FlowLaw &flow_law)