From fdfd1816299edf1ee3bebc71d2a824ed4b964f3e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 May 2023 14:22:56 +0200 Subject: [PATCH] changed: put calculation of vaporized and dissolved water volume ratio in separate method --- opm/simulators/wells/StandardWell.hpp | 9 ++++ opm/simulators/wells/StandardWell_impl.hpp | 59 ++++++++++++++-------- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index a8160ca56..7f80c1b83 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -479,6 +479,15 @@ namespace Opm PerforationRates& perf_rates, const Value& rvw, const Value& rsw) const; + + template + void disOilVapWatVolumeRatio(Value& volumeRatio, + const Value& rvw, + const Value& rsw, + const Value& pressure, + const std::vector& cmix_s, + const std::vector& b_perfcells_dense, + DeferredLogger& deferred_logger) const; }; } diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 5bdc5970b..7cd16383e 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -255,26 +255,8 @@ namespace Opm Value volumeRatio = bhp * 0.0; // initialize it with the correct type ; if (FluidSystem::enableVaporizedWater() && FluidSystem::enableDissolvedGasInWater()) { - const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); - const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); - // Incorporate RSW/RVW factors if both water and gas active - const Value d = 1.0 - rvw * rsw; - - if (d <= 0.0) { - std::ostringstream sstr; - sstr << "Problematic d value " << d << " obtained for well " << this->name() - << " during computePerfRate calculations with rsw " << rsw - << ", rvw " << rvw << " and pressure " << pressure - << " obtaining d " << d - << " Continue as if no dissolution (rsw = 0) and vaporization (rvw = 0) " - << " for this connection."; - deferred_logger.debug(sstr.str()); - } - const Value tmp_wat = d > 0.0? (cmix_s[waterCompIdx] - rvw * cmix_s[gasCompIdx]) / d : cmix_s[waterCompIdx]; - volumeRatio += tmp_wat / b_perfcells_dense[waterCompIdx]; - - const Value tmp_gas = d > 0.0? (cmix_s[gasCompIdx] - rsw * cmix_s[waterCompIdx]) / d : cmix_s[gasCompIdx]; - volumeRatio += tmp_gas / b_perfcells_dense[gasCompIdx]; + disOilVapWatVolumeRatio(volumeRatio, rvw, rsw, pressure, + cmix_s, b_perfcells_dense, deferred_logger); } else { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); @@ -2496,4 +2478,41 @@ namespace Opm } } + + template + template + void + StandardWell:: + disOilVapWatVolumeRatio(Value& volumeRatio, + const Value& rvw, + const Value& rsw, + const Value& pressure, + const std::vector& cmix_s, + const std::vector& b_perfcells_dense, + DeferredLogger& deferred_logger) const + { + const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); + const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); + // Incorporate RSW/RVW factors if both water and gas active + const Value d = 1.0 - rvw * rsw; + + if (d <= 0.0) { + std::ostringstream sstr; + sstr << "Problematic d value " << d << " obtained for well " << this->name() + << " during computePerfRate calculations with rsw " << rsw + << ", rvw " << rvw << " and pressure " << pressure + << " obtaining d " << d + << " Continue as if no dissolution (rsw = 0) and vaporization (rvw = 0) " + << " for this connection."; + deferred_logger.debug(sstr.str()); + } + const Value tmp_wat = d > 0.0 ? (cmix_s[waterCompIdx] - rvw * cmix_s[gasCompIdx]) / d + : cmix_s[waterCompIdx]; + volumeRatio += tmp_wat / b_perfcells_dense[waterCompIdx]; + + const Value tmp_gas = d > 0.0 ? (cmix_s[gasCompIdx] - rsw * cmix_s[waterCompIdx]) / d + : cmix_s[waterCompIdx]; + volumeRatio += tmp_gas / b_perfcells_dense[gasCompIdx]; + } + } // namespace Opm