MultisegmentWell: move getSegmentPressure to MultisegmentWellPrimaryVariables

This commit is contained in:
Arne Morten Kvarving 2022-12-19 09:52:48 +01:00
parent f99ecd15ac
commit bb377c0a47
5 changed files with 21 additions and 19 deletions

View File

@ -214,7 +214,7 @@ computeSegmentFluidProperties(const EvalWell& temperature,
std::vector<EvalWell> visc(baseif_.numComponents(), 0.0);
std::vector<EvalWell>& phase_densities = segment_phase_densities_[seg];
const EvalWell seg_pressure = getSegmentPressure(seg);
const EvalWell seg_pressure = primary_variables_.getSegmentPressure(seg);
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
b[waterCompIdx] =
@ -360,20 +360,12 @@ computeSegmentFluidProperties(const EvalWell& temperature,
}
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
getSegmentPressure(const int seg) const
{
return primary_variables_.evaluation_[seg][SPres];
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
getBhp() const
{
return getSegmentPressure(0);
return primary_variables_.getSegmentPressure(0);
}
template<typename FluidSystem, typename Indices, typename Scalar>
@ -656,7 +648,7 @@ getSegmentSurfaceVolume(const EvalWell& temperature,
const int pvt_region_index,
const int seg_idx) const
{
const EvalWell seg_pressure = getSegmentPressure(seg_idx);
const EvalWell seg_pressure = primary_variables_.getSegmentPressure(seg_idx);
std::vector<EvalWell> mix_s(baseif_.numComponents(), 0.0);
for (int comp_idx = 0; comp_idx < baseif_.numComponents(); ++comp_idx) {
@ -846,7 +838,7 @@ assembleDefaultPressureEq(const int seg,
assert(seg != 0); // not top segment
// for top segment, the well control equation will be used.
EvalWell pressure_equation = getSegmentPressure(seg);
EvalWell pressure_equation = primary_variables_.getSegmentPressure(seg);
// we need to handle the pressure difference between the two segments
// we only consider the hydrostatic pressure loss first
@ -866,7 +858,7 @@ assembleDefaultPressureEq(const int seg,
// contribution from the outlet segment
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
const EvalWell outlet_pressure = getSegmentPressure(outlet_segment_index);
const EvalWell outlet_pressure = primary_variables_.getSegmentPressure(outlet_segment_index);
const int seg_upwind = upwinding_segments_[seg];
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
@ -1100,7 +1092,7 @@ assembleICDPressureEq(const int seg,
// p_seg - deltaP - p_outlet = 0.
// the major part is how to calculate the deltaP
EvalWell pressure_equation = getSegmentPressure(seg);
EvalWell pressure_equation = primary_variables_.getSegmentPressure(seg);
EvalWell icd_pressure_drop;
switch(this->segmentSet()[seg].segmentType()) {
@ -1124,7 +1116,7 @@ assembleICDPressureEq(const int seg,
// contribution from the outlet segment
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
const EvalWell outlet_pressure = getSegmentPressure(outlet_segment_index);
const EvalWell outlet_pressure = primary_variables_.getSegmentPressure(outlet_segment_index);
const int seg_upwind = upwinding_segments_[seg];
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).

View File

@ -143,7 +143,6 @@ protected:
EvalWell getHydroPressureLoss(const int seg) const;
EvalWell getQs(const int comp_idx) const;
EvalWell getSegmentWQTotal(const int seg) const;
EvalWell getSegmentPressure(const int seg) const;
EvalWell getSegmentRate(const int seg, const int comp_idx) const;
EvalWell getSegmentSurfaceVolume(const EvalWell& temperature,
const EvalWell& saltConcentration,

View File

@ -361,6 +361,14 @@ getSegmentRateUpwinding(const int seg,
return segment_rate;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
getSegmentPressure(const int seg) const
{
return evaluation_[seg][SPres];
}
#define INSTANCE(...) \
template class MultisegmentWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@ -109,6 +109,9 @@ public:
const int seg_upwind,
const size_t comp_idx) const;
//! \brief Get pressure for a segment.
EvalWell getSegmentPressure(const int seg) const;
// the values for the primary varibles
// based on different solutioin strategies, the wells can have different primary variables
std::vector<std::array<double, numWellEq> > value_;

View File

@ -1600,7 +1600,7 @@ namespace Opm
}
// calculating the perforation rate for each perforation that belongs to this segment
const EvalWell seg_pressure = this->getSegmentPressure(seg);
const EvalWell seg_pressure = this->primary_variables_.getSegmentPressure(seg);
auto& perf_data = ws.perf_data;
auto& perf_rates = perf_data.phase_rates;
auto& perf_press_state = perf_data.pressure;
@ -1688,7 +1688,7 @@ namespace Opm
const int nseg = this->numberOfSegments();
for (int seg = 0; seg < nseg; ++seg) {
const EvalWell segment_pressure = this->getSegmentPressure(seg);
const EvalWell segment_pressure = this->primary_variables_.getSegmentPressure(seg);
for (const int perf : this->segment_perforations_[seg]) {
const int cell_idx = this->well_cells_[perf];
@ -1917,7 +1917,7 @@ namespace Opm
const int nseg = this->numberOfSegments();
for (int seg = 0; seg < nseg; ++seg) {
// calculating the perforation rate for each perforation that belongs to this segment
const Scalar seg_pressure = getValue(this->getSegmentPressure(seg));
const Scalar seg_pressure = getValue(this->primary_variables_.getSegmentPressure(seg));
for (const int perf : this->segment_perforations_[seg]) {
const int cell_idx = this->well_cells_[perf];
const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));