diff --git a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp index 7e6ad4be4..f94cfdbd9 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp @@ -85,13 +85,6 @@ namespace Opm { namespace WellInjector { - enum TypeEnum { - WATER = 1, - GAS = 2, - OIL = 3, - MULTI = 4 - }; - enum ControlModeEnum { RATE = 1 , @@ -111,9 +104,6 @@ namespace Opm { const std::string ControlMode2String( ControlModeEnum enumValue ); ControlModeEnum ControlModeFromString( const std::string& stringValue ); - - const std::string Type2String( TypeEnum enumValue ); - TypeEnum TypeFromString( const std::string& stringValue ); } 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/Well2.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp index 2e230e37a..3aba1eb9d 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp @@ -45,6 +45,8 @@ class DeckKeyword; struct WellInjectionProperties; class WellProductionProperties; class UDQActive; +class UDQConfig; + struct WellGuideRate { bool available; @@ -62,11 +64,94 @@ public: 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 ); + + + struct InjectionControls { + public: + InjectionControls(int controls_arg) : + controls(controls_arg) + {} + + double bhp_limit; + double thp_limit; + + + InjectorType 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; + }; + + + + 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; + 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; + }; + + Well2(const std::string& wname, const std::string& gname, std::size_t init_step, @@ -92,7 +177,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; @@ -210,6 +295,8 @@ private: std::shared_ptr segments; }; +std::ostream& operator<<( std::ostream&, const Well2::WellInjectionProperties& ); + } diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp index cc6817f3c..29e121616 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp @@ -34,53 +34,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/src/opm/output/eclipse/AggregateWellData.cpp b/src/opm/output/eclipse/AggregateWellData.cpp index 7d588abef..6cbb48c57 100644 --- a/src/opm/output/eclipse/AggregateWellData.cpp +++ b/src/opm/output/eclipse/AggregateWellData.cpp @@ -141,7 +141,7 @@ namespace { return WTypeVal::Producer; } - using IType = ::Opm::WellInjector::TypeEnum; + using IType = ::Opm::Well2::InjectorType; const auto itype = well.injectionControls(st).injector_type; @@ -173,7 +173,7 @@ namespace { const auto wtype = controls.injector_type; using CMode = ::Opm::WellInjector::ControlModeEnum; - using WType = ::Opm::WellInjector::TypeEnum; + using WType = ::Opm::Well2::InjectorType; switch (wmctl) { case CMode::RATE: { @@ -514,7 +514,7 @@ namespace { const auto& ic = well.injectionControls(smry); using IP = ::Opm::WellInjector::ControlModeEnum; - using IT = ::Opm::WellInjector::TypeEnum; + using IT = ::Opm::Well2::InjectorType; if (ic.hasControl(IP::RATE)) { if (ic.injector_type == IT::OIL) { @@ -714,7 +714,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/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 354792aea..735b40c4a 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -740,7 +740,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); } @@ -890,7 +890,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->handleWCONINJE(record, well2->isAvailableForGroupControl(), well_name); if (well2->updateProducer(false)) @@ -953,7 +953,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)) @@ -1205,7 +1205,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); @@ -1262,7 +1262,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); @@ -1296,7 +1296,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); @@ -1339,7 +1339,6 @@ namespace { 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); @@ -1427,7 +1426,7 @@ namespace { if (cmode == WellTarget::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) diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp index 90cc823b4..f73bc9fb0 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp @@ -345,37 +345,6 @@ namespace Opm { 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 ) { diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp index 8ea2554fe..7aa42717e 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp @@ -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"); @@ -498,7 +498,7 @@ 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; } @@ -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; } @@ -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(); @@ -812,4 +812,35 @@ Well2::Status Well2::StatusFromString(const std::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 ); +} + + } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp index 0413bd690..787a11845 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,9 +35,9 @@ namespace Opm { - WellInjectionProperties::WellInjectionProperties(const std::string& wname) + Well2::WellInjectionProperties::WellInjectionProperties(const std::string& wname) : name(wname), - injectorType(WellInjector::WATER), + injectorType(InjectorType::WATER), controlMode(WellInjector::CMODE_UNDEFINED) { temperature= @@ -50,8 +51,8 @@ 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)) { @@ -104,25 +105,25 @@ namespace Opm { - void WellInjectionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { + void Well2::WellInjectionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { if (cmode == WellTarget::BHP){ this->BHPLimit.reset( newValue * siFactorP ); } else if (cmode == WellTarget::ORAT){ - if(this->injectorType == WellInjector::TypeEnum::OIL){ + 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) + 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){ + 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"); @@ -143,14 +144,14 @@ namespace Opm { } - 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); @@ -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 << ", " + << "injector type: " << Well2::InjectorType2String(wp.injectorType) << ", " << "control mode: " << 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/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/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index f057b7fc2..dbc075629 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -2518,34 +2518,34 @@ BOOST_AUTO_TEST_CASE(TestGroupProductionExceedLimitActionEnumLoop) { /*****************************************************************/ 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" ) )); } /*****************************************************************/ diff --git a/tests/parser/WellTests.cpp b/tests/parser/WellTests.cpp index 012735cbc..bfbec4f8e 100644 --- a/tests/parser/WellTests.cpp +++ b/tests/parser/WellTests.cpp @@ -208,7 +208,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()); @@ -221,7 +221,7 @@ 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); /* 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()); @@ -232,7 +232,7 @@ 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); /* 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() ); @@ -281,7 +281,7 @@ BOOST_AUTO_TEST_CASE(XHPLimitDefault) { BOOST_CHECK_EQUAL( 100 , well.getProductionProperties().BHPLimit.get()); BOOST_CHECK_EQUAL( true, well.getProductionProperties().hasProductionControl( Opm::WellProducer::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()); @@ -293,12 +293,12 @@ BOOST_AUTO_TEST_CASE(XHPLimitDefault) { 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); - 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); } @@ -359,20 +359,20 @@ BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) { BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); - auto injProps1 = std::make_shared(well.getInjectionProperties()); + auto injProps1 = std::make_shared(well.getInjectionProperties()); injProps1->surfaceInjectionRate.reset(100); injProps1->addInjectionControl(Opm::WellInjector::RATE); well.updateInjection(injProps1); BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV )); - auto injProps2 = std::make_shared(well.getInjectionProperties()); + auto injProps2 = std::make_shared(well.getInjectionProperties()); injProps2->reservoirInjectionRate.reset(100); injProps2->addInjectionControl(Opm::WellInjector::RESV); well.updateInjection(injProps2); BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::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->THPLimit.reset(100); @@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) { BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::BHP )); - auto injProps4 = std::make_shared(well.getInjectionProperties()); + auto injProps4 = std::make_shared(well.getInjectionProperties()); injProps4->dropInjectionControl( Opm::WellInjector::RESV ); well.updateInjection(injProps4); BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE )); @@ -748,7 +748,7 @@ 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::WellInjectionProperties Iproperties("W"); BOOST_CHECK_EQUAL( Pproperties.controlMode , Opm::WellProducer::CMODE_UNDEFINED ); BOOST_CHECK_EQUAL( Iproperties.controlMode , Opm::WellInjector::CMODE_UNDEFINED ); @@ -782,7 +782,7 @@ 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); - auto inj_props= std::make_shared(inj.getInjectionProperties()); + auto inj_props= std::make_shared(inj.getInjectionProperties()); inj_props->VFPTableNumber = 100; inj.updateInjection(inj_props); diff --git a/tests/test_writenumwells.cpp b/tests/test_writenumwells.cpp index dcce45db9..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; } }