Opm::detail Namespace Reference

Classes

struct  alignment_of
 
struct  BdaSolverInfo
 
struct  FlexibleSolverInfo
 
struct  InterpData
 
struct  is_alignment_constant
 
struct  max_align
 
struct  max_count_of
 
struct  min_size
 
struct  NoReorderer
 
struct  offset_object
 
class  ParallelFileMerger
 A functor that merges multiple files of a parallel run to one file. More...
 
struct  RealReorderer
 
struct  Reorderer
 
struct  VFPEvaluation
 

Typedefs

template<class K >
using FMat4 = Dune::FieldMatrix< K, 4, 4 >
 
template<class M >
using FieldFunct = std::function< typename M::field_type(const typename M::field_type &)>
 

Functions

constexpr bool is_alignment (std::size_t value) noexcept
 
template<class GridView >
std::size_t countLocalInteriorCellsGridView (const GridView &gridView)
 Get the number of local interior cells in a grid view. More...
 
template<class Grid >
std::size_t countLocalInteriorCells (const Grid &grid)
 Get the number of local interior cells in a grid. More...
 
template<class Grid >
std::size_t countGlobalCells (const Grid &grid)
 Get the number of cells of a global grid. More...
 
void checkAllMPIProcesses ()
 
void mergeParallelLogFiles (std::string_view output_dir, std::string_view deck_filename, bool enableLoggingFalloutWarning)
 
void handleExtraConvergenceOutput (SimulatorReport &report, std::string_view option, std::string_view optionName, std::string_view output_dir, std::string_view base_name)
 
template<class Scalar >
void hideUnusedParameters ()
 Hides unused runtime parameters. More...
 
template<class Scalar >
void detectOscillations (const std::vector< std::vector< Scalar > > &residualHistory, const int it, const int numPhases, const Scalar relaxRelTol, const int minimumOscillatingPhases, bool &oscillate, bool &stagnate)
 Detect oscillation or stagnation in a given residual history. More...
 
template<class BVector , class Scalar >
void stabilizeNonlinearUpdate (BVector &dx, BVector &dxOld, const Scalar omega, NonlinearRelaxType relaxType)
 
template<class Scalar >
void registerNonlinearParameters ()
 
template<class Grid , class CartMapper , class W >
void setWellConnections (const Grid &grid, const CartMapper &cartMapper, const W &wells, const std::unordered_map< std::string, std::set< int > > &possibleFutureConnections, bool useWellConn, std::vector< std::set< int > > &wellGraph, int numJacobiBlocks)
 Find cell IDs for wells contained in local grid. More...
 
template<class Grid , class Mapper >
void findOverlapAndInterior (const Grid &grid, const Mapper &mapper, std::vector< int > &overlapRows, std::vector< int > &interiorRows)
 Find the rows corresponding to overlap cells. More...
 
template<class Grid >
std::size_t numMatrixRowsToUseInSolver (const Grid &grid, bool ownerFirst)
 If ownerFirst=true, returns the number of interior cells in grid, else just numCells(). More...
 
void copyParValues (std::any &parallelInformation, std::size_t size, Dune::OwnerOverlapCopyCommunication< int, int > &comm)
 Copy values in parallel. More...
 
template<class Matrix >
void makeOverlapRowsInvalid (Matrix &matrix, const std::vector< int > &overlapRows)
 
template<class Matrix , class Grid >
std::unique_ptr< Matrix > blockJacobiAdjacency (const Grid &grid, const std::vector< int > &cell_part, std::size_t nonzeroes, const std::vector< std::set< int > > &wellConnectionsGraph)
 
template<typename K , int m, int n>
static void invertMatrix (Dune::FieldMatrix< K, m, n > &matrix)
 
template<typename K >
static void invertMatrix (Dune::FieldMatrix< K, 1, 1 > &matrix)
 
template<typename K >
static void invertMatrix (Dune::FieldMatrix< K, 2, 2 > &matrix)
 
template<typename K >
static void invertMatrix (Dune::FieldMatrix< K, 3, 3 > &matrix)
 
template<template< class K > class Matrix, typename K >
static K invertMatrix4 (const Matrix< K > &matrix, Matrix< K > &inverse)
 invert 4x4 Matrix without changing the original matrix More...
 
