version 3.10-dev
Dumux::NcpFlash< Scalar, FluidSystem > Class Template Reference

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

#include <dumux/material/constraintsolvers/ncpflash.hh>

Description

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

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

Public Types

using ComponentVector = Dune::FieldVector< Scalar, numComponents >
 

Public Member Functions

 NcpFlash (int wettingPhaseIdx=0)
 Construct a new flash. More...
 
template<class FluidState >
void guessInitial (FluidState &fluidState, ParameterCache &paramCache, const ComponentVector &globalMolarities)
 Guess initial values for all quantities. More...
 
template<class MaterialLaw , class FluidState >
void solve (FluidState &fluidState, ParameterCache &paramCache, const MaterialLaw &material, const ComponentVector &globalMolarities)
 Calculates the chemical equilibrium from the component fugacities in a phase. More...
 

Protected Member Functions

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

Member Typedef Documentation

◆ ComponentVector

template<class Scalar , class FluidSystem >
using Dumux::NcpFlash< Scalar, FluidSystem >::ComponentVector = Dune::FieldVector<Scalar, numComponents>

Constructor & Destructor Documentation

◆ NcpFlash()

template<class Scalar , class FluidSystem >
Dumux::NcpFlash< Scalar, FluidSystem >::NcpFlash ( int  wettingPhaseIdx = 0)
inlineexplicit
Parameters
wettingPhaseIdxthe phase index of the wetting phase

Member Function Documentation

◆ calculateDefect_()

template<class Scalar , class FluidSystem >
template<class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::calculateDefect_ ( Vector &  b,
const FluidState &  fluidStateEval,
const FluidState &  fluidState,
const ComponentVector globalMolarities 
)
inlineprotected

◆ completeFluidState_()

template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::completeFluidState_ ( FluidState &  fluidState,
ParameterCache &  paramCache,
const MaterialLaw &  material 
)
inlineprotected

◆ getQuantity_()

template<class Scalar , class FluidSystem >
template<class FluidState >
Scalar Dumux::NcpFlash< Scalar, FluidSystem >::getQuantity_ ( const FluidState &  fs,
int  pvIdx 
)
inlineprotected

◆ guessInitial()

template<class Scalar , class FluidSystem >
template<class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::guessInitial ( FluidState &  fluidState,
ParameterCache &  paramCache,
const ComponentVector globalMolarities 
)
inline
Parameters
fluidStateThermodynamic state of the fluids
paramCacheContainer for cache parameters
globalMolarities

◆ isMoleFracIdx_()

template<class Scalar , class FluidSystem >
bool Dumux::NcpFlash< Scalar, FluidSystem >::isMoleFracIdx_ ( int  pvIdx)
inlineprotected

◆ isPressureIdx_()

template<class Scalar , class FluidSystem >
bool Dumux::NcpFlash< Scalar, FluidSystem >::isPressureIdx_ ( int  pvIdx)
inlineprotected

◆ isSaturationIdx_()

template<class Scalar , class FluidSystem >
bool Dumux::NcpFlash< Scalar, FluidSystem >::isSaturationIdx_ ( int  pvIdx)
inlineprotected

◆ linearize_()

template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::linearize_ ( Matrix &  J,
Vector &  b,
FluidState &  fluidState,
ParameterCache &  paramCache,
const MaterialLaw &  material,
const ComponentVector globalMolarities 
)
inlineprotected

◆ printFluidState_()

template<class Scalar , class FluidSystem >
template<class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::printFluidState_ ( const FluidState &  fs)
inlineprotected

◆ quantityWeight_()

template<class Scalar , class FluidSystem >
template<class FluidState >
Scalar Dumux::NcpFlash< Scalar, FluidSystem >::quantityWeight_ ( const FluidState &  fs,
int  pvIdx 
)
inlineprotected

◆ setQuantity_()

template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::setQuantity_ ( FluidState &  fs,
ParameterCache &  paramCache,
const MaterialLaw &  material,
int  pvIdx,
Scalar  value 
)
inlineprotected

◆ setQuantityRaw_()

template<class Scalar , class FluidSystem >
template<class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::setQuantityRaw_ ( FluidState &  fs,
int  pvIdx,
Scalar  value 
)
inlineprotected

◆ solve()

template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
void Dumux::NcpFlash< Scalar, FluidSystem >::solve ( FluidState &  fluidState,
ParameterCache &  paramCache,
const MaterialLaw &  material,
const ComponentVector globalMolarities 
)
inline
Parameters
fluidStateThermodynamic state of the fluids
paramCacheContainer for cache parameters
globalMolarities
materialThe material law object

The phase's fugacities must already be set.

◆ update_()

template<class Scalar , class FluidSystem >
template<class MaterialLaw , class FluidState >
Scalar Dumux::NcpFlash< Scalar, FluidSystem >::update_ ( FluidState &  fluidState,
ParameterCache &  paramCache,
const MaterialLaw &  material,
const Vector &  deltaX 
)
inlineprotected

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