diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp index fc045441e..9a3a7315e 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp @@ -43,6 +43,7 @@ struct GroupInjectionProperties { UDAValue target_reinj_fraction; UDAValue target_void_fraction; + int injection_controls = 0; bool operator==(const GroupInjectionProperties& other) const; bool operator!=(const GroupInjectionProperties& other) const; }; @@ -54,6 +55,8 @@ struct InjectionControls { double resv_max_rate; double target_reinj_fraction; double target_void_fraction; + int injection_controls = 0; + bool has_control(GroupInjection::ControlEnum control) const; }; struct GroupProductionProperties { @@ -65,6 +68,7 @@ struct GroupProductionProperties { UDAValue liquid_target; double resv_target = 0; + int production_controls = 0; bool operator==(const GroupProductionProperties& other) const; bool operator!=(const GroupProductionProperties& other) const; }; @@ -77,6 +81,8 @@ struct ProductionControls { double gas_target; double liquid_target; double resv_target = 0; + int production_controls = 0; + bool has_control(GroupProduction::ControlEnum control) const; }; Group2(const std::string& group_name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system); @@ -115,6 +121,8 @@ struct ProductionControls { GroupProduction::ControlEnum production_cmode() const; GroupInjection::ControlEnum injection_cmode() const; Phase injection_phase() const; + bool has_control(GroupProduction::ControlEnum control) const; + bool has_control(GroupInjection::ControlEnum control) const; private: bool hasType(GroupType gtype) const; void addType(GroupType new_gtype); diff --git a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp index ee69d4e78..1dab4c6d5 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp @@ -167,9 +167,9 @@ namespace Opm { NONE = 0, RATE = 1, RESV = 2, - REIN = 3, - VREP = 4, - FLD = 5 + REIN = 4, + VREP = 8, + FLD = 16 }; const std::string ControlEnum2String( ControlEnum enumValue ); @@ -209,12 +209,12 @@ namespace Opm { NONE = 0, ORAT = 1, WRAT = 2, - GRAT = 3, - LRAT = 4, - CRAT = 5, - RESV = 6, - PRBL = 7, - FLD = 8 + GRAT = 4, + LRAT = 8, + CRAT = 16, + RESV = 32, + PRBL = 64, + FLD = 128 }; const std::string ControlEnum2String( GroupProduction::ControlEnum enumValue ); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp index b3b3b3aa4..f05d17cfc 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp @@ -114,6 +114,7 @@ bool Group2::GroupInjectionProperties::operator==(const GroupInjectionProperties this->surface_max_rate == other.surface_max_rate && this->resv_max_rate == other.resv_max_rate && this->target_reinj_fraction == other.target_reinj_fraction && + this->injection_controls == other.injection_controls && this->target_void_fraction == other.target_void_fraction; } @@ -125,13 +126,14 @@ bool Group2::GroupInjectionProperties::operator!=(const GroupInjectionProperties bool Group2::GroupProductionProperties::operator==(const GroupProductionProperties& other) const { return - this->cmode == other.cmode && - this->exceed_action == other.exceed_action && - this->oil_target == other.oil_target && - this->water_target == other.oil_target && - this->gas_target == other.gas_target && - this->liquid_target == other.liquid_target && - this->resv_target == other.resv_target; + this->cmode == other.cmode && + this->exceed_action == other.exceed_action && + this->oil_target == other.oil_target && + this->water_target == other.oil_target && + this->gas_target == other.gas_target && + this->liquid_target == other.liquid_target && + this->production_controls == other.production_controls && + this->resv_target == other.resv_target; } @@ -299,4 +301,21 @@ Phase Group2::injection_phase() const { return this->injection_properties.phase; } + +bool Group2::ProductionControls::has_control(GroupProduction::ControlEnum control) const { + return (this->production_controls & control) != 0; +} + + +bool Group2::InjectionControls::has_control(GroupInjection::ControlEnum control) const { + return (this->injection_controls & control) != 0; +} + +bool Group2::has_control(GroupProduction::ControlEnum control) const { + return (this->production_properties.production_controls & control) != 0; +} + +bool Group2::has_control(GroupInjection::ControlEnum control) const { + return (this->injection_properties.injection_controls & control) != 0; +} } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 5a7139364..ba89f8323 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1406,6 +1406,19 @@ namespace { injection.resv_max_rate = reservoirInjectionRate; injection.target_reinj_fraction = reinj_target; injection.target_void_fraction = voidage_target; + injection.injection_controls = 0; + + if (!record.getItem("SURFACE_TARGET").defaultApplied(0)) + injection.injection_controls += GroupInjection::RATE; + + if (!record.getItem("RESV_TARGET").defaultApplied(0)) + injection.injection_controls += GroupInjection::RESV; + + if (!record.getItem("REINJ_TARGET").defaultApplied(0)) + injection.injection_controls += GroupInjection::REIN; + + if (!record.getItem("VOIDAGE_TARGET").defaultApplied(0)) + injection.injection_controls += GroupInjection::VREP; if (group_ptr->updateInjection(injection)) this->updateGroup(std::move(group_ptr), currentStep); @@ -1441,6 +1454,22 @@ namespace { production.liquid_target = liquid_target; production.resv_target = resv_target; production.exceed_action = exceedAction; + production.production_controls = 0; + + if (!record.getItem("OIL_TARGET").defaultApplied(0)) + production.production_controls += GroupProduction::ORAT; + + if (!record.getItem("GAS_TARGET").defaultApplied(0)) + production.production_controls += GroupProduction::GRAT; + + if (!record.getItem("WATER_TARGET").defaultApplied(0)) + production.production_controls += GroupProduction::WRAT; + + if (!record.getItem("LIQUID_TARGET").defaultApplied(0)) + production.production_controls += GroupProduction::LRAT; + + if (!record.getItem("RESERVOIR_FLUID_TARGET").defaultApplied(0)) + production.production_controls += GroupProduction::RESV; if (group_ptr->updateProduction(production)) this->updateGroup(std::move(group_ptr), currentStep); diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 06fa6d3ff..fd7250241 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -1145,6 +1145,8 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) { { auto g = schedule.getGroup2("G1", 1); BOOST_CHECK_EQUAL(g.productionControls(st).oil_target, 1000 * siFactorL); + BOOST_CHECK(g.has_control(GroupProduction::ORAT)); + BOOST_CHECK(!g.has_control(GroupProduction::WRAT)); } { auto g = schedule.getGroup2("G1", 2);