20 "Ice sheet driver for PISM (SIA and SSA) verification. Uses exact solutions\n"
21 " to various coupled subsystems. Computes difference between exact solution\n"
22 " and numerical solution.\n"
23 " Currently implements tests A, B, C, D, E, F, G, H, K, L.\n\n";
27 #include "pism/util/Grid.hh"
28 #include "pism/util/Config.hh"
29 #include "pism/util/error_handling.hh"
30 #include "pism/util/petscwrappers/PetscInitializer.hh"
31 #include "pism/util/pism_options.hh"
32 #include "pism/verification/iceCompModel.hh"
33 #include "pism/util/Context.hh"
34 #include "pism/util/Logger.hh"
35 #include "pism/util/Time.hh"
36 #include "pism/util/EnthalpyConverter.hh"
41 std::shared_ptr<Context>
pismv_context(MPI_Comm com,
const std::string &prefix) {
51 config->set_string(
"grid.periodicity",
"none");
52 config->set_string(
"grid.registration",
"corner");
55 config->resolve_filenames();
59 Time::Ptr time = std::make_shared<Time>(com, config, *logger, sys);
63 return std::make_shared<Context>(com, sys, config, EC, time, logger, prefix);
76 P.
Lx = config->get_number(
"grid.Lx");
77 P.
Ly = config->get_number(
"grid.Ly");
79 P.
Mx = config->get_number(
"grid.Mx");
80 P.
My = config->get_number(
"grid.My");
83 double Lz = config->get_number(
"grid.Lz");
84 unsigned int Mz = config->get_number(
"grid.Mz");
113 config->set_number(
"grid.Mbz", 2);
114 config->set_number(
"grid.Lbz", 1000);
134 std::shared_ptr<Grid>
pismv_grid(std::shared_ptr<Context> ctx,
char testname) {
135 auto config = ctx->config();
137 auto input_file = config->get_string(
"input.file");
139 if (config->get_flag(
"input.bootstrap")) {
143 if (not input_file.empty()) {
147 return Grid::FromFile(ctx, input_file, {
"enthalpy",
"temp" }, r);
152 P.horizontal_size_from_options();
153 P.horizontal_extent_from_options(ctx->unit_system());
154 P.vertical_grid_from_options(ctx->config());
155 P.ownership_ranges_from_options(ctx->size());
157 return std::make_shared<Grid>(ctx, P);
160 int main(
int argc,
char *argv[]) {
161 MPI_Comm com = MPI_COMM_WORLD;
164 com = MPI_COMM_WORLD;
172 " pismv -test x [-no_report] [OTHER PISM & PETSc OPTIONS]\n"
174 " -test x SIA-type verification test (x = A|B|C|D|F|G|H|K|L)\n"
175 " -no_report do not give error report at end of run\n"
176 "(see User's Manual for tests I and J).\n";
178 std::vector<std::string> required(1,
"-test");
188 std::string testname =
options::Keyword(
"-test",
"Specifies PISM verification test",
189 "A,B,C,D,F,G,H,K,L,V",
"A");
198 log->message(2,
"done with run\n");
200 if (not
options::Bool(
"-no_report",
"do not print the error report")) {
An EnthalpyConverter for use in verification tests.
std::shared_ptr< Config > Ptr
std::shared_ptr< EnthalpyConverter > Ptr
static std::shared_ptr< Grid > FromFile(std::shared_ptr< const Context > ctx, const std::string &filename, const std::vector< std::string > &var_names, grid::Registration r)
Create a grid using one of variables in var_names in file.
IceModelTerminationReason run()
void init()
Manage the initialization of the IceModel object.
virtual void save_results()
Save model state in NetCDF format.
std::shared_ptr< Logger > Ptr
std::shared_ptr< Time > Ptr
Periodicity periodicity
Grid periodicity.
std::vector< double > z
Vertical levels.
Registration registration
Grid registration.
unsigned int Mx
Number of grid points in the X direction.
double Ly
Domain half-width in the Y direction.
double Lx
Domain half-width in the X direction.
unsigned int My
Number of grid points in the Y direction.
Grid parameters; used to collect defaults before an Grid is allocated.
std::shared_ptr< System > Ptr
#define PISM_ERROR_LOCATION
Registration string_to_registration(const std::string &keyword)
std::vector< double > compute_vertical_levels(double new_Lz, unsigned int new_Mz, grid::VerticalSpacing spacing, double lambda)
Set the vertical levels in the ice according to values in Mz (number of levels), Lz (domain height),...
bool Bool(const std::string &option, const std::string &description)
Logger::Ptr logger_from_options(MPI_Comm com)
Config::Ptr config_from_options(MPI_Comm com, const Logger &log, units::System::Ptr unit_system)
Create a configuration database using command-line options.
void handle_fatal_errors(MPI_Comm com)
void set_config_from_options(units::System::Ptr unit_system, Config &config)
Set configuration parameters using command-line options.
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...
void print_unused_parameters(const Logger &log, int verbosity_threshhold, const Config &config)
Report unused configuration parameters to stdout.
void print_config(const Logger &log, int verbosity_threshhold, const Config &config)
Report configuration parameters to stdout.
std::shared_ptr< Grid > pismv_grid(std::shared_ptr< Context > ctx, char testname)
int main(int argc, char *argv[])
std::shared_ptr< Context > pismv_context(MPI_Comm com, const std::string &prefix)
Allocate the PISMV (verification) context. Uses ColdEnthalpyConverter.
grid::Parameters pismv_grid_defaults(Config::Ptr config, char testname)