diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index f72ad7fa2..d1ffece29 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -110,6 +110,8 @@ namespace WellGroupHelpers updateGuideRateForGroups( groupTmp, schedule, pu, reportStepIdx, simTime, isInjector, wellState, comm, guideRate, thisPot); + const auto gefac = groupTmp.getGroupEfficiencyFactor(); + // accumulate group contribution from sub group unconditionally if (isInjector) { const Phase all[] = {Phase::WATER, Phase::OIL, Phase::GAS}; @@ -124,7 +126,7 @@ namespace WellGroupHelpers else continue; - pot[phasePos] += thisPot[phasePos]; + pot[phasePos] += gefac * thisPot[phasePos]; } } else { const Group::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName); @@ -133,12 +135,13 @@ namespace WellGroupHelpers continue; } for (int phase = 0; phase < np; phase++) { - pot[phase] += thisPot[phase]; + pot[phase] += gefac * thisPot[phase]; } } } for (const std::string& wellName : group.wells()) { const auto& wellTmp = schedule.getWell(wellName, reportStepIdx); + const auto wefac = wellTmp.getEfficiencyFactor(); if (wellTmp.isProducer() && isInjector) continue; @@ -157,7 +160,7 @@ namespace WellGroupHelpers const auto wellrate_index = well_index * wellState.numPhases(); // add contribution from wells unconditionally for (int phase = 0; phase < np; phase++) { - pot[phase] += wellState.wellPotentials()[wellrate_index + phase]; + pot[phase] += wefac * wellState.wellPotentials()[wellrate_index + phase]; } } @@ -173,11 +176,9 @@ namespace WellGroupHelpers if (pu.phase_used[BlackoilPhases::Aqua]) waterPot = pot[pu.phase_pos[BlackoilPhases::Aqua]]; - const double gefac = group.getGroupEfficiencyFactor(); - - oilPot = comm.sum(oilPot) * gefac; - gasPot = comm.sum(gasPot) * gefac; - waterPot = comm.sum(waterPot) * gefac; + oilPot = comm.sum(oilPot); + gasPot = comm.sum(gasPot); + waterPot = comm.sum(waterPot); if (isInjector) { wellState.setCurrentGroupInjectionPotentials(group.name(), pot); @@ -217,10 +218,9 @@ namespace WellGroupHelpers if (pu.phase_used[BlackoilPhases::Aqua] > 0) waterpot = wpot[pu.phase_pos[BlackoilPhases::Aqua]]; } - const double wefac = well.getEfficiencyFactor(); - oilpot = comm.sum(oilpot) * wefac; - gaspot = comm.sum(gaspot) * wefac; - waterpot = comm.sum(waterpot) * wefac; + oilpot = comm.sum(oilpot); + gaspot = comm.sum(gaspot); + waterpot = comm.sum(waterpot); guideRate->compute(well.name(), reportStepIdx, simTime, oilpot, gaspot, waterpot); } }