20 "Ice sheet driver for PISM ice sheet simulations, initialized from data.\n"
21 "The basic PISM executable for evolution runs.\n";
26 #include "pism/icemodel/IceModel.hh"
27 #include "pism/icemodel/IceEISModel.hh"
28 #include "pism/util/Config.hh"
29 #include "pism/util/Grid.hh"
31 #include "pism/util/Context.hh"
32 #include "pism/util/Profiling.hh"
33 #include "pism/util/error_handling.hh"
34 #include "pism/util/petscwrappers/PetscInitializer.hh"
35 #include "pism/util/pism_options.hh"
37 #include "pism/regional/Grid_Regional.hh"
38 #include "pism/regional/IceRegionalModel.hh"
46 config.
set_string(
"grid.registration",
"corner");
47 config.
set_string(
"stress_balance.sia.flow_law",
"pb");
49 config.
set_flag(
"energy.temperature_based",
true);
52 config.
set_number(
"sea_level.constant.value", -1e4);
55 config.
set_number(
"stress_balance.sia.enhancement_factor", 1.0);
58 config.
set_number(
"stress_balance.sia.bed_smoother.range", 0.0);
61 config.
set_flag(
"geometry.update.use_basal_melt_rate",
false);
67 config.
set_number(
"energy.bedrock_thermal.density",
69 config.
set_number(
"energy.bedrock_thermal.conductivity",
70 config.
get_number(
"constants.ice.thermal_conductivity"));
71 config.
set_number(
"energy.bedrock_thermal.specific_heat_capacity",
72 config.
get_number(
"constants.ice.specific_heat_capacity"));
75 config.
set_string(
"stress_balance.model",
"sia");
78 int main(
int argc,
char *argv[]) {
80 MPI_Comm com = MPI_COMM_WORLD;
83 com = PETSC_COMM_WORLD;
89 "EISMINT II experiment name",
90 "A,B,C,D,E,F,I,J,K,L",
"A");
97 std::vector<std::string> required_options{};
106 ctx->unit_system()));
107 overrides->init(*ctx->log());
108 config->import_from(*overrides);
111 config->resolve_filenames();
113 required_options.emplace_back(
"-i");
119 " pismr -i IN.nc [-bootstrap] [-regional] [OTHER PISM & PETSc OPTIONS]\n"
121 " -i IN.nc is input file in NetCDF format: contains PISM-written model state\n"
122 " -bootstrap enable heuristics to produce an initial state from an incomplete input\n"
123 " -regional enable \"regional mode\"\n"
124 " -eisII [experiment] enable EISMINT II mode\n"
126 " * option -i is required\n"
127 " * if -bootstrap is used then also '-Mx A -My B -Mz C -Lz D' are required\n";
130 required_options, usage);
137 "Save detailed profiling data to a file.");
139 if (profiling_log.
is_set()) {
140 ctx->profiling().start();
143 std::shared_ptr<Grid> grid;
144 std::unique_ptr<IceModel> model;
146 if (
options::Bool(
"-regional",
"enable regional (outlet glacier) mode")) {
152 if (eisII.is_set()) {
153 char experiment = eisII.value()[0];
154 model.reset(
new IceEISModel(grid, ctx, experiment));
156 model.reset(
new IceModel(grid, ctx));
163 "List available diagnostic quantities and stop.",
164 "all,spatial,scalar,json",
167 if (list_type.is_set()) {
168 model->list_diagnostics(list_type);
170 auto termination_reason = model->run();
172 switch (termination_reason) {
175 exit_code =
static_cast<int>(config->get_number(
"output.checkpoint.exit_code"));
176 log->message(2,
"... stopping (exit_code=%d) after saving the checkpoint file\n",
187 log->message(2,
"... done with the run\n");
188 model->save_results();
196 if (profiling_log.
is_set()) {
197 ctx->profiling().report(profiling_log);
std::shared_ptr< Config > Ptr
void set_string(const std::string &name, const std::string &value, ConfigSettingFlag flag=CONFIG_FORCE)
double get_number(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
void set_flag(const std::string &name, bool value, ConfigSettingFlag flag=CONFIG_FORCE)
void set_number(const std::string &name, double value, ConfigSettingFlag flag=CONFIG_FORCE)
A class for storing and accessing PISM configuration flags and parameters.
std::shared_ptr< DefaultConfig > Ptr
Default PISM configuration database: uses NetCDF files; can be initialized from a file specified usin...
static std::shared_ptr< Grid > FromOptions(std::shared_ptr< const Context > ctx)
Create a grid using command-line options and (possibly) an input file.
Derived class for doing EISMINT II simplified geometry experiments.
A version of the PISM core class (IceModel) which knows about the no_model_mask and its semantics.
std::shared_ptr< Logger > Ptr
bool Bool(const std::string &option, const std::string &description)
std::shared_ptr< Grid > regional_grid_from_options(std::shared_ptr< Context > ctx)
Create a grid using command-line options and (possibly) an input file.
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)
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.
int main(int argc, char *argv[])
static void set_eismint2_config_defaults(Config &config)