mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Abort the run before reading the deck if there are unknown params.
This commit is contained in:
parent
afdce991c2
commit
c7200460ab
@ -278,11 +278,15 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
PreProblem::setBriefDescription("Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
|
PreProblem::setBriefDescription("Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
|
||||||
int status = Opm::FlowMainEbos<PreTypeTag>::setupParameters_(argc, argv);
|
int status = Opm::FlowMainEbos<PreTypeTag>::setupParameters_(argc, argv);
|
||||||
if (status != 0)
|
if (status != 0) {
|
||||||
// if setupParameters_ returns a value smaller than 0, there was no error, but
|
// if setupParameters_ returns a value smaller than 0, there was no error, but
|
||||||
// the program should abort. This is the case e.g. for the --help and the
|
// the program should abort. This is the case e.g. for the --help and the
|
||||||
// --print-properties parameters.
|
// --print-properties parameters.
|
||||||
|
#if HAVE_MPI
|
||||||
|
MPI_Finalize();
|
||||||
|
#endif
|
||||||
return (status >= 0)?status:0;
|
return (status >= 0)?status:0;
|
||||||
|
}
|
||||||
|
|
||||||
FileOutputMode outputMode = FileOutputMode::OUTPUT_NONE;
|
FileOutputMode outputMode = FileOutputMode::OUTPUT_NONE;
|
||||||
bool outputCout = false;
|
bool outputCout = false;
|
||||||
|
@ -150,14 +150,45 @@ namespace Opm
|
|||||||
// read in the command line parameters
|
// read in the command line parameters
|
||||||
int status = Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/true);
|
int status = Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/true);
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
// deal with --print-properties and --print-parameters
|
|
||||||
|
|
||||||
bool doExit = false;
|
|
||||||
|
|
||||||
int mpiRank = 0;
|
int mpiRank = 0;
|
||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// deal with unknown parameters.
|
||||||
|
|
||||||
|
int unknownKeyWords = 0;
|
||||||
|
if (mpiRank == 0) {
|
||||||
|
unknownKeyWords = Opm::Parameters::printUnused<TypeTag>(std::cerr);
|
||||||
|
}
|
||||||
|
#if HAVE_MPI
|
||||||
|
int globalUnknownKeyWords;
|
||||||
|
MPI_Allreduce(&unknownKeyWords, &globalUnknownKeyWords, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
|
||||||
|
unknownKeyWords = globalUnknownKeyWords;
|
||||||
|
#endif
|
||||||
|
if ( unknownKeyWords )
|
||||||
|
{
|
||||||
|
if ( mpiRank == 0 )
|
||||||
|
{
|
||||||
|
std::string msg = "Aborting simulation due to unknown "
|
||||||
|
"parameters. Please query \"flow --help\" for "
|
||||||
|
"supported command line parameters.";
|
||||||
|
if (OpmLog::hasBackend("STREAMLOG"))
|
||||||
|
{
|
||||||
|
OpmLog::error(msg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << msg << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// deal with --print-properties and --print-parameters and unknown parameters.
|
||||||
|
|
||||||
|
bool doExit = false;
|
||||||
|
|
||||||
if (EWOMS_GET_PARAM(TypeTag, int, PrintProperties) == 1) {
|
if (EWOMS_GET_PARAM(TypeTag, int, PrintProperties) == 1) {
|
||||||
doExit = true;
|
doExit = true;
|
||||||
if (mpiRank == 0)
|
if (mpiRank == 0)
|
||||||
@ -209,33 +240,7 @@ namespace Opm
|
|||||||
|
|
||||||
setupParallelism();
|
setupParallelism();
|
||||||
setupEbosSimulator(output_cout);
|
setupEbosSimulator(output_cout);
|
||||||
int unknownKeyWords = printPRTHeader(output_cout);
|
printPRTHeader(output_cout);
|
||||||
#if HAVE_MPI
|
|
||||||
int globalUnknownKeyWords;
|
|
||||||
MPI_Allreduce(&unknownKeyWords, &globalUnknownKeyWords, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
|
|
||||||
unknownKeyWords = globalUnknownKeyWords;
|
|
||||||
#endif
|
|
||||||
if ( unknownKeyWords )
|
|
||||||
{
|
|
||||||
if ( output_cout )
|
|
||||||
{
|
|
||||||
std::string msg = "Aborting simulation due to unknown "
|
|
||||||
"parameters. Please query \"flow --help\" for "
|
|
||||||
"supported command line parameters.";
|
|
||||||
if (OpmLog::hasBackend("STREAMLOG"))
|
|
||||||
{
|
|
||||||
OpmLog::error(msg);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
std::cerr << msg << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_MPI
|
|
||||||
MPI_Finalize();
|
|
||||||
#endif
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
runDiagnostics(output_cout);
|
runDiagnostics(output_cout);
|
||||||
createSimulator();
|
createSimulator();
|
||||||
|
|
||||||
@ -290,10 +295,9 @@ namespace Opm
|
|||||||
ThreadManager::init();
|
ThreadManager::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Print an ASCII-art header to the PRT and DEBUG files.
|
// Print an ASCII-art header to the PRT and DEBUG files.
|
||||||
// \return Whether unkown keywords were seen during parsing.
|
// \return Whether unkown keywords were seen during parsing.
|
||||||
bool printPRTHeader(bool output_cout)
|
void printPRTHeader(bool output_cout)
|
||||||
{
|
{
|
||||||
if (output_cout) {
|
if (output_cout) {
|
||||||
const std::string version = moduleVersion();
|
const std::string version = moduleVersion();
|
||||||
@ -333,15 +337,6 @@ namespace Opm
|
|||||||
|
|
||||||
OpmLog::note(ss.str());
|
OpmLog::note(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mpi_rank_ == 0 )
|
|
||||||
{
|
|
||||||
return Opm::Parameters::printUnused<TypeTag>(std::cerr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mergeParallelLogFiles(bool output_to_files)
|
void mergeParallelLogFiles(bool output_to_files)
|
||||||
|
Loading…
Reference in New Issue
Block a user