21 " Testing program for the finite element implementation of the SSA.\n"
22 " Does a time-independent calculation. Does not run IceModel or a derived\n"
23 " class thereof. Uses verification test I. Also may be used in a PISM\n"
24 " software (regression) test.\n\n";
26 #include "pism/basalstrength/basal_resistance.hh"
27 #include "pism/stressbalance/ssa/SSAFD.hh"
28 #include "pism/stressbalance/ssa/SSAFEM.hh"
29 #include "pism/stressbalance/ssa/SSATestCase.hh"
30 #include "pism/util/Context.hh"
31 #include "pism/util/VariableMetadata.hh"
32 #include "pism/util/error_handling.hh"
33 #include "pism/util/io/File.hh"
34 #include "pism/util/petscwrappers/PetscInitializer.hh"
35 #include "pism/util/pism_utilities.hh"
36 #include "pism/util/pism_options.hh"
37 #include "pism/verification/tests/exactTestsIJ.h"
40 namespace stressbalance {
55 std::
max(60.0e3, ((Mx - 1) / 2) * (2.0 * (3.0 *
L_schoof) / (My - 1))),
61 m_config->set_flag(
"basal_resistance.pseudo_plastic.enabled",
false);
63 m_config->set_string(
"stress_balance.ssa.flow_law",
"isothermal_glen");
64 m_config->set_number(
"flow_law.isothermal_Glen.ice_softness", pow(
B_schoof, -
m_config->get_number(
"stress_balance.ssa.Glen_exponent")));
73 double x,
double y,
double *u,
double *v);
88 m_config->set_flag(
"stress_balance.ssa.compute_surface_gradient_inward",
true);
89 m_config->set_number(
"stress_balance.ssa.epsilon", 0.0);
93 for (
auto p =
m_grid->points(); p; p.next()) {
94 const int i = p.i(), j = p.j();
120 double *u,
double *v) {
129 int main(
int argc,
char *argv[]) {
131 using namespace pism;
134 MPI_Comm com = MPI_COMM_WORLD;
137 com = PETSC_COMM_WORLD;
144 std::string usage =
"\n"
145 "usage of SSA_TESTi:\n"
146 " run ssa_testi -Mx <number> -My <number> -ssa_method <fd|fem>\n"
156 unsigned int Mx = config->get_number(
"grid.Mx");
157 unsigned int My = config->get_number(
"grid.My");
159 auto method = config->get_string(
"stress_balance.ssa.method");
160 auto output_file = config->get_string(
"output.file");
162 bool write_output = config->get_string(
"output.size") !=
"none";
166 if (method ==
"fem") {
168 }
else if (method ==
"fd") {
179 testcase.
write(output_file);
std::shared_ptr< Config > Ptr
std::shared_ptr< EnthalpyConverter > Ptr
Converts between specific enthalpy and temperature or liquid content.
void ensure_consistency(double ice_free_thickness_threshold)
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.
SSATestCaseI(std::shared_ptr< Context > ctx, int Mx, int My, SSAFactory ssafactory)
virtual void exactSolution(int i, int j, double x, double y, double *u, double *v)
virtual void initializeSSACoefficients()
Set up the coefficient variables as appropriate for the test case.
virtual void init()
Initialize the test case at the start of a run.
EnthalpyConverter::Ptr m_enthalpyconverter
array::Array3D m_ice_enthalpy
std::shared_ptr< Grid > m_grid
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::Ptr m_config
virtual void write(const std::string &filename)
Save the computation and data to a file.
struct TestIParameters exactI(const double m, const double x, const double y)
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
bool domain_edge(const Grid &grid, int i, int j)
SSA * SSAFDFactory(std::shared_ptr< const Grid > g)
Constructs a new SSAFD.
SSA *(* SSAFactory)(std::shared_ptr< const Grid >)
const double aspect_schoof
SSA * SSAFEMFactory(std::shared_ptr< const Grid > g)
Factory function for constructing a new SSAFEM.
Stress balance models and related diagnostics.
std::shared_ptr< Context > context_from_options(MPI_Comm com, const std::string &prefix, bool print)
Create a default context using options.
void handle_fatal_errors(MPI_Comm com)
bool show_usage_check_req_opts(const Logger &log, const std::string &execname, const std::vector< std::string > &required_options, const std::string &usage)
In a single call a driver program can provide a usage string to the user and check if required option...
int main(int argc, char *argv[])