From 516320699e7a7f0bbf7e0ced8d77773a88128db4 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 May 2023 09:55:26 +0200 Subject: [PATCH] changed: put calculation of production gas-water perf rates in separate method --- opm/simulators/wells/StandardWell.hpp | 6 ++++ opm/simulators/wells/StandardWell_impl.hpp | 38 +++++++++++++++------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index e7f08cc48..a8160ca56 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -473,6 +473,12 @@ namespace Opm const Value& rv, const Value& rs, const Value& rvw) const; + + template + void gasWaterPerfRateProd(std::vector& cq_s, + PerforationRates& perf_rates, + const Value& rvw, + const Value& rsw) const; }; } diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 0bf22e865..5bdc5970b 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -234,18 +234,7 @@ namespace Opm if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { gasOilPerfRateProd(cq_s, perf_rates, rv, rs, rvw); } else if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { - const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); - const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); - const Value cq_sWat = cq_s[waterCompIdx]; - const Value cq_sGas = cq_s[gasCompIdx]; - const Value vap_wat = rvw * cq_sGas; - const Value dis_gas_wat = rsw * cq_sWat; - cq_s[waterCompIdx] += vap_wat; - cq_s[gasCompIdx] += dis_gas_wat; - if (this->isProducer()) { - perf_rates.vap_wat = getValue(vap_wat); - perf_rates.dis_gas_in_water = getValue(dis_gas_wat); - } + gasWaterPerfRateProd(cq_s, perf_rates, rvw, rsw); } } else { // Do nothing if crossflow is not allowed @@ -2482,4 +2471,29 @@ namespace Opm perf_rates.vap_wat = getValue(vap_wat); } } + + + template + template + void + StandardWell:: + gasWaterPerfRateProd(std::vector& cq_s, + PerforationRates& perf_rates, + const Value& rvw, + const Value& rsw) const + { + const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); + const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); + const Value cq_sWat = cq_s[waterCompIdx]; + const Value cq_sGas = cq_s[gasCompIdx]; + const Value vap_wat = rvw * cq_sGas; + const Value dis_gas_wat = rsw * cq_sWat; + cq_s[waterCompIdx] += vap_wat; + cq_s[gasCompIdx] += dis_gas_wat; + if (this->isProducer()) { + perf_rates.vap_wat = getValue(vap_wat); + perf_rates.dis_gas_in_water = getValue(dis_gas_wat); + } + } + } // namespace Opm