diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 0dd271ed8..e7714599a 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -1108,10 +1108,6 @@ namespace { using WELL_NAME = ParserKeywords::WELPI::WELL_NAME; using PI = ParserKeywords::WELPI::STEADY_STATE_PRODUCTIVITY_OR_INJECTIVITY_INDEX_VALUE; - const auto& usys = handlerContext.section.unitSystem(); - const auto gasPI = UnitSystem::measure::gas_productivity_index; - const auto liqPI = UnitSystem::measure::liquid_productivity_index; - for (const auto& record : handlerContext.keyword) { const auto well_names = this->wellNames(record.getItem().getTrimmedString(0), handlerContext.currentStep); @@ -1123,18 +1119,15 @@ namespace { const auto rawProdIndex = record.getItem().get(0); for (const auto& well_name : well_names) { - // All wells in a single record *hopefully* have the same preferred phase... - const auto& well = this->getWell(well_name, handlerContext.currentStep); - const auto unitPI = (well.getPreferredPhase() == Phase::GAS) ? gasPI : liqPI; + auto well2 = std::make_shared(this->getWell(well_name, handlerContext.currentStep)); // Note: Need to ensure we have an independent copy of // well's connections because // Well::updateWellProductivityIndex() implicitly mutates // internal state in the WellConnections class. - auto well2 = std::make_shared(well); auto connections = std::make_shared(well2->getConnections()); well2->forceUpdateConnections(std::move(connections)); - if (well2->updateWellProductivityIndex(usys.to_si(unitPI, rawProdIndex))) + if (well2->updateWellProductivityIndex(rawProdIndex)) this->updateWell(std::move(well2), handlerContext.currentStep); this->addWellGroupEvent(well_name, ScheduleEvents::WELL_PRODUCTIVITY_INDEX, handlerContext.currentStep); diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 20f41f9a7..1cbe62256 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -60,11 +60,6 @@ using namespace Opm; namespace { - double liquid_PI_unit() - { - return UnitSystem::newMETRIC().to_si(UnitSystem::measure::liquid_productivity_index, 1.0); - } - double cp_rm3_per_db() { return prefix::centi*unit::Poise * unit::cubic(unit::meter) @@ -3816,7 +3811,7 @@ END const auto expectCF = (200.0 / 100.0) * 100.0*cp_rm3_per_db(); auto wellP = sched.getWell("P", 1); - const auto scalingFactor = wellP.getWellPIScalingFactor(100.0*liquid_PI_unit()); + const auto scalingFactor = wellP.getWellPIScalingFactor(100.0); BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10); std::vector scalingApplicable; @@ -3835,7 +3830,7 @@ END const auto expectCF = (200.0 / 100.0) * 100.0*cp_rm3_per_db(); auto wellP = sched.getWell("P", 2); - const auto scalingFactor = wellP.getWellPIScalingFactor(100.0*liquid_PI_unit()); + const auto scalingFactor = wellP.getWellPIScalingFactor(100.0); BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10); std::vector scalingApplicable; @@ -3959,7 +3954,7 @@ END // Apply WELPI scaling after end of time series => no change to CTFs { const auto report_step = std::size_t{1}; - const auto scalingFactor = getScalingFactor(report_step, 100.0*liquid_PI_unit()); + const auto scalingFactor = getScalingFactor(report_step, 100.0); BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10); @@ -4025,7 +4020,7 @@ END // Apply WELPI scaling after first WELPI specification { const auto report_step = std::size_t{1}; - const auto scalingFactor = getScalingFactor(report_step, 100.0*liquid_PI_unit()); + const auto scalingFactor = getScalingFactor(report_step, 100.0); BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10); @@ -4093,7 +4088,7 @@ END // Apply WELPI scaling after second WELPI specification { const auto report_step = std::size_t{3}; - const auto scalingFactor = getScalingFactor(report_step, 200.0*liquid_PI_unit()); + const auto scalingFactor = getScalingFactor(report_step, 200.0); BOOST_CHECK_CLOSE(scalingFactor, 0.25, 1.0e-10);