mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-21 16:57:25 -06:00
don't count wells not under group controll when computing guiderates
This commit is contained in:
parent
614025b28b
commit
5e1ec249cd
@ -1842,8 +1842,8 @@ namespace Opm
|
||||
|
||||
double groupTargetReduction = 0.0;
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/true, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, wellTarget, /*isInjector*/true);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, groupTarget, /*isInjector*/true, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, wellTarget, /*isInjector*/true);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, groupTarget, /*isInjector*/true, fraction);
|
||||
|
||||
switch(currentGroupControl) {
|
||||
case Group2::InjectionCMode::NONE:
|
||||
@ -1935,8 +1935,8 @@ namespace Opm
|
||||
double groupTargetReduction = 0.0;
|
||||
int phasePos = pu.phase_pos[Oil];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::OIL, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::OIL, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::OIL, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::OIL, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.oil_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||
@ -1949,8 +1949,8 @@ namespace Opm
|
||||
double groupTargetReduction = 0.0;
|
||||
int phasePos = pu.phase_pos[Water];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::WAT, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::WAT, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::WAT, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::WAT, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.water_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
||||
@ -1963,8 +1963,8 @@ namespace Opm
|
||||
double groupTargetReduction = 0.0;
|
||||
int phasePos = pu.phase_pos[Gas];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::GAS, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::GAS, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::GAS, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::GAS, /*isInjector*/false, fraction);
|
||||
const double rate_target = std::max(0.0, groupcontrols.gas_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasCompIdx));
|
||||
const EvalWell& rate = -getSegmentRate(0, Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx));
|
||||
@ -1978,8 +1978,8 @@ namespace Opm
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
phasePos = pu.phase_pos[Oil];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::LIQ, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::LIQ, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.liquid_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||
|
@ -998,8 +998,8 @@ namespace Opm
|
||||
|
||||
double groupTargetReduction = 0.0;
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/true, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, wellTarget, /*isInjector*/true);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, groupTarget, /*isInjector*/true, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, wellTarget, /*isInjector*/true);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, groupTarget, /*isInjector*/true, fraction);
|
||||
|
||||
switch(currentGroupControl) {
|
||||
case Group2::InjectionCMode::NONE:
|
||||
@ -1092,8 +1092,8 @@ namespace Opm
|
||||
double groupTargetReduction = 0.0;
|
||||
int phasePos = pu.phase_pos[Oil];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::OIL, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::OIL, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::OIL, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::OIL, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.oil_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||
@ -1106,8 +1106,8 @@ namespace Opm
|
||||
double groupTargetReduction = 0.0;
|
||||
int phasePos = pu.phase_pos[Water];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::WAT, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::WAT, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::WAT, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::WAT, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.water_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
||||
@ -1120,8 +1120,8 @@ namespace Opm
|
||||
double groupTargetReduction = 0.0;
|
||||
int phasePos = pu.phase_pos[Gas];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::GAS, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::GAS, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::GAS, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::GAS, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.gas_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasCompIdx));
|
||||
@ -1136,8 +1136,8 @@ namespace Opm
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
phasePos = pu.phase_pos[Oil];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::LIQ, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::LIQ, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
|
||||
|
||||
const double rate_target = std::max(0.0, groupcontrols.liquid_target / efficiencyFactor - groupTargetReduction);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||
@ -1162,8 +1162,8 @@ namespace Opm
|
||||
phasePos = pu.phase_pos[Gas];
|
||||
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
|
||||
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, current_step_, Base::guide_rate_, Well2::GuideRateTarget::RES, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, current_step_, Base::guide_rate_, Group2::GuideRateTarget::RES, /*isInjector*/false, fraction);
|
||||
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::RES, /*isInjector*/false);
|
||||
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::RES, /*isInjector*/false, fraction);
|
||||
|
||||
EvalWell total_rate(numWellEq_ + numEq, 0.); // reservoir rate
|
||||
std::vector<double> convert_coeff(number_of_phases_, 1.0);
|
||||
|
@ -238,7 +238,7 @@ namespace Opm {
|
||||
guideRate->compute(group.name(), reportStepIdx, simTime, oilPot, gasPot, waterPot);
|
||||
}
|
||||
|
||||
inline double wellFractionFromGuideRates(const Well2& well, const Schedule& schedule, const int reportStepIdx, const GuideRate* guideRate, const Well2::GuideRateTarget& wellTarget, const bool isInjector) {
|
||||
inline double wellFractionFromGuideRates(const Well2& well, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const GuideRate* guideRate, const Well2::GuideRateTarget& wellTarget, const bool isInjector) {
|
||||
double groupTotalGuideRate = 0.0;
|
||||
const Group2& groupTmp = schedule.getGroup2(well.groupName(), reportStepIdx);
|
||||
for (const std::string& wellName : groupTmp.wells()) {
|
||||
@ -253,6 +253,22 @@ namespace Opm {
|
||||
if (wellTmp.getStatus() == Well2::Status::SHUT)
|
||||
continue;
|
||||
|
||||
const auto& end = wellState.wellMap().end();
|
||||
const auto& it = wellState.wellMap().find( wellName );
|
||||
if (it == end) // the well is not found
|
||||
continue;
|
||||
|
||||
int well_index = it->second[0];
|
||||
|
||||
// only count wells under group control
|
||||
if (isInjector) {
|
||||
if (wellState.currentInjectionControls()[well_index] != Well2::InjectorCMode::GRUP)
|
||||
continue;
|
||||
} else {
|
||||
if (wellState.currentProductionControls()[well_index] != Well2::ProducerCMode::GRUP)
|
||||
continue;
|
||||
}
|
||||
|
||||
groupTotalGuideRate += guideRate->get(wellName, wellTarget);
|
||||
}
|
||||
|
||||
@ -263,12 +279,23 @@ namespace Opm {
|
||||
return wellGuideRate / groupTotalGuideRate;
|
||||
}
|
||||
|
||||
inline double groupFractionFromGuideRates(const Group2& group, const Schedule& schedule, const int reportStepIdx, const GuideRate* guideRate, const Group2::GuideRateTarget& groupTarget, const bool isInjector) {
|
||||
inline double groupFractionFromGuideRates(const Group2& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const GuideRate* guideRate, const Group2::GuideRateTarget& groupTarget, const bool isInjector) {
|
||||
double groupTotalGuideRate = 0.0;
|
||||
const Group2& groupParent = schedule.getGroup2(group.parent(), reportStepIdx);
|
||||
for (const std::string& groupName : groupParent.groups()) {
|
||||
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
|
||||
|
||||
// only count group under group control from its parent
|
||||
if (isInjector) {
|
||||
const Group2::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(group.name());
|
||||
if (currentGroupControl != Group2::InjectionCMode::FLD)
|
||||
continue;
|
||||
} else {
|
||||
const Group2::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(group.name());
|
||||
if (currentGroupControl != Group2::ProductionCMode::FLD)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( (groupTmp.isProductionGroup() && !isInjector) ||
|
||||
(groupTmp.isInjectionGroup() && isInjector) )
|
||||
{
|
||||
@ -282,12 +309,12 @@ namespace Opm {
|
||||
return groupGuideRate / groupTotalGuideRate;
|
||||
}
|
||||
|
||||
inline void accumulateGroupFractions(const std::string& groupName, const std::string& controlGroupName, const Schedule& schedule, const int reportStepIdx, const GuideRate* guideRate, const Group2::GuideRateTarget& groupTarget, const bool isInjector, double fraction) {
|
||||
inline void accumulateGroupFractions(const std::string& groupName, const std::string& controlGroupName, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState,const int reportStepIdx, const GuideRate* guideRate, const Group2::GuideRateTarget& groupTarget, const bool isInjector, double fraction) {
|
||||
|
||||
const Group2& group = schedule.getGroup2(groupName, reportStepIdx);
|
||||
if (groupName != controlGroupName) {
|
||||
fraction *= groupFractionFromGuideRates(group, schedule, reportStepIdx, guideRate, groupTarget, isInjector);
|
||||
accumulateGroupFractions(group.parent(), controlGroupName, schedule, reportStepIdx, guideRate, groupTarget, isInjector, fraction);
|
||||
fraction *= groupFractionFromGuideRates(group, schedule, wellState, reportStepIdx, guideRate, groupTarget, isInjector);
|
||||
accumulateGroupFractions(group.parent(), controlGroupName, schedule, wellState, reportStepIdx, guideRate, groupTarget, isInjector, fraction);
|
||||
}
|
||||
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user