From 1b13f44e12546dbde4b35661bf170085e5b6c4c0 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 21 Nov 2017 09:59:33 +0100 Subject: [PATCH 1/2] Handle WEFAC Added test combining WEFAC and GEFAC --- opm/core/wells/WellsGroup.cpp | 4 ++-- tests/test_wellcollection.cpp | 39 +++++++++++++++++++++++++++++++++++ tests/test_wellsgroup.cpp | 25 ++++++++++++++++++++++ tests/wells_group.data | 14 +++++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 6d1ef1fc..e720231c 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -1612,8 +1612,8 @@ namespace Opm production_specification.control_mode_ = toProductionControlMode(WellProducer::ControlMode2String(properties.controlMode)); } } - // TODO: should be specified with WEFAC, while we do not have this keyword support yet. - const double efficiency_factor = 1.0; + // Efficiency factor given specified with WEFAC + const double efficiency_factor = well->getEfficiencyFactor(timeStep); std::shared_ptr wells_group(new WellNode(well->name(), efficiency_factor, production_specification, injection_specification, phase_usage)); return wells_group; } diff --git a/tests/test_wellcollection.cpp b/tests/test_wellcollection.cpp index 06b91ac6..43fd4f77 100644 --- a/tests/test_wellcollection.cpp +++ b/tests/test_wellcollection.cpp @@ -78,3 +78,42 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) { BOOST_CHECK_EQUAL("G2", collection.findNode("PROD2")->getParent()->name()); } +BOOST_AUTO_TEST_CASE(EfficiencyFactor) { + Parser parser; + std::string scheduleFile("wells_group.data"); + ParseContext parseContext; + Deck deck = parser.parseFile(scheduleFile, parseContext); + EclipseState eclipseState(deck, parseContext); + PhaseUsage pu = phaseUsageFromDeck(eclipseState); + const auto& grid = eclipseState.getInputGrid(); + const TableManager table ( deck ); + const Eclipse3DProperties eclipseProperties ( deck , table, grid); + const Schedule sched(deck, grid, eclipseProperties, Phases(true, true, true), parseContext ); + + size_t timestep = 2; + WellCollection collection; + // Add groups to WellCollection + const auto& fieldGroup = sched.getGroup("FIELD"); + collection.addField(fieldGroup, timestep, pu); + collection.addGroup( sched.getGroup( "G1" ), fieldGroup.name(), timestep, pu); + collection.addGroup( sched.getGroup( "G2" ), fieldGroup.name(), timestep, pu); + + BOOST_CHECK_EQUAL(1.0, collection.findNode("FIELD")->efficiencyFactor()); + BOOST_CHECK_EQUAL(1.0, collection.findNode("G1")->getParent()->efficiencyFactor()); + BOOST_CHECK_EQUAL(1.0, collection.findNode("G2")->getParent()->efficiencyFactor()); + + // Add wells to WellCollection + auto wells1 = sched.getWells(timestep); + for (size_t i=0; iname() ) ) continue; + const auto& group = *grp; + + std::shared_ptr wellsGroup = createGroupWellsGroup(group, 2, pu); + BOOST_CHECK_EQUAL(group.name(), wellsGroup->name()); + BOOST_CHECK_EQUAL(group.getGroupEfficiencyFactor(2), wellsGroup->efficiencyFactor()); + BOOST_CHECK_EQUAL(group.getGroupEfficiencyFactor(2), wellsGroup->efficiencyFactor()); + + } +} + diff --git a/tests/wells_group.data b/tests/wells_group.data index fc33d092..26a9c4f9 100755 --- a/tests/wells_group.data +++ b/tests/wells_group.data @@ -39,6 +39,11 @@ COMPDAT 'PROD1' 10 1 1 1 'OPEN' 0 10.6092 0.5 / / +WEFAC + 'INJ1' 0.5 / + 'PROD1' 0.5 / +/ + TSTEP 14.0 / @@ -61,6 +66,15 @@ GCONPROD 'G2' ORAT 10000 / / +WEFAC + 'INJ2' 0.8 / + 'PROD2' 1.0 / +/ + +GEFAC + 'G1' 0.8 / +/ + WCONINJE 'INJ1' 'WATER' 'OPEN' 'RESV' 10 20 40 / 'INJ2' 'WATER' 'OPEN' 'RESV' 10 20 40 / From bcd83025ec2198c1c9e52daa0607f8d7401ba4f2 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 1 Dec 2017 11:31:01 +0100 Subject: [PATCH 2/2] Add efficiencyFactor to GuideRate --- opm/core/wells/WellsGroup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index e720231c..c3dbdc1c 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -1388,7 +1388,7 @@ namespace Opm // 1. preventing the well from group control with keyword WGRUPCON // 2. the well violating some limits and working under limits. if ( (!only_group || !individualControl()) && isProducer() ) { - return prodSpec().guide_rate_; + return prodSpec().guide_rate_ * efficiencyFactor(); } else { return 0.0; } @@ -1400,7 +1400,7 @@ namespace Opm double WellNode::injectionGuideRate(bool only_group) { if ( (!only_group || !individualControl()) && isInjector() ) { - return injSpec().guide_rate_; + return injSpec().guide_rate_ * efficiencyFactor(); } else { return 0.0; }