template<typename K >
static void invertMatrix (Dune::FieldMatrix< K, 4, 4 > &matrix)
 
template<typename K >
static void invertMatrix (Dune::DynamicMatrix< K > &matrix)
 
template<typename T >
identityFunctor (const T &)
 
template<typename T >
oneFunctor (const T &)
 
template<typename T >
signFunctor (const T &)
 
template<typename T >
isPositiveFunctor (const T &)
 
template<typename T >
absFunctor (const T &)
 
template<typename M >
void milu0_decomposition (M &A, FieldFunct< M > absFunctor=signFunctor< typename M::field_type >, FieldFunct< M > signFunctor=oneFunctor< typename M::field_type >, std::vector< typename M::block_type > *diagonal=nullptr)
 
template<class M >
void milu0_decomposition (M &A, std::vector< typename M::block_type > *diagonal)
 
template<class M >
void milun_decomposition (const M &A, int n, MILU_VARIANT milu, M &ILU, Reorderer &ordering, Reorderer &inverseOrdering)
 
template<class M >
void ghost_last_bilu0_decomposition (M &A, std::size_t interiorSize)
 Compute Blocked ILU0 decomposition, when we know junk ghost rows are located at the end of A. More...
 
template<class M , class CRS , class InvVector >
void convertToCRS (const M &A, CRS &lower, CRS &upper, InvVector &inv)
 compute ILU decomposition of A. A is overwritten by its decomposition More...
 
template<class PI >
size_t set_interiorSize (size_t N, size_t interiorSize, const PI &comm)
 
template<>
size_t set_interiorSize (size_t N, size_t interiorSize, const Dune::OwnerOverlapCopyCommunication< int, int > &comm)
 
template<class TA , class TB , class TC , class PositiveSign >
static void multMatrixImpl (const TA &A, const TB &B, TC &ret, const PositiveSign)
 calculates ret = A * B More...
 
template<class TA , class TB , class TC , class PositiveSign >
static void multMatrixTransposedImpl (const TA &A, const TB &B, TC &ret, const PositiveSign)
 
template<class DenseMatrixA , class DenseMatrixB , class DenseMatrixC >
static void multMatrixTransposed (const DenseMatrixA &A, const DenseMatrixB &B, DenseMatrixC &ret)
 calculates ret = A^T * B More...
 
template<class DenseMatrixA , class DenseMatrixB , class DenseMatrixC >
static void negativeMultMatrixTransposed (const DenseMatrixA &A, const DenseMatrixB &B, DenseMatrixC &ret)
 calculates ret = -A^T * B More...
 
template<class K >
static void multMatrix (const Dune::DynamicMatrix< K > &A, const Dune::DynamicMatrix< K > &B, Dune::DynamicMatrix< K > &ret)
 calculates ret = A * B More...
 
void logTimer (const AdaptiveSimulatorTimer &substepTimer)
 
std::set< std::string > consistentlyFailingWells (const std::vector< StepReport > &sr)
 
void registerAdaptiveParameters ()
 
template<class Scalar >
Scalar pressureAverage (const Scalar pressurePvHydrocarbon, const Scalar pvHydrocarbon, const Scalar pressurePv, const Scalar pv, const bool hydrocarbon)
 Calculates average pressure value. More...
 
template<class Scalar >
std::vector< Scalar > pressureAverage (const std::vector< Scalar > &pressurePvHydrocarbon, const std::vector< Scalar > &pvHydrocarbon, const std::vector< Scalar > &pressurePv, const std::vector< Scalar > &pv, const bool hydrocarbon)
 Calculates average pressure value for a vector. More...
 
template<class Scalar >
VFPEvaluation< Scalar > operator+ (VFPEvaluation< Scalar > lhs, const VFPEvaluation< Scalar > &rhs)
 
template<class Scalar >
VFPEvaluation< Scalar > operator- (VFPEvaluation< Scalar > lhs, const VFPEvaluation< Scalar > &rhs)
 
template<class Scalar >
VFPEvaluation< Scalar > operator* (Scalar lhs, const VFPEvaluation< Scalar > &rhs)
 
template<typename T >
getFlo (const VFPProdTable &table, const T &aqua, const T &liquid, const T &vapour)
 
