From d388ce40e587f9b070d506563a62525f2efc18e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 13 Oct 2022 16:19:33 +0200 Subject: [PATCH] Revert to Original Rs/Rv Calculation Scheme for RESV Rates Keep the alternative approach in place for reference and experimental purposes, but disabled by a macro. --- opm/simulators/wells/RateConverter.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/opm/simulators/wells/RateConverter.hpp b/opm/simulators/wells/RateConverter.hpp index 9704d2cb7..91ac14afe 100644 --- a/opm/simulators/wells/RateConverter.hpp +++ b/opm/simulators/wells/RateConverter.hpp @@ -552,6 +552,26 @@ namespace Opm { return { rs, rv }; } +#define BURN_RESV_BRIDGES 0 + +#if !BURN_RESV_BRIDGES + + auto b = rs; + if (io >= 0 && ig >= 0) { + b = surface_rates[ig] / (surface_rates[io] + 1.0e-15); + } + const double Rs = std::min(rs, b); + + b = rv; + if (io >= 0 && ig >= 0) { + b = surface_rates[io] / (surface_rates[ig] + 1.0e-15); + } + const double Rv = std::min(rv, b); + + return { Rs, Rv }; + +#else // BURN_RESV_BRIDGES + auto eps = std::copysign(1.0e-15, surface_rates[io]); const auto Rs = surface_rates[ig] / (surface_rates[io] + eps); @@ -562,6 +582,10 @@ namespace Opm { std::clamp(static_cast(Rs), 0.0, rs), std::clamp(static_cast(Rv), 0.0, rv) }; + +#endif // BURN_RESV_BRIDGES + +#undef BURN_RESV_BRIDGES } };