Support nupcol

Only update groupTargetReduction, group REIN rates and group VREP rates when iteration < nupcol
This commit is contained in:
Tor Harald Sandve committed 2019-11-06 10:23:30 +01:00
1 parent b9b8905db5
commit 008eb17693
5 files changed
+244 -89

No files matched your search

+35 -38
View File
@@ -1980,7 +1980,17 @@ namespace Opm
const auto& well = well_ecl_;
const auto pu = phaseUsage();
const Group2::InjectionCMode& currentGroupControl = well_state.currentInjectionGroupControl(group.name());
if (!group.isInjectionGroup() && currentGroupControl!=Group2::InjectionCMode::FLD )
if (currentGroupControl == Group2::InjectionCMode::FLD) {
// Inject share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
assembleGroupInjectionControl(parent, well_state, schedule, summaryState, injectorType, control_eq, efficiencyFactor, deferred_logger);
return;
}
if (!group.isInjectionGroup())
return;
const auto& groupcontrols = group.injectionControls(summaryState);
@@ -2019,8 +2029,8 @@ namespace Opm
throw("Expected WATER, OIL or GAS as type for injectors " + well.name());
}
double groupTargetReduction = 0.0;
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/true, groupTargetReduction);
const std::vector<double>& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name());
double groupTargetReduction = groupTargetReductions[phasePos];
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);
@@ -2047,9 +2057,7 @@ namespace Opm
}
case Group2::InjectionCMode::REIN:
{
double productionRate = 0.0;
const Group2& reinGroup = schedule.getGroup2( groupcontrols.reinj_group, current_step_ );
productionRate += wellGroupHelpers::sumWellRates(reinGroup, schedule, well_state, current_step_, phasePos, /*isInjector*/false);
double productionRate = well_state.currentInjectionVREPRates(groupcontrols.reinj_group);
productionRate /= efficiencyFactor;
double target = std::max(0.0, (groupcontrols.target_reinj_fraction*productionRate - groupTargetReduction));
control_eq = getSegmentGTotal(0) / scaling - fraction * target;
@@ -2060,11 +2068,7 @@ namespace Opm
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
double coeff = convert_coeff[phasePos];
double voidageRate = 0.0;
const Group2& voidageGroup = schedule.getGroup2( groupcontrols.voidage_group, current_step_ );
voidageRate += wellGroupHelpers::sumWellResRates(voidageGroup, schedule, well_state, current_step_, pu.phase_pos[BlackoilPhases::Aqua], /*injector*/false);
voidageRate += wellGroupHelpers::sumWellResRates(voidageGroup, schedule, well_state, current_step_, pu.phase_pos[BlackoilPhases::Liquid], /*injector*/false);
voidageRate += wellGroupHelpers::sumWellResRates(voidageGroup, schedule, well_state, current_step_, pu.phase_pos[BlackoilPhases::Vapour], /*injector*/false);
double voidageRate = well_state.currentInjectionVREPRates(groupcontrols.voidage_group);
voidageRate /= efficiencyFactor;
double target = std::max(0.0, ( groupcontrols.target_void_fraction*voidageRate/coeff - groupTargetReduction));
control_eq = getSegmentGTotal(0) / scaling - fraction * target ;
@@ -2072,11 +2076,8 @@ namespace Opm
}
case Group2::InjectionCMode::FLD:
{
// Inject share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
assembleGroupInjectionControl(parent, well_state, schedule, summaryState, injectorType, control_eq, efficiencyFactor, deferred_logger);
// The FLD case is handled earlier
assert(false);
break;
}
@@ -2100,10 +2101,21 @@ namespace Opm
const auto pu = phaseUsage();
const Group2::ProductionCMode& currentGroupControl = well_state.currentProductionGroupControl(group.name());
if (!group.isProductionGroup() && currentGroupControl != Group2::ProductionCMode::FLD)
if (currentGroupControl == Group2::ProductionCMode::FLD ) {
// Produce share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
assembleGroupProductionControl(parent, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger);
return;
}
if (!group.isProductionGroup())
return;
const auto& groupcontrols = group.productionControls(summaryState);
const std::vector<double>& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name());
switch(currentGroupControl) {
case Group2::ProductionCMode::NONE:
@@ -2113,9 +2125,7 @@ namespace Opm
}
case Group2::ProductionCMode::ORAT:
{
double groupTargetReduction = 0.0;
int phasePos = pu.phase_pos[Oil];
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]];
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);
@@ -2127,9 +2137,7 @@ namespace Opm
}
case Group2::ProductionCMode::WRAT:
{
double groupTargetReduction = 0.0;
int phasePos = pu.phase_pos[Water];
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Water]];
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);
@@ -2141,9 +2149,7 @@ namespace Opm
}
case Group2::ProductionCMode::GRAT:
{
double groupTargetReduction = 0.0;
int phasePos = pu.phase_pos[Gas];
wellGroupHelpers::computeGroupTargetReduction(group, well_state, schedule, current_step_, phasePos, /*isInjector*/false, groupTargetReduction);
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Gas]];
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);
@@ -2154,11 +2160,7 @@ namespace Opm
}
case Group2::ProductionCMode::LRAT:
{
double groupTargetReduction = 0.0;
int phasePos = pu.phase_pos[Water];
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 groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]] + groupTargetReductions[pu.phase_pos[Water]];
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);
@@ -2187,15 +2189,10 @@ namespace Opm
}
case Group2::ProductionCMode::FLD:
{
// Produce share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
assembleGroupProductionControl(parent, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger);
// The FLD case is handled earlier
assert(false);
break;
}
default:
OPM_DEFLOG_THROW(std::runtime_error, "Unvallied group control specified for group " + well.groupName(), deferred_logger );
}