mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-02 05:49:09 -06:00
MultisegmentWellSegments: make members private
and add various read-only accessors
This commit is contained in:
parent
12b15b5038
commit
c1e05fae18
@ -69,8 +69,8 @@ MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||
initMatrixAndVectors(const int num_cells)
|
||||
{
|
||||
linSys_.init(num_cells, baseif_.numPerfs(),
|
||||
baseif_.cells(), segments_.inlets_,
|
||||
segments_.perforations_);
|
||||
baseif_.cells(), segments_.inlets(),
|
||||
segments_.perforations());
|
||||
primary_variables_.resize(this->numberOfSegments());
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ handleAccelerationPressureLoss(const int seg,
|
||||
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assemblePressureLoss(seg,
|
||||
segments_.upwinding_segments_[seg],
|
||||
segments_.upwinding_segment(seg),
|
||||
accelerationPressureLoss, linSys_);
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ assembleDefaultPressureEq(const int seg,
|
||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
||||
const EvalWell outlet_pressure = primary_variables_.getSegmentPressure(outlet_segment_index);
|
||||
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
const int seg_upwind = segments_.upwinding_segment(seg);
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assemblePressureEq(seg, seg_upwind, outlet_segment_index,
|
||||
pressure_equation, outlet_pressure, linSys_);
|
||||
@ -290,7 +290,7 @@ assembleICDPressureEq(const int seg,
|
||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
||||
const EvalWell outlet_pressure = primary_variables_.getSegmentPressure(outlet_segment_index);
|
||||
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
const int seg_upwind = segments_.upwinding_segment(seg);
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assemblePressureEq(seg, seg_upwind, outlet_segment_index,
|
||||
pressure_equation, outlet_pressure,
|
||||
|
@ -321,6 +321,14 @@ getHydroPressureLoss(const int seg) const
|
||||
return densities_[seg] * well_.gravity() * depth_diffs_[seg];
|
||||
}
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
Scalar MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
|
||||
getPressureDiffSegPerf(const int seg,
|
||||
const int perf) const
|
||||
{
|
||||
return well_.gravity() * densities_[seg].value() * perforation_depth_diffs_[perf];
|
||||
}
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
|
||||
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
|
||||
|
@ -53,6 +53,10 @@ public:
|
||||
|
||||
EvalWell getHydroPressureLoss(const int seg) const;
|
||||
|
||||
//! Pressure difference between segment and perforation.
|
||||
Scalar getPressureDiffSegPerf(const int seg,
|
||||
const int perf) const;
|
||||
|
||||
EvalWell getSurfaceVolume(const EvalWell& temperature,
|
||||
const EvalWell& saltConcentration,
|
||||
const PrimaryVariables& primary_variables,
|
||||
@ -74,6 +78,37 @@ public:
|
||||
// pressure loss due to acceleration
|
||||
EvalWell accelerationPressureLoss(const int seg) const;
|
||||
|
||||
const std::vector<std::vector<int>>& inlets() const
|
||||
{
|
||||
return inlets_;
|
||||
}
|
||||
|
||||
const std::vector<std::vector<int>>& perforations() const
|
||||
{
|
||||
return perforations_;
|
||||
}
|
||||
|
||||
int upwinding_segment(const int seg) const
|
||||
{
|
||||
return upwinding_segments_[seg];
|
||||
}
|
||||
|
||||
double getRefDensity() const
|
||||
{
|
||||
return densities_[0].value();
|
||||
}
|
||||
|
||||
const EvalWell& density(const int seg) const
|
||||
{
|
||||
return densities_[seg];
|
||||
}
|
||||
|
||||
double perforation_depth_diff(const int perf) const
|
||||
{
|
||||
return perforation_depth_diffs_[perf];
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: trying to use the information from the Well opm-parser as much
|
||||
// as possible, it will possibly be re-implemented later for efficiency reason.
|
||||
|
||||
@ -112,7 +147,6 @@ public:
|
||||
std::vector<std::vector<EvalWell>> phase_fractions_;
|
||||
std::vector<std::vector<EvalWell>> phase_viscosities_;
|
||||
|
||||
private:
|
||||
const WellInterfaceGeneric& well_;
|
||||
};
|
||||
|
||||
|
@ -161,8 +161,8 @@ namespace Opm
|
||||
Base::updateWellStateWithTarget(ebos_simulator, group_state, well_state, deferred_logger);
|
||||
// scale segment rates based on the wellRates
|
||||
// and segment pressure based on bhp
|
||||
this->scaleSegmentRatesWithWellRates(this->segments_.inlets_,
|
||||
this->segments_.perforations_,
|
||||
this->scaleSegmentRatesWithWellRates(this->segments_.inlets(),
|
||||
this->segments_.perforations(),
|
||||
well_state);
|
||||
this->scaleSegmentPressuresWithBhp(well_state);
|
||||
}
|
||||
@ -370,7 +370,7 @@ namespace Opm
|
||||
segments_copy.scale_pressure(bhp);
|
||||
const auto& segment_pressure = segments_copy.pressure;
|
||||
for (int seg = 0; seg < nseg; ++seg) {
|
||||
for (const int perf : this->segments_.perforations_[seg]) {
|
||||
for (const int perf : this->segments_.perforations()[seg]) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
// flux for each perforation
|
||||
@ -443,8 +443,8 @@ namespace Opm
|
||||
ws.surface_rates[phase] = sign * ws.well_potentials[phase];
|
||||
}
|
||||
}
|
||||
well_copy.scaleSegmentRatesWithWellRates(this->segments_.inlets_,
|
||||
this->segments_.perforations_,
|
||||
well_copy.scaleSegmentRatesWithWellRates(this->segments_.inlets(),
|
||||
this->segments_.perforations(),
|
||||
well_state_copy);
|
||||
|
||||
well_copy.calculateExplicitQuantities(ebosSimulator, well_state_copy, deferred_logger);
|
||||
@ -774,7 +774,8 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// pressure difference between the segment and the perforation
|
||||
const Value perf_seg_press_diff = this->gravity() * segment_density * this->segments_.perforation_depth_diffs_[perf];
|
||||
const Value perf_seg_press_diff = this->gravity() * segment_density *
|
||||
this->segments_.perforation_depth_diff(perf);
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
|
||||
|
||||
@ -935,7 +936,7 @@ namespace Opm
|
||||
Tw,
|
||||
perf,
|
||||
segment_pressure,
|
||||
this->segments_.densities_[seg],
|
||||
this->segments_.density(seg),
|
||||
allow_cf,
|
||||
cmix_s,
|
||||
cq_s,
|
||||
@ -996,7 +997,7 @@ namespace Opm
|
||||
Tw,
|
||||
perf,
|
||||
segment_pressure,
|
||||
getValue(this->segments_.densities_[seg]),
|
||||
getValue(this->segments_.density(seg)),
|
||||
allow_cf,
|
||||
cmix_s,
|
||||
cq_s,
|
||||
@ -1158,7 +1159,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
getRefDensity() const
|
||||
{
|
||||
return this->segments_.densities_[0].value();
|
||||
return this->segments_.getRefDensity();
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
@ -1243,14 +1244,15 @@ namespace Opm
|
||||
const double segment_depth = this->segmentSet()[seg].depth();
|
||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
||||
const double segment_depth_outlet = seg == 0? ref_depth : this->segmentSet()[outlet_segment_index].depth();
|
||||
double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth, this->segments_.densities_[seg].value(), this->gravity_);
|
||||
double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth,
|
||||
this->segments_.density(seg).value(), this->gravity_);
|
||||
// we add the hydrostatic correction from the outlet segment
|
||||
// in order to get the correction all the way to the bhp ref depth.
|
||||
if (seg > 0) {
|
||||
dp += seg_dp[outlet_segment_index];
|
||||
}
|
||||
seg_dp[seg] = dp;
|
||||
for (const int perf : this->segments_.perforations_[seg]) {
|
||||
for (const int perf : this->segments_.perforations()[seg]) {
|
||||
std::vector<Scalar> mob(this->num_components_, 0.0);
|
||||
|
||||
// TODO: maybe we should store the mobility somewhere, so that we only need to calculate it one per iteration
|
||||
@ -1260,7 +1262,7 @@ namespace Opm
|
||||
const auto& int_quantities = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& fs = int_quantities.fluidState();
|
||||
// pressure difference between the segment and the perforation
|
||||
const double perf_seg_press_diff = this->gravity_ * this->segments_.densities_[seg].value() * this->segments_.perforation_depth_diffs_[perf];
|
||||
const double perf_seg_press_diff = this->segments_.getPressureDiffSegPerf(seg, perf);
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
|
||||
const double pressure_cell = this->getPerfCellPressure(fs).value();
|
||||
@ -1576,7 +1578,7 @@ namespace Opm
|
||||
}
|
||||
// considering the contributions due to flowing out from the segment
|
||||
{
|
||||
const int seg_upwind = this->segments_.upwinding_segments_[seg];
|
||||
const int seg_upwind = this->segments_.upwinding_segment(seg);
|
||||
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
|
||||
const EvalWell segment_rate =
|
||||
this->primary_variables_.getSegmentRateUpwinding(seg,
|
||||
@ -1590,8 +1592,8 @@ namespace Opm
|
||||
|
||||
// considering the contributions from the inlet segments
|
||||
{
|
||||
for (const int inlet : this->segments_.inlets_[seg]) {
|
||||
const int inlet_upwind = this->segments_.upwinding_segments_[inlet];
|
||||
for (const int inlet : this->segments_.inlets()[seg]) {
|
||||
const int inlet_upwind = this->segments_.upwinding_segment(inlet);
|
||||
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
|
||||
const EvalWell inlet_rate =
|
||||
this->primary_variables_.getSegmentRateUpwinding(inlet,
|
||||
@ -1609,7 +1611,7 @@ namespace Opm
|
||||
auto& perf_data = ws.perf_data;
|
||||
auto& perf_rates = perf_data.phase_rates;
|
||||
auto& perf_press_state = perf_data.pressure;
|
||||
for (const int perf : this->segments_.perforations_[seg]) {
|
||||
for (const int perf : this->segments_.perforations()[seg]) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
std::vector<EvalWell> mob(this->num_components_, 0.0);
|
||||
@ -1691,14 +1693,14 @@ namespace Opm
|
||||
|
||||
for (int seg = 0; seg < nseg; ++seg) {
|
||||
const EvalWell segment_pressure = this->primary_variables_.getSegmentPressure(seg);
|
||||
for (const int perf : this->segments_.perforations_[seg]) {
|
||||
for (const int perf : this->segments_.perforations()[seg]) {
|
||||
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& intQuants = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
// pressure difference between the segment and the perforation
|
||||
const EvalWell perf_seg_press_diff = this->gravity_ * this->segments_.densities_[seg] * this->segments_.perforation_depth_diffs_[perf];
|
||||
const EvalWell perf_seg_press_diff = this->segments_.getPressureDiffSegPerf(seg, perf);
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
|
||||
|
||||
@ -1893,7 +1895,7 @@ namespace Opm
|
||||
double max_pressure = 0.0;
|
||||
const int nseg = this->numberOfSegments();
|
||||
for (int seg = 0; seg < nseg; ++seg) {
|
||||
for (const int perf : this->segments_.perforations_[seg]) {
|
||||
for (const int perf : this->segments_.perforations()[seg]) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quants = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& fs = int_quants.fluidState();
|
||||
@ -1921,7 +1923,7 @@ namespace Opm
|
||||
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->primary_variables_.getSegmentPressure(seg));
|
||||
for (const int perf : this->segments_.perforations_[seg]) {
|
||||
for (const int perf : this->segments_.perforations()[seg]) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
std::vector<Scalar> mob(this->num_components_, 0.0);
|
||||
|
Loading…
Reference in New Issue
Block a user