21 " Testing program for PISM's implementations of the SSA.\n"
22 " Does a time-independent calculation. Does not run IceModel or a derived\n"
23 " class thereof. Uses the van der Veen flow-line shelf geometry. Also may be\n"
24 " used in a PISM software (regression) test.\n\n";
26#include "pism/stressbalance/ssa/SSATestCase.hh"
27#include "pism/util/Context.hh"
28#include "pism/util/error_handling.hh"
29#include "pism/util/petscwrappers/PetscInitializer.hh"
30#include "pism/util/pism_options.hh"
32#include "pism/stressbalance/ssa/SSAFD.hh"
33#include "pism/stressbalance/ssa/SSAFEM.hh"
36namespace stressbalance {
39static double H_exact(
double V0,
double H0,
double C,
double x) {
40 const double Q0 = V0*
H0;
41 return pow(4 * C / Q0 * x + 1/pow(
H0, 4), -0.25);
39static double H_exact(
double V0,
double H0,
double C,
double x) {
…}
45static double u_exact(
double V0,
double H0,
double C,
double x) {
46 const double Q0 = V0*
H0;
45static double u_exact(
double V0,
double H0,
double C,
double x) {
…}
70 void exactSolution(
int i,
int j,
double x,
double y,
double *u,
double *v);
85 const double x_min =
m_grid->x(0);
87 for (
auto p =
m_grid->points(); p; p.next()) {
88 const int i = p.i(), j = p.j();
90 const double x =
m_grid->x(i);
92 if (i != (
int)
m_grid->Mx() - 1) {
116 double *u,
double *v) {
117 const double x_min =
m_grid->x(0);
119 if (i != (
int)
m_grid->Mx() - 1) {
131int main(
int argc,
char *argv[]) {
133 using namespace pism;
136 MPI_Comm com = MPI_COMM_WORLD;
139 com = PETSC_COMM_WORLD;
143 std::shared_ptr<Context> ctx = context_from_options(com,
"ssa_test_cfbc");
146 std::string usage =
"\n"
147 "usage of SSA_TEST_CFBC:\n"
148 " run ssa_test_cfbc -Mx <number> -My <number>\n"
151 bool stop = show_usage_check_req_opts(*ctx->log(),
"ssa_test_cfbc", {}, usage);
158 unsigned int Mx = config->get_number(
"grid.Mx");
159 unsigned int My = config->get_number(
"grid.My");
161 auto method = config->get_string(
"stress_balance.ssa.method");
162 auto output_file = config->get_string(
"output.file");
164 bool write_output = config->get_string(
"output.size") !=
"none";
167 config->set_number(
"flow_law.isothermal_Glen.ice_softness",
168 pow(1.9e8, -config->get_number(
"stress_balance.ssa.Glen_exponent")));
169 config->set_flag(
"stress_balance.ssa.compute_surface_gradient_inward",
false);
170 config->set_flag(
"stress_balance.calving_front_stress_bc",
true);
171 config->set_flag(
"stress_balance.ssa.fd.flow_line_mode",
true);
172 config->set_flag(
"stress_balance.ssa.fd.extrapolate_at_margins",
false);
173 config->set_string(
"stress_balance.ssa.flow_law",
"isothermal_glen");
175 auto grid = ssa_test_cfbc_grid(ctx, Mx, My);
181 testcase.
write(output_file);
185 handle_fatal_errors(com);
std::shared_ptr< Config > Ptr
double enthalpy(double T, double omega, double P) const
Compute enthalpy from absolute temperature, liquid water fraction, and pressure.
Converts between specific enthalpy and temperature or liquid content.
void ensure_consistency(double ice_free_thickness_threshold)
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.
double m_V0
grounding line vertically-averaged velocity
void exactSolution(int i, int j, double x, double y, double *u, double *v)
SSATestCaseCFBC(std::shared_ptr< SSA > ssa)
double m_H0
grounding line thickness (meters)
void initializeSSACoefficients()
Set up the coefficient variables as appropriate for the test case.
double m_C
"typical constant ice parameter"
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
array::Array3D m_ice_enthalpy
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
virtual void write(const std::string &filename)
Save the computation and data to a file.
static double H_exact(double V0, double H0, double C, double x)
std::shared_ptr< Grid > ssa_test_cfbc_grid(std::shared_ptr< Context > ctx, int Mx, int My)
static double u_exact(double V0, double H0, double C, double x)
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[])