diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index d6afc29b0..b3b7c9598 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -438,11 +438,6 @@ namespace Opm DeferredLogger& deferred_logger) const; private: - Eval connectionRateBrine(double& rate, - const double vap_wat_rate, - const std::vector& cq_s, - const IntensiveQuantities& intQuants) const; - Eval connectionRateEnergy(const double maxOilSaturation, const std::vector& cq_s, const IntensiveQuantities& intQuants, diff --git a/opm/simulators/wells/StandardWellConnections.cpp b/opm/simulators/wells/StandardWellConnections.cpp index 15ec18f0b..0e436f144 100644 --- a/opm/simulators/wells/StandardWellConnections.cpp +++ b/opm/simulators/wells/StandardWellConnections.cpp @@ -514,6 +514,31 @@ computeProperties(const WellState& well_state, this->computePressureDelta(); } +template +typename StandardWellConnections::Eval +StandardWellConnections:: +connectionRateBrine(double& rate, + const double vap_wat_rate, + const std::vector& cq_s, + const std::variant& saltConcentration) const +{ + // TODO: the application of well efficiency factor has not been tested with an example yet + const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); + // Correction salt rate; evaporated water does not contain salt + EvalWell cq_s_sm = cq_s[waterCompIdx] - vap_wat_rate; + if (well_.isInjector()) { + cq_s_sm *= std::get(saltConcentration); + } else { + cq_s_sm *= std::get(saltConcentration); + } + + // Note. Efficiency factor is handled in the output layer + rate = cq_s_sm.value(); + + cq_s_sm *= well_.wellEfficiencyFactor(); + return well_.restrictEval(cq_s_sm); +} + #define INSTANCE(...) \ template class StandardWellConnections,__VA_ARGS__,double>; diff --git a/opm/simulators/wells/StandardWellConnections.hpp b/opm/simulators/wells/StandardWellConnections.hpp index 45b6eb02c..2d4d3b9ec 100644 --- a/opm/simulators/wells/StandardWellConnections.hpp +++ b/opm/simulators/wells/StandardWellConnections.hpp @@ -23,7 +23,10 @@ #ifndef OPM_STANDARDWELL_CONNECTIONS_HEADER_INCLUDED #define OPM_STANDARDWELL_CONNECTIONS_HEADER_INCLUDED +#include + #include +#include #include namespace Opm @@ -76,6 +79,14 @@ public: Scalar pressure_diff(const unsigned perf) const { return perf_pressure_diffs_[perf]; } + using Eval = typename WellInterfaceIndices::Eval; + using EvalWell = typename StandardWellPrimaryVariables::EvalWell; + + Eval connectionRateBrine(double& rate, + const double vap_wat_rate, + const std::vector& cq_s, + const std::variant& saltConcentration) const; + private: void computePressureDelta(); diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 80172708a..d64225c41 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -549,9 +549,17 @@ namespace Opm } if constexpr (has_brine) { + std::variant saltConcentration; + if (this->isInjector()) { + saltConcentration = this->wsalt(); + } else { + saltConcentration = this->extendEval(intQuants.fluidState().saltConcentration()); + } + connectionRates[perf][Indices::contiBrineEqIdx] = - connectionRateBrine(perf_data.brine_rates[perf], - perf_rates.vap_wat, cq_s, intQuants); + this->connections_.connectionRateBrine(perf_data.brine_rates[perf], + perf_rates.vap_wat, cq_s, + saltConcentration); } if constexpr (has_micp) { @@ -2136,32 +2144,6 @@ namespace Opm } - template - typename StandardWell::Eval - StandardWell:: - connectionRateBrine(double& rate, - const double vap_wat_rate, - const std::vector& cq_s, - const IntensiveQuantities& intQuants) const - { - // TODO: the application of well efficiency factor has not been tested with an example yet - const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); - // Correction salt rate; evaporated water does not contain salt - EvalWell cq_s_sm = cq_s[waterCompIdx] - vap_wat_rate; - if (this->isInjector()) { - cq_s_sm *= this->wsalt(); - } else { - cq_s_sm *= this->extendEval(intQuants.fluidState().saltConcentration()); - } - - // Note. Efficiency factor is handled in the output layer - rate = cq_s_sm.value(); - - cq_s_sm *= this->well_efficiency_factor_; - return Base::restrictEval(cq_s_sm); - } - - template typename StandardWell::Eval StandardWell::