Merge pull request #4848 from vkip/gconsump_mpi_fix

Avoid adding/substracting GCONSUMP values per MPI process..
This commit is contained in:
Atgeirr Flø Rasmussen 2023-09-13 11:00:04 +02:00 committed by GitHub
commit 3673c05242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
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::updateReservoirRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, this->groupState());

View File

@ -657,12 +657,13 @@ namespace WellGroupHelpers
const PhaseUsage& pu,
const SummaryState& st,
const WellState& wellState,
GroupState& group_state)
GroupState& group_state,
bool sum_rank)
{
const int np = wellState.numPhases();
for (const std::string& groupName : group.groups()) {
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);
@ -671,11 +672,13 @@ namespace WellGroupHelpers
}
// add import rate and subtract consumption rate for group for gas
if (schedule[reportStepIdx].gconsump().has(group.name())) {
const auto& gconsump = schedule[reportStepIdx].gconsump().get(group.name(), st);
if (pu.phase_used[BlackoilPhases::Vapour]) {
rein[pu.phase_pos[BlackoilPhases::Vapour]] += gconsump.import_rate;
rein[pu.phase_pos[BlackoilPhases::Vapour]] -= gconsump.consumption_rate;
if (sum_rank) {
if (schedule[reportStepIdx].gconsump().has(group.name())) {
const auto& gconsump = schedule[reportStepIdx].gconsump().get(group.name(), st);
if (pu.phase_used[BlackoilPhases::Vapour]) {
rein[pu.phase_pos[BlackoilPhases::Vapour]] += gconsump.import_rate;
rein[pu.phase_pos[BlackoilPhases::Vapour]] -= gconsump.consumption_rate;
}
}
}

View File

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