From 371c8058bc14978e0fceafd7500944c38cf88b73 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 14 Jun 2022 10:09:35 +0200 Subject: [PATCH] changed: remove support for internal deck handling in simulators --- ebos/eclgenericvanguard.cc | 23 ++++++--------------- ebos/eclgenericvanguard.hh | 14 +++---------- flow/flow_ebos_blackoil.cpp | 2 +- flow/flow_ebos_brine.cpp | 2 +- flow/flow_ebos_brine_precsalt_vapwat.cpp | 2 +- flow/flow_ebos_brine_saltprecipitation.cpp | 2 +- flow/flow_ebos_energy.cpp | 2 +- flow/flow_ebos_extbo.cpp | 2 +- flow/flow_ebos_foam.cpp | 2 +- flow/flow_ebos_gasoil.cpp | 2 +- flow/flow_ebos_gasoil_energy.cpp | 2 +- flow/flow_ebos_gaswater.cpp | 2 +- flow/flow_ebos_gaswater_brine.cpp | 2 +- flow/flow_ebos_gaswater_saltprec_vapwat.cpp | 2 +- flow/flow_ebos_micp.cpp | 2 +- flow/flow_ebos_oilwater.cpp | 2 +- flow/flow_ebos_oilwater_brine.cpp | 2 +- flow/flow_ebos_oilwater_polymer.cpp | 2 +- flow/flow_ebos_onephase.cpp | 2 +- flow/flow_ebos_onephase_energy.cpp | 2 +- flow/flow_ebos_polymer.cpp | 2 +- flow/flow_ebos_solvent.cpp | 2 +- opm/simulators/flow/Main.hpp | 2 +- 23 files changed, 30 insertions(+), 49 deletions(-) diff --git a/ebos/eclgenericvanguard.cc b/ebos/eclgenericvanguard.cc index 04746a52c..7fe30563b 100644 --- a/ebos/eclgenericvanguard.cc +++ b/ebos/eclgenericvanguard.cc @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -54,10 +53,9 @@ namespace Opm { double EclGenericVanguard::setupTime_ = 0.0; +std::shared_ptr EclGenericVanguard::deck_; std::unique_ptr EclGenericVanguard::externalParseContext_; std::unique_ptr EclGenericVanguard::externalErrorGuard_; -std::shared_ptr EclGenericVanguard::externalDeck_; -bool EclGenericVanguard::externalDeckSet_ = false; std::shared_ptr EclGenericVanguard::externalEclState_; std::shared_ptr EclGenericVanguard::externalEclSchedule_; std::shared_ptr EclGenericVanguard::externalEclSummaryConfig_; @@ -105,16 +103,14 @@ void EclGenericVanguard::setExternalSummaryConfig( externalEclSummaryConfig_ = std::move(summaryConfig); } -void EclGenericVanguard::setExternalDeck(std::shared_ptr deck) +void EclGenericVanguard::setDeck(std::shared_ptr deck) { - externalDeck_ = std::move(deck); - externalDeckSet_ = true; + deck_ = std::move(deck); } -void EclGenericVanguard::setExternalDeck(std::unique_ptr deck) +void EclGenericVanguard::setDeck(std::unique_ptr deck) { - externalDeck_ = std::move(deck); - externalDeckSet_ = true; + deck_ = std::move(deck); } void EclGenericVanguard::setExternalEclState(std::shared_ptr eclState) @@ -266,10 +262,8 @@ void EclGenericVanguard::init() // Check that we are in one of the known configurations for external variables // and move them to internal - if (externalDeck_) + if (true) { - deck_ = std::move(externalDeck_); - if (externalParseContext_ && externalErrorGuard_ ) { parseContext_ = std::move(externalParseContext_); @@ -296,11 +290,6 @@ void EclGenericVanguard::init() parseContext_ = createParseContext(ignoredKeywords_, eclStrictParsing_); } - readDeck(EclGenericVanguard::comm(), fileName_, deck_, eclState_, eclSchedule_, udqState_, actionState_, wtestState_, - eclSummaryConfig_, std::move(errorGuard), python, - std::move(parseContext_), /* initFromRestart = */ false, - /* checkDeck = */ enableExperiments_, outputInterval_); - if (EclGenericVanguard::externalUDQState_) this->udqState_ = std::move(EclGenericVanguard::externalUDQState_); else diff --git a/ebos/eclgenericvanguard.hh b/ebos/eclgenericvanguard.hh index abccb968e..471b7089a 100644 --- a/ebos/eclgenericvanguard.hh +++ b/ebos/eclgenericvanguard.hh @@ -120,15 +120,9 @@ public: /*! * \brief Set the Opm::Deck object which ought to be used when the simulator vanguard * is instantiated. - * - * This is basically an optimization: In cases where the ECL input deck must be - * examined to decide which simulator ought to be used, this avoids having to parse - * the input twice. When this method is used, the caller is responsible for lifetime - * management of these two objects, i.e., they are not allowed to be deleted as long - * as the simulator vanguard object is alive. */ - static void setExternalDeck(std::shared_ptr deck); - static void setExternalDeck(std::unique_ptr deck); + static void setDeck(std::shared_ptr deck); + static void setDeck(std::unique_ptr deck); /*! * \brief Set the Opm::EclipseState object which ought to be used when the simulator @@ -321,12 +315,10 @@ protected: static std::unique_ptr externalErrorGuard_; // These variables may be owned by both Python and the simulator - static std::shared_ptr externalDeck_; static std::shared_ptr externalEclState_; static std::shared_ptr externalEclSchedule_; static std::shared_ptr externalEclSummaryConfig_; - static bool externalDeckSet_; static std::unique_ptr externalUDQState_; static std::unique_ptr externalActionState_; static std::unique_ptr externalWTestState_; @@ -366,7 +358,7 @@ protected: std::unique_ptr errorGuard_; std::shared_ptr python; // These variables may be owned by both Python and the simulator - std::shared_ptr deck_; + static std::shared_ptr deck_; std::shared_ptr eclState_; std::shared_ptr eclSchedule_; std::shared_ptr eclSummaryConfig_; diff --git a/flow/flow_ebos_blackoil.cpp b/flow/flow_ebos_blackoil.cpp index 7754f1fb7..1204724d8 100644 --- a/flow/flow_ebos_blackoil.cpp +++ b/flow/flow_ebos_blackoil.cpp @@ -36,7 +36,7 @@ void flowEbosBlackoilSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalUDQState(std::move(udqState)); diff --git a/flow/flow_ebos_brine.cpp b/flow/flow_ebos_brine.cpp index eed6c6a20..96687f9c4 100644 --- a/flow/flow_ebos_brine.cpp +++ b/flow/flow_ebos_brine.cpp @@ -46,7 +46,7 @@ void flowEbosBrineSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_brine_precsalt_vapwat.cpp b/flow/flow_ebos_brine_precsalt_vapwat.cpp index 230301ae9..29f5f3aa7 100644 --- a/flow/flow_ebos_brine_precsalt_vapwat.cpp +++ b/flow/flow_ebos_brine_precsalt_vapwat.cpp @@ -56,7 +56,7 @@ void flowEbosBrinePrecsaltVapwatSetDeck(double setupTime, std::shared_ptr using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_brine_saltprecipitation.cpp b/flow/flow_ebos_brine_saltprecipitation.cpp index 456908617..e932b58c6 100644 --- a/flow/flow_ebos_brine_saltprecipitation.cpp +++ b/flow/flow_ebos_brine_saltprecipitation.cpp @@ -51,7 +51,7 @@ void flowEbosBrineSaltPrecipitationSetDeck(double setupTime, std::shared_ptr; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_energy.cpp b/flow/flow_ebos_energy.cpp index 249793399..97a120526 100644 --- a/flow/flow_ebos_energy.cpp +++ b/flow/flow_ebos_energy.cpp @@ -46,7 +46,7 @@ void flowEbosEnergySetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_extbo.cpp b/flow/flow_ebos_extbo.cpp index 40fe46357..08805d255 100644 --- a/flow/flow_ebos_extbo.cpp +++ b/flow/flow_ebos_extbo.cpp @@ -46,7 +46,7 @@ void flowEbosExtboSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_foam.cpp b/flow/flow_ebos_foam.cpp index 37a7b3d70..b6aebe062 100644 --- a/flow/flow_ebos_foam.cpp +++ b/flow/flow_ebos_foam.cpp @@ -46,7 +46,7 @@ void flowEbosFoamSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_gasoil.cpp b/flow/flow_ebos_gasoil.cpp index ce6cfa934..591bf59ea 100644 --- a/flow/flow_ebos_gasoil.cpp +++ b/flow/flow_ebos_gasoil.cpp @@ -67,7 +67,7 @@ void flowEbosGasOilSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_gasoil_energy.cpp b/flow/flow_ebos_gasoil_energy.cpp index 8f3404341..b1c02c2b4 100644 --- a/flow/flow_ebos_gasoil_energy.cpp +++ b/flow/flow_ebos_gasoil_energy.cpp @@ -71,7 +71,7 @@ void flowEbosGasOilEnergySetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_gaswater.cpp b/flow/flow_ebos_gaswater.cpp index 601b2d477..7c7137ca9 100644 --- a/flow/flow_ebos_gaswater.cpp +++ b/flow/flow_ebos_gaswater.cpp @@ -70,7 +70,7 @@ void flowEbosGasWaterSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_gaswater_brine.cpp b/flow/flow_ebos_gaswater_brine.cpp index 9f42174e9..20871171d 100644 --- a/flow/flow_ebos_gaswater_brine.cpp +++ b/flow/flow_ebos_gaswater_brine.cpp @@ -70,7 +70,7 @@ void flowEbosGasWaterBrineSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_gaswater_saltprec_vapwat.cpp b/flow/flow_ebos_gaswater_saltprec_vapwat.cpp index 34b5baade..8bb6b2597 100644 --- a/flow/flow_ebos_gaswater_saltprec_vapwat.cpp +++ b/flow/flow_ebos_gaswater_saltprec_vapwat.cpp @@ -81,7 +81,7 @@ void flowEbosGasWaterSaltprecVapwatSetDeck(double setupTime, std::shared_ptr; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_micp.cpp b/flow/flow_ebos_micp.cpp index a20d8a7ee..21a4f348b 100644 --- a/flow/flow_ebos_micp.cpp +++ b/flow/flow_ebos_micp.cpp @@ -70,7 +70,7 @@ void flowEbosMICPSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_oilwater.cpp b/flow/flow_ebos_oilwater.cpp index 2336b5cf2..2f3d6a902 100644 --- a/flow/flow_ebos_oilwater.cpp +++ b/flow/flow_ebos_oilwater.cpp @@ -67,7 +67,7 @@ void flowEbosOilWaterSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_oilwater_brine.cpp b/flow/flow_ebos_oilwater_brine.cpp index 064c40aa7..f1720685f 100644 --- a/flow/flow_ebos_oilwater_brine.cpp +++ b/flow/flow_ebos_oilwater_brine.cpp @@ -70,7 +70,7 @@ void flowEbosOilWaterBrineSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_oilwater_polymer.cpp b/flow/flow_ebos_oilwater_polymer.cpp index 169ddb7a0..bd98aee3c 100644 --- a/flow/flow_ebos_oilwater_polymer.cpp +++ b/flow/flow_ebos_oilwater_polymer.cpp @@ -70,7 +70,7 @@ void flowEbosOilWaterPolymerSetDeck(double setupTime, std::shared_ptr deck using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_onephase.cpp b/flow/flow_ebos_onephase.cpp index 707b6030c..a9ef409d5 100644 --- a/flow/flow_ebos_onephase.cpp +++ b/flow/flow_ebos_onephase.cpp @@ -66,7 +66,7 @@ void flowEbosWaterOnlySetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_onephase_energy.cpp b/flow/flow_ebos_onephase_energy.cpp index 1ebc62329..7ef925692 100644 --- a/flow/flow_ebos_onephase_energy.cpp +++ b/flow/flow_ebos_onephase_energy.cpp @@ -73,7 +73,7 @@ void flowEbosWaterOnlyEnergySetDeck(double setupTime, std::shared_ptr deck using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_polymer.cpp b/flow/flow_ebos_polymer.cpp index 4d57544d1..bf04d0a59 100644 --- a/flow/flow_ebos_polymer.cpp +++ b/flow/flow_ebos_polymer.cpp @@ -46,7 +46,7 @@ void flowEbosPolymerSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/flow/flow_ebos_solvent.cpp b/flow/flow_ebos_solvent.cpp index f4afad899..1837b3754 100644 --- a/flow/flow_ebos_solvent.cpp +++ b/flow/flow_ebos_solvent.cpp @@ -46,7 +46,7 @@ void flowEbosSolventSetDeck(double setupTime, std::shared_ptr deck, using Vanguard = GetPropType; Vanguard::setSetupTime(setupTime); - Vanguard::setExternalDeck(std::move(deck)); + Vanguard::setDeck(std::move(deck)); Vanguard::setExternalEclState(std::move(eclState)); Vanguard::setExternalSchedule(std::move(schedule)); Vanguard::setExternalSummaryConfig(std::move(summaryConfig)); diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index 8ce99f990..f352ddea5 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -104,7 +104,7 @@ void flowEbosSetDeck(std::shared_ptr deck, { using Vanguard = GetPropType; - Vanguard::setExternalDeck(deck); + Vanguard::setDeck(deck); Vanguard::setExternalEclState(eclState); Vanguard::setExternalSchedule(schedule); Vanguard::setExternalSummaryConfig(summaryConfig);