Loading...
Searching...
No Matches
Opm::PvsModel< TypeTag > Class Template Reference

A generic compositional multi-phase model using primary-variable switching. More...

`#include <pvsmodel.hh>`

Inheritance diagram for Opm::PvsModel< TypeTag >:

## Public Member Functions

| PvsModel (Simulator &simulator)
std::string | primaryVarName (unsigned pvIdx) const
| Given an primary variable index, return a human readable name.
std::string | eqName (unsigned eqIdx) const
| Given an equation index, return a human readable name.
void | updateFailed ()
| Called by the update() method if it was unsuccessful.
void | updateBegin ()
| Called by the update() method before it tries to apply the newton method.
Scalar | primaryVarWeight (unsigned globalDofIdx, unsigned pvIdx) const
| Returns the relative weight of a primary variable for calculating relative errors.
Scalar | eqWeight (unsigned globalDofIdx, unsigned eqIdx) const
| Returns the relative weight of an equation.
void | advanceTimeLevel ()
| Called by the problem if a time integration was successful, post processing of the solution is done and the result has been written to disk.
bool | switched () const
| Return true if the primary variables were switched for at least one vertex after the last timestep.
template<class DofEntity>
void | serializeEntity (std::ostream &outstream, const DofEntity &dofEntity)
| Write the current solution for a degree of freedom to a restart file.
template<class DofEntity>
void | deserializeEntity (std::istream &instream, const DofEntity &dofEntity)
| Reads the current solution variables for a degree of freedom from a restart file.
void | switchPrimaryVars_ ()
template<class FluidState>
void | printSwitchedPhases_ (const ElementContext &elemCtx, unsigned dofIdx, const FluidState &fs, short oldPhasePresence, const PrimaryVariables &newPv) const
void | registerOutputModules_ ()
Public Member Functions inherited from Opm::MultiPhaseBaseModel< TypeTag >
| MultiPhaseBaseModel (Simulator &simulator)
bool | phaseIsConsidered (unsigned) const
| Returns true iff a fluid phase is used by the model.
void | globalPhaseStorage (EqVector &storage, unsigned phaseIdx)
| Compute the total storage inside one phase of all conservation quantities.
void | registerOutputModules_ ()

## Static Public Member Functions

static void | registerParameters ()
| Register all run-time parameters for the PVS compositional model.
static std::string | name ()
Static Public Member Functions inherited from Opm::MultiPhaseBaseModel< TypeTag >
static void | registerParameters ()
| Register all run-time parameters for the immiscible model.

## Public Attributes

Scalar | referencePressure_ {}
unsigned | numSwitched_
int | verbosity_

## Detailed Description

template<class TypeTag>
class Opm::PvsModel< TypeTag >

A generic compositional multi-phase model using primary-variable switching.

This model assumes a flow of fluid phases , each of which is assumed to be a mixture chemical species .

By default, the standard multi-phase Darcy approach is used to determine the velocity, i.e.

although the actual approach which is used can be specified via the `FluxModule` property. For example, the velocity model can by changed to the Forchheimer approach by

template<class TypeTag>
struct FluxModule<TypeTag, TTag::MyProblemTypeTag> { using type = Opm::ForchheimerFluxModule<TypeTag>; };
Opm::ForchheimerFluxModule
Specifies a flux module which uses the Forchheimer relation.
Definition forchheimerfluxmodule.hh:66

The core of the model is the conservation mass of each component by means of the equation

To close the system mathematically, model equations are also required. This model uses the primary variable switching assumptions, which are given by:

To make this approach applicable, a pseudo primary variable phase presence has to be introduced. Its purpose is to specify for each phase whether it is present or not. It is a pseudo primary variable because it is not directly considered when linearizing the system in the Newton method, but after each Newton iteration, it gets updated like the "real" primary variables. The following rules are used for this update procedure:

- If phase is present according to the pseudo primary variable, but after the Newton update, consider the phase disappeared for the next iteration and use the set of primary variables which correspond to the new phase presence.
- If phase is not present according to the pseudo primary variable, but the sum of the component mole fractions in the phase is larger than 1, i.e. , consider the phase present in the the next iteration and update the set of primary variables to make it consistent with the new phase presence.

- In all other cases don't modify the phase presence for phase .

The model always requires primary variables, but their interpretation is dependent on the phase presence:

- The first primary variable is always interpreted as the pressure of the phase with the lowest index .

- Then, "switching primary variables" follow, which are interpreted depending in the presence of the first phases: If phase is present, its saturation is used as primary variable; if it is not present, the mole fraction of the component with index in the phase with the lowest index that is present is used instead.

- Finally, the mole fractions of the components with the largest index in the phase with the lowest index that is present are used as primary variables.

## Member Function Documentation

## advanceTimeLevel()

template<class TypeTag>

void Opm::PvsModel< TypeTag >::advanceTimeLevel | ( |  | ) |

inline

Called by the problem if a time integration was successful, post processing of the solution is done and the result has been written to disk.

This should prepare the model for the next time integration.

## deserializeEntity()

template<class TypeTag>
template<class DofEntity>

void Opm::PvsModel< TypeTag >::deserializeEntity | ( | std::istream & | instream,
|  | const DofEntity & | dofEntity )

inline

Reads the current solution variables for a degree of freedom from a restart file.

Parameters

  instream | The stream from which the vertex data should be deserialized from
  dof | The Dune entity which's data should be deserialized
  instream | Stream to de-serialize from
  dofEntity | Dof entity to de-serialize

## eqName()

template<class TypeTag>

std::string Opm::PvsModel< TypeTag >::eqName | ( | unsigned | eqIdx | ) | const

inline

Given an equation index, return a human readable name.

Parameters

  eqIdx | The index of the conservation equation of interest.

## eqWeight()

template<class TypeTag>

Scalar Opm::PvsModel< TypeTag >::eqWeight | ( | unsigned | globalDofIdx,
|  | unsigned | eqIdx ) const

inline

Returns the relative weight of an equation.

Parameters

  globalVertexIdx | The global index of the vertex
  eqIdx | The index of the equation
  globalDofIdx | Global index
  eqIdx | Equation index

## name()

template<class TypeTag>

std::string Opm::PvsModel< TypeTag >::name | ( |  | ) |

inline static

## primaryVarName()

template<class TypeTag>

std::string Opm::PvsModel< TypeTag >::primaryVarName | ( | unsigned | pvIdx | ) | const

inline

Given an primary variable index, return a human readable name.

Parameters

  pvIdx | The index of the primary variable of interest.

## primaryVarWeight()

template<class TypeTag>

Scalar Opm::PvsModel< TypeTag >::primaryVarWeight | ( | unsigned | globalDofIdx,
|  | unsigned | pvIdx ) const

inline

Returns the relative weight of a primary variable for calculating relative errors.

Parameters

  globalDofIdx | The global index of the degree of freedom
  pvIdx | The index of the primary variable

## serializeEntity()

template<class TypeTag>
template<class DofEntity>

void Opm::PvsModel< TypeTag >::serializeEntity | ( | std::ostream & | outstream,
|  | const DofEntity & | dofEntity )

inline

Write the current solution for a degree of freedom to a restart file.

Parameters

  outstream | The stream into which the vertex data should be serialized to
  dof | The Dune entity which's data should be serialized
  outstream | Stream to write serialization to
  dofEntity | Dof entity to serialize

## updateBegin()

template<class TypeTag>

void Opm::PvsModel< TypeTag >::updateBegin | ( |  | ) |

inline

Called by the update() method before it tries to apply the newton method.

This is primary a hook which the actual model can overload.

## updateFailed()

template<class TypeTag>

void Opm::PvsModel< TypeTag >::updateFailed | ( |  | ) |

inline

Called by the update() method if it was unsuccessful.

This is primary a hook which the actual model can overload.

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

- opm/models/pvs/pvsmodel.hh