From 71acf4e056c922f97aced204ac12821d31ce17d6 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 24 Mar 2022 10:43:57 +0100 Subject: [PATCH 1/2] Double check econ potential limits Sometimes the potentials are inaccurate as a safty measure we also check that the rates are violated. The rates are supposed to be less or equal to the potentials. --- opm/simulators/wells/WellInterfaceFluidSystem.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/opm/simulators/wells/WellInterfaceFluidSystem.cpp b/opm/simulators/wells/WellInterfaceFluidSystem.cpp index 6908ac0d3..413f06b03 100644 --- a/opm/simulators/wells/WellInterfaceFluidSystem.cpp +++ b/opm/simulators/wells/WellInterfaceFluidSystem.cpp @@ -715,8 +715,15 @@ updateWellTestStateEconomic(const SingleWellState& ws, const auto& quantity_limit = econ_production_limits.quantityLimit(); if (econ_production_limits.onAnyRateLimit()) { - if (quantity_limit == WellEconProductionLimits::QuantityLimit::POTN) + if (quantity_limit == WellEconProductionLimits::QuantityLimit::POTN) { rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.well_potentials.data(), deferred_logger); + // Due to instability of the bhpFromThpLimit code the potentials are sometimes wrong + // this can lead to premature shutting of wells due to rate limits of the potentials. + // Since rates are supposed to be less or equal to the potentials, we double-check + // that also the rate limit is violated before shutting the well. + if (rate_limit_violated) + rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.surface_rates.data(), deferred_logger); + } else { rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.surface_rates.data(), deferred_logger); } From 8909b259d0b898577055db76b69e894e28e79d38 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 28 Mar 2022 10:43:24 +0200 Subject: [PATCH 2/2] don't shut wells due to ratio when rate is negative --- opm/simulators/wells/WellInterfaceFluidSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/wells/WellInterfaceFluidSystem.cpp b/opm/simulators/wells/WellInterfaceFluidSystem.cpp index 413f06b03..e31717875 100644 --- a/opm/simulators/wells/WellInterfaceFluidSystem.cpp +++ b/opm/simulators/wells/WellInterfaceFluidSystem.cpp @@ -550,7 +550,7 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits, const double oil_rate = -rates[pu.phase_pos[Oil]]; const double water_rate = -rates[pu.phase_pos[Water]]; const double liquid_rate = oil_rate + water_rate; - if (liquid_rate == 0.) + if (liquid_rate <= 0.) return 0.; else if (water_rate < 0) return 0.;