template<typename T >
getFlo (const VFPInjTable &table, const T &aqua, const T &liquid, const T &vapour)
 
template<typename T >
getWFR (const VFPProdTable &table, const T &aqua, const T &liquid, const T &vapour)
 
template<typename T >
getGFR (const VFPProdTable &table, const T &aqua, const T &liquid, const T &vapour)
 
template<typename T >
const T & getTable (const std::map< int, std::reference_wrapper< const T > > &tables, int table_id)
 
template<typename T >
bool hasTable (const std::map< int, std::reference_wrapper< const T > > &tables, int table_id)
 
template<typename TYPE , typename TABLE >
TYPE getType (const TABLE &table)
 

Typedef Documentation

◆ FieldFunct

template<class M >
using Opm::detail::FieldFunct = typedef std::function<typename M::field_type(const typename M::field_type&)>

◆ FMat4

template<class K >
using Opm::detail::FMat4 = typedef Dune::FieldMatrix<K,4,4>

Function Documentation

◆ absFunctor()

template<typename T >
T Opm::detail::absFunctor ( const T &  )

◆ blockJacobiAdjacency()

template<class Matrix , class Grid >
std::unique_ptr< Matrix > Opm::detail::blockJacobiAdjacency ( const Grid &  grid,
const std::vector< int > &  cell_part,
std::size_t  nonzeroes,
const std::vector< std::set< int > > &  wellConnectionsGraph 
)

Create sparsity pattern for block-Jacobi matrix based on partitioning of grid. Do not initialize the values, that is done in copyMatToBlockJac()

◆ checkAllMPIProcesses()

void Opm::detail::checkAllMPIProcesses ( )

◆ consistentlyFailingWells()

std::set< std::string > Opm::detail::consistentlyFailingWells ( const std::vector< StepReport > &  sr)

◆ convertToCRS()

template<class M , class CRS , class InvVector >
void Opm::detail::convertToCRS ( const M &  A,
CRS &  lower,
CRS &  upper,
InvVector &  inv 
)

compute ILU decomposition of A. A is overwritten by its decomposition

References convertToCRS().

Referenced by convertToCRS(), and Opm::ParallelOverlappingILU0< Matrix, Domain, Range, ParallelInfoT >::update().

◆ copyParValues()

void Opm::detail::copyParValues ( std::any &  parallelInformation,
std::size_t  size,
Dune::OwnerOverlapCopyCommunication< int, int > &  comm 
)

Copy values in parallel.

Referenced by Opm::ISTLSolver< TypeTag >::initialize().

◆ countGlobalCells()

template<class Grid >
std::size_t Opm::detail::countGlobalCells ( const Grid &  grid)

Get the number of cells of a global grid.

In a parallel run this is the number of cells that a grid would have if the whole grid was stored on one process only.

Template Parameters
GridType of DUNE grid.
Parameters
[in]gridGrid for which to count global cells.
Returns
The global number of cells.

References countLocalInteriorCellsGridView().

Referenced by Opm::BlackoilModel< TypeTag >::BlackoilModel().

◆ countLocalInteriorCells()

template<class Grid >
std::size_t Opm::detail::countLocalInteriorCells ( const Grid &  grid)

Get the number of local interior cells in a grid.

Template Parameters
GridType of DUNE grid.
Parameters
[in]gridGrid for which to count interior cells.
Returns
The number of interior cells in the partition of the grid stored on this process.

References countLocalInteriorCellsGridView().

◆ countLocalInteriorCellsGridView()

template<class GridView >
std::size_t Opm::detail::countLocalInteriorCellsGridView ( const GridView &  gridView)

Get the number of local interior cells in a grid view.

Template Parameters
GridViewType of DUNE grid view.
Parameters
[in]gridViewGrid view for which to count the number of interior cells.
Returns
The number of interior cell in the partition of the grid stored on this process.

Referenced by countGlobalCells(), countLocalInteriorCells(), and Opm::EclWriter< TypeTag >::writeInitialFIPReport().

◆ detectOscillations()

template<class Scalar >
void Opm::detail::detectOscillations ( const std::vector< std::vector< Scalar > > &  residualHistory,
const int  it,
const int  numPhases,
const Scalar  relaxRelTol,
const int  minimumOscillatingPhases,
bool &  oscillate,
bool &  stagnate 
)

