Loading...
Searching...
No Matches
Opm::RegionPhasePoreVolAverage Class Reference

Facility for calculating volume-weighted average function values over user-defined regions in parallel. More...

`#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.

## Public Member Functions

| RegionPhasePoreVolAverage (const Parallel::Communication &comm, std::size_t numPhases, const std::vector< std::string > &regionNames, RegionArrayAccessor getRegionArray)
| Constructor.
double | fieldValue (const Phase &p) const
| Retrieve field-level average function value for specific phase.
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 set.
void | prepareAccumulation ()
| Clear internal arrays in preparation of accumulating region-level averages from per-cell contributions.
void | addCell (std::size_t activeCell, const Phase &p, const CellValue &cv)
| Incorporate contributions from a single cell.
void | accumulateParallel ()
| Accumulate region-level average values across MPI ranks.

## 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.

## 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] | comm | Grid level global communicator.
  [in] | numPhases | Number of phases for which to calculate average values.
  [in] | regionNames | List of region sets. Typically contains one or more of the FIP* array names and, possibly, the PVTNUM region set as well.
  [in] | getRegionArray | Call-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] | activeCell | Per-rank active cell ID–typically one of the rank's interior cells.
  [in] | p | Phase for which to incorporate the per-cell contribution.
  [in] | cv | Single cell function value contribution.

## fieldValue()

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

Retrieve field-level average function value for specific phase.

Parameters

  [in] | p | Phase for which to retrieve the field-level average function value.

Returns
  Field-level average function value for phase `p`.

## 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] | rset | Named region set–e.g., "FIPNUM".
  [in] | p | Phase for which to retrieve the region-level average function value.
  [in] | r | Region 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 files:

- opm/simulators/flow/RegionPhasePVAverage.hpp
- opm/simulators/flow/RegionPhasePVAverage.cpp