Loading...
Searching...
No Matches
Opm::ParallelWBPCalculation< Scalar > Class Template Reference

Parallel facility for managing the on-rank collection and global distribution of WBPn source values as well as local calculation and distributed reduction of the inferred WBPn report values. More...

`#include <ParallelWBPCalculation.hpp>`

## Public Types

using | GlobalToLocal = typename ParallelPAvgDynamicSourceData<Scalar>::GlobalToLocal
| Callback for inferring the source locations which are active on the current MPI rank.
using | Evaluator = typename ParallelPAvgDynamicSourceData<Scalar>::Evaluator
| Callback for evaluating WBPn source terms on the current MPI rank.
using | EvaluatorFactory = std::function<Evaluator()>
| Callback for constructing a source term evaluation function on the current MPI rank.

## Public Member Functions

| ParallelWBPCalculation (const GridDims &cellIndexMap, const Parallel::Communication &gridComm)
| Constructor.
ParallelWBPCalculation & | localCellIndex (GlobalToLocal localCellIdx)
| Assign translation function for inferring the on-rank IDs of the known source locations.
ParallelWBPCalculation & | evalCellSource (Evaluator evalCellSrc)
| Assign evaluation function for computing the on-rank, cell level WBPn source terms.
std::size_t | createCalculator (const Well &well, const ParallelWellInfo< Scalar > &parallelWellInfo, const std::vector< int > &localConnIdx, EvaluatorFactory makeWellSourceEvaluator)
| Create, or reassign, a WBPn calculation object for a particular well.
void | defineCommunication ()
| Set up communication patterns for both cell and connection level source terms and partial/intermediate WBPn results.
void | collectDynamicValues ()
| Collect all on-rank source term value and distribute those on-rank values to all other MPI ranks.
void | inferBlockAveragePressures (const std::size_t calcIndex, const PAvg &controls, const Scalar gravity, const Scalar refDepth)
| Compute WBPn report values for a single well.
const PAvgCalculatorResult< Scalar > & | averagePressures (const std::size_t calcIndex) const
| Retrieve results from most recent WBPn value calculation for specified well.

## Detailed Description

template<class Scalar>
class Opm::ParallelWBPCalculation< Scalar >

Parallel facility for managing the on-rank collection and global distribution of WBPn source values as well as local calculation and distributed reduction of the inferred WBPn report values.

## Member Typedef Documentation

## EvaluatorFactory

template<class Scalar>

using Opm::ParallelWBPCalculation< Scalar >::EvaluatorFactory = std::function<Evaluator()>

Callback for constructing a source term evaluation function on the current MPI rank.

Needed for deferred construction of per-well source term evaluation functions.

## Constructor & Destructor Documentation

## ParallelWBPCalculation()

template<class Scalar>

Opm::ParallelWBPCalculation< Scalar >::ParallelWBPCalculation | ( | const GridDims & | cellIndexMap,
|  | const Parallel::Communication & | gridComm )

explicit

Constructor.

Parameters

  [in] | cellIndexMap | Cell index triple map ((I,J,K) <-> global).
  [in] | gridComm | Main, grid level, global communicator.

## Member Function Documentation

## averagePressures()

template<class Scalar>

const Opm::PAvgCalculatorResult< Scalar > & Opm::ParallelWBPCalculation< Scalar >::averagePressures | ( | const std::size_t | calcIndex | ) | const

Retrieve results from most recent WBPn value calculation for specified well.

Parameters

  [in] | calcIndex | Calculator object index. Return value from a previous call to member function `createCalculator()`.

Returns
  Result set from most recent call to member function `inferBlockAveragePressures()` for `calcIndex`.

## collectDynamicValues()

template<class Scalar>

void Opm::ParallelWBPCalculation< Scalar >::collectDynamicValues | ( |  | ) |

Collect all on-rank source term value and distribute those on-rank values to all other MPI ranks.

Will call the registered source term evaluation functions for all on-rank source locations. Once this function returns, all ranks have a full view of all cell level source term values, and all ranks which share an individual well have a full view of the per-connection source term values for that well.

Will `throw` an object of type

std::logic_error

if the communication patterns have not been fully defined through a prior call to member function `defineCommunication()`.

## createCalculator()

template<class Scalar>

std::size_t Opm::ParallelWBPCalculation< Scalar >::createCalculator | ( | const Well & | well,
|  | const ParallelWellInfo< Scalar > & | parallelWellInfo,
|  | const std::vector< int > & | localConnIdx,
|  | EvaluatorFactory | makeWellSourceEvaluator )

Create, or reassign, a WBPn calculation object for a particular well.

Parameters

  [in] | well | Well for which to create a WBPn calculation object.
  [in] | parallelWellInfo | Communicator object for the ranks sharing this well.

  [in]

  localConnIdx

  Local (on-rank) connection index. Sized according to
  well.getConnections().size()
  , but with a non-negative entry only for those active connections that intersect the current rank. If
  localConnIdx[i] == j
  , then the `i-th` global connection is the `j-th` active connection on the current rank. Use a negative value to identify a connection that is either not flowing or which does not intersect the current MPI rank.

  [in] | makeWellSourceEvaluator | Factory function to support deferred creation of an evaluation function for the per-connection WBP source terms.

Returns
  Calculator object index. Must be used in subsequent calls to inferBlockAveragePressures() and averagePressures() for this `well`.

## defineCommunication()

template<class Scalar>

void Opm::ParallelWBPCalculation< Scalar >::defineCommunication | ( |  | ) |

Set up communication patterns for both cell and connection level source terms and partial/intermediate WBPn results.

Clients must call this function once all calculation objects have been created, and strictly before the first call to member function `collectDynamicValues()`.

## evalCellSource()

template<class Scalar>

Opm::ParallelWBPCalculation< Scalar > & Opm::ParallelWBPCalculation< Scalar >::evalCellSource | ( | Evaluator | evalCellSrc | ) |

Assign evaluation function for computing the on-rank, cell level WBPn source terms.

Parameters

  [in] | evalCellSrc | Source term evaluation function.

Returns
  *this

## inferBlockAveragePressures()

template<class Scalar>

void Opm::ParallelWBPCalculation< Scalar >::inferBlockAveragePressures | ( | const std::size_t | calcIndex,
|  | const PAvg & | controls,
|  | const Scalar | gravity,
|  | const Scalar | refDepth )

Compute WBPn report values for a single well.

Parameters

  [in] | calcIndex | Calculator object index. Return value from a previous call to member function `createCalculator()`.
  [in] | controls | Pressure averaging procedure controls for this well.
  [in] | gravity | Strength of gravity acceleration.
  [in] | refDepth | WBPn reference depth. Typically Well::getWPaveRefDepth() .

## localCellIndex()

template<class Scalar>

Opm::ParallelWBPCalculation< Scalar > & Opm::ParallelWBPCalculation< Scalar >::localCellIndex | ( | GlobalToLocal | localCellIdx | ) |

Assign translation function for inferring the on-rank IDs of the known source locations.

Parameters

  [in] | localCellIdx | Translation from global, Cartesian cell indices to local, on-rank, cell indices.

Returns
  *this

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

- opm/simulators/wells/ParallelWBPCalculation.hpp
- opm/simulators/wells/ParallelWBPCalculation.cpp