From 9b0e86a1725eb0a067b30d0a7ee4ce143865f39e Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 13 May 2019 10:27:42 +0200 Subject: [PATCH] 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. --- opm/autodiff/FlowMainEbos.hpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/opm/autodiff/FlowMainEbos.hpp b/opm/autodiff/FlowMainEbos.hpp index 6489161f2..886577e32 100644 --- a/opm/autodiff/FlowMainEbos.hpp +++ b/opm/autodiff/FlowMainEbos.hpp @@ -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(ss); OpmLog::note(ss.str()); - } + } + + if ( mpi_rank_ == 0 ) + { + return Ewoms::Parameters::printUnused(std::cerr); + } + else + { + return false; + } } void mergeParallelLogFiles()