28 " Testing program for the finite element implementation of the SSA.\n"
29 " Does a time-independent calculation. Does not run IceModel or a derived\n"
30 " class thereof.\n\n";
34#include "pism/stressbalance/ssa/SSAFD.hh"
35#include "pism/stressbalance/ssa/SSAFEM.hh"
36#include "pism/stressbalance/ssa/SSATestCase.hh"
37#include "pism/util/Context.hh"
38#include "pism/util/error_handling.hh"
39#include "pism/util/petscwrappers/PetscInitializer.hh"
40#include "pism/util/pism_options.hh"
43namespace stressbalance {
55 static const double H0;
56 static const double L;
59 static const double B0;
64 virtual void exactSolution(
int i,
int j,
double x,
double y,
double *u,
double *v);
76 m_ssa->strength_extension->set_min_thickness(
H0 / 2);
88 for (
auto p =
m_grid->points(); p; p.next()) {
89 const int i = p.i(), j = p.j();
98 ((j == 0) || (j == (
int)
m_grid->My() - 1) || (i == 0) || (i == (
int)
m_grid->Mx() - 1));
115 double earth_grav =
m_config->get_number(
"constants.standard_gravity"),
116 ice_rho =
m_config->get_number(
"constants.ice.density");
117 double f = ice_rho * earth_grav *
H0 *
dhdx;
120 *u = 0.5 * pow(f, 3) * pow(
L, 4) / pow(
B0 *
H0, 3) * (1 - pow(ynd, 4));
127int main(
int argc,
char *argv[]) {
129 using namespace pism;
132 MPI_Comm com = MPI_COMM_WORLD;
135 com = PETSC_COMM_WORLD;
139 std::shared_ptr<Context> ctx = context_from_options(com,
"ssa_test_plug");
142 std::string usage =
"\n"
143 "usage of SSA_TEST_PLUG:\n"
144 " run ssa_test_plug -Mx <number> -My <number> -ssa_method <fd|fem>\n"
147 bool stop = show_usage_check_req_opts(*ctx->log(),
"ssa_test_plug", {}, usage);
155 unsigned int Mx = config->get_number(
"grid.Mx");
156 unsigned int My = config->get_number(
"grid.My");
158 auto method = config->get_string(
"stress_balance.ssa.method");
159 auto output_file = config->get_string(
"output.file");
161 bool write_output = config->get_string(
"output.size") !=
"none";
166 config->set_string(
"stress_balance.ssa.flow_law",
"isothermal_glen");
168 "flow_law.isothermal_Glen.ice_softness",
169 pow(SSATestCasePlug::B0, -config->get_number(
"stress_balance.ssa.Glen_exponent")));
172 config->set_flag(
"stress_balance.ssa.compute_surface_gradient_inward",
true);
173 config->set_number(
"stress_balance.ssa.epsilon", 0.0);
175 auto grid = ssa_test_plug_grid(ctx, Mx, My);
181 testcase.
write(output_file);
184 handle_fatal_errors(com);
std::shared_ptr< Config > Ptr
array::Scalar2 ice_surface_elevation
array::Scalar2 ice_thickness
array::Scalar2 bed_elevation
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 update_ghosts()
Updates ghost points.
virtual void initializeSSACoefficients()
Set up the coefficient variables as appropriate for the test case.
virtual void exactSolution(int i, int j, double x, double y, double *u, double *v)
static const double tauc0
SSATestCasePlug(std::shared_ptr< SSA > ssa)
std::shared_ptr< const pism::Grid > m_grid
virtual void init()
Initialize the test case at the start of a run.
static std::shared_ptr< Grid > grid(std::shared_ptr< Context > ctx, int Mx, int My, double Lx, double Ly, grid::Registration registration, grid::Periodicity periodicity)
array::Vector2 m_bc_values
virtual void report(const std::string &testname)
Report on the generated solution.
virtual void run()
Solve the SSA.
const Config::ConstPtr m_config
std::shared_ptr< SSA > m_ssa
virtual void write(const std::string &filename)
Save the computation and data to a file.
std::shared_ptr< Grid > ssa_test_plug_grid(std::shared_ptr< Context > ctx, int Mx, int My)
Stress balance models and related diagnostics.
int main(int argc, char *argv[])