26 #include "pism/regional/SSAFD_Regional.hh"
27 #include "pism/regional/SIAFD_Regional.hh"
31 #include "pism/util/pism_utilities.hh"
32 #include "pism/util/Context.hh"
33 #include "pism/stressbalance/ssa/SSAFEM.hh"
36 namespace stressbalance {
38 std::shared_ptr<StressBalance>
create(
const std::string &model,
42 auto config = grid->ctx()->config();
44 if (model ==
"blatter") {
45 int Mz = config->get_number(
"stress_balance.blatter.Mz");
46 int C = config->get_number(
"stress_balance.blatter.coarsening_factor");
48 std::shared_ptr<Blatter> blatter(
new Blatter(grid, Mz,
C));
49 std::shared_ptr<BlatterMod> mod(
new BlatterMod(blatter));
51 return std::shared_ptr<StressBalance>(
new StressBalance(grid, blatter, mod));
55 if (config->get_string(
"stress_balance.ssa.method") ==
"fd") {
61 std::shared_ptr<ShallowStressBalance> sliding;
62 if (
member(model, {
"none",
"sia"})) {
64 }
else if (
member(model, {
"prescribed_sliding",
"prescribed_sliding+sia"})) {
66 }
else if (
member(model, {
"weertman_sliding",
"weertman_sliding+sia"})) {
68 }
else if (
member(model, {
"ssa",
"ssa+sia"})) {
69 sliding.reset(
SSA(grid));
72 "invalid stress balance model: %s", model.c_str());
75 std::shared_ptr<SSB_Modifier> modifier;
77 if (
member(model, {
"none",
"ssa",
"prescribed_sliding",
"weertman_sliding"})) {
79 }
else if (
member(model, {
"prescribed_sliding+sia",
"weertman_sliding+sia",
"ssa+sia",
"sia"})) {
83 modifier.reset(
new SIAFD(grid));
87 "invalid stress balance model: %s", model.c_str());
90 return std::shared_ptr<StressBalance>(
new StressBalance(grid, sliding, modifier));
std::shared_ptr< const IceGrid > ConstPtr
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
The trivial Shallow Stress Balance modifier.
A version of the SIA stress balance with tweaks for outlet glacier simulations.
The class defining PISM's interface to the shallow stress balance code.
Returns zero velocity field, zero friction heating, and zero for D^2.
#define PISM_ERROR_LOCATION
SSA *(* SSAFactory)(IceGrid::ConstPtr)
std::shared_ptr< StressBalance > create(const std::string &model, IceGrid::ConstPtr grid, bool regional)
SSA * SSAFEMFactory(IceGrid::ConstPtr g)
Factory function for constructing a new SSAFEM.
SSA * SSAFD_RegionalFactory(IceGrid::ConstPtr grid)
SSA * SSAFDFactory(IceGrid::ConstPtr g)
Constructs a new SSAFD.
bool member(const std::string &string, const std::set< std::string > &set)