diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp index 51018ceb0..9fe6da7de 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp @@ -69,6 +69,7 @@ enum class InjectionCMode : int { static const std::string InjectionCMode2String( InjectionCMode enumValue ); static InjectionCMode InjectionCModeFromString( const std::string& stringValue ); + enum class ProductionCMode : int { NONE = 0, ORAT = 1, @@ -80,10 +81,27 @@ enum class ProductionCMode : int { PRBL = 64, FLD = 128 }; - static const std::string ProductionCMode2String( ProductionCMode enumValue ); static ProductionCMode ProductionCModeFromString( const std::string& stringValue ); + +enum class GuideRateTarget { + OIL = 0, + WAT = 1, + GAS = 2, + LIQ = 3, + COMB = 4, + WGA = 5, + CVAL = 6, + INJV = 7, + POTN = 8, + FORM = 9, + NO_GUIDE_RATE = 10 +}; +static GuideRateTarget GuideRateTargetFromString( const std::string& stringValue ); + + + struct GroupInjectionProperties { Phase phase = Phase::WATER; InjectionCMode cmode = InjectionCMode::NONE; @@ -116,7 +134,7 @@ struct GroupProductionProperties { UDAValue gas_target; UDAValue liquid_target; double guide_rate; - GroupProduction::GuideRateDef guide_rate_def; + GuideRateTarget guide_rate_def; double resv_target = 0; int production_controls = 0; @@ -132,7 +150,7 @@ struct ProductionControls { double gas_target; double liquid_target; double guide_rate; - GroupProduction::GuideRateDef guide_rate_def; + GuideRateTarget guide_rate_def; double resv_target = 0; int production_controls = 0; bool has_control(ProductionCMode control) const; diff --git a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp index 0dc054f9e..a1310db7d 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp @@ -26,31 +26,6 @@ namespace Opm { - - - - - namespace GroupProduction { - - - enum class GuideRateDef { - OIL = 0, - WAT = 1, - GAS = 2, - LIQ = 3, - COMB = 4, - WGA = 5, - CVAL = 6, - INJV = 7, - POTN = 8, - FORM = 9, - NO_GUIDE_RATE = 10 - }; - - GroupProduction::GuideRateDef GetGuideRateFromString( const std::string& stringValue ); - - } - namespace GuideRate { enum GuideRatePhaseEnum { OIL = 0, diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp index 954749092..2e46320f2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp @@ -457,4 +457,29 @@ Group2::ProductionCMode Group2::ProductionCModeFromString( const std::string& st throw std::invalid_argument("Unknown enum state string: " + stringValue ); } +Group2::GuideRateTarget Group2::GuideRateTargetFromString( const std::string& stringValue ) { + if (stringValue == "OIL") + return GuideRateTarget::OIL; + else if (stringValue == "WAT") + return GuideRateTarget::WAT; + else if (stringValue == "GAS") + return GuideRateTarget::GAS; + else if (stringValue == "LIQ") + return GuideRateTarget::LIQ; + else if (stringValue == "COMB") + return GuideRateTarget::COMB; + else if (stringValue == "WGA") + return GuideRateTarget::WGA; + else if (stringValue == "CVAL") + return GuideRateTarget::CVAL; + else if (stringValue == "INJV") + return GuideRateTarget::INJV; + else if (stringValue == "POTN") + return GuideRateTarget::POTN; + else if (stringValue == "FORM") + return GuideRateTarget::FORM; + else + return GuideRateTarget::NO_GUIDE_RATE; +} + } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 895ec3cd4..03c767b5d 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1486,6 +1486,7 @@ namespace { } } + void Schedule::handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) { for( const auto& record : keyword ) { const std::string& groupNamePattern = record.getItem("GROUP").getTrimmedString(0); @@ -1501,12 +1502,12 @@ namespace { auto gas_target = record.getItem("GAS_TARGET").get(0); auto water_target = record.getItem("WATER_TARGET").get(0); auto liquid_target = record.getItem("LIQUID_TARGET").get(0); + auto guide_rate_def = Group2::GuideRateTarget::NO_GUIDE_RATE; double guide_rate = 0; - GroupProduction::GuideRateDef guide_rate_def = GroupProduction::GuideRateDef::NO_GUIDE_RATE; if (group_name != "FIELD") { if (record.getItem("GUIDE_RATE_DEF").hasValue(0)) { std::string guide_rate_str = record.getItem("GUIDE_RATE_DEF").getTrimmedString(0); - guide_rate_def = GroupProduction::GetGuideRateFromString( guide_rate_str ); + guide_rate_def = Group2::GuideRateTargetFromString( guide_rate_str ); if ((guide_rate_str == "INJ" || guide_rate_str == "POTN" || guide_rate_str == "FORM")) { std::string msg = "The supplied guide_rate value will be ignored"; @@ -1515,7 +1516,7 @@ namespace { else { guide_rate = record.getItem("GUIDE_RATE").get(0); if (guide_rate == 0) - guide_rate_def = GroupProduction::GuideRateDef::POTN; + guide_rate_def = Group2::GuideRateTarget::POTN; } } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp index 30d8d855f..1ebf43067 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp @@ -32,32 +32,6 @@ namespace Opm { namespace GroupProduction { - GuideRateDef GetGuideRateFromString( const std::string& stringValue ) { - - if (stringValue == "OIL") - return GuideRateDef::OIL; - else if (stringValue == "WAT") - return GuideRateDef::WAT; - else if (stringValue == "GAS") - return GuideRateDef::GAS; - else if (stringValue == "LIQ") - return GuideRateDef::LIQ; - else if (stringValue == "COMB") - return GuideRateDef::COMB; - else if (stringValue == "WGA") - return GuideRateDef::WGA; - else if (stringValue == "CVAL") - return GuideRateDef::CVAL; - else if (stringValue == "INJV") - return GuideRateDef::INJV; - else if (stringValue == "POTN") - return GuideRateDef::POTN; - else if (stringValue == "FORM") - return GuideRateDef::FORM; - else - return GuideRateDef::NO_GUIDE_RATE; - - } } diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 5e6bc6e30..9af533f4c 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -1205,7 +1205,7 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) { auto g = schedule.getGroup2("G1", 2); BOOST_CHECK_EQUAL(g.productionControls(st).oil_target, 2000 * siFactorL); BOOST_CHECK_EQUAL(g.productionControls(st).guide_rate, 148); - BOOST_CHECK_EQUAL(true, g.productionControls(st).guide_rate_def == GroupProduction::GuideRateDef::OIL); + BOOST_CHECK_EQUAL(true, g.productionControls(st).guide_rate_def == Group2::GuideRateTarget::OIL); } auto g2 = schedule.getGroup2("G2", 2);