diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index 043d8dca7..e7f08cc48 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -466,6 +466,13 @@ namespace Opm const double dis_gas_rate, const std::vector& cq_s, const IntensiveQuantities& intQuants) const; + + template + void gasOilPerfRateProd(std::vector& cq_s, + PerforationRates& perf_rates, + const Value& rv, + const Value& rs, + const Value& rvw) const; }; } diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 9f68ca42a..0bf22e865 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -232,29 +232,7 @@ namespace Opm } if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { - const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx); - const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); - const Value cq_sOil = cq_s[oilCompIdx]; - const Value cq_sGas = cq_s[gasCompIdx]; - const Value dis_gas = rs * cq_sOil; - const Value vap_oil = rv * cq_sGas; - - cq_s[gasCompIdx] += dis_gas; - cq_s[oilCompIdx] += vap_oil; - - // recording the perforation solution gas rate and solution oil rates - if (this->isProducer()) { - perf_rates.dis_gas = getValue(dis_gas); - perf_rates.vap_oil = getValue(vap_oil); - } - - if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { - const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); - const Value vap_wat = rvw * cq_sGas; - cq_s[waterCompIdx] += vap_wat; - if (this->isProducer()) - perf_rates.vap_wat = getValue(vap_wat); - } + 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); @@ -2470,4 +2448,38 @@ namespace Opm return {Base::restrictEval(cq_s_zfrac_effective), cq_s_zfrac_effective}; } + template + template + void + StandardWell:: + gasOilPerfRateProd(std::vector& cq_s, + PerforationRates& perf_rates, + const Value& rv, + const Value& rs, + const Value& rvw) const + { + const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx); + const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); + const Value cq_sOil = cq_s[oilCompIdx]; + const Value cq_sGas = cq_s[gasCompIdx]; + const Value dis_gas = rs * cq_sOil; + const Value vap_oil = rv * cq_sGas; + + cq_s[gasCompIdx] += dis_gas; + cq_s[oilCompIdx] += vap_oil; + + // recording the perforation solution gas rate and solution oil rates + if (this->isProducer()) { + perf_rates.dis_gas = getValue(dis_gas); + perf_rates.vap_oil = getValue(vap_oil); + } + + if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { + const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); + const Value vap_wat = rvw * cq_sGas; + cq_s[waterCompIdx] += vap_wat; + if (this->isProducer()) + perf_rates.vap_wat = getValue(vap_wat); + } + } } // namespace Opm