3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Dumux::FVPressure< TypeTag > Class Template Reference

The finite volume base class for the solution of a pressure equation. More...

#include <dumux/porousmediumflow/sequential/cellcentered/pressure.hh>

Inheritance diagram for Dumux::FVPressure< TypeTag >:
Inheritance graph

Description

template<class TypeTag>
class Dumux::FVPressure< TypeTag >

The finite volume base class for the solution of a pressure equation.

Base class for finite volume (FV) implementations of a diffusion-like pressure equation. The class provides a methods for assembling of the global matrix and right hand side (RHS) as well as for solving the system of equations. Additionally, it contains the global matrix, the RHS-vector as well as the solution vector. A certain pressure equation defined in the implementation of this base class must be splitted into a storage term, a flux term and a source term. Corresponding functions (getSource(), getStorage(), getFlux() and getFluxOnBoundary()) have to be defined in the implementation.

Template Parameters
TypeTagThe Type Tag

Public Member Functions

void getSource (EntryType &entry, const Element &element, const CellData &cellData, const bool first)
 Function which calculates the source entry. More...
 
void getStorage (EntryType &entry, const Element &element, const CellData &cellData, const bool first)
 Function which calculates the storage entry. More...
 
void getFlux (EntryType &entry, const Intersection &intersection, const CellData &cellData, const bool first)
 Function which calculates the flux entry. More...
 
void getFluxOnBoundary (EntryType &entry, const Intersection &intersection, const CellData &cellData, const bool first)
 Function which calculates the boundary flux entry. More...
 
const Scalar pressure (const int eIdxGlobal) const
 Public access function for the primary pressure variable. More...
 
const Matrix & globalMatrix ()
 Returns the global matrix of the last pressure solution step. More...
 
const RHSVector & rightHandSide ()
 Returns the right hand side vector of the last pressure solution step. More...
 
void initialize ()
 Initialize pressure model. More...
 
void update ()
 Pressure update. More...
 
void calculateVelocity ()
 
void updateVelocity ()
 
void serializeEntity (std::ostream &outstream, const Element &element)
 Function for serialization of the pressure field. More...
 
void deserializeEntity (std::istream &instream, const Element &element)
 Function for deserialization of the pressure field. More...
 
void setFixPressureAtIndex (Scalar pressure, int eIdxGlobal)
 Set a pressure to be fixed at a certain cell. More...
 
void unsetFixPressureAtIndex (int eIdxGlobal)
 Reset the fixed pressure state. More...
 
void resetFixPressureAtIndex ()
 
 FVPressure (Problem &problem)
 Constructs a FVPressure object. More...
 

Protected Types

enum  { rhs = 1 , matrix = 0 }
 Indices of matrix and rhs entries. More...
 
enum  { pressEqIdx = Indices::pressureEqIdx }
 
using EntryType = Dune::FieldVector< Scalar, 2 >
 

Protected Member Functions

void initializeMatrix ()
 Initialize the global matrix of the system of equations to solve. More...
 
void initializeMatrixRowSize ()
 Initialize the global matrix of the system of equations to solve. More...
 
void initializeMatrixIndices ()
 Initialize the global matrix of the system of equations to solve. More...
 
void assemble (bool first)
 Function which assembles the system of equations to be solved. More...
 
void solve ()
 Solves the global system of equations to get the spatial distribution of the pressure. More...
 
PressureSolution & pressure ()
 Returns the vector containing the pressure solution. More...
 
const PressureSolution & pressure () const
 Returns the vector containing the pressure solution. More...
 
void initializePressure ()
 Initialization of the pressure solution vector: Initialization with meaningful values may. More...
 

Protected Attributes

Matrix A_
 Global stiffnes matrix (sparse matrix which is build by the initializeMatrix() function) More...
 
RHSVector f_
 Right hand side vector. More...
 

Member Typedef Documentation

◆ EntryType

template<class TypeTag >
using Dumux::FVPressure< TypeTag >::EntryType = Dune::FieldVector<Scalar, 2>
protected

Type of the vector of entries

Contains the return values of the get*()-functions (matrix or right-hand side entry).

Member Enumeration Documentation

◆ anonymous enum

template<class TypeTag >
anonymous enum
protected

Indices of matrix and rhs entries.

During the assembling of the global system of equations get-functions are called (getSource(), getFlux(), etc.), which return global matrix or right hand side entries in a vector. These can be accessed using following indices:

Enumerator
rhs 

index for the right hand side entry

matrix 

index for the global matrix entry

◆ anonymous enum

template<class TypeTag >
anonymous enum
protected
Enumerator
pressEqIdx 

Constructor & Destructor Documentation

◆ FVPressure()

template<class TypeTag >
Dumux::FVPressure< TypeTag >::FVPressure ( Problem &  problem)
inline

Constructs a FVPressure object.

Parameters
problemA problem class object

Member Function Documentation

◆ assemble()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::assemble ( bool  first)
protected

Function which assembles the system of equations to be solved.

This function assembles the Matrix and the right hand side (RHS) vector to solve for a pressure field with a Finite-Volume (FV) discretization. Implementations of this base class have to provide the methods getSource(), getStorage(), getFlux() and getFluxOnBoundary() if the assemble() method is called!

Parameters
firstIndicates if function is called at the initialization step or during the simulation (If first is true, no pressure field of previous iterations is required)

◆ calculateVelocity()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::calculateVelocity ( )
inline

◆ deserializeEntity()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::deserializeEntity ( std::istream &  instream,
const Element &  element 
)
inline

Function for deserialization of the pressure field.

Function needed for restart option. Reads the pressure of a grid element from a restart file.

Parameters
instreamStream from the restart file.
elementGrid element

◆ getFlux()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::getFlux ( EntryType entry,
const Intersection &  intersection,
const CellData &  cellData,
const bool  first 
)

Function which calculates the flux entry.

Function computes the inter-cell flux term and writes it to the corresponding entry of the entry vector

Parameters
entryVector containing return values of the function
intersectionIntersection of two grid elements
cellDataObject containing all model relevant cell data
firstIndicates if function is called in the initialization step or during the simulation

◆ getFluxOnBoundary()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::getFluxOnBoundary ( EntryType entry,
const Intersection &  intersection,
const CellData &  cellData,
const bool  first 
)

Function which calculates the boundary flux entry.

Function computes the boundary-flux term and writes it to the corresponding entry of the entry vector

Parameters
entryVector containing return values of the function
intersectionIntersection of two grid elements
cellDataObject containing all model relevant cell data
firstIndicates if function is called in the initialization step or during the simulation

◆ getSource()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::getSource ( EntryType entry,
const Element &  element,
const CellData &  cellData,
const bool  first 
)

Function which calculates the source entry.

Function computes the source term and writes it to the corresponding entry of the entry vector

Parameters
entryVector containing return values of the function
elementGrid element
cellDataObject containing all model relevant cell data
firstIndicates if function is called in the initialization step or during the simulation

◆ getStorage()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::getStorage ( EntryType entry,
const Element &  element,
const CellData &  cellData,
const bool  first 
)

Function which calculates the storage entry.

Function computes the storage term and writes it to the corresponding entry of the entry vector

Parameters
entryVector containing return values of the function
elementGrid element
cellDataObject containing all model relevant cell data
firstIndicates if function is called in the initialization step or during the simulation

◆ globalMatrix()

template<class TypeTag >
const Matrix & Dumux::FVPressure< TypeTag >::globalMatrix ( )
inline

Returns the global matrix of the last pressure solution step.

◆ initialize()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::initialize ( )
inline

Initialize pressure model.

Function initializes the sparse matrix to solve the global system of equations and sets/calculates the initial pressure

◆ initializeMatrix()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::initializeMatrix
protected

Initialize the global matrix of the system of equations to solve.

◆ initializeMatrixIndices()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::initializeMatrixIndices
protected

Initialize the global matrix of the system of equations to solve.

◆ initializeMatrixRowSize()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::initializeMatrixRowSize
protected

Initialize the global matrix of the system of equations to solve.

◆ initializePressure()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::initializePressure ( )
inlineprotected

Initialization of the pressure solution vector: Initialization with meaningful values may.

◆ pressure() [1/3]

template<class TypeTag >
PressureSolution & Dumux::FVPressure< TypeTag >::pressure ( )
inlineprotected

Returns the vector containing the pressure solution.

◆ pressure() [2/3]

template<class TypeTag >
const PressureSolution & Dumux::FVPressure< TypeTag >::pressure ( ) const
inlineprotected

Returns the vector containing the pressure solution.

◆ pressure() [3/3]

template<class TypeTag >
const Scalar Dumux::FVPressure< TypeTag >::pressure ( const int  eIdxGlobal) const
inline

Public access function for the primary pressure variable.

Function returns the cell pressure value at index eIdxGlobal

Parameters
eIdxGlobalGlobal index of a grid cell

◆ resetFixPressureAtIndex()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::resetFixPressureAtIndex ( )
inline

◆ rightHandSide()

template<class TypeTag >
const RHSVector & Dumux::FVPressure< TypeTag >::rightHandSide ( )
inline

Returns the right hand side vector of the last pressure solution step.

◆ serializeEntity()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::serializeEntity ( std::ostream &  outstream,
const Element &  element 
)
inline

Function for serialization of the pressure field.

Function needed for restart option. Writes the pressure of a grid element to a restart file.

Parameters
outstreamStream into the restart file.
elementGrid element

◆ setFixPressureAtIndex()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::setFixPressureAtIndex ( Scalar  pressure,
int  eIdxGlobal 
)
inline

Set a pressure to be fixed at a certain cell.

Allows to fix a pressure somewhere (at one certain cell) in the domain. This can be necessary e.g. if only Neumann boundary conditions are defined. The pressure is fixed until the unsetFixPressureAtIndex() function is called

Parameters
pressurePressure value at eIdxGlobal
eIdxGlobalGlobal index of a grid cell

◆ solve()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::solve
protected

Solves the global system of equations to get the spatial distribution of the pressure.

◆ unsetFixPressureAtIndex()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::unsetFixPressureAtIndex ( int  eIdxGlobal)
inline

Reset the fixed pressure state.

No pressure is fixed inside the domain until setFixPressureAtIndex() function is called again.

Parameters
eIdxGlobalGlobal index of a grid cell

◆ update()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::update ( )
inline

Pressure update.

Function reassembles the system of equations and solves for a new pressure solution.

◆ updateVelocity()

template<class TypeTag >
void Dumux::FVPressure< TypeTag >::updateVelocity ( )
inline

Member Data Documentation

◆ A_

template<class TypeTag >
Matrix Dumux::FVPressure< TypeTag >::A_
protected

Global stiffnes matrix (sparse matrix which is build by the initializeMatrix() function)

◆ f_

template<class TypeTag >
RHSVector Dumux::FVPressure< TypeTag >::f_
protected

Right hand side vector.


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