diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index 5052eda59..df7bce46b 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -443,10 +443,6 @@ namespace Opm const IntensiveQuantities& intQuants, DeferredLogger& deferred_logger) const; - std::tuple - connectionRatesMICP(const std::vector& cq_s, - const IntensiveQuantities& intQuants) const; - std::tuple connectionRatePolymer(double& rate, const std::vector& cq_s, diff --git a/opm/simulators/wells/StandardWellConnections.cpp b/opm/simulators/wells/StandardWellConnections.cpp index 8e4e7e076..1dcd6946b 100644 --- a/opm/simulators/wells/StandardWellConnections.cpp +++ b/opm/simulators/wells/StandardWellConnections.cpp @@ -578,6 +578,43 @@ connectionRateFoam(const std::vector& cq_s, return well_.restrictEval(cq_s_foam); } +template +std::tuple::Eval, + typename StandardWellConnections::Eval, + typename StandardWellConnections::Eval> +StandardWellConnections:: +connectionRatesMICP(const std::vector& cq_s, + const std::variant& microbialConcentration, + const std::variant& oxygenConcentration, + const std::variant& ureaConcentration) const +{ + const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); + EvalWell cq_s_microbe = cq_s[waterCompIdx]; + if (well_.isInjector()) { + cq_s_microbe *= std::get(microbialConcentration); + } else { + cq_s_microbe *= std::get(microbialConcentration); + } + + EvalWell cq_s_oxygen = cq_s[waterCompIdx]; + if (well_.isInjector()) { + cq_s_oxygen *= std::get(oxygenConcentration); + } else { + cq_s_oxygen *= std::get(oxygenConcentration); + } + + EvalWell cq_s_urea = cq_s[waterCompIdx]; + if (well_.isInjector()) { + cq_s_urea *= std::get(ureaConcentration); + } else { + cq_s_urea *= std::get(ureaConcentration); + } + + return {well_.restrictEval(cq_s_microbe), + well_.restrictEval(cq_s_oxygen), + well_.restrictEval(cq_s_urea)}; +} + #define INSTANCE(...) \ template class StandardWellConnections, \ __VA_ARGS__,double>; diff --git a/opm/simulators/wells/StandardWellConnections.hpp b/opm/simulators/wells/StandardWellConnections.hpp index 878db2971..76a7478d2 100644 --- a/opm/simulators/wells/StandardWellConnections.hpp +++ b/opm/simulators/wells/StandardWellConnections.hpp @@ -93,6 +93,12 @@ public: const Phase transportPhase, DeferredLogger& deferred_logger) const; + std::tuple + connectionRatesMICP(const std::vector& cq_s, + const std::variant& microbialConcentration, + const std::variant& oxygenConcentration, + const std::variant& ureaConcentration) const; + private: void computePressureDelta(); diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 6aeccbe58..2eb50a99e 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -571,10 +571,25 @@ namespace Opm } if constexpr (has_micp) { + std::variant microbialConcentration; + std::variant oxygenConcentration; + std::variant ureaConcentration; + if (this->isInjector()) { + microbialConcentration = this->wmicrobes(); + oxygenConcentration = this->woxygen(); + ureaConcentration = this->wurea(); + } else { + microbialConcentration = this->extendEval(intQuants.microbialConcentration()); + oxygenConcentration = this->extendEval(intQuants.oxygenConcentration()); + ureaConcentration = this->extendEval(intQuants.ureaConcentration()); + } std::tie(connectionRates[perf][Indices::contiMicrobialEqIdx], connectionRates[perf][Indices::contiOxygenEqIdx], connectionRates[perf][Indices::contiUreaEqIdx]) = - connectionRatesMICP(cq_s, intQuants); + this->connections_.connectionRatesMICP(cq_s, + microbialConcentration, + oxygenConcentration, + ureaConcentration); } // Store the perforation pressure for later usage. @@ -2233,42 +2248,6 @@ namespace Opm } - template - std::tuple::Eval, - typename StandardWell::Eval, - typename StandardWell::Eval> - StandardWell:: - connectionRatesMICP(const std::vector& cq_s, - const IntensiveQuantities& intQuants) const - { - const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); - EvalWell cq_s_microbe = cq_s[waterCompIdx]; - if (this->isInjector()) { - cq_s_microbe *= this->wmicrobes(); - } else { - cq_s_microbe *= this->extendEval(intQuants.microbialConcentration()); - } - - EvalWell cq_s_oxygen = cq_s[waterCompIdx]; - if (this->isInjector()) { - cq_s_oxygen *= this->woxygen(); - } else { - cq_s_oxygen *= this->extendEval(intQuants.oxygenConcentration()); - } - - EvalWell cq_s_urea = cq_s[waterCompIdx]; - if (this->isInjector()) { - cq_s_urea *= this->wurea(); - } else { - cq_s_urea *= this->extendEval(intQuants.ureaConcentration()); - } - - return {Base::restrictEval(cq_s_microbe), - Base::restrictEval(cq_s_oxygen), - Base::restrictEval(cq_s_urea)}; - } - - template std::tuple::Eval, typename StandardWell::EvalWell>