Add parameter InputSkipMode to parameterise the behvaviour of the SKIP100 and SKIP300 keywords

This commit is contained in:
Vegard Kippe 2024-05-03 09:28:14 +02:00
parent da5f20a0d9
commit b68a55a9b9
6 changed files with 26 additions and 1 deletions

View File

@ -73,6 +73,10 @@ struct ParsingStrictness {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct InputSkipMode {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct SchedRestart {
using type = UndefinedProperty;
};
@ -148,6 +152,10 @@ struct ParsingStrictness<TypeTag, TTag::FlowBaseVanguard> {
static constexpr auto value = "normal";
};
template<class TypeTag>
struct InputSkipMode<TypeTag, TTag::FlowBaseVanguard> {
static constexpr auto value = "100";
};
template<class TypeTag>
struct SchedRestart<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = false;
};
@ -253,6 +261,11 @@ public:
"high (stop for all errors) and "
"low (as normal, except do not stop due to unsupported "
"keywords even if marked critical");
Parameters::registerParam<TypeTag, Properties::InputSkipMode>
("Set compatibility mode for the SKIP100/SKIP300 keywords. Options are "
"100 (skip SKIP100..ENDSKIP, keep SKIP300..ENDSKIP) [default], "
"300 (skip SKIP300..ENDSKIP, keep SKIP100..ENDSKIP) and "
"all (skip both SKIP100..ENDSKIP and SKIP300..ENDSKIP) ");
Parameters::registerParam<TypeTag, Properties::SchedRestart>
("When restarting: should we try to initialize wells and "
"groups from historical SCHEDULE section.");

View File

@ -136,7 +136,7 @@ void FlowGenericVanguard::readDeck(const std::string& filename)
modelParams_.actionState_,
modelParams_.wtestState_,
modelParams_.eclSummaryConfig_,
nullptr, "normal", false, false, {});
nullptr, "normal", "100", false, false, {});
modelParams_.setupTime_ = setupTimer.stop();
}

View File

@ -188,6 +188,7 @@ void Main::readDeck(const std::string& deckFilename,
const bool init_from_restart_file,
const bool allRanksDbgPrtLog,
const std::string& parsingStrictness,
const std::string& inputSkipMode,
const std::size_t numThreads,
const int output_param,
const std::string& parameters,
@ -220,6 +221,7 @@ void Main::readDeck(const std::string& deckFilename,
summaryConfig_,
std::make_shared<Python>(),
parsingStrictness,
inputSkipMode,
init_from_restart_file,
outputCout_,
outputInterval);

View File

@ -417,6 +417,7 @@ private:
!Parameters::get<PreTypeTag, Properties::SchedRestart>(),
Parameters::get<PreTypeTag, Properties::EnableLoggingFalloutWarning>(),
Parameters::get<PreTypeTag, Properties::ParsingStrictness>(),
Parameters::get<PreTypeTag, Properties::InputSkipMode>(),
getNumThreads<PreTypeTag>(),
Parameters::get<PreTypeTag, Properties::EclOutputInterval>(),
cmdline_params,
@ -691,6 +692,7 @@ private:
const bool init_from_restart_file,
const bool allRanksDbgPrtLog,
const std::string& parsingStrictness,
const std::string& inputSkipMode,
const std::size_t numThreads,
const int output_param,
const std::string& parameters,

View File

@ -536,6 +536,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& inputSkipMode,
const bool initFromRestart,
const bool checkDeck,
const std::optional<int>& outputInterval)
@ -550,6 +551,11 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
fmt::format("Incorrect value {} for parameter ParsingStrictness, must be 'high', 'normal', or 'low'", parsingStrictness));
}
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));
}
if (comm.rank() == 0) { // Always true when !HAVE_MPI
const bool exitOnAllErrors = (parsingStrictness == "high");
const bool treatCriticalAsNonCritical = (parsingStrictness == "low");
@ -558,6 +564,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
if (treatCriticalAsNonCritical) { // Continue with invalid names if parsing strictness is set to low
parseContext->update(ParseContext::SCHEDULE_INVALID_NAME, InputErrorAction::WARN);
}
parseContext->setInputSkipMode(inputSkipMode);
readOnIORank(comm, deckFilename, parseContext.get(),
eclipseState, schedule, udqState, actionState, wtestState,
summaryConfig, std::move(python), initFromRestart,

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& inputSkipMode,
bool initFromRestart,
bool checkDeck,
const std::optional<int>& outputInterval);