30#include <dune/common/parallel/mpihelper.hh>
32#include <opm/material/common/ResetLocale.hpp>
37#include <opm/models/utils/terminal.hpp>
40#include <opm/simulators/utils/readDeck.hpp>
43#include <dune/fem/misc/mpimanager.hh>
62template <
class TypeTag>
68 Parameters::Register<Parameters::ParameterFile>
69 (
"An .ini file which contains a set of run-time parameters");
70 Parameters::Register<Parameters::PrintParameters>
71 (
"Print the values of the run-time parameters at the "
72 "start of the simulation");
74 TM::registerParameters();
78 Parameters::endRegistration();
91template <
class TypeTag>
92static inline int setupParameters_(
int argc,
114 std::string helpPreamble;
116 helpPreamble = Problem::helpPreamble(
argc,
argv);
118 const std::string s =
119 Parameters::parseCommandLineOptions(
argc,
125 if (s ==
"Help called") {
137 const std::string
paramFileName = Parameters::Get<Parameters::ParameterFile>(
false);
145 std::ostringstream
oss;
148 <<
"\" does not exist or is not readable.";
149 Parameters::printUsage(
argv[0], std::cerr,
oss.str());
156 using ParamList = std::vector<Parameters::Parameter>;
165 std::cerr <<
"The following explicitly specified parameter is unknown:\n";
169 <<
" explicitly specified parameters are unknown:\n";
174 std::cerr <<
" " <<
keyValue <<
"\n";
180 <<
" " <<
argv[0] <<
" --help\n"
182 <<
"to obtain the list of recognized command line parameters.\n\n";
201template <
class TypeTag>
217 Dune::Fem::MPIManager::initialize(
argc,
argv);
218 myRank = Dune::Fem::MPIManager::rank();
220 myRank = Dune::MPIHelper::instance(
argc,
argv).rank();
224 const_cast<const char**
>(
argv),
240 setupStreamLogging(
"STDOUT_LOGGER");
244 const Scalar endTime = Parameters::Get<Parameters::EndTime<Scalar>>();
245 if (endTime < -1
e50) {
247 Parameters::printUsage(
argv[0], std::cerr,
248 "Mandatory parameter '--end-time' not specified!");
253 const Scalar
initialTimeStepSize = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
256 Parameters::printUsage(
argv[0], std::cerr,
257 "Mandatory parameter '--initial-time-step-size' "
269 const std::string briefDescription = Problem::briefDescription();
270 if (!briefDescription.empty()) {
271 const std::string tmp =
breakLines(briefDescription,
274 std::cout << tmp << std::endl << std::endl;
278 <<
" will now start the simulation. " << std::endl;
283 const int printParams = Parameters::Get<Parameters::PrintParameters>();
289 Parameters::printValues(std::cout);
302 if (Parameters::printUnused(std::cout)) {
315 std::cout <<
"Simulation completed" << std::endl;
319 catch (std::exception&
e) {
321 std::cout <<
e.what() <<
". Abort!\n" << std::flush;
323 std::cout <<
"Trying to reset TTY.\n";
331 std::cout <<
"Unknown exception thrown!\n" << std::flush;
333 std::cout <<
"Trying to reset TTY.\n";
static void registerParameters()
Registers all runtime parameters used by the simulation.
Definition simulator.hh:214
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
void resetTerminal()
Resets the current TTY to a usable state if the program was aborted.
Definition terminal.cpp:123
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
std::string breakLines(const std::string &msg, int indentWidth, int maxWidth)
Break up a string in lines suitable for terminal output.
Definition terminal.cpp:39
void assignResetTerminalSignalHandlers()
Assign signal handlers that reset the terminal on errors.
Definition terminal.cpp:108
int getTtyWidth()
Get the width of the tty we are attached to.
Definition terminal.cpp:90
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.
Manages the initializing and running of time dependent problems.