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 J. 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/Mask.hh"
31 #include "pism/util/Context.hh"
32 #include "pism/util/VariableMetadata.hh"
33 #include "pism/util/error_handling.hh"
34 #include "pism/util/io/File.hh"
35 #include "pism/util/petscwrappers/PetscInitializer.hh"
36 #include "pism/util/pism_utilities.hh"
37 #include "pism/util/pism_options.hh"
38 #include "pism/verification/tests/exactTestsIJ.h"
41 namespace stressbalance {
48 m_config->set_flag(
"basal_resistance.pseudo_plastic.enabled",
false);
51 m_config->set_string(
"stress_balance.ssa.flow_law",
"isothermal_glen");
60 double x,
double y,
double *u,
double *v);
72 double ocean_rho =
m_config->get_number(
"constants.sea_water.density"),
73 ice_rho =
m_config->get_number(
"constants.ice.density");
75 const double H0 = 500.;
85 for (
auto p =
m_grid->points(); p; p.next()) {
86 const int i = p.i(), j = p.j();
98 if ((i == ((
int)
m_grid->Mx()) / 2) and
99 (j == ((
int)
m_grid->My()) / 2)) {
115 double *
u,
double *
v) {
124 int main(
int argc,
char *argv[]) {
126 using namespace pism;
129 MPI_Comm com = MPI_COMM_WORLD;
132 com = PETSC_COMM_WORLD;
139 std::string usage =
"\n"
140 "usage of SSA_TESTJ:\n"
141 " run ssafe_test -Mx <number> -My <number> -ssa_method <fd|fem>\n"
152 unsigned int Mx = config->get_number(
"grid.Mx");
153 unsigned int My = config->get_number(
"grid.My");
155 auto method = config->get_string(
"stress_balance.ssa.method");
156 auto output = config->get_string(
"output.file");
158 bool write_output = config->get_string(
"output.size") !=
"none";
162 if (method ==
"fem") {
164 }
else if (method ==
"fd") {
175 testcase.
write(output);
std::shared_ptr< Config > Ptr
std::shared_ptr< EnthalpyConverter > Ptr
Converts between specific enthalpy and temperature or liquid content.
array::Scalar2 ice_surface_elevation
array::CellType2 cell_type
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.
void set_min_thickness(double my_min_thickness)
Set minimum thickness to trigger use of extension.
void set_notional_strength(double my_nuH)
Set strength = (viscosity times thickness).
virtual void initializeSSACoefficients()
Set up the coefficient variables as appropriate for the test case.
SSATestCaseJ(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 init()
Initialize the test case at the start of a run.
EnthalpyConverter::Ptr m_enthalpyconverter
const units::System::Ptr m_sys
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.
SSAStrengthExtension * strength_extension
struct TestJParameters exactJ(const double x, const double y)
SSA * SSAFDFactory(std::shared_ptr< const Grid > g)
Constructs a new SSAFD.
SSA *(* SSAFactory)(std::shared_ptr< const Grid >)
SSA * SSAFEMFactory(std::shared_ptr< const Grid > g)
Factory function for constructing a new SSAFEM.
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.
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[])