fix vrep and rein for more then one level of groups

This commit is contained in:
Tor Harald Sandve 2020-01-08 14:13:38 +01:00
parent 646e7d4eb1
commit 18c8cc6119
2 changed files with 9 additions and 15 deletions

View File

@ -1191,11 +1191,9 @@ namespace Opm {
std::vector<double> potInj(numPhases(), 0.0); std::vector<double> potInj(numPhases(), 0.0);
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ true, well_state_, comm, guideRate_.get(), potInj); wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ true, well_state_, comm, guideRate_.get(), potInj);
std::vector<double> rein(numPhases(), 0.0);
const auto& summaryState = ebosSimulator_.vanguard().summaryState(); const auto& summaryState = ebosSimulator_.vanguard().summaryState();
wellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState, well_state_nupcol_, well_state_, rein); wellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState, well_state_nupcol_, well_state_);
double resv = 0.0; wellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_, well_state_);
wellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_, well_state_, resv);
well_state_.communicateReinVrep(comm); well_state_.communicateReinVrep(comm);
// compute wsolvent fraction for REIN wells // compute wsolvent fraction for REIN wells

View File

@ -408,31 +408,27 @@ namespace Opm {
} }
inline void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState, double& resv) { inline void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState) {
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);
double thisResv = 0.0; updateVREPForGroups(groupTmp, schedule, reportStepIdx, wellStateNupcol, wellState);
updateVREPForGroups(groupTmp, schedule, reportStepIdx, wellStateNupcol, wellState, thisResv);
resv += thisResv;
} }
const int np = wellState.numPhases(); const int np = wellState.numPhases();
double resv = 0.0;
for (int phase = 0; phase < np; ++phase) { for (int phase = 0; phase < np; ++phase) {
resv += sumWellPhaseRates(wellStateNupcol.wellReservoirRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false); resv += sumWellPhaseRates(wellStateNupcol.wellReservoirRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false);
} }
wellState.setCurrentInjectionVREPRates(group.name(), resv); wellState.setCurrentInjectionVREPRates(group.name(), resv);
} }
inline void updateREINForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const PhaseUsage& pu, const SummaryState& st, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& rein) { inline void updateREINForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const PhaseUsage& pu, const SummaryState& st, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState) {
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);
std::vector<double> thisRein(np, 0.0); updateREINForGroups(groupTmp, schedule, reportStepIdx, pu, st, wellStateNupcol, wellState);
updateREINForGroups(groupTmp, schedule, reportStepIdx, pu, st, wellStateNupcol, wellState, thisRein);
for (int phase = 0; phase < np; ++phase) {
rein[phase] = thisRein[phase];
}
} }
std::vector<double> rein(np, 0.0);
for (int phase = 0; phase < np; ++phase) { for (int phase = 0; phase < np; ++phase) {
rein[phase] = sumWellPhaseRates(wellStateNupcol.wellRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false); rein[phase] = sumWellPhaseRates(wellStateNupcol.wellRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false);
} }