diff --git a/opm/simulators/flow/FlowGenericVanguard.cpp b/opm/simulators/flow/FlowGenericVanguard.cpp index f80346de1..c1a5d8d83 100644 --- a/opm/simulators/flow/FlowGenericVanguard.cpp +++ b/opm/simulators/flow/FlowGenericVanguard.cpp @@ -149,7 +149,7 @@ void FlowGenericVanguard::readDeck(const std::string& filename) modelParams_.actionState_, modelParams_.wtestState_, modelParams_.eclSummaryConfig_, - nullptr, "normal", "normal", "100", false, false, {}); + nullptr, "normal", "normal", "100", false, false, false, {}); modelParams_.setupTime_ = setupTimer.stop(); } diff --git a/opm/simulators/flow/Main.cpp b/opm/simulators/flow/Main.cpp index dea425e68..4e02035c4 100644 --- a/opm/simulators/flow/Main.cpp +++ b/opm/simulators/flow/Main.cpp @@ -202,6 +202,7 @@ void Main::readDeck(const std::string& deckFilename, const std::string& parsingStrictness, const std::string& actionParsingStrictness, const std::string& inputSkipMode, + const bool keepKeywords, const std::size_t numThreads, const int output_param, const std::string& parameters, @@ -238,6 +239,7 @@ void Main::readDeck(const std::string& deckFilename, inputSkipMode, init_from_restart_file, outputCout_, + keepKeywords, outputInterval); verifyValidCellGeometry(FlowGenericVanguard::comm(), *this->eclipseState_); diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index f32906e52..f368bfd6b 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -272,12 +272,13 @@ private: protected: /// \brief Initialize /// \param exitCode The exitCode of the program. + /// \param keepKeywords Keep Schedule keywords even if there are no actions /// /// \return Whether to actually run the simulator. I.e. true if /// parsing of command line was successful and no --help, /// --print-properties, or --print-parameters have been found. template - bool initialize_(int& exitCode) + bool initialize_(int& exitCode, bool keepKeywords = false) { Dune::Timer externalSetupTimer; externalSetupTimer.start(); @@ -404,6 +405,7 @@ protected: Parameters::Get(), Parameters::Get(), Parameters::Get(), + keepKeywords, getNumThreads(), Parameters::Get(), cmdline_params, @@ -683,6 +685,7 @@ private: const std::string& parsingStrictness, const std::string& actionParsingStrictness, const std::string& inputSkipMode, + const bool keepKeywords, const std::size_t numThreads, const int output_param, const std::string& parameters, diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index d05edb1b3..0be2ef0f7 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -73,12 +73,10 @@ #include #include #include -#include #include #include #include #include -#include #include namespace { @@ -105,6 +103,7 @@ namespace { const bool initFromRestart, const std::optional& outputInterval, const bool lowActionParsingStrictness, + const bool keepKeywords, Opm::EclipseState& eclipseState, std::shared_ptr python, std::shared_ptr& schedule, @@ -152,7 +151,8 @@ namespace { if (schedule == nullptr) { schedule = std::make_shared (deck, eclipseState, parseContext, errorGuard, - std::move(python), lowActionParsingStrictness, outputInterval, init_state); + std::move(python), lowActionParsingStrictness, + keepKeywords, outputInterval, init_state); } // Read network pressures from restart @@ -174,6 +174,7 @@ namespace { const Opm::EclipseState& eclipseState, const Opm::ParseContext& parseContext, const bool lowActionParsingStrictness, + const bool keepKeywords, std::shared_ptr python, std::shared_ptr& schedule, std::unique_ptr& udqState, @@ -184,7 +185,7 @@ namespace { if (schedule == nullptr) { schedule = std::make_shared (deck, eclipseState, parseContext, - errorGuard, std::move(python), lowActionParsingStrictness); + errorGuard, std::move(python), lowActionParsingStrictness, keepKeywords); } udqState = std::make_unique @@ -246,6 +247,7 @@ namespace { const bool checkDeck, const bool treatCriticalAsNonCritical, const bool lowActionParsingStrictness, + const bool keepKeywords, const std::optional& outputInterval, Opm::ErrorGuard& errorGuard) { @@ -270,14 +272,15 @@ namespace { if (eclipseState->getInitConfig().restartRequested()) { loadObjectsFromRestart(deck, parser, *parseContext, initFromRestart, outputInterval, - lowActionParsingStrictness, + lowActionParsingStrictness, keepKeywords, *eclipseState, std::move(python), schedule, udqState, actionState, wtestState, errorGuard); } else { createNonRestartDynamicObjects(deck, *eclipseState, *parseContext, - lowActionParsingStrictness, std::move(python), + lowActionParsingStrictness, keepKeywords, + std::move(python), schedule, udqState, actionState, wtestState, errorGuard); } @@ -535,6 +538,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm, const std::string& inputSkipMode, const bool initFromRestart, const bool checkDeck, + const bool keepKeywords, const std::optional& outputInterval) { auto errorGuard = std::make_unique(); @@ -569,7 +573,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm, eclipseState, schedule, udqState, actionState, wtestState, summaryConfig, std::move(python), initFromRestart, checkDeck, treatCriticalAsNonCritical, lowActionParsingStrictness, - outputInterval, *errorGuard); + keepKeywords, outputInterval, *errorGuard); // Update schedule so that re-parsing after actions use same strictness assert(schedule); diff --git a/opm/simulators/utils/readDeck.hpp b/opm/simulators/utils/readDeck.hpp index 3be4ad036..87da15315 100644 --- a/opm/simulators/utils/readDeck.hpp +++ b/opm/simulators/utils/readDeck.hpp @@ -98,6 +98,7 @@ void readDeck(Parallel::Communication comm, const std::string& inputSkipMode, bool initFromRestart, bool checkDeck, + bool keepKeywords, const std::optional& outputInterval); void verifyValidCellGeometry(Parallel::Communication comm, diff --git a/python/simulators/PyMain.hpp b/python/simulators/PyMain.hpp index fdf547515..55fe00ae9 100644 --- a/python/simulators/PyMain.hpp +++ b/python/simulators/PyMain.hpp @@ -42,7 +42,7 @@ public: std::unique_ptr initFlowBlackoil(int& exitCode) { exitCode = EXIT_SUCCESS; - if (initialize_(exitCode)) { + if (initialize_(exitCode, true)) { // TODO: check that this deck really represents a blackoil // case. E.g. check that number of phases == 3 this->setupVanguard();