Merge pull request #5547 from lisajulia/feature/action-parsing-strictness

Add action-parsing-strictness command line parameter
This commit is contained in:
Markus Blatt 2024-08-26 09:06:25 +02:00 committed by GitHub
commit 7ebb6e7034
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 7 deletions

View File

@ -149,7 +149,7 @@ void FlowGenericVanguard::readDeck(const std::string& filename)
modelParams_.actionState_,
modelParams_.wtestState_,
modelParams_.eclSummaryConfig_,
nullptr, "normal", "100", false, false, {});
nullptr, "normal", "normal", "100", false, false, {});
modelParams_.setupTime_ = setupTimer.stop();
}
@ -401,6 +401,10 @@ void FlowGenericVanguard::registerParameters_()
"high (stop for all errors) and "
"low (as normal, except do not stop due to unsupported "
"keywords even if marked critical");
Parameters::Register<Parameters::ActionParsingStrictness>
("Set strictness of parsing process for ActionX and PyAction. Available options are "
"normal (do not apply keywords that have not been tested for ActionX or PyAction) and "
"low (try to apply all keywords, beware: the simulation outcome might be incorrect).");
Parameters::Register<Parameters::InputSkipMode>
("Set compatibility mode for the SKIP100/SKIP300 keywords. Options are "
"100 (skip SKIP100..ENDSKIP, keep SKIP300..ENDSKIP) [default], "

View File

@ -67,6 +67,7 @@ struct NumJacobiBlocks { static constexpr int value = 0; };
struct OwnerCellsFirst { static constexpr bool value = true; };
struct ParsingStrictness { static constexpr auto value = "normal"; };
struct ActionParsingStrictness { static constexpr auto value = "normal"; };
// 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
struct PartitionMethod { static constexpr int value = 1; };

View File

@ -200,6 +200,7 @@ void Main::readDeck(const std::string& deckFilename,
const bool init_from_restart_file,
const bool allRanksDbgPrtLog,
const std::string& parsingStrictness,
const std::string& actionParsingStrictness,
const std::string& inputSkipMode,
const std::size_t numThreads,
const int output_param,
@ -233,6 +234,7 @@ void Main::readDeck(const std::string& deckFilename,
summaryConfig_,
std::make_shared<Python>(),
parsingStrictness,
actionParsingStrictness,
inputSkipMode,
init_from_restart_file,
outputCout_,

View File

@ -421,6 +421,7 @@ private:
!Parameters::Get<Parameters::SchedRestart>(),
Parameters::Get<Parameters::EnableLoggingFalloutWarning>(),
Parameters::Get<Parameters::ParsingStrictness>(),
Parameters::Get<Parameters::ActionParsingStrictness>(),
Parameters::Get<Parameters::InputSkipMode>(),
getNumThreads(),
Parameters::Get<Parameters::EclOutputInterval>(),
@ -696,6 +697,7 @@ private:
const bool init_from_restart_file,
const bool allRanksDbgPrtLog,
const std::string& parsingStrictness,
const std::string& actionParsingStrictness,
const std::string& inputSkipMode,
const std::size_t numThreads,
const int output_param,

View File

@ -104,6 +104,7 @@ namespace {
const Opm::ParseContext& parseContext,
const bool initFromRestart,
const std::optional<int>& outputInterval,
const bool lowActionParsingStrictness,
Opm::EclipseState& eclipseState,
std::shared_ptr<Opm::Python> python,
std::shared_ptr<Opm::Schedule>& schedule,
@ -151,7 +152,7 @@ namespace {
if (schedule == nullptr) {
schedule = std::make_shared<Opm::Schedule>
(deck, eclipseState, parseContext, errorGuard,
std::move(python), outputInterval, init_state);
std::move(python), lowActionParsingStrictness, outputInterval, init_state);
}
// Read network pressures from restart
@ -172,6 +173,7 @@ namespace {
void createNonRestartDynamicObjects(const Opm::Deck& deck,
const Opm::EclipseState& eclipseState,
const Opm::ParseContext& parseContext,
const bool lowActionParsingStrictness,
std::shared_ptr<Opm::Python> python,
std::shared_ptr<Opm::Schedule>& schedule,
std::unique_ptr<Opm::UDQState>& udqState,
@ -182,7 +184,7 @@ namespace {
if (schedule == nullptr) {
schedule = std::make_shared<Opm::Schedule>
(deck, eclipseState, parseContext,
errorGuard, std::move(python));
errorGuard, std::move(python), lowActionParsingStrictness);
}
udqState = std::make_unique<Opm::UDQState>
@ -243,6 +245,7 @@ namespace {
const bool initFromRestart,
const bool checkDeck,
const bool treatCriticalAsNonCritical,
const bool lowActionParsingStrictness,
const std::optional<int>& outputInterval,
Opm::ErrorGuard& errorGuard)
{
@ -267,13 +270,14 @@ namespace {
if (eclipseState->getInitConfig().restartRequested()) {
loadObjectsFromRestart(deck, parser, *parseContext,
initFromRestart, outputInterval,
lowActionParsingStrictness,
*eclipseState, std::move(python),
schedule, udqState, actionState, wtestState,
errorGuard);
}
else {
createNonRestartDynamicObjects(deck, *eclipseState,
*parseContext, std::move(python),
createNonRestartDynamicObjects(deck, *eclipseState, *parseContext,
lowActionParsingStrictness, std::move(python),
schedule, udqState, actionState, wtestState,
errorGuard);
}
@ -535,6 +539,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
std::shared_ptr<SummaryConfig>& summaryConfig,
std::shared_ptr<Python> python,
const std::string& parsingStrictness,
const std::string& actionParsingStrictness,
const std::string& inputSkipMode,
const bool initFromRestart,
const bool checkDeck,
@ -549,7 +554,10 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
OPM_THROW(std::runtime_error,
fmt::format("Incorrect value {} for parameter ParsingStrictness, must be 'high', 'normal', or 'low'", parsingStrictness));
}
if (actionParsingStrictness != "normal" && actionParsingStrictness != "low") {
OPM_THROW(std::runtime_error,
fmt::format("Incorrect value {} for parameter ActionParsingStrictness, must be 'normal', or 'low'", actionParsingStrictness));
}
if (inputSkipMode != "100" && inputSkipMode != "300" && inputSkipMode != "all") {
OPM_THROW(std::runtime_error,
fmt::format("Incorrect value {} for parameter InputSkipMode, must be '100', '300', or 'all'", inputSkipMode));
@ -558,6 +566,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
if (comm.rank() == 0) { // Always true when !HAVE_MPI
const bool exitOnAllErrors = (parsingStrictness == "high");
const bool treatCriticalAsNonCritical = (parsingStrictness == "low");
const bool lowActionParsingStrictness = (actionParsingStrictness == "low");
try {
auto parseContext = setupParseContext(exitOnAllErrors);
if (treatCriticalAsNonCritical) { // Continue with invalid names if parsing strictness is set to low
@ -567,7 +576,8 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
readOnIORank(comm, deckFilename, parseContext.get(),
eclipseState, schedule, udqState, actionState, wtestState,
summaryConfig, std::move(python), initFromRestart,
checkDeck, treatCriticalAsNonCritical, outputInterval, *errorGuard);
checkDeck, treatCriticalAsNonCritical, lowActionParsingStrictness,
outputInterval, *errorGuard);
// Update schedule so that re-parsing after actions use same strictness
assert(schedule);

View File

@ -91,6 +91,7 @@ void readDeck(Parallel::Communication comm,
std::shared_ptr<SummaryConfig>& summaryConfig,
std::shared_ptr<Python> python,
const std::string& parsingStrictness,
const std::string& actionParsingStrictness,
const std::string& inputSkipMode,
bool initFromRestart,
bool checkDeck,