30 " Testing program for the finite element implementation of the SSA.\n"
31 " Does a time-independent calculation. Does not run IceModel or a derived\n"
32 " class thereof.Also may be used in a PISM\n"
33 " software (regression) test.\n\n";
37#include "pism/stressbalance/ssa/SSAFD.hh"
38#include "pism/stressbalance/ssa/SSAFEM.hh"
39#include "pism/stressbalance/ssa/SSATestCase.hh"
40#include "pism/util/Context.hh"
41#include "pism/util/error_handling.hh"
42#include "pism/util/petscwrappers/PetscInitializer.hh"
43#include "pism/util/pism_options.hh"
46namespace stressbalance {
68 double x,
double y,
double *u,
double *v);
76 m_ssa->strength_extension->set_notional_strength(
nu0 *
H0);
77 m_ssa->strength_extension->set_min_thickness(4000*10);
91 for (
auto p =
m_grid->points(); p; p.next()) {
92 const int i = p.i(), j = p.j();
97 bool edge = ((j == 0) || (j == (
int)
m_grid->My() - 1) ||
98 (i == 0) || (i == (
int)
m_grid->Mx() - 1));
113 double *u,
double *v) {
114 double tauc_threshold_velocity =
m_config->get_number(
"basal_resistance.pseudo_plastic.u_threshold",
118 double alpha = sqrt((
tauc0/tauc_threshold_velocity) / (4*
nu0*
H0));
119 *u =
v0*exp(-alpha*(x-
L));
126int main(
int argc,
char *argv[]) {
128 using namespace pism;
131 MPI_Comm com = MPI_COMM_WORLD;
134 com = PETSC_COMM_WORLD;
138 std::shared_ptr<Context> ctx = context_from_options(com,
"ssa_test_linear");
141 std::string usage =
"\n"
143 " run ssa_test_linear -Mx <number> -My <number> -ssa_method <fd|fem>\n"
146 bool stop = show_usage_check_req_opts(*ctx->log(),
"ssa_test_linear", {}, usage);
153 unsigned int Mx = config->get_number(
"grid.Mx");
154 unsigned int My = config->get_number(
"grid.My");
156 auto method = config->get_string(
"stress_balance.ssa.method");
157 auto output_file = config->get_string(
"output.file");
159 bool write_output = config->get_string(
"output.size") !=
"none";
162 config->set_flag(
"basal_resistance.pseudo_plastic.enabled",
true);
163 config->set_number(
"basal_resistance.pseudo_plastic.q", 1.0);
166 config->set_flag(
"stress_balance.ssa.compute_surface_gradient_inward",
true);
168 auto grid = ssa_test_linear_grid(ctx, Mx, My);
172 testcase.
report(
"linear");
174 testcase.
write(output_file);
178 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.
SSATestCaseExp(std::shared_ptr< SSA > ssa)
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)
std::shared_ptr< const pism::Grid > m_grid
virtual void init()
Initialize the test case at the start of a run.
const units::System::Ptr m_sys
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_linear_grid(std::shared_ptr< Context > ctx, int Mx, int My)
Stress balance models and related diagnostics.
double convert(System::Ptr system, double input, const std::string &spec1, const std::string &spec2)
Convert a quantity from unit1 to unit2.
int main(int argc, char *argv[])