Honor top most group efficiency factor in checkGroupConstraints{Inj,Prod}

This commit is contained in:
Markus Blatt 2021-03-02 11:32:27 +01:00
parent 0d2b9629b0
commit d1f65451f1

View File

@ -1089,13 +1089,15 @@ namespace WellGroupHelpers
name, group.name(), schedule, wellState, reportStepIdx, guideRate, target, pu, injectionPhase, true);
double target_fraction = 1.0;
bool constraint_broken = false;
double efficiencyFactorInclGroup = efficiencyFactor * group.getGroupEfficiencyFactor();
switch (currentGroupControl) {
case Group::InjectionCMode::RATE: {
const double current_rate = rates[phasePos];
const double target_rate = fraction
* std::max(0.0,
(groupcontrols.surface_max_rate - groupTargetReduction + current_rate * efficiencyFactor))
/ efficiencyFactor;
(groupcontrols.surface_max_rate - groupTargetReduction + current_rate * efficiencyFactorInclGroup))
/ efficiencyFactorInclGroup;
if (current_rate > target_rate) {
constraint_broken = true;
target_fraction = target_rate / current_rate;
@ -1108,8 +1110,8 @@ namespace WellGroupHelpers
const double target_rate = fraction
* std::max(0.0,
(groupcontrols.resv_max_rate / coeff - groupTargetReduction
+ current_rate * efficiencyFactor))
/ efficiencyFactor;
+ current_rate * efficiencyFactorInclGroup))
/ efficiencyFactorInclGroup;
if (current_rate > target_rate) {
constraint_broken = true;
target_fraction = target_rate / current_rate;
@ -1122,8 +1124,8 @@ namespace WellGroupHelpers
const double target_rate = fraction
* std::max(0.0,
(groupcontrols.target_reinj_fraction * productionRate - groupTargetReduction
+ current_rate * efficiencyFactor))
/ efficiencyFactor;
+ current_rate * efficiencyFactorInclGroup))
/ efficiencyFactorInclGroup;
if (current_rate > target_rate) {
constraint_broken = true;
target_fraction = target_rate / current_rate;
@ -1149,8 +1151,8 @@ namespace WellGroupHelpers
const double current_rate = rates[phasePos];
const double target_rate = fraction
* std::max(0.0, (voidageRate / coeff - groupTargetReduction + current_rate * efficiencyFactor))
/ efficiencyFactor;
* std::max(0.0, (voidageRate / coeff - groupTargetReduction + current_rate * efficiencyFactorInclGroup))
/ efficiencyFactorInclGroup;
if (current_rate > target_rate) {
constraint_broken = true;
target_fraction = target_rate / current_rate;
@ -1169,7 +1171,7 @@ namespace WellGroupHelpers
const double current_rate = rates[phasePos];
const double target_rate = fraction
* std::max(0.0, (inj_rate - groupTargetReduction + current_rate * efficiencyFactor)) / efficiencyFactor;
* std::max(0.0, (inj_rate - groupTargetReduction + current_rate * efficiencyFactorInclGroup)) / efficiencyFactorInclGroup;
if (current_rate > target_rate) {
constraint_broken = true;
target_fraction = target_rate / current_rate;
@ -1311,6 +1313,7 @@ namespace WellGroupHelpers
}
}
double efficiencyFactorInclGroup = efficiencyFactor * group.getGroupEfficiencyFactor();
double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || guideRate->has(chain[ii])) {
@ -1321,7 +1324,7 @@ namespace WellGroupHelpers
// Add my reduction back at the level where it is included in the local reduction
if (local_reduction_level == ii )
target += current_rate * efficiencyFactor;
target += current_rate * efficiencyFactorInclGroup;
}
if (ii < num_ancestors - 1) {
// Not final level. Add sub-level reduction back, if
@ -1340,7 +1343,7 @@ namespace WellGroupHelpers
target *= localFraction(chain[ii + 1]);
}
// Avoid negative target rates comming from too large local reductions.
const double target_rate = std::max(1e-12, target / efficiencyFactor);
const double target_rate = std::max(1e-12, target / efficiencyFactorInclGroup);
return std::make_pair(current_rate > target_rate, target_rate / current_rate);
}