Avoid adding/substracting GCONSUMP values per MPI process..

This commit is contained in:
Vegard Kippe 2023-09-07 14:14:56 +02:00
parent 62abbbde60
commit dbd1d343e8
3 changed files with 13 additions and 9 deletions

View File

@ -947,7 +947,7 @@ updateAndCommunicateGroupData(const int reportStepIdx,
std::vector<double> groupTargetReductionInj(numPhases(), 0.0); std::vector<double> groupTargetReductionInj(numPhases(), 0.0);
WellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ true, phase_usage_, guideRate_, well_state, this->groupState(), groupTargetReductionInj); WellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ true, phase_usage_, guideRate_, well_state, this->groupState(), groupTargetReductionInj);
WellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState_, well_state_nupcol, this->groupState()); WellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState_, well_state_nupcol, this->groupState(), comm_.rank()==0);
WellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, this->groupState()); WellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, this->groupState());
WellGroupHelpers::updateReservoirRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, this->groupState()); WellGroupHelpers::updateReservoirRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, this->groupState());

View File

@ -657,12 +657,13 @@ namespace WellGroupHelpers
const PhaseUsage& pu, const PhaseUsage& pu,
const SummaryState& st, const SummaryState& st,
const WellState& wellState, const WellState& wellState,
GroupState& group_state) GroupState& group_state,
bool sum_rank)
{ {
const int np = wellState.numPhases(); const int np = wellState.numPhases();
for (const std::string& groupName : group.groups()) { for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
updateREINForGroups(groupTmp, schedule, reportStepIdx, pu, st, wellState, group_state); updateREINForGroups(groupTmp, schedule, reportStepIdx, pu, st, wellState, group_state, sum_rank);
} }
std::vector<double> rein(np, 0.0); std::vector<double> rein(np, 0.0);
@ -671,6 +672,7 @@ namespace WellGroupHelpers
} }
// add import rate and subtract consumption rate for group for gas // add import rate and subtract consumption rate for group for gas
if (sum_rank) {
if (schedule[reportStepIdx].gconsump().has(group.name())) { if (schedule[reportStepIdx].gconsump().has(group.name())) {
const auto& gconsump = schedule[reportStepIdx].gconsump().get(group.name(), st); const auto& gconsump = schedule[reportStepIdx].gconsump().get(group.name(), st);
if (pu.phase_used[BlackoilPhases::Vapour]) { if (pu.phase_used[BlackoilPhases::Vapour]) {
@ -678,6 +680,7 @@ namespace WellGroupHelpers
rein[pu.phase_pos[BlackoilPhases::Vapour]] -= gconsump.consumption_rate; rein[pu.phase_pos[BlackoilPhases::Vapour]] -= gconsump.consumption_rate;
} }
} }
}
group_state.update_injection_rein_rates(group.name(), rein); group_state.update_injection_rein_rates(group.name(), rein);
} }

View File

@ -179,7 +179,8 @@ namespace WellGroupHelpers
const PhaseUsage& pu, const PhaseUsage& pu,
const SummaryState& st, const SummaryState& st,
const WellState& wellState, const WellState& wellState,
GroupState& group_state); GroupState& group_state,
bool sum_rank);
template <class RegionalValues> template <class RegionalValues>
void updateGpMaintTargetForGroups(const Group& group, void updateGpMaintTargetForGroups(const Group& group,