This commit is contained in:
Tor Harald Sandve 2020-01-23 14:26:02 +01:00
parent e39e327451
commit 2d2ec82640
5 changed files with 47 additions and 26 deletions

View File

@ -1190,7 +1190,6 @@ namespace Opm {
wellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ true, well_state_nupcol_, well_state_, groupTargetReductionInj);
const auto& comm = ebosSimulator_.vanguard().grid().comm();
well_state_.communicateGroupReductionRates(comm);
well_state_.updateGlobalIsGrup(schedule(), reportStepIdx, comm);
const double simulationTime = ebosSimulator_.time();
@ -1202,7 +1201,10 @@ namespace Opm {
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
wellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState, well_state_nupcol_, well_state_);
wellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_, well_state_);
well_state_.communicateReinVrep(comm);
wellGroupHelpers::updateReservoirRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_, well_state_);
well_state_.communicateGroupRates(comm);
// compute wsolvent fraction for REIN wells
updateWsolvent(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_);

View File

@ -2226,15 +2226,15 @@ namespace Opm
double voidageRate = well_state.currentInjectionVREPRates(groupcontrols.voidage_group)*groupcontrols.target_void_fraction;
double injReduction = 0.0;
std::vector<double> groupInjectionReservoirRates = well_state.currentInjectionGroupReservoirRates(group.name());
if (groupcontrols.phase != Phase::WATER)
injReduction += groupInjectionReductions[pu.phase_pos[BlackoilPhases::Aqua]]*convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]];
injReduction += groupInjectionReservoirRates[pu.phase_pos[BlackoilPhases::Aqua]];
if (groupcontrols.phase != Phase::OIL)
injReduction += groupInjectionReductions[pu.phase_pos[BlackoilPhases::Liquid]]*convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]];
injReduction += groupInjectionReservoirRates[pu.phase_pos[BlackoilPhases::Liquid]];
if (groupcontrols.phase != Phase::GAS)
injReduction += groupInjectionReductions[pu.phase_pos[BlackoilPhases::Vapour]]*convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]];
injReduction += groupInjectionReservoirRates[pu.phase_pos[BlackoilPhases::Vapour]];
voidageRate -= injReduction;

View File

@ -1078,19 +1078,15 @@ namespace Opm
double voidageRate = well_state.currentInjectionVREPRates(groupcontrols.voidage_group)*groupcontrols.target_void_fraction;
double injReduction = 0.0;
std::vector<double> groupInjectionReservoirRates = well_state.currentInjectionGroupReservoirRates(group.name());
if (groupcontrols.phase != Phase::WATER)
injReduction += wellGroupHelpers::sumWellPhaseRates(well_state.wellReservoirRates(), group, schedule, well_state, current_step_, pu.phase_pos[BlackoilPhases::Aqua], true);
// injReduction += groupInjectionReductions[pu.phase_pos[BlackoilPhases::Aqua]]*convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]];
injReduction += groupInjectionReservoirRates[pu.phase_pos[BlackoilPhases::Aqua]];
if (groupcontrols.phase != Phase::OIL)
injReduction += wellGroupHelpers::sumWellPhaseRates(well_state.wellReservoirRates(), group, schedule, well_state, current_step_, pu.phase_pos[BlackoilPhases::Liquid], true);
//injReduction += groupInjectionReductions[pu.phase_pos[BlackoilPhases::Liquid]]*convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]];
injReduction += groupInjectionReservoirRates[pu.phase_pos[BlackoilPhases::Liquid]];
if (groupcontrols.phase != Phase::GAS)
injReduction += wellGroupHelpers::sumWellPhaseRates(well_state.wellReservoirRates(), group, schedule, well_state, current_step_, pu.phase_pos[BlackoilPhases::Vapour], true);
//injReduction += groupInjectionReductions[pu.phase_pos[BlackoilPhases::Vapour]]*convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]];
injReduction += groupInjectionReservoirRates[pu.phase_pos[BlackoilPhases::Vapour]];
voidageRate -= injReduction;

View File

@ -469,6 +469,18 @@ namespace Opm {
}
wellState.setCurrentInjectionVREPRates(group.name(), resv);
}
inline void updateReservoirRatesInjectionGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState) {
for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
updateReservoirRatesInjectionGroups(groupTmp, schedule, reportStepIdx, wellStateNupcol, wellState);
}
const int np = wellState.numPhases();
std::vector<double> resv(np, 0.0);
for (int phase = 0; phase < np; ++phase) {
resv[phase] = sumWellPhaseRates(wellStateNupcol.wellReservoirRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ true);
}
wellState.setCurrentInjectionGroupReservoirRates(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) {
const int np = wellState.numPhases();

View File

@ -374,6 +374,18 @@ namespace Opm
return it->second;
}
void setCurrentInjectionGroupReservoirRates(const std::string& groupName, const std::vector<double>& target ) {
injection_group_reservoir_rates[groupName] = target;
}
const std::vector<double>& currentInjectionGroupReservoirRates(const std::string& groupName) const {
auto it = injection_group_reservoir_rates.find(groupName);
if (it == injection_group_reservoir_rates.end())
OPM_THROW(std::logic_error, "Could not find any reservoir rates for injection group " << groupName);
return it->second;
}
void setCurrentInjectionVREPRates(const std::string& groupName, const double& target ) {
injection_group_vrep_rates[groupName] = target;
}
@ -836,18 +848,7 @@ namespace Opm
}
template<class Comm>
void communicateGroupReductionRates(const Comm& comm) {
// sum over all nodes
for (auto& x : production_group_reduction_rates) {
comm.sum(x.second.data(), x.second.size());
}
for (auto& x : injection_group_reduction_rates) {
comm.sum(x.second.data(), x.second.size());
}
}
template<class Comm>
void communicateReinVrep(const Comm& comm) {
void communicateGroupRates(const Comm& comm) {
// sum over all nodes
for (auto& x : injection_group_rein_rates) {
comm.sum(x.second.data(), x.second.size());
@ -855,6 +856,15 @@ namespace Opm
for (auto& x : injection_group_vrep_rates) {
x.second = comm.sum(x.second);
}
for (auto& x : production_group_reduction_rates) {
comm.sum(x.second.data(), x.second.size());
}
for (auto& x : injection_group_reduction_rates) {
comm.sum(x.second.data(), x.second.size());
}
for (auto& x : injection_group_reservoir_rates) {
comm.sum(x.second.data(), x.second.size());
}
}
template<class Comm>
@ -916,6 +926,7 @@ namespace Opm
std::map<std::string, std::vector<double>> production_group_reduction_rates;
std::map<std::string, std::vector<double>> injection_group_reduction_rates;
std::map<std::string, std::vector<double>> injection_group_reservoir_rates;
std::map<std::string, std::vector<double>> injection_group_potentials;
std::map<std::string, double> injection_group_vrep_rates;
std::map<std::string, std::vector<double>> injection_group_rein_rates;