22 #include "pism/stressbalance/StressBalance.hh"
23 #include "pism/stressbalance/ShallowStressBalance.hh"
24 #include "pism/stressbalance/WeertmanSliding.hh"
25 #include "pism/stressbalance/SSB_Modifier.hh"
26 #include "pism/regional/SSAFD_Regional.hh"
27 #include "pism/regional/SIAFD_Regional.hh"
28 #include "pism/stressbalance/blatter/Blatter.hh"
29 #include "pism/stressbalance/blatter/BlatterMod.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,
39 std::shared_ptr<const Grid> grid,
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));
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 * SSAFDFactory(std::shared_ptr< const Grid > g)
Constructs a new SSAFD.
SSA *(* SSAFactory)(std::shared_ptr< const Grid >)
std::shared_ptr< StressBalance > create(const std::string &model, std::shared_ptr< const Grid > grid, bool regional)
SSA * SSAFEMFactory(std::shared_ptr< const Grid > g)
Factory function for constructing a new SSAFEM.
SSA * SSAFD_RegionalFactory(std::shared_ptr< const Grid > grid)
bool member(const std::string &string, const std::set< std::string > &set)