Opm::RegionPhasePoreVolAverage Class Reference

#include <RegionPhasePVAverage.hpp>

Classes

struct  CellValue
 Minimal characteristics of a cell from a simulation grid. More...
 
struct  Phase
 Compile-time disambiguation type for phases. More...
 
struct  Region
 Compile-time disambiguation type for regions. More...
 

Public Types

using RegionArrayAccessor = std::function< const std::vector< int > &(const std::string &)>
 Call-back function type for accessing region arrays–typically the FIP* arrays. More...
 

Public Member Functions

 RegionPhasePoreVolAverage (const Parallel::Communication &comm, std::size_t numPhases, const std::vector< std::string > &regionNames, RegionArrayAccessor getRegionArray)
 
double fieldValue (const Phase &p) const
 
double value (std::string_view rset, const Phase &p, const Region &r) const
 
void prepareAccumulation ()
 
void addCell (std::size_t activeCell, const Phase &p, const CellValue &cv)
 
void accumulateParallel ()
 

Detailed Description

Facility for calculating volume-weighted average function values over user-defined regions in parallel. Defaults to phase-filled pore-volume averages, but falls back to simple pore-volume averages if the saturation is identically zero in a region–i.e., calculates what the average value would be if the phase fully occupied the available pore-volume in this case.

Member Typedef Documentation

◆ RegionArrayAccessor

using Opm::RegionPhasePoreVolAverage::RegionArrayAccessor = std::function<const std::vector<int>&(const std::string&)>

Call-back function type for accessing region arrays–typically the FIP* arrays.

Constructor & Destructor Documentation

◆ RegionPhasePoreVolAverage()

Opm::RegionPhasePoreVolAverage::RegionPhasePoreVolAverage ( const Parallel::Communication comm,
std::size_t  numPhases,
const std::vector< std::string > &  regionNames,
RegionArrayAccessor  getRegionArray 
)
explicit

Constructor.

Parameters
[in]commGrid level global communicator.
[in]numPhasesNumber of phases for which to calculate average values.
[in]regionNamesList of region sets. Typically contains one or more of the FIP* array names and, possibly, the PVTNUM region set as well.
[in]getRegionArrayCall-back function for accessing region definition from region set names.

Member Function Documentation

◆ accumulateParallel()

void Opm::RegionPhasePoreVolAverage::accumulateParallel ( )

Accumulate region-level average values across MPI ranks.

Typically the last step in calculating the region-level average values. It is typically an error to call this function multiple times without an intervening call to prepareAccumulation().

◆ addCell()

void Opm::RegionPhasePoreVolAverage::addCell ( std::size_t  activeCell,
const Phase p,
const CellValue cv 
)

Incorporate contributions from a single cell.

Parameters
[in]activeCellPer-rank active cell ID–typically one of the rank's interior cells.
[in]pPhase for which to incorporate the per-cell contribution.
[in]cvSingle cell function value contribution.

◆ fieldValue()

double Opm::RegionPhasePoreVolAverage::fieldValue ( const Phase p) const

Retrieve field-level average function value for specific phase.

Parameters
[in]pPhase for which to retrieve the field-level average function value.
Returns
Field-level average function value for phase p.

◆ prepareAccumulation()

void Opm::RegionPhasePoreVolAverage::prepareAccumulation ( )

Clear internal arrays in preparation of accumulating region-level averages from per-cell contributions.

◆ value()

double Opm::RegionPhasePoreVolAverage::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 set.

Parameters
[in]rsetNamed region set–e.g., "FIPNUM".
[in]pPhase for which to retrieve the region-level average function value.
[in]rRegion ID for which to retrieve the region-level average function value.
Returns
Region-level average function value.

The documentation for this class was generated from the following file: