From 3b80b913da8f70ac0ef3ba7b10005d134972a8e7 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 12:26:46 +0100 Subject: [PATCH] MultisegmentWellPrimaryVariables: make data members private and add generic read-only accessor to evaluations --- opm/simulators/wells/MultisegmentWellEval.cpp | 2 +- .../wells/MultisegmentWellPrimaryVariables.hpp | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWellEval.cpp b/opm/simulators/wells/MultisegmentWellEval.cpp index e77debc0e..9930f3caa 100644 --- a/opm/simulators/wells/MultisegmentWellEval.cpp +++ b/opm/simulators/wells/MultisegmentWellEval.cpp @@ -842,7 +842,7 @@ assembleICDPressureEq(const int seg, (segment.segmentType() == Segment::SegmentType::VALVE) && (segment.valve().status() == Opm::ICDStatus::SHUT) ) { // we use a zero rate equation to handle SHUT valve MultisegmentWellAssemble(baseif_). - assembleTrivialEq(seg, this->primary_variables_.evaluation_[seg][WQTotal].value(), linSys_); + assembleTrivialEq(seg, this->primary_variables_.eval(seg)[WQTotal].value(), linSys_); auto& ws = well_state.well(baseif_.indexOfWell()); ws.segments.pressure_drop_friction[seg] = 0.; diff --git a/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp b/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp index 8965d11e9..9e8417fc6 100644 --- a/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp +++ b/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp @@ -137,12 +137,9 @@ public: void updateUpwindingSegments(const MultisegmentWellGeneric& mswell, std::vector& upwinding_segments) const; - // the values for the primary varibles - // based on different solutioin strategies, the wells can have different primary variables - std::vector > value_; - - // the Evaluation for the well primary variables, which contain derivativles and are used in AD calculation - std::vector > evaluation_; + //! \brief Returns a const ref to an evaluation. + const std::array& eval(const int idx) const + { return evaluation_[idx]; } private: //! \brief Handle non-reasonable fractions due to numerical overshoot. @@ -152,6 +149,14 @@ private: EvalWell volumeFraction(const int seg, const unsigned compIdx) const; + //! \brief The values for the primary variables + //! \details Based on different solution strategies, the wells can have different primary variables + std::vector> value_; + + //! \brief The Evaluation for the well primary variables. + //! \details Contains derivatives and are used in AD calculation + std::vector> evaluation_; + const WellInterfaceIndices& well_; //!< Reference to well interface };