mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-25 15:10:09 -05:00
Make perforation_depth_diffs_ of MultisegmentWellSegments a local vector and rename to local_perforation_depth_diffs_
Also fix one access to this vector
This commit is contained in:
1 parent
f58539e70e
commit
d424f137b1
5 files changed
+23
-19
No files matched your search
@@ -226,7 +226,7 @@ namespace Opm {
|
||||
// get the mobility for specific perforation
|
||||
template<class Value>
|
||||
void getMobility(const Simulator& simulator,
|
||||
const int perf,
|
||||
const int local_perf_index,
|
||||
std::vector<Value>& mob,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif, const Pa
|
||||
, baseif_(baseif)
|
||||
, linSys_(*this, pw_info)
|
||||
, primary_variables_(baseif)
|
||||
, segments_(this->numberOfSegments(), pw_info.communication().sum(baseif.numPerfs()), baseif)
|
||||
, segments_(this->numberOfSegments(), pw_info, baseif)
|
||||
, cell_perforation_depth_diffs_(baseif_.numPerfs(), 0.0)
|
||||
, cell_perforation_pressure_diffs_(baseif_.numPerfs(), 0.0)
|
||||
{
|
||||
|
||||
@@ -60,10 +60,10 @@ namespace Opm
|
||||
template<class FluidSystem, class Indices>
|
||||
MultisegmentWellSegments<FluidSystem,Indices>::
|
||||
MultisegmentWellSegments(const int numSegments,
|
||||
const int num_perfs_whole_mswell,
|
||||
const ParallelWellInfo<Scalar>& parallel_well_info,
|
||||
WellInterfaceGeneric<Scalar>& well)
|
||||
: perforations_(numSegments)
|
||||
, perforation_depth_diffs_(num_perfs_whole_mswell, 0.0)
|
||||
, local_perforation_depth_diffs_(well.numPerfs(), 0.0)
|
||||
, inlets_(well.wellEcl().getSegments().size())
|
||||
, depth_diffs_(numSegments, 0.0)
|
||||
, densities_(numSegments, 0.0)
|
||||
@@ -87,6 +87,7 @@ MultisegmentWellSegments(const int numSegments,
|
||||
// side
|
||||
int i_perf_wells = 0;
|
||||
// The perfDepth vector will contain the depths of all perforations across all processes of this well!
|
||||
int num_perfs_whole_mswell = parallel_well_info.communication().sum(well.numPerfs());
|
||||
well.perfDepth().resize(num_perfs_whole_mswell, 0.0);
|
||||
const auto& segment_set = well_.wellEcl().getSegments();
|
||||
for (std::size_t perf = 0; perf < completion_set.size(); ++perf) {
|
||||
@@ -103,7 +104,9 @@ MultisegmentWellSegments(const int numSegments,
|
||||
perforations_[segment_index].push_back(i_perf_wells);
|
||||
well.perfDepth()[i_perf_wells] = connection.depth();
|
||||
const Scalar segment_depth = segment_set[segment_index].depth();
|
||||
perforation_depth_diffs_[i_perf_wells] = well_.perfDepth()[i_perf_wells] - segment_depth;
|
||||
int local_perf_index = parallel_well_info.globalToLocal(i_perf_wells);
|
||||
if (local_perf_index > -1) // If local_perf_index == -1, then the perforation is not on this process
|
||||
local_perforation_depth_diffs_[local_perf_index] = well_.perfDepth()[i_perf_wells] - segment_depth;
|
||||
i_perf_wells++;
|
||||
}
|
||||
}
|
||||
@@ -344,10 +347,10 @@ getHydroPressureLoss(const int seg,
|
||||
template<class FluidSystem, class Indices>
|
||||
typename MultisegmentWellSegments<FluidSystem,Indices>::Scalar
|
||||
MultisegmentWellSegments<FluidSystem,Indices>::
|
||||
getPressureDiffSegPerf(const int seg,
|
||||
const int perf) const
|
||||
getPressureDiffSegLocalPerf(const int seg,
|
||||
const int local_perf_index) const
|
||||
{
|
||||
return well_.gravity() * densities_[seg].value() * perforation_depth_diffs_[perf];
|
||||
return well_.gravity() * densities_[seg].value() * local_perforation_depth_diffs_[local_perf_index];
|
||||
}
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
|
||||
|
||||
#include <opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp>
|
||||
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
@@ -49,7 +50,7 @@ class MultisegmentWellSegments
|
||||
|
||||
public:
|
||||
MultisegmentWellSegments(const int numSegments,
|
||||
const int num_perfs_whole_mswell,
|
||||
const ParallelWellInfo<Scalar>& parallel_well_info,
|
||||
WellInterfaceGeneric<Scalar>& well);
|
||||
|
||||
void computeFluidProperties(const EvalWell& temperature,
|
||||
@@ -65,8 +66,8 @@ public:
|
||||
const int seg_side) const;
|
||||
|
||||
//! Pressure difference between segment and perforation.
|
||||
Scalar getPressureDiffSegPerf(const int seg,
|
||||
const int perf) const;
|
||||
Scalar getPressureDiffSegLocalPerf(const int seg,
|
||||
const int local_perf_index) const;
|
||||
|
||||
EvalWell getSurfaceVolume(const EvalWell& temperature,
|
||||
const EvalWell& saltConcentration,
|
||||
@@ -126,9 +127,9 @@ public:
|
||||
return densities_[seg];
|
||||
}
|
||||
|
||||
Scalar perforation_depth_diff(const int perf) const
|
||||
Scalar local_perforation_depth_diff(const int local_perf_index) const
|
||||
{
|
||||
return perforation_depth_diffs_[perf];
|
||||
return local_perforation_depth_diffs_[local_perf_index];
|
||||
}
|
||||
|
||||
void copyPhaseDensities(const PhaseUsage& pu,
|
||||
@@ -152,7 +153,7 @@ private:
|
||||
// This vector contains the depth differences for *all* perforations across all processes
|
||||
// that this well lies on, its size is well.wellEcl().getConnections().size(),
|
||||
// also it works with *global* perforation indices!
|
||||
std::vector<Scalar> perforation_depth_diffs_;
|
||||
std::vector<Scalar> local_perforation_depth_diffs_;
|
||||
|
||||
// the inlet segments for each segment. It is for convenience and efficiency reason
|
||||
std::vector<std::vector<int>> inlets_;
|
||||
|
||||
@@ -903,12 +903,12 @@ namespace Opm
|
||||
|
||||
// pressure difference between the segment and the perforation
|
||||
const Value perf_seg_press_diff = this->gravity() * segment_density *
|
||||
this->segments_.perforation_depth_diff(perf);
|
||||
this->segments_.local_perforation_depth_diff(local_perf_index);
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const Scalar cell_perf_press_diff = this->cell_perforation_pressure_diffs_[local_perf_index];
|
||||
|
||||
// perforation pressure is the wellbore pressure corrected to perforation depth
|
||||
// (positive sign due to convention in segments_.perforation_depth_diff() )
|
||||
// (positive sign due to convention in segments_.local_perforation_depth_diff() )
|
||||
perf_press = segment_pressure + perf_seg_press_diff;
|
||||
|
||||
// cell pressure corrected to perforation depth
|
||||
@@ -1162,7 +1162,7 @@ namespace Opm
|
||||
// we can change this depending on what we want
|
||||
const Scalar segment_pres = this->primary_variables_.getSegmentPressure(seg).value();
|
||||
const Scalar perf_seg_press_diff = this->gravity() * this->segments_.density(seg).value()
|
||||
* this->segments_.perforation_depth_diff(local_perf_index);
|
||||
* this->segments_.local_perforation_depth_diff(local_perf_index);
|
||||
const Scalar perf_press = segment_pres + perf_seg_press_diff;
|
||||
const Scalar multiplier = this->getInjMult(local_perf_index, segment_pres, perf_press, deferred_logger);
|
||||
for (std::size_t i = 0; i < mob.size(); ++i) {
|
||||
@@ -1279,7 +1279,7 @@ namespace Opm
|
||||
const auto& int_quantities = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
const auto& fs = int_quantities.fluidState();
|
||||
// pressure difference between the segment and the perforation
|
||||
const Scalar perf_seg_press_diff = this->segments_.getPressureDiffSegPerf(seg, perf);
|
||||
const Scalar perf_seg_press_diff = this->segments_.getPressureDiffSegLocalPerf(seg, local_perf_index);
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const Scalar cell_perf_press_diff = this->cell_perforation_pressure_diffs_[local_perf_index];
|
||||
const Scalar pressure_cell = this->getPerfCellPressure(fs).value();
|
||||
@@ -2011,7 +2011,7 @@ namespace Opm
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
// pressure difference between the segment and the perforation
|
||||
const EvalWell perf_seg_press_diff = this->segments_.getPressureDiffSegPerf(seg, perf);
|
||||
const EvalWell perf_seg_press_diff = this->segments_.getPressureDiffSegLocalPerf(seg, local_perf_index);
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const Scalar cell_perf_press_diff = this->cell_perforation_pressure_diffs_[local_perf_index];
|
||||
|
||||
|
||||
Reference in new issue
Block a user