Abort if flow is run with unknown keywords.

This change will print the encountered unknown keywords to std::cerr
(albeit in the format ThisKeyword and not --this-keyword) and abort
before running the simulator.
This commit is contained in:
Markus Blatt 2019-05-13 10:27:42 +02:00
parent 2d27226538
commit 9b0e86a172

View File

@ -227,7 +227,19 @@ namespace Opm
setupOutput();
setupEbosSimulator();
setupLogging();
printPRTHeader();
int unknownKeyWords = printPRTHeader();
#if HAVE_MPI
int globalUnknownKeyWords;
MPI_Allreduce(&unknownKeyWords, &globalUnknownKeyWords, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
unknownKeyWords = globalUnknownKeyWords;
#endif
if ( unknownKeyWords )
{
#if HAVE_MPI
MPI_Finalize();
#endif
exit(EXIT_FAILURE);
}
runDiagnostics();
createSimulator();
@ -379,7 +391,8 @@ namespace Opm
}
// Print an ASCII-art header to the PRT and DEBUG files.
void printPRTHeader()
// \return Whether unkown keywords were seen during parsing.
bool printPRTHeader()
{
if (output_cout_) {
const std::string version = moduleVersion();
@ -418,7 +431,16 @@ namespace Opm
Ewoms::Parameters::printValues<TypeTag>(ss);
OpmLog::note(ss.str());
}
}
if ( mpi_rank_ == 0 )
{
return Ewoms::Parameters::printUnused<TypeTag>(std::cerr);
}
else
{
return false;
}
}
void mergeParallelLogFiles()