Opm::NcpFlash< Scalar, FluidSystem > Class Template Reference

Determines the phase compositions, pressures and saturations given the total mass of all components. More...

#include <NcpFlash.hpp>

Static Public Member Functions

template<class FluidState , class Evaluation = typename FluidState::Scalar>
static void guessInitial (FluidState &fluidState, ParameterCache &paramCache, const Dune::FieldVector< Evaluation, numComponents > &globalMolarities)
 Guess initial values for all quantities. More...
 
template<class MaterialLaw , class FluidState >
static void solve (FluidState &fluidState, ParameterCache &paramCache, const typename MaterialLaw::Params &matParams, const Dune::FieldVector< typename FluidState::Scalar, numComponents > &globalMolarities, Scalar tolerance=0.0)
 Calculates the chemical equilibrium from the component fugacities in a phase. More...
 
template<class FluidState , class ComponentVector >
static void solve (FluidState &fluidState, const ComponentVector &globalMolarities, Scalar tolerance=0.0)
 Calculates the chemical equilibrium from the component fugacities in a phase. More...
 

Static Protected Member Functions

template<class FluidState >
static void printFluidState_ (const FluidState &fluidState)
 
template<class MaterialLaw , class FluidState , class Matrix , class Vector , class ComponentVector >
static void linearize_ (Matrix &J, Vector &b, FluidState &fluidState, ParameterCache &paramCache, const typename MaterialLaw::Params &matParams, const ComponentVector &globalMolarities)
 
template<class FluidState , class Vector , class ComponentVector >
static void calculateDefect_ (Vector &b, const FluidState &fluidStateEval, const FluidState &fluidState, const ComponentVector &globalMolarities)
 
template<class MaterialLaw , class FluidState , class Vector >
static Scalar update_ (FluidState &fluidState, ParameterCache &paramCache, const typename MaterialLaw::Params &matParams, const Vector &deltaX)
 
template<class MaterialLaw , class FluidState >
static void completeFluidState_ (FluidState &fluidState, ParameterCache &paramCache, const typename MaterialLaw::Params &matParams)
 
static bool isPressureIdx_ (unsigned pvIdx)
 
static bool isSaturationIdx_ (unsigned pvIdx)
 
static bool isMoleFracIdx_ (unsigned pvIdx)
 
template<class FluidState >
static const FluidState::Scalar & getQuantity_ (const FluidState &fluidState, unsigned pvIdx)
 
template<class MaterialLaw , class FluidState >
static void setQuantity_ (FluidState &fluidState, ParameterCache &paramCache, const typename MaterialLaw::Params &matParams, unsigned pvIdx, const typename FluidState::Scalar &value)
 
template<class FluidState >
static void setQuantityRaw_ (FluidState &fluidState, unsigned pvIdx, const typename FluidState::Scalar &value)
 
template<class FluidState >
static Scalar quantityWeight_ (const FluidState &, unsigned pvIdx)
 

Detailed Description

template<class Scalar, class FluidSystem>
class Opm::NcpFlash< Scalar, FluidSystem >

Determines the phase compositions, pressures and saturations given the total mass of all components.

In a M-phase, N-component context, we have the following unknowns:

  • M pressures
  • M saturations
  • M*N mole fractions

This sums up to M*(N + 2). On the equations side of things, we have:

  • (M - 1)*N equation stemming from the fact that the fugacity of any component is the same in all phases
  • 1 equation from the closure condition of all saturations (they sum up to 1)
  • M - 1 constraints from the capillary pressures $(-> p_\beta = p_\alpha + p_c\alpha,\beta)$
  • N constraints from the fact that the total mass of each component is given $(-> sum_\alpha rhoMolar_\alpha * x_\alpha^\kappa = const)$
  • M model constraints. Here we use the NCP constraints (-> 0 = min $ {S_\alpha, 1 - \sum_\kappa x_\alpha^\kappa}$)

this also sums up to M*(N + 2).

We use the following catches: Capillary pressures are taken into account explicitly, so that only the pressure of the first phase is solved implicitly, also the closure condition for the saturations is taken into account explicitly, which means that we don't need to implicitly solve for the last saturation. These two measures reduce the number of unknowns to M*(N + 1), namely:

  • 1 pressure
  • M - 1 saturations
  • M*N mole fractions

Member Function Documentation

template<class Scalar , class FluidSystem >
template<class FluidState , class Vector , class ComponentVector >
static void Opm::NcpFlash< Scalar, FluidSystem >::calculateDefect_ ( Vector &  b,
const FluidState &  fluidStateEval,
const FluidState &  fluidState,
const ComponentVector &  globalMolarities 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
static void Opm::NcpFlash< Scalar, FluidSystem >::completeFluidState_ ( FluidState &  fluidState,
ParameterCache &  paramCache,
const typename MaterialLaw::Params &  matParams 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class FluidState >
static const FluidState::Scalar& Opm::NcpFlash< Scalar, FluidSystem >::getQuantity_ ( const FluidState &  fluidState,
unsigned  pvIdx 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class FluidState , class Evaluation = typename FluidState::Scalar>
static void Opm::NcpFlash< Scalar, FluidSystem >::guessInitial ( FluidState &  fluidState,
ParameterCache &  paramCache,
const Dune::FieldVector< Evaluation, numComponents > &  globalMolarities 
)
inlinestatic

Guess initial values for all quantities.

template<class Scalar , class FluidSystem >
static bool Opm::NcpFlash< Scalar, FluidSystem >::isMoleFracIdx_ ( unsigned  pvIdx)
inlinestaticprotected
template<class Scalar , class FluidSystem >
static bool Opm::NcpFlash< Scalar, FluidSystem >::isPressureIdx_ ( unsigned  pvIdx)
inlinestaticprotected
template<class Scalar , class FluidSystem >
static bool Opm::NcpFlash< Scalar, FluidSystem >::isSaturationIdx_ ( unsigned  pvIdx)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState , class Matrix , class Vector , class ComponentVector >
static void Opm::NcpFlash< Scalar, FluidSystem >::linearize_ ( Matrix &  J,
Vector &  b,
FluidState &  fluidState,
ParameterCache &  paramCache,
const typename MaterialLaw::Params &  matParams,
const ComponentVector &  globalMolarities 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class FluidState >
static void Opm::NcpFlash< Scalar, FluidSystem >::printFluidState_ ( const FluidState &  fluidState)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class FluidState >
static Scalar Opm::NcpFlash< Scalar, FluidSystem >::quantityWeight_ ( const FluidState &  ,
unsigned  pvIdx 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
static void Opm::NcpFlash< Scalar, FluidSystem >::setQuantity_ ( FluidState &  fluidState,
ParameterCache &  paramCache,
const typename MaterialLaw::Params &  matParams,
unsigned  pvIdx,
const typename FluidState::Scalar &  value 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class FluidState >
static void Opm::NcpFlash< Scalar, FluidSystem >::setQuantityRaw_ ( FluidState &  fluidState,
unsigned  pvIdx,
const typename FluidState::Scalar &  value 
)
inlinestaticprotected
template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
static void Opm::NcpFlash< Scalar, FluidSystem >::solve ( FluidState &  fluidState,
ParameterCache &  paramCache,
const typename MaterialLaw::Params &  matParams,
const Dune::FieldVector< typename FluidState::Scalar, numComponents > &  globalMolarities,
Scalar  tolerance = 0.0 
)
inlinestatic

Calculates the chemical equilibrium from the component fugacities in a phase.

The phase's fugacities must already be set.

References Valgrind::CheckDefined(), Opm::geometricMean(), and Valgrind::SetUndefined().

template<class Scalar , class FluidSystem >
template<class FluidState , class ComponentVector >
static void Opm::NcpFlash< Scalar, FluidSystem >::solve ( FluidState &  fluidState,
const ComponentVector &  globalMolarities,
Scalar  tolerance = 0.0 
)
inlinestatic

Calculates the chemical equilibrium from the component fugacities in a phase.

This is a convenience method which assumes that the capillary pressure is zero...

template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState , class Vector >
static Scalar Opm::NcpFlash< Scalar, FluidSystem >::update_ ( FluidState &  fluidState,
ParameterCache &  paramCache,
const typename MaterialLaw::Params &  matParams,
const Vector &  deltaX 
)
inlinestaticprotected

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