Opm::detail Namespace Reference

Classes

struct  BdaSolverInfo
 
struct  FlexibleSolverInfo
 
struct  InterpData
 
struct  NoReorderer
 
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 M >
using FieldFunct = std::function< typename M::field_type(const typename M::field_type &)>
 

Functions

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)
 
void detectOscillations (const std::vector< std::vector< double > > &residualHistory, const int it, const int numPhases, const double relaxRelTol, bool &oscillate, bool &stagnate)
 Detect oscillation or stagnation in a given residual history. More...
 
template<class BVector >
void stabilizeNonlinearUpdate (BVector &dx, BVector &dxOld, const double omega, NonlinearRelaxType relaxType)
 
template<class Grid , class CartMapper , class W >
void setWellConnections (const Grid &grid, const CartMapper &cartMapper, const W &wells, 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 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 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)
 
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<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)
 
InterpData findInterpData (const double value_in, const std::vector< double > &values)
 
VFPEvaluation operator+ (VFPEvaluation lhs, const VFPEvaluation &rhs)
 
VFPEvaluation operator- (VFPEvaluation lhs, const VFPEvaluation &rhs)
 
VFPEvaluation operator* (double lhs, const VFPEvaluation &rhs)
 
VFPEvaluation interpolate (const VFPProdTable &table, const InterpData &flo_i, const InterpData &thp_i, const InterpData &wfr_i, const InterpData &gfr_i, const InterpData &alq_i)
 
VFPEvaluation interpolate (const VFPInjTable &table, const InterpData &flo_i, const InterpData &thp_i)
 
VFPEvaluation bhp (const VFPProdTable &table, const double aqua, const double liquid, const double vapour, const double thp, const double alq, const double explicit_wfr, const double explicit_gfr, const bool use_vfpexplicit)
 
VFPEvaluation bhp (const VFPInjTable &table, const double aqua, const double liquid, const double vapour, const double thp)
 
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)
 
double findTHP (const std::vector< double > &bhp_array, const std::vector< double > &thp_array, double bhp)
 
std::pair< double, double > getMinimumBHPCoordinate (const VFPProdTable &table, const double thp, const double wfr, const double gfr, const double alq)
 
std::optional< std::pair< double, double > > intersectWithIPR (const VFPProdTable &table, const double thp, const double wfr, const double gfr, const double alq, const double ipr_a, const double ipr_b, const std::function< double(const double)> &adjust_bhp)
 

Typedef Documentation

◆ FieldFunct

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

Function Documentation

◆ absFunctor()

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

◆ bhp() [1/2]

VFPEvaluation Opm::detail::bhp ( const VFPInjTable &  table,
const double  aqua,
const double  liquid,
const double  vapour,
const double  thp 
)

◆ bhp() [2/2]

VFPEvaluation Opm::detail::bhp ( const VFPProdTable &  table,
const double  aqua,
const double  liquid,
const double  vapour,
const double  thp,
const double  alq,
const double  explicit_wfr,
const double  explicit_gfr,
const bool  use_vfpexplicit 
)

◆ 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()

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

◆ findInterpData()

InterpData Opm::detail::findInterpData ( const double  value_in,
const std::vector< double > &  values 
)

Helper function to find indices etc. for linear interpolation and extrapolation

Parameters
value_inValue to find in values
valuesSorted list of values to search for value in.
Returns
Data required to find the interpolated value

◆ 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().

◆ findTHP()

double Opm::detail::findTHP ( const std::vector< double > &  bhp_array,
const std::vector< double > &  thp_array,
double  bhp 
)

This function finds the value of THP given a specific BHP. Essentially: Given the function f(thp_array(x)) = bhp_array(x), which is piecewise linear, find thp so that f(thp) = bhp.

◆ 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::getExplicitGFR().

◆ getMinimumBHPCoordinate()

std::pair< double, double > Opm::detail::getMinimumBHPCoordinate ( const VFPProdTable &  table,
const double  thp,
const double  wfr,
const double  gfr,
const double  alq 
)

Get (flo, bhp) at minimum bhp for given thp,wfr,gfr,alq

◆ 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::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

◆ identityFunctor()

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

◆ interpolate() [1/2]

VFPEvaluation Opm::detail::interpolate ( const VFPInjTable &  table,
const InterpData flo_i,
const InterpData thp_i 
)

This basically models interpolate(VFPProdTable::array_type, ...) which performs 5D interpolation, but here for the 2D case only

◆ interpolate() [2/2]

VFPEvaluation Opm::detail::interpolate ( const VFPProdTable &  table,
const InterpData flo_i,
const InterpData thp_i,
const InterpData wfr_i,
const InterpData gfr_i,
const InterpData alq_i 
)

Helper function which interpolates data using the indices etc. given in the inputs.

◆ intersectWithIPR()

std::optional< std::pair< double, double > > Opm::detail::intersectWithIPR ( const VFPProdTable &  table,
const double  thp,
const double  wfr,
const double  gfr,
const double  alq,
const double  ipr_a,
const double  ipr_b,
const std::function< double(const double)> &  adjust_bhp 
)

Get (flo, bhp) at largest occuring stable vfp/ipr-intersection if it exists

◆ 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*()

VFPEvaluation Opm::detail::operator* ( double  lhs,
const VFPEvaluation rhs 
)

◆ operator+()

VFPEvaluation Opm::detail::operator+ ( VFPEvaluation  lhs,
const VFPEvaluation rhs 
)

◆ operator-()

VFPEvaluation Opm::detail::operator- ( VFPEvaluation  lhs,
const VFPEvaluation 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.

◆ setWellConnections()

template<class Grid , class CartMapper , class W >
void Opm::detail::setWellConnections ( const Grid &  grid,
const CartMapper &  cartMapper,
const W &  wells,
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 >
void Opm::detail::stabilizeNonlinearUpdate ( BVector &  dx,
BVector &  dxOld,
const double  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().