From 8501a7ead41f20b658531ccd03258bdf3d0fb72e Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 5 Mar 2020 09:03:54 +0100 Subject: [PATCH] Construct UDA values in WellInjectionProperties with correct unit --- .../EclipseState/Schedule/Well/Well.hpp | 2 +- .../EclipseState/Schedule/Well/Well.cpp | 2 +- .../Schedule/Well/WellInjectionProperties.cpp | 26 +++++++++---------- tests/parser/WellTests.cpp | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 909533c59..f8b920be7 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -211,7 +211,7 @@ public: bool operator!=(const WellInjectionProperties& other) const; WellInjectionProperties(); - WellInjectionProperties(const std::string& wname); + WellInjectionProperties(const UnitSystem& units, const std::string& wname); WellInjectionProperties(const std::string& wname, const UDAValue& surfaceInjRate, const UDAValue& reservoirInjRate, diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index daaf9ccdd..1882302b2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -133,7 +133,7 @@ Well::Well(const std::string& wname_arg, tracer_properties(std::make_shared()), connections(std::make_shared(headI, headJ)), production(std::make_shared(unit_system, wname)), - injection(std::make_shared(wname)) + injection(std::make_shared(unit_system, wname)) { auto p = std::make_shared(this->unit_system, this->wname); p->whistctl_cmode = whistctl_cmode; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp index 21c6e73e3..9f01ec787 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp @@ -37,26 +37,26 @@ namespace Opm { Well::WellInjectionProperties::WellInjectionProperties() - : temperature(0.0), BHPH(0.0), THPH(0.0), VFPTableNumber(0), - predictionMode(false), injectionControls(0), - injectorType(InjectorType::WATER), - controlMode(InjectorCMode::CMODE_UNDEFINED) + : WellInjectionProperties(UnitSystem(UnitSystem::UnitType::UNIT_TYPE_METRIC), "") { } - Well::WellInjectionProperties::WellInjectionProperties(const std::string& wname) + + Well::WellInjectionProperties::WellInjectionProperties(const UnitSystem& units, const std::string& wname) : name(wname), + surfaceInjectionRate(units.getDimension(UnitSystem::measure::identity)), + reservoirInjectionRate(units.getDimension(UnitSystem::measure::rate)), + BHPTarget(units.getDimension(UnitSystem::measure::pressure)), + THPTarget(units.getDimension(UnitSystem::measure::pressure)), + temperature(Metric::TemperatureOffset + ParserKeywords::STCOND::TEMPERATURE::defaultValue), + BHPH(0), + THPH(0), + VFPTableNumber(0), + predictionMode(true), + injectionControls(0), injectorType(InjectorType::WATER), controlMode(InjectorCMode::CMODE_UNDEFINED) { - temperature= - Metric::TemperatureOffset - + ParserKeywords::STCOND::TEMPERATURE::defaultValue; - BHPH=0.0; - THPH=0.0; - VFPTableNumber=0; - predictionMode=true; - injectionControls=0; } Well::WellInjectionProperties::WellInjectionProperties(const std::string& wname, diff --git a/tests/parser/WellTests.cpp b/tests/parser/WellTests.cpp index 2bcafc556..6a17bf1d4 100644 --- a/tests/parser/WellTests.cpp +++ b/tests/parser/WellTests.cpp @@ -769,7 +769,7 @@ BOOST_AUTO_TEST_CASE(BHP_CMODE) BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) { auto unit_system = UnitSystem::newMETRIC(); const Opm::Well::WellProductionProperties Pproperties(unit_system, "W"); - const Opm::Well::WellInjectionProperties Iproperties("W"); + const Opm::Well::WellInjectionProperties Iproperties(unit_system, "W"); BOOST_CHECK( Pproperties.controlMode == Opm::Well::ProducerCMode::CMODE_UNDEFINED ); BOOST_CHECK( Iproperties.controlMode == Opm::Well::InjectorCMode::CMODE_UNDEFINED );