diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 3e2cd93f3..f694203cd 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -227,7 +227,7 @@ public: Well::InjectorType injType, InjectorCMode ctrlMode); - void handleWELTARG(WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP); + void handleWELTARG(WELTARGCMode cmode, double newValue); 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 { @@ -348,7 +348,7 @@ public: 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 handleWELTARG( WELTARGCMode cmode, double newValue); void resetDefaultBHPLimit(); void clearControls(); ProductionControls controls(const SummaryState& st, double udq_default) const; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index af4057bde..7b0363946 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1491,38 +1491,6 @@ namespace { const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) { - Opm::UnitSystem unitSystem = section.unitSystem(); - /* - double siFactorL = unitSystem.parse("LiquidSurfaceVolume/Time").getSIScaling(); - double siFactorG = unitSystem.parse("GasSurfaceVolume/Time").getSIScaling(); - double siFactorP = unitSystem.parse("Pressure").getSIScaling(); - */ - - /* - Unit system handling in the UDA values has become a complete mess. The - point is that the UDA values can *optionally* carry a dimension object - with them, and then that unit system is transparaently used when - calling UDAValue::get(). For UDA values which come from the - deck they are properly decorated with unitsystem, and things work as - they should. But when it comes to *explicitly setting* UDA values from - the API, as is done in the WELTARG implementation - things are quite - broken. - - What currently "works" is: - - - The well must be fully specified with WCONPROD / WCONHIST before the - WELTARG keyword is used. - - - The unit conversion here in handleWELTARG is bypassed by setting the - conversion factors to 1.0, and the conversion which comes from the - dim objects internalized in the UDA objects will handle things on - return. - */ - - const double siFactorL = 1.0; - const double siFactorG = 1.0; - const double siFactorP = 1.0; - for( const auto& record : keyword ) { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); @@ -1541,13 +1509,13 @@ namespace { bool update = false; if (well2->isProducer()) { auto prop = std::make_shared(well2->getProductionProperties()); - prop->handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP); + prop->handleWELTARG(cmode, newValue); update = well2->updateProduction(prop); if (cmode == Well::WELTARGCMode::GUID) update |= well2->updateWellGuideRate(newValue); } else { auto inj = std::make_shared(well2->getInjectionProperties()); - inj->handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP); + inj->handleWELTARG(cmode, newValue); update = well2->updateInjection(inj); if (cmode == Well::WELTARGCMode::GUID) update |= well2->updateWellGuideRate(newValue); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp index 7a43c2757..538202085 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp @@ -143,38 +143,38 @@ namespace Opm { - void Well::WellInjectionProperties::handleWELTARG(WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { + void Well::WellInjectionProperties::handleWELTARG(WELTARGCMode cmode, double newValue) { if (cmode == Well::WELTARGCMode::BHP){ - this->BHPLimit.reset( newValue * siFactorP ); + this->BHPLimit.reset( newValue ); } else if (cmode == WELTARGCMode::ORAT){ if(this->injectorType == Well::InjectorType::OIL){ - this->surfaceInjectionRate.reset( newValue * siFactorL ); + this->surfaceInjectionRate.reset( newValue ); }else{ std::invalid_argument("Well type must be OIL to set the oil rate"); } } else if (cmode == WELTARGCMode::WRAT){ if(this->injectorType == Well::InjectorType::WATER) - this->surfaceInjectionRate.reset( newValue * siFactorL ); + this->surfaceInjectionRate.reset( newValue ); else std::invalid_argument("Well type must be WATER to set the water rate"); } else if (cmode == WELTARGCMode::GRAT){ if(this->injectorType == Well::InjectorType::GAS){ - this->surfaceInjectionRate.reset( newValue * siFactorG ); + this->surfaceInjectionRate.reset( newValue ); }else{ std::invalid_argument("Well type must be GAS to set the gas rate"); } } else if (cmode == WELTARGCMode::THP){ - this->THPLimit.reset( newValue * siFactorP ); + this->THPLimit.reset( newValue ); } else if (cmode == WELTARGCMode::VFP){ this->VFPTableNumber = static_cast (newValue); } else if (cmode == WELTARGCMode::RESV){ - this->reservoirInjectionRate.reset( newValue * siFactorL ); + this->reservoirInjectionRate.reset( newValue ); } else if (cmode != WELTARGCMode::GUID){ throw std::invalid_argument("Invalid keyword (MODE) supplied"); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp index 01bb7cc71..3c44a3502 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp @@ -220,34 +220,34 @@ namespace Opm { -void Well::WellProductionProperties::handleWELTARG(Well::WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) { +void Well::WellProductionProperties::handleWELTARG(Well::WELTARGCMode cmode, double newValue) { if (cmode == WELTARGCMode::ORAT){ this->OilRate.assert_numeric("Can not combine UDA and WELTARG"); - this->OilRate.reset( newValue * siFactorL ); + this->OilRate.reset( newValue ); } else if (cmode == WELTARGCMode::WRAT){ this->WaterRate.assert_numeric("Can not combine UDA and WELTARG"); - this->WaterRate.reset( newValue * siFactorL ); + this->WaterRate.reset( newValue ); } else if (cmode == WELTARGCMode::GRAT){ this->GasRate.assert_numeric("Can not combine UDA and WELTARG"); - this->GasRate.reset( newValue * siFactorG ); + this->GasRate.reset( newValue ); } else if (cmode == WELTARGCMode::LRAT){ this->LiquidRate.assert_numeric("Can not combine UDA and WELTARG"); - this->LiquidRate.reset( newValue * siFactorL ); + this->LiquidRate.reset( newValue ); } else if (cmode == WELTARGCMode::RESV){ this->ResVRate.assert_numeric("Can not combine UDA and WELTARG"); - this->ResVRate.reset( newValue * siFactorL ); + this->ResVRate.reset( newValue ); } else if (cmode == WELTARGCMode::BHP){ this->BHPLimit.assert_numeric("Can not combine UDA and WELTARG"); - this->BHPLimit.reset( newValue * siFactorP ); + this->BHPLimit.reset( newValue ); } else if (cmode == WELTARGCMode::THP){ this->THPLimit.assert_numeric("Can not combine UDA and WELTARG"); - this->THPLimit.reset(newValue * siFactorP); + this->THPLimit.reset(newValue ); } else if (cmode == WELTARGCMode::VFP) this->VFPTableNumber = static_cast (newValue);