Merge pull request #1188 from totto82/handleWEFAC

Handle WEFAC
This commit is contained in:
Atgeirr Flø Rasmussen 2017-12-05 08:37:44 +01:00 committed by GitHub
commit c9c4c81661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 4 deletions

View File

@ -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;
}
@ -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<WellsGroupInterface> wells_group(new WellNode(well->name(), efficiency_factor, production_specification, injection_specification, phase_usage));
return wells_group;
}

View File

@ -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; i<wells1.size(); i++) {
collection.addWell(wells1[i], timestep, pu);
}
// 0.5(inj1) * 0.8(G1)
BOOST_CHECK_CLOSE(0.4, collection.findWellNode("INJ1").getAccumulativeEfficiencyFactor(), 1e-10);
// 0.8(inj2) * 0.8(G1)
BOOST_CHECK_CLOSE(0.64, collection.findWellNode("INJ2").getAccumulativeEfficiencyFactor(), 1e-10);
// 0.5 (prod1) * 1.0 (G2)
BOOST_CHECK_CLOSE(0.5, collection.findWellNode("PROD1").getAccumulativeEfficiencyFactor(), 1e-10);
// 1.0 (prod2) * 1.0 (G2)
BOOST_CHECK_CLOSE(1.0, collection.findWellNode("PROD2").getAccumulativeEfficiencyFactor(), 1e-10);
}

View File

@ -122,5 +122,30 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
}
}
BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
Parser parser;
ParseContext parseContext;
std::string scheduleFile("wells_group.data");
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 );
const auto& nodes = sched.getGroupTree(2);
for( const auto& grp : sched.getGroups() ) {
if( !nodes.exists( grp->name() ) ) continue;
const auto& group = *grp;
std::shared_ptr<WellsGroupInterface> 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());
}
}

View File

@ -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 /