mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Remove EclStrictParsing, replace with ParsingStrictness.
The new parameter takes the "high", "normal" (default), or "low" string. Also implemented behaviour.
This commit is contained in:
parent
04d2b8f39d
commit
9ca6034388
@ -65,7 +65,7 @@ struct EnableOpmRstFile {
|
|||||||
using type = UndefinedProperty;
|
using type = UndefinedProperty;
|
||||||
};
|
};
|
||||||
template<class TypeTag, class MyTypeTag>
|
template<class TypeTag, class MyTypeTag>
|
||||||
struct EclStrictParsing {
|
struct ParsingStrictness {
|
||||||
using type = UndefinedProperty;
|
using type = UndefinedProperty;
|
||||||
};
|
};
|
||||||
template<class TypeTag, class MyTypeTag>
|
template<class TypeTag, class MyTypeTag>
|
||||||
@ -134,8 +134,8 @@ struct EnableOpmRstFile<TypeTag, TTag::EclBaseVanguard> {
|
|||||||
static constexpr bool value = false;
|
static constexpr bool value = false;
|
||||||
};
|
};
|
||||||
template<class TypeTag>
|
template<class TypeTag>
|
||||||
struct EclStrictParsing<TypeTag, TTag::EclBaseVanguard> {
|
struct ParsingStrictness<TypeTag, TTag::EclBaseVanguard> {
|
||||||
static constexpr bool value = false;
|
static constexpr auto value = "normal";
|
||||||
};
|
};
|
||||||
template<class TypeTag>
|
template<class TypeTag>
|
||||||
struct SchedRestart<TypeTag, TTag::EclBaseVanguard> {
|
struct SchedRestart<TypeTag, TTag::EclBaseVanguard> {
|
||||||
@ -231,8 +231,8 @@ public:
|
|||||||
"Include OPM-specific keywords in the ECL restart file to enable restart of OPM simulators from these files");
|
"Include OPM-specific keywords in the ECL restart file to enable restart of OPM simulators from these files");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, IgnoreKeywords,
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, IgnoreKeywords,
|
||||||
"List of Eclipse keywords which should be ignored. As a ':' separated string.");
|
"List of Eclipse keywords which should be ignored. As a ':' separated string.");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, bool, EclStrictParsing,
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, ParsingStrictness,
|
||||||
"Use strict mode for parsing - all errors are collected before the applicaton exists.");
|
"Set strictness of parsing process. Avaliable options are normal (stop for critical errors), high (stop for all errors) and low (as normal, except do not stop due to unsupported keywords even if marked critical");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, bool, SchedRestart,
|
EWOMS_REGISTER_PARAM(TypeTag, bool, SchedRestart,
|
||||||
"When restarting: should we try to initialize wells and groups from historical SCHEDULE section.");
|
"When restarting: should we try to initialize wells and groups from historical SCHEDULE section.");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, int, EdgeWeightsMethod,
|
EWOMS_REGISTER_PARAM(TypeTag, int, EdgeWeightsMethod,
|
||||||
@ -290,7 +290,6 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
enableDistributedWells_ = EWOMS_GET_PARAM(TypeTag, bool, AllowDistributedWells);
|
enableDistributedWells_ = EWOMS_GET_PARAM(TypeTag, bool, AllowDistributedWells);
|
||||||
ignoredKeywords_ = EWOMS_GET_PARAM(TypeTag, std::string, IgnoreKeywords);
|
ignoredKeywords_ = EWOMS_GET_PARAM(TypeTag, std::string, IgnoreKeywords);
|
||||||
eclStrictParsing_ = EWOMS_GET_PARAM(TypeTag, bool, EclStrictParsing);
|
|
||||||
int output_param = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
|
int output_param = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
|
||||||
if (output_param >= 0)
|
if (output_param >= 0)
|
||||||
outputInterval_ = output_param;
|
outputInterval_ = output_param;
|
||||||
|
@ -133,7 +133,7 @@ void EclGenericVanguard::readDeck(const std::string& filename)
|
|||||||
modelParams_.actionState_,
|
modelParams_.actionState_,
|
||||||
modelParams_.wtestState_,
|
modelParams_.wtestState_,
|
||||||
modelParams_.eclSummaryConfig_,
|
modelParams_.eclSummaryConfig_,
|
||||||
nullptr, false, false, false, {});
|
nullptr, "normal", false, false, {});
|
||||||
modelParams_.setupTime_ = setupTimer.stop();
|
modelParams_.setupTime_ = setupTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,6 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
bool enableDistributedWells_;
|
bool enableDistributedWells_;
|
||||||
std::string ignoredKeywords_;
|
std::string ignoredKeywords_;
|
||||||
bool eclStrictParsing_;
|
|
||||||
std::optional<int> outputInterval_;
|
std::optional<int> outputInterval_;
|
||||||
bool useMultisegmentWell_;
|
bool useMultisegmentWell_;
|
||||||
bool enableExperiments_;
|
bool enableExperiments_;
|
||||||
|
@ -171,7 +171,7 @@ void Main::readDeck(const std::string& deckFilename,
|
|||||||
const std::string& outputMode,
|
const std::string& outputMode,
|
||||||
const bool init_from_restart_file,
|
const bool init_from_restart_file,
|
||||||
const bool allRanksDbgPrtLog,
|
const bool allRanksDbgPrtLog,
|
||||||
const bool strictParsing,
|
const std::string& parsingStrictness,
|
||||||
const int mpiRank,
|
const int mpiRank,
|
||||||
const int output_param,
|
const int output_param,
|
||||||
const std::string& parameters,
|
const std::string& parameters,
|
||||||
@ -202,7 +202,7 @@ void Main::readDeck(const std::string& deckFilename,
|
|||||||
wtestState_,
|
wtestState_,
|
||||||
summaryConfig_,
|
summaryConfig_,
|
||||||
std::make_shared<Python>(),
|
std::make_shared<Python>(),
|
||||||
strictParsing,
|
parsingStrictness,
|
||||||
init_from_restart_file,
|
init_from_restart_file,
|
||||||
outputCout_,
|
outputCout_,
|
||||||
outputInterval);
|
outputInterval);
|
||||||
|
@ -374,7 +374,7 @@ private:
|
|||||||
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
|
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
|
||||||
!EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart),
|
!EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart),
|
||||||
EWOMS_GET_PARAM(PreTypeTag, bool, EnableLoggingFalloutWarning),
|
EWOMS_GET_PARAM(PreTypeTag, bool, EnableLoggingFalloutWarning),
|
||||||
EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing),
|
EWOMS_GET_PARAM(PreTypeTag, std::string, ParsingStrictness),
|
||||||
mpiRank,
|
mpiRank,
|
||||||
EWOMS_GET_PARAM(PreTypeTag, int, EclOutputInterval),
|
EWOMS_GET_PARAM(PreTypeTag, int, EclOutputInterval),
|
||||||
cmdline_params,
|
cmdline_params,
|
||||||
@ -626,7 +626,7 @@ private:
|
|||||||
const std::string& outputMode,
|
const std::string& outputMode,
|
||||||
const bool init_from_restart_file,
|
const bool init_from_restart_file,
|
||||||
const bool allRanksDbgPrtLog,
|
const bool allRanksDbgPrtLog,
|
||||||
const bool strictParsing,
|
const std::string& parsingStrictness,
|
||||||
const int mpiRank,
|
const int mpiRank,
|
||||||
const int output_param,
|
const int output_param,
|
||||||
const std::string& parameters,
|
const std::string& parameters,
|
||||||
|
@ -191,6 +191,7 @@ namespace {
|
|||||||
const bool checkDeck,
|
const bool checkDeck,
|
||||||
const Opm::Parser& parser,
|
const Opm::Parser& parser,
|
||||||
const Opm::ParseContext& parseContext,
|
const Opm::ParseContext& parseContext,
|
||||||
|
const bool treatCriticalAsNonCritical,
|
||||||
Opm::ErrorGuard& errorGuard)
|
Opm::ErrorGuard& errorGuard)
|
||||||
{
|
{
|
||||||
Opm::Deck deck(parser.parseFile(deckFilename, parseContext, errorGuard));
|
Opm::Deck deck(parser.parseFile(deckFilename, parseContext, errorGuard));
|
||||||
@ -203,7 +204,7 @@ namespace {
|
|||||||
Opm::KeywordValidation::specialValidation()
|
Opm::KeywordValidation::specialValidation()
|
||||||
};
|
};
|
||||||
|
|
||||||
keyword_validator.validateDeck(deck, parseContext, true, errorGuard);
|
keyword_validator.validateDeck(deck, parseContext, treatCriticalAsNonCritical, errorGuard);
|
||||||
|
|
||||||
if (checkDeck) {
|
if (checkDeck) {
|
||||||
Opm::checkDeck(deck, parser, parseContext, errorGuard);
|
Opm::checkDeck(deck, parser, parseContext, errorGuard);
|
||||||
@ -235,6 +236,7 @@ namespace {
|
|||||||
std::shared_ptr<Opm::Python> python,
|
std::shared_ptr<Opm::Python> python,
|
||||||
const bool initFromRestart,
|
const bool initFromRestart,
|
||||||
const bool checkDeck,
|
const bool checkDeck,
|
||||||
|
const bool treatCriticalAsNonCritical,
|
||||||
const std::optional<int>& outputInterval,
|
const std::optional<int>& outputInterval,
|
||||||
Opm::ErrorGuard& errorGuard)
|
Opm::ErrorGuard& errorGuard)
|
||||||
{
|
{
|
||||||
@ -248,7 +250,7 @@ namespace {
|
|||||||
|
|
||||||
auto parser = Opm::Parser{};
|
auto parser = Opm::Parser{};
|
||||||
const auto deck = readDeckFile(deckFilename, checkDeck, parser,
|
const auto deck = readDeckFile(deckFilename, checkDeck, parser,
|
||||||
*parseContext, errorGuard);
|
*parseContext, treatCriticalAsNonCritical, errorGuard);
|
||||||
|
|
||||||
if (eclipseState == nullptr) {
|
if (eclipseState == nullptr) {
|
||||||
eclipseState = createEclipseState(comm, deck);
|
eclipseState = createEclipseState(comm, deck);
|
||||||
@ -490,7 +492,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
|||||||
std::unique_ptr<WellTestState>& wtestState,
|
std::unique_ptr<WellTestState>& wtestState,
|
||||||
std::shared_ptr<SummaryConfig>& summaryConfig,
|
std::shared_ptr<SummaryConfig>& summaryConfig,
|
||||||
std::shared_ptr<Python> python,
|
std::shared_ptr<Python> python,
|
||||||
const bool strictParsing,
|
const std::string& parsingStrictness,
|
||||||
const bool initFromRestart,
|
const bool initFromRestart,
|
||||||
const bool checkDeck,
|
const bool checkDeck,
|
||||||
const std::optional<int>& outputInterval)
|
const std::optional<int>& outputInterval)
|
||||||
@ -500,13 +502,20 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
|||||||
int parseSuccess = 1; // > 0 is success
|
int parseSuccess = 1; // > 0 is success
|
||||||
std::string failureMessage;
|
std::string failureMessage;
|
||||||
|
|
||||||
|
if (parsingStrictness != "high" && parsingStrictness != "normal" && parsingStrictness != "low") {
|
||||||
|
OPM_THROW(std::runtime_error,
|
||||||
|
fmt::format("Incorrect value {} for parameter ParsingStrictness, must be 'high', 'normal', or 'low'"));
|
||||||
|
}
|
||||||
|
|
||||||
if (comm.rank() == 0) { // Always true when !HAVE_MPI
|
if (comm.rank() == 0) { // Always true when !HAVE_MPI
|
||||||
|
const bool exitOnAllErrors = (parsingStrictness == "high");
|
||||||
|
const bool treatCriticalAsNonCritical = (parsingStrictness == "low");
|
||||||
try {
|
try {
|
||||||
auto parseContext = setupParseContext(strictParsing);
|
auto parseContext = setupParseContext(exitOnAllErrors);
|
||||||
readOnIORank(comm, deckFilename, parseContext.get(),
|
readOnIORank(comm, deckFilename, parseContext.get(),
|
||||||
eclipseState, schedule, udqState, actionState, wtestState,
|
eclipseState, schedule, udqState, actionState, wtestState,
|
||||||
summaryConfig, std::move(python), initFromRestart,
|
summaryConfig, std::move(python), initFromRestart,
|
||||||
checkDeck, outputInterval, *errorGuard);
|
checkDeck, treatCriticalAsNonCritical, outputInterval, *errorGuard);
|
||||||
}
|
}
|
||||||
catch (const OpmInputError& input_error) {
|
catch (const OpmInputError& input_error) {
|
||||||
failureMessage = input_error.what();
|
failureMessage = input_error.what();
|
||||||
|
@ -60,7 +60,7 @@ enum class FileOutputMode {
|
|||||||
void
|
void
|
||||||
ensureOutputDirExists(const std::string& cmdline_output_dir);
|
ensureOutputDirExists(const std::string& cmdline_output_dir);
|
||||||
|
|
||||||
std::unique_ptr<ParseContext> setupParseContext(const bool strictParsing);
|
std::unique_ptr<ParseContext> setupParseContext(const bool exitOnAllErrors);
|
||||||
|
|
||||||
// Setup the OpmLog backends
|
// Setup the OpmLog backends
|
||||||
FileOutputMode
|
FileOutputMode
|
||||||
@ -85,7 +85,7 @@ void readDeck(Parallel::Communication comm,
|
|||||||
std::unique_ptr<WellTestState>& wtestState,
|
std::unique_ptr<WellTestState>& wtestState,
|
||||||
std::shared_ptr<SummaryConfig>& summaryConfig,
|
std::shared_ptr<SummaryConfig>& summaryConfig,
|
||||||
std::shared_ptr<Python> python,
|
std::shared_ptr<Python> python,
|
||||||
bool strictParsing,
|
const std::string& parsingStrictness,
|
||||||
bool initFromRestart,
|
bool initFromRestart,
|
||||||
bool checkDeck,
|
bool checkDeck,
|
||||||
const std::optional<int>& outputInterval);
|
const std::optional<int>& outputInterval);
|
||||||
|
Loading…
Reference in New Issue
Block a user