From 40640e9da6a8f818993233326e915bda01e960d2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 11 Nov 2022 21:41:24 +0100 Subject: [PATCH] added: StandardWellEquations::recoverSolutionWell() this recovers the well solution from a solution vector. use the new method in the well implementation. --- opm/simulators/wells/StandardWell.hpp | 3 --- opm/simulators/wells/StandardWellEquations.cpp | 12 ++++++++++++ opm/simulators/wells/StandardWellEquations.hpp | 4 ++++ opm/simulators/wells/StandardWell_impl.hpp | 17 +---------------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index d79ab70f7..2536d97a7 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -253,9 +253,6 @@ namespace Opm protected: bool regularize_; - // xw = inv(D)*(rw - C*x) - void recoverSolutionWell(const BVector& x, BVectorWell& xw) const; - // updating the well_state based on well solution dwells void updateWellState(const BVectorWell& dwells, WellState& well_state, diff --git a/opm/simulators/wells/StandardWellEquations.cpp b/opm/simulators/wells/StandardWellEquations.cpp index bf9686f24..197686fd3 100644 --- a/opm/simulators/wells/StandardWellEquations.cpp +++ b/opm/simulators/wells/StandardWellEquations.cpp @@ -166,6 +166,18 @@ void StandardWellEquations::solve(BVectorWell& dx_well) const invDuneD_.mv(resWell_, dx_well); } + +template +void StandardWellEquations:: +recoverSolutionWell(const BVector& x, BVectorWell& xw) const +{ + BVectorWell resWell = resWell_; + // resWell = resWell - B * x + parallelB_.mmv(x, resWell); + // xw = D^-1 * resWell + invDuneD_.mv(resWell, xw); +} + #define INSTANCE(N) \ template class StandardWellEquations; diff --git a/opm/simulators/wells/StandardWellEquations.hpp b/opm/simulators/wells/StandardWellEquations.hpp index e2102e165..e182362dd 100644 --- a/opm/simulators/wells/StandardWellEquations.hpp +++ b/opm/simulators/wells/StandardWellEquations.hpp @@ -85,6 +85,10 @@ public: //! \brief Invert D matrix. void invert(); + //! \brief Recover well solution. + //! \details xw = inv(D)*(rw - C*x) + void recoverSolutionWell(const BVector& x, BVectorWell& xw) const; + // two off-diagonal matrices OffDiagMatWell duneB_; OffDiagMatWell duneC_; diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index b8f35f9c9..d91ca496b 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -1732,21 +1732,6 @@ namespace Opm this->linSys_.apply(r); } - template - void - StandardWell:: - recoverSolutionWell(const BVector& x, BVectorWell& xw) const - { - if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; - - BVectorWell resWell = this->linSys_.resWell_; - // resWell = resWell - B * x - this->linSys_.parallelB_.mmv(x, resWell); - // xw = D^-1 * resWell - this->linSys_.invDuneD_.mv(resWell, xw); - } - - @@ -1762,7 +1747,7 @@ namespace Opm BVectorWell xw(1); xw[0].resize(this->numWellEq_); - recoverSolutionWell(x, xw); + this->linSys_.recoverSolutionWell(x, xw); updateWellState(xw, well_state, deferred_logger); }