MultisegmentWellPrimaryVariables: make data members private

and add generic read-only accessor to evaluations
This commit is contained in:
Arne Morten Kvarving
2022-11-09 12:26:46 +01:00
parent e1cd54b267
commit 3b80b913da
2 changed files with 12 additions and 7 deletions

View File

@@ -842,7 +842,7 @@ assembleICDPressureEq(const int seg,
(segment.segmentType() == Segment::SegmentType::VALVE) && (segment.segmentType() == Segment::SegmentType::VALVE) &&
(segment.valve().status() == Opm::ICDStatus::SHUT) ) { // we use a zero rate equation to handle SHUT valve (segment.valve().status() == Opm::ICDStatus::SHUT) ) { // we use a zero rate equation to handle SHUT valve
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_). MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(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()); auto& ws = well_state.well(baseif_.indexOfWell());
ws.segments.pressure_drop_friction[seg] = 0.; ws.segments.pressure_drop_friction[seg] = 0.;

View File

@@ -137,12 +137,9 @@ public:
void updateUpwindingSegments(const MultisegmentWellGeneric<Scalar>& mswell, void updateUpwindingSegments(const MultisegmentWellGeneric<Scalar>& mswell,
std::vector<int>& upwinding_segments) const; std::vector<int>& upwinding_segments) const;
// the values for the primary varibles //! \brief Returns a const ref to an evaluation.
// based on different solutioin strategies, the wells can have different primary variables const std::array<EvalWell,numWellEq>& eval(const int idx) const
std::vector<std::array<double, numWellEq> > value_; { return evaluation_[idx]; }
// the Evaluation for the well primary variables, which contain derivativles and are used in AD calculation
std::vector<std::array<EvalWell, numWellEq> > evaluation_;
private: private:
//! \brief Handle non-reasonable fractions due to numerical overshoot. //! \brief Handle non-reasonable fractions due to numerical overshoot.
@@ -152,6 +149,14 @@ private:
EvalWell volumeFraction(const int seg, EvalWell volumeFraction(const int seg,
const unsigned compIdx) const; 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<std::array<double, numWellEq>> value_;
//! \brief The Evaluation for the well primary variables.
//! \details Contains derivatives and are used in AD calculation
std::vector<std::array<EvalWell, numWellEq>> evaluation_;
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface
}; };