Skip to content

Commit

Permalink
Also update REIN if REIN changes significantly
Browse files Browse the repository at this point in the history
  • Loading branch information
Tor Harald Sandve committed Nov 12, 2024
1 parent e90ffe0 commit 04d4364
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions opm/simulators/wells/BlackoilWellModelGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,34 +1197,37 @@ updateAndCommunicateGroupData(const int reportStepIdx,
const Phase all[] = { Phase::WATER, Phase::OIL, Phase::GAS };
for (Phase phase : all) {
if (this->groupState().has_injection_control(gr_name, phase)) {
if (this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP) {
if (this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP ||
this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::REIN) {
const bool is_vrep = this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP;
const Group& group = schedule().getGroup(gr_name, reportStepIdx);
const int np = this->wellState().numPhases();
Scalar resv_nupcol = 0.0;
Scalar gr_rate_nupcol = 0.0;
for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) {
resv_nupcol += WellGroupHelpers<Scalar>::sumWellPhaseRates(true,
gr_rate_nupcol += WellGroupHelpers<Scalar>::sumWellPhaseRates(is_vrep,
group,
schedule(),
this->nupcolWellState(),
reportStepIdx,
phaseIdx,
/*isInjector*/ false);
}
Scalar resv_wellstate = 0.0;
Scalar gr_rate = 0.0;
for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) {
resv_wellstate += WellGroupHelpers<Scalar>::sumWellPhaseRates(true,
gr_rate += WellGroupHelpers<Scalar>::sumWellPhaseRates(is_vrep,
group,
schedule(),
this->wellState(),
reportStepIdx,
phaseIdx,
/*isInjector*/ false);
}
if ( std::abs( (resv_nupcol - resv_wellstate) / (0.5*resv_nupcol + 0.5*resv_wellstate)) > tol_nupcol) {
if ( std::abs( (gr_rate_nupcol - gr_rate) / (0.5*gr_rate_nupcol + 0.5*gr_rate)) > tol_nupcol) {
this->updateNupcolWGState();
const std::string control_str = is_vrep? "VREP" : "REIN";
const std::string msg = fmt::format("Group prodution relative change larger than tolerance {} "
"at iteration {}. Update VREP for Group {} even if iteration is larger than {} given by NUPCOL." ,
tol_nupcol, iterationIdx, gr_name, nupcol);
"at iteration {}. Update {} for Group {} even if iteration is larger than {} given by NUPCOL." ,
tol_nupcol, iterationIdx, control_str, gr_name, nupcol);
deferred_logger.info(msg);
}
}
Expand Down

0 comments on commit 04d4364

Please sign in to comment.