diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index eefc88b1d..b9cfb3913 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -996,7 +996,17 @@ checkGroupProductionConstraints(const Group& group, // sum over all nodes current_rate = comm_.sum(current_rate); - if (controls.liquid_target < current_rate ) { + bool skip = false; + if (controls.liquid_target == controls.oil_target) { + double current_water_rate = WellGroupHelpers::sumWellSurfaceRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Aqua], false); + current_water_rate = comm_.sum(current_water_rate); + if (std::abs(current_water_rate) < 1e-12) { + skip = true; + deferred_logger.debug("LRAT_ORAT_GROUP", "GROUP " + group.name() + " The LRAT target is equal the ORAT target and the water rate is zero, skip checking LRAT"); + } + } + + if (!skip && controls.liquid_target < current_rate ) { double scale = 1.0; if (current_rate > 1e-12) scale = controls.liquid_target / current_rate; diff --git a/opm/simulators/wells/WellInterfaceFluidSystem.cpp b/opm/simulators/wells/WellInterfaceFluidSystem.cpp index f5a54254e..6ff791122 100644 --- a/opm/simulators/wells/WellInterfaceFluidSystem.cpp +++ b/opm/simulators/wells/WellInterfaceFluidSystem.cpp @@ -118,7 +118,16 @@ activeProductionConstraint(const SingleWellState& ws, if (controls.hasControl(Well::ProducerCMode::LRAT) && currentControl != Well::ProducerCMode::LRAT) { double current_rate = -ws.surface_rates[pu.phase_pos[BlackoilPhases::Liquid]]; current_rate -= ws.surface_rates[pu.phase_pos[BlackoilPhases::Aqua]]; - if (controls.liquid_rate < current_rate) + + bool skip = false; + if (controls.liquid_rate == controls.oil_rate) { + const double current_water_rate = ws.surface_rates[pu.phase_pos[BlackoilPhases::Aqua]]; + if (std::abs(current_water_rate) < 1e-12) { + skip = true; + deferred_logger.debug("LRAT_ORAT_WELL", "Well " + this->name() + " The LRAT target is equal the ORAT target and the water rate is zero, skip checking LRAT"); + } + } + if (!skip && controls.liquid_rate < current_rate) return Well::ProducerCMode::LRAT; }