◆ findOverlapAndInterior()

template<class Grid , class Mapper >
void Opm::detail::findOverlapAndInterior ( const Grid &  grid,
const Mapper &  mapper,
std::vector< int > &  overlapRows,
std::vector< int > &  interiorRows 
)

Find the rows corresponding to overlap cells.

Loop over grid and store cell ids of rows corresponding to overlap cells.

Template Parameters
Thetype of the DUNE grid.
Parameters
gridThe grid where we look for overlap cells.
overlapRowsList where overlap rows are stored.
interiorRowsList where overlap rows are stored.

Referenced by Opm::ISTLSolver< TypeTag >::initialize().

◆ getFlo() [1/2]

template<typename T >
T Opm::detail::getFlo ( const VFPInjTable &  table,
const T &  aqua,
const T &  liquid,
const T &  vapour 
)

Computes the flo parameter according to the flo_type_ for injection tables

Returns
Production rate of oil, gas or liquid.

◆ getFlo() [2/2]

template<typename T >
T Opm::detail::getFlo ( const VFPProdTable &  table,
const T &  aqua,
const T &  liquid,
const T &  vapour 
)

Computes the flo parameter according to the flo_type_ for production tables

Returns
Production rate of oil, gas or liquid.

◆ getGFR()

template<typename T >
T Opm::detail::getGFR ( const VFPProdTable &  table,
const T &  aqua,
const T &  liquid,
const T &  vapour 
)

Computes the gfr parameter according to the gfr_type_

Returns
Production rate of oil, gas or liquid.

Referenced by Opm::VFPProperties< Scalar >::getExplicitGFR().

◆ getTable()

template<typename T >
const T & Opm::detail::getTable ( const std::map< int, std::reference_wrapper< const T > > &  tables,
int  table_id 
)

Returns the table from the map if found, or throws an exception

◆ getType()

template<typename TYPE , typename TABLE >
TYPE Opm::detail::getType ( const TABLE &  table)

◆ getWFR()

template<typename T >
T Opm::detail::getWFR ( const VFPProdTable &  table,
const T &  aqua,
const T &  liquid,
const T &  vapour 
)

Computes the wfr parameter according to the wfr_type_

Returns
Production rate of oil, gas or liquid.

Referenced by Opm::VFPProperties< Scalar >::getExplicitWFR().

◆ ghost_last_bilu0_decomposition()

template<class M >
void Opm::detail::ghost_last_bilu0_decomposition ( M &  A,
std::size_t  interiorSize 
)

Compute Blocked ILU0 decomposition, when we know junk ghost rows are located at the end of A.

Referenced by Opm::ParallelOverlappingILU0< Matrix, Domain, Range, ParallelInfoT >::update().

◆ handleExtraConvergenceOutput()

void Opm::detail::handleExtraConvergenceOutput ( SimulatorReport report,
std::string_view  option,
std::string_view  optionName,
std::string_view  output_dir,
std::string_view  base_name 
)

◆ hasTable()

template<typename T >
bool Opm::detail::hasTable ( const std::map< int, std::reference_wrapper< const T > > &  tables,
int  table_id 
)

Check whether we have a table with the table number

◆ hideUnusedParameters()

template<class Scalar >
void Opm::detail::hideUnusedParameters ( )

Hides unused runtime parameters.

◆ identityFunctor()

template<typename T >
T Opm::detail::identityFunctor ( const T &  )

◆ invertMatrix() [1/6]

template<typename K >
static void Opm::detail::invertMatrix ( Dune::DynamicMatrix< K > &  matrix)
inlinestatic

References invertMatrix4().

Referenced by invertMatrix().

◆ invertMatrix() [2/6]

template<typename K >
static void Opm::detail::invertMatrix ( Dune::FieldMatrix< K, 1, 1 > &  matrix)
inlinestatic

References invertMatrix().

◆ invertMatrix() [3/6]

template<typename K >
static void Opm::detail::invertMatrix ( Dune::FieldMatrix< K, 2, 2 > &  matrix)
inlinestatic

References invertMatrix().

◆ invertMatrix() [4/6]

template<typename K >
static void Opm::detail::invertMatrix ( Dune::FieldMatrix< K, 3, 3 > &  matrix)
inlinestatic

References invertMatrix().

◆ invertMatrix() [5/6]

template<typename K >
static void Opm::detail::invertMatrix ( Dune::FieldMatrix< K, 4, 4 > &  matrix)
inlinestatic

◆ invertMatrix() [6/6]

template<typename K , int m, int n>
static void Opm::detail::invertMatrix ( Dune::FieldMatrix< K, m, n > &  matrix)
inlinestatic

◆ invertMatrix4()

template<template< class K > class Matrix, typename K >
static K Opm::detail::invertMatrix4 ( const Matrix< K > &  matrix,
Matrix< K > &  inverse 
)
inlinestatic

invert 4x4 Matrix without changing the original matrix

Referenced by invertMatrix().

◆ is_alignment()

constexpr bool Opm::detail::is_alignment ( std::size_t  value)
inlineconstexprnoexcept

Referenced by Opm::aligned_alloc().

◆ isPositiveFunctor()

template<typename T >
T Opm::detail::isPositiveFunctor ( const T &  )

◆ logTimer()

void Opm::detail::logTimer ( const AdaptiveSimulatorTimer substepTimer)

◆ makeOverlapRowsInvalid()

template<class Matrix >
void Opm::detail::makeOverlapRowsInvalid ( Matrix &  matrix,
const std::vector< int > &  overlapRows 
)

Zero out off-diagonal blocks on rows corresponding to overlap cells Diagonal blocks on ovelap rows are set to diag(1.0).

Referenced by Opm::ISTLSolver< TypeTag >::initPrepare().

◆ mergeParallelLogFiles()

void Opm::detail::mergeParallelLogFiles ( std::string_view  output_dir,
std::string_view  deck_filename,
bool  enableLoggingFalloutWarning 
)

◆ milu0_decomposition() [1/2]

template<typename M >
void Opm::detail::milu0_decomposition ( M &  A,
FieldFunct< M >  absFunctor = signFunctor< typename M::field_type >,
FieldFunct< M >  signFunctor = oneFunctor< typename M::field_type >,
std::vector< typename M::block_type > *  diagonal = nullptr 
)

◆ milu0_decomposition() [2/2]

template<class M >
void Opm::detail::milu0_decomposition ( M &  A,
std::vector< typename M::block_type > *  diagonal 
)

References milu0_decomposition().

◆ milun_decomposition()

template<class M >
void Opm::detail::milun_decomposition ( const M &  A,
int  n,
MILU_VARIANT  milu,
M &  ILU,
Reorderer ordering,
Reorderer inverseOrdering 
)

◆ multMatrix()

template<class K >
static void Opm::detail::multMatrix ( const Dune::DynamicMatrix< K > &  A,
const Dune::DynamicMatrix< K > &  B,
Dune::DynamicMatrix< K > &  ret 
)
inlinestatic

calculates ret = A * B

◆ multMatrixImpl()

template<class TA , class TB , class TC , class PositiveSign >
static void Opm::detail::multMatrixImpl ( const TA &  A,
const TB &  B,
TC &  ret,
const  PositiveSign 
)
inlinestatic

calculates ret = A * B

◆ multMatrixTransposed()

template<class DenseMatrixA , class DenseMatrixB , class DenseMatrixC >
static void Opm::detail::multMatrixTransposed ( const DenseMatrixA &  A,
const DenseMatrixB &  B,
DenseMatrixC &  ret 
)
inlinestatic

calculates ret = A^T * B

References multMatrixTransposedImpl().

◆ multMatrixTransposedImpl()

template<class TA , class TB , class TC , class PositiveSign >
static void Opm::detail::multMatrixTransposedImpl ( const TA &  A,
const TB &  B,
TC &  ret,
const  PositiveSign 
)
inlinestatic

calculates ret = sign * (A^T * B) TA, TB, and TC are not necessarily FieldMatrix, but those should follow the Dune::DenseMatrix interface.

Referenced by multMatrixTransposed(), and negativeMultMatrixTransposed().

◆ negativeMultMatrixTransposed()

template<class DenseMatrixA , class DenseMatrixB , class DenseMatrixC >
static void Opm::detail::negativeMultMatrixTransposed ( const DenseMatrixA &  A,
const DenseMatrixB &  B,
DenseMatrixC &  ret 
)
inlinestatic

calculates ret = -A^T * B

References multMatrixTransposedImpl().

◆ numMatrixRowsToUseInSolver()

template<class Grid >
std::size_t Opm::detail::numMatrixRowsToUseInSolver ( const Grid &  grid,
bool  ownerFirst 
)

If ownerFirst=true, returns the number of interior cells in grid, else just numCells().

If cells in grid is ordered so that interior/owner cells come before overlap/copy cells, the method returns the number of interior cells numInterior. In the linear solver only the first numInterior rows of the matrix are needed.

Referenced by Opm::ISTLSolver< TypeTag >::initialize().

◆ oneFunctor()

template<typename T >
T Opm::detail::oneFunctor ( const T &  )

◆ operator*()

template<class Scalar >
VFPEvaluation< Scalar > Opm::detail::operator* ( Scalar  lhs,
const VFPEvaluation< Scalar > &  rhs 
)

◆ operator+()

template<class Scalar >
VFPEvaluation< Scalar > Opm::detail::operator+ ( VFPEvaluation< Scalar >  lhs,
const VFPEvaluation< Scalar > &  rhs 
)

◆ operator-()

template<class Scalar >
VFPEvaluation< Scalar > Opm::detail::operator- ( VFPEvaluation< Scalar >  lhs,
const VFPEvaluation< Scalar > &  rhs 
)

◆ pressureAverage() [1/2]

template<class Scalar >
Scalar Opm::detail::pressureAverage ( const Scalar  pressurePvHydrocarbon,
const Scalar  pvHydrocarbon,
const Scalar  pressurePv,
const Scalar  pv,
const bool  hydrocarbon 
)

Calculates average pressure value.

◆ pressureAverage() [2/2]

template<class Scalar >
std::vector< Scalar > Opm::detail::pressureAverage ( const std::vector< Scalar > &  pressurePvHydrocarbon,
const std::vector< Scalar > &  pvHydrocarbon,
const std::vector< Scalar > &  pressurePv,
const std::vector< Scalar > &  pv,
const bool  hydrocarbon 
)

Calculates average pressure value for a vector.

◆ registerAdaptiveParameters()

void Opm::detail::registerAdaptiveParameters ( )

◆ registerNonlinearParameters()

template<class Scalar >
void Opm::detail::registerNonlinearParameters ( )

◆ set_interiorSize() [1/2]

template<>
size_t Opm::detail::set_interiorSize ( size_t  N,
size_t  interiorSize,
const Dune::OwnerOverlapCopyCommunication< int, int > &  comm 
)

◆ set_interiorSize() [2/2]

template<class PI >
size_t Opm::detail::set_interiorSize ( size_t  N,
size_t  interiorSize,
const PI &  comm 
)

◆ setWellConnections()

template<class Grid , class CartMapper , class W >
void Opm::detail::setWellConnections ( const Grid &  grid,
const CartMapper &  cartMapper,
const W &  wells,
const std::unordered_map< std::string, std::set< int > > &  possibleFutureConnections,
bool  useWellConn,
std::vector< std::set< int > > &  wellGraph,
int  numJacobiBlocks 
)

Find cell IDs for wells contained in local grid.

Cell IDs of wells stored in a graph, so it can be used to create an adjacency pattern. Only relevant when the UseWellContribusion option is set to true

Template Parameters
Thetype of the DUNE grid.
Wellvector type
Parameters
gridThe grid where we look for overlap cells.
wellsList of wells contained in grid.
useWellConnBoolean that is true when UseWellContribusion is true
wellGraphCell IDs of well cells stored in a graph.

◆ signFunctor()

template<typename T >
T Opm::detail::signFunctor ( const T &  )

◆ stabilizeNonlinearUpdate()

template<class BVector , class Scalar >
void Opm::detail::stabilizeNonlinearUpdate ( BVector &  dx,
BVector &  dxOld,
const Scalar  omega,
NonlinearRelaxType  relaxType 
)

Apply a stabilization to dx, depending on dxOld and relaxation parameters. Implemention for Dune block vectors.

Referenced by Opm::NonlinearSolver< TypeTag, PhysicalModel >::stabilizeNonlinearUpdate().