Opm::detail Namespace Reference

Classes

struct  InterpData
 
struct  VFPEvaluation
 

Typedefs

typedef AutoDiffBlock< double > ADB
 

Functions

std::vector< int > buildAllCells (const int nc)
 
template<class PU >
std::vector< bool > activePhases (const PU &pu)
 
template<class PU >
std::vector< int > active2Canonical (const PU &pu)
 
double getGravity (const double *g, const int dim)
 
double rateToCompare (const std::vector< double > &well_phase_flow_rate, const int well, const int num_phases, const double *distr)
 
bool constraintBroken (const std::vector< double > &bhp, const std::vector< double > &thp, const std::vector< double > &well_phase_flow_rate, const int well, const int num_phases, const WellType &well_type, const WellControls *wc, const int ctrl_index)
 
double computeHydrostaticCorrection (const Wells &wells, const int w, double vfp_ref_depth, const ADB::V &well_perforation_densities, const double gravity)
 
ADB::V computeHydrostaticCorrection (const Wells &wells, const ADB::V vfp_ref_depth, const ADB::V &well_perforation_densities, const double gravity)
 
double infinityNorm (const ADB &a, const boost::any &pinfo=boost::any())
 Compute the L-infinity norm of a vector This function is not suitable to compute on the well equations. More...
 
double infinityNormWell (const ADB &a, const boost::any &pinfo)
 Compute the L-infinity norm of a vector representing a well equation. More...
 
template<class PU >
int solventPos (const PU &pu)
 
double zeroIfNan (const double &value)
 
ADB zeroIfNan (const ADB &values)
 
template<typename T >
static T getFlo (const T &aqua, const T &liquid, const T &vapour, const VFPProdTable::FLO_TYPE &type)
 
template<typename T >
static T getFlo (const T &aqua, const T &liquid, const T &vapour, const VFPInjTable::FLO_TYPE &type)
 
template<typename T >
static T getWFR (const T &aqua, const T &liquid, const T &vapour, const VFPProdTable::WFR_TYPE &type)
 
template<typename T >
static T getGFR (const T &aqua, const T &liquid, const T &vapour, const VFPProdTable::GFR_TYPE &type)
 
InterpData findInterpData (const double &value, 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::array_type &array, const InterpData &flo_i, const InterpData &thp_i, const InterpData &wfr_i, const InterpData &gfr_i, const InterpData &alq_i)
 
VFPEvaluation interpolate (const VFPInjTable::array_type &array, 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)
 
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, T * > tables, int table_id)
 
void extendBlockPattern (const ADB &x, std::vector< int > &block_pattern)
 
std::vector< int > commonBlockPattern (const ADB &x1, const ADB &x2, const ADB &x3, const ADB &x4)
 
std::vector< int > commonBlockPattern (const ADB &x1, const ADB &x2, const ADB &x3, const ADB &x4, const ADB &x5)
 
template<typename TYPE , typename TABLE >
TYPE getType (const TABLE *table)
 
template<>
VFPProdTable::FLO_TYPE getType (const VFPProdTable *table)
 
template<>
VFPProdTable::WFR_TYPE getType (const VFPProdTable *table)
 
template<>
VFPProdTable::GFR_TYPE getType (const VFPProdTable *table)
 
template<>
VFPInjTable::FLO_TYPE getType (const VFPInjTable *table)
 
template<typename TYPE >
ADB getValue (const ADB &aqua, const ADB &liquid, const ADB &vapour, TYPE type)
 
template<>
ADB getValue (const ADB &aqua, const ADB &liquid, const ADB &vapour, VFPProdTable::FLO_TYPE type)
 
template<>
ADB getValue (const ADB &aqua, const ADB &liquid, const ADB &vapour, VFPProdTable::WFR_TYPE type)
 
template<>
ADB getValue (const ADB &aqua, const ADB &liquid, const ADB &vapour, VFPProdTable::GFR_TYPE type)
 
template<>
ADB getValue (const ADB &aqua, const ADB &liquid, const ADB &vapour, VFPInjTable::FLO_TYPE type)
 
template<typename TYPE , typename TABLE >
ADB combineADBVars (const std::vector< const TABLE * > &well_tables, const ADB &aqua, const ADB &liquid, const ADB &vapour)
 
double findX (const double &x0, const double &x1, const double &y0, const double &y1, const double &y)
 
double findTHP (const std::vector< double > &bhp_array, const std::vector< double > &thp_array, double bhp)
 

Typedef Documentation

Function Documentation

template<class PU >
std::vector<int> Opm::detail::active2Canonical ( const PU &  pu)

References Opm::MaxNumPhases.

template<class PU >
std::vector<bool> Opm::detail::activePhases ( const PU &  pu)

References Opm::MaxNumPhases.

VFPEvaluation Opm::detail::bhp ( const VFPProdTable *  table,
const double &  aqua,
const double &  liquid,
const double &  vapour,
const double &  thp,
const double &  alq 
)
inline
VFPEvaluation Opm::detail::bhp ( const VFPInjTable *  table,
const double &  aqua,
const double &  liquid,
const double &  vapour,
const double &  thp 
)
inline
std::vector<int> Opm::detail::buildAllCells ( const int  nc)
inline
template<typename TYPE , typename TABLE >
ADB Opm::detail::combineADBVars ( const std::vector< const TABLE * > &  well_tables,
const ADB &  aqua,
const ADB &  liquid,
const ADB &  vapour 
)

Given m wells and n types of VFP variables (e.g., FLO = {FLO_OIL, FLO_LIQ} this function combines the n types of ADB objects, so that each of the m wells gets the right ADB.

Parameters
TYPEType of variable to return, e.g., FLO_TYPE, WFR_TYPE, GFR_TYPE
TABLEType of table to use, e.g., VFPInjTable, VFPProdTable.

References Opm::AutoDiffBlock< double >::constant(), Opm::AutoDiffBlock< Scalar >::size(), Opm::subset(), and Opm::superset().

std::vector<int> Opm::detail::commonBlockPattern ( const ADB &  x1,
const ADB &  x2,
const ADB &  x3,
const ADB &  x4 
)
inline

Finds the common block pattern for all inputs

References extendBlockPattern().

Referenced by commonBlockPattern().

std::vector<int> Opm::detail::commonBlockPattern ( const ADB &  x1,
const ADB &  x2,
const ADB &  x3,
const ADB &  x4,
const ADB &  x5 
)
inline
double Opm::detail::computeHydrostaticCorrection ( const Wells &  wells,
const int  w,
double  vfp_ref_depth,
const ADB::V well_perforation_densities,
const double  gravity 
)
inline

Simple hydrostatic correction for VFP table

Parameters
wells- wells struct
wWell number
vfp_tableVFP table
well_perforation_densitiesDensities at well perforations
gravityGravitational constant (e.g., 9.81...)

Referenced by Opm::BlackoilModelBase< Grid, Implementation >::addWellControlEq(), Opm::BlackoilModelBase< Grid, Implementation >::updateWellControls(), and Opm::BlackoilModelBase< Grid, Implementation >::updateWellState().

ADB::V Opm::detail::computeHydrostaticCorrection ( const Wells &  wells,
const ADB::V  vfp_ref_depth,
const ADB::V well_perforation_densities,
const double  gravity 
)
inline
bool Opm::detail::constraintBroken ( const std::vector< double > &  bhp,
const std::vector< double > &  thp,
const std::vector< double > &  well_phase_flow_rate,
const int  well,
const int  num_phases,
const WellType &  well_type,
const WellControls *  wc,
const int  ctrl_index 
)
inline
void Opm::detail::extendBlockPattern ( const ADB &  x,
std::vector< int > &  block_pattern 
)
inline

Sets block_pattern to be the "union of x.blockPattern() and block_pattern".

References Opm::AutoDiffBlock< Scalar >::blockPattern().

Referenced by commonBlockPattern().

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

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

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

References Opm::detail::InterpData::factor_, Opm::detail::InterpData::ind_, and Opm::detail::InterpData::inv_dist_.

Referenced by bhp().

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

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.

Our interpolated bhp_array will be montonic increasing for increasing THP if our input BHP values are monotonic increasing for increasing THP values. However, if we have to extrapolate along any of the other axes, this guarantee holds no more, and bhp_array may be "random"

References findX().

double Opm::detail::findX ( const double &  x0,
const double &  x1,
const double &  y0,
const double &  y1,
const double &  y 
)
inline

Helper function that finds x for a given value of y for a line NOTE ORDER OF ARGUMENTS

  y = y0 + (dy / dx) * (x - x0)

=> x = x0 + (y - y0) * (dx / dy)

If dy is zero, use x1 as the value.

Referenced by findTHP().

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

Computes the flo parameter according to the flo_type_ for production tables

Returns
Production rate of oil, gas or liquid.

Referenced by bhp(), and getValue().

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

Computes the flo parameter according to the flo_type_ for injection tables

Returns
Production rate of oil, gas or liquid.
template<typename T >
static T Opm::detail::getGFR ( const T &  aqua,
const T &  liquid,
const T &  vapour,
const VFPProdTable::GFR_TYPE &  type 
)
static

Computes the gfr parameter according to the gfr_type_

Returns
Production rate of oil, gas or liquid.

References zeroIfNan().

Referenced by bhp(), and getValue().

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

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

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

Returns the type variable for FLO/GFR/WFR for production tables

template<>
VFPProdTable::FLO_TYPE Opm::detail::getType ( const VFPProdTable *  table)
inline
template<>
VFPProdTable::WFR_TYPE Opm::detail::getType ( const VFPProdTable *  table)
inline
template<>
VFPProdTable::GFR_TYPE Opm::detail::getType ( const VFPProdTable *  table)
inline
template<>
VFPInjTable::FLO_TYPE Opm::detail::getType ( const VFPInjTable *  table)
inline

Returns the type variable for FLO for injection tables

template<typename TYPE >
ADB Opm::detail::getValue ( const ADB &  aqua,
const ADB &  liquid,
const ADB &  vapour,
TYPE  type 
)

Returns the actual ADB for the type of FLO/GFR/WFR type

template<>
ADB Opm::detail::getValue ( const ADB &  aqua,
const ADB &  liquid,
const ADB &  vapour,
VFPProdTable::FLO_TYPE  type 
)
inline

References getFlo().

template<>
ADB Opm::detail::getValue ( const ADB &  aqua,
const ADB &  liquid,
const ADB &  vapour,
VFPProdTable::WFR_TYPE  type 
)
inline

References getWFR().

template<>
ADB Opm::detail::getValue ( const ADB &  aqua,
const ADB &  liquid,
const ADB &  vapour,
VFPProdTable::GFR_TYPE  type 
)
inline

References getGFR().

template<>
ADB Opm::detail::getValue ( const ADB &  aqua,
const ADB &  liquid,
const ADB &  vapour,
VFPInjTable::FLO_TYPE  type 
)
inline

References getFlo().

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

Computes the wfr parameter according to the wfr_type_

Returns
Production rate of oil, gas or liquid.

References zeroIfNan().

Referenced by bhp(), and getValue().

double Opm::detail::infinityNorm ( const ADB &  a,
const boost::any &  pinfo = boost::any() 
)
inline

Compute the L-infinity norm of a vector This function is not suitable to compute on the well equations.

Parameters
aThe container to compute the infinity norm on. It has to have one entry for each cell.
infoIn a parallel this holds the information about the data distribution.

References Opm::AutoDiffBlock< Scalar >::value().

Referenced by Opm::BlackoilModelBase< Grid, Implementation >::computeResidualNorms().

double Opm::detail::infinityNormWell ( const ADB &  a,
const boost::any &  pinfo 
)
inline

Compute the L-infinity norm of a vector representing a well equation.

Parameters
aThe container to compute the infinity norm on.
infoIn a parallel this holds the information about the data distribution.

References Opm::AutoDiffBlock< Scalar >::value().

Referenced by Opm::BlackoilModelBase< Grid, Implementation >::computeResidualNorms(), Opm::BlackoilModelBase< Grid, Implementation >::getConvergence(), and Opm::BlackoilModelBase< Grid, Implementation >::getWellConvergence().

VFPEvaluation Opm::detail::interpolate ( const VFPProdTable::array_type &  array,
const InterpData &  flo_i,
const InterpData &  thp_i,
const InterpData &  wfr_i,
const InterpData &  gfr_i,
const InterpData &  alq_i 
)
inline
VFPEvaluation Opm::detail::interpolate ( const VFPInjTable::array_type &  array,
const InterpData &  flo_i,
const InterpData &  thp_i 
)
inline
double Opm::detail::rateToCompare ( const std::vector< double > &  well_phase_flow_rate,
const int  well,
const int  num_phases,
const double *  distr 
)
inline

Referenced by constraintBroken().

template<class PU >
int Opm::detail::solventPos ( const PU &  pu)

References Opm::MaxNumPhases.

double Opm::detail::zeroIfNan ( const double &  value)
inline

Returns zero if input value is NaN

Referenced by getGFR(), and getWFR().

ADB Opm::detail::zeroIfNan ( const ADB &  values)
inline