diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 54be7c025..5772ff08a 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -100,7 +100,6 @@ if(ENABLE_ECL_INPUT) src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp - src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp src/opm/parser/eclipse/EclipseState/Schedule/Tuning.cpp @@ -562,7 +561,6 @@ if(ENABLE_ECL_INPUT) opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp opm/parser/eclipse/EclipseState/Schedule/Events.hpp - opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp index 6aa89fffc..b85d1453d 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -35,9 +34,76 @@ class SummaryState; class Group2 { public: +// A group can have both injection controls and production controls set at +// the same time, i.e. this enum is used as a bitmask. +enum class GroupType : unsigned { + NONE = 0, + PRODUCTION = 1, + INJECTION = 2, + MIXED = 3 +}; + + + +enum class ExceedAction { + NONE = 0, + CON = 1, + CON_PLUS = 2, // String: "+CON" + WELL = 3, + PLUG = 4, + RATE = 5 +}; +static const std::string ExceedAction2String( ExceedAction enumValue ); +static ExceedAction ExceedActionFromString( const std::string& stringValue ); + + +enum class InjectionCMode : int { + NONE = 0, + RATE = 1, + RESV = 2, + REIN = 4, + VREP = 8, + FLD = 16 +}; +static const std::string InjectionCMode2String( InjectionCMode enumValue ); +static InjectionCMode InjectionCModeFromString( const std::string& stringValue ); + + +enum class ProductionCMode : int { + NONE = 0, + ORAT = 1, + WRAT = 2, + GRAT = 4, + LRAT = 8, + CRAT = 16, + RESV = 32, + 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; - GroupInjection::ControlEnum cmode = GroupInjection::NONE; + InjectionCMode cmode = InjectionCMode::NONE; UDAValue surface_max_rate; UDAValue resv_max_rate; UDAValue target_reinj_fraction; @@ -50,24 +116,24 @@ struct GroupInjectionProperties { struct InjectionControls { Phase phase; - GroupInjection::ControlEnum cmode; + InjectionCMode cmode; double surface_max_rate; double resv_max_rate; double target_reinj_fraction; double target_void_fraction; int injection_controls = 0; - bool has_control(GroupInjection::ControlEnum control) const; + bool has_control(InjectionCMode control) const; }; struct GroupProductionProperties { - GroupProduction::ControlEnum cmode = GroupProduction::NONE; - GroupProductionExceedLimit::ActionEnum exceed_action = GroupProductionExceedLimit::NONE; + ProductionCMode cmode = ProductionCMode::NONE; + ExceedAction exceed_action = ExceedAction::NONE; UDAValue oil_target; UDAValue water_target; 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; @@ -76,19 +142,20 @@ struct GroupProductionProperties { }; struct ProductionControls { - GroupProduction::ControlEnum cmode; - GroupProductionExceedLimit::ActionEnum exceed_action; + ProductionCMode cmode; + ExceedAction exceed_action; double oil_target; double water_target; 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(GroupProduction::ControlEnum control) const; + bool has_control(ProductionCMode 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); bool defined(std::size_t timeStep) const; @@ -122,11 +189,11 @@ struct ProductionControls { bool wellgroup() const; ProductionControls productionControls(const SummaryState& st) const; InjectionControls injectionControls(const SummaryState& st) const; - GroupProduction::ControlEnum production_cmode() const; - GroupInjection::ControlEnum injection_cmode() const; + ProductionCMode production_cmode() const; + InjectionCMode injection_cmode() const; Phase injection_phase() const; - bool has_control(GroupProduction::ControlEnum control) const; - bool has_control(GroupInjection::ControlEnum control) const; + bool has_control(ProductionCMode control) const; + bool has_control(InjectionCMode control) const; private: bool hasType(GroupType gtype) const; void addType(GroupType new_gtype); @@ -151,6 +218,9 @@ private: GroupProductionProperties production_properties{}; }; +Group2::GroupType operator |(Group2::GroupType lhs, Group2::GroupType rhs); +Group2::GroupType operator &(Group2::GroupType lhs, Group2::GroupType rhs); + } #endif diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp index 46dc7556a..3ad51eb73 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp @@ -20,14 +20,24 @@ #ifndef GUIDE_RATE_MODEL_HPP #define GUIDE_RATE_MODEL_HPP -#include - namespace Opm { class GuideRateModel { public: + + enum class Target { + OIL = 0, + LIQ = 1, + GAS = 2, + RES = 3, + COMB = 4, + NONE = 5 + }; + + static Target TargetFromString(const std::string& s); + GuideRateModel(double time_interval_arg, - GuideRateTarget phase_arg, + Target target_arg, double A_arg, double B_arg, double C_arg, @@ -50,7 +60,7 @@ private: be evaluated, due to a division by zero problem. */ double time_interval = 0; - GuideRateTarget phase = GuideRateTarget::NONE; + Target target = Target::NONE; double A = 0; double B = 0; double C = 0; diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp index ad80a6ce4..64dbbdd2a 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp @@ -23,7 +23,6 @@ #include #include -#include #include namespace Opm { @@ -32,6 +31,31 @@ namespace Opm { class WellSegments { public: + enum class LengthDepth{ + INC = 0, + ABS = 1 + }; + static const std::string LengthDepthToString(LengthDepth enumValue); + static LengthDepth LengthDepthFromString(const std::string& stringValue); + + + enum class CompPressureDrop { + HFA = 0, + HF_ = 1, + H__ = 2 + }; + static const std::string CompPressureDropToString(CompPressureDrop enumValue); + static CompPressureDrop CompPressureDropFromString(const std::string& stringValue); + + + enum class MultiPhaseModel { + HO = 0, + DF = 1 + }; + static const std::string MultiPhaseModelToString(MultiPhaseModel enumValue); + static MultiPhaseModel MultiPhaseModelFromString(const std::string& stringValue); + + WellSegments() = default; const std::string& wellName() const; @@ -40,8 +64,8 @@ namespace Opm { double lengthTopSegment() const; double volumeTopSegment() const; - WellSegment::CompPressureDropEnum compPressureDrop() const; - WellSegment::MultiPhaseModelEnum multiPhaseModel() const; + CompPressureDrop compPressureDrop() const; + MultiPhaseModel multiPhaseModel() const; // mapping the segment number to the index in the vector of segments int segmentNumberToIndex(const int segment_number) const; @@ -63,7 +87,6 @@ namespace Opm { void processABS(); void processINC(const bool first_time); - // name of the well std::string m_well_name; // depth of the nodal point of the top segment // it is taken as the BHP reference depth of the well @@ -74,11 +97,11 @@ namespace Opm { // effective wellbore volume of the top segment double m_volume_top; // type of the tubing length and depth information - WellSegment::LengthDepthEnum m_length_depth_type; + LengthDepth m_length_depth_type; // components of the pressure drop to be included - WellSegment::CompPressureDropEnum m_comp_pressure_drop; + CompPressureDrop m_comp_pressure_drop; // multi-phase flow model - WellSegment::MultiPhaseModelEnum m_multiphase_model; + MultiPhaseModel m_multiphase_model; // There are X and Y cooridnate of the nodal point of the top segment // Since they are not used for simulations and we are not supporting plotting, // we are not handling them at the moment. diff --git a/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp index 9ae656aac..eae8c76cb 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp @@ -23,8 +23,6 @@ #include #include -#include - namespace Opm { /* @@ -35,12 +33,19 @@ namespace Opm */ class OilVaporizationProperties { public: + enum class OilVaporization { + UNDEF = 0, + VAPPARS = 1, + DRDT = 2 // DRSDT or DRVDT + }; + + explicit OilVaporizationProperties(const size_t numPvtReginIdx); static void updateDRSDT(Opm::OilVaporizationProperties& ovp, const std::vector& maxDRSDT, const std::vector& option); static void updateDRVDT(Opm::OilVaporizationProperties& ovp, const std::vector& maxDRVDT); static void updateVAPPARS(Opm::OilVaporizationProperties& ovp, const std::vector& vap1, const std::vector& vap2); - Opm::OilVaporizationEnum getType() const; + OilVaporization getType() const; double getVap1(const size_t pvtRegionIdx) const; double getVap2(const size_t pvtRegionIdx) const; double getMaxDRSDT(const size_t pvtRegionIdx) const; @@ -59,7 +64,7 @@ namespace Opm bool operator!=( const OilVaporizationProperties& ) const; private: - Opm::OilVaporizationEnum m_type = OilVaporizationEnum::UNDEF; + OilVaporization m_type = OilVaporization::UNDEF; std::vector m_vap1; std::vector m_vap2; std::vector m_maxDRSDT; diff --git a/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp b/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp index 6fbccdafd..51cd1bf22 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -32,6 +31,26 @@ namespace Opm { class TimeMap; class RFTConfig { public: + enum class RFT { + YES = 1, + REPT = 2, + TIMESTEP = 3, + FOPN = 4, + NO = 5 + }; + static std::string RFT2String(RFT enumValue); + static RFT RFTFromString(const std::string &stringValue); + + enum class PLT { + YES = 1, + REPT = 2, + TIMESTEP = 3, + NO = 4 + }; + static std::string PLT2String(PLT enumValue); + static PLT PLTFromString( const std::string& stringValue); + + explicit RFTConfig(const TimeMap& time_map); bool rft(const std::string& well, std::size_t report_step) const; bool plt(const std::string& well, std::size_t report_step) const; @@ -41,16 +60,16 @@ public: bool active(std::size_t report_step) const; std::size_t firstRFTOutput() const; - void updateRFT(const std::string& well, std::size_t report_step, RFTConnections::RFTEnum value); - void updatePLT(const std::string& well, std::size_t report_step, PLTConnections::PLTEnum value); + void updateRFT(const std::string& well, std::size_t report_step, RFT value); + void updatePLT(const std::string& well, std::size_t report_step, PLT value); void addWellOpen(const std::string& well, std::size_t report_step); private: const TimeMap& tm; std::pair well_open_rft_time; std::unordered_set well_open_rft_name; std::unordered_map well_open; - std::unordered_map>> rft_config; - std::unordered_map>> plt_config; + std::unordered_map>> rft_config; + std::unordered_map>> plt_config; }; } diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 1bdc0c752..3bb897513 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -176,7 +175,7 @@ namespace Opm std::vector getWells2atEnd() const; std::vector getChildGroups2(const std::string& group_name, size_t timeStep) const; - std::vector getChildWells2(const std::string& group_name, size_t timeStep, GroupWellQueryMode query_mode) const; + std::vector getChildWells2(const std::string& group_name, size_t timeStep) const; const OilVaporizationProperties& getOilVaporizationProperties(size_t timestep) const; const UDQActive& udqActive(size_t timeStep) const; @@ -234,19 +233,19 @@ namespace Opm DynamicState> udq_config; DynamicState> udq_active; DynamicState> guide_rate_model; - DynamicState global_whistctl_mode; + DynamicState global_whistctl_mode; DynamicState> m_actions; RFTConfig rft_config; + DynamicState m_nupcol; std::map well_events; - DynamicState m_nupcol; GTNode groupTree(const std::string& root_node, std::size_t report_step, const GTNode * parent) const; void updateGroup(std::shared_ptr group, size_t reportStep); bool checkGroups(const ParseContext& parseContext, ErrorGuard& errors); void updateUDQActive( std::size_t timeStep, std::shared_ptr udq ); - bool updateWellStatus( const std::string& well, size_t reportStep , WellCommon::StatusEnum status); + bool updateWellStatus( const std::string& well, size_t reportStep , Well2::Status status); void addWellToGroup( const std::string& group_name, const std::string& well_name , size_t timeStep); void iterateScheduleSection(const ParseContext& parseContext , ErrorGuard& errors, const SCHEDULESection& , const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties); @@ -254,7 +253,7 @@ namespace Opm void addGroupToGroup( const std::string& parent_group, const std::string& child_group, size_t timeStep); void addGroupToGroup( const std::string& parent_group, const Group2& child_group, size_t timeStep); void addGroup(const std::string& groupName , size_t timeStep, const UnitSystem& unit_system); - void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellCompletionOrder, const UnitSystem& unit_system); + void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, Connection::Order connection_order, const UnitSystem& unit_system); void handleUDQ(const DeckKeyword& keyword, size_t currentStep); void handleWLIST(const DeckKeyword& keyword, size_t currentStep); void handleCOMPORD(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& compordKeyword, size_t currentStep); diff --git a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp deleted file mode 100644 index 38a31344c..000000000 --- a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp +++ /dev/null @@ -1,359 +0,0 @@ -/* - Copyright 2013 Statoil ASA. - - This file is part of the Open Porous Media project (OPM). - - OPM is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OPM is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OPM. If not, see . - */ - -#ifndef SCHEDULE_ENUMS_H -#define SCHEDULE_ENUMS_H - -#include - -namespace Opm { - namespace WellCommon { - - enum StatusEnum { - OPEN = 1, - STOP = 2, - SHUT = 3, - AUTO = 4 - }; - - const std::string Status2String(StatusEnum enumValue); - StatusEnum StatusFromString(const std::string& stringValue); - } - - namespace WellCompletion { - - enum StateEnum { - OPEN = 1, - SHUT = 2, - AUTO = 3 - }; - - - enum DirectionEnum { - X = 1, - Y = 2, - Z = 3 - }; - - - enum CompletionOrderEnum{ - DEPTH, - INPUT, - TRACK - }; - - std::string DirectionEnum2String(const DirectionEnum enumValue); - DirectionEnum DirectionEnumFromString(const std::string& stringValue); - - const std::string StateEnum2String( StateEnum enumValue ); - StateEnum StateEnumFromString( const std::string& stringValue ); - - const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue ); - CompletionOrderEnum CompletionOrderEnumFromString(const std::string& comporderStringValue); - - } - - namespace WellTarget { - enum ControlModeEnum { - ORAT = 1, - WRAT = 2, - GRAT = 3, - LRAT = 4, - CRAT = 5, // Not supported - RESV = 6, - BHP = 7, - THP = 8, - VFP = 9, - LIFT = 10, // Not supported - GUID = 11 - }; - /* - There are unfortuntaley separate enums for production controls, - injection controls and also for WELTARG control arguments. Since the - WELTARG control arguments are *not* used to enumerate available - controls the numerical values are - conciously - not in 2^n range. - */ - - ControlModeEnum ControlModeFromString(const std::string& string_value); - } - - - namespace WellInjector { - enum TypeEnum { - WATER = 1, - GAS = 2, - OIL = 3, - MULTI = 4 - }; - - - enum ControlModeEnum { - RATE = 1 , - RESV = 2 , - BHP = 4 , - THP = 8 , - GRUP = 16 , - CMODE_UNDEFINED = 512 - }; - /* - The elements in this enum are used as bitmasks to keep track - of which controls are present, i.e. the 2^n structure must - be intact. - */ - - - - const std::string ControlMode2String( ControlModeEnum enumValue ); - ControlModeEnum ControlModeFromString( const std::string& stringValue ); - - const std::string Type2String( TypeEnum enumValue ); - TypeEnum TypeFromString( const std::string& stringValue ); - } - - - namespace WellProducer { - - enum ControlModeEnum { - NONE = 0, - ORAT = 1, - WRAT = 2, - GRAT = 4, - LRAT = 8, - CRAT = 16, - RESV = 32, - BHP = 64, - THP = 128, - GRUP = 256, - CMODE_UNDEFINED = 1024 - }; - - /* - The items BHP, THP and GRUP only apply in prediction mode: - WCONPROD. The elements in this enum are used as bitmasks to - keep track of which controls are present, i.e. the 2^n - structure must be intact.The NONE item is only used in WHISTCTL - to cancel its effect. - - The properties are initialized with the CMODE_UNDEFINED - value, but the undefined value is never assigned apart from - that; and it is not part of the string conversion routines. - */ - - - const std::string ControlMode2String( ControlModeEnum enumValue ); - ControlModeEnum ControlModeFromString( const std::string& stringValue ); - } - - - namespace GroupInjection { - - enum ControlEnum { - NONE = 0, - RATE = 1, - RESV = 2, - REIN = 4, - VREP = 8, - FLD = 16 - }; - - const std::string ControlEnum2String( ControlEnum enumValue ); - ControlEnum ControlEnumFromString( const std::string& stringValue ); - } - - - namespace GroupProductionExceedLimit { - enum ActionEnum { - NONE = 0, - CON = 1, - CON_PLUS = 2, // String: "+CON" - WELL = 3, - PLUG = 4, - RATE = 5 - }; - - const std::string ActionEnum2String( ActionEnum enumValue ); - ActionEnum ActionEnumFromString( const std::string& stringValue ); - } - - // A group can have both injection controls and production controls set at - // the same time, i.e. this enum is used as a bitmask. - enum class GroupType : unsigned { - NONE = 0, - PRODUCTION = 1, - INJECTION = 2, - MIXED = 3 - }; - - GroupType operator |(GroupType lhs, GroupType rhs); - GroupType operator &(GroupType lhs, GroupType rhs); - - - enum class GuideRateTarget { - OIL = 0, - LIQ = 1, - GAS = 2, - RES = 3, - COMB = 4, - NONE = 5 - }; - GuideRateTarget GuideRateTargetFromString(const std::string& s); - - - namespace GroupProduction { - - enum ControlEnum { - NONE = 0, - ORAT = 1, - WRAT = 2, - GRAT = 4, - LRAT = 8, - CRAT = 16, - RESV = 32, - PRBL = 64, - FLD = 128 - }; - - const std::string ControlEnum2String( GroupProduction::ControlEnum enumValue ); - GroupProduction::ControlEnum ControlEnumFromString( const std::string& stringValue ); - - 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, - WAT = 1, - GAS = 2, - LIQ = 3, - COMB = 4, - WGA = 5, - CVAL = 6, - RAT = 7, - RES = 8, - UNDEFINED = 9 - }; - const std::string GuideRatePhaseEnum2String( GuideRatePhaseEnum enumValue ); - GuideRatePhaseEnum GuideRatePhaseEnumFromString( const std::string& stringValue ); - } - - namespace RFTConnections { - enum RFTEnum { - YES = 1, - REPT = 2, - TIMESTEP = 3, - FOPN = 4, - NO = 5 - }; - - const std::string RFTEnum2String(RFTEnum enumValue); - - RFTEnum RFTEnumFromString(const std::string &stringValue); - } - namespace PLTConnections{ - enum PLTEnum{ - YES = 1, - REPT = 2, - TIMESTEP = 3, - NO = 4 - }; - const std::string PLTEnum2String( PLTEnum enumValue); - PLTEnum PLTEnumFromString( const std::string& stringValue); - } - - enum OilVaporizationEnum{ - UNDEF = 0, - VAPPARS = 1, - DRDT = 2 // DRSDT or DRVDT - }; - - - namespace WellSegment{ - - enum LengthDepthEnum { - INC = 0, - ABS = 1 - }; - const std::string LengthDepthEnumToString(LengthDepthEnum enumValue); - LengthDepthEnum LengthDepthEnumFromString(const std::string& stringValue); - - enum CompPressureDropEnum { - HFA = 0, - HF_ = 1, - H__ = 2 - }; - const std::string CompPressureDropEnumToString(CompPressureDropEnum enumValue); - CompPressureDropEnum CompPressureDropEnumFromString(const std::string& stringValue); - - enum MultiPhaseModelEnum { - HO = 0, - DF = 1 - }; - const std::string MultiPhaseModelEnumToString(MultiPhaseModelEnum enumValue); - MultiPhaseModelEnum MultiPhaseModelEnumFromString(const std::string& stringValue); - - } - - - namespace WellEcon { - enum WorkoverEnum { - NONE = 0, - CON = 1, // CON - CONP = 2, // +CON - WELL = 3, - PLUG = 4, - // the following two only related to workover action - // on exceeding secondary water cut limit - LAST = 5, - RED = 6 - }; - const std::string WorkoverEnumToString(WorkoverEnum enumValue); - WorkoverEnum WorkoverEnumFromString(const std::string& stringValue); - - enum QuantityLimitEnum { - RATE = 0, - POTN = 1 - }; - const std::string QuantityLimitEnumToString(QuantityLimitEnum enumValue); - QuantityLimitEnum QuantityLimitEnumFromString(const std::string& stringValue); - } - - - enum class GroupWellQueryMode { - Immediate, - Recursive - }; - -} - -#endif diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp index 2a0c12e2b..0978e17a8 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp @@ -29,7 +29,6 @@ #include #include -#include #include namespace Opm { @@ -39,17 +38,48 @@ namespace Opm { class Connection { public: + enum class State { + OPEN = 1, + SHUT = 2, + AUTO = 3 + }; + + static const std::string State2String( State enumValue ); + static State StateFromString( const std::string& stringValue ); + + + enum class Direction{ + X = 1, + Y = 2, + Z = 3 + }; + + static std::string Direction2String(const Direction enumValue); + static Direction DirectionFromString(const std::string& stringValue); + + + enum class Order { + DEPTH, + INPUT, + TRACK + }; + + static const std::string Order2String( Order enumValue ); + static Order OrderFromString(const std::string& comporderStringValue); + + + Connection(int i, int j , int k , int complnum, double depth, - WellCompletion::StateEnum state, + State state, double CF, double Kh, double rw, double r0, double skin_factor, const int satTableId, - const WellCompletion::DirectionEnum direction, + const Direction direction, const std::size_t seqIndex, const double segDistStart, const double segDistEnd, @@ -61,8 +91,8 @@ namespace Opm { int getI() const; int getJ() const; int getK() const; - WellCompletion::StateEnum state() const; - WellCompletion::DirectionEnum dir() const; + State state() const; + Direction dir() const; double depth() const; int satTableId() const; int complnum() const; @@ -74,7 +104,7 @@ namespace Opm { double skinFactor() const; double wellPi() const; - void setState(WellCompletion::StateEnum state); + void setState(State state); void setComplnum(int compnum); void scaleWellPi(double wellPi); void updateSegment(int segment_number, double center_depth, std::size_t seqIndex); @@ -92,9 +122,9 @@ namespace Opm { bool operator==( const Connection& ) const; bool operator!=( const Connection& ) const; private: - WellCompletion::DirectionEnum direction; + Direction direction; double center_depth; - WellCompletion::StateEnum open_state; + State open_state; int sat_tableId; int m_complnum; double m_CF; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp index 94002a8c9..2167651bd 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp @@ -22,29 +22,5 @@ #define INJECTION_CONTROLS_HPP namespace Opm { -struct InjectionControls { -public: - InjectionControls(int controls_arg) : - controls(controls_arg) - {} - - double bhp_limit; - double thp_limit; - - - WellInjector::TypeEnum injector_type; - WellInjector::ControlModeEnum cmode; - double surface_rate; - double reservoir_rate; - double temperature; - int vfp_table_number; - bool prediction_mode; - - bool hasControl(WellInjector::ControlModeEnum cmode_arg) const { - return (this->controls & cmode_arg) != 0; - } -private: - int controls; -}; } #endif diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp index 5bd9d8d9d..cedc038cc 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp @@ -22,33 +22,5 @@ #define PRODUCTION_CONTROLS_HPP namespace Opm { -struct ProductionControls { -public: - ProductionControls(int controls_arg) : - controls(controls_arg) - { - } - - WellProducer::ControlModeEnum cmode; - double oil_rate; - double water_rate; - double gas_rate; - double liquid_rate; - double resv_rate; - double bhp_history; - double thp_history; - double bhp_limit; - double thp_limit; - double alq_value; - int vfp_table_number; - bool prediction_mode; - - bool hasControl(WellProducer::ControlModeEnum cmode_arg) const { - return (this->controls & cmode_arg) != 0; - } - -private: - int controls; -}; } #endif diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp index 8415e80f3..c92a5d78b 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -45,17 +44,289 @@ class DeckKeyword; struct WellInjectionProperties; class WellProductionProperties; class UDQActive; - -struct WellGuideRate { - bool available; - double guide_rate; - GuideRate::GuideRatePhaseEnum guide_phase; - double scale_factor; -}; +class UDQConfig; class Well2 { public: + + enum class Status { + OPEN = 1, + STOP = 2, + SHUT = 3, + AUTO = 4 + }; + static std::string Status2String(Status enumValue); + static Status StatusFromString(const std::string& stringValue); + + + enum class InjectorType { + WATER = 1, + GAS = 2, + OIL = 3, + MULTI = 4 + }; + static const std::string InjectorType2String( InjectorType enumValue ); + static InjectorType InjectorTypeFromString( const std::string& stringValue ); + + + /* + The elements in this enum are used as bitmasks to keep track + of which controls are present, i.e. the 2^n structure must + be intact. + */ + enum class InjectorCMode : int{ + RATE = 1 , + RESV = 2 , + BHP = 4 , + THP = 8 , + GRUP = 16 , + CMODE_UNDEFINED = 512 + }; + static const std::string InjectorCMode2String( InjectorCMode enumValue ); + static InjectorCMode InjectorCModeFromString( const std::string& stringValue ); + + + /* + The items BHP, THP and GRUP only apply in prediction mode: + WCONPROD. The elements in this enum are used as bitmasks to + keep track of which controls are present, i.e. the 2^n + structure must be intact.The NONE item is only used in WHISTCTL + to cancel its effect. + + The properties are initialized with the CMODE_UNDEFINED + value, but the undefined value is never assigned apart from + that; and it is not part of the string conversion routines. + */ + enum class ProducerCMode : int { + NONE = 0, + ORAT = 1, + WRAT = 2, + GRAT = 4, + LRAT = 8, + CRAT = 16, + RESV = 32, + BHP = 64, + THP = 128, + GRUP = 256, + CMODE_UNDEFINED = 1024 + }; + static const std::string ProducerCMode2String( ProducerCMode enumValue ); + static ProducerCMode ProducerCModeFromString( const std::string& stringValue ); + + + + enum class WELTARGCMode { + ORAT = 1, + WRAT = 2, + GRAT = 3, + LRAT = 4, + CRAT = 5, // Not supported + RESV = 6, + BHP = 7, + THP = 8, + VFP = 9, + LIFT = 10, // Not supported + GUID = 11 + }; + + static WELTARGCMode WELTARGCModeFromString(const std::string& stringValue); + + + enum class GuideRateTarget { + OIL = 0, + WAT = 1, + GAS = 2, + LIQ = 3, + COMB = 4, + WGA = 5, + CVAL = 6, + RAT = 7, + RES = 8, + UNDEFINED = 9 + }; + static const std::string GuideRateTarget2String( GuideRateTarget enumValue ); + static GuideRateTarget GuideRateTargetFromString( const std::string& stringValue ); + + + + struct WellGuideRate { + bool available; + double guide_rate; + GuideRateTarget guide_phase; + double scale_factor; + }; + + + struct InjectionControls { + public: + InjectionControls(int controls_arg) : + controls(controls_arg) + {} + + double bhp_limit; + double thp_limit; + + + InjectorType injector_type; + InjectorCMode cmode; + double surface_rate; + double reservoir_rate; + double temperature; + int vfp_table_number; + bool prediction_mode; + + bool hasControl(InjectorCMode cmode_arg) const { + return (this->controls & static_cast(cmode_arg)) != 0; + } + + private: + int controls; + }; + + + + struct WellInjectionProperties { + std::string name; + UDAValue surfaceInjectionRate; + UDAValue reservoirInjectionRate; + UDAValue BHPLimit; + UDAValue THPLimit; + double temperature; + double BHPH; + double THPH; + int VFPTableNumber; + bool predictionMode; + int injectionControls; + Well2::InjectorType injectorType; + InjectorCMode controlMode; + + bool operator==(const WellInjectionProperties& other) const; + bool operator!=(const WellInjectionProperties& other) const; + + WellInjectionProperties(const std::string& wname); + void handleWELTARG(WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP); + void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name); + void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name); + bool hasInjectionControl(InjectorCMode controlModeArg) const { + if (injectionControls & static_cast(controlModeArg)) + return true; + else + return false; + } + + void dropInjectionControl(InjectorCMode controlModeArg) { + auto int_arg = static_cast(controlModeArg); + if ((injectionControls & int_arg) != 0) + injectionControls -= int_arg; + } + + void addInjectionControl(InjectorCMode controlModeArg) { + auto int_arg = static_cast(controlModeArg); + if ((injectionControls & int_arg) == 0) + injectionControls += int_arg; + } + + void resetDefaultHistoricalBHPLimit(); + + void setBHPLimit(const double limit); + InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const; + bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const; + }; + + struct ProductionControls { + public: + ProductionControls(int controls_arg) : + controls(controls_arg) + { + } + + ProducerCMode cmode; + double oil_rate; + double water_rate; + double gas_rate; + double liquid_rate; + double resv_rate; + double bhp_history; + double thp_history; + double bhp_limit; + double thp_limit; + double alq_value; + int vfp_table_number; + bool prediction_mode; + + bool hasControl(ProducerCMode cmode_arg) const { + return (this->controls & static_cast(cmode_arg)) != 0; + } + + private: + int controls; + }; + + + class WellProductionProperties { + public: + // the rates serve as limits under prediction mode + // while they are observed rates under historical mode + std::string name; + UDAValue OilRate; + UDAValue WaterRate; + UDAValue GasRate; + UDAValue LiquidRate; + UDAValue ResVRate; + // BHP and THP limit + UDAValue BHPLimit; + UDAValue THPLimit; + // historical BHP and THP under historical mode + double BHPH = 0.0; + double THPH = 0.0; + int VFPTableNumber = 0; + double ALQValue = 0.0; + bool predictionMode = false; + ProducerCMode controlMode = ProducerCMode::CMODE_UNDEFINED; + ProducerCMode whistctl_cmode = ProducerCMode::CMODE_UNDEFINED; + + bool operator==(const WellProductionProperties& other) const; + bool operator!=(const WellProductionProperties& other) const; + WellProductionProperties(const std::string& name_arg); + + bool hasProductionControl(ProducerCMode controlModeArg) const { + return (m_productionControls & static_cast(controlModeArg)) != 0; + } + + void dropProductionControl(ProducerCMode controlModeArg) { + if (hasProductionControl(controlModeArg)) + m_productionControls -= static_cast(controlModeArg); + } + + void addProductionControl(ProducerCMode controlModeArg) { + if (! hasProductionControl(controlModeArg)) + m_productionControls += static_cast(controlModeArg); + } + + // this is used to check whether the specified control mode is an effective history matching production mode + static bool effectiveHistoryProductionControl(ProducerCMode cmode); + void handleWCONPROD( const std::string& well, const DeckRecord& record); + void handleWCONHIST( const DeckRecord& record); + void handleWELTARG( WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP); + void resetDefaultBHPLimit(); + void clearControls(); + ProductionControls controls(const SummaryState& st, double udq_default) const; + bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const; + private: + int m_productionControls = 0; + void init_rates( const DeckRecord& record ); + + void init_history(const DeckRecord& record); + + WellProductionProperties(const DeckRecord& record); + + void setBHPLimit(const double limit); + + double getBHPLimit() const; + }; + + Well2(const std::string& wname, const std::string& gname, std::size_t init_step, @@ -64,15 +335,15 @@ public: int headJ, double ref_depth, Phase phase, - WellProducer::ControlModeEnum whistctl_cmode, - WellCompletion::CompletionOrderEnum ordering, + ProducerCMode whistctl_cmode, + Connection::Order ordering, const UnitSystem& unit_system, double udq_undefined); bool isMultiSegment() const; bool isAvailableForGroupControl() const; double getGuideRate() const; - GuideRate::GuideRatePhaseEnum getGuideRatePhase() const; + GuideRateTarget getGuideRatePhase() const; double getGuideRateScalingFactor() const; bool hasBeenDefined(size_t timeStep) const; @@ -81,7 +352,7 @@ public: bool canOpen() const; bool isProducer() const; bool isInjector() const; - WellInjector::TypeEnum injectorType() const; + InjectorType injectorType() const; size_t seqIndex() const; bool getAutomaticShutIn() const; bool getAllowCrossFlow() const; @@ -91,7 +362,7 @@ public: double getRefDepth() const; double getDrainageRadius() const; double getEfficiencyFactor() const; - WellCompletion::CompletionOrderEnum getWellConnectionOrdering() const; + Connection::Order getWellConnectionOrdering() const; const WellProductionProperties& getProductionProperties() const; const WellInjectionProperties& getInjectionProperties() const; const WellEconProductionLimits& getEconLimits() const; @@ -101,7 +372,7 @@ public: const WellConnections& getConnections() const; const WellSegments& getSegments() const; double getSolventFraction() const; - WellCommon::StatusEnum getStatus() const; + Status getStatus() const; const std::string& groupName() const; Phase getPreferredPhase() const; /* The rate of a given phase under the following assumptions: @@ -138,10 +409,10 @@ public: bool updateRefDepth(double ref_dpeth); bool updateDrainageRadius(double drainage_radius); bool updateConnections(const std::shared_ptr connections); - bool updateStatus(WellCommon::StatusEnum status); + bool updateStatus(Status status); bool updateGroup(const std::string& group); bool updateProducer(bool is_producer); - bool updateWellGuideRate(bool available, double guide_rate, GuideRate::GuideRatePhaseEnum guide_phase, double scale_factor); + bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor); bool updateWellGuideRate(double guide_rate); bool updateEfficiencyFactor(double efficiency_factor); bool updateSolventFraction(double solvent_fraction); @@ -154,7 +425,7 @@ public: bool handleWELSEGS(const DeckKeyword& keyword); bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); - bool handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum status); + bool handleWELOPEN(const DeckRecord& record, Connection::State status); bool handleCOMPLUMP(const DeckRecord& record); bool handleWPIMULT(const DeckRecord& record); @@ -175,11 +446,11 @@ private: int headJ; double ref_depth; Phase phase; - WellCompletion::CompletionOrderEnum ordering; + Connection::Order ordering; UnitSystem unit_system; double udq_undefined; - WellCommon::StatusEnum status; + Status status; double drainage_radius; bool allow_cross_flow; bool automatic_shutin; @@ -199,6 +470,9 @@ private: std::shared_ptr segments; }; +std::ostream& operator<<( std::ostream&, const Well2::WellInjectionProperties& ); +std::ostream& operator<<( std::ostream&, const WellProductionProperties& ); + } diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp index 723066c64..17edd8c05 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp @@ -28,19 +28,21 @@ namespace Opm { class Eclipse3DProperties; class WellConnections { public: + + WellConnections(int headI, int headJ); // cppcheck-suppress noExplicitConstructor WellConnections(const WellConnections& src, const EclipseGrid& grid); void addConnection(int i, int j , int k , double depth, - WellCompletion::StateEnum state , + Connection::State state , double CF, double Kh, double rw, double r0, double skin_factor, const int satTableId, - const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnum::Z, + const Connection::Direction direction = Connection::Direction::Z, const std::size_t seqIndex = 0, const double segDistStart= 0.0, const double segDistEnd= 0.0, @@ -82,14 +84,14 @@ namespace Opm { void addConnection(int i, int j , int k , int complnum, double depth, - WellCompletion::StateEnum state , + Connection::State state , double CF, double Kh, double rw, double r0, double skin_factor, const int satTableId, - const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnum::Z, + const Connection::Direction direction = Connection::Direction::Z, const std::size_t seqIndex = 0, const double segDistStart= 0.0, const double segDistEnd= 0.0, diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp index ba8055049..9e7d36974 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp @@ -22,14 +22,37 @@ #include -#include - namespace Opm { class DeckRecord; - class WellEconProductionLimits{ + class WellEconProductionLimits { public: + + enum class QuantityLimit { + RATE = 0, + POTN = 1 + }; + + static const std::string QuantityLimit2String(QuantityLimit enumValue); + static QuantityLimit QuantityLimitFromString(const std::string& stringValue); + + + enum class EconWorkover { + NONE = 0, + CON = 1, // CON + CONP = 2, // +CON + WELL = 3, + PLUG = 4, + // the following two only related to workover action + // on exceeding secondary water cut limit + LAST = 5, + RED = 6 + }; + static std::string EconWorkover2String(EconWorkover enumValue); + static EconWorkover EconWorkoverFromString(const std::string& stringValue); + + explicit WellEconProductionLimits(const DeckRecord& record); WellEconProductionLimits(); @@ -37,128 +60,53 @@ namespace Opm { // for the moment. // limit switch on? - bool onAnyEffectiveLimit() const { - return (onAnyRatioLimit() || - onAnyRateLimit()); - }; - - bool onAnyRatioLimit() const { - return (onMaxWaterCut() || - onMaxGasOilRatio() || - onMaxWaterGasRatio() || - onMaxGasLiquidRatio()); - }; - - - bool onAnyRateLimit() const { - return (onMinOilRate() || - onMinGasRate() || - onMinLiquidRate() || - onMinReservoirFluidRate()); - }; - - bool onMinOilRate() const { - return (m_min_oil_rate > 0.0); - }; - - bool onMinGasRate() const { - return (m_min_gas_rate > 0.0); - }; - - bool onMaxWaterCut() const { - return (m_max_water_cut > 0.0); - }; - - bool onMaxGasOilRatio() const { - return (m_max_gas_oil_ratio > 0.0); - }; - - bool onMaxWaterGasRatio() const { - return (m_max_water_gas_ratio > 0.0); - }; - - bool onSecondaryMaxWaterCut() const { - return (m_secondary_max_water_cut > 0.0); - }; - - bool onMaxGasLiquidRatio() const { - return (m_max_gas_oil_ratio > 0.0); - }; - - // assuming Celsius temperature is used internally - bool onMaxTemperature() const { - return (m_max_temperature > -273.15); - }; - - bool onMinLiquidRate() const { - return (m_min_liquid_rate > 0.0); - }; - - bool onMinReservoirFluidRate() const { - return (m_min_reservoir_fluid_rate > 0.0); - }; - - // not sure what will happen if the followon well is a well does not exist. - bool validFollowonWell() const { - return (m_followon_well != "'"); - }; - - bool requireWorkover() const { - return (m_workover != WellEcon::NONE); - }; - - bool requireSecondaryWorkover() const { - return (m_workover_secondary != WellEcon::NONE); - } - - bool endRun() const { - return m_end_run; - } - - double minOilRate() const { return m_min_oil_rate; }; - - double minGasRate() const { return m_min_gas_rate; }; - - double maxWaterCut() const { return m_max_water_cut; }; - - double maxGasOilRatio() const { return m_max_gas_oil_ratio; }; - - double maxWaterGasRatio() const { return m_max_water_gas_ratio; }; - - WellEcon::WorkoverEnum workover() const { return m_workover; }; - - const std::string& followonWell() const { return m_followon_well; }; - - WellEcon::QuantityLimitEnum quantityLimit() const {return m_quantity_limit; }; - - double maxSecondaryMaxWaterCut() const { return m_secondary_max_water_cut; }; - - WellEcon::WorkoverEnum workoverSecondary() const { return m_workover_secondary; }; - - double maxGasLiquidRatio() const { return m_max_gas_liquid_ratio; }; - - double minLiquidRate() const { return m_min_liquid_rate; }; - - double maxTemperature() const { return m_max_temperature; }; - - double minReservoirFluidRate() const { return m_min_reservoir_fluid_rate; }; - + bool onAnyEffectiveLimit() const; + bool onAnyRatioLimit() const; + bool onAnyRateLimit() const; + bool onMinOilRate() const; + bool onMinGasRate() const; + bool onMaxWaterCut() const; + bool onMaxGasOilRatio() const; + bool onMaxWaterGasRatio() const; + bool onSecondaryMaxWaterCut() const; + bool onMaxGasLiquidRatio() const; + // assuming Celsius temperature is used internally; + bool onMaxTemperature() const; + bool onMinLiquidRate() const; + bool onMinReservoirFluidRate() const; + // not sure what will happen if the followon well is a well does not exist.; + bool validFollowonWell() const; + bool requireWorkover() const; + bool requireSecondaryWorkover() const; + bool endRun() const; + double minOilRate() const; + double minGasRate() const; + double maxWaterCut() const; + double maxGasOilRatio() const; + double maxWaterGasRatio() const; + EconWorkover workover() const; + const std::string& followonWell() const; + QuantityLimit quantityLimit() const; + double maxSecondaryMaxWaterCut() const; + EconWorkover workoverSecondary() const; + double maxGasLiquidRatio() const; + double minLiquidRate() const; + double maxTemperature() const; + double minReservoirFluidRate() const; bool operator==(const WellEconProductionLimits& other) const; - bool operator!=(const WellEconProductionLimits& other) const; - private: double m_min_oil_rate; double m_min_gas_rate; double m_max_water_cut; double m_max_gas_oil_ratio; double m_max_water_gas_ratio; - WellEcon::WorkoverEnum m_workover; + EconWorkover m_workover; bool m_end_run; std::string m_followon_well; - WellEcon::QuantityLimitEnum m_quantity_limit; + QuantityLimit m_quantity_limit; double m_secondary_max_water_cut; - WellEcon::WorkoverEnum m_workover_secondary; + EconWorkover m_workover_secondary; double m_max_gas_liquid_ratio; double m_min_liquid_rate; double m_max_temperature; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp index cc6817f3c..9f4bf6152 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp @@ -20,11 +20,6 @@ #ifndef WELLINJECTIONPROPERTIES_HPP_HEADER_INCLUDED #define WELLINJECTIONPROPERTIES_HPP_HEADER_INCLUDED -#include - -#include -#include -#include namespace Opm { @@ -34,53 +29,6 @@ namespace Opm { class UDQActive; class UDQConfig; - struct WellInjectionProperties { - std::string name; - UDAValue surfaceInjectionRate; - UDAValue reservoirInjectionRate; - UDAValue BHPLimit; - UDAValue THPLimit; - double temperature; - double BHPH; - double THPH; - int VFPTableNumber; - bool predictionMode; - int injectionControls; - WellInjector::TypeEnum injectorType; - WellInjector::ControlModeEnum controlMode; - - bool operator==(const WellInjectionProperties& other) const; - bool operator!=(const WellInjectionProperties& other) const; - - WellInjectionProperties(const std::string& wname); - void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP); - void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name); - void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name); - bool hasInjectionControl(WellInjector::ControlModeEnum controlModeArg) const { - if (injectionControls & controlModeArg) - return true; - else - return false; - } - - void dropInjectionControl(WellInjector::ControlModeEnum controlModeArg) { - if ((injectionControls & controlModeArg) != 0) - injectionControls -= controlModeArg; - } - - void addInjectionControl(WellInjector::ControlModeEnum controlModeArg) { - if ((injectionControls & controlModeArg) == 0) - injectionControls += controlModeArg; - } - - void resetDefaultHistoricalBHPLimit(); - - void setBHPLimit(const double limit); - InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const; - bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const; - }; - - std::ostream& operator<<( std::ostream&, const WellInjectionProperties& ); } #endif diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp index 52b031ccc..b592fbad6 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp @@ -20,84 +20,13 @@ #ifndef WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED #define WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED -#include -#include - -#include -#include -#include -#include - namespace Opm { class DeckRecord; class SummaryState; class UDQActive; - class WellProductionProperties { - public: - // the rates serve as limits under prediction mode - // while they are observed rates under historical mode - std::string name; - UDAValue OilRate; - UDAValue WaterRate; - UDAValue GasRate; - UDAValue LiquidRate; - UDAValue ResVRate; - // BHP and THP limit - UDAValue BHPLimit; - UDAValue THPLimit; - // historical BHP and THP under historical mode - double BHPH = 0.0; - double THPH = 0.0; - int VFPTableNumber = 0; - double ALQValue = 0.0; - bool predictionMode = false; - WellProducer::ControlModeEnum controlMode = WellProducer::CMODE_UNDEFINED; - WellProducer::ControlModeEnum whistctl_cmode = WellProducer::CMODE_UNDEFINED; - bool operator==(const WellProductionProperties& other) const; - bool operator!=(const WellProductionProperties& other) const; - WellProductionProperties(const std::string& name_arg); +} - bool hasProductionControl(WellProducer::ControlModeEnum controlModeArg) const { - return (m_productionControls & controlModeArg) != 0; - } - - void dropProductionControl(WellProducer::ControlModeEnum controlModeArg) { - if (hasProductionControl(controlModeArg)) - m_productionControls -= controlModeArg; - } - - void addProductionControl(WellProducer::ControlModeEnum controlModeArg) { - if (! hasProductionControl(controlModeArg)) - m_productionControls += controlModeArg; - } - - // this is used to check whether the specified control mode is an effective history matching production mode - static bool effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode); - void handleWCONPROD( const std::string& well, const DeckRecord& record); - void handleWCONHIST( const DeckRecord& record); - void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP); - void resetDefaultBHPLimit(); - void clearControls(); - ProductionControls controls(const SummaryState& st, double udq_default) const; - bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const; - private: - int m_productionControls = 0; - void init_rates( const DeckRecord& record ); - - void init_history(const DeckRecord& record); - - WellProductionProperties(const DeckRecord& record); - - void setBHPLimit(const double limit); - - double getBHPLimit() const; - }; - - std::ostream& operator<<( std::ostream&, const WellProductionProperties& ); - -} // namespace Opm - -#endif // WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED +#endif diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index ff5bbdcbf..888aee9b3 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -30,7 +30,6 @@ #include #include -#include // Phase::PhaseEnum #include #include #include diff --git a/python/cxx/connection.cpp b/python/cxx/connection.cpp index 9981e80c9..f84de4335 100644 --- a/python/cxx/connection.cpp +++ b/python/cxx/connection.cpp @@ -5,11 +5,11 @@ namespace { std::string state( const Connection& c ) { - return WellCompletion::StateEnum2String( c.state() ); + return Connection::State2String( c.state() ); } std::string direction( const Connection& c ) { - return WellCompletion::DirectionEnum2String( c.dir() ); + return Connection::Direction2String( c.dir() ); } } diff --git a/python/cxx/well.cpp b/python/cxx/well.cpp index 7ff880cc2..69ee10443 100644 --- a/python/cxx/well.cpp +++ b/python/cxx/well.cpp @@ -11,7 +11,7 @@ namespace { } std::string status( const Well2& w ) { - return WellCommon::Status2String( w.getStatus() ); + return Well2::Status2String( w.getStatus() ); } std::string preferred_phase( const Well2& w ) { diff --git a/src/opm/output/eclipse/AggregateConnectionData.cpp b/src/opm/output/eclipse/AggregateConnectionData.cpp index effab60ab..76a06a5d9 100755 --- a/src/opm/output/eclipse/AggregateConnectionData.cpp +++ b/src/opm/output/eclipse/AggregateConnectionData.cpp @@ -26,7 +26,6 @@ #include #include -#include #include @@ -116,7 +115,7 @@ namespace { const std::size_t connID, IConnArray& iConn) { - using ConnState = ::Opm::WellCompletion::StateEnum; + using ConnState = ::Opm::Connection::State; using Ix = ::Opm::RestartIO::Helpers::VectorItems::IConn::index; iConn[Ix::SeqIndex] = connID + 1; @@ -139,7 +138,7 @@ namespace { iConn[Ix::ComplNum] = std::abs(conn.complnum()); //iConn[Ix::ComplNum] = iConn[Ix::SeqIndex]; - iConn[Ix::ConnDir] = conn.dir(); + iConn[Ix::ConnDir] = static_cast(conn.dir()); iConn[Ix::Segment] = conn.attachedToSegment() ? conn.segment() : 0; } @@ -298,12 +297,12 @@ captureDeclaredConnData(const Schedule& sched, for (auto nConn = conns.size(), connID = 0*nConn; connID < nConn; connID++) { // // WellRates connections are only defined for OPEN connections - if ((conns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) && + if ((conns[connID].state() == Opm::Connection::State::OPEN) && (rCInd < xr->second.connections.size())) { it->second[connID] = &(xr->second.connections[rCInd]); rCInd+= 1; } - else if ((conns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) && (rCInd >= xr->second.connections.size())) { + else if ((conns[connID].state() == Opm::Connection::State::OPEN) && (rCInd >= xr->second.connections.size())) { throw std::invalid_argument { "Inconsistent number of open connections I in vector (" + std::to_string(xr->second.connections.size()) + ") in Well " + wl.name() diff --git a/src/opm/output/eclipse/AggregateGroupData.cpp b/src/opm/output/eclipse/AggregateGroupData.cpp index 9625ed400..accac95d9 100644 --- a/src/opm/output/eclipse/AggregateGroupData.cpp +++ b/src/opm/output/eclipse/AggregateGroupData.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/src/opm/output/eclipse/AggregateMSWData.cpp b/src/opm/output/eclipse/AggregateMSWData.cpp index a344c32b8..ea9023af3 100644 --- a/src/opm/output/eclipse/AggregateMSWData.cpp +++ b/src/opm/output/eclipse/AggregateMSWData.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -195,7 +194,7 @@ namespace { using M = ::Opm::UnitSystem::measure; using R = ::Opm::data::Rates::opt; for (auto nConn = welConns.size(), connID = 0*nConn; connID < nConn; connID++) { - if (welConns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) openConnections.push_back(&welConns[connID]); + if (welConns[connID].state() == Opm::Connection::State::OPEN) openConnections.push_back(&welConns[connID]); } if (openConnections.size() != rateConns.size()) { throw std::invalid_argument { diff --git a/src/opm/output/eclipse/AggregateWellData.cpp b/src/opm/output/eclipse/AggregateWellData.cpp index 80460ef23..ec2bb3c98 100644 --- a/src/opm/output/eclipse/AggregateWellData.cpp +++ b/src/opm/output/eclipse/AggregateWellData.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -141,7 +140,7 @@ namespace { return WTypeVal::Producer; } - using IType = ::Opm::WellInjector::TypeEnum; + using IType = ::Opm::Well2::InjectorType; const auto itype = well.injectionControls(st).injector_type; @@ -172,8 +171,8 @@ namespace { const auto wmctl = controls.cmode; const auto wtype = controls.injector_type; - using CMode = ::Opm::WellInjector::ControlModeEnum; - using WType = ::Opm::WellInjector::TypeEnum; + using CMode = ::Opm::Well2::InjectorCMode; + using WType = ::Opm::Well2::InjectorType; switch (wmctl) { case CMode::RATE: { @@ -195,7 +194,7 @@ namespace { { const auto stat = well.getStatus(); - using WStat = ::Opm::WellCommon::StatusEnum; + using WStat = ::Opm::Well2::Status; if (stat == WStat::SHUT) { return WMCtrlVal::Shut; @@ -207,7 +206,7 @@ namespace { else if (well.isProducer()) { const auto& controls = well.productionControls(st); - using CMode = ::Opm::WellProducer::ControlModeEnum; + using CMode = ::Opm::Well2::ProducerCMode; switch (controls.cmode) { case CMode::ORAT: return WMCtrlVal::OilRate; @@ -224,7 +223,7 @@ namespace { { const auto stat = well.getStatus(); - using WStat = ::Opm::WellCommon::StatusEnum; + using WStat = ::Opm::Well2::Status; if (stat == WStat::SHUT) { return WMCtrlVal::Shut; @@ -239,7 +238,7 @@ namespace { int compOrder(const Opm::Well2& well) { - using WCO = ::Opm::WellCompletion::CompletionOrderEnum; + using WCO = ::Opm::Connection::Order; using COVal = ::Opm::RestartIO::Helpers:: VectorItems::IWell::Value::CompOrder; @@ -513,8 +512,8 @@ namespace { else if (well.isInjector()) { const auto& ic = well.injectionControls(smry); - using IP = ::Opm::WellInjector::ControlModeEnum; - using IT = ::Opm::WellInjector::TypeEnum; + using IP = ::Opm::Well2::InjectorCMode; + using IT = ::Opm::Well2::InjectorType; if (ic.hasControl(IP::RATE)) { if (ic.injector_type == IT::OIL) { @@ -714,7 +713,7 @@ namespace { assignProducer(well.name(), smry, xWell); } else if (well.isInjector()) { - using IType = ::Opm::WellInjector::TypeEnum; + using IType = ::Opm::Well2::InjectorType; const auto itype = well.injectionControls(smry).injector_type; switch (itype) { diff --git a/src/opm/output/eclipse/DoubHEAD.cpp b/src/opm/output/eclipse/DoubHEAD.cpp index 4b65201f7..2a6cd5bad 100755 --- a/src/opm/output/eclipse/DoubHEAD.cpp +++ b/src/opm/output/eclipse/DoubHEAD.cpp @@ -21,7 +21,6 @@ // Note: DynamicState.hpp and are prerequisites of Tuning.hpp #include -#include #include #include #include @@ -617,7 +616,7 @@ Opm::RestartIO::DoubHEAD::drsdt(const Schedule& sched, sched.getOilVaporizationProperties(lookup_step); this->data_[dRsdt] = - (vappar.getType() == Opm::OilVaporizationEnum::DRDT) + (vappar.getType() == Opm::OilVaporizationProperties::OilVaporization::DRDT) ? vappar.getMaxDRSDT(0)*cnvT : 1.0e+20; diff --git a/src/opm/output/eclipse/EclipseIO.cpp b/src/opm/output/eclipse/EclipseIO.cpp index b6dba32c8..7db9b52ec 100644 --- a/src/opm/output/eclipse/EclipseIO.cpp +++ b/src/opm/output/eclipse/EclipseIO.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/src/opm/output/eclipse/LoadRestart.cpp b/src/opm/output/eclipse/LoadRestart.cpp index decafd778..3e5478b72 100644 --- a/src/opm/output/eclipse/LoadRestart.cpp +++ b/src/opm/output/eclipse/LoadRestart.cpp @@ -775,7 +775,7 @@ namespace { for (const auto& sc : sched_well.getConnections()) { const auto i = sc.getI(), j = sc.getJ(), k = sc.getK(); - if (!grid.cellActive(i, j, k) || sc.state() == Opm::WellCompletion::SHUT) { + if (!grid.cellActive(i, j, k) || sc.state() == Opm::Connection::State::SHUT) { opm_xwel_data += Opm::data::Connection::restart_size + phases.size(); continue; } diff --git a/src/opm/output/eclipse/RestartIO.cpp b/src/opm/output/eclipse/RestartIO.cpp index 8320684ad..ab3f5ae60 100644 --- a/src/opm/output/eclipse/RestartIO.cpp +++ b/src/opm/output/eclipse/RestartIO.cpp @@ -113,7 +113,7 @@ namespace { std::vector< double > xwel; for (const auto& sched_well : sched_wells) { if (wells.count(sched_well.name()) == 0 || - sched_well.getStatus() == Opm::WellCommon::SHUT) + sched_well.getStatus() == Opm::Well2::Status::SHUT) { const auto elems = (sched_well.getConnections().size() * (phases.size() + data::Connection::restart_size)) @@ -137,7 +137,7 @@ namespace { const auto i = sc.getI(), j = sc.getJ(), k = sc.getK(); const auto rs_size = phases.size() + data::Connection::restart_size; - if (!grid.cellActive(i, j, k) || sc.state() == WellCompletion::SHUT) { + if (!grid.cellActive(i, j, k) || sc.state() == Connection::State::SHUT) { xwel.insert(xwel.end(), rs_size, 0.0); continue; } diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index cb3844cce..b1a40158f 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -1098,7 +1098,7 @@ inline std::vector find_wells( const Schedule& schedule, if( type == ECL_SMSPEC_GROUP_VAR ) { if( !schedule.hasGroup( name ) ) return {}; - return schedule.getChildWells2( name, sim_step, GroupWellQueryMode::Recursive); + return schedule.getChildWells2( name, sim_step); } if( type == ECL_SMSPEC_FIELD_VAR ) diff --git a/src/opm/parser/eclipse/EclipseState/EclipseState.cpp b/src/opm/parser/eclipse/EclipseState/EclipseState.cpp index da18a7bfc..43c88d34a 100644 --- a/src/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/src/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp index 5ff60dab9..2e46320f2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp @@ -291,11 +291,11 @@ Group2::InjectionControls Group2::injectionControls(const SummaryState& st) cons return ic; } -GroupProduction::ControlEnum Group2::production_cmode() const { +Group2::ProductionCMode Group2::production_cmode() const { return this->production_properties.cmode; } -GroupInjection::ControlEnum Group2::injection_cmode() const { +Group2::InjectionCMode Group2::injection_cmode() const { return this->injection_properties.cmode; } @@ -304,20 +304,182 @@ Phase Group2::injection_phase() const { } -bool Group2::ProductionControls::has_control(GroupProduction::ControlEnum control) const { - return (this->production_controls & control) != 0; +bool Group2::ProductionControls::has_control(Group2::ProductionCMode control) const { + return (this->production_controls & static_cast(control)) != 0; } -bool Group2::InjectionControls::has_control(GroupInjection::ControlEnum control) const { - return (this->injection_controls & control) != 0; +bool Group2::InjectionControls::has_control(InjectionCMode cmode_arg) const { + return (this->injection_controls & static_cast(cmode_arg)) != 0; } -bool Group2::has_control(GroupProduction::ControlEnum control) const { - return (this->production_properties.production_controls & control) != 0; +bool Group2::has_control(Group2::ProductionCMode control) const { + return (this->production_properties.production_controls & static_cast(control)) != 0; } -bool Group2::has_control(GroupInjection::ControlEnum control) const { - return (this->injection_properties.injection_controls & control) != 0; +bool Group2::has_control(InjectionCMode control) const { + return (this->injection_properties.injection_controls & static_cast(control)) != 0; } + + +const std::string Group2::ExceedAction2String( ExceedAction enumValue ) { + switch(enumValue) { + case ExceedAction::NONE: + return "NONE"; + case ExceedAction::CON: + return "CON"; + case ExceedAction::CON_PLUS: + return "+CON"; + case ExceedAction::WELL: + return "WELL"; + case ExceedAction::PLUG: + return "PLUG"; + case ExceedAction::RATE: + return "RATE"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + + +Group2::ExceedAction Group2::ExceedActionFromString( const std::string& stringValue ) { + + if (stringValue == "NONE") + return ExceedAction::NONE; + else if (stringValue == "CON") + return ExceedAction::CON; + else if (stringValue == "+CON") + return ExceedAction::CON_PLUS; + else if (stringValue == "WELL") + return ExceedAction::WELL; + else if (stringValue == "PLUG") + return ExceedAction::PLUG; + else if (stringValue == "RATE") + return ExceedAction::RATE; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + + +const std::string Group2::InjectionCMode2String( InjectionCMode enumValue ) { + switch( enumValue ) { + case InjectionCMode::NONE: + return "NONE"; + case InjectionCMode::RATE: + return "RATE"; + case InjectionCMode::RESV: + return "RESV"; + case InjectionCMode::REIN: + return "REIN"; + case InjectionCMode::VREP: + return "VREP"; + case InjectionCMode::FLD: + return "FLD"; + default: + throw std::invalid_argument("Unhandled enum value"); + } +} + + +Group2::InjectionCMode Group2::InjectionCModeFromString( const std::string& stringValue ) { + if (stringValue == "NONE") + return InjectionCMode::NONE; + else if (stringValue == "RATE") + return InjectionCMode::RATE; + else if (stringValue == "RESV") + return InjectionCMode::RESV; + else if (stringValue == "REIN") + return InjectionCMode::REIN; + else if (stringValue == "VREP") + return InjectionCMode::VREP; + else if (stringValue == "FLD") + return InjectionCMode::FLD; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + +Group2::GroupType operator|(Group2::GroupType lhs, Group2::GroupType rhs) { + return static_cast(static_cast::type>(lhs) | static_cast::type>(rhs)); +} + + +Group2::GroupType operator&(Group2::GroupType lhs, Group2::GroupType rhs) { + return static_cast(static_cast::type>(lhs) & static_cast::type>(rhs)); +} + + +const std::string Group2::ProductionCMode2String( ProductionCMode enumValue ) { + switch( enumValue ) { + case ProductionCMode::NONE: + return "NONE"; + case ProductionCMode::ORAT: + return "ORAT"; + case ProductionCMode::WRAT: + return "WRAT"; + case ProductionCMode::GRAT: + return "GRAT"; + case ProductionCMode::LRAT: + return "LRAT"; + case ProductionCMode::CRAT: + return "CRAT"; + case ProductionCMode::RESV: + return "RESV"; + case ProductionCMode::PRBL: + return "PRBL"; + case ProductionCMode::FLD: + return "FLD"; + default: + throw std::invalid_argument("Unhandled enum value"); + } +} + + +Group2::ProductionCMode Group2::ProductionCModeFromString( const std::string& stringValue ) { + if (stringValue == "NONE") + return ProductionCMode::NONE; + else if (stringValue == "ORAT") + return ProductionCMode::ORAT; + else if (stringValue == "WRAT") + return ProductionCMode::WRAT; + else if (stringValue == "GRAT") + return ProductionCMode::GRAT; + else if (stringValue == "LRAT") + return ProductionCMode::LRAT; + else if (stringValue == "CRAT") + return ProductionCMode::CRAT; + else if (stringValue == "RESV") + return ProductionCMode::RESV; + else if (stringValue == "PRBL") + return ProductionCMode::PRBL; + else if (stringValue == "FLD") + return ProductionCMode::FLD; + else + 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/Group/GuideRateModel.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp index 56825ef3b..4cb082015 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp @@ -24,18 +24,18 @@ namespace Opm { GuideRateModel::GuideRateModel(double time_interval_arg, - GuideRateTarget phase_arg, - double A_arg, - double B_arg, - double C_arg, - double D_arg, - double E_arg, - double F_arg, - bool allow_increase_arg, - double damping_factor_arg, - bool use_free_gas_arg) : + Target target_arg, + double A_arg, + double B_arg, + double C_arg, + double D_arg, + double E_arg, + double F_arg, + bool allow_increase_arg, + double damping_factor_arg, + bool use_free_gas_arg) : time_interval(time_interval_arg), - phase(phase_arg), + target(target_arg), A(A_arg), B(B_arg), C(C_arg), @@ -84,7 +84,7 @@ double GuideRateModel::eval(double pot, double R1, double R2) const { bool GuideRateModel::operator==(const GuideRateModel& other) const { return (this->time_interval == other.time_interval) && - (this->phase == other.phase) && + (this->target == other.target) && (this->A == other.A) && (this->B == other.B) && (this->C == other.C) && @@ -100,4 +100,27 @@ bool GuideRateModel::operator!=(const GuideRateModel& other) const { return !(*this == other); } + +GuideRateModel::Target GuideRateModel::TargetFromString(const std::string& s) { + if (s == "OIL") + return Target::OIL; + + if (s == "LIQ") + return Target::LIQ; + + if (s == "GAS") + return Target::GAS; + + if (s == "RES") + return Target::RES; + + if (s == "COMB") + return Target::COMB; + + if (s == "NONE") + return Target::NONE; + + throw std::invalid_argument("Could not convert: " + s + " to a valid Target enum value"); +} + } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp index 5329d0b75..5187539a4 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp @@ -29,7 +29,6 @@ #include #include -#include #include "Compsegs.hpp" @@ -37,7 +36,7 @@ namespace Opm { Compsegs::Compsegs(int i_in, int j_in, int k_in, int branch_number_in, double distance_start_in, double distance_end_in, - WellCompletion::DirectionEnum dir_in, double center_depth_in, int segment_number_in, size_t seqIndex_in) + Connection::Direction dir_in, double center_depth_in, int segment_number_in, size_t seqIndex_in) : m_i(i_in), m_j(j_in), m_k(k_in), @@ -116,9 +115,9 @@ namespace Opm { * Defaulted well connection. Must be non-defaulted if DISTANCE_END * is set or a range is specified. If not this is effectively ignored. */ - WellCompletion::DirectionEnum direction = WellCompletion::X; + auto direction = Connection::Direction::X; if( record.getItem< ParserKeywords::COMPSEGS::DIRECTION >().hasValue( 0 ) ) { - direction = WellCompletion::DirectionEnumFromString(record.getItem().get< std::string >(0)); + direction = Connection::DirectionFromString(record.getItem().get< std::string >(0)); } double center_depth; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.hpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.hpp index e102c115d..612e24fe0 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.hpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.hpp @@ -24,8 +24,8 @@ #include #include -#include #include +#include #include namespace Opm { @@ -45,8 +45,8 @@ namespace Opm { int m_branch_number; double m_distance_start; double m_distance_end; + Connection::Direction m_dir; - WellCompletion::DirectionEnum m_dir; double center_depth; // we do not handle thermal length for the moment // double m_thermal_length; @@ -54,7 +54,7 @@ namespace Opm { std::size_t m_seqIndex; Compsegs(int i_in, int j_in, int k_in, int branch_number_in, double distance_start_in, double distance_end_in, - WellCompletion::DirectionEnum dir_in, double center_depth_in, int segment_number_in, std::size_t seqIndex_in); + Connection::Direction dir_in, double center_depth_in, int segment_number_in, std::size_t seqIndex_in); void calculateCenterDepthWithSegments(const WellSegments& segment_set); @@ -66,7 +66,7 @@ namespace Opm { // update the segment related information for Connections static void updateConnectionsWithSegment(const std::vector< Compsegs >& compsegs, - const EclipseGrid& grid, + const EclipseGrid& grid, WellConnections& connection_set); }; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp index 87a96e1cb..d2f21beeb 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp @@ -57,11 +57,11 @@ namespace Opm { } - WellSegment::CompPressureDropEnum WellSegments::compPressureDrop() const { + WellSegments::CompPressureDrop WellSegments::compPressureDrop() const { return m_comp_pressure_drop; } - WellSegment::MultiPhaseModelEnum WellSegments::multiPhaseModel() const { + WellSegments::MultiPhaseModel WellSegments::multiPhaseModel() const { return m_multiphase_model; } @@ -105,19 +105,19 @@ namespace Opm { m_depth_top = record1.getItem("DEPTH").getSIDouble(0); m_length_top = record1.getItem("LENGTH").getSIDouble(0); - m_length_depth_type = WellSegment::LengthDepthEnumFromString(record1.getItem("INFO_TYPE").getTrimmedString(0)); + m_length_depth_type = LengthDepthFromString(record1.getItem("INFO_TYPE").getTrimmedString(0)); m_volume_top = record1.getItem("WELLBORE_VOLUME").getSIDouble(0); - m_comp_pressure_drop = WellSegment::CompPressureDropEnumFromString(record1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0)); - m_multiphase_model = WellSegment::MultiPhaseModelEnumFromString(record1.getItem("FLOW_MODEL").getTrimmedString(0)); + m_comp_pressure_drop = CompPressureDropFromString(record1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0)); + m_multiphase_model = MultiPhaseModelFromString(record1.getItem("FLOW_MODEL").getTrimmedString(0)); // the main branch is 1 instead of 0 // the segment number for top segment is also 1 - if (m_length_depth_type == WellSegment::INC) { + if (m_length_depth_type == LengthDepth::INC) { m_segments.emplace_back( 1, 1, 0, 0., 0., invalid_value, invalid_value, invalid_value, m_volume_top, false ); - } else if (m_length_depth_type == WellSegment::ABS) { + } else if (m_length_depth_type == LengthDepth::ABS) { m_segments.emplace_back( 1, 1, 0, m_length_top, m_depth_top, invalid_value, invalid_value, invalid_value, m_volume_top, true ); @@ -160,7 +160,7 @@ namespace Opm { double volume; if (itemVolume.hasValue(0)) { volume = itemVolume.getSIDouble(0); - } else if (m_length_depth_type == WellSegment::INC) { + } else if (m_length_depth_type == LengthDepth::INC) { volume = area * segment_length; } else { volume = invalid_value; // A * L, while L is not determined yet @@ -178,7 +178,7 @@ namespace Opm { outlet_segment = i - 1; } - if (m_length_depth_type == WellSegment::INC) { + if (m_length_depth_type == LengthDepth::INC) { m_segments.emplace_back( i, branch, outlet_segment, segment_length, depth_change, diameter, roughness, area, volume, false ); } else if (i == segment2) { @@ -223,9 +223,9 @@ namespace Opm { } void WellSegments::process(bool first_time) { - if (this->m_length_depth_type == WellSegment::ABS) + if (this->m_length_depth_type == LengthDepth::ABS) this->processABS(); - else if (this->m_length_depth_type == WellSegment::INC) + else if (this->m_length_depth_type == LengthDepth::INC) this->processINC(first_time); else throw std::logic_error("Invalid llength/depth/type in segment data structure"); @@ -429,4 +429,75 @@ namespace Opm { " V: " << well_segments.volumeTopSegment() << " }}"; } +const std::string WellSegments::LengthDepthToString(LengthDepth enumValue) { + switch (enumValue) { + case LengthDepth::INC: + return "INC"; + case LengthDepth::ABS: + return "ABS"; + default: + throw std::invalid_argument("unhandled LengthDepth value"); + } +} + + +WellSegments::LengthDepth WellSegments::LengthDepthFromString(const std::string& string_value ) { + if (string_value == "INC") { + return LengthDepth::INC; + } else if (string_value == "ABS") { + return LengthDepth::ABS; + } else { + throw std::invalid_argument("Unknown enum string_value: " + string_value + " for LengthDepth"); + } +} + + +const std::string WellSegments::CompPressureDropToString(CompPressureDrop enumValue) { + switch (enumValue) { + case CompPressureDrop::HFA: + return "HFA"; + case CompPressureDrop::HF_: + return "HF-"; + case CompPressureDrop::H__: + return "H--"; + default: + throw std::invalid_argument("unhandled CompPressureDrop value"); + } +} + +WellSegments::CompPressureDrop WellSegments::CompPressureDropFromString( const std::string& string_value ) { + + if (string_value == "HFA") { + return CompPressureDrop::HFA; + } else if (string_value == "HF-") { + return CompPressureDrop::HF_; + } else if (string_value == "H--") { + return CompPressureDrop::H__; + } else { + throw std::invalid_argument("Unknown enum string_value: " + string_value + " for CompPressureDrop"); + } +} + +const std::string WellSegments::MultiPhaseModelToString(MultiPhaseModel enumValue) { + switch (enumValue) { + case MultiPhaseModel::HO: + return "HO"; + case MultiPhaseModel::DF: + return "DF"; + default: + throw std::invalid_argument("unhandled MultiPhaseModel value"); + } +} + +WellSegments::MultiPhaseModel WellSegments::MultiPhaseModelFromString(const std::string& string_value ) { + + if ((string_value == "HO") || (string_value == "H0")) { + return MultiPhaseModel::HO; + } else if (string_value == "DF") { + return MultiPhaseModel::DF; + } else { + throw std::invalid_argument("Unknown enum string_value: " + string_value + " for MultiPhaseModel"); + } + +} } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp index 33e01910e..e090a42e3 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp @@ -52,12 +52,12 @@ namespace Opm { } } - Opm::OilVaporizationEnum OilVaporizationProperties::getType() const{ + OilVaporizationProperties::OilVaporization OilVaporizationProperties::getType() const{ return m_type; } double OilVaporizationProperties::getVap1(const size_t pvtRegionIdx) const{ - if (m_type == Opm::OilVaporizationEnum::VAPPARS){ + if (m_type == OilVaporization::VAPPARS){ return m_vap1[pvtRegionIdx]; }else{ throw std::logic_error("Only valid if type is VAPPARS"); @@ -65,7 +65,7 @@ namespace Opm { } double OilVaporizationProperties::getVap2(const size_t pvtRegionIdx) const{ - if (m_type == Opm::OilVaporizationEnum::VAPPARS){ + if (m_type == OilVaporization::VAPPARS){ return m_vap2[pvtRegionIdx]; }else{ throw std::logic_error("Only valid if type is VAPPARS"); @@ -73,54 +73,54 @@ namespace Opm { } void OilVaporizationProperties::updateDRSDT(OilVaporizationProperties& ovp, const std::vector& maximums, const std::vector& options){ - ovp.m_type = Opm::OilVaporizationEnum::DRDT; + ovp.m_type = OilVaporization::DRDT; ovp.m_maxDRSDT = maximums; for (size_t pvtRegionIdx = 0; pvtRegionIdx < options.size(); ++pvtRegionIdx) { if (options[pvtRegionIdx] == "ALL"){ ovp.m_maxDRSDT_allCells[pvtRegionIdx] = true; - }else if (options[pvtRegionIdx] == "FREE") { + } else if (options[pvtRegionIdx] == "FREE") { ovp.m_maxDRSDT_allCells[pvtRegionIdx] = false; - }else{ + } else { throw std::invalid_argument("Only ALL or FREE is allowed as option string"); } } } void OilVaporizationProperties::updateDRVDT(OilVaporizationProperties& ovp, const std::vector& maximums){ - ovp.m_type = Opm::OilVaporizationEnum::DRDT; + ovp.m_type = OilVaporization::DRDT; ovp.m_maxDRVDT = maximums; } void OilVaporizationProperties::updateVAPPARS(OilVaporizationProperties& ovp, const std::vector& vap1, const std::vector& vap2){ - ovp.m_type = Opm::OilVaporizationEnum::VAPPARS; + ovp.m_type = OilVaporization::VAPPARS; ovp.m_vap1 = vap1; ovp.m_vap2 = vap2; } bool OilVaporizationProperties::defined() const { - return this->m_type != OilVaporizationEnum::UNDEF; + return this->m_type != OilVaporization::UNDEF; } bool OilVaporizationProperties::drsdtActive() const { - return (m_maxDRSDT[0] >= 0 && m_type == Opm::OilVaporizationEnum::DRDT); + return (m_maxDRSDT[0] >= 0 && m_type == OilVaporization::DRDT); } bool OilVaporizationProperties::drvdtActive() const { - return (m_maxDRVDT[0] >= 0 && m_type == Opm::OilVaporizationEnum::DRDT); + return (m_maxDRVDT[0] >= 0 && m_type == OilVaporization::DRDT); } bool OilVaporizationProperties::operator==( const OilVaporizationProperties& rhs ) const { - if( this->m_type == OilVaporizationEnum::UNDEF - || rhs.m_type == OilVaporizationEnum::UNDEF + if( this->m_type == OilVaporization::UNDEF + || rhs.m_type == OilVaporization::UNDEF || this->m_type != rhs.m_type ) return false; switch( this->m_type ) { - case OilVaporizationEnum::DRDT: + case OilVaporization::DRDT: return this->m_maxDRSDT == rhs.m_maxDRSDT && this->m_maxDRSDT_allCells == rhs.m_maxDRSDT_allCells && this->m_maxDRVDT == rhs.m_maxDRVDT; - case OilVaporizationEnum::VAPPARS: + case OilVaporization::VAPPARS: return this->m_vap1 == rhs.m_vap1 && this->m_vap2 == rhs.m_vap2; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp index 4d8c88aec..cec3f3870 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp @@ -52,16 +52,16 @@ bool RFTConfig::rft(const std::string& well_name, std::size_t report_step) const return false; auto rft_pair = this->rft_config.at(well_name)[report_step]; - if (rft_pair.first == RFTConnections::YES) + if (rft_pair.first == RFT::YES) return (rft_pair.second == report_step); - if (rft_pair.first == RFTConnections::NO) + if (rft_pair.first == RFT::NO) return false; - if (rft_pair.first == RFTConnections::REPT) + if (rft_pair.first == RFT::REPT) return true; - if (rft_pair.first == RFTConnections::TIMESTEP) + if (rft_pair.first == RFT::TIMESTEP) return true; return false; @@ -75,36 +75,36 @@ bool RFTConfig::plt(const std::string& well_name, std::size_t report_step) const return false; auto plt_pair = this->plt_config.at(well_name)[report_step]; - if (plt_pair.first == PLTConnections::YES) + if (plt_pair.first == PLT::YES) return (plt_pair.second == report_step); - if (plt_pair.first == PLTConnections::NO) + if (plt_pair.first == PLT::NO) return false; - if (plt_pair.first == PLTConnections::REPT) + if (plt_pair.first == PLT::REPT) return true; - if (plt_pair.first == PLTConnections::TIMESTEP) + if (plt_pair.first == PLT::TIMESTEP) return true; return false; } -void RFTConfig::updateRFT(const std::string& well_name, std::size_t report_step, RFTConnections::RFTEnum value) { - if (value == RFTConnections::FOPN) +void RFTConfig::updateRFT(const std::string& well_name, std::size_t report_step, RFT value) { + if (value == RFT::FOPN) this->setWellOpenRFT(well_name); else { if (this->rft_config.count(well_name) == 0) { - auto state = DynamicState>(this->tm, std::make_pair(RFTConnections::NO, 0)); + auto state = DynamicState>(this->tm, std::make_pair(RFT::NO, 0)); this->rft_config.emplace( well_name, state ); } this->rft_config.at(well_name).update(report_step, std::make_pair(value, report_step)); } } -void RFTConfig::updatePLT(const std::string& well_name, std::size_t report_step, PLTConnections::PLTEnum value) { +void RFTConfig::updatePLT(const std::string& well_name, std::size_t report_step, PLT value) { if (this->plt_config.count(well_name) == 0) { - auto state = DynamicState>(this->tm, std::make_pair(PLTConnections::NO, 0)); + auto state = DynamicState>(this->tm, std::make_pair(PLT::NO, 0)); this->plt_config.emplace( well_name, state ); } this->plt_config.at(well_name).update(report_step, std::make_pair(value, report_step)); @@ -154,7 +154,7 @@ std::size_t RFTConfig::firstRFTOutput() const { We do not really output PLT, so this predictae will unconditionally return false. */ - auto pred = [] (const std::pair& ) { return false; }; + auto pred = [] (const std::pair& ) { return false; }; int this_first_rft = dynamic_state.find_if(pred); if (this_first_rft >= 0) first_rft = std::min(first_rft, static_cast(this_first_rft)); @@ -163,12 +163,12 @@ std::size_t RFTConfig::firstRFTOutput() const { for (const auto& rft_pair : this->rft_config) { const auto& dynamic_state = rft_pair.second; - auto pred = [] (const std::pair& pred_arg) { - if (pred_arg.first == RFTConnections::RFTEnum::YES) + auto pred = [] (const std::pair& pred_arg) { + if (pred_arg.first == RFT::YES) return true; - if (pred_arg.first == RFTConnections::RFTEnum::REPT) + if (pred_arg.first == RFT::REPT) return true; - if (pred_arg.first == RFTConnections::RFTEnum::TIMESTEP) + if (pred_arg.first == RFT::TIMESTEP) return true; return false; }; @@ -194,4 +194,63 @@ bool RFTConfig::active(std::size_t report_step) const { return false; } +std::string RFTConfig::RFT2String(RFT enumValue) { + switch (enumValue) { + case RFT::YES: + return "YES"; + case RFT::REPT: + return "REPT"; + case RFT::TIMESTEP: + return "TIMESTEP"; + case RFT::FOPN: + return "FOPN"; + case RFT::NO: + return "NO"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + +RFTConfig::RFT RFTConfig::RFTFromString(const std::string& stringValue) { + if (stringValue == "YES") + return RFT::YES; + else if (stringValue == "REPT") + return RFT::REPT; + else if (stringValue == "TIMESTEP") + return RFT::TIMESTEP; + else if (stringValue == "FOPN") + return RFT::FOPN; + else if (stringValue == "NO") + return RFT::NO; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue); +} + +std::string RFTConfig::PLT2String(PLT enumValue) { + switch (enumValue) { + case PLT::YES: + return "YES"; + case PLT::REPT: + return "REPT"; + case PLT::TIMESTEP: + return "TIMESTEP"; + case PLT::NO: + return "NO"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + +RFTConfig::PLT RFTConfig::PLTFromString( const std::string& stringValue ){ + if (stringValue == "YES") + return PLT::YES; + else if (stringValue == "REPT") + return PLT::REPT; + else if (stringValue == "TIMESTEP") + return PLT::TIMESTEP; + else if (stringValue == "NO") + return PLT::NO; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 0ed623750..69151b585 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -48,7 +48,6 @@ #include #include -#include #include #include #include @@ -122,7 +121,7 @@ namespace { udq_config(this->m_timeMap, std::make_shared(deck)), udq_active(this->m_timeMap, std::make_shared()), guide_rate_model(this->m_timeMap, std::make_shared()), - global_whistctl_mode(this->m_timeMap, WellProducer::CMODE_UNDEFINED), + global_whistctl_mode(this->m_timeMap, Well2::ProducerCMode::CMODE_UNDEFINED), m_actions(this->m_timeMap, std::make_shared()), rft_config(this->m_timeMap), m_nupcol(this->m_timeMap, 3) @@ -471,10 +470,10 @@ namespace { void Schedule::handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) { const auto& record = keyword.getRecord(0); const std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0); - const WellProducer::ControlModeEnum controlMode = WellProducer::ControlModeFromString( cmodeString ); + const auto controlMode = Well2::ProducerCModeFromString( cmodeString ); - if (controlMode != WellProducer::NONE) { - if (!WellProductionProperties::effectiveHistoryProductionControl(controlMode) ) { + if (controlMode != Well2::ProducerCMode::NONE) { + if (!Well2::WellProductionProperties::effectiveHistoryProductionControl(controlMode) ) { std::string msg = "The WHISTCTL keyword specifies an un-supported control mode " + cmodeString + ", which makes WHISTCTL keyword not affect the simulation at all"; OpmLog::warning(msg); @@ -493,7 +492,7 @@ namespace { for (auto& well_pair : this->wells_static) { auto& dynamic_state = well_pair.second; auto well2 = std::make_shared(*dynamic_state[currentStep]); - auto prop = std::make_shared(well2->getProductionProperties()); + auto prop = std::make_shared(well2->getProductionProperties()); if (prop->whistctl_cmode != controlMode) { prop->whistctl_cmode = controlMode; @@ -505,7 +504,7 @@ namespace { for (auto& well_pair : this->wells_static) { auto& dynamic_state = well_pair.second; auto well2 = std::make_shared(*dynamic_state[currentStep]); - auto prop = std::make_shared(well2->getProductionProperties()); + auto prop = std::make_shared(well2->getProductionProperties()); if (prop->whistctl_cmode != controlMode) { prop->whistctl_cmode = controlMode; @@ -517,7 +516,7 @@ namespace { for (auto& well_pair : this->wells_static) { auto& dynamic_state = well_pair.second; auto well2 = std::make_shared(*dynamic_state[currentStep]); - auto prop = std::make_shared(well2->getProductionProperties()); + auto prop = std::make_shared(well2->getProductionProperties()); if (prop->whistctl_cmode != controlMode) { prop->whistctl_cmode = controlMode; @@ -532,7 +531,7 @@ namespace { this->m_nupcol.update(currentStep, nupcol); } - + /* The COMPORD keyword is handled together with the WELSPECS keyword in the @@ -606,7 +605,7 @@ namespace { addGroup(groupName , currentStep, unit_system); if (!hasWell(wellName)) { - WellCompletion::CompletionOrderEnum wellConnectionOrder = WellCompletion::TRACK; + auto wellConnectionOrder = Connection::Order::TRACK; if( const auto* compordp = COMPORD_in_timestep() ) { const auto& compord = *compordp; @@ -617,7 +616,7 @@ namespace { const std::string& wellNamePattern = compordRecord.getItem(0).getTrimmedString(0); if (Well2::wellNameInWellNamePattern(wellName, wellNamePattern)) { const std::string& compordString = compordRecord.getItem(1).getTrimmedString(0); - wellConnectionOrder = WellCompletion::CompletionOrderEnumFromString(compordString); + wellConnectionOrder = Connection::OrderFromString(compordString); } } } @@ -720,8 +719,7 @@ namespace { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - const WellCommon::StatusEnum status = - WellCommon::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); + const Well2::Status status = Well2::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); auto well_names = this->wellNames(wellNamePattern, currentStep); if (well_names.empty()) @@ -733,7 +731,7 @@ namespace { auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[currentStep]); bool switching_from_injector = !well2->isProducer(); - auto properties = std::make_shared(well2->getProductionProperties()); + auto properties = std::make_shared(well2->getProductionProperties()); bool update_well = false; properties->handleWCONHIST(record); @@ -741,7 +739,7 @@ namespace { properties->resetDefaultBHPLimit(); well2->updateProducer(true); - auto inj_props = std::make_shared(well2->getInjectionProperties()); + auto inj_props = std::make_shared(well2->getInjectionProperties()); inj_props->setBHPLimit(0); well2->updateInjection(inj_props); } @@ -771,7 +769,7 @@ namespace { "Well " + well2->name() + " is a history matched well with zero rate where crossflow is banned. " + "This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days"; OpmLog::note(msg); - updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT ); + updateWellStatus( well_name, currentStep, Well2::Status::SHUT ); } } } @@ -785,9 +783,7 @@ namespace { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - const WellCommon::StatusEnum status = - WellCommon::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); - + const Well2::Status status = Well2::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); auto well_names = this->wellNames(wellNamePattern, currentStep); if (well_names.empty()) invalidNamePattern(wellNamePattern, parseContext, errors, keyword); @@ -799,11 +795,11 @@ namespace { auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[currentStep]); bool switching_from_injector = !well2->isProducer(); - auto properties = std::make_shared(well2->getProductionProperties()); + auto properties = std::make_shared(well2->getProductionProperties()); bool update_well = switching_from_injector; properties->clearControls(); if (well2->isAvailableForGroupControl()) - properties->addProductionControl(WellProducer::GRUP); + properties->addProductionControl(Well2::ProducerCMode::GRUP); properties->handleWCONPROD(well_name, record); @@ -844,7 +840,7 @@ namespace { Function is quite dangerous - because if this is called while holding a Well2 pointer that will go stale and needs to be refreshed. */ - bool Schedule::updateWellStatus( const std::string& well_name, size_t reportStep , WellCommon::StatusEnum status) { + bool Schedule::updateWellStatus( const std::string& well_name, size_t reportStep , Well2::Status status) { bool update = false; { auto& dynamic_state = this->wells_static.at(well_name); @@ -887,13 +883,13 @@ namespace { invalidNamePattern(wellNamePattern, parseContext, errors, keyword); for( const auto& well_name : well_names ) { - WellCommon::StatusEnum status = WellCommon::StatusFromString( record.getItem("STATUS").getTrimmedString(0)); + Well2::Status status = Well2::StatusFromString( record.getItem("STATUS").getTrimmedString(0)); updateWellStatus( well_name , currentStep , status ); { bool update_well = false; auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[currentStep]); - auto injection = std::make_shared(well2->getInjectionProperties()); + auto injection = std::make_shared(well2->getInjectionProperties()); injection->handleWCONINJE(record, well2->isAvailableForGroupControl(), well_name); if (well2->updateProducer(false)) @@ -919,16 +915,16 @@ namespace { "This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days"; if (injection->surfaceInjectionRate.is()) { - if (injection->hasInjectionControl(WellInjector::RATE) && injection->surfaceInjectionRate.get() == 0) { + if (injection->hasInjectionControl(Well2::InjectorCMode::RATE) && injection->surfaceInjectionRate.get() == 0) { OpmLog::note(msg); - updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT ); + updateWellStatus( well_name, currentStep, Well2::Status::SHUT ); } } if (injection->reservoirInjectionRate.is()) { - if (injection->hasInjectionControl(WellInjector::RESV) && injection->reservoirInjectionRate.get() == 0) { + if (injection->hasInjectionControl(Well2::InjectorCMode::RESV) && injection->reservoirInjectionRate.get() == 0) { OpmLog::note(msg); - updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT ); + updateWellStatus( well_name, currentStep, Well2::Status::SHUT ); } } } @@ -944,7 +940,7 @@ namespace { void Schedule::handleWCONINJH(const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) { for( const auto& record : keyword ) { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - WellCommon::StatusEnum status = WellCommon::StatusFromString( record.getItem("STATUS").getTrimmedString(0)); + Well2::Status status = Well2::StatusFromString( record.getItem("STATUS").getTrimmedString(0)); const auto well_names = wellNames( wellNamePattern, currentStep ); if (well_names.empty()) @@ -956,7 +952,7 @@ namespace { bool update_well = false; auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[currentStep]); - auto injection = std::make_shared(well2->getInjectionProperties()); + auto injection = std::make_shared(well2->getInjectionProperties()); injection->handleWCONINJH(record, well2->isProducer(), well_name); if (well2->updateProducer(false)) @@ -979,7 +975,7 @@ namespace { "Well " + well_name + " is an injector with zero rate where crossflow is banned. " + "This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days"; OpmLog::note(msg); - updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT ); + updateWellStatus( well_name, currentStep, Well2::Status::SHUT ); } } } @@ -1208,7 +1204,7 @@ namespace { { const auto& well = this->getWell2(well_name, currentStep); const auto& inj = well.getInjectionProperties(); - if (!well.isProducer() && inj.injectorType == WellInjector::GAS) { + if (!well.isProducer() && inj.injectorType == Well2::InjectorType::GAS) { if (well.getSolventFraction() != fraction) { auto new_well = std::make_shared(well); new_well->updateSolventFraction(fraction); @@ -1265,7 +1261,7 @@ namespace { if (current_temp != temp && !well.isProducer()) { auto& dynamic_state = this->wells_static.at(well_name); auto well_ptr = std::make_shared( *dynamic_state[currentStep] ); - auto inj = std::make_shared(well_ptr->getInjectionProperties()); + auto inj = std::make_shared(well_ptr->getInjectionProperties()); inj->temperature = temp; well_ptr->updateInjection(inj); this->updateWell(well_ptr, currentStep); @@ -1299,7 +1295,7 @@ namespace { if (current_temp != temp && !well.isProducer()) { auto& dynamic_state = this->wells_static.at(well_name); auto well_ptr = std::make_shared( *dynamic_state[currentStep] ); - auto inj = std::make_shared(well_ptr->getInjectionProperties()); + auto inj = std::make_shared(well_ptr->getInjectionProperties()); inj->temperature = temp; well_ptr->updateInjection(inj); this->updateWell(well_ptr, currentStep); @@ -1336,13 +1332,12 @@ namespace { return std::all_of( rec.begin() + 2, rec.end(), defaulted ); }; - constexpr auto open = WellCommon::StatusEnum::OPEN; + constexpr auto open = Well2::Status::OPEN; for( const auto& record : keyword ) { const auto& wellNamePattern = record.getItem( "WELL" ).getTrimmedString(0); const auto& status_str = record.getItem( "STATUS" ).getTrimmedString( 0 ); const auto well_names = this->wellNames(wellNamePattern, currentStep, matching_wells); - if (well_names.empty()) invalidNamePattern( wellNamePattern, parseContext, errors, keyword); @@ -1350,7 +1345,7 @@ namespace { * well status is updated */ if( conn_defaulted( record ) ) { - const auto well_status = WellCommon::StatusFromString( status_str ); + const auto well_status = Well2::StatusFromString( status_str ); for (const auto& wname : well_names) { { const auto& well = this->getWell2(wname, currentStep); @@ -1373,7 +1368,7 @@ namespace { } for (const auto& wname : well_names) { - const auto comp_status = WellCompletion::StateEnumFromString( status_str ); + const auto comp_status = Connection::StateFromString( status_str ); { auto& dynamic_state = this->wells_static.at(wname); auto well_ptr = std::make_shared( *dynamic_state[currentStep] ); @@ -1410,7 +1405,7 @@ namespace { for( const auto& record : keyword ) { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - const auto cmode = WellTarget::ControlModeFromString(record.getItem("CMODE").getTrimmedString(0)); + const auto cmode = Well2::WELTARGCModeFromString(record.getItem("CMODE").getTrimmedString(0)); double newValue = record.getItem("NEW_VALUE").get< double >(0); const auto well_names = wellNames( wellNamePattern, currentStep ); @@ -1424,16 +1419,16 @@ namespace { auto well2 = std::make_shared(*dynamic_state[currentStep]); bool update = false; if (well2->isProducer()) { - auto prop = std::make_shared(well2->getProductionProperties()); + auto prop = std::make_shared(well2->getProductionProperties()); prop->handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP); update = well2->updateProduction(prop); - if (cmode == WellTarget::GUID) + if (cmode == Well2::WELTARGCMode::GUID) update |= well2->updateWellGuideRate(newValue); } else { - auto inj = std::make_shared(well2->getInjectionProperties()); + auto inj = std::make_shared(well2->getInjectionProperties()); inj->handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP); update = well2->updateInjection(inj); - if (cmode == WellTarget::GUID) + if (cmode == Well2::WELTARGCMode::GUID) update |= well2->updateWellGuideRate(newValue); } if (update) @@ -1452,7 +1447,7 @@ namespace { invalidNamePattern(groupNamePattern, parseContext, errors, keyword); for (const auto& group_name : group_names){ - GroupInjection::ControlEnum controlMode = GroupInjection::ControlEnumFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) ); + Group2::InjectionCMode controlMode = Group2::InjectionCModeFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) ); Phase phase = get_phase( record.getItem("PHASE").getTrimmedString(0)); auto surfaceInjectionRate = record.getItem("SURFACE_TARGET").get< UDAValue >(0); auto reservoirInjectionRate = record.getItem("RESV_TARGET").get(0); @@ -1472,16 +1467,16 @@ namespace { injection.injection_controls = 0; if (!record.getItem("SURFACE_TARGET").defaultApplied(0)) - injection.injection_controls += GroupInjection::RATE; + injection.injection_controls += static_cast(Group2::InjectionCMode::RATE); if (!record.getItem("RESV_TARGET").defaultApplied(0)) - injection.injection_controls += GroupInjection::RESV; + injection.injection_controls += static_cast(Group2::InjectionCMode::RESV); if (!record.getItem("REINJ_TARGET").defaultApplied(0)) - injection.injection_controls += GroupInjection::REIN; + injection.injection_controls += static_cast(Group2::InjectionCMode::REIN); if (!record.getItem("VOIDAGE_TARGET").defaultApplied(0)) - injection.injection_controls += GroupInjection::VREP; + injection.injection_controls += static_cast(Group2::InjectionCMode::VREP); if (group_ptr->updateInjection(injection)) this->updateGroup(std::move(group_ptr), currentStep); @@ -1490,6 +1485,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); @@ -1499,27 +1495,27 @@ namespace { invalidNamePattern(groupNamePattern, parseContext, errors, keyword); for (const auto& group_name : group_names){ - GroupProduction::ControlEnum controlMode = GroupProduction::ControlEnumFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) ); - GroupProductionExceedLimit::ActionEnum exceedAction = GroupProductionExceedLimit::ActionEnumFromString(record.getItem("EXCEED_PROC").getTrimmedString(0) ); + Group2::ProductionCMode controlMode = Group2::ProductionCModeFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) ); + Group2::ExceedAction exceedAction = Group2::ExceedActionFromString(record.getItem("EXCEED_PROC").getTrimmedString(0) ); auto oil_target = record.getItem("OIL_TARGET").get(0); 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)) { + 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"; - parseContext.handleError(ParseContext::SCHEDULE_IGNORED_GUIDE_RATE, msg, errors); - } + parseContext.handleError(ParseContext::SCHEDULE_IGNORED_GUIDE_RATE, msg, errors); + } 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; } } } @@ -1535,30 +1531,30 @@ namespace { production.guide_rate = guide_rate; production.guide_rate_def = guide_rate_def; production.resv_target = resv_target; - if ((production.cmode == GroupProduction::ORAT) || - (production.cmode == GroupProduction::WRAT) || - (production.cmode == GroupProduction::GRAT) || - (production.cmode == GroupProduction::LRAT)) - production.exceed_action = GroupProductionExceedLimit::RATE; + if ((production.cmode == Group2::ProductionCMode::ORAT) || + (production.cmode == Group2::ProductionCMode::WRAT) || + (production.cmode == Group2::ProductionCMode::GRAT) || + (production.cmode == Group2::ProductionCMode::LRAT)) + production.exceed_action = Group2::ExceedAction::RATE; else production.exceed_action = exceedAction; production.production_controls = 0; if (!record.getItem("OIL_TARGET").defaultApplied(0)) - production.production_controls += GroupProduction::ORAT; + production.production_controls += static_cast(Group2::ProductionCMode::ORAT); if (!record.getItem("GAS_TARGET").defaultApplied(0)) - production.production_controls += GroupProduction::GRAT; + production.production_controls += static_cast(Group2::ProductionCMode::GRAT); if (!record.getItem("WATER_TARGET").defaultApplied(0)) - production.production_controls += GroupProduction::WRAT; + production.production_controls += static_cast(Group2::ProductionCMode::WRAT); if (!record.getItem("LIQUID_TARGET").defaultApplied(0)) - production.production_controls += GroupProduction::LRAT; + production.production_controls += static_cast(Group2::ProductionCMode::LRAT); if (!record.getItem("RESERVOIR_FLUID_TARGET").defaultApplied(0)) - production.production_controls += GroupProduction::RESV; + production.production_controls += static_cast(Group2::ProductionCMode::RESV); if (group_ptr->updateProduction(production)) this->updateGroup(std::move(group_ptr), currentStep); @@ -1592,7 +1588,7 @@ namespace { const auto& record = keyword.getRecord(0); double min_calc_delay = record.getItem().getSIDouble(0); - auto phase = GuideRateTargetFromString(record.getItem().getTrimmedString(0)); + auto phase = GuideRateModel::TargetFromString(record.getItem().getTrimmedString(0)); double A = record.getItem().get(0); double B = record.getItem().get(0); double C = record.getItem().get(0); @@ -1806,7 +1802,7 @@ namespace { if (well2->updateConnections(connections)) this->updateWell(well2, currentStep); - if (well2->getStatus() == WellCommon::StatusEnum::SHUT) { + if (well2->getStatus() == Well2::Status::SHUT) { std::string msg = "All completions in well " + well2->name() + " is shut at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days. \n" + "The well is therefore also shut."; @@ -1855,10 +1851,10 @@ namespace { bool availableForGroupControl = DeckItem::to_bool(record.getItem("GROUP_CONTROLLED").getTrimmedString(0)); double guide_rate = record.getItem("GUIDE_RATE").get< double >(0); double scaling_factor = record.getItem("SCALING_FACTOR").get< double >(0); - GuideRate::GuideRatePhaseEnum phase = GuideRate::UNDEFINED; + auto phase = Well2::GuideRateTarget::UNDEFINED; if (!record.getItem("PHASE").defaultApplied(0)) { std::string guideRatePhase = record.getItem("PHASE").getTrimmedString(0); - phase = GuideRate::GuideRatePhaseEnumFromString(guideRatePhase); + phase = Well2::GuideRateTargetFromString(guideRatePhase); } { @@ -1914,7 +1910,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); const auto well_names = wellNames(wellNamePattern, currentStep); for(const auto& well_name : well_names) - this->rft_config.updateRFT(well_name, currentStep, RFTConnections::RFTEnum::YES); + this->rft_config.updateRFT(well_name, currentStep, RFTConfig::RFT::YES); } @@ -1926,8 +1922,8 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - RFTConnections::RFTEnum RFTKey = RFTConnections::RFTEnumFromString(record.getItem("OUTPUT_RFT").getTrimmedString(0)); - PLTConnections::PLTEnum PLTKey = PLTConnections::PLTEnumFromString(record.getItem("OUTPUT_PLT").getTrimmedString(0)); + RFTConfig::RFT RFTKey = RFTConfig::RFTFromString(record.getItem("OUTPUT_RFT").getTrimmedString(0)); + RFTConfig::PLT PLTKey = RFTConfig::PLTFromString(record.getItem("OUTPUT_PLT").getTrimmedString(0)); const auto well_names = wellNames(wellNamePattern, currentStep); for(const auto& well_name : well_names) { this->rft_config.updateRFT(well_name, currentStep, RFTKey); @@ -1980,7 +1976,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c void Schedule::addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, - WellCompletion::CompletionOrderEnum wellConnectionOrder, + Connection::Order wellConnectionOrder, const UnitSystem& unit_system) { // We change from eclipse's 1 - n, to a 0 - n-1 solution @@ -2085,7 +2081,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c } - std::vector< Well2 > Schedule::getChildWells2(const std::string& group_name, size_t timeStep, GroupWellQueryMode query_mode) const { + std::vector< Well2 > Schedule::getChildWells2(const std::string& group_name, size_t timeStep) const { if (!hasGroup(group_name)) throw std::invalid_argument("No such group: '" + group_name + "'"); { @@ -2094,9 +2090,9 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c if (group_ptr) { std::vector wells; - if (group_ptr->groups().size() && query_mode == GroupWellQueryMode::Recursive) { + if (group_ptr->groups().size()) { for (const auto& child_name : group_ptr->groups()) { - const auto& child_wells = getChildWells2( child_name, timeStep, query_mode ); + const auto& child_wells = getChildWells2( child_name, timeStep); wells.insert( wells.end() , child_wells.begin() , child_wells.end()); } } else { @@ -2444,7 +2440,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c const auto& well = this->getWell2(wname, timeStep); const auto& connections = well.getConnections(); if (connections.allConnectionsShut()) - this->updateWellStatus( well.name(), timeStep, WellCommon::StatusEnum::SHUT); + this->updateWellStatus( well.name(), timeStep, Well2::Status::SHUT); } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp deleted file mode 100644 index f00407677..000000000 --- a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp +++ /dev/null @@ -1,784 +0,0 @@ -/* - Copyright 2013 Statoil ASA. - - This file is part of the Open Porous Media project (OPM). - - OPM is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OPM is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OPM. If not, see . - */ - -#include -#include - -#include - -namespace Opm { - - namespace WellCompletion { - - std::string - DirectionEnum2String(const DirectionEnum enumValue) - { - std::string stringValue; - - switch (enumValue) { - case DirectionEnum::X: - stringValue = "X"; - break; - - case DirectionEnum::Y: - stringValue = "Y"; - break; - - case DirectionEnum::Z: - stringValue = "Z"; - break; - } - - return stringValue; - } - - DirectionEnum - DirectionEnumFromString(const std::string& s ) - { - DirectionEnum direction; - - if (s == "X") { direction = DirectionEnum::X; } - else if (s == "Y") { direction = DirectionEnum::Y; } - else if (s == "Z") { direction = DirectionEnum::Z; } - else { - std::string msg = "Unsupported completion direction " + s; - throw std::invalid_argument(msg); - } - - return direction; - } - - - const std::string StateEnum2String( StateEnum enumValue ) { - switch( enumValue ) { - case OPEN: - return "OPEN"; - case AUTO: - return "AUTO"; - case SHUT: - return "SHUT"; - default: - throw std::invalid_argument("Unhandled enum value"); - } - } - - - StateEnum StateEnumFromString( const std::string& stringValue ) { - if (stringValue == "OPEN") - return OPEN; - else if (stringValue == "SHUT") - return SHUT; - else if (stringValue == "STOP") - return SHUT; - else if (stringValue == "AUTO") - return AUTO; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - - const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue ) { - switch( enumValue ) { - case DEPTH: - return "DEPTH"; - case INPUT: - return "INPUT"; - case TRACK: - return "TRACK"; - default: - throw std::invalid_argument("Unhandled enum value"); - } - - } - - CompletionOrderEnum CompletionOrderEnumFromString(const std::string& stringValue ) { - if (stringValue == "DEPTH") - return DEPTH; - else if (stringValue == "INPUT") - return INPUT; - else if (stringValue == "TRACK") - return TRACK; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - } - - - /*****************************************************************/ - - namespace GroupInjection { - - const std::string ControlEnum2String( ControlEnum enumValue ) { - switch( enumValue ) { - case NONE: - return "NONE"; - case RATE: - return "RATE"; - case RESV: - return "RESV"; - case REIN: - return "REIN"; - case VREP: - return "VREP"; - case FLD: - return "FLD"; - default: - throw std::invalid_argument("Unhandled enum value"); - } - } - - - ControlEnum ControlEnumFromString( const std::string& stringValue ) { - if (stringValue == "NONE") - return NONE; - else if (stringValue == "RATE") - return RATE; - else if (stringValue == "RESV") - return RESV; - else if (stringValue == "REIN") - return REIN; - else if (stringValue == "VREP") - return VREP; - else if (stringValue == "FLD") - return FLD; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - } - - /*****************************************************************/ - - namespace GroupProduction { - - const std::string ControlEnum2String( ControlEnum enumValue ) { - switch( enumValue ) { - case NONE: - return "NONE"; - case ORAT: - return "ORAT"; - case WRAT: - return "WRAT"; - case GRAT: - return "GRAT"; - case LRAT: - return "LRAT"; - case CRAT: - return "CRAT"; - case RESV: - return "RESV"; - case PRBL: - return "PRBL"; - case FLD: - return "FLD"; - default: - throw std::invalid_argument("Unhandled enum value"); - } - } - - - ControlEnum ControlEnumFromString( const std::string& stringValue ) { - if (stringValue == "NONE") - return NONE; - else if (stringValue == "ORAT") - return ORAT; - else if (stringValue == "WRAT") - return WRAT; - else if (stringValue == "GRAT") - return GRAT; - else if (stringValue == "LRAT") - return LRAT; - else if (stringValue == "CRAT") - return CRAT; - else if (stringValue == "RESV") - return RESV; - else if (stringValue == "PRBL") - return PRBL; - else if (stringValue == "FLD") - return FLD; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - 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; - - } - - } - - /*****************************************************************/ - namespace GroupProductionExceedLimit { - - const std::string ActionEnum2String( ActionEnum enumValue ) { - switch(enumValue) { - case NONE: - return "NONE"; - case CON: - return "CON"; - case CON_PLUS: - return "+CON"; - case WELL: - return "WELL"; - case PLUG: - return "PLUG"; - case RATE: - return "RATE"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - - ActionEnum ActionEnumFromString( const std::string& stringValue ) { - - if (stringValue == "NONE") - return NONE; - else if (stringValue == "CON") - return CON; - else if (stringValue == "+CON") - return CON_PLUS; - else if (stringValue == "WELL") - return WELL; - else if (stringValue == "PLUG") - return PLUG; - else if (stringValue == "RATE") - return RATE; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - } - - /*****************************************************************/ - - namespace WellProducer { - - const std::string ControlMode2String( ControlModeEnum enumValue ) { - switch( enumValue ) { - case ORAT: - return "ORAT"; - case WRAT: - return "WRAT"; - case GRAT: - return "GRAT"; - case LRAT: - return "LRAT"; - case CRAT: - return "CRAT"; - case RESV: - return "RESV"; - case BHP: - return "BHP"; - case THP: - return "THP"; - case GRUP: - return "GRUP"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - ControlModeEnum ControlModeFromString( const std::string& stringValue ) { - if (stringValue == "ORAT") - return ORAT; - else if (stringValue == "WRAT") - return WRAT; - else if (stringValue == "GRAT") - return GRAT; - else if (stringValue == "LRAT") - return LRAT; - else if (stringValue == "CRAT") - return CRAT; - else if (stringValue == "RESV") - return RESV; - else if (stringValue == "BHP") - return BHP; - else if (stringValue == "THP") - return THP; - else if (stringValue == "GRUP") - return GRUP; - else if (stringValue == "NONE") - return NONE; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - } - - - namespace WellInjector { - - const std::string Type2String( TypeEnum enumValue ) { - switch( enumValue ) { - case OIL: - return "OIL"; - case GAS: - return "GAS"; - case WATER: - return "WATER"; - case MULTI: - return "MULTI"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - TypeEnum TypeFromString( const std::string& stringValue ) { - if (stringValue == "OIL") - return OIL; - else if (stringValue == "WATER") - return WATER; - else if (stringValue == "WAT") - return WATER; - else if (stringValue == "GAS") - return GAS; - else if (stringValue == "MULTI") - return MULTI; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - /*****************************************************************/ - - const std::string ControlMode2String( ControlModeEnum enumValue ) { - switch( enumValue ) { - case RESV: - return "RESV"; - case RATE: - return "RATE"; - case BHP: - return "BHP"; - case THP: - return "THP"; - case GRUP: - return "GRUP"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - ControlModeEnum ControlModeFromString( const std::string& stringValue ) { - if (stringValue == "RATE") - return RATE; - else if (stringValue == "RESV") - return RESV; - else if (stringValue == "BHP") - return BHP; - else if (stringValue == "THP") - return THP; - else if (stringValue == "GRUP") - return GRUP; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - } - - - namespace WellCommon { - - const std::string Status2String(StatusEnum enumValue) { - switch( enumValue ) { - case OPEN: - return "OPEN"; - case SHUT: - return "SHUT"; - case AUTO: - return "AUTO"; - case STOP: - return "STOP"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - - StatusEnum StatusFromString(const std::string& stringValue) { - if (stringValue == "OPEN") - return OPEN; - else if (stringValue == "SHUT") - return SHUT; - else if (stringValue == "STOP") - return STOP; - else if (stringValue == "AUTO") - return AUTO; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - - } - - namespace GuideRate { - - const std::string GuideRatePhaseEnum2String( GuideRatePhaseEnum enumValue ) { - switch( enumValue ) { - case OIL: - return "OIL"; - case WAT: - return "WAT"; - case GAS: - return "GAS"; - case LIQ: - return "LIQ"; - case COMB: - return "COMB"; - case WGA: - return "WGA"; - case CVAL: - return "CVAL"; - case RAT: - return "RAT"; - case RES: - return "RES"; - case UNDEFINED: - return "UNDEFINED"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - GuideRatePhaseEnum GuideRatePhaseEnumFromString( const std::string& stringValue ) { - - if (stringValue == "OIL") - return OIL; - else if (stringValue == "WAT") - return WAT; - else if (stringValue == "GAS") - return GAS; - else if (stringValue == "LIQ") - return LIQ; - else if (stringValue == "COMB") - return COMB; - else if (stringValue == "WGA") - return WGA; - else if (stringValue == "CVAL") - return CVAL; - else if (stringValue == "RAT") - return RAT; - else if (stringValue == "RES") - return RES; - else if (stringValue == "UNDEFINED") - return UNDEFINED; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - } - - namespace RFTConnections { - const std::string RFTEnum2String(RFTEnum enumValue) { - switch (enumValue) { - case YES: - return "YES"; - case REPT: - return "REPT"; - case TIMESTEP: - return "TIMESTEP"; - case FOPN: - return "FOPN"; - case NO: - return "NO"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - RFTEnum RFTEnumFromString(const std::string& stringValue) { - - if (stringValue == "YES") - return YES; - else if (stringValue == "REPT") - return REPT; - else if (stringValue == "TIMESTEP") - return TIMESTEP; - else if (stringValue == "FOPN") - return FOPN; - else if (stringValue == "NO") - return NO; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue); - } - - } - namespace PLTConnections { - const std::string PLTEnum2String(PLTEnum enumValue) { - switch (enumValue) { - case YES: - return "YES"; - case REPT: - return "REPT"; - case TIMESTEP: - return "TIMESTEP"; - case NO: - return "NO"; - default: - throw std::invalid_argument("unhandled enum value"); - } - } - - PLTEnum PLTEnumFromString( const std::string& stringValue ){ - if (stringValue == "YES") - return YES; - else if (stringValue == "REPT") - return REPT; - else if (stringValue == "TIMESTEP") - return TIMESTEP; - else if (stringValue == "NO") - return NO; - else - throw std::invalid_argument("Unknown enum state string: " + stringValue ); - } - } - - namespace WellSegment{ - - const std::string LengthDepthEnumToString(LengthDepthEnum enumValue) { - switch (enumValue) { - case INC: - return "INC"; - case ABS: - return "ABS"; - default: - throw std::invalid_argument("unhandled LengthDepthEnum value"); - } - } - - LengthDepthEnum LengthDepthEnumFromString(const std::string& string ) { - if (string == "INC") { - return INC; - } else if (string == "ABS") { - return ABS; - } else { - throw std::invalid_argument("Unknown enum string: " + string + " for LengthDepthEnum"); - } - } - - const std::string CompPressureDropEnumToString(CompPressureDropEnum enumValue) { - switch (enumValue) { - case HFA: - return "HFA"; - case HF_: - return "HF-"; - case H__: - return "H--"; - default: - throw std::invalid_argument("unhandled CompPressureDropEnum value"); - } - } - - CompPressureDropEnum CompPressureDropEnumFromString( const std::string& string ) { - - if (string == "HFA") { - return HFA; - } else if (string == "HF-") { - return HF_; - } else if (string == "H--") { - return H__; - } else { - throw std::invalid_argument("Unknown enum string: " + string + " for CompPressureDropEnum"); - } - } - - const std::string MultiPhaseModelEnumToString(MultiPhaseModelEnum enumValue) { - switch (enumValue) { - case HO: - return "HO"; - case DF: - return "DF"; - default: - throw std::invalid_argument("unhandled MultiPhaseModelEnum value"); - } - } - - MultiPhaseModelEnum MultiPhaseModelEnumFromString(const std::string& string ) { - - if ((string == "HO") || (string == "H0")) { - return HO; - } else if (string == "DF") { - return DF; - } else { - throw std::invalid_argument("Unknown enum string: " + string + " for MultiPhaseModelEnum"); - } - - } - - } - - - namespace WellTarget { - - ControlModeEnum ControlModeFromString(const std::string& string_value) { - if (string_value == "ORAT") - return ORAT; - - if (string_value == "WRAT") - return WRAT; - - if (string_value == "GRAT") - return GRAT; - - if (string_value == "LRAT") - return LRAT; - - if (string_value == "CRAT") - return CRAT; - - if (string_value == "RESV") - return RESV; - - if (string_value == "BHP") - return BHP; - - if (string_value == "THP") - return THP; - - if (string_value == "VFP") - return VFP; - - if (string_value == "LIFT") - return LIFT; - - if (string_value == "GUID") - return GUID; - - throw std::invalid_argument("WELTARG control mode: " + string_value + " not recognized."); - } - } - - - - - namespace WellEcon { - const std::string WorkoverEnumToString(WorkoverEnum enumValue) { - switch(enumValue) { - case NONE: - return "NONE"; - case CON: - return "CON"; - case CONP: - return "+CON"; - case WELL: - return "WELL"; - case PLUG: - return "PLUG"; - case LAST: - return "LAST"; - case RED: - return "RED"; - default: - throw std::invalid_argument("unhandled WorkoverEnum value"); - } - } - - WorkoverEnum WorkoverEnumFromString( const std::string& string ) { - - if (string == "NONE") { - return NONE; - } else if (string == "CON") { - return CON; - } else if (string == "+CON") { - return CONP; - } else if (string == "WELL") { - return WELL; - } else if (string == "PLUG") { - return PLUG; - } else if (string == "LAST") { - return LAST; - } else if (string == "RED") { - return RED; - } else { - throw std::invalid_argument("Unknown enum string: " + string + " for WorkoverEnum"); - } - } - - const std::string QuantityLimitEnumToString(QuantityLimitEnum enumValue) { - switch(enumValue) { - case RATE: - return "RATE"; - case POTN: - return "POTN"; - default: - throw std::invalid_argument("unhandled QuantityLimitvalue"); - } - } - - QuantityLimitEnum QuantityLimitEnumFromString(const std::string& string ) { - if (string == "RATE") { - return RATE; - } else if (string == "POTN") { - return POTN; - } else { - throw std::invalid_argument("Unknown enum string: " + string + " for QuantityLimitEnum"); - } - } - - - } - - GroupType operator|(GroupType lhs, GroupType rhs) { - return static_cast(static_cast::type>(lhs) | static_cast::type>(rhs)); - } - - GroupType operator&(GroupType lhs, GroupType rhs) { - return static_cast(static_cast::type>(lhs) & static_cast::type>(rhs)); - } - - GuideRateTarget GuideRateTargetFromString(const std::string& s) { - if (s == "OIL") - return GuideRateTarget::OIL; - - if (s == "LIQ") - return GuideRateTarget::LIQ; - - if (s == "GAS") - return GuideRateTarget::GAS; - - if (s == "RES") - return GuideRateTarget::RES; - - if (s == "COMB") - return GuideRateTarget::COMB; - - if (s == "NONE") - return GuideRateTarget::NONE; - - throw std::invalid_argument("Could not convert: " + s + " to a valid GuideRateTarget enum value"); - } -} diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp index 6661fc791..5f402f963 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -40,19 +39,18 @@ namespace Opm { Connection::Connection(int i, int j , int k , int compnum, double depth, - WellCompletion::StateEnum stateArg , + State stateArg , double CF, double Kh, double rw, double r0, double skin_factor, const int satTableId, - const WellCompletion::DirectionEnum directionArg, + const Direction directionArg, const std::size_t seqIndex, const double segDistStart, const double segDistEnd, - const bool defaultSatTabId - ) + const bool defaultSatTabId) : direction(directionArg), center_depth(depth), open_state(stateArg), @@ -70,14 +68,6 @@ namespace Opm { m_defaultSatTabId(defaultSatTabId) {} - /*bool Connection::sameCoordinate(const Connection& other) const { - if ((m_i == other.m_i) && - (m_j == other.m_j) && - (m_k == other.m_k)) - return true; - else - return false; - }*/ bool Connection::sameCoordinate(const int i, const int j, const int k) const { if ((ijk[0] == i) && (ijk[1] == j) && (ijk[2] == k)) { @@ -87,8 +77,6 @@ namespace Opm { } } - - int Connection::getI() const { return ijk[0]; } @@ -117,7 +105,7 @@ namespace Opm { return m_compSeg_seqIndex; } - WellCompletion::DirectionEnum Connection::dir() const { + Connection::Direction Connection::dir() const { return this->direction; } @@ -150,7 +138,7 @@ namespace Opm { return this->center_depth; } - WellCompletion::StateEnum Connection::state() const { + Connection::State Connection::state() const { return this->open_state; } @@ -186,7 +174,7 @@ namespace Opm { return this->m_skin_factor; } - void Connection::setState(WellCompletion::StateEnum state) { + void Connection::setState(State state) { this->open_state = state; } @@ -221,8 +209,8 @@ namespace Opm { ss << "wPi " << this->wPi << std::endl; ss << "kh " << this->m_Kh << std::endl; ss << "sat_tableId " << this->sat_tableId << std::endl; - ss << "open_state " << this->open_state << std::endl; - ss << "direction " << this->direction << std::endl; + ss << "open_state " << Connection::State2String(this->open_state) << std::endl; + ss << "direction " << Connection::Direction2String(this->direction) << std::endl; ss << "segment_nr " << this->segment_number << std::endl; ss << "center_depth " << this->center_depth << std::endl; ss << "seqIndex " << this->m_seqIndex << std::endl; @@ -254,4 +242,101 @@ namespace Opm { bool Connection::operator!=( const Connection& rhs ) const { return !( *this == rhs ); } + + + +const std::string Connection::State2String( State enumValue ) { + switch( enumValue ) { + case State::OPEN: + return "OPEN"; + case State::AUTO: + return "AUTO"; + case State::SHUT: + return "SHUT"; + default: + throw std::invalid_argument("Unhandled enum value"); + } } + + +Connection::State Connection::StateFromString( const std::string& stringValue ) { + if (stringValue == "OPEN") + return State::OPEN; + else if (stringValue == "SHUT") + return State::SHUT; + else if (stringValue == "STOP") + return State::SHUT; + else if (stringValue == "AUTO") + return State::AUTO; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + + +std::string Connection::Direction2String(const Direction enumValue) +{ + std::string stringValue; + + switch (enumValue) { + case Direction::X: + stringValue = "X"; + break; + + case Direction::Y: + stringValue = "Y"; + break; + + case Direction::Z: + stringValue = "Z"; + break; + } + + return stringValue; +} + + +Connection::Direction Connection::DirectionFromString(const std::string& s ) +{ + Direction direction; + + if (s == "X") { direction = Direction::X; } + else if (s == "Y") { direction = Direction::Y; } + else if (s == "Z") { direction = Direction::Z; } + else { + std::string msg = "Unsupported completion direction " + s; + throw std::invalid_argument(msg); + } + + return direction; +} + + +const std::string Connection::Order2String( Order enumValue ) { + switch( enumValue ) { + case Order::DEPTH: + return "DEPTH"; + case Order::INPUT: + return "INPUT"; + case Order::TRACK: + return "TRACK"; + default: + throw std::invalid_argument("Unhandled enum value"); + } +} + + +Connection::Order Connection::OrderFromString(const std::string& stringValue ) { + if (stringValue == "DEPTH") + return Order::DEPTH; + else if (stringValue == "INPUT") + return Order::INPUT; + else if (stringValue == "TRACK") + return Order::TRACK; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + + + +} + diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp index 8238563f6..307bbce0e 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp @@ -80,8 +80,8 @@ Well2::Well2(const std::string& wname_arg, int headJ_arg, double ref_depth_arg, Phase phase_arg, - WellProducer::ControlModeEnum whistctl_cmode, - WellCompletion::CompletionOrderEnum ordering_arg, + ProducerCMode whistctl_cmode, + Connection::Order ordering_arg, const UnitSystem& unit_system_arg, double udq_undefined_arg) : wname(wname_arg), @@ -95,12 +95,12 @@ Well2::Well2(const std::string& wname_arg, ordering(ordering_arg), unit_system(unit_system_arg), udq_undefined(udq_undefined_arg), - status(WellCommon::SHUT), + status(Status::SHUT), drainage_radius(ParserKeywords::WELSPECS::D_RADIUS::defaultValue), allow_cross_flow(DeckItem::to_bool(ParserKeywords::WELSPECS::CROSSFLOW::defaultValue)), automatic_shutin( ParserKeywords::WELSPECS::CROSSFLOW::defaultValue == "SHUT"), producer(true), - guide_rate({true, -1, GuideRate::UNDEFINED,ParserKeywords::WGRUPCON::SCALING_FACTOR::defaultValue}), + guide_rate({true, -1, Well2::GuideRateTarget::UNDEFINED,ParserKeywords::WGRUPCON::SCALING_FACTOR::defaultValue}), efficiency_factor(1.0), solvent_fraction(0.0), econ_limits(std::make_shared()), @@ -176,7 +176,7 @@ void Well2::switchToProducer() { auto p = std::make_shared(this->getInjectionProperties()); p->BHPLimit.reset( 0 ); - p->dropInjectionControl( Opm::WellInjector::BHP ); + p->dropInjectionControl( Opm::Well2::InjectorCMode::BHP ); this->updateInjection( p ); this->updateProducer(true); } @@ -187,7 +187,7 @@ void Well2::switchToInjector() { p->BHPLimit.assert_numeric(); p->BHPLimit.reset(0); - p->dropProductionControl( Opm::WellProducer::BHP ); + p->dropProductionControl( ProducerCMode::BHP ); this->updateProduction( p ); this->updateProducer( false ); } @@ -225,7 +225,7 @@ bool Well2::updateTracer(std::shared_ptr tracer_properties return false; } -bool Well2::updateWellGuideRate(bool available, double guide_rate_arg, GuideRate::GuideRatePhaseEnum guide_phase, double scale_factor) { +bool Well2::updateWellGuideRate(bool available, double guide_rate_arg, GuideRateTarget guide_phase, double scale_factor) { bool update = false; if (this->guide_rate.available != available) { this->guide_rate.available = available; @@ -285,7 +285,7 @@ bool Well2::updateHead(int I, int J) { } -bool Well2::updateStatus(WellCommon::StatusEnum status_arg) { +bool Well2::updateStatus(Status status_arg) { if (this->status != status_arg) { this->status = status_arg; return true; @@ -334,7 +334,7 @@ bool Well2::updateAutoShutin(bool auto_shutin) { bool Well2::updateConnections(const std::shared_ptr connections_arg) { - if( this->ordering == WellCompletion::TRACK) + if( this->ordering == Connection::Order::TRACK) connections_arg->orderConnections( this->headI, this->headJ ); if (*this->connections != *connections_arg) { @@ -386,7 +386,7 @@ bool Well2::isInjector() const { } -WellInjector::TypeEnum Well2::injectorType() const { +Well2::InjectorType Well2::injectorType() const { if (this->producer) throw std::runtime_error("Can not access injectorType attribute of a producer"); @@ -403,7 +403,7 @@ double Well2::getGuideRate() const { return this->guide_rate.guide_rate; } -GuideRate::GuideRatePhaseEnum Well2::getGuideRatePhase() const { +Well2::GuideRateTarget Well2::getGuideRatePhase() const { return this->guide_rate.guide_phase; } @@ -487,7 +487,7 @@ const WellEconProductionLimits& Well2::getEconLimits() const { return *this->econ_limits; } -const WellProductionProperties& Well2::getProductionProperties() const { +const Well2::WellProductionProperties& Well2::getProductionProperties() const { return *this->production; } @@ -498,11 +498,11 @@ const WellSegments& Well2::getSegments() const { throw std::logic_error("Asked for segment information in not MSW well: " + this->name()); } -const WellInjectionProperties& Well2::getInjectionProperties() const { +const Well2::WellInjectionProperties& Well2::getInjectionProperties() const { return *this->injection; } -WellCommon::StatusEnum Well2::getStatus() const { +Well2::Status Well2::getStatus() const { return this->status; } @@ -526,7 +526,7 @@ Phase Well2::getPreferredPhase() const { return this->phase; } -bool Well2::handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum status_arg) { +bool Well2::handleWELOPEN(const DeckRecord& record, Connection::State state_arg) { auto match = [=]( const Connection &c) -> bool { if (!match_eq(c.getI(), record, "I" , -1)) return false; @@ -542,7 +542,7 @@ bool Well2::handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum st for (auto c : *this->connections) { if (match(c)) - c.setState( status_arg ); + c.setState( state_arg ); new_connections->add(c); } @@ -681,7 +681,7 @@ bool Well2::updatePrediction(bool prediction_mode_arg) { } -WellCompletion::CompletionOrderEnum Well2::getWellConnectionOrdering() const { +Connection::Order Well2::getWellConnectionOrdering() const { return this->ordering; } @@ -716,9 +716,9 @@ double Well2::injection_rate(const SummaryState& st, Phase phase_arg) const { const auto type = controls.injector_type; - if( phase_arg == Phase::WATER && type != WellInjector::WATER ) return 0.0; - if( phase_arg == Phase::OIL && type != WellInjector::OIL ) return 0.0; - if( phase_arg == Phase::GAS && type != WellInjector::GAS ) return 0.0; + if( phase_arg == Phase::WATER && type != Well2::InjectorType::WATER ) return 0.0; + if( phase_arg == Phase::OIL && type != Well2::InjectorType::OIL ) return 0.0; + if( phase_arg == Phase::GAS && type != Well2::InjectorType::GAS ) return 0.0; return controls.surface_rate; } @@ -733,7 +733,7 @@ bool Well2::wellNameInWellNamePattern(const std::string& wellName, const std::st } -ProductionControls Well2::productionControls(const SummaryState& st) const { +Well2::ProductionControls Well2::productionControls(const SummaryState& st) const { if (this->isProducer()) { auto controls = this->production->controls(st, this->udq_undefined); controls.prediction_mode = this->predictionMode(); @@ -742,7 +742,7 @@ ProductionControls Well2::productionControls(const SummaryState& st) const { throw std::logic_error("Trying to get production data from an injector"); } -InjectionControls Well2::injectionControls(const SummaryState& st) const { +Well2::InjectionControls Well2::injectionControls(const SummaryState& st) const { if (!this->isProducer()) { auto controls = this->injection->controls(this->unit_system, st, this->udq_undefined); controls.prediction_mode = this->predictionMode(); @@ -781,4 +781,238 @@ double Well2::temperature() const { throw std::runtime_error("Can not ask for temperature in a producer"); } + +std::string Well2::Status2String(Well2::Status enumValue) { + switch( enumValue ) { + case Status::OPEN: + return "OPEN"; + case Status::SHUT: + return "SHUT"; + case Status::AUTO: + return "AUTO"; + case Status::STOP: + return "STOP"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + + +Well2::Status Well2::StatusFromString(const std::string& stringValue) { + if (stringValue == "OPEN") + return Status::OPEN; + else if (stringValue == "SHUT") + return Status::SHUT; + else if (stringValue == "STOP") + return Status::STOP; + else if (stringValue == "AUTO") + return Status::AUTO; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + + +const std::string Well2::InjectorType2String( Well2::InjectorType enumValue ) { + switch( enumValue ) { + case InjectorType::OIL: + return "OIL"; + case InjectorType::GAS: + return "GAS"; + case InjectorType::WATER: + return "WATER"; + case InjectorType::MULTI: + return "MULTI"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + +Well2::InjectorType Well2::InjectorTypeFromString( const std::string& stringValue ) { + if (stringValue == "OIL") + return InjectorType::OIL; + else if (stringValue == "WATER") + return InjectorType::WATER; + else if (stringValue == "WAT") + return InjectorType::WATER; + else if (stringValue == "GAS") + return InjectorType::GAS; + else if (stringValue == "MULTI") + return InjectorType::MULTI; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + +const std::string Well2::InjectorCMode2String( InjectorCMode enumValue ) { + switch( enumValue ) { + case InjectorCMode::RESV: + return "RESV"; + case InjectorCMode::RATE: + return "RATE"; + case InjectorCMode::BHP: + return "BHP"; + case InjectorCMode::THP: + return "THP"; + case InjectorCMode::GRUP: + return "GRUP"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + + +Well2::InjectorCMode Well2::InjectorCModeFromString(const std::string &stringValue) { + if (stringValue == "RATE") + return InjectorCMode::RATE; + else if (stringValue == "RESV") + return InjectorCMode::RESV; + else if (stringValue == "BHP") + return InjectorCMode::BHP; + else if (stringValue == "THP") + return InjectorCMode::THP; + else if (stringValue == "GRUP") + return InjectorCMode::GRUP; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue); +} + +Well2::WELTARGCMode Well2::WELTARGCModeFromString(const std::string& string_value) { + if (string_value == "ORAT") + return WELTARGCMode::ORAT; + + if (string_value == "WRAT") + return WELTARGCMode::WRAT; + + if (string_value == "GRAT") + return WELTARGCMode::GRAT; + + if (string_value == "LRAT") + return WELTARGCMode::LRAT; + + if (string_value == "CRAT") + return WELTARGCMode::CRAT; + + if (string_value == "RESV") + return WELTARGCMode::RESV; + + if (string_value == "BHP") + return WELTARGCMode::BHP; + + if (string_value == "THP") + return WELTARGCMode::THP; + + if (string_value == "VFP") + return WELTARGCMode::VFP; + + if (string_value == "LIFT") + return WELTARGCMode::LIFT; + + if (string_value == "GUID") + return WELTARGCMode::GUID; + + throw std::invalid_argument("WELTARG control mode: " + string_value + " not recognized."); +} + + +const std::string Well2::ProducerCMode2String( ProducerCMode enumValue ) { + switch( enumValue ) { + case ProducerCMode::ORAT: + return "ORAT"; + case ProducerCMode::WRAT: + return "WRAT"; + case ProducerCMode::GRAT: + return "GRAT"; + case ProducerCMode::LRAT: + return "LRAT"; + case ProducerCMode::CRAT: + return "CRAT"; + case ProducerCMode::RESV: + return "RESV"; + case ProducerCMode::BHP: + return "BHP"; + case ProducerCMode::THP: + return "THP"; + case ProducerCMode::GRUP: + return "GRUP"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + +Well2::ProducerCMode Well2::ProducerCModeFromString( const std::string& stringValue ) { + if (stringValue == "ORAT") + return ProducerCMode::ORAT; + else if (stringValue == "WRAT") + return ProducerCMode::WRAT; + else if (stringValue == "GRAT") + return ProducerCMode::GRAT; + else if (stringValue == "LRAT") + return ProducerCMode::LRAT; + else if (stringValue == "CRAT") + return ProducerCMode::CRAT; + else if (stringValue == "RESV") + return ProducerCMode::RESV; + else if (stringValue == "BHP") + return ProducerCMode::BHP; + else if (stringValue == "THP") + return ProducerCMode::THP; + else if (stringValue == "GRUP") + return ProducerCMode::GRUP; + else if (stringValue == "NONE") + return ProducerCMode::NONE; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} + + +const std::string Well2::GuideRateTarget2String( GuideRateTarget enumValue ) { + switch( enumValue ) { + case GuideRateTarget::OIL: + return "OIL"; + case GuideRateTarget::WAT: + return "WAT"; + case GuideRateTarget::GAS: + return "GAS"; + case GuideRateTarget::LIQ: + return "LIQ"; + case GuideRateTarget::COMB: + return "COMB"; + case GuideRateTarget::WGA: + return "WGA"; + case GuideRateTarget::CVAL: + return "CVAL"; + case GuideRateTarget::RAT: + return "RAT"; + case GuideRateTarget::RES: + return "RES"; + case GuideRateTarget::UNDEFINED: + return "UNDEFINED"; + default: + throw std::invalid_argument("unhandled enum value"); + } +} + +Well2::GuideRateTarget Well2::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 == "RAT") + return GuideRateTarget::RAT; + else if (stringValue == "RES") + return GuideRateTarget::RES; + else if (stringValue == "UNDEFINED") + return GuideRateTarget::UNDEFINED; + else + throw std::invalid_argument("Unknown enum state string: " + stringValue ); +} } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp index 2d9591bf6..e94ad5120 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -37,16 +36,16 @@ namespace { // direction. First two elements of return value are directions // perpendicular to completion while last element is direction // along completion. - inline std::array< size_t, 3> directionIndices(const Opm::WellCompletion::DirectionEnum direction) +inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction direction) { switch (direction) { - case Opm::WellCompletion::DirectionEnum::X: + case Opm::Connection::Direction::X: return {{ 1,2,0 }}; - case Opm::WellCompletion::DirectionEnum::Y: + case Opm::Connection::Direction::Y: return {{ 2,0,1}}; - case Opm::WellCompletion::DirectionEnum::Z: + case Opm::Connection::Direction::Z: return {{ 0,1,2 }}; } // All enum values should be handled above. Therefore @@ -59,7 +58,7 @@ namespace { // Permute (diagonal) permeability components according to // completion's direction. inline std::array - permComponents(const Opm::WellCompletion::DirectionEnum direction, + permComponents(const Opm::Connection::Direction direction, const std::array& perm) { const auto p = directionIndices(direction); @@ -75,9 +74,9 @@ namespace { // Note: 'extent' is intentionally accepted by modifiable value // rather than reference-to-const to support NTG manipulation. inline std::array - effectiveExtent(const Opm::WellCompletion::DirectionEnum direction, - const double ntg, - std::array extent) + effectiveExtent(const Opm::Connection::Direction direction, + const double ntg, + std::array extent) { // Vertical extent affected by net-to-gross ratio. extent[2] *= ntg; @@ -136,14 +135,14 @@ namespace { void WellConnections::addConnection(int i, int j , int k , int complnum, double depth, - WellCompletion::StateEnum state, + Connection::State state, double CF, double Kh, double rw, double r0, double skin_factor, const int satTableId, - const WellCompletion::DirectionEnum direction, + const Connection::Direction direction, const std::size_t seqIndex, const double segDistStart, const double segDistEnd, @@ -159,14 +158,14 @@ namespace { void WellConnections::addConnection(int i, int j , int k , double depth, - WellCompletion::StateEnum state , + Connection::State state , double CF, double Kh, double rw, double r0, double skin_factor, const int satTableId, - const WellCompletion::DirectionEnum direction, + const Connection::Direction direction, const std::size_t seqIndex, const double segDistStart, const double segDistEnd, @@ -208,7 +207,7 @@ namespace { int K1 = record.getItem("K1").get< int >(0) - 1; int K2 = record.getItem("K2").get< int >(0) - 1; - WellCompletion::StateEnum state = WellCompletion::StateEnumFromString( record.getItem("STATE").getTrimmedString(0) ); + Connection::State state = Connection::StateFromString( record.getItem("STATE").getTrimmedString(0) ); const auto& satnum = eclipseProperties.getIntGridProperty("SATNUM"); int satTableId = -1; @@ -218,7 +217,7 @@ namespace { const auto& KhItem = record.getItem("Kh"); const auto& satTableIdItem = record.getItem("SAT_TABLE"); const auto& r0Item = record.getItem("PR"); - const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnumFromString(record.getItem("DIR").getTrimmedString(0)); + const auto direction = Connection::DirectionFromString(record.getItem("DIR").getTrimmedString(0)); double skin_factor = record.getItem("SKIN").getSIDouble(0); double rw; double r0=0.0; @@ -388,7 +387,7 @@ namespace { auto shut = []( const Connection& c ) { - return c.state() == WellCompletion::StateEnum::SHUT; + return c.state() == Connection::State::SHUT; }; return std::all_of( this->m_connections.begin(), diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp index c2450093b..8baac3376 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp @@ -34,10 +34,10 @@ namespace Opm { , m_max_water_cut(0.0) , m_max_gas_oil_ratio(0.0) , m_max_water_gas_ratio(0.0) - , m_workover(WellEcon::NONE) + , m_workover(EconWorkover::NONE) , m_end_run(false) , m_followon_well("'") - , m_quantity_limit(WellEcon::RATE) + , m_quantity_limit(QuantityLimit::RATE) , m_secondary_max_water_cut(0.0) , m_workover_secondary(m_workover) , m_max_gas_liquid_ratio(0.0) @@ -55,17 +55,17 @@ namespace Opm { , m_max_water_cut(record.getItem("MAX_WATER_CUT").get(0).get()) , m_max_gas_oil_ratio(record.getItem("MAX_GAS_OIL_RATIO").get(0).get()) , m_max_water_gas_ratio(record.getItem("MAX_WATER_GAS_RATIO").get(0).get()) - , m_workover(WellEcon::WorkoverEnumFromString(record.getItem("WORKOVER_RATIO_LIMIT").getTrimmedString(0))) + , m_workover(EconWorkoverFromString(record.getItem("WORKOVER_RATIO_LIMIT").getTrimmedString(0))) , m_end_run(false) , m_followon_well(record.getItem("FOLLOW_ON_WELL").getTrimmedString(0)) - , m_quantity_limit(WellEcon::QuantityLimitEnumFromString(record.getItem("LIMITED_QUANTITY").getTrimmedString(0))) + , m_quantity_limit(QuantityLimitFromString(record.getItem("LIMITED_QUANTITY").getTrimmedString(0))) , m_secondary_max_water_cut(record.getItem("SECOND_MAX_WATER_CUT").get(0)) , m_max_gas_liquid_ratio(record.getItem("MAX_GAS_LIQUID_RATIO").get(0)) , m_min_liquid_rate(record.getItem("MIN_LIQUID_PRODCUTION_RATE").getSIDouble(0)) , m_min_reservoir_fluid_rate(record.getItem("MIN_RES_FLUID_RATE").getSIDouble(0)) { - assert(m_workover != WellEcon::LAST); - assert(m_workover != WellEcon::RED); + assert(m_workover != EconWorkover::LAST); + assert(m_workover != EconWorkover::RED); if (record.getItem("MAX_TEMP").hasValue(0)) { m_max_temperature = record.getItem("MAX_TEMP").getSIDouble(0); @@ -76,7 +76,7 @@ namespace Opm { if (record.getItem("WORKOVER_SECOND_WATER_CUT_LIMIT").hasValue(0)) { const std::string string_workover = record.getItem("WORKOVER_SECOND_WATER_CUT_LIMIT").getTrimmedString(0); - m_workover_secondary = WellEcon::WorkoverEnumFromString(string_workover); + m_workover_secondary = EconWorkoverFromString(string_workover); } else { m_workover_secondary = m_workover; } @@ -116,8 +116,159 @@ namespace Opm { } - bool WellEconProductionLimits::operator!=(const WellEconProductionLimits& other) const { - return (!(*this == other)); +bool WellEconProductionLimits::operator!=(const WellEconProductionLimits& other) const { + return (!(*this == other)); +} + +// limit switch on? +bool WellEconProductionLimits::onAnyEffectiveLimit() const { + return (onAnyRatioLimit() || onAnyRateLimit()); +}; + +bool WellEconProductionLimits::onAnyRatioLimit() const { + return (onMaxWaterCut() || onMaxGasOilRatio() || onMaxWaterGasRatio() || + onMaxGasLiquidRatio()); +}; + +bool WellEconProductionLimits::onAnyRateLimit() const { + return (onMinOilRate() || onMinGasRate() || onMinLiquidRate() || + onMinReservoirFluidRate()); +}; + +bool WellEconProductionLimits::onMinOilRate() const { return (m_min_oil_rate > 0.0); }; + +bool WellEconProductionLimits::onMinGasRate() const { return (m_min_gas_rate > 0.0); }; + +bool WellEconProductionLimits::onMaxWaterCut() const { return (m_max_water_cut > 0.0); }; + +bool WellEconProductionLimits::onMaxGasOilRatio() const { return (m_max_gas_oil_ratio > 0.0); }; + +bool WellEconProductionLimits::onMaxWaterGasRatio() const { return (m_max_water_gas_ratio > 0.0); }; + +bool WellEconProductionLimits::onSecondaryMaxWaterCut() const { + return (m_secondary_max_water_cut > 0.0); +}; + +bool WellEconProductionLimits::onMaxGasLiquidRatio() const { return (m_max_gas_oil_ratio > 0.0); }; + +// assuming Celsius temperature is used internally +bool WellEconProductionLimits::onMaxTemperature() const { return (m_max_temperature > -273.15); }; + +bool WellEconProductionLimits::onMinLiquidRate() const { return (m_min_liquid_rate > 0.0); }; + +bool WellEconProductionLimits::onMinReservoirFluidRate() const { + return (m_min_reservoir_fluid_rate > 0.0); +}; + +// not sure what will happen if the followon well is a well does not exist. +bool WellEconProductionLimits::validFollowonWell() const { return (m_followon_well != "'"); }; + +bool WellEconProductionLimits::requireWorkover() const { + return (m_workover != EconWorkover::NONE); +}; + +bool WellEconProductionLimits::requireSecondaryWorkover() const { + return (m_workover_secondary != EconWorkover::NONE); +} + +bool WellEconProductionLimits::endRun() const { return m_end_run; } + +double WellEconProductionLimits::minOilRate() const { return m_min_oil_rate; }; + +double WellEconProductionLimits::minGasRate() const { return m_min_gas_rate; }; + +double WellEconProductionLimits::maxWaterCut() const { return m_max_water_cut; }; + +double WellEconProductionLimits::maxGasOilRatio() const { return m_max_gas_oil_ratio; }; + +double WellEconProductionLimits::maxWaterGasRatio() const { return m_max_water_gas_ratio; }; + +double WellEconProductionLimits::maxGasLiquidRatio() const { return m_max_gas_liquid_ratio; }; + +double WellEconProductionLimits::minLiquidRate() const { return m_min_liquid_rate; }; + +double WellEconProductionLimits::maxTemperature() const { return m_max_temperature; }; + +double WellEconProductionLimits::minReservoirFluidRate() const { return m_min_reservoir_fluid_rate; }; + +WellEconProductionLimits::EconWorkover WellEconProductionLimits::workover() const { return m_workover; }; + +const std::string& WellEconProductionLimits::followonWell() const { return m_followon_well; }; + +WellEconProductionLimits::QuantityLimit WellEconProductionLimits::quantityLimit() const { + return m_quantity_limit; +}; + +double WellEconProductionLimits::maxSecondaryMaxWaterCut() const { + return m_secondary_max_water_cut; +}; + +WellEconProductionLimits::EconWorkover WellEconProductionLimits::workoverSecondary() const { + return m_workover_secondary; +}; + +std::string WellEconProductionLimits::EconWorkover2String(EconWorkover enumValue) { + switch(enumValue) { + case EconWorkover::NONE: + return "NONE"; + case EconWorkover::CON: + return "CON"; + case EconWorkover::CONP: + return "+CON"; + case EconWorkover::WELL: + return "WELL"; + case EconWorkover::PLUG: + return "PLUG"; + case EconWorkover::LAST: + return "LAST"; + case EconWorkover::RED: + return "RED"; + default: + throw std::invalid_argument("unhandled WorkoverEnum value"); } +} + + +WellEconProductionLimits::EconWorkover WellEconProductionLimits::EconWorkoverFromString(const std::string& stringValue) { + if (stringValue == "NONE") + return EconWorkover::NONE; + else if (stringValue == "CON") + return EconWorkover::CON; + else if (stringValue == "+CON") + return EconWorkover::CONP; + else if (stringValue == "WELL") + return EconWorkover::WELL; + else if (stringValue == "PLUG") + return EconWorkover::PLUG; + else if (stringValue == "LAST") + return EconWorkover::LAST; + else if (stringValue == "RED") + return EconWorkover::RED; + else + throw std::invalid_argument("Unknown enum stringValue: " + stringValue + + " for WorkoverEnum"); +} + +const std::string WellEconProductionLimits::QuantityLimit2String(QuantityLimit enumValue) { + switch(enumValue) { + case QuantityLimit::RATE: + return "RATE"; + case QuantityLimit::POTN: + return "POTN"; + default: + throw std::invalid_argument("unhandled QuantityLimitvalue"); + } +} + +WellEconProductionLimits::QuantityLimit WellEconProductionLimits::QuantityLimitFromString(const std::string& string ) { + if (string == "RATE") { + return QuantityLimit::RATE; + } else if (string == "POTN") { + return QuantityLimit::POTN; + } else { + throw std::invalid_argument("Unknown enum string: " + string + " for QuantityLimitEnum"); + } +} + } // namespace Opm diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp index 0413bd690..dc0c57f29 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "injection.hpp" #include "../eval_uda.hpp" @@ -34,10 +35,10 @@ namespace Opm { - WellInjectionProperties::WellInjectionProperties(const std::string& wname) + Well2::WellInjectionProperties::WellInjectionProperties(const std::string& wname) : name(wname), - injectorType(WellInjector::WATER), - controlMode(WellInjector::CMODE_UNDEFINED) + injectorType(InjectorType::WATER), + controlMode(InjectorCMode::CMODE_UNDEFINED) { temperature= Metric::TemperatureOffset @@ -50,29 +51,29 @@ namespace Opm { } - void WellInjectionProperties::handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name) { - this->injectorType = WellInjector::TypeFromString( record.getItem("TYPE").getTrimmedString(0) ); + void Well2::WellInjectionProperties::handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name) { + this->injectorType = Well2::InjectorTypeFromString( record.getItem("TYPE").getTrimmedString(0) ); this->predictionMode = true; if (!record.getItem("RATE").defaultApplied(0)) { this->surfaceInjectionRate = record.getItem("RATE").get(0); - this->addInjectionControl(WellInjector::RATE); + this->addInjectionControl(InjectorCMode::RATE); } else - this->dropInjectionControl(WellInjector::RATE); + this->dropInjectionControl(InjectorCMode::RATE); if (!record.getItem("RESV").defaultApplied(0)) { this->reservoirInjectionRate = record.getItem("RESV").get(0); - this->addInjectionControl(WellInjector::RESV); + this->addInjectionControl(InjectorCMode::RESV); } else - this->dropInjectionControl(WellInjector::RESV); + this->dropInjectionControl(InjectorCMode::RESV); if (!record.getItem("THP").defaultApplied(0)) { this->THPLimit = record.getItem("THP").get(0); - this->addInjectionControl(WellInjector::THP); + this->addInjectionControl(InjectorCMode::THP); } else - this->dropInjectionControl(WellInjector::THP); + this->dropInjectionControl(InjectorCMode::THP); this->VFPTableNumber = record.getItem("VFP_TABLE").get< int >(0); @@ -85,15 +86,15 @@ namespace Opm { */ this->setBHPLimit(record.getItem("BHP").get(0).get()); // BHP control should always be there. - this->addInjectionControl(WellInjector::BHP); + this->addInjectionControl(InjectorCMode::BHP); if (availableForGroupControl) - this->addInjectionControl(WellInjector::GRUP); + this->addInjectionControl(InjectorCMode::GRUP); else - this->dropInjectionControl(WellInjector::GRUP); + this->dropInjectionControl(InjectorCMode::GRUP); { const std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0); - WellInjector::ControlModeEnum controlModeArg = WellInjector::ControlModeFromString( cmodeString ); + InjectorCMode controlModeArg = InjectorCModeFromString( cmodeString ); if (this->hasInjectionControl( controlModeArg)) this->controlMode = controlModeArg; else { @@ -104,53 +105,53 @@ namespace Opm { - void WellInjectionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { - if (cmode == WellTarget::BHP){ + void Well2::WellInjectionProperties::handleWELTARG(WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { + if (cmode == Well2::WELTARGCMode::BHP){ this->BHPLimit.reset( newValue * siFactorP ); } - else if (cmode == WellTarget::ORAT){ - if(this->injectorType == WellInjector::TypeEnum::OIL){ + else if (cmode == WELTARGCMode::ORAT){ + if(this->injectorType == Well2::InjectorType::OIL){ this->surfaceInjectionRate.reset( newValue * siFactorL ); }else{ std::invalid_argument("Well type must be OIL to set the oil rate"); } } - else if (cmode == WellTarget::WRAT){ - if(this->injectorType == WellInjector::TypeEnum::WATER) + else if (cmode == WELTARGCMode::WRAT){ + if(this->injectorType == Well2::InjectorType::WATER) this->surfaceInjectionRate.reset( newValue * siFactorL ); else std::invalid_argument("Well type must be WATER to set the water rate"); } - else if (cmode == WellTarget::GRAT){ - if(this->injectorType == WellInjector::TypeEnum::GAS){ + else if (cmode == WELTARGCMode::GRAT){ + if(this->injectorType == Well2::InjectorType::GAS){ this->surfaceInjectionRate.reset( newValue * siFactorG ); }else{ std::invalid_argument("Well type must be GAS to set the gas rate"); } } - else if (cmode == WellTarget::THP){ + else if (cmode == WELTARGCMode::THP){ this->THPLimit.reset( newValue * siFactorP ); } - else if (cmode == WellTarget::VFP){ + else if (cmode == WELTARGCMode::VFP){ this->VFPTableNumber = static_cast (newValue); } - else if (cmode == WellTarget::RESV){ + else if (cmode == WELTARGCMode::RESV){ this->reservoirInjectionRate.reset( newValue * siFactorL ); } - else if (cmode != WellTarget::GUID){ + else if (cmode != WELTARGCMode::GUID){ throw std::invalid_argument("Invalid keyword (MODE) supplied"); } } - void WellInjectionProperties::handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name) { + void Well2::WellInjectionProperties::handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name) { // convert injection rates to SI const auto& typeItem = record.getItem("TYPE"); if (typeItem.defaultApplied(0)) { const std::string msg = "Injection type can not be defaulted for keyword WCONINJH"; throw std::invalid_argument(msg); } - this->injectorType = WellInjector::TypeFromString( typeItem.getTrimmedString(0)); + this->injectorType = Well2::InjectorTypeFromString( typeItem.getTrimmedString(0)); if (!record.getItem("RATE").defaultApplied(0)) { double injectionRate = record.getItem("RATE").get(0); @@ -162,20 +163,20 @@ namespace Opm { this->THPH = record.getItem("THP").getSIDouble(0); const std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0); - const WellInjector::ControlModeEnum newControlMode = WellInjector::ControlModeFromString( cmodeString ); + const InjectorCMode newControlMode = InjectorCModeFromString( cmodeString ); - if ( !(newControlMode == WellInjector::RATE || newControlMode == WellInjector::BHP) ) { + if ( !(newControlMode == InjectorCMode::RATE || newControlMode == InjectorCMode::BHP) ) { const std::string msg = "Only RATE and BHP control are allowed for WCONINJH for well " + well_name; throw std::invalid_argument(msg); } // when well is under BHP control, we use its historical BHP value as BHP limit - if (newControlMode == WellInjector::BHP) { + if (newControlMode == InjectorCMode::BHP) { this->setBHPLimit(this->BHPH); } else { const bool switching_from_producer = is_producer; const bool switching_from_prediction = this->predictionMode; - const bool switching_from_BHP_control = (this->controlMode == WellInjector::BHP); + const bool switching_from_BHP_control = (this->controlMode == InjectorCMode::BHP); if (switching_from_prediction || switching_from_BHP_control || switching_from_producer) { @@ -184,7 +185,7 @@ namespace Opm { // otherwise, we keep its previous BHP limit } - this->addInjectionControl(WellInjector::BHP); + this->addInjectionControl(InjectorCMode::BHP); this->addInjectionControl(newControlMode); this->controlMode = newControlMode; this->predictionMode = false; @@ -195,7 +196,7 @@ namespace Opm { } } - bool WellInjectionProperties::operator==(const WellInjectionProperties& other) const { + bool Well2::WellInjectionProperties::operator==(const Well2::WellInjectionProperties& other) const { if ((surfaceInjectionRate == other.surfaceInjectionRate) && (reservoirInjectionRate == other.reservoirInjectionRate) && (temperature == other.temperature) && @@ -213,24 +214,24 @@ namespace Opm { return false; } - bool WellInjectionProperties::operator!=(const WellInjectionProperties& other) const { + bool Well2::WellInjectionProperties::operator!=(const Well2::WellInjectionProperties& other) const { return !(*this == other); } - void WellInjectionProperties::resetDefaultHistoricalBHPLimit() { + void Well2::WellInjectionProperties::resetDefaultHistoricalBHPLimit() { // this default BHP value is from simulation result, // without finding any related document BHPLimit.reset( 6891.2 * unit::barsa ); } - void WellInjectionProperties::setBHPLimit(const double limit) { + void Well2::WellInjectionProperties::setBHPLimit(const double limit) { BHPLimit.reset( limit ); } std::ostream& operator<<( std::ostream& stream, - const WellInjectionProperties& wp ) { + const Well2::WellInjectionProperties& wp ) { return stream - << "WellInjectionProperties { " + << "Well2::WellInjectionProperties { " << "surfacerate: " << wp.surfaceInjectionRate << ", " << "reservoir rate " << wp.reservoirInjectionRate << ", " << "temperature: " << wp.temperature << ", " @@ -241,12 +242,12 @@ namespace Opm { << "VFP table: " << wp.VFPTableNumber << ", " << "prediction mode: " << wp.predictionMode << ", " << "injection ctrl: " << wp.injectionControls << ", " - << "injector type: " << wp.injectorType << ", " - << "control mode: " << wp.controlMode << " }"; + << "injector type: " << Well2::InjectorType2String(wp.injectorType) << ", " + << "control mode: " << Well2::InjectorCMode2String(wp.controlMode) << " }"; } - InjectionControls WellInjectionProperties::controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const { +Well2::InjectionControls Well2::WellInjectionProperties::controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const { InjectionControls controls(this->injectionControls); controls.surface_rate = UDA::eval_well_uda_rate(this->surfaceInjectionRate, this->name, st, udq_default, this->injectorType, unit_system); @@ -263,7 +264,7 @@ namespace Opm { return controls; } - bool WellInjectionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const { + bool Well2::WellInjectionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const { int update_count = 0; update_count += active.update(udq_config, this->surfaceInjectionRate, this->name, UDAControl::WCONINJE_RATE); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp index 86bc3f96e..9f939db9f 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -34,20 +33,20 @@ namespace Opm { - WellProductionProperties::WellProductionProperties(const std::string& name_arg) : + Well2::WellProductionProperties::WellProductionProperties(const std::string& name_arg) : name(name_arg), predictionMode( true ) {} - void WellProductionProperties::init_rates( const DeckRecord& record ) { + void Well2::WellProductionProperties::init_rates( const DeckRecord& record ) { this->OilRate = record.getItem("ORAT").get(0); this->WaterRate = record.getItem("WRAT").get(0); this->GasRate = record.getItem("GRAT").get(0); } - void WellProductionProperties::init_history(const DeckRecord& record) + void Well2::WellProductionProperties::init_history(const DeckRecord& record) { this->predictionMode = false; // update LiquidRate @@ -64,13 +63,12 @@ namespace Opm { throw std::invalid_argument(msg); } - namespace wp = WellProducer; - auto cmode = wp::CMODE_UNDEFINED; + auto cmode = ProducerCMode::CMODE_UNDEFINED; if (effectiveHistoryProductionControl(this->whistctl_cmode) ) cmode = this->whistctl_cmode; else - cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) ); + cmode = ProducerCModeFromString( cmodeItem.getTrimmedString( 0 ) ); // clearing the existing targets/limits clearControls(); @@ -86,10 +84,10 @@ namespace Opm { // always have a BHP control/limit, while the limit value needs to be determined // the control mode added above can be a BHP control or a type of RATE control - if ( !this->hasProductionControl( wp::BHP ) ) - this->addProductionControl( wp::BHP ); + if ( !this->hasProductionControl( ProducerCMode::BHP ) ) + this->addProductionControl( ProducerCMode::BHP ); - if (cmode == wp::BHP) + if (cmode == ProducerCMode::BHP) this->setBHPLimit(this->BHPH); const auto vfp_table = record.getItem("VFPTable").get< int >(0); @@ -103,7 +101,7 @@ namespace Opm { - void WellProductionProperties::handleWCONPROD( const std::string& /* well */, const DeckRecord& record) + void Well2::WellProductionProperties::handleWCONPROD( const std::string& /* well */, const DeckRecord& record) { this->predictionMode = true; @@ -114,11 +112,10 @@ namespace Opm { this->LiquidRate = record.getItem("LRAT").get(0); this->ResVRate = record.getItem("RESV").get(0); - namespace wp = WellProducer; - using mode = std::pair< const std::string, wp::ControlModeEnum >; + using mode = std::pair< const std::string, ProducerCMode >; static const mode modes[] = { - { "ORAT", wp::ORAT }, { "WRAT", wp::WRAT }, { "GRAT", wp::GRAT }, - { "LRAT", wp::LRAT }, { "RESV", wp::RESV }, { "THP", wp::THP } + { "ORAT", ProducerCMode::ORAT }, { "WRAT", ProducerCMode::WRAT }, { "GRAT", ProducerCMode::GRAT }, + { "LRAT", ProducerCMode::LRAT }, { "RESV", ProducerCMode::RESV }, { "THP", ProducerCMode::THP } }; @@ -136,11 +133,11 @@ namespace Opm { } // There is always a BHP constraint, when not specified, will use the default value - this->addProductionControl( wp::BHP ); + this->addProductionControl( ProducerCMode::BHP ); { const auto& cmodeItem = record.getItem("CMODE"); if (cmodeItem.hasValue(0)) { - const WellProducer::ControlModeEnum cmode = WellProducer::ControlModeFromString( cmodeItem.getTrimmedString(0) ); + auto cmode = Well2::ProducerCModeFromString( cmodeItem.getTrimmedString(0) ); if (this->hasProductionControl( cmode )) this->controlMode = cmode; @@ -155,7 +152,7 @@ namespace Opm { originate from the WCONHIST keyword. Predictions are handled with the default constructor and the handleWCONPROD() method. */ - void WellProductionProperties::handleWCONHIST(const DeckRecord& record) + void Well2::WellProductionProperties::handleWCONHIST(const DeckRecord& record) { this->init_rates(record); this->LiquidRate.reset(0); @@ -168,7 +165,7 @@ namespace Opm { if (this->predictionMode) this->resetDefaultBHPLimit(); - if (this->controlMode == WellProducer::BHP) + if (this->controlMode == ProducerCMode::BHP) this->resetDefaultBHPLimit(); this->init_history(record); @@ -176,44 +173,44 @@ namespace Opm { - void WellProductionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { - if (cmode == WellTarget::ORAT){ +void Well2::WellProductionProperties::handleWELTARG(Well2::WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { + if (cmode == WELTARGCMode::ORAT){ this->OilRate.assert_numeric("Can not combine UDA and WELTARG"); this->OilRate.reset( newValue * siFactorL ); } - else if (cmode == WellTarget::WRAT){ + else if (cmode == WELTARGCMode::WRAT){ this->WaterRate.assert_numeric("Can not combine UDA and WELTARG"); this->WaterRate.reset( newValue * siFactorL ); } - else if (cmode == WellTarget::GRAT){ + else if (cmode == WELTARGCMode::GRAT){ this->GasRate.assert_numeric("Can not combine UDA and WELTARG"); this->GasRate.reset( newValue * siFactorG ); } - else if (cmode == WellTarget::LRAT){ + else if (cmode == WELTARGCMode::LRAT){ this->LiquidRate.assert_numeric("Can not combine UDA and WELTARG"); this->LiquidRate.reset( newValue * siFactorL ); } - else if (cmode == WellTarget::RESV){ + else if (cmode == WELTARGCMode::RESV){ this->ResVRate.assert_numeric("Can not combine UDA and WELTARG"); this->ResVRate.reset( newValue * siFactorL ); } - else if (cmode == WellTarget::BHP){ + else if (cmode == WELTARGCMode::BHP){ this->BHPLimit.assert_numeric("Can not combine UDA and WELTARG"); this->BHPLimit.reset( newValue * siFactorP ); } - else if (cmode == WellTarget::THP){ + else if (cmode == WELTARGCMode::THP){ this->THPLimit.assert_numeric("Can not combine UDA and WELTARG"); this->THPLimit.reset(newValue * siFactorP); } - else if (cmode == WellTarget::VFP) + else if (cmode == WELTARGCMode::VFP) this->VFPTableNumber = static_cast (newValue); - else if (cmode != WellTarget::GUID) + else if (cmode != WELTARGCMode::GUID) throw std::invalid_argument("Invalid keyword (MODE) supplied"); } - bool WellProductionProperties::operator==(const WellProductionProperties& other) const { + bool Well2::WellProductionProperties::operator==(const Well2::WellProductionProperties& other) const { return OilRate == other.OilRate && WaterRate == other.WaterRate && GasRate == other.GasRate @@ -231,14 +228,14 @@ namespace Opm { } - bool WellProductionProperties::operator!=(const WellProductionProperties& other) const { + bool Well2::WellProductionProperties::operator!=(const Well2::WellProductionProperties& other) const { return !(*this == other); } - std::ostream& operator<<( std::ostream& stream, const WellProductionProperties& wp ) { + std::ostream& operator<<( std::ostream& stream, const Well2::WellProductionProperties& wp ) { return stream - << "WellProductionProperties { " + << "Well2::WellProductionProperties { " << "oil rate: " << wp.OilRate << ", " << "water rate: " << wp.WaterRate << ", " << "gas rate: " << wp.GasRate << ", " @@ -250,36 +247,35 @@ namespace Opm { << "THPH: " << wp.THPH << ", " << "VFP table: " << wp.VFPTableNumber << ", " << "ALQ: " << wp.ALQValue << ", " - << "WHISTCTL: " << wp.whistctl_cmode << ", " + << "WHISTCTL: " << Well2::ProducerCMode2String(wp.whistctl_cmode) << ", " << "prediction: " << wp.predictionMode << " }"; } - bool WellProductionProperties::effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode) { +bool Well2::WellProductionProperties::effectiveHistoryProductionControl(const Well2::ProducerCMode cmode) { // Note, not handling CRAT for now - namespace wp = WellProducer; - return ( (cmode == wp::LRAT || cmode == wp::RESV || cmode == wp::ORAT || - cmode == wp::WRAT || cmode == wp::GRAT || cmode == wp::BHP) ); + return ( (cmode == ProducerCMode::LRAT || cmode == ProducerCMode::RESV || cmode == ProducerCMode::ORAT || + cmode == ProducerCMode::WRAT || cmode == ProducerCMode::GRAT || cmode == ProducerCMode::BHP) ); } - void WellProductionProperties::resetDefaultBHPLimit() { + void Well2::WellProductionProperties::resetDefaultBHPLimit() { BHPLimit = UDAValue( 1. * unit::atm ); } - void WellProductionProperties::clearControls() { + void Well2::WellProductionProperties::clearControls() { m_productionControls = 0; } - void WellProductionProperties::setBHPLimit(const double limit) { + void Well2::WellProductionProperties::setBHPLimit(const double limit) { BHPLimit = UDAValue( limit ); } - double WellProductionProperties::getBHPLimit() const { + double Well2::WellProductionProperties::getBHPLimit() const { return BHPLimit.get(); } - ProductionControls WellProductionProperties::controls(const SummaryState& st, double udq_undefined) const { - ProductionControls controls(this->m_productionControls); + Well2::ProductionControls Well2::WellProductionProperties::controls(const SummaryState& st, double udq_undefined) const { + Well2::ProductionControls controls(this->m_productionControls); controls.oil_rate = UDA::eval_well_uda(this->OilRate, this->name, st, udq_undefined); controls.water_rate = UDA::eval_well_uda(this->WaterRate, this->name, st, udq_undefined); @@ -298,7 +294,7 @@ namespace Opm { return controls; } - bool WellProductionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const { + bool Well2::WellProductionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const { int update_count = 0; update_count += active.update(udq_config, this->OilRate, this->name, UDAControl::WCONPROD_ORAT); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp index 0d6077d8a..56f7b264e 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp @@ -119,7 +119,7 @@ namespace Opm { throw std::runtime_error("No well named " + well.name + " is found in wells_ecl."); // if the well is SHUT, we do not consider to test it - if (well_ecl->getStatus() != WellCommon::OPEN) + if (well_ecl->getStatus() != Well2::Status::OPEN) continue; if (well.closed && config.has(well.name, well.reason)) { diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp index 389ca5268..457c0c652 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp @@ -22,27 +22,27 @@ #include #include -#include +#include #include "injection.hpp" namespace Opm { namespace injection { - double rateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem) { + double rateToSI(double rawRate, Well2::InjectorType wellType, const Opm::UnitSystem &unitSystem) { switch (wellType) { - case WellInjector::MULTI: + case Well2::InjectorType::MULTI: // multi-phase controlled injectors are a really funny // construct in Eclipse: the quantity controlled for is // not physically meaningful, i.e. Eclipse adds up // MCFT/day and STB/day. throw std::logic_error("There is no generic way to handle multi-phase injectors at this level!"); - case WellInjector::OIL: - case WellInjector::WATER: + case Well2::InjectorType::OIL: + case Well2::InjectorType::WATER: return unitSystem.to_si( UnitSystem::measure::liquid_surface_rate, rawRate ); - case WellInjector::GAS: + case Well2::InjectorType::GAS: return unitSystem.to_si( UnitSystem::measure::gas_surface_rate, rawRate ); default: diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.hpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.hpp index dfd18ca2f..d1b5023ae 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.hpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.hpp @@ -20,13 +20,13 @@ #ifndef INJECTION_HPP #define INJECTION_HPP -#include #include +#include namespace Opm { namespace injection { -double rateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem); +double rateToSI(double rawRate, Well2::InjectorType wellType, const Opm::UnitSystem &unitSystem); double rateToSI(double rawRate, Phase wellPhase, const Opm::UnitSystem& unitSystem); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp index bfa08f684..60be710c9 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp @@ -46,7 +46,7 @@ namespace UDA { } -double eval_well_uda_rate(const UDAValue& value, const std::string& well, const SummaryState& st, double udq_default, WellInjector::TypeEnum wellType, const UnitSystem& unitSystem) { +double eval_well_uda_rate(const UDAValue& value, const std::string& well, const SummaryState& st, double udq_default, Well2::InjectorType wellType, const UnitSystem& unitSystem) { double raw_rate = eval_well_uda(value, well, st, udq_default); return injection::rateToSI(raw_rate, wellType, unitSystem); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.hpp b/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.hpp index a220ceb1e..c5daef3ae 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.hpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.hpp @@ -22,7 +22,7 @@ #include -#include +#include namespace Opm { class UDAvalue; @@ -32,7 +32,7 @@ class UnitSystem; namespace UDA { double eval_well_uda(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined); - double eval_well_uda_rate(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined, WellInjector::TypeEnum wellType, const UnitSystem& unitSystem); +double eval_well_uda_rate(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined, Well2::InjectorType wellType, const UnitSystem& unitSystem); double eval_group_uda(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined); double eval_group_uda_rate(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined, Phase phase, const UnitSystem& unitSystem); diff --git a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp index 5dff49afc..de70ffc83 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp @@ -36,7 +36,6 @@ #include #include -#include // Phase::PhaseEnum #include #include #include diff --git a/tests/msim/test_msim_ACTIONX.cpp b/tests/msim/test_msim_ACTIONX.cpp index 4698a14cb..aa39e7cdb 100644 --- a/tests/msim/test_msim_ACTIONX.cpp +++ b/tests/msim/test_msim_ACTIONX.cpp @@ -142,14 +142,14 @@ BOOST_AUTO_TEST_CASE(UDQ_SORTA_EXAMPLE) { { const auto& w1 = td.schedule.getWell2("P1", 1); const auto& w4 = td.schedule.getWell2("P4", 1); - BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w4.getStatus(), WellCommon::StatusEnum::OPEN ); + BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w4.getStatus() == Well2::Status::OPEN ); } { const auto& w1 = td.schedule.getWell2atEnd("P1"); const auto& w4 = td.schedule.getWell2atEnd("P4"); - BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w4.getStatus(), WellCommon::StatusEnum::SHUT ); + BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w4.getStatus() == Well2::Status::SHUT ); } test_work_area_free(work_area); @@ -182,10 +182,10 @@ BOOST_AUTO_TEST_CASE(WELL_CLOSE_EXAMPLE) { const auto& w3 = td.schedule.getWell2("P3", 15); const auto& w4 = td.schedule.getWell2("P4", 15); - BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w2.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w3.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w4.getStatus(), WellCommon::StatusEnum::OPEN ); + BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w2.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w3.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w4.getStatus() == Well2::Status::OPEN ); } @@ -193,20 +193,20 @@ BOOST_AUTO_TEST_CASE(WELL_CLOSE_EXAMPLE) { { const auto& w1 = td.schedule.getWell2("P1", 15); const auto& w3 = td.schedule.getWell2("P3", 15); - BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w3.getStatus(), WellCommon::StatusEnum::OPEN ); + BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w3.getStatus() == Well2::Status::OPEN ); } { const auto& w2_5 = td.schedule.getWell2("P2", 5); const auto& w2_6 = td.schedule.getWell2("P2", 6); - BOOST_CHECK_EQUAL(w2_5.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w2_6.getStatus(), WellCommon::StatusEnum::SHUT ); + BOOST_CHECK(w2_5.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w2_6.getStatus() == Well2::Status::SHUT ); } { const auto& w4_10 = td.schedule.getWell2("P4", 10); const auto& w4_11 = td.schedule.getWell2("P4", 11); - BOOST_CHECK_EQUAL(w4_10.getStatus(), WellCommon::StatusEnum::OPEN ); - BOOST_CHECK_EQUAL(w4_11.getStatus(), WellCommon::StatusEnum::SHUT ); + BOOST_CHECK(w4_10.getStatus() == Well2::Status::OPEN ); + BOOST_CHECK(w4_11.getStatus() == Well2::Status::SHUT ); } test_work_area_free(work_area); diff --git a/tests/parser/ConnectionTests.cpp b/tests/parser/ConnectionTests.cpp index 1f086be29..545f54e59 100644 --- a/tests/parser/ConnectionTests.cpp +++ b/tests/parser/ConnectionTests.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -67,10 +66,10 @@ BOOST_AUTO_TEST_CASE(CreateWellConnectionsOK) { BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) { - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + auto dir = Opm::Connection::Direction::Z; Opm::WellConnections completionSet(1,1); - Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true); - Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true); + Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true); + Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true); completionSet.add( completion1 ); BOOST_CHECK_EQUAL( 1U , completionSet.size() ); @@ -82,9 +81,9 @@ BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) { BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) { - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; - Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); - Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + auto dir = Opm::Connection::Direction::Z; + Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); Opm::WellConnections completionSet(1,1); completionSet.add( completion1 ); BOOST_CHECK_EQUAL( 1U , completionSet.size() ); @@ -100,12 +99,12 @@ BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) { BOOST_AUTO_TEST_CASE(AddCompletionCopy) { - Opm::WellConnections completionSet(10,10); - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + Opm::WellConnections completionSet(10,10); + auto dir = Opm::Connection::Direction::Z; - Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); - Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); - Opm::Connection completion3( 10,10,12, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion3( 10,10,12, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); completionSet.add( completion1 ); completionSet.add( completion2 ); @@ -123,11 +122,11 @@ BOOST_AUTO_TEST_CASE(AddCompletionCopy) { BOOST_AUTO_TEST_CASE(ActiveCompletions) { Opm::EclipseGrid grid(10,20,20); - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + auto dir = Opm::Connection::Direction::Z; Opm::WellConnections completions(10,10); - Opm::Connection completion1( 0,0,0, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); - Opm::Connection completion2( 0,0,1, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); - Opm::Connection completion3( 0,0,2, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion1( 0,0,0, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion2( 0,0,1, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); + Opm::Connection completion3( 0,0,2, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true); completions.add( completion1 ); completions.add( completion2 ); diff --git a/tests/parser/EclipseStateTests.cpp b/tests/parser/EclipseStateTests.cpp index cf6b7d331..e8b4df0d5 100644 --- a/tests/parser/EclipseStateTests.cpp +++ b/tests/parser/EclipseStateTests.cpp @@ -28,7 +28,6 @@ along with OPM. If not, see . #include #include -#include #include #include #include diff --git a/tests/parser/GroupTests.cpp b/tests/parser/GroupTests.cpp index 8c829f370..38c939a76 100644 --- a/tests/parser/GroupTests.cpp +++ b/tests/parser/GroupTests.cpp @@ -75,8 +75,8 @@ BOOST_AUTO_TEST_CASE(CreateGroup_SetInjectorProducer_CorrectStatusSet) { BOOST_AUTO_TEST_CASE(ControlModeOK) { Opm::Group2 group("G1" , 1, 0, 0, UnitSystem::newMETRIC()); Opm::SummaryState st; - const auto& prod = group.productionControls(st); - BOOST_CHECK_EQUAL( Opm::GroupInjection::NONE , prod.cmode); + const auto& inj = group.injectionControls(st); + BOOST_CHECK( Opm::Group2::InjectionCMode::NONE == inj.cmode); } @@ -183,12 +183,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithWGRUPCONandWCONPROD) { Runspec runspec (deck ); Opm::Schedule schedule(deck, grid, eclipseProperties, runspec); const auto& currentWell = schedule.getWell2("B-37T2", 0); - const Opm::WellProductionProperties& wellProductionProperties = currentWell.getProductionProperties(); - BOOST_CHECK_EQUAL(wellProductionProperties.controlMode, Opm::WellProducer::ControlModeEnum::GRUP); + const Opm::Well2::WellProductionProperties& wellProductionProperties = currentWell.getProductionProperties(); + BOOST_CHECK(wellProductionProperties.controlMode == Opm::Well2::ProducerCMode::GRUP); BOOST_CHECK_EQUAL(currentWell.isAvailableForGroupControl(), true); BOOST_CHECK_EQUAL(currentWell.getGuideRate(), 30); - BOOST_CHECK_EQUAL(currentWell.getGuideRatePhase(), Opm::GuideRate::OIL); + BOOST_CHECK(currentWell.getGuideRatePhase() == Opm::Well2::GuideRateTarget::OIL); BOOST_CHECK_EQUAL(currentWell.getGuideRateScalingFactor(), 1.0); @@ -292,16 +292,16 @@ BOOST_AUTO_TEST_CASE(createDeckWithGCONPROD) { auto ctrl1 = group1.productionControls(st); auto ctrl2 = group2.productionControls(st); - BOOST_CHECK_EQUAL(ctrl1.exceed_action, GroupProductionExceedLimit::RATE); - BOOST_CHECK_EQUAL(ctrl2.exceed_action, GroupProductionExceedLimit::CON); + BOOST_CHECK(ctrl1.exceed_action == Group2::ExceedAction::RATE); + BOOST_CHECK(ctrl2.exceed_action == Group2::ExceedAction::CON); } BOOST_AUTO_TEST_CASE(TESTGuideRateModel) { Opm::GuideRateModel grc_default; - BOOST_CHECK_THROW(Opm::GuideRateModel(0.0,GuideRateTarget::NONE, -5,0,0,0,0,0,true,1,true), std::invalid_argument); + BOOST_CHECK_THROW(Opm::GuideRateModel(0.0,GuideRateModel::Target::NONE, -5,0,0,0,0,0,true,1,true), std::invalid_argument); BOOST_CHECK_THROW(grc_default.eval(1,0.50,0.50), std::invalid_argument); - Opm::GuideRateModel grc_delay(10, GuideRateTarget::NONE, 1,1,0,0,0,0,true,1,true); + Opm::GuideRateModel grc_delay(10, GuideRateModel::Target::NONE, 1,1,0,0,0,0,true,1,true); BOOST_CHECK_NO_THROW(grc_delay.eval(1.0, 0.5, 0.5)); } diff --git a/tests/parser/MultisegmentWellTests.cpp b/tests/parser/MultisegmentWellTests.cpp index 3f8966393..b97133c75 100644 --- a/tests/parser/MultisegmentWellTests.cpp +++ b/tests/parser/MultisegmentWellTests.cpp @@ -34,24 +34,23 @@ #include #include -#include #include #include BOOST_AUTO_TEST_CASE(MultisegmentWellTest) { - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + auto dir = Opm::Connection::Direction::Z; Opm::WellConnections connection_set(10,10); Opm::EclipseGrid grid(20,20,20); - connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); @@ -129,17 +128,17 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) { } BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) { - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + auto dir = Opm::Connection::Direction::Z; Opm::WellConnections connection_set(10,10); Opm::EclipseGrid grid(20,20,20); - connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); @@ -186,17 +185,17 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) { } BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) { - Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + auto dir = Opm::Connection::Direction::Z; Opm::WellConnections connection_set(10,10); Opm::EclipseGrid grid(20,20,20); - connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); - connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index d865e3eae..d6f802f1c 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -399,9 +399,9 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) { Runspec runspec (deck); Schedule schedule(deck, grid , eclipseProperties, runspec); - BOOST_CHECK_THROW( schedule.getChildWells2( "NO_SUCH_GROUP" , 1 , GroupWellQueryMode::Recursive), std::invalid_argument); + BOOST_CHECK_THROW( schedule.getChildWells2( "NO_SUCH_GROUP" , 1 ), std::invalid_argument); { - auto field_wells = schedule.getChildWells2("FIELD" , 0, GroupWellQueryMode::Recursive); + auto field_wells = schedule.getChildWells2("FIELD" , 0); BOOST_CHECK_EQUAL( field_wells.size() , 4U); BOOST_CHECK( has_well( field_wells, "DW_0" )); @@ -411,7 +411,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) { } { - auto platform_wells = schedule.getChildWells2("PLATFORM" , 0, GroupWellQueryMode::Recursive); + auto platform_wells = schedule.getChildWells2("PLATFORM" , 0); BOOST_CHECK_EQUAL( platform_wells.size() , 4U); BOOST_CHECK( has_well( platform_wells, "DW_0" )); @@ -421,7 +421,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) { } { - auto child_wells1 = schedule.getChildWells2("CG1" , 0, GroupWellQueryMode::Recursive); + auto child_wells1 = schedule.getChildWells2("CG1" , 0); BOOST_CHECK_EQUAL( child_wells1.size() , 2U); BOOST_CHECK( has_well( child_wells1, "DW_0" )); @@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) { } { - auto parent_wells2 = schedule.getChildWells2("PG2" , 0, GroupWellQueryMode::Recursive); + auto parent_wells2 = schedule.getChildWells2("PG2" , 0); BOOST_CHECK_EQUAL( parent_wells2.size() , 2U); BOOST_CHECK( has_well( parent_wells2, "BW_2" )); @@ -584,12 +584,12 @@ BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) { BOOST_CHECK_EQUAL(schedule.getWell2("BAN", 0).getAllowCrossFlow(), false); BOOST_CHECK_EQUAL(schedule.getWell2("ALLOW", 0).getAllowCrossFlow(), true); BOOST_CHECK_EQUAL(schedule.getWell2("DEFAULT", 0).getAllowCrossFlow(), true); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, schedule.getWell2("BAN", 0).getStatus()); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, schedule.getWell2("BAN", 1).getStatus()); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, schedule.getWell2("BAN", 2).getStatus()); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, schedule.getWell2("BAN", 3).getStatus()); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, schedule.getWell2("BAN", 4).getStatus()); // not allow to open - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, schedule.getWell2("BAN", 5).getStatus()); + BOOST_CHECK(Well2::Status::SHUT == schedule.getWell2("BAN", 0).getStatus()); + BOOST_CHECK(Well2::Status::OPEN == schedule.getWell2("BAN", 1).getStatus()); + BOOST_CHECK(Well2::Status::OPEN == schedule.getWell2("BAN", 2).getStatus()); + BOOST_CHECK(Well2::Status::SHUT == schedule.getWell2("BAN", 3).getStatus()); + BOOST_CHECK(Well2::Status::SHUT == schedule.getWell2("BAN", 4).getStatus()); // not allow to open + BOOST_CHECK(Well2::Status::OPEN == schedule.getWell2("BAN", 5).getStatus()); } static Deck createDeckWithWellsAndConnectionDataWithWELOPEN() { @@ -654,43 +654,43 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndConnectionDataWithWELOPEN) { Runspec runspec (deck); Schedule schedule(deck ,grid , eclipseProperties, runspec); { - constexpr auto well_shut = WellCommon::StatusEnum::SHUT; - constexpr auto well_open = WellCommon::StatusEnum::OPEN; + constexpr auto well_shut = Well2::Status::SHUT; + constexpr auto well_open = Well2::Status::OPEN; - BOOST_CHECK_EQUAL(well_shut, schedule.getWell2("OP_1", 3).getStatus( )); - BOOST_CHECK_EQUAL(well_open, schedule.getWell2("OP_1", 4).getStatus( )); - BOOST_CHECK_EQUAL(well_shut, schedule.getWell2("OP_1", 5).getStatus( )); + BOOST_CHECK(well_shut == schedule.getWell2("OP_1", 3).getStatus( )); + BOOST_CHECK(well_open == schedule.getWell2("OP_1", 4).getStatus( )); + BOOST_CHECK(well_shut == schedule.getWell2("OP_1", 5).getStatus( )); } { - constexpr auto comp_shut = WellCompletion::StateEnum::SHUT; - constexpr auto comp_open = WellCompletion::StateEnum::OPEN; + constexpr auto comp_shut = Connection::State::SHUT; + constexpr auto comp_open = Connection::State::OPEN; { const auto& well = schedule.getWell2("OP_2", 3); const auto& cs = well.getConnections( ); BOOST_CHECK_EQUAL( 7U, cs.size() ); - BOOST_CHECK_EQUAL(comp_shut, cs.getFromIJK( 7, 6, 2 ).state()); - BOOST_CHECK_EQUAL(comp_shut, cs.getFromIJK( 7, 6, 3 ).state()); - BOOST_CHECK_EQUAL(comp_shut, cs.getFromIJK( 7, 6, 4 ).state()); - BOOST_CHECK_EQUAL(comp_open, cs.getFromIJK( 7, 7, 2 ).state()); + BOOST_CHECK(comp_shut == cs.getFromIJK( 7, 6, 2 ).state()); + BOOST_CHECK(comp_shut == cs.getFromIJK( 7, 6, 3 ).state()); + BOOST_CHECK(comp_shut == cs.getFromIJK( 7, 6, 4 ).state()); + BOOST_CHECK(comp_open == cs.getFromIJK( 7, 7, 2 ).state()); } { const auto& well = schedule.getWell2("OP_2", 4); const auto& cs2 = well.getConnections( ); - BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 6, 2 ).state()); - BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 6, 3 ).state()); - BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 6, 4 ).state()); - BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 7, 2 ).state()); + BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 6, 2 ).state()); + BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 6, 3 ).state()); + BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 6, 4 ).state()); + BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 7, 2 ).state()); } { const auto& well = schedule.getWell2("OP_3", 3); const auto& cs3 = well.getConnections( ); - BOOST_CHECK_EQUAL(comp_shut, cs3.get( 0 ).state()); + BOOST_CHECK(comp_shut == cs3.get( 0 ).state()); } { const auto& well = schedule.getWell2("OP_3", 4); const auto& cs4 = well.getConnections( ); - BOOST_CHECK_EQUAL(comp_open, cs4.get( 0 ).state()); + BOOST_CHECK(comp_open == cs4.get( 0 ).state()); } } } @@ -739,8 +739,8 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_TryToOpenWellWithShutCompleti Schedule schedule(deck , grid , eclipseProperties, runspec); const auto& well2_3 = schedule.getWell2("OP_1",3); const auto& well2_4 = schedule.getWell2("OP_1",4); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well2_3.getStatus()); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well2_4.getStatus()); + BOOST_CHECK(Well2::Status::SHUT == well2_3.getStatus()); + BOOST_CHECK(Well2::Status::SHUT == well2_4.getStatus()); } BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_CombineShutCompletionsAndAddNewCompletionsDoNotShutWell) { @@ -801,14 +801,14 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_CombineShutCompletionsAndAddN const auto& well_4 = schedule.getWell2("OP_1", 4); const auto& well_5 = schedule.getWell2("OP_1", 5); // timestep 3. Close all completions with WELOPEN and immediately open new completions with COMPDAT. - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, well_3.getStatus()); + BOOST_CHECK(Well2::Status::OPEN == well_3.getStatus()); BOOST_CHECK( !schedule.hasWellEvent( "OP_1", ScheduleEvents::WELL_STATUS_CHANGE , 3 )); // timestep 4. Close all completions with WELOPEN. The well will be shut since no completions // are open. - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well_4.getStatus()); + BOOST_CHECK(Well2::Status::SHUT == well_4.getStatus()); BOOST_CHECK( schedule.hasWellEvent( "OP_1", ScheduleEvents::WELL_STATUS_CHANGE , 4 )); // timestep 5. Open new completions. But keep the well shut, - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well_5.getStatus()); + BOOST_CHECK(Well2::Status::SHUT == well_5.getStatus()); } BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFT) { @@ -914,7 +914,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) { Runspec runspec (deck); Schedule schedule(deck, grid , eclipseProperties, runspec); const auto& well = schedule.getWell2("OP_1", 4); - BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, well.getStatus()); + BOOST_CHECK(Well2::Status::OPEN == well.getStatus()); const auto& rft_config = schedule.rftConfig(); BOOST_CHECK_EQUAL(rft_config.rft("OP_1", 3),false); @@ -1197,15 +1197,15 @@ 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)); + BOOST_CHECK(g.has_control(Group2::ProductionCMode::ORAT)); + BOOST_CHECK(!g.has_control(Group2::ProductionCMode::WRAT)); BOOST_CHECK_EQUAL(g.productionControls(st).guide_rate, 0); } { 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); @@ -1238,7 +1238,8 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDT) { const auto& ovap = schedule.getOilVaporizationProperties(currentStep); BOOST_CHECK_EQUAL(true, ovap.getOption(0)); - BOOST_CHECK_EQUAL(ovap.getType(), Opm::OilVaporizationEnum::DRDT); + BOOST_CHECK(ovap.getType() == OilVaporizationProperties::OilVaporization::DRDT); + BOOST_CHECK_EQUAL(true, ovap.drsdtActive()); BOOST_CHECK_EQUAL(false, ovap.drvdtActive()); } @@ -1276,7 +1277,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTR) { BOOST_CHECK_EQUAL(true, ovap.getOption(i)); } - BOOST_CHECK_EQUAL(ovap.getType(), Opm::OilVaporizationEnum::DRDT); + BOOST_CHECK(ovap.getType() == OilVaporizationProperties::OilVaporization::DRDT); BOOST_CHECK_EQUAL(true, ovap.drsdtActive()); BOOST_CHECK_EQUAL(false, ovap.drvdtActive()); } @@ -1316,19 +1317,19 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTthenDRVDT) { BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true); const OilVaporizationProperties& ovap1 = schedule.getOilVaporizationProperties(1); - BOOST_CHECK_EQUAL(ovap1.getType(), Opm::OilVaporizationEnum::DRDT); + BOOST_CHECK(ovap1.getType() == OilVaporizationProperties::OilVaporization::DRDT); BOOST_CHECK_EQUAL(true, ovap1.drsdtActive()); BOOST_CHECK_EQUAL(false, ovap1.drvdtActive()); const OilVaporizationProperties& ovap2 = schedule.getOilVaporizationProperties(2); //double value = ovap2.getMaxDRVDT(0); //BOOST_CHECK_EQUAL(1.1574074074074074e-06, value); - BOOST_CHECK_EQUAL(ovap2.getType(), Opm::OilVaporizationEnum::DRDT); + BOOST_CHECK(ovap2.getType() == OilVaporizationProperties::OilVaporization::DRDT); BOOST_CHECK_EQUAL(true, ovap2.drvdtActive()); BOOST_CHECK_EQUAL(true, ovap2.drsdtActive()); const OilVaporizationProperties& ovap3 = schedule.getOilVaporizationProperties(3); - BOOST_CHECK_EQUAL(ovap3.getType(), Opm::OilVaporizationEnum::VAPPARS); + BOOST_CHECK(ovap3.getType() == OilVaporizationProperties::OilVaporization::VAPPARS); BOOST_CHECK_EQUAL(false, ovap3.drvdtActive()); BOOST_CHECK_EQUAL(false, ovap3.drsdtActive()); @@ -1357,7 +1358,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithVAPPARS) { size_t currentStep = 1; BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true); const OilVaporizationProperties& ovap = schedule.getOilVaporizationProperties(currentStep); - BOOST_CHECK_EQUAL(ovap.getType(), Opm::OilVaporizationEnum::VAPPARS); + BOOST_CHECK(ovap.getType() == OilVaporizationProperties::OilVaporization::VAPPARS); double vap1 = ovap.getVap1(0); BOOST_CHECK_EQUAL(2, vap1); double vap2 = ovap.getVap2(0); @@ -1455,13 +1456,13 @@ BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) { BOOST_CHECK_EQUAL(sched.getWell2("I", 1).getInjectionProperties().BHPLimit.get(), 600 * 1e5); // 1 BOOST_CHECK_EQUAL(sched.getWell2("I", 2).getInjectionProperties().BHPLimit.get(), 600 * 1e5); // 2 - BOOST_CHECK_EQUAL(sched.getWell2("I", 2).getInjectionProperties().hasInjectionControl(Opm::WellInjector::BHP), true); + BOOST_CHECK_EQUAL(sched.getWell2("I", 2).getInjectionProperties().hasInjectionControl(Opm::Well2::InjectorCMode::BHP), true); // The well is producer for timestep 3 and the injection properties BHPLimit should be set to zero. BOOST_CHECK(sched.getWell2("I", 3).isProducer()); BOOST_CHECK_EQUAL(sched.getWell2("I", 3).getInjectionProperties().BHPLimit.get(), 0); // 3 - BOOST_CHECK_EQUAL(sched.getWell2("I", 3).getProductionProperties().hasProductionControl(Opm::WellProducer::BHP), true ); - BOOST_CHECK_EQUAL(sched.getWell2("I", 4).getInjectionProperties().hasInjectionControl(Opm::WellInjector::BHP), true ); + BOOST_CHECK_EQUAL(sched.getWell2("I", 3).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::BHP), true ); + BOOST_CHECK_EQUAL(sched.getWell2("I", 4).getInjectionProperties().hasInjectionControl(Opm::Well2::InjectorCMode::BHP), true ); BOOST_CHECK_EQUAL(sched.getWell2("I", 4).getInjectionProperties().BHPLimit.get(), 6891.2 * 1e5); // 4 } @@ -1538,20 +1539,20 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) { BOOST_CHECK_THROW(schedule.getWell2("P2", 0), std::invalid_argument); //10 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT); + BOOST_CHECK(schedule.getWell2("P1", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT); + BOOST_CHECK(schedule.getWell2("P2", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT); //15 OKT 2008 { const auto& props1 = schedule.getWell2("P1", 2).getProductionProperties(); const auto& props2 = schedule.getWell2("P2", 2).getProductionProperties(); - BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::RESV); - BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::RESV); + BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::RESV); + BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::RESV); // under history mode, a producing well should have only one rate target/limit or have no rate target/limit. // the rate target/limit from previous report step should not be kept. - BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::ORAT) ); + BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); } //18 OKT 2008 @@ -1559,11 +1560,11 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) { const auto& props1 = schedule.getWell2("P1", 3).getProductionProperties(); const auto& props2 = schedule.getWell2("P2", 3).getProductionProperties(); - BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::RESV); - BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::RESV); + BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::RESV); + BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::RESV); - BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::ORAT) ); + BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); } // 20 OKT 2008 @@ -1571,13 +1572,13 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) { const auto& props1 = schedule.getWell2("P1", 4).getProductionProperties(); const auto& props2 = schedule.getWell2("P2", 4).getProductionProperties(); - BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::LRAT); - BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::LRAT); + BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::LRAT); + BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::LRAT); - BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::RESV) ); - BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::RESV) ); + BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); + BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); } // 25 OKT 2008 @@ -1585,13 +1586,13 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) { const auto& props1 = schedule.getWell2("P1", 5).getProductionProperties(); const auto& props2 = schedule.getWell2("P2", 5).getProductionProperties(); - BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::ORAT); - BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::ORAT); + BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::ORAT); + BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::ORAT); - BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::LRAT) ); - BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::LRAT) ); - BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::RESV) ); - BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::RESV) ); + BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::LRAT) ); + BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::LRAT) ); + BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); + BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); } } @@ -1644,17 +1645,17 @@ BOOST_AUTO_TEST_CASE(fromWCONHISTtoWCONPROD) { BOOST_CHECK_THROW(schedule.getWell2("P2", 0), std::invalid_argument); //10 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT); + BOOST_CHECK(schedule.getWell2("P1", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT); + BOOST_CHECK(schedule.getWell2("P2", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT); //15 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 2).getProductionProperties().controlMode, Opm::WellProducer::GRAT); - BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::WRAT) ); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 2).getProductionProperties().controlMode, Opm::WellProducer::WRAT); - BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::GRAT) ); + BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::GRAT); + BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::WRAT) ); + BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::WRAT); + BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::GRAT) ); // the previous control limits/targets should not stay - BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); } BOOST_AUTO_TEST_CASE(WHISTCTL_NEW_WELL) { @@ -1728,38 +1729,38 @@ BOOST_AUTO_TEST_CASE(WHISTCTL_NEW_WELL) { Schedule schedule(deck, grid , eclipseProperties, runspec); //10 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 1).getProductionProperties().controlMode, Opm::WellProducer::GRAT); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 1).getProductionProperties().controlMode, Opm::WellProducer::GRAT); + BOOST_CHECK(schedule.getWell2("P1", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::GRAT); + BOOST_CHECK(schedule.getWell2("P2", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::GRAT); //15 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 2).getProductionProperties().controlMode, Opm::WellProducer::RESV); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 2).getProductionProperties().controlMode, Opm::WellProducer::RESV); + BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV); + BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV); // under history mode, a producing well should have only one rate target/limit or have no rate target/limit. // the rate target/limit from previous report step should not be kept. - BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); //18 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 3).getProductionProperties().controlMode, Opm::WellProducer::RESV); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 3).getProductionProperties().controlMode, Opm::WellProducer::RESV); - BOOST_CHECK( !schedule.getWell2("P1", 3).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !schedule.getWell2("P2", 3).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); + BOOST_CHECK(schedule.getWell2("P1", 3).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV); + BOOST_CHECK(schedule.getWell2("P2", 3).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV); + BOOST_CHECK( !schedule.getWell2("P1", 3).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P2", 3).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); // 20 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 4).getProductionProperties().controlMode, Opm::WellProducer::LRAT); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 4).getProductionProperties().controlMode, Opm::WellProducer::LRAT); - BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) ); - BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) ); - BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) ); + BOOST_CHECK(schedule.getWell2("P1", 4).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::LRAT); + BOOST_CHECK(schedule.getWell2("P2", 4).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::LRAT); + BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) ); + BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); + BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); // 25 OKT 2008 - BOOST_CHECK_EQUAL(schedule.getWell2("P1", 5).getProductionProperties().controlMode, Opm::WellProducer::ORAT); - BOOST_CHECK_EQUAL(schedule.getWell2("P2", 5).getProductionProperties().controlMode, Opm::WellProducer::ORAT); - BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) ); - BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) ); - BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::LRAT) ); - BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::LRAT) ); + BOOST_CHECK(schedule.getWell2("P1", 5).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT); + BOOST_CHECK(schedule.getWell2("P2", 5).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT); + BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); + BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) ); + BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::LRAT) ); + BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::LRAT) ); } @@ -2201,8 +2202,8 @@ BOOST_AUTO_TEST_CASE( complump ) { / )"; - constexpr auto open = WellCompletion::StateEnum::OPEN; - constexpr auto shut = WellCompletion::StateEnum::SHUT; + constexpr auto open = Connection::State::OPEN; + constexpr auto shut = Connection::State::SHUT; auto deck = Parser().parseString(input); EclipseGrid grid(10,10,10); @@ -2217,15 +2218,15 @@ BOOST_AUTO_TEST_CASE( complump ) { BOOST_CHECK_EQUAL( 1, sc0.getFromIJK( 2, 2, 1 ).complnum() ); BOOST_CHECK_EQUAL( 1, sc0.getFromIJK( 2, 2, 2 ).complnum() ); - BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 0 ).state() ); - BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 1 ).state() ); - BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 2 ).state() ); + BOOST_CHECK( shut == sc0.getFromIJK( 2, 2, 0 ).state() ); + BOOST_CHECK( shut == sc0.getFromIJK( 2, 2, 1 ).state() ); + BOOST_CHECK( shut == sc0.getFromIJK( 2, 2, 2 ).state() ); const auto& sc1 = schedule.getWell2("W1", 1).getConnections(); - BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 0 ).state() ); - BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 1 ).state() ); - BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 2 ).state() ); - BOOST_CHECK_EQUAL( shut, sc1.getFromIJK( 2, 2, 3 ).state() ); + BOOST_CHECK( open == sc1.getFromIJK( 2, 2, 0 ).state() ); + BOOST_CHECK( open == sc1.getFromIJK( 2, 2, 1 ).state() ); + BOOST_CHECK( open == sc1.getFromIJK( 2, 2, 2 ).state() ); + BOOST_CHECK( shut == sc1.getFromIJK( 2, 2, 3 ).state() ); const auto& completions = schedule.getWell2("W1", 1).getCompletions(); BOOST_CHECK_EQUAL(completions.size(), 4); @@ -2291,8 +2292,8 @@ BOOST_AUTO_TEST_CASE( COMPLUMP_specific_coordinates ) { / )"; - constexpr auto open = WellCompletion::StateEnum::OPEN; - constexpr auto shut = WellCompletion::StateEnum::SHUT; + constexpr auto open = Connection::State::OPEN; + constexpr auto shut = Connection::State::SHUT; auto deck = Parser().parseString( input); EclipseGrid grid( 10, 10, 10 ); @@ -2304,50 +2305,50 @@ BOOST_AUTO_TEST_CASE( COMPLUMP_specific_coordinates ) { const auto& cs1 = schedule.getWell2("W1", 1).getConnections(); const auto& cs2 = schedule.getWell2("W1", 2).getConnections(); BOOST_CHECK_EQUAL( 9U, cs1.size() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 0, 0, 1 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 2, 2, 0 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 2, 2, 1 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 2, 2, 2 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 0 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 3 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 4 ).state() ); - BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 5 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 0, 0, 1 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 2, 2, 0 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 2, 2, 1 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 2, 2, 2 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 0 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 3 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 4 ).state() ); + BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 5 ).state() ); - BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 0, 0, 1 ).state() ); - BOOST_CHECK_EQUAL( shut, cs2.getFromIJK( 2, 2, 0 ).state() ); - BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 2, 2, 1 ).state() ); - BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 2, 2, 2 ).state() ); - BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 1, 1, 0 ).state() ); - BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 1, 1, 3 ).state() ); - BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 1, 1, 4 ).state() ); - BOOST_CHECK_EQUAL( shut, cs2.getFromIJK( 1, 1, 5 ).state() ); + BOOST_CHECK( open == cs2.getFromIJK( 0, 0, 1 ).state() ); + BOOST_CHECK( shut == cs2.getFromIJK( 2, 2, 0 ).state() ); + BOOST_CHECK( open == cs2.getFromIJK( 2, 2, 1 ).state() ); + BOOST_CHECK( open == cs2.getFromIJK( 2, 2, 2 ).state() ); + BOOST_CHECK( open == cs2.getFromIJK( 1, 1, 0 ).state() ); + BOOST_CHECK( open == cs2.getFromIJK( 1, 1, 3 ).state() ); + BOOST_CHECK( open == cs2.getFromIJK( 1, 1, 4 ).state() ); + BOOST_CHECK( shut == cs2.getFromIJK( 1, 1, 5 ).state() ); } BOOST_AUTO_TEST_CASE(TestCompletionStateEnum2String) { - BOOST_CHECK_EQUAL( "AUTO" , WellCompletion::StateEnum2String(WellCompletion::AUTO)); - BOOST_CHECK_EQUAL( "OPEN" , WellCompletion::StateEnum2String(WellCompletion::OPEN)); - BOOST_CHECK_EQUAL( "SHUT" , WellCompletion::StateEnum2String(WellCompletion::SHUT)); + BOOST_CHECK( "AUTO" == Connection::State2String(Connection::State::AUTO)); + BOOST_CHECK( "OPEN" == Connection::State2String(Connection::State::OPEN)); + BOOST_CHECK( "SHUT" == Connection::State2String(Connection::State::SHUT)); } BOOST_AUTO_TEST_CASE(TestCompletionStateEnumFromString) { - BOOST_CHECK_THROW( WellCompletion::StateEnumFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL( WellCompletion::AUTO , WellCompletion::StateEnumFromString("AUTO")); - BOOST_CHECK_EQUAL( WellCompletion::SHUT , WellCompletion::StateEnumFromString("SHUT")); - BOOST_CHECK_EQUAL( WellCompletion::SHUT , WellCompletion::StateEnumFromString("STOP")); - BOOST_CHECK_EQUAL( WellCompletion::OPEN , WellCompletion::StateEnumFromString("OPEN")); + BOOST_CHECK_THROW( Connection::StateFromString("XXX") , std::invalid_argument ); + BOOST_CHECK( Connection::State::AUTO == Connection::StateFromString("AUTO")); + BOOST_CHECK( Connection::State::SHUT == Connection::StateFromString("SHUT")); + BOOST_CHECK( Connection::State::SHUT == Connection::StateFromString("STOP")); + BOOST_CHECK( Connection::State::OPEN == Connection::StateFromString("OPEN")); } BOOST_AUTO_TEST_CASE(TestCompletionStateEnumLoop) { - BOOST_CHECK_EQUAL( WellCompletion::AUTO , WellCompletion::StateEnumFromString( WellCompletion::StateEnum2String( WellCompletion::AUTO ) )); - BOOST_CHECK_EQUAL( WellCompletion::SHUT , WellCompletion::StateEnumFromString( WellCompletion::StateEnum2String( WellCompletion::SHUT ) )); - BOOST_CHECK_EQUAL( WellCompletion::OPEN , WellCompletion::StateEnumFromString( WellCompletion::StateEnum2String( WellCompletion::OPEN ) )); + BOOST_CHECK( Connection::State::AUTO == Connection::StateFromString( Connection::State2String( Connection::State::AUTO ) )); + BOOST_CHECK( Connection::State::SHUT == Connection::StateFromString( Connection::State2String( Connection::State::SHUT ) )); + BOOST_CHECK( Connection::State::OPEN == Connection::StateFromString( Connection::State2String( Connection::State::OPEN ) )); - BOOST_CHECK_EQUAL( "AUTO" , WellCompletion::StateEnum2String(WellCompletion::StateEnumFromString( "AUTO" ) )); - BOOST_CHECK_EQUAL( "OPEN" , WellCompletion::StateEnum2String(WellCompletion::StateEnumFromString( "OPEN" ) )); - BOOST_CHECK_EQUAL( "SHUT" , WellCompletion::StateEnum2String(WellCompletion::StateEnumFromString( "SHUT" ) )); + BOOST_CHECK( "AUTO" == Connection::State2String(Connection::StateFromString( "AUTO" ) )); + BOOST_CHECK( "OPEN" == Connection::State2String(Connection::StateFromString( "OPEN" ) )); + BOOST_CHECK( "SHUT" == Connection::State2String(Connection::StateFromString( "SHUT" ) )); } @@ -2355,233 +2356,227 @@ BOOST_AUTO_TEST_CASE(TestCompletionStateEnumLoop) { BOOST_AUTO_TEST_CASE(TestCompletionDirectionEnum2String) { - using namespace WellCompletion; - - BOOST_CHECK_EQUAL("X", DirectionEnum2String(DirectionEnum::X)); - BOOST_CHECK_EQUAL("Y", DirectionEnum2String(DirectionEnum::Y)); - BOOST_CHECK_EQUAL("Z", DirectionEnum2String(DirectionEnum::Z)); + BOOST_CHECK("X" == Connection::Direction2String(Connection::Direction::X)); + BOOST_CHECK("Y" == Connection::Direction2String(Connection::Direction::Y)); + BOOST_CHECK("Z" == Connection::Direction2String(Connection::Direction::Z)); } BOOST_AUTO_TEST_CASE(TestCompletionDirectionEnumFromString) { - using namespace WellCompletion; + BOOST_CHECK_THROW(Connection::DirectionFromString("XXX"), std::invalid_argument); - BOOST_CHECK_THROW(DirectionEnumFromString("XXX"), std::invalid_argument); - - BOOST_CHECK_EQUAL(DirectionEnum::X, DirectionEnumFromString("X")); - BOOST_CHECK_EQUAL(DirectionEnum::Y, DirectionEnumFromString("Y")); - BOOST_CHECK_EQUAL(DirectionEnum::Z, DirectionEnumFromString("Z")); + BOOST_CHECK(Connection::Direction::X == Connection::DirectionFromString("X")); + BOOST_CHECK(Connection::Direction::Y == Connection::DirectionFromString("Y")); + BOOST_CHECK(Connection::Direction::Z == Connection::DirectionFromString("Z")); } -BOOST_AUTO_TEST_CASE(TestCompletionDirectionEnumLoop) +BOOST_AUTO_TEST_CASE(TestCompletionConnectionDirectionLoop) { - using namespace WellCompletion; + BOOST_CHECK(Connection::Direction::X == Connection::DirectionFromString(Connection::Direction2String(Connection::Direction::X))); + BOOST_CHECK(Connection::Direction::Y == Connection::DirectionFromString(Connection::Direction2String(Connection::Direction::Y))); + BOOST_CHECK(Connection::Direction::Z == Connection::DirectionFromString(Connection::Direction2String(Connection::Direction::Z))); - BOOST_CHECK_EQUAL(DirectionEnum::X, DirectionEnumFromString(DirectionEnum2String(DirectionEnum::X))); - BOOST_CHECK_EQUAL(DirectionEnum::Y, DirectionEnumFromString(DirectionEnum2String(DirectionEnum::Y))); - BOOST_CHECK_EQUAL(DirectionEnum::Z, DirectionEnumFromString(DirectionEnum2String(DirectionEnum::Z))); - - BOOST_CHECK_EQUAL("X", DirectionEnum2String(DirectionEnumFromString("X"))); - BOOST_CHECK_EQUAL("Y", DirectionEnum2String(DirectionEnumFromString("Y"))); - BOOST_CHECK_EQUAL("Z", DirectionEnum2String(DirectionEnumFromString("Z"))); + BOOST_CHECK("X" == Connection::Direction2String(Connection::DirectionFromString("X"))); + BOOST_CHECK("Y" == Connection::Direction2String(Connection::DirectionFromString("Y"))); + BOOST_CHECK("Z" == Connection::Direction2String(Connection::DirectionFromString("Z"))); } /*****************************************************************/ BOOST_AUTO_TEST_CASE(TestGroupInjectionControlEnum2String) { - BOOST_CHECK_EQUAL( "NONE" , GroupInjection::ControlEnum2String(GroupInjection::NONE)); - BOOST_CHECK_EQUAL( "RATE" , GroupInjection::ControlEnum2String(GroupInjection::RATE)); - BOOST_CHECK_EQUAL( "RESV" , GroupInjection::ControlEnum2String(GroupInjection::RESV)); - BOOST_CHECK_EQUAL( "REIN" , GroupInjection::ControlEnum2String(GroupInjection::REIN)); - BOOST_CHECK_EQUAL( "VREP" , GroupInjection::ControlEnum2String(GroupInjection::VREP)); - BOOST_CHECK_EQUAL( "FLD" , GroupInjection::ControlEnum2String(GroupInjection::FLD)); + BOOST_CHECK_EQUAL( "NONE" , Group2::InjectionCMode2String(Group2::InjectionCMode::NONE)); + BOOST_CHECK_EQUAL( "RATE" , Group2::InjectionCMode2String(Group2::InjectionCMode::RATE)); + BOOST_CHECK_EQUAL( "RESV" , Group2::InjectionCMode2String(Group2::InjectionCMode::RESV)); + BOOST_CHECK_EQUAL( "REIN" , Group2::InjectionCMode2String(Group2::InjectionCMode::REIN)); + BOOST_CHECK_EQUAL( "VREP" , Group2::InjectionCMode2String(Group2::InjectionCMode::VREP)); + BOOST_CHECK_EQUAL( "FLD" , Group2::InjectionCMode2String(Group2::InjectionCMode::FLD)); } BOOST_AUTO_TEST_CASE(TestGroupInjectionControlEnumFromString) { - BOOST_CHECK_THROW( GroupInjection::ControlEnumFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL( GroupInjection::NONE , GroupInjection::ControlEnumFromString("NONE")); - BOOST_CHECK_EQUAL( GroupInjection::RATE , GroupInjection::ControlEnumFromString("RATE")); - BOOST_CHECK_EQUAL( GroupInjection::RESV , GroupInjection::ControlEnumFromString("RESV")); - BOOST_CHECK_EQUAL( GroupInjection::REIN , GroupInjection::ControlEnumFromString("REIN")); - BOOST_CHECK_EQUAL( GroupInjection::VREP , GroupInjection::ControlEnumFromString("VREP")); - BOOST_CHECK_EQUAL( GroupInjection::FLD , GroupInjection::ControlEnumFromString("FLD")); + BOOST_CHECK_THROW( Group2::InjectionCModeFromString("XXX") , std::invalid_argument ); + BOOST_CHECK( Group2::InjectionCMode::NONE == Group2::InjectionCModeFromString("NONE")); + BOOST_CHECK( Group2::InjectionCMode::RATE == Group2::InjectionCModeFromString("RATE")); + BOOST_CHECK( Group2::InjectionCMode::RESV == Group2::InjectionCModeFromString("RESV")); + BOOST_CHECK( Group2::InjectionCMode::REIN == Group2::InjectionCModeFromString("REIN")); + BOOST_CHECK( Group2::InjectionCMode::VREP == Group2::InjectionCModeFromString("VREP")); + BOOST_CHECK( Group2::InjectionCMode::FLD == Group2::InjectionCModeFromString("FLD")); } BOOST_AUTO_TEST_CASE(TestGroupInjectionControlEnumLoop) { - BOOST_CHECK_EQUAL( GroupInjection::NONE , GroupInjection::ControlEnumFromString( GroupInjection::ControlEnum2String( GroupInjection::NONE ) )); - BOOST_CHECK_EQUAL( GroupInjection::RATE , GroupInjection::ControlEnumFromString( GroupInjection::ControlEnum2String( GroupInjection::RATE ) )); - BOOST_CHECK_EQUAL( GroupInjection::RESV , GroupInjection::ControlEnumFromString( GroupInjection::ControlEnum2String( GroupInjection::RESV ) )); - BOOST_CHECK_EQUAL( GroupInjection::REIN , GroupInjection::ControlEnumFromString( GroupInjection::ControlEnum2String( GroupInjection::REIN ) )); - BOOST_CHECK_EQUAL( GroupInjection::VREP , GroupInjection::ControlEnumFromString( GroupInjection::ControlEnum2String( GroupInjection::VREP ) )); - BOOST_CHECK_EQUAL( GroupInjection::FLD , GroupInjection::ControlEnumFromString( GroupInjection::ControlEnum2String( GroupInjection::FLD ) )); + BOOST_CHECK( Group2::InjectionCMode::NONE == Group2::InjectionCModeFromString( Group2::InjectionCMode2String( Group2::InjectionCMode::NONE ) )); + BOOST_CHECK( Group2::InjectionCMode::RATE == Group2::InjectionCModeFromString( Group2::InjectionCMode2String( Group2::InjectionCMode::RATE ) )); + BOOST_CHECK( Group2::InjectionCMode::RESV == Group2::InjectionCModeFromString( Group2::InjectionCMode2String( Group2::InjectionCMode::RESV ) )); + BOOST_CHECK( Group2::InjectionCMode::REIN == Group2::InjectionCModeFromString( Group2::InjectionCMode2String( Group2::InjectionCMode::REIN ) )); + BOOST_CHECK( Group2::InjectionCMode::VREP == Group2::InjectionCModeFromString( Group2::InjectionCMode2String( Group2::InjectionCMode::VREP ) )); + BOOST_CHECK( Group2::InjectionCMode::FLD == Group2::InjectionCModeFromString( Group2::InjectionCMode2String( Group2::InjectionCMode::FLD ) )); - BOOST_CHECK_EQUAL( "NONE" , GroupInjection::ControlEnum2String(GroupInjection::ControlEnumFromString( "NONE" ) )); - BOOST_CHECK_EQUAL( "RATE" , GroupInjection::ControlEnum2String(GroupInjection::ControlEnumFromString( "RATE" ) )); - BOOST_CHECK_EQUAL( "RESV" , GroupInjection::ControlEnum2String(GroupInjection::ControlEnumFromString( "RESV" ) )); - BOOST_CHECK_EQUAL( "REIN" , GroupInjection::ControlEnum2String(GroupInjection::ControlEnumFromString( "REIN" ) )); - BOOST_CHECK_EQUAL( "VREP" , GroupInjection::ControlEnum2String(GroupInjection::ControlEnumFromString( "VREP" ) )); - BOOST_CHECK_EQUAL( "FLD" , GroupInjection::ControlEnum2String(GroupInjection::ControlEnumFromString( "FLD" ) )); + BOOST_CHECK_EQUAL( "NONE" , Group2::InjectionCMode2String(Group2::InjectionCModeFromString( "NONE" ) )); + BOOST_CHECK_EQUAL( "RATE" , Group2::InjectionCMode2String(Group2::InjectionCModeFromString( "RATE" ) )); + BOOST_CHECK_EQUAL( "RESV" , Group2::InjectionCMode2String(Group2::InjectionCModeFromString( "RESV" ) )); + BOOST_CHECK_EQUAL( "REIN" , Group2::InjectionCMode2String(Group2::InjectionCModeFromString( "REIN" ) )); + BOOST_CHECK_EQUAL( "VREP" , Group2::InjectionCMode2String(Group2::InjectionCModeFromString( "VREP" ) )); + BOOST_CHECK_EQUAL( "FLD" , Group2::InjectionCMode2String(Group2::InjectionCModeFromString( "FLD" ) )); } /*****************************************************************/ BOOST_AUTO_TEST_CASE(TestGroupProductionControlEnum2String) { - BOOST_CHECK_EQUAL( "NONE" , GroupProduction::ControlEnum2String(GroupProduction::NONE)); - BOOST_CHECK_EQUAL( "ORAT" , GroupProduction::ControlEnum2String(GroupProduction::ORAT)); - BOOST_CHECK_EQUAL( "WRAT" , GroupProduction::ControlEnum2String(GroupProduction::WRAT)); - BOOST_CHECK_EQUAL( "GRAT" , GroupProduction::ControlEnum2String(GroupProduction::GRAT)); - BOOST_CHECK_EQUAL( "LRAT" , GroupProduction::ControlEnum2String(GroupProduction::LRAT)); - BOOST_CHECK_EQUAL( "CRAT" , GroupProduction::ControlEnum2String(GroupProduction::CRAT)); - BOOST_CHECK_EQUAL( "RESV" , GroupProduction::ControlEnum2String(GroupProduction::RESV)); - BOOST_CHECK_EQUAL( "PRBL" , GroupProduction::ControlEnum2String(GroupProduction::PRBL)); + BOOST_CHECK_EQUAL( "NONE" , Group2::ProductionCMode2String(Group2::ProductionCMode::NONE)); + BOOST_CHECK_EQUAL( "ORAT" , Group2::ProductionCMode2String(Group2::ProductionCMode::ORAT)); + BOOST_CHECK_EQUAL( "WRAT" , Group2::ProductionCMode2String(Group2::ProductionCMode::WRAT)); + BOOST_CHECK_EQUAL( "GRAT" , Group2::ProductionCMode2String(Group2::ProductionCMode::GRAT)); + BOOST_CHECK_EQUAL( "LRAT" , Group2::ProductionCMode2String(Group2::ProductionCMode::LRAT)); + BOOST_CHECK_EQUAL( "CRAT" , Group2::ProductionCMode2String(Group2::ProductionCMode::CRAT)); + BOOST_CHECK_EQUAL( "RESV" , Group2::ProductionCMode2String(Group2::ProductionCMode::RESV)); + BOOST_CHECK_EQUAL( "PRBL" , Group2::ProductionCMode2String(Group2::ProductionCMode::PRBL)); } BOOST_AUTO_TEST_CASE(TestGroupProductionControlEnumFromString) { - BOOST_CHECK_THROW( GroupProduction::ControlEnumFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL(GroupProduction::NONE , GroupProduction::ControlEnumFromString("NONE")); - BOOST_CHECK_EQUAL(GroupProduction::ORAT , GroupProduction::ControlEnumFromString("ORAT")); - BOOST_CHECK_EQUAL(GroupProduction::WRAT , GroupProduction::ControlEnumFromString("WRAT")); - BOOST_CHECK_EQUAL(GroupProduction::GRAT , GroupProduction::ControlEnumFromString("GRAT")); - BOOST_CHECK_EQUAL(GroupProduction::LRAT , GroupProduction::ControlEnumFromString("LRAT")); - BOOST_CHECK_EQUAL(GroupProduction::CRAT , GroupProduction::ControlEnumFromString("CRAT")); - BOOST_CHECK_EQUAL(GroupProduction::RESV , GroupProduction::ControlEnumFromString("RESV")); - BOOST_CHECK_EQUAL(GroupProduction::PRBL , GroupProduction::ControlEnumFromString("PRBL")); + BOOST_CHECK_THROW(Group2::ProductionCModeFromString("XXX") , std::invalid_argument ); + BOOST_CHECK(Group2::ProductionCMode::NONE == Group2::ProductionCModeFromString("NONE")); + BOOST_CHECK(Group2::ProductionCMode::ORAT == Group2::ProductionCModeFromString("ORAT")); + BOOST_CHECK(Group2::ProductionCMode::WRAT == Group2::ProductionCModeFromString("WRAT")); + BOOST_CHECK(Group2::ProductionCMode::GRAT == Group2::ProductionCModeFromString("GRAT")); + BOOST_CHECK(Group2::ProductionCMode::LRAT == Group2::ProductionCModeFromString("LRAT")); + BOOST_CHECK(Group2::ProductionCMode::CRAT == Group2::ProductionCModeFromString("CRAT")); + BOOST_CHECK(Group2::ProductionCMode::RESV == Group2::ProductionCModeFromString("RESV")); + BOOST_CHECK(Group2::ProductionCMode::PRBL == Group2::ProductionCModeFromString("PRBL")); } BOOST_AUTO_TEST_CASE(TestGroupProductionControlEnumLoop) { - BOOST_CHECK_EQUAL( GroupProduction::NONE, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::NONE ) )); - BOOST_CHECK_EQUAL( GroupProduction::ORAT, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::ORAT ) )); - BOOST_CHECK_EQUAL( GroupProduction::WRAT, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::WRAT ) )); - BOOST_CHECK_EQUAL( GroupProduction::GRAT, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::GRAT ) )); - BOOST_CHECK_EQUAL( GroupProduction::LRAT, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::LRAT ) )); - BOOST_CHECK_EQUAL( GroupProduction::CRAT, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::CRAT ) )); - BOOST_CHECK_EQUAL( GroupProduction::RESV, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::RESV ) )); - BOOST_CHECK_EQUAL( GroupProduction::PRBL, GroupProduction::ControlEnumFromString( GroupProduction::ControlEnum2String( GroupProduction::PRBL ) )); + BOOST_CHECK( Group2::ProductionCMode::NONE == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::NONE ) )); + BOOST_CHECK( Group2::ProductionCMode::ORAT == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::ORAT ) )); + BOOST_CHECK( Group2::ProductionCMode::WRAT == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::WRAT ) )); + BOOST_CHECK( Group2::ProductionCMode::GRAT == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::GRAT ) )); + BOOST_CHECK( Group2::ProductionCMode::LRAT == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::LRAT ) )); + BOOST_CHECK( Group2::ProductionCMode::CRAT == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::CRAT ) )); + BOOST_CHECK( Group2::ProductionCMode::RESV == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::RESV ) )); + BOOST_CHECK( Group2::ProductionCMode::PRBL == Group2::ProductionCModeFromString( Group2::ProductionCMode2String( Group2::ProductionCMode::PRBL ) )); - BOOST_CHECK_EQUAL( "NONE" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "NONE" ) )); - BOOST_CHECK_EQUAL( "ORAT" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "ORAT" ) )); - BOOST_CHECK_EQUAL( "WRAT" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "WRAT" ) )); - BOOST_CHECK_EQUAL( "GRAT" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "GRAT" ) )); - BOOST_CHECK_EQUAL( "LRAT" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "LRAT" ) )); - BOOST_CHECK_EQUAL( "CRAT" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "CRAT" ) )); - BOOST_CHECK_EQUAL( "RESV" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "RESV" ) )); - BOOST_CHECK_EQUAL( "PRBL" , GroupProduction::ControlEnum2String(GroupProduction::ControlEnumFromString( "PRBL" ) )); + BOOST_CHECK_EQUAL( "NONE" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "NONE" ) )); + BOOST_CHECK_EQUAL( "ORAT" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "ORAT" ) )); + BOOST_CHECK_EQUAL( "WRAT" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "WRAT" ) )); + BOOST_CHECK_EQUAL( "GRAT" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "GRAT" ) )); + BOOST_CHECK_EQUAL( "LRAT" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "LRAT" ) )); + BOOST_CHECK_EQUAL( "CRAT" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "CRAT" ) )); + BOOST_CHECK_EQUAL( "RESV" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "RESV" ) )); + BOOST_CHECK_EQUAL( "PRBL" , Group2::ProductionCMode2String(Group2::ProductionCModeFromString( "PRBL" ) )); } /*****************************************************************/ BOOST_AUTO_TEST_CASE(TestGroupProductionExceedLimitControlEnum2String) { - BOOST_CHECK_EQUAL( "NONE" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::NONE)); - BOOST_CHECK_EQUAL( "CON" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::CON)); - BOOST_CHECK_EQUAL( "+CON" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::CON_PLUS)); - BOOST_CHECK_EQUAL( "WELL" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::WELL)); - BOOST_CHECK_EQUAL( "PLUG" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::PLUG)); - BOOST_CHECK_EQUAL( "RATE" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::RATE)); + BOOST_CHECK_EQUAL( "NONE" , Group2::ExceedAction2String(Group2::ExceedAction::NONE)); + BOOST_CHECK_EQUAL( "CON" , Group2::ExceedAction2String(Group2::ExceedAction::CON)); + BOOST_CHECK_EQUAL( "+CON" , Group2::ExceedAction2String(Group2::ExceedAction::CON_PLUS)); + BOOST_CHECK_EQUAL( "WELL" , Group2::ExceedAction2String(Group2::ExceedAction::WELL)); + BOOST_CHECK_EQUAL( "PLUG" , Group2::ExceedAction2String(Group2::ExceedAction::PLUG)); + BOOST_CHECK_EQUAL( "RATE" , Group2::ExceedAction2String(Group2::ExceedAction::RATE)); } BOOST_AUTO_TEST_CASE(TestGroupProductionExceedLimitActionEnumFromString) { - BOOST_CHECK_THROW( GroupProductionExceedLimit::ActionEnumFromString("XXX") , std::invalid_argument ); + BOOST_CHECK_THROW( Group2::ExceedActionFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL(GroupProductionExceedLimit::NONE , GroupProductionExceedLimit::ActionEnumFromString("NONE")); - BOOST_CHECK_EQUAL(GroupProductionExceedLimit::CON , GroupProductionExceedLimit::ActionEnumFromString("CON" )); - BOOST_CHECK_EQUAL(GroupProductionExceedLimit::CON_PLUS , GroupProductionExceedLimit::ActionEnumFromString("+CON")); - BOOST_CHECK_EQUAL(GroupProductionExceedLimit::WELL , GroupProductionExceedLimit::ActionEnumFromString("WELL")); - BOOST_CHECK_EQUAL(GroupProductionExceedLimit::PLUG , GroupProductionExceedLimit::ActionEnumFromString("PLUG")); - BOOST_CHECK_EQUAL(GroupProductionExceedLimit::RATE , GroupProductionExceedLimit::ActionEnumFromString("RATE")); + BOOST_CHECK(Group2::ExceedAction::NONE == Group2::ExceedActionFromString("NONE")); + BOOST_CHECK(Group2::ExceedAction::CON == Group2::ExceedActionFromString("CON" )); + BOOST_CHECK(Group2::ExceedAction::CON_PLUS == Group2::ExceedActionFromString("+CON")); + BOOST_CHECK(Group2::ExceedAction::WELL == Group2::ExceedActionFromString("WELL")); + BOOST_CHECK(Group2::ExceedAction::PLUG == Group2::ExceedActionFromString("PLUG")); + BOOST_CHECK(Group2::ExceedAction::RATE == Group2::ExceedActionFromString("RATE")); } BOOST_AUTO_TEST_CASE(TestGroupProductionExceedLimitActionEnumLoop) { - BOOST_CHECK_EQUAL( GroupProductionExceedLimit::NONE , GroupProductionExceedLimit::ActionEnumFromString( GroupProductionExceedLimit::ActionEnum2String( GroupProductionExceedLimit::NONE ) )); - BOOST_CHECK_EQUAL( GroupProductionExceedLimit::CON , GroupProductionExceedLimit::ActionEnumFromString( GroupProductionExceedLimit::ActionEnum2String( GroupProductionExceedLimit::CON ) )); - BOOST_CHECK_EQUAL( GroupProductionExceedLimit::CON_PLUS , GroupProductionExceedLimit::ActionEnumFromString( GroupProductionExceedLimit::ActionEnum2String( GroupProductionExceedLimit::CON_PLUS ) )); - BOOST_CHECK_EQUAL( GroupProductionExceedLimit::WELL , GroupProductionExceedLimit::ActionEnumFromString( GroupProductionExceedLimit::ActionEnum2String( GroupProductionExceedLimit::WELL ) )); - BOOST_CHECK_EQUAL( GroupProductionExceedLimit::PLUG , GroupProductionExceedLimit::ActionEnumFromString( GroupProductionExceedLimit::ActionEnum2String( GroupProductionExceedLimit::PLUG ) )); - BOOST_CHECK_EQUAL( GroupProductionExceedLimit::RATE , GroupProductionExceedLimit::ActionEnumFromString( GroupProductionExceedLimit::ActionEnum2String( GroupProductionExceedLimit::RATE ) )); + BOOST_CHECK( Group2::ExceedAction::NONE == Group2::ExceedActionFromString( Group2::ExceedAction2String( Group2::ExceedAction::NONE ) )); + BOOST_CHECK( Group2::ExceedAction::CON == Group2::ExceedActionFromString( Group2::ExceedAction2String( Group2::ExceedAction::CON ) )); + BOOST_CHECK( Group2::ExceedAction::CON_PLUS == Group2::ExceedActionFromString( Group2::ExceedAction2String( Group2::ExceedAction::CON_PLUS ) )); + BOOST_CHECK( Group2::ExceedAction::WELL == Group2::ExceedActionFromString( Group2::ExceedAction2String( Group2::ExceedAction::WELL ) )); + BOOST_CHECK( Group2::ExceedAction::PLUG == Group2::ExceedActionFromString( Group2::ExceedAction2String( Group2::ExceedAction::PLUG ) )); + BOOST_CHECK( Group2::ExceedAction::RATE == Group2::ExceedActionFromString( Group2::ExceedAction2String( Group2::ExceedAction::RATE ) )); - BOOST_CHECK_EQUAL("NONE" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::ActionEnumFromString( "NONE" ) )); - BOOST_CHECK_EQUAL("CON" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::ActionEnumFromString( "CON" ) )); - BOOST_CHECK_EQUAL("+CON" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::ActionEnumFromString( "+CON" ) )); - BOOST_CHECK_EQUAL("WELL" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::ActionEnumFromString( "WELL" ) )); - BOOST_CHECK_EQUAL("PLUG" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::ActionEnumFromString( "PLUG" ) )); - BOOST_CHECK_EQUAL("RATE" , GroupProductionExceedLimit::ActionEnum2String(GroupProductionExceedLimit::ActionEnumFromString( "RATE" ) )); + BOOST_CHECK_EQUAL("NONE" , Group2::ExceedAction2String(Group2::ExceedActionFromString( "NONE" ) )); + BOOST_CHECK_EQUAL("CON" , Group2::ExceedAction2String(Group2::ExceedActionFromString( "CON" ) )); + BOOST_CHECK_EQUAL("+CON" , Group2::ExceedAction2String(Group2::ExceedActionFromString( "+CON" ) )); + BOOST_CHECK_EQUAL("WELL" , Group2::ExceedAction2String(Group2::ExceedActionFromString( "WELL" ) )); + BOOST_CHECK_EQUAL("PLUG" , Group2::ExceedAction2String(Group2::ExceedActionFromString( "PLUG" ) )); + BOOST_CHECK_EQUAL("RATE" , Group2::ExceedAction2String(Group2::ExceedActionFromString( "RATE" ) )); } /*****************************************************************/ BOOST_AUTO_TEST_CASE(TestInjectorEnum2String) { - BOOST_CHECK_EQUAL( "OIL" , WellInjector::Type2String(WellInjector::OIL)); - BOOST_CHECK_EQUAL( "GAS" , WellInjector::Type2String(WellInjector::GAS)); - BOOST_CHECK_EQUAL( "WATER" , WellInjector::Type2String(WellInjector::WATER)); - BOOST_CHECK_EQUAL( "MULTI" , WellInjector::Type2String(WellInjector::MULTI)); + BOOST_CHECK_EQUAL( "OIL" , Well2::InjectorType2String(Well2::InjectorType::OIL)); + BOOST_CHECK_EQUAL( "GAS" , Well2::InjectorType2String(Well2::InjectorType::GAS)); + BOOST_CHECK_EQUAL( "WATER" , Well2::InjectorType2String(Well2::InjectorType::WATER)); + BOOST_CHECK_EQUAL( "MULTI" , Well2::InjectorType2String(Well2::InjectorType::MULTI)); } BOOST_AUTO_TEST_CASE(TestInjectorEnumFromString) { - BOOST_CHECK_THROW( WellInjector::TypeFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL( WellInjector::OIL , WellInjector::TypeFromString("OIL")); - BOOST_CHECK_EQUAL( WellInjector::WATER , WellInjector::TypeFromString("WATER")); - BOOST_CHECK_EQUAL( WellInjector::WATER , WellInjector::TypeFromString("WAT")); - BOOST_CHECK_EQUAL( WellInjector::GAS , WellInjector::TypeFromString("GAS")); - BOOST_CHECK_EQUAL( WellInjector::MULTI , WellInjector::TypeFromString("MULTI")); + BOOST_CHECK_THROW( Well2::InjectorTypeFromString("XXX") , std::invalid_argument ); + BOOST_CHECK( Well2::InjectorType::OIL == Well2::InjectorTypeFromString("OIL")); + BOOST_CHECK( Well2::InjectorType::WATER == Well2::InjectorTypeFromString("WATER")); + BOOST_CHECK( Well2::InjectorType::WATER == Well2::InjectorTypeFromString("WAT")); + BOOST_CHECK( Well2::InjectorType::GAS == Well2::InjectorTypeFromString("GAS")); + BOOST_CHECK( Well2::InjectorType::MULTI == Well2::InjectorTypeFromString("MULTI")); } BOOST_AUTO_TEST_CASE(TestInjectorEnumLoop) { - BOOST_CHECK_EQUAL( WellInjector::OIL , WellInjector::TypeFromString( WellInjector::Type2String( WellInjector::OIL ) )); - BOOST_CHECK_EQUAL( WellInjector::WATER , WellInjector::TypeFromString( WellInjector::Type2String( WellInjector::WATER ) )); - BOOST_CHECK_EQUAL( WellInjector::GAS , WellInjector::TypeFromString( WellInjector::Type2String( WellInjector::GAS ) )); - BOOST_CHECK_EQUAL( WellInjector::MULTI , WellInjector::TypeFromString( WellInjector::Type2String( WellInjector::MULTI ) )); + BOOST_CHECK( Well2::InjectorType::OIL == Well2::InjectorTypeFromString( Well2::InjectorType2String( Well2::InjectorType::OIL ) )); + BOOST_CHECK( Well2::InjectorType::WATER == Well2::InjectorTypeFromString( Well2::InjectorType2String( Well2::InjectorType::WATER ) )); + BOOST_CHECK( Well2::InjectorType::GAS == Well2::InjectorTypeFromString( Well2::InjectorType2String( Well2::InjectorType::GAS ) )); + BOOST_CHECK( Well2::InjectorType::MULTI == Well2::InjectorTypeFromString( Well2::InjectorType2String( Well2::InjectorType::MULTI ) )); - BOOST_CHECK_EQUAL( "MULTI" , WellInjector::Type2String(WellInjector::TypeFromString( "MULTI" ) )); - BOOST_CHECK_EQUAL( "OIL" , WellInjector::Type2String(WellInjector::TypeFromString( "OIL" ) )); - BOOST_CHECK_EQUAL( "GAS" , WellInjector::Type2String(WellInjector::TypeFromString( "GAS" ) )); - BOOST_CHECK_EQUAL( "WATER" , WellInjector::Type2String(WellInjector::TypeFromString( "WATER" ) )); + BOOST_CHECK_EQUAL( "MULTI" , Well2::InjectorType2String(Well2::InjectorTypeFromString( "MULTI" ) )); + BOOST_CHECK_EQUAL( "OIL" , Well2::InjectorType2String(Well2::InjectorTypeFromString( "OIL" ) )); + BOOST_CHECK_EQUAL( "GAS" , Well2::InjectorType2String(Well2::InjectorTypeFromString( "GAS" ) )); + BOOST_CHECK_EQUAL( "WATER" , Well2::InjectorType2String(Well2::InjectorTypeFromString( "WATER" ) )); } /*****************************************************************/ BOOST_AUTO_TEST_CASE(InjectorCOntrolMopdeEnum2String) { - BOOST_CHECK_EQUAL( "RATE" , WellInjector::ControlMode2String(WellInjector::RATE)); - BOOST_CHECK_EQUAL( "RESV" , WellInjector::ControlMode2String(WellInjector::RESV)); - BOOST_CHECK_EQUAL( "BHP" , WellInjector::ControlMode2String(WellInjector::BHP)); - BOOST_CHECK_EQUAL( "THP" , WellInjector::ControlMode2String(WellInjector::THP)); - BOOST_CHECK_EQUAL( "GRUP" , WellInjector::ControlMode2String(WellInjector::GRUP)); + BOOST_CHECK_EQUAL( "RATE" , Well2::InjectorCMode2String(Well2::InjectorCMode::RATE)); + BOOST_CHECK_EQUAL( "RESV" , Well2::InjectorCMode2String(Well2::InjectorCMode::RESV)); + BOOST_CHECK_EQUAL( "BHP" , Well2::InjectorCMode2String(Well2::InjectorCMode::BHP)); + BOOST_CHECK_EQUAL( "THP" , Well2::InjectorCMode2String(Well2::InjectorCMode::THP)); + BOOST_CHECK_EQUAL( "GRUP" , Well2::InjectorCMode2String(Well2::InjectorCMode::GRUP)); } BOOST_AUTO_TEST_CASE(InjectorControlModeEnumFromString) { - BOOST_CHECK_THROW( WellInjector::ControlModeFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL( WellInjector::RATE , WellInjector::ControlModeFromString("RATE")); - BOOST_CHECK_EQUAL( WellInjector::BHP , WellInjector::ControlModeFromString("BHP")); - BOOST_CHECK_EQUAL( WellInjector::RESV , WellInjector::ControlModeFromString("RESV")); - BOOST_CHECK_EQUAL( WellInjector::THP , WellInjector::ControlModeFromString("THP")); - BOOST_CHECK_EQUAL( WellInjector::GRUP , WellInjector::ControlModeFromString("GRUP")); + BOOST_CHECK_THROW( Well2::InjectorCModeFromString("XXX") , std::invalid_argument ); + BOOST_CHECK( Well2::InjectorCMode::RATE == Well2::InjectorCModeFromString("RATE")); + BOOST_CHECK( Well2::InjectorCMode::BHP == Well2::InjectorCModeFromString("BHP")); + BOOST_CHECK( Well2::InjectorCMode::RESV == Well2::InjectorCModeFromString("RESV")); + BOOST_CHECK( Well2::InjectorCMode::THP == Well2::InjectorCModeFromString("THP")); + BOOST_CHECK( Well2::InjectorCMode::GRUP == Well2::InjectorCModeFromString("GRUP")); } BOOST_AUTO_TEST_CASE(InjectorControlModeEnumLoop) { - BOOST_CHECK_EQUAL( WellInjector::RATE , WellInjector::ControlModeFromString( WellInjector::ControlMode2String( WellInjector::RATE ) )); - BOOST_CHECK_EQUAL( WellInjector::BHP , WellInjector::ControlModeFromString( WellInjector::ControlMode2String( WellInjector::BHP ) )); - BOOST_CHECK_EQUAL( WellInjector::RESV , WellInjector::ControlModeFromString( WellInjector::ControlMode2String( WellInjector::RESV ) )); - BOOST_CHECK_EQUAL( WellInjector::THP , WellInjector::ControlModeFromString( WellInjector::ControlMode2String( WellInjector::THP ) )); - BOOST_CHECK_EQUAL( WellInjector::GRUP , WellInjector::ControlModeFromString( WellInjector::ControlMode2String( WellInjector::GRUP ) )); + BOOST_CHECK( Well2::InjectorCMode::RATE == Well2::InjectorCModeFromString( Well2::InjectorCMode2String( Well2::InjectorCMode::RATE ) )); + BOOST_CHECK( Well2::InjectorCMode::BHP == Well2::InjectorCModeFromString( Well2::InjectorCMode2String( Well2::InjectorCMode::BHP ) )); + BOOST_CHECK( Well2::InjectorCMode::RESV == Well2::InjectorCModeFromString( Well2::InjectorCMode2String( Well2::InjectorCMode::RESV ) )); + BOOST_CHECK( Well2::InjectorCMode::THP == Well2::InjectorCModeFromString( Well2::InjectorCMode2String( Well2::InjectorCMode::THP ) )); + BOOST_CHECK( Well2::InjectorCMode::GRUP == Well2::InjectorCModeFromString( Well2::InjectorCMode2String( Well2::InjectorCMode::GRUP ) )); - BOOST_CHECK_EQUAL( "THP" , WellInjector::ControlMode2String(WellInjector::ControlModeFromString( "THP" ) )); - BOOST_CHECK_EQUAL( "RATE" , WellInjector::ControlMode2String(WellInjector::ControlModeFromString( "RATE" ) )); - BOOST_CHECK_EQUAL( "RESV" , WellInjector::ControlMode2String(WellInjector::ControlModeFromString( "RESV" ) )); - BOOST_CHECK_EQUAL( "BHP" , WellInjector::ControlMode2String(WellInjector::ControlModeFromString( "BHP" ) )); - BOOST_CHECK_EQUAL( "GRUP" , WellInjector::ControlMode2String(WellInjector::ControlModeFromString( "GRUP" ) )); + BOOST_CHECK_EQUAL( "THP" , Well2::InjectorCMode2String(Well2::InjectorCModeFromString( "THP" ) )); + BOOST_CHECK_EQUAL( "RATE" , Well2::InjectorCMode2String(Well2::InjectorCModeFromString( "RATE" ) )); + BOOST_CHECK_EQUAL( "RESV" , Well2::InjectorCMode2String(Well2::InjectorCModeFromString( "RESV" ) )); + BOOST_CHECK_EQUAL( "BHP" , Well2::InjectorCMode2String(Well2::InjectorCModeFromString( "BHP" ) )); + BOOST_CHECK_EQUAL( "GRUP" , Well2::InjectorCMode2String(Well2::InjectorCModeFromString( "GRUP" ) )); } @@ -2589,33 +2584,33 @@ BOOST_AUTO_TEST_CASE(InjectorControlModeEnumLoop) { /*****************************************************************/ BOOST_AUTO_TEST_CASE(InjectorStatusEnum2String) { - BOOST_CHECK_EQUAL( "OPEN" , WellCommon::Status2String(WellCommon::OPEN)); - BOOST_CHECK_EQUAL( "SHUT" , WellCommon::Status2String(WellCommon::SHUT)); - BOOST_CHECK_EQUAL( "AUTO" , WellCommon::Status2String(WellCommon::AUTO)); - BOOST_CHECK_EQUAL( "STOP" , WellCommon::Status2String(WellCommon::STOP)); + BOOST_CHECK_EQUAL( "OPEN", Well2::Status2String(Well2::Status::OPEN)); + BOOST_CHECK_EQUAL( "SHUT", Well2::Status2String(Well2::Status::SHUT)); + BOOST_CHECK_EQUAL( "AUTO", Well2::Status2String(Well2::Status::AUTO)); + BOOST_CHECK_EQUAL( "STOP", Well2::Status2String(Well2::Status::STOP)); } BOOST_AUTO_TEST_CASE(InjectorStatusEnumFromString) { - BOOST_CHECK_THROW( WellCommon::StatusFromString("XXX") , std::invalid_argument ); - BOOST_CHECK_EQUAL( WellCommon::OPEN , WellCommon::StatusFromString("OPEN")); - BOOST_CHECK_EQUAL( WellCommon::AUTO , WellCommon::StatusFromString("AUTO")); - BOOST_CHECK_EQUAL( WellCommon::SHUT , WellCommon::StatusFromString("SHUT")); - BOOST_CHECK_EQUAL( WellCommon::STOP , WellCommon::StatusFromString("STOP")); + BOOST_CHECK_THROW( Well2::StatusFromString("XXX") , std::invalid_argument ); + BOOST_CHECK( Well2::Status::OPEN == Well2::StatusFromString("OPEN")); + BOOST_CHECK( Well2::Status::AUTO == Well2::StatusFromString("AUTO")); + BOOST_CHECK( Well2::Status::SHUT == Well2::StatusFromString("SHUT")); + BOOST_CHECK( Well2::Status::STOP == Well2::StatusFromString("STOP")); } BOOST_AUTO_TEST_CASE(InjectorStatusEnumLoop) { - BOOST_CHECK_EQUAL( WellCommon::OPEN , WellCommon::StatusFromString( WellCommon::Status2String( WellCommon::OPEN ) )); - BOOST_CHECK_EQUAL( WellCommon::AUTO , WellCommon::StatusFromString( WellCommon::Status2String( WellCommon::AUTO ) )); - BOOST_CHECK_EQUAL( WellCommon::SHUT , WellCommon::StatusFromString( WellCommon::Status2String( WellCommon::SHUT ) )); - BOOST_CHECK_EQUAL( WellCommon::STOP , WellCommon::StatusFromString( WellCommon::Status2String( WellCommon::STOP ) )); + BOOST_CHECK( Well2::Status::OPEN == Well2::StatusFromString( Well2::Status2String( Well2::Status::OPEN ) )); + BOOST_CHECK( Well2::Status::AUTO == Well2::StatusFromString( Well2::Status2String( Well2::Status::AUTO ) )); + BOOST_CHECK( Well2::Status::SHUT == Well2::StatusFromString( Well2::Status2String( Well2::Status::SHUT ) )); + BOOST_CHECK( Well2::Status::STOP == Well2::StatusFromString( Well2::Status2String( Well2::Status::STOP ) )); - BOOST_CHECK_EQUAL( "STOP" , WellCommon::Status2String(WellCommon::StatusFromString( "STOP" ) )); - BOOST_CHECK_EQUAL( "OPEN" , WellCommon::Status2String(WellCommon::StatusFromString( "OPEN" ) )); - BOOST_CHECK_EQUAL( "SHUT" , WellCommon::Status2String(WellCommon::StatusFromString( "SHUT" ) )); - BOOST_CHECK_EQUAL( "AUTO" , WellCommon::Status2String(WellCommon::StatusFromString( "AUTO" ) )); + BOOST_CHECK_EQUAL( "STOP", Well2::Status2String(Well2::StatusFromString( "STOP" ) )); + BOOST_CHECK_EQUAL( "OPEN", Well2::Status2String(Well2::StatusFromString( "OPEN" ) )); + BOOST_CHECK_EQUAL( "SHUT", Well2::Status2String(Well2::StatusFromString( "SHUT" ) )); + BOOST_CHECK_EQUAL( "AUTO", Well2::Status2String(Well2::StatusFromString( "AUTO" ) )); } @@ -2623,110 +2618,110 @@ BOOST_AUTO_TEST_CASE(InjectorStatusEnumLoop) { /*****************************************************************/ BOOST_AUTO_TEST_CASE(ProducerCOntrolMopdeEnum2String) { - BOOST_CHECK_EQUAL( "ORAT" , WellProducer::ControlMode2String(WellProducer::ORAT)); - BOOST_CHECK_EQUAL( "WRAT" , WellProducer::ControlMode2String(WellProducer::WRAT)); - BOOST_CHECK_EQUAL( "GRAT" , WellProducer::ControlMode2String(WellProducer::GRAT)); - BOOST_CHECK_EQUAL( "LRAT" , WellProducer::ControlMode2String(WellProducer::LRAT)); - BOOST_CHECK_EQUAL( "CRAT" , WellProducer::ControlMode2String(WellProducer::CRAT)); - BOOST_CHECK_EQUAL( "RESV" , WellProducer::ControlMode2String(WellProducer::RESV)); - BOOST_CHECK_EQUAL( "BHP" , WellProducer::ControlMode2String(WellProducer::BHP)); - BOOST_CHECK_EQUAL( "THP" , WellProducer::ControlMode2String(WellProducer::THP)); - BOOST_CHECK_EQUAL( "GRUP" , WellProducer::ControlMode2String(WellProducer::GRUP)); + BOOST_CHECK_EQUAL( "ORAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::ORAT)); + BOOST_CHECK_EQUAL( "WRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::WRAT)); + BOOST_CHECK_EQUAL( "GRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::GRAT)); + BOOST_CHECK_EQUAL( "LRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::LRAT)); + BOOST_CHECK_EQUAL( "CRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::CRAT)); + BOOST_CHECK_EQUAL( "RESV" , Well2::ProducerCMode2String(Well2::ProducerCMode::RESV)); + BOOST_CHECK_EQUAL( "BHP" , Well2::ProducerCMode2String(Well2::ProducerCMode::BHP)); + BOOST_CHECK_EQUAL( "THP" , Well2::ProducerCMode2String(Well2::ProducerCMode::THP)); + BOOST_CHECK_EQUAL( "GRUP" , Well2::ProducerCMode2String(Well2::ProducerCMode::GRUP)); } BOOST_AUTO_TEST_CASE(ProducerControlModeEnumFromString) { - BOOST_CHECK_THROW( WellProducer::ControlModeFromString("XRAT") , std::invalid_argument ); - BOOST_CHECK_EQUAL( WellProducer::ORAT , WellProducer::ControlModeFromString("ORAT")); - BOOST_CHECK_EQUAL( WellProducer::WRAT , WellProducer::ControlModeFromString("WRAT")); - BOOST_CHECK_EQUAL( WellProducer::GRAT , WellProducer::ControlModeFromString("GRAT")); - BOOST_CHECK_EQUAL( WellProducer::LRAT , WellProducer::ControlModeFromString("LRAT")); - BOOST_CHECK_EQUAL( WellProducer::CRAT , WellProducer::ControlModeFromString("CRAT")); - BOOST_CHECK_EQUAL( WellProducer::RESV , WellProducer::ControlModeFromString("RESV")); - BOOST_CHECK_EQUAL( WellProducer::BHP , WellProducer::ControlModeFromString("BHP" )); - BOOST_CHECK_EQUAL( WellProducer::THP , WellProducer::ControlModeFromString("THP" )); - BOOST_CHECK_EQUAL( WellProducer::GRUP , WellProducer::ControlModeFromString("GRUP")); + BOOST_CHECK_THROW( Well2::ProducerCModeFromString("XRAT") , std::invalid_argument ); + BOOST_CHECK( Well2::ProducerCMode::ORAT == Well2::ProducerCModeFromString("ORAT")); + BOOST_CHECK( Well2::ProducerCMode::WRAT == Well2::ProducerCModeFromString("WRAT")); + BOOST_CHECK( Well2::ProducerCMode::GRAT == Well2::ProducerCModeFromString("GRAT")); + BOOST_CHECK( Well2::ProducerCMode::LRAT == Well2::ProducerCModeFromString("LRAT")); + BOOST_CHECK( Well2::ProducerCMode::CRAT == Well2::ProducerCModeFromString("CRAT")); + BOOST_CHECK( Well2::ProducerCMode::RESV == Well2::ProducerCModeFromString("RESV")); + BOOST_CHECK( Well2::ProducerCMode::BHP == Well2::ProducerCModeFromString("BHP" )); + BOOST_CHECK( Well2::ProducerCMode::THP == Well2::ProducerCModeFromString("THP" )); + BOOST_CHECK( Well2::ProducerCMode::GRUP == Well2::ProducerCModeFromString("GRUP")); } BOOST_AUTO_TEST_CASE(ProducerControlModeEnumLoop) { - BOOST_CHECK_EQUAL( WellProducer::ORAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::ORAT ) )); - BOOST_CHECK_EQUAL( WellProducer::WRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::WRAT ) )); - BOOST_CHECK_EQUAL( WellProducer::GRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::GRAT ) )); - BOOST_CHECK_EQUAL( WellProducer::LRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::LRAT ) )); - BOOST_CHECK_EQUAL( WellProducer::CRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::CRAT ) )); - BOOST_CHECK_EQUAL( WellProducer::RESV , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::RESV ) )); - BOOST_CHECK_EQUAL( WellProducer::BHP , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::BHP ) )); - BOOST_CHECK_EQUAL( WellProducer::THP , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::THP ) )); - BOOST_CHECK_EQUAL( WellProducer::GRUP , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::GRUP ) )); + BOOST_CHECK( Well2::ProducerCMode::ORAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::ORAT ) )); + BOOST_CHECK( Well2::ProducerCMode::WRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::WRAT ) )); + BOOST_CHECK( Well2::ProducerCMode::GRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::GRAT ) )); + BOOST_CHECK( Well2::ProducerCMode::LRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::LRAT ) )); + BOOST_CHECK( Well2::ProducerCMode::CRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::CRAT ) )); + BOOST_CHECK( Well2::ProducerCMode::RESV == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::RESV ) )); + BOOST_CHECK( Well2::ProducerCMode::BHP == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::BHP ) )); + BOOST_CHECK( Well2::ProducerCMode::THP == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::THP ) )); + BOOST_CHECK( Well2::ProducerCMode::GRUP == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::GRUP ) )); - BOOST_CHECK_EQUAL( "ORAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "ORAT" ) )); - BOOST_CHECK_EQUAL( "WRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "WRAT" ) )); - BOOST_CHECK_EQUAL( "GRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "GRAT" ) )); - BOOST_CHECK_EQUAL( "LRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "LRAT" ) )); - BOOST_CHECK_EQUAL( "CRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "CRAT" ) )); - BOOST_CHECK_EQUAL( "RESV" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "RESV" ) )); - BOOST_CHECK_EQUAL( "BHP" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "BHP" ) )); - BOOST_CHECK_EQUAL( "THP" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "THP" ) )); - BOOST_CHECK_EQUAL( "GRUP" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "GRUP" ) )); + BOOST_CHECK_EQUAL( "ORAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "ORAT" ) )); + BOOST_CHECK_EQUAL( "WRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "WRAT" ) )); + BOOST_CHECK_EQUAL( "GRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "GRAT" ) )); + BOOST_CHECK_EQUAL( "LRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "LRAT" ) )); + BOOST_CHECK_EQUAL( "CRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "CRAT" ) )); + BOOST_CHECK_EQUAL( "RESV" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "RESV" ) )); + BOOST_CHECK_EQUAL( "BHP" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "BHP" ) )); + BOOST_CHECK_EQUAL( "THP" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "THP" ) )); + BOOST_CHECK_EQUAL( "GRUP" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "GRUP" ) )); } /*******************************************************************/ /*****************************************************************/ BOOST_AUTO_TEST_CASE(GuideRatePhaseEnum2String) { - BOOST_CHECK_EQUAL( "OIL" , GuideRate::GuideRatePhaseEnum2String(GuideRate::OIL)); - BOOST_CHECK_EQUAL( "WAT" , GuideRate::GuideRatePhaseEnum2String(GuideRate::WAT)); - BOOST_CHECK_EQUAL( "GAS" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GAS)); - BOOST_CHECK_EQUAL( "LIQ" , GuideRate::GuideRatePhaseEnum2String(GuideRate::LIQ)); - BOOST_CHECK_EQUAL( "COMB" , GuideRate::GuideRatePhaseEnum2String(GuideRate::COMB)); - BOOST_CHECK_EQUAL( "WGA" , GuideRate::GuideRatePhaseEnum2String(GuideRate::WGA)); - BOOST_CHECK_EQUAL( "CVAL" , GuideRate::GuideRatePhaseEnum2String(GuideRate::CVAL)); - BOOST_CHECK_EQUAL( "RAT" , GuideRate::GuideRatePhaseEnum2String(GuideRate::RAT)); - BOOST_CHECK_EQUAL( "RES" , GuideRate::GuideRatePhaseEnum2String(GuideRate::RES)); - BOOST_CHECK_EQUAL( "UNDEFINED" , GuideRate::GuideRatePhaseEnum2String(GuideRate::UNDEFINED)); + BOOST_CHECK_EQUAL( "OIL" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::OIL)); + BOOST_CHECK_EQUAL( "WAT" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::WAT)); + BOOST_CHECK_EQUAL( "GAS" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::GAS)); + BOOST_CHECK_EQUAL( "LIQ" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::LIQ)); + BOOST_CHECK_EQUAL( "COMB" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::COMB)); + BOOST_CHECK_EQUAL( "WGA" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::WGA)); + BOOST_CHECK_EQUAL( "CVAL" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::CVAL)); + BOOST_CHECK_EQUAL( "RAT" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::RAT)); + BOOST_CHECK_EQUAL( "RES" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::RES)); + BOOST_CHECK_EQUAL( "UNDEFINED" , Well2::GuideRateTarget2String(Well2::GuideRateTarget::UNDEFINED)); } BOOST_AUTO_TEST_CASE(GuideRatePhaseEnumFromString) { - BOOST_CHECK_THROW( GuideRate::GuideRatePhaseEnumFromString("XRAT") , std::invalid_argument ); - BOOST_CHECK_EQUAL( GuideRate::OIL , GuideRate::GuideRatePhaseEnumFromString("OIL")); - BOOST_CHECK_EQUAL( GuideRate::WAT , GuideRate::GuideRatePhaseEnumFromString("WAT")); - BOOST_CHECK_EQUAL( GuideRate::GAS , GuideRate::GuideRatePhaseEnumFromString("GAS")); - BOOST_CHECK_EQUAL( GuideRate::LIQ , GuideRate::GuideRatePhaseEnumFromString("LIQ")); - BOOST_CHECK_EQUAL( GuideRate::COMB , GuideRate::GuideRatePhaseEnumFromString("COMB")); - BOOST_CHECK_EQUAL( GuideRate::WGA , GuideRate::GuideRatePhaseEnumFromString("WGA")); - BOOST_CHECK_EQUAL( GuideRate::CVAL , GuideRate::GuideRatePhaseEnumFromString("CVAL")); - BOOST_CHECK_EQUAL( GuideRate::RAT , GuideRate::GuideRatePhaseEnumFromString("RAT")); - BOOST_CHECK_EQUAL( GuideRate::RES , GuideRate::GuideRatePhaseEnumFromString("RES")); - BOOST_CHECK_EQUAL( GuideRate::UNDEFINED, GuideRate::GuideRatePhaseEnumFromString("UNDEFINED")); + BOOST_CHECK_THROW( Well2::GuideRateTargetFromString("XRAT") , std::invalid_argument ); + BOOST_CHECK( Well2::GuideRateTarget::OIL == Well2::GuideRateTargetFromString("OIL")); + BOOST_CHECK( Well2::GuideRateTarget::WAT == Well2::GuideRateTargetFromString("WAT")); + BOOST_CHECK( Well2::GuideRateTarget::GAS == Well2::GuideRateTargetFromString("GAS")); + BOOST_CHECK( Well2::GuideRateTarget::LIQ == Well2::GuideRateTargetFromString("LIQ")); + BOOST_CHECK( Well2::GuideRateTarget::COMB == Well2::GuideRateTargetFromString("COMB")); + BOOST_CHECK( Well2::GuideRateTarget::WGA == Well2::GuideRateTargetFromString("WGA")); + BOOST_CHECK( Well2::GuideRateTarget::CVAL == Well2::GuideRateTargetFromString("CVAL")); + BOOST_CHECK( Well2::GuideRateTarget::RAT == Well2::GuideRateTargetFromString("RAT")); + BOOST_CHECK( Well2::GuideRateTarget::RES == Well2::GuideRateTargetFromString("RES")); + BOOST_CHECK( Well2::GuideRateTarget::UNDEFINED == Well2::GuideRateTargetFromString("UNDEFINED")); } BOOST_AUTO_TEST_CASE(GuideRatePhaseEnum2Loop) { - BOOST_CHECK_EQUAL( GuideRate::OIL , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::OIL ) )); - BOOST_CHECK_EQUAL( GuideRate::WAT , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::WAT ) )); - BOOST_CHECK_EQUAL( GuideRate::GAS , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::GAS ) )); - BOOST_CHECK_EQUAL( GuideRate::LIQ , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::LIQ ) )); - BOOST_CHECK_EQUAL( GuideRate::COMB , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::COMB ) )); - BOOST_CHECK_EQUAL( GuideRate::WGA , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::WGA ) )); - BOOST_CHECK_EQUAL( GuideRate::CVAL , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::CVAL ) )); - BOOST_CHECK_EQUAL( GuideRate::RAT , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::RAT ) )); - BOOST_CHECK_EQUAL( GuideRate::RES , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::RES ) )); - BOOST_CHECK_EQUAL( GuideRate::UNDEFINED , GuideRate::GuideRatePhaseEnumFromString( GuideRate::GuideRatePhaseEnum2String( GuideRate::UNDEFINED ) )); + BOOST_CHECK( Well2::GuideRateTarget::OIL == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::OIL ) )); + BOOST_CHECK( Well2::GuideRateTarget::WAT == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::WAT ) )); + BOOST_CHECK( Well2::GuideRateTarget::GAS == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::GAS ) )); + BOOST_CHECK( Well2::GuideRateTarget::LIQ == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::LIQ ) )); + BOOST_CHECK( Well2::GuideRateTarget::COMB == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::COMB ) )); + BOOST_CHECK( Well2::GuideRateTarget::WGA == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::WGA ) )); + BOOST_CHECK( Well2::GuideRateTarget::CVAL == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::CVAL ) )); + BOOST_CHECK( Well2::GuideRateTarget::RAT == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::RAT ) )); + BOOST_CHECK( Well2::GuideRateTarget::RES == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::RES ) )); + BOOST_CHECK( Well2::GuideRateTarget::UNDEFINED == Well2::GuideRateTargetFromString( Well2::GuideRateTarget2String( Well2::GuideRateTarget::UNDEFINED ) )); - BOOST_CHECK_EQUAL( "OIL" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "OIL" ) )); - BOOST_CHECK_EQUAL( "WAT" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "WAT" ) )); - BOOST_CHECK_EQUAL( "GAS" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "GAS" ) )); - BOOST_CHECK_EQUAL( "LIQ" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "LIQ" ) )); - BOOST_CHECK_EQUAL( "COMB" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "COMB" ) )); - BOOST_CHECK_EQUAL( "WGA" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "WGA" ) )); - BOOST_CHECK_EQUAL( "CVAL" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "CVAL" ) )); - BOOST_CHECK_EQUAL( "RAT" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "RAT" ) )); - BOOST_CHECK_EQUAL( "RES" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "RES" ) )); - BOOST_CHECK_EQUAL( "UNDEFINED" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "UNDEFINED" ) )); + BOOST_CHECK_EQUAL( "OIL" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "OIL" ) )); + BOOST_CHECK_EQUAL( "WAT" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "WAT" ) )); + BOOST_CHECK_EQUAL( "GAS" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "GAS" ) )); + BOOST_CHECK_EQUAL( "LIQ" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "LIQ" ) )); + BOOST_CHECK_EQUAL( "COMB" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "COMB" ) )); + BOOST_CHECK_EQUAL( "WGA" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "WGA" ) )); + BOOST_CHECK_EQUAL( "CVAL" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "CVAL" ) )); + BOOST_CHECK_EQUAL( "RAT" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "RAT" ) )); + BOOST_CHECK_EQUAL( "RES" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "RES" ) )); + BOOST_CHECK_EQUAL( "UNDEFINED" , Well2::GuideRateTarget2String(Well2::GuideRateTargetFromString( "UNDEFINED" ) )); } @@ -3190,16 +3185,16 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) { BOOST_CHECK(ws.updateRefDepth(1.0)); BOOST_CHECK(!ws.updateRefDepth(1.0)); - ws.updateStatus(WellCommon::OPEN); - BOOST_CHECK(!ws.updateStatus(WellCommon::OPEN)); - BOOST_CHECK(ws.updateStatus(WellCommon::SHUT)); + ws.updateStatus(Well2::Status::OPEN); + BOOST_CHECK(!ws.updateStatus(Well2::Status::OPEN)); + BOOST_CHECK(ws.updateStatus(Well2::Status::SHUT)); const auto& connections = ws.getConnections(); BOOST_CHECK_EQUAL(connections.size(), 0); auto c2 = std::make_shared(1,1); c2->addConnection(1,1,1, 100, - WellCompletion::StateEnum::OPEN, + Connection::State::OPEN, 10, 10, 10, @@ -3301,13 +3296,13 @@ BOOST_AUTO_TEST_CASE(RFT_CONFIG) { BOOST_CHECK(!conf.getWellOpenRFT("W1", 0)); - conf.updateRFT("W1", 2, RFTConnections::YES); + conf.updateRFT("W1", 2, RFTConfig::RFT::YES); BOOST_CHECK(conf.rft("W1", 2)); BOOST_CHECK(!conf.rft("W1", 1)); BOOST_CHECK(!conf.rft("W1", 3)); - conf.updateRFT("W2", 2, RFTConnections::REPT); - conf.updateRFT("W2", 4, RFTConnections::NO); + conf.updateRFT("W2", 2, RFTConfig::RFT::REPT); + conf.updateRFT("W2", 4, RFTConfig::RFT::NO); BOOST_CHECK(!conf.rft("W2", 1)); BOOST_CHECK( conf.rft("W2", 2)); BOOST_CHECK( conf.rft("W2", 3)); @@ -3317,7 +3312,7 @@ BOOST_AUTO_TEST_CASE(RFT_CONFIG) { conf.setWellOpenRFT("W3"); BOOST_CHECK(conf.getWellOpenRFT("W3", 2)); - conf.updateRFT("W4", 2, RFTConnections::FOPN); + conf.updateRFT("W4", 2, RFTConfig::RFT::FOPN); BOOST_CHECK(conf.getWellOpenRFT("W4", 2)); diff --git a/tests/parser/WTEST.cpp b/tests/parser/WTEST.cpp index 2464a09ef..8aa2c0dbd 100644 --- a/tests/parser/WTEST.cpp +++ b/tests/parser/WTEST.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -77,17 +76,17 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE2) { const UnitSystem us{}; std::vector wells; - wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.); + wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.); { - wells[0].updateStatus(WellCommon::SHUT); - auto shut_wells = st.updateWells(wc, wells, 5000); - BOOST_CHECK_EQUAL(shut_wells.size(), 0); + wells[0].updateStatus(Well2::Status::SHUT); + auto shut_wells = st.updateWells(wc, wells, 5000); + BOOST_CHECK_EQUAL(shut_wells.size(), 0); } { - wells[0].updateStatus(WellCommon::OPEN); - auto shut_wells = st.updateWells(wc, wells, 5000); - BOOST_CHECK_EQUAL( shut_wells.size(), 1); + wells[0].updateStatus(Well2::Status::OPEN); + auto shut_wells = st.updateWells(wc, wells, 5000); + BOOST_CHECK_EQUAL( shut_wells.size(), 1); } } @@ -111,17 +110,17 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE) { const UnitSystem us{}; std::vector wells; - wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.); - wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.); + wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.); + wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.); WellTestConfig wc; { - wells[0].updateStatus(WellCommon::SHUT); + wells[0].updateStatus(Well2::Status::SHUT); auto shut_wells = st.updateWells(wc, wells, 110. * day); BOOST_CHECK_EQUAL(shut_wells.size(), 0); } { - wells[0].updateStatus(WellCommon::OPEN); + wells[0].updateStatus(Well2::Status::OPEN); auto shut_wells = st.updateWells(wc, wells, 110. * day); BOOST_CHECK_EQUAL(shut_wells.size(), 0); } @@ -152,10 +151,10 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE) { wc.add_well("WELL_NAME", WellTestConfig::Reason::PHYSICAL, 1000. * day, 3, 0, 5); - wells[0].updateStatus(WellCommon::SHUT); + wells[0].updateStatus(Well2::Status::SHUT); BOOST_CHECK_EQUAL( st.updateWells(wc, wells, 4100. * day).size(), 0); - wells[0].updateStatus(WellCommon::OPEN); + wells[0].updateStatus(Well2::Status::OPEN); BOOST_CHECK_EQUAL( st.updateWells(wc, wells, 4100. * day).size(), 1); BOOST_CHECK_EQUAL( st.updateWells(wc, wells, 5200. * day).size(), 1); @@ -182,10 +181,10 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE_COMPLETIONS) { const UnitSystem us{}; std::vector wells; - wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.); - wells[0].updateStatus(WellCommon::OPEN); - wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.); - wells[1].updateStatus(WellCommon::OPEN); + wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.); + wells[0].updateStatus(Well2::Status::OPEN); + wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.); + wells[1].updateStatus(Well2::Status::OPEN); auto closed_completions = st.updateWells(wc, wells, 5000); BOOST_CHECK_EQUAL( closed_completions.size(), 0); diff --git a/tests/parser/WellTests.cpp b/tests/parser/WellTests.cpp index 012735cbc..ba33250c1 100644 --- a/tests/parser/WellTests.cpp +++ b/tests/parser/WellTests.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -191,7 +190,7 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) { } BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) { - Opm::Well2 well("WELL1", "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1", "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); BOOST_CHECK_EQUAL( 0U , well.getConnections( ).size() ); } @@ -200,7 +199,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { // HACK: This test checks correctly setting of isProducer/isInjector. This property depends on which of // WellProductionProperties/WellInjectionProperties is set last, independent of actual values. { - Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); /* 1: Well is created as producer */ @@ -208,7 +207,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { BOOST_CHECK_EQUAL( true , well.isProducer()); /* Set a surface injection rate => Well becomes an Injector */ - auto injectionProps1 = std::make_shared(well.getInjectionProperties()); + auto injectionProps1 = std::make_shared(well.getInjectionProperties()); injectionProps1->surfaceInjectionRate.reset(100); well.updateInjection(injectionProps1); BOOST_CHECK_EQUAL( true , well.isInjector()); @@ -218,10 +217,10 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { { - Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); /* Set a reservoir injection rate => Well becomes an Injector */ - auto injectionProps2 = std::make_shared(well.getInjectionProperties()); + auto injectionProps2 = std::make_shared(well.getInjectionProperties()); injectionProps2->reservoirInjectionRate.reset(200); well.updateInjection(injectionProps2); BOOST_CHECK_EQUAL( false , well.isProducer()); @@ -229,13 +228,13 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { } { - Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); /* Set rates => Well becomes a producer; injection rate should be set to 0. */ - auto injectionProps3 = std::make_shared(well.getInjectionProperties()); + auto injectionProps3 = std::make_shared(well.getInjectionProperties()); well.updateInjection(injectionProps3); - auto properties = std::make_shared( well.getProductionProperties() ); + auto properties = std::make_shared( well.getProductionProperties() ); properties->OilRate.reset(100); properties->GasRate.reset(200); properties->WaterRate.reset(300); @@ -252,7 +251,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { } BOOST_AUTO_TEST_CASE(GroupnameCorretlySet) { - Opm::Well2 well("WELL1" , "G1", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1" , "G1", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); BOOST_CHECK_EQUAL("G1" , well.groupName()); well.updateGroup( "GROUP2"); @@ -261,7 +260,7 @@ BOOST_AUTO_TEST_CASE(GroupnameCorretlySet) { BOOST_AUTO_TEST_CASE(addWELSPECS_setData_dataSet) { - Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); BOOST_CHECK_EQUAL(23, well.getHeadI()); BOOST_CHECK_EQUAL(42, well.getHeadJ()); @@ -271,34 +270,34 @@ BOOST_AUTO_TEST_CASE(addWELSPECS_setData_dataSet) { BOOST_AUTO_TEST_CASE(XHPLimitDefault) { - Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); - auto productionProps = std::make_shared(well.getProductionProperties()); + auto productionProps = std::make_shared(well.getProductionProperties()); productionProps->BHPLimit.reset(100); - productionProps->addProductionControl(Opm::WellProducer::BHP); + productionProps->addProductionControl(Opm::Well2::ProducerCMode::BHP); well.updateProduction(productionProps); BOOST_CHECK_EQUAL( 100 , well.getProductionProperties().BHPLimit.get()); - BOOST_CHECK_EQUAL( true, well.getProductionProperties().hasProductionControl( Opm::WellProducer::BHP )); + BOOST_CHECK_EQUAL( true, well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::BHP )); - auto injProps = std::make_shared(well.getInjectionProperties()); + auto injProps = std::make_shared(well.getInjectionProperties()); injProps->THPLimit.reset(200); well.updateInjection(injProps); BOOST_CHECK_EQUAL( 200 , well.getInjectionProperties().THPLimit.get()); - BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::THP )); + BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::THP )); } BOOST_AUTO_TEST_CASE(InjectorType) { - Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); - auto injectionProps = std::make_shared(well.getInjectionProperties()); - injectionProps->injectorType = Opm::WellInjector::WATER; + auto injectionProps = std::make_shared(well.getInjectionProperties()); + injectionProps->injectorType = Opm::Well2::InjectorType::WATER; well.updateInjection(injectionProps); // TODO: Should we test for something other than wate here, as long as // the default value for InjectorType is WellInjector::WATER? - BOOST_CHECK_EQUAL( Opm::WellInjector::WATER , well.getInjectionProperties().injectorType); + BOOST_CHECK( Opm::Well2::InjectorType::WATER == well.getInjectionProperties().injectorType); } @@ -307,26 +306,26 @@ BOOST_AUTO_TEST_CASE(InjectorType) { BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) { - Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); - BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT )); - BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::WellProducer::RESV )); + BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT )); + BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::RESV )); - auto properties1 = std::make_shared(well.getProductionProperties()); + auto properties1 = std::make_shared(well.getProductionProperties()); properties1->OilRate.reset(100); - properties1->addProductionControl(Opm::WellProducer::ORAT); + properties1->addProductionControl(Opm::Well2::ProducerCMode::ORAT); well.updateProduction(properties1); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT )); - BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::WellProducer::RESV )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT )); + BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::RESV )); - auto properties2 = std::make_shared(well.getProductionProperties()); + auto properties2 = std::make_shared(well.getProductionProperties()); properties2->ResVRate.reset( 100 ); - properties2->addProductionControl(Opm::WellProducer::RESV); + properties2->addProductionControl(Opm::Well2::ProducerCMode::RESV); well.updateProduction(properties2); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::RESV )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::RESV )); - auto properties3 = std::make_shared(well.getProductionProperties()); + auto properties3 = std::make_shared(well.getProductionProperties()); properties3->OilRate.reset(100); properties3->WaterRate.reset(100); properties3->GasRate.reset(100); @@ -334,80 +333,80 @@ BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) { properties3->ResVRate.reset(100); properties3->BHPLimit.reset(100); properties3->THPLimit.reset(100); - properties3->addProductionControl(Opm::WellProducer::ORAT); - properties3->addProductionControl(Opm::WellProducer::LRAT); - properties3->addProductionControl(Opm::WellProducer::BHP); + properties3->addProductionControl(Opm::Well2::ProducerCMode::ORAT); + properties3->addProductionControl(Opm::Well2::ProducerCMode::LRAT); + properties3->addProductionControl(Opm::Well2::ProducerCMode::BHP); well.updateProduction(properties3); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT )); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::LRAT )); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::BHP )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::LRAT )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::BHP )); - auto properties4 = std::make_shared(well.getProductionProperties()); - properties4->dropProductionControl( Opm::WellProducer::LRAT ); + auto properties4 = std::make_shared(well.getProductionProperties()); + properties4->dropProductionControl( Opm::Well2::ProducerCMode::LRAT ); well.updateProduction(properties4); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT )); - BOOST_CHECK(!well.getProductionProperties().hasProductionControl( Opm::WellProducer::LRAT )); - BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::BHP )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT )); + BOOST_CHECK(!well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::LRAT )); + BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::BHP )); } BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) { - Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); - BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); - BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); + BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE )); + BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV )); - auto injProps1 = std::make_shared(well.getInjectionProperties()); + auto injProps1 = std::make_shared(well.getInjectionProperties()); injProps1->surfaceInjectionRate.reset(100); - injProps1->addInjectionControl(Opm::WellInjector::RATE); + injProps1->addInjectionControl(Opm::Well2::InjectorCMode::RATE); well.updateInjection(injProps1); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); - BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE )); + BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV )); - auto injProps2 = std::make_shared(well.getInjectionProperties()); + auto injProps2 = std::make_shared(well.getInjectionProperties()); injProps2->reservoirInjectionRate.reset(100); - injProps2->addInjectionControl(Opm::WellInjector::RESV); + injProps2->addInjectionControl(Opm::Well2::InjectorCMode::RESV); well.updateInjection(injProps2); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV )); - auto injProps3 = std::make_shared(well.getInjectionProperties()); + auto injProps3 = std::make_shared(well.getInjectionProperties()); injProps3->BHPLimit.reset(100); - injProps3->addInjectionControl(Opm::WellInjector::BHP); + injProps3->addInjectionControl(Opm::Well2::InjectorCMode::BHP); injProps3->THPLimit.reset(100); - injProps3->addInjectionControl(Opm::WellInjector::THP); + injProps3->addInjectionControl(Opm::Well2::InjectorCMode::THP); well.updateInjection(injProps3); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::THP )); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::BHP )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::THP )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::BHP )); - auto injProps4 = std::make_shared(well.getInjectionProperties()); - injProps4->dropInjectionControl( Opm::WellInjector::RESV ); + auto injProps4 = std::make_shared(well.getInjectionProperties()); + injProps4->dropInjectionControl( Opm::Well2::InjectorCMode::RESV ); well.updateInjection(injProps4); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); - BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::THP )); - BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::BHP )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE )); + BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::THP )); + BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::BHP )); } /*********************************************************************/ BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) { - Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); - BOOST_CHECK_EQUAL(Opm::GuideRate::UNDEFINED, well.getGuideRatePhase()); + BOOST_CHECK(Opm::Well2::GuideRateTarget::UNDEFINED == well.getGuideRatePhase()); - BOOST_CHECK(well.updateWellGuideRate(true, 100, Opm::GuideRate::RAT, 66.0)); - BOOST_CHECK_EQUAL(Opm::GuideRate::RAT, well.getGuideRatePhase()); + BOOST_CHECK(well.updateWellGuideRate(true, 100, Opm::Well2::GuideRateTarget::RAT, 66.0)); + BOOST_CHECK(Opm::Well2::GuideRateTarget::RAT == well.getGuideRatePhase()); BOOST_CHECK_EQUAL(100, well.getGuideRate()); BOOST_CHECK_EQUAL(66.0, well.getGuideRateScalingFactor()); } BOOST_AUTO_TEST_CASE(WellEfficiencyFactorSet) { - Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); BOOST_CHECK_EQUAL(1.0, well.getEfficiencyFactor()); BOOST_CHECK( well.updateEfficiencyFactor(0.9)); @@ -487,12 +486,12 @@ namespace { } - Opm::WellProductionProperties properties(const std::string& input) { + Opm::Well2::WellProductionProperties properties(const std::string& input) { Opm::Parser parser; auto deck = parser.parseString(input); const auto& record = deck.getKeyword("WCONHIST").getRecord(0); - Opm::WellProductionProperties hist("W"); + Opm::Well2::WellProductionProperties hist("W"); hist.handleWCONHIST(record); @@ -539,13 +538,13 @@ namespace { } - Opm::WellProductionProperties properties(const std::string& input) + Opm::Well2::WellProductionProperties properties(const std::string& input) { Opm::Parser parser; auto deck = parser.parseString(input); const auto& kwd = deck.getKeyword("WCONPROD"); const auto& record = kwd.getRecord(0); - Opm::WellProductionProperties pred("W"); + Opm::Well2::WellProductionProperties pred("W"); pred.handleWCONPROD("WELL", record); return pred; @@ -556,100 +555,100 @@ namespace { BOOST_AUTO_TEST_CASE(WCH_All_Specified_BHP_Defaulted) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::all_specified()); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::ORAT); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::ORAT); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 101325.); } BOOST_AUTO_TEST_CASE(WCH_ORAT_Defaulted_BHP_Defaulted) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::orat_defaulted()); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::WRAT); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::WRAT); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 101325.); } BOOST_AUTO_TEST_CASE(WCH_OWRAT_Defaulted_BHP_Defaulted) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::owrat_defaulted()); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::GRAT); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::GRAT); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 101325.); } BOOST_AUTO_TEST_CASE(WCH_Rates_Defaulted_BHP_Defaulted) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::all_defaulted()); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::LRAT); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::LRAT); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 101325.); } BOOST_AUTO_TEST_CASE(WCH_Rates_Defaulted_BHP_Specified) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::all_defaulted_with_bhp()); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::RESV)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::RESV); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::RESV); - BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 101325.); } BOOST_AUTO_TEST_CASE(WCH_Rates_NON_Defaulted_VFP) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::all_defaulted_with_bhp_vfp_table()); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::RESV)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::RESV); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::RESV); - BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.VFPTableNumber, 3); BOOST_CHECK_EQUAL(p.ALQValue, 10.); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 101325.); @@ -657,36 +656,36 @@ BOOST_AUTO_TEST_CASE(WCH_Rates_NON_Defaulted_VFP) BOOST_AUTO_TEST_CASE(WCH_BHP_Specified) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONHIST::properties(WCONHIST::bhp_defaulted()); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::BHP); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::BHP); - BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.BHPLimit.get(), 5.e7); // 500 barsa } BOOST_AUTO_TEST_CASE(WCONPROD_ORAT_CMode) { - const Opm::WellProductionProperties& p = WCONPROD::properties(WCONPROD::orat_CMODE_other_defaulted()); + const Opm::Well2::WellProductionProperties& p = WCONPROD::properties(WCONPROD::orat_CMODE_other_defaulted()); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::THP)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::THP)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::ORAT); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::ORAT); - BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.VFPTableNumber, 0); BOOST_CHECK_EQUAL(p.ALQValue, 0.); @@ -694,19 +693,19 @@ BOOST_AUTO_TEST_CASE(WCONPROD_ORAT_CMode) BOOST_AUTO_TEST_CASE(WCONPROD_THP_CMode) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONPROD::properties(WCONPROD::thp_CMODE()); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::THP)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::THP)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::THP); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::THP); - BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.VFPTableNumber, 8); BOOST_CHECK_EQUAL(p.ALQValue, 13.); @@ -716,19 +715,19 @@ BOOST_AUTO_TEST_CASE(WCONPROD_THP_CMode) BOOST_AUTO_TEST_CASE(WCONPROD_BHP_CMode) { - const Opm::WellProductionProperties& p = + const Opm::Well2::WellProductionProperties& p = WCONPROD::properties(WCONPROD::bhp_CMODE()); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::GRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT)); - BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV)); - BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::THP)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT)); + BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV)); + BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::THP)); - BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::BHP); + BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::BHP); - BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); + BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP)); BOOST_CHECK_EQUAL(p.VFPTableNumber, 8); BOOST_CHECK_EQUAL(p.ALQValue, 13.); @@ -747,19 +746,19 @@ BOOST_AUTO_TEST_CASE(BHP_CMODE) BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) { - const Opm::WellProductionProperties Pproperties("W"); - const Opm::WellInjectionProperties Iproperties("W"); + const Opm::Well2::WellProductionProperties Pproperties("W"); + const Opm::Well2::WellInjectionProperties Iproperties("W"); - BOOST_CHECK_EQUAL( Pproperties.controlMode , Opm::WellProducer::CMODE_UNDEFINED ); - BOOST_CHECK_EQUAL( Iproperties.controlMode , Opm::WellInjector::CMODE_UNDEFINED ); + BOOST_CHECK( Pproperties.controlMode == Opm::Well2::ProducerCMode::CMODE_UNDEFINED ); + BOOST_CHECK( Iproperties.controlMode == Opm::Well2::InjectorCMode::CMODE_UNDEFINED ); } BOOST_AUTO_TEST_CASE(WELL_CONTROLS) { - Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Opm::WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); - Opm::WellProductionProperties prod("OP1"); + Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Opm::Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2::WellProductionProperties prod("OP1"); Opm::SummaryState st; well.productionControls(st); @@ -779,14 +778,14 @@ BOOST_AUTO_TEST_CASE(WELL_CONTROLS) { BOOST_AUTO_TEST_CASE(ExtraAccessors) { - Opm::Well2 inj("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); - Opm::Well2 prod("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 inj("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); + Opm::Well2 prod("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); - auto inj_props= std::make_shared(inj.getInjectionProperties()); + auto inj_props= std::make_shared(inj.getInjectionProperties()); inj_props->VFPTableNumber = 100; inj.updateInjection(inj_props); - auto prod_props = std::make_shared( prod.getProductionProperties() ); + auto prod_props = std::make_shared( prod.getProductionProperties() ); prod_props->VFPTableNumber = 200; prod.updateProduction(prod_props); diff --git a/tests/parser/integration/ParseKEYWORD.cpp b/tests/parser/integration/ParseKEYWORD.cpp index 656738b8d..0714d5956 100644 --- a/tests/parser/integration/ParseKEYWORD.cpp +++ b/tests/parser/integration/ParseKEYWORD.cpp @@ -465,19 +465,19 @@ BOOST_AUTO_TEST_CASE( MULTISEGMENT_ABS ) { const double depth_top = rec1.getItem("DEPTH").get< double >(0); const double length_top = rec1.getItem("LENGTH").get< double >(0); const double volume_top = rec1.getItem("WELLBORE_VOLUME").get< double >(0); - const WellSegment::LengthDepthEnum length_depth_type = WellSegment::LengthDepthEnumFromString(rec1.getItem("INFO_TYPE").getTrimmedString(0)); - const WellSegment::CompPressureDropEnum comp_pressure_drop = WellSegment::CompPressureDropEnumFromString(rec1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0)); - const WellSegment::MultiPhaseModelEnum multiphase_model = WellSegment::MultiPhaseModelEnumFromString(rec1.getItem("FLOW_MODEL").getTrimmedString(0)); + const WellSegments::LengthDepth length_depth_type = WellSegments::LengthDepthFromString(rec1.getItem("INFO_TYPE").getTrimmedString(0)); + const WellSegments::CompPressureDrop comp_pressure_drop = WellSegments::CompPressureDropFromString(rec1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0)); + const WellSegments::MultiPhaseModel multiphase_model = WellSegments::MultiPhaseModelFromString(rec1.getItem("FLOW_MODEL").getTrimmedString(0)); BOOST_CHECK_EQUAL( "PROD01", well_name ); BOOST_CHECK_EQUAL( 2512.5, depth_top ); BOOST_CHECK_EQUAL( 2512.5, length_top ); BOOST_CHECK_EQUAL( 1.0e-5, volume_top ); - const std::string length_depth_type_string = WellSegment::LengthDepthEnumToString(length_depth_type); + const std::string length_depth_type_string = WellSegments::LengthDepthToString(length_depth_type); BOOST_CHECK_EQUAL( length_depth_type_string, "ABS" ); - const std::string comp_pressure_drop_string = WellSegment::CompPressureDropEnumToString(comp_pressure_drop); + const std::string comp_pressure_drop_string = WellSegments::CompPressureDropToString(comp_pressure_drop); BOOST_CHECK_EQUAL( comp_pressure_drop_string, "H--" ); - const std::string multiphase_model_string = WellSegment::MultiPhaseModelEnumToString(multiphase_model); + const std::string multiphase_model_string = WellSegments::MultiPhaseModelToString(multiphase_model); BOOST_CHECK_EQUAL( multiphase_model_string, "HO" ); } diff --git a/tests/parser/integration/ScheduleCreateFromDeck.cpp b/tests/parser/integration/ScheduleCreateFromDeck.cpp index 918f1817a..44ddb30d6 100644 --- a/tests/parser/integration/ScheduleCreateFromDeck.cpp +++ b/tests/parser/integration/ScheduleCreateFromDeck.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -111,10 +110,8 @@ BOOST_AUTO_TEST_CASE(WellTestRefDepth) { EclipseGrid grid(40,60,30); TableManager table ( deck ); Eclipse3DProperties eclipseProperties ( deck , table, grid); - BOOST_CHECK_EQUAL(3, 3); Runspec runspec (deck); Schedule sched(deck , grid , eclipseProperties, runspec); - BOOST_CHECK_EQUAL(4, 4); const auto& well1 = sched.getWell2atEnd("W_1"); const auto& well2 = sched.getWell2atEnd("W_2"); @@ -146,7 +143,7 @@ BOOST_AUTO_TEST_CASE(WellTesting) { BOOST_CHECK_CLOSE( 777/Metric::Time , sched.getWell2("W_2", 7).getProductionProperties().ResVRate.get() , 0.0001); BOOST_CHECK_EQUAL( 0 , sched.getWell2("W_2", 8).getProductionProperties().ResVRate.get()); - BOOST_CHECK_EQUAL( WellCommon::SHUT , sched.getWell2("W_2", 3).getStatus()); + BOOST_CHECK( Well2::Status::SHUT == sched.getWell2("W_2", 3).getStatus()); { const auto& rft_config = sched.rftConfig(); @@ -157,19 +154,19 @@ BOOST_AUTO_TEST_CASE(WellTesting) { BOOST_CHECK( rft_config.rft("W_1", 3)); } { - const WellProductionProperties& prop3 = sched.getWell2("W_2", 3).getProductionProperties(); - BOOST_CHECK_EQUAL( WellProducer::ORAT , prop3.controlMode); - BOOST_CHECK( prop3.hasProductionControl(WellProducer::ORAT)); - BOOST_CHECK( !prop3.hasProductionControl(WellProducer::GRAT)); - BOOST_CHECK( !prop3.hasProductionControl(WellProducer::WRAT)); + const auto & prop3 = sched.getWell2("W_2", 3).getProductionProperties(); + BOOST_CHECK( Well2::ProducerCMode::ORAT == prop3.controlMode); + BOOST_CHECK( prop3.hasProductionControl(Well2::ProducerCMode::ORAT)); + BOOST_CHECK( !prop3.hasProductionControl(Well2::ProducerCMode::GRAT)); + BOOST_CHECK( !prop3.hasProductionControl(Well2::ProducerCMode::WRAT)); } - BOOST_CHECK_EQUAL( WellCommon::AUTO, sched.getWell2("W_3", 3).getStatus()); + BOOST_CHECK( Well2::Status::AUTO == sched.getWell2("W_3", 3).getStatus()); { - const WellProductionProperties& prop7 = sched.getWell2("W_3", 7).getProductionProperties(); + const auto& prop7 = sched.getWell2("W_3", 7).getProductionProperties(); BOOST_CHECK_CLOSE( 999/Metric::Time , prop7.LiquidRate.get() , 0.001); - BOOST_CHECK_EQUAL( WellProducer::RESV, prop7.controlMode); + BOOST_CHECK( Well2::ProducerCMode::RESV == prop7.controlMode); } BOOST_CHECK_CLOSE( 8000./Metric::Time , sched.getWell2("W_3", 3).getProductionProperties().LiquidRate.get(), 1.e-12); BOOST_CHECK_CLOSE( 18000./Metric::Time, sched.getWell2("W_3", 8).getProductionProperties().LiquidRate.get(), 1.e-12); @@ -214,25 +211,25 @@ BOOST_AUTO_TEST_CASE(WellTesting) { BOOST_CHECK_CLOSE(200000/Metric::Time , controls.reservoir_rate, 0.001); BOOST_CHECK_CLOSE(6895 * Metric::Pressure , controls.bhp_limit, 0.001); BOOST_CHECK_CLOSE(0 , controls.thp_limit , 0.001); - BOOST_CHECK_EQUAL( WellInjector::RESV , controls.cmode); - BOOST_CHECK( controls.hasControl(WellInjector::RATE )); - BOOST_CHECK( controls.hasControl(WellInjector::RESV )); - BOOST_CHECK( !controls.hasControl(WellInjector::THP)); - BOOST_CHECK( controls.hasControl(WellInjector::BHP)); + BOOST_CHECK( Well2::InjectorCMode::RESV == controls.cmode); + BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RATE )); + BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RESV )); + BOOST_CHECK( !controls.hasControl(Well2::InjectorCMode::THP)); + BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::BHP)); } - BOOST_CHECK_EQUAL( WellCommon::OPEN, sched.getWell2("W_1", 11).getStatus( )); - BOOST_CHECK_EQUAL( WellCommon::OPEN, sched.getWell2("W_1", 12).getStatus( )); - BOOST_CHECK_EQUAL( WellCommon::SHUT, sched.getWell2("W_1", 13).getStatus( )); - BOOST_CHECK_EQUAL( WellCommon::OPEN, sched.getWell2("W_1", 14).getStatus( )); + BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 11).getStatus( )); + BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 12).getStatus( )); + BOOST_CHECK( Well2::Status::SHUT == sched.getWell2("W_1", 13).getStatus( )); + BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 14).getStatus( )); { SummaryState st; const auto controls = sched.getWell2("W_1", 12).injectionControls(st); - BOOST_CHECK( controls.hasControl(WellInjector::RATE )); - BOOST_CHECK( !controls.hasControl(WellInjector::RESV)); - BOOST_CHECK( controls.hasControl(WellInjector::THP )); - BOOST_CHECK( controls.hasControl(WellInjector::BHP )); + BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RATE )); + BOOST_CHECK( !controls.hasControl(Well2::InjectorCMode::RESV)); + BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::THP )); + BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::BHP )); } } } @@ -270,13 +267,13 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) { const auto& connections = sched.getWell2("W_1", 3).getConnections(); BOOST_CHECK_EQUAL(4U, connections.size()); - BOOST_CHECK_EQUAL(WellCompletion::OPEN, connections.get(3).state()); + BOOST_CHECK(Connection::State::OPEN == connections.get(3).state()); BOOST_CHECK_EQUAL(2.2836805555555556e-12 , connections.get(3).CF()); } { const auto& connections = sched.getWell2("W_1", 7).getConnections(); BOOST_CHECK_EQUAL(4U, connections.size() ); - BOOST_CHECK_EQUAL(WellCompletion::SHUT, connections.get( 3 ).state() ); + BOOST_CHECK(Connection::State::SHUT == connections.get( 3 ).state() ); } } } @@ -346,7 +343,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) { auto& group = sched.getGroup2("INJ", 3); const auto& injection = group.injectionControls(st); BOOST_CHECK_EQUAL( Phase::WATER , injection.phase); - BOOST_CHECK_EQUAL( GroupInjection::VREP , injection.cmode); + BOOST_CHECK( Group2::InjectionCMode::VREP == injection.cmode); BOOST_CHECK_CLOSE( 10/Metric::Time , injection.surface_max_rate, 0.001); BOOST_CHECK_CLOSE( 20/Metric::Time , injection.resv_max_rate, 0.001); BOOST_CHECK_EQUAL( 0.75 , injection.target_reinj_fraction); @@ -357,7 +354,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) { auto& group = sched.getGroup2("INJ", 6); const auto& injection = group.injectionControls(st); BOOST_CHECK_EQUAL( Phase::OIL , injection.phase); - BOOST_CHECK_EQUAL( GroupInjection::RATE , injection.cmode); + BOOST_CHECK( Group2::InjectionCMode::RATE == injection.cmode); BOOST_CHECK_CLOSE( 1000/Metric::Time , injection.surface_max_rate, 0.0001); BOOST_CHECK(group.isInjectionGroup()); } @@ -365,7 +362,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) { { auto& group = sched.getGroup2("OP", 3); const auto& production = group.productionControls(st); - BOOST_CHECK_EQUAL( GroupProduction::ORAT , production.cmode); + BOOST_CHECK( Group2::ProductionCMode::ORAT == production.cmode); BOOST_CHECK_CLOSE( 10/Metric::Time , production.oil_target , 0.001); BOOST_CHECK_CLOSE( 20/Metric::Time , production.water_target , 0.001); BOOST_CHECK_CLOSE( 30/Metric::Time , production.gas_target , 0.001); @@ -451,19 +448,19 @@ BOOST_AUTO_TEST_CASE(WellTestWGRUPCONWellPropertiesSet) { const auto& well1 = sched.getWell2("W_1", 0); BOOST_CHECK(well1.isAvailableForGroupControl( )); BOOST_CHECK_EQUAL(-1, well1.getGuideRate( )); - BOOST_CHECK_EQUAL(GuideRate::OIL, well1.getGuideRatePhase( )); + BOOST_CHECK(Well2::GuideRateTarget::OIL == well1.getGuideRatePhase( )); BOOST_CHECK_EQUAL(1.0, well1.getGuideRateScalingFactor( )); const auto& well2 = sched.getWell2("W_2", 0); BOOST_CHECK(!well2.isAvailableForGroupControl( )); BOOST_CHECK_EQUAL(-1, well2.getGuideRate( )); - BOOST_CHECK_EQUAL(GuideRate::UNDEFINED, well2.getGuideRatePhase( )); + BOOST_CHECK(Well2::GuideRateTarget::UNDEFINED == well2.getGuideRatePhase( )); BOOST_CHECK_EQUAL(1.0, well2.getGuideRateScalingFactor( )); const auto& well3 = sched.getWell2("W_3", 0); BOOST_CHECK(well3.isAvailableForGroupControl( )); BOOST_CHECK_EQUAL(100, well3.getGuideRate( )); - BOOST_CHECK_EQUAL(GuideRate::RAT, well3.getGuideRatePhase( )); + BOOST_CHECK(Well2::GuideRateTarget::RAT == well3.getGuideRatePhase( )); BOOST_CHECK_EQUAL(0.5, well3.getGuideRateScalingFactor( )); } @@ -533,17 +530,17 @@ BOOST_AUTO_TEST_CASE(WELLS_SHUT) { const auto& well1 = sched.getWell2("W1", 1); const auto& well2 = sched.getWell2("W2", 1); const auto& well3 = sched.getWell2("W3", 1); - BOOST_CHECK_EQUAL( WellCommon::StatusEnum::OPEN , well1.getStatus()); - BOOST_CHECK_EQUAL( WellCommon::StatusEnum::OPEN , well2.getStatus()); - BOOST_CHECK_EQUAL( WellCommon::StatusEnum::OPEN , well3.getStatus()); + BOOST_CHECK( Well2::Status::OPEN == well1.getStatus()); + BOOST_CHECK( Well2::Status::OPEN == well2.getStatus()); + BOOST_CHECK( Well2::Status::OPEN == well3.getStatus()); } { const auto& well1 = sched.getWell2("W1", 2); const auto& well2 = sched.getWell2("W2", 2); const auto& well3 = sched.getWell2("W3", 2); - BOOST_CHECK_EQUAL( WellCommon::StatusEnum::SHUT , well1.getStatus()); - BOOST_CHECK_EQUAL( WellCommon::StatusEnum::SHUT , well2.getStatus()); - BOOST_CHECK_EQUAL( WellCommon::StatusEnum::SHUT , well3.getStatus()); + BOOST_CHECK( Well2::Status::SHUT == well1.getStatus()); + BOOST_CHECK( Well2::Status::SHUT == well2.getStatus()); + BOOST_CHECK( Well2::Status::SHUT == well3.getStatus()); } } @@ -709,9 +706,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) { BOOST_CHECK_EQUAL(econ_limit1.maxGasOilRatio(), 0.0); BOOST_CHECK_EQUAL(econ_limit1.endRun(), false); BOOST_CHECK_EQUAL(econ_limit1.followonWell(), "'"); - BOOST_CHECK_EQUAL(econ_limit1.quantityLimit(), WellEcon::RATE); - BOOST_CHECK_EQUAL(econ_limit1.workover(), WellEcon::CON); - BOOST_CHECK_EQUAL(econ_limit1.workoverSecondary(), WellEcon::CON); + BOOST_CHECK(econ_limit1.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE); + BOOST_CHECK(econ_limit1.workover() == WellEconProductionLimits::EconWorkover::CON); + BOOST_CHECK(econ_limit1.workoverSecondary() == WellEconProductionLimits::EconWorkover::CON); BOOST_CHECK(econ_limit1.requireWorkover()); BOOST_CHECK(econ_limit1.requireSecondaryWorkover()); BOOST_CHECK(!(econ_limit1.validFollowonWell())); @@ -731,9 +728,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) { BOOST_CHECK_EQUAL(econ_limit2.maxGasOilRatio(), 0.0); BOOST_CHECK_EQUAL(econ_limit2.endRun(), false); BOOST_CHECK_EQUAL(econ_limit2.followonWell(), "'"); - BOOST_CHECK_EQUAL(econ_limit2.quantityLimit(), WellEcon::RATE); - BOOST_CHECK_EQUAL(econ_limit2.workover(), WellEcon::CON); - BOOST_CHECK_EQUAL(econ_limit2.workoverSecondary(), WellEcon::CON); + BOOST_CHECK(econ_limit2.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE); + BOOST_CHECK(econ_limit2.workover() == WellEconProductionLimits::EconWorkover::CON); + BOOST_CHECK(econ_limit2.workoverSecondary() == WellEconProductionLimits::EconWorkover::CON); BOOST_CHECK(econ_limit2.requireWorkover()); BOOST_CHECK(econ_limit2.requireSecondaryWorkover()); BOOST_CHECK(!(econ_limit2.validFollowonWell())); @@ -755,9 +752,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) { BOOST_CHECK_EQUAL(econ_limit1.maxGasOilRatio(), 0.0); BOOST_CHECK_EQUAL(econ_limit1.endRun(), false); BOOST_CHECK_EQUAL(econ_limit1.followonWell(), "'"); - BOOST_CHECK_EQUAL(econ_limit1.quantityLimit(), WellEcon::RATE); - BOOST_CHECK_EQUAL(econ_limit1.workover(), WellEcon::NONE); - BOOST_CHECK_EQUAL(econ_limit1.workoverSecondary(), WellEcon::NONE); + BOOST_CHECK(econ_limit1.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE); + BOOST_CHECK(econ_limit1.workover() == WellEconProductionLimits::EconWorkover::NONE); + BOOST_CHECK(econ_limit1.workoverSecondary() == WellEconProductionLimits::EconWorkover::NONE); BOOST_CHECK(!(econ_limit1.requireWorkover())); BOOST_CHECK(!(econ_limit1.requireSecondaryWorkover())); BOOST_CHECK(!(econ_limit1.validFollowonWell())); @@ -777,9 +774,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) { BOOST_CHECK_EQUAL(econ_limit2.maxGasOilRatio(), 0.0); BOOST_CHECK_EQUAL(econ_limit2.endRun(), false); BOOST_CHECK_EQUAL(econ_limit2.followonWell(), "'"); - BOOST_CHECK_EQUAL(econ_limit2.quantityLimit(), WellEcon::RATE); - BOOST_CHECK_EQUAL(econ_limit2.workover(), WellEcon::CON); - BOOST_CHECK_EQUAL(econ_limit2.workoverSecondary(), WellEcon::CON); + BOOST_CHECK(econ_limit2.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE); + BOOST_CHECK(econ_limit2.workover() == WellEconProductionLimits::EconWorkover::CON); + BOOST_CHECK(econ_limit2.workoverSecondary() == WellEconProductionLimits::EconWorkover::CON); BOOST_CHECK(econ_limit2.requireWorkover()); BOOST_CHECK(econ_limit2.requireSecondaryWorkover()); BOOST_CHECK(!(econ_limit2.validFollowonWell())); diff --git a/tests/test_writenumwells.cpp b/tests/test_writenumwells.cpp index f9160d75e..3c3f3d29a 100644 --- a/tests/test_writenumwells.cpp +++ b/tests/test_writenumwells.cpp @@ -89,17 +89,17 @@ void verifyWellState(const std::string& rst_filename, } else { switch( well.getInjectionProperties( ).injectorType ) { - case WellInjector::WATER: - well_type = ERT_WATER_INJECTOR; - break; - case WellInjector::GAS: - well_type = ERT_GAS_INJECTOR; - break; - case WellInjector::OIL: - well_type = ERT_OIL_INJECTOR; - break; - default: - break; + case Well2::InjectorType::WATER: + well_type = ERT_WATER_INJECTOR; + break; + case Well2::InjectorType::GAS: + well_type = ERT_GAS_INJECTOR; + break; + case Well2::InjectorType::OIL: + well_type = ERT_OIL_INJECTOR; + break; + default: + break; } } @@ -108,7 +108,7 @@ void verifyWellState(const std::string& rst_filename, //Verify wellstatus int ert_well_status = well_state_is_open(well_state) ? 1 : 0; - int wellstatus = well.getStatus( ) == WellCommon::OPEN ? 1 : 0; + int wellstatus = well.getStatus( ) == Well2::Status::OPEN ? 1 : 0; BOOST_CHECK_EQUAL(ert_well_status, wellstatus);