20 #include "pism/regional/SSAFD_Regional.hh"
21 #include "pism/util/Vars.hh"
22 #include "pism/stressbalance/StressBalance.hh"
26 namespace stressbalance {
40 m_log->message(2,
" using the regional version of the SSA solver...\n");
42 if (
m_config->get_flag(
"stress_balance.ssa.dirichlet_bc")) {
43 m_log->message(2,
" using stored SSA velocities as Dirichlet B.C. in the no_model_strip...\n");
59 static int weight(
int M_ij,
int M_n,
double h_ij,
double h_n) {
87 for (
auto p =
m_grid->points(); p; p.next()) {
88 const int i = p.i(), j = p.j();
90 auto M = no_model_mask->
star(i, j);
105 auto CT = cell_type.
star(i, j);
111 west = M.w == 1 and i > 0,
112 east = M.e == 1 and i < Mx - 1;
115 west *=
weight(CT.c, CT.w, h.c, h.w);
116 east *=
weight(CT.c, CT.e, h.c, h.e);
118 if (east + west > 0) {
119 h_x = 1.0 / ((west + east) * dx) * (west * (h.c - h.w) + east * (h.e - h.c));
129 south = M.s == 1 and j > 0,
130 north = M.n == 1 and j < My - 1;
133 south *=
weight(CT.c, CT.s, h.c, h.s);
134 north *=
weight(CT.c, CT.n, h.c, h.n);
136 if (north + south > 0) {
137 h_y = 1.0 / ((south + north) * dy) * (south * (h.c - h.s) + north * (h.n - h.c));
143 result(i, j) = - pressure *
Vector2d(h_x, h_y);
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
const std::shared_ptr< const Grid > m_grid
grid used by this component
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
stencils::Star< T > star(int i, int j) const
SSAFD_Regional(std::shared_ptr< const Grid > g)
const array::Scalar * m_no_model_mask
void update(const Inputs &inputs, bool full_update)
Update the SSA solution.
const array::Scalar * m_H_stored
const array::Scalar1 * m_h_stored
virtual void compute_driving_stress(const array::Scalar &ice_thickness, const array::Scalar1 &surface_elevation, const array::CellType1 &cell_type, const array::Scalar1 *no_model_mask, array::Vector &result) const
Compute the gravitational driving stress.
A version of the SSA stress balance with tweaks for outlet glacier simulations.
PISM's SSA solver: the finite difference implementation.
virtual void update(const Inputs &inputs, bool full_update)
Update the SSA solution.
virtual void compute_driving_stress(const array::Scalar &ice_thickness, const array::Scalar1 &surface_elevation, const array::CellType1 &cell_type, const array::Scalar1 *no_model_mask, array::Vector &result) const
Compute the gravitational driving stress.
EnthalpyConverter::Ptr m_EC
bool icy(int M)
Ice-filled cell (grounded or floating).
bool ice_free(int M)
Ice-free cell (grounded or ocean).
static int weight(int M_ij, int M_n, double h_ij, double h_n)
SSA * SSAFD_RegionalFactory(std::shared_ptr< const Grid > grid)