diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 980639aaf..909533c59 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -317,7 +317,7 @@ public: bool operator!=(const WellProductionProperties& other) const; WellProductionProperties(); - WellProductionProperties(const std::string& name_arg); + WellProductionProperties(const UnitSystem& units, const std::string& name_arg); WellProductionProperties(const std::string& wname, const UDAValue& oilRate, const UDAValue& waterRate, diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 746bcc5f0..daaf9ccdd 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -132,10 +132,10 @@ Well::Well(const std::string& wname_arg, brine_properties(std::make_shared()), tracer_properties(std::make_shared()), connections(std::make_shared(headI, headJ)), - production(std::make_shared(wname)), + production(std::make_shared(unit_system, wname)), injection(std::make_shared(wname)) { - auto p = std::make_shared(wname); + auto p = std::make_shared(this->unit_system, this->wname); p->whistctl_cmode = whistctl_cmode; this->updateProduction(p); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp index c7665c6b4..0e7820d35 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp @@ -33,17 +33,27 @@ namespace Opm { - Well::WellProductionProperties::WellProductionProperties() - : BHPH(0.0), THPH(0.0), VFPTableNumber(0), - ALQValue(0.0), predictionMode(false), - controlMode(ProducerCMode::NONE), - whistctl_cmode(ProducerCMode::NONE), - m_productionControls(0) + Well::WellProductionProperties::WellProductionProperties() : + WellProductionProperties(UnitSystem(UnitSystem::UnitType::UNIT_TYPE_METRIC), "") {} - Well::WellProductionProperties::WellProductionProperties(const std::string& name_arg) : + Well::WellProductionProperties::WellProductionProperties(const UnitSystem& units, const std::string& name_arg) : name(name_arg), - predictionMode( true ) + OilRate(units.getDimension(UnitSystem::measure::liquid_surface_rate)), + WaterRate(units.getDimension(UnitSystem::measure::liquid_surface_rate)), + GasRate(units.getDimension(UnitSystem::measure::gas_surface_rate)), + LiquidRate(units.getDimension(UnitSystem::measure::liquid_surface_rate)), + ResVRate(units.getDimension(UnitSystem::measure::rate)), + BHPTarget(units.getDimension(UnitSystem::measure::pressure)), + THPTarget(units.getDimension(UnitSystem::measure::pressure)), + BHPH(0.0), + THPH(0.0), + VFPTableNumber(0), + ALQValue(0.0), + predictionMode(true), + controlMode(ProducerCMode::CMODE_UNDEFINED), + whistctl_cmode(ProducerCMode::CMODE_UNDEFINED), + m_productionControls(0) {} diff --git a/tests/parser/WellTests.cpp b/tests/parser/WellTests.cpp index 3ea97363d..2bcafc556 100644 --- a/tests/parser/WellTests.cpp +++ b/tests/parser/WellTests.cpp @@ -493,10 +493,10 @@ namespace { Opm::Well::WellProductionProperties properties(const std::string& input) { Opm::Parser parser; - + Opm::UnitSystem unit_system(Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC); auto deck = parser.parseString(input); const auto& record = deck.getKeyword("WCONHIST").getRecord(0); - Opm::Well::WellProductionProperties hist("W"); + Opm::Well::WellProductionProperties hist(unit_system, "W"); hist.handleWCONHIST(record); @@ -542,14 +542,14 @@ namespace { return input; } - + Opm::UnitSystem unit_system(Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC); Opm::Well::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::Well::WellProductionProperties pred("W"); + Opm::Well::WellProductionProperties pred(unit_system, "W"); pred.handleWCONPROD("WELL", record); return pred; @@ -767,7 +767,8 @@ BOOST_AUTO_TEST_CASE(BHP_CMODE) BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) { - const Opm::Well::WellProductionProperties Pproperties("W"); + auto unit_system = UnitSystem::newMETRIC(); + const Opm::Well::WellProductionProperties Pproperties(unit_system, "W"); const Opm::Well::WellInjectionProperties Iproperties("W"); BOOST_CHECK( Pproperties.controlMode == Opm::Well::ProducerCMode::CMODE_UNDEFINED ); @@ -778,8 +779,9 @@ BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) { BOOST_AUTO_TEST_CASE(WELL_CONTROLS) { - Opm::Well well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::Well::ProducerCMode::CMODE_UNDEFINED, Opm::Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0, 1.0, false, false); - Opm::Well::WellProductionProperties prod("OP1"); + auto unit_system = UnitSystem::newMETRIC(); + Opm::Well well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::Well::ProducerCMode::CMODE_UNDEFINED, Opm::Connection::Order::DEPTH, unit_system, 0, 1.0, false, false); + Opm::Well::WellProductionProperties prod(unit_system, "OP1"); Opm::SummaryState st(std::chrono::system_clock::now()); well.productionControls(st);