22 #ifndef OPM_REGION_PHASE_POREVOL_AVERAGE_MODULE_HPP 23 #define OPM_REGION_PHASE_POREVOL_AVERAGE_MODULE_HPP 25 #include <opm/simulators/utils/ParallelCommunication.hpp> 30 #include <string_view> 88 std::size_t numPhases,
89 const std::vector<std::string>& regionNames,
137 using Ix = std::vector<double>::size_type;
158 std::reference_wrapper<const Parallel::Communication> comm_;
164 std::vector<std::string> rsetNames_{};
173 std::vector<Ix> rsStart_{};
190 std::vector<double> x_{};
204 double averageValueWithFallback(Ix start)
const;
216 double averageValue(Ix start, AvgType type)
const;
224 Ix fieldStartIx(
unsigned int phase)
const;
236 Ix rsetStartIx(std::size_t rset,
int region,
unsigned int phase)
const;
246 Ix startIx(std::size_t offset,
unsigned int phase)
const;
257 int regionIndex(std::size_t rset, std::size_t activeCell)
const;
267 void add(Ix start,
const CellValue& cv);
281 void add(Ix start, AvgType type,
double x,
double w);
294 double&
value(Ix start, AvgType type);
307 double& weight(Ix start, AvgType type);
319 double value(Ix start, AvgType type)
const;
331 double weight(Ix start, AvgType type)
const;
349 Ix valueArrayIndex(Ix start, AvgType type, Element element)
const;
353 #endif // OPM_REGION_PHASE_POREVOL_AVERAGE_MODULE_HPP double value
Function value.
Definition: RegionPhasePVAverage.hpp:48
unsigned int ix
Phase index.
Definition: RegionPhasePVAverage.hpp:61
double fieldValue(const Phase &p) const
Retrieve field-level average function value for specific phase.
Definition: RegionPhasePVAverage.cpp:90
RegionPhasePoreVolAverage(const Parallel::Communication &comm, std::size_t numPhases, const std::vector< std::string > ®ionNames, RegionArrayAccessor getRegionArray)
Constructor.
Definition: RegionPhasePVAverage.cpp:78
void prepareAccumulation()
Clear internal arrays in preparation of accumulating region-level averages from per-cell contribution...
Definition: RegionPhasePVAverage.cpp:111
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
double porv
Reservoir condition pore-volume.
Definition: RegionPhasePVAverage.hpp:54
double sat
Phase saturation.
Definition: RegionPhasePVAverage.hpp:51
void addCell(std::size_t activeCell, const Phase &p, const CellValue &cv)
Incorporate contributions from a single cell.
Definition: RegionPhasePVAverage.cpp:117
Facility for calculating volume-weighted average function values over user-defined regions in paralle...
Definition: RegionPhasePVAverage.hpp:41
double value(std::string_view rset, const Phase &p, const Region &r) const
Retrieve region-level average function value for specific phase in specific region of named region se...
Definition: RegionPhasePVAverage.cpp:97
Compile-time disambiguation type for phases.
Definition: RegionPhasePVAverage.hpp:58
std::function< const std::vector< int > &(const std::string &)> RegionArrayAccessor
Call-back function type for accessing region arrays–typically the FIP* arrays.
Definition: RegionPhasePVAverage.hpp:72
Minimal characteristics of a cell from a simulation grid.
Definition: RegionPhasePVAverage.hpp:45
Compile-time disambiguation type for regions.
Definition: RegionPhasePVAverage.hpp:65
void accumulateParallel()
Accumulate region-level average values across MPI ranks.
Definition: RegionPhasePVAverage.cpp:128
unsigned int ix
Region index.
Definition: RegionPhasePVAverage.hpp:68