From 68bc90b3be9bc3b4a84aae3df49a0788ef05139c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 18 Nov 2022 12:09:43 +0100 Subject: [PATCH] added: StandardWellAssemble::assembleSourceEq extracted from StandardWell::assembleWellEqWithoutIterationImpl --- opm/simulators/wells/StandardWellAssemble.cpp | 22 ++++++++++++++++++- opm/simulators/wells/StandardWellAssemble.hpp | 8 +++++++ opm/simulators/wells/StandardWell_impl.hpp | 9 ++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/StandardWellAssemble.cpp b/opm/simulators/wells/StandardWellAssemble.cpp index 7c21446e4..b90b99c2c 100644 --- a/opm/simulators/wells/StandardWellAssemble.cpp +++ b/opm/simulators/wells/StandardWellAssemble.cpp @@ -188,6 +188,20 @@ assemblePerforationEq(const EvalWell& cq_s_effective, } } +template +template +void StandardWellAssemble:: +assembleSourceEq(const EvalWell& resWell_loc, + const int componentIdx, + const int numWellEq, + StandardWellEquations& eqns) const +{ + for (int pvIdx = 0; pvIdx < numWellEq; ++pvIdx) { + eqns.duneD_[0][0][componentIdx][pvIdx] += resWell_loc.derivative(pvIdx+Indices::numEq); + } + eqns.resWell_[0][componentIdx] += resWell_loc.value(); +} + template template void StandardWellAssemble:: @@ -238,7 +252,13 @@ StandardWellAssemble,__VA assembleZFracEq(const DenseAd::Evaluation&, \ const int, \ const int, \ - StandardWellEquations&) const; + StandardWellEquations&) const; \ +template void \ +StandardWellAssemble,__VA_ARGS__,double>:: \ + assembleSourceEq(const DenseAd::Evaluation&, \ + const int, \ + const int, \ + StandardWellEquations&) const; // One phase INSTANCE(4u, BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>) diff --git a/opm/simulators/wells/StandardWellAssemble.hpp b/opm/simulators/wells/StandardWellAssemble.hpp index 715b379f1..35a3a1254 100644 --- a/opm/simulators/wells/StandardWellAssemble.hpp +++ b/opm/simulators/wells/StandardWellAssemble.hpp @@ -86,6 +86,14 @@ public: const int numWellEq, StandardWellEquations& eqns) const; + //! \brief Assemble a source term. + template + void assembleSourceEq(const EvalWell& resWell_loc, + const int componentIdx, + const int numWellEq, + StandardWellEquations& eqns) const; + + private: const WellInterfaceFluidSystem& well_; //!< Reference to well }; diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 6c982e186..dbb6b8216 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -532,10 +532,11 @@ namespace Opm resWell_loc += (this->wellSurfaceVolumeFraction(componentIdx) - this->F0_[componentIdx]) * volume / dt; } resWell_loc -= this->getQs(componentIdx) * this->well_efficiency_factor_; - for (int pvIdx = 0; pvIdx < this->numWellEq_; ++pvIdx) { - this->linSys_.duneD_[0][0][componentIdx][pvIdx] += resWell_loc.derivative(pvIdx+Indices::numEq); - } - this->linSys_.resWell_[0][componentIdx] += resWell_loc.value(); + StandardWellAssemble(*this). + assembleSourceEq(resWell_loc, + componentIdx, + this->numWellEq_, + this->linSys_); } const auto& summaryState = ebosSimulator.vanguard().summaryState();