From 5eac7cae4ebb835f2d8a6d136f50947198409e01 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 18 Nov 2022 12:59:16 +0100 Subject: [PATCH] added: StandardWellEquations::residual() this returns a const reference to the residual vector. use this in StandardWellEval::getWellConvergence --- opm/simulators/wells/StandardWellEquations.hpp | 6 ++++++ opm/simulators/wells/StandardWellEval.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/StandardWellEquations.hpp b/opm/simulators/wells/StandardWellEquations.hpp index e9d0bca6a..5453e4586 100644 --- a/opm/simulators/wells/StandardWellEquations.hpp +++ b/opm/simulators/wells/StandardWellEquations.hpp @@ -117,6 +117,12 @@ public: //! \brief Sum with off-process contribution. void sumDistributed(Parallel::Communication comm); + //! \brief Returns a const reference to the residual. + const BVectorWell& residual() const + { + return resWell_; + } + // two off-diagonal matrices OffDiagMatWell duneB_; OffDiagMatWell duneC_; diff --git a/opm/simulators/wells/StandardWellEval.cpp b/opm/simulators/wells/StandardWellEval.cpp index 6fc380fef..529c2e40d 100644 --- a/opm/simulators/wells/StandardWellEval.cpp +++ b/opm/simulators/wells/StandardWellEval.cpp @@ -679,7 +679,7 @@ getWellConvergence(const WellState& well_state, res.resize(numWellEq_); for (int eq_idx = 0; eq_idx < numWellEq_; ++eq_idx) { // magnitude of the residual matters - res[eq_idx] = std::abs(this->linSys_.resWell_[0][eq_idx]); + res[eq_idx] = std::abs(this->linSys_.residual()[0][eq_idx]); } std::vector well_flux_residual(baseif_.numComponents()); @@ -716,7 +716,7 @@ getWellConvergence(const WellState& well_state, WellConvergence(baseif_). checkConvergenceControlEq(well_state, {1.e3, 1.e4, 1.e-4, 1.e-6, maxResidualAllowed}, - std::abs(this->linSys_.resWell_[0][Bhp]), + std::abs(this->linSys_.residual()[0][Bhp]), report, deferred_logger);