version 3.11-dev
Dumux::Experimental::LocalResidual< TypeTag > Class Template Reference

The element-wise residual for grid-based discretization schemes. More...

#include <dumux/assembly/localresidual.hh>

Description

template<class TypeTag>
class Dumux::Experimental::LocalResidual< TypeTag >
Note
This class defines the interface used by the assembler using static polymorphism. Implementations are specialized for a certain discretization scheme

Public Types

using ElementResidualVector = ReservedBlockVector< NumEqVector, Dumux::Detail::LocalDofs::maxNumLocalDofs< FVElementGeometry >()>
 the container storing all element residuals More...
 

Public Member Functions

 LocalResidual (const Problem *problem, const TimeLoop *timeLoop=nullptr)
 the constructor More...
 
Main interface
Note
Methods used by the assembler to compute derivatives and residual
ElementResidualVector evalStorage (const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &prevElemVars, const ElementVariables &curElemVars) const
 Compute the storage local residual, i.e. the deviation of the storage term from zero for instationary problems. More...
 
ElementResidualVector evalFluxAndSource (const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const ElementBoundaryTypes &bcTypes) const
 Compute the flux and source. More...
 
void addToElementStorageResidual (ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &prevElemVars, const ElementVariables &curElemVars) const
 add additional storage contributions (e.g. hybrid CVFE or FE schemes) More...
 
void addToElementFluxAndSourceResidual (ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &curElemVars, const ElementBoundaryTypes &bcTypes) const
 add additional flux and source contributions (e.g. hybrid CVFE or FE schemes) More...
 
Model specific interface
Note
The following methods are the model specific implementations of the local residual
template<class SubControlVolume >
NumEqVector storageIntegral (const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolume &scv, bool isPreviousTimeLevel) const
 Calculate the source term integral of the equation. More...
 
template<class SubControlVolume >
NumEqVector sourceIntegral (const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolume &scv) const
 Calculate the source term integral of the equation. More...
 
template<class SubControlVolumeFace >
NumEqVector fluxIntegral (const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolumeFace &scvf) const
 Calculate the flux integral of the equation. More...
 
Discretization specific interface
Note
The following methods are the discretization specific wrapper methods
template<class SubControlVolume >
void evalStorage (ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &prevElemVars, const ElementVariables &curElemVars, const SubControlVolume &scv) const
 Compute the storage local residual, i.e. the deviation of the storage term from zero for instationary problems. More...
 
template<class SubControlVolume >
void evalSource (ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &curElemVars, const SubControlVolume &scv) const
 Compute the source local residual, i.e. the deviation of the source term from zero. More...
 
template<class SubControlVolumeFace >
void evalFlux (ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const ElementBoundaryTypes &elemBcTypes, const SubControlVolumeFace &scvf) const
 Compute the fluxes of the local residual. More...
 
template<class SubControlVolumeFace >
NumEqVector evalFlux (const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolumeFace &scvf) const
 Compute the fluxes of the local residual. More...
 

Interfaces accessed by local residual implementations

const Problem & problem () const
 the problem More...
 
const TimeLooptimeLoop () const
 
bool isStationary () const
 returns true if the residual is stationary More...
 
Implementation & asImp ()
 
const Implementation & asImp () const
 

Member Typedef Documentation

◆ ElementResidualVector

template<class TypeTag >
using Dumux::Experimental::LocalResidual< TypeTag >::ElementResidualVector = ReservedBlockVector<NumEqVector, Dumux::Detail::LocalDofs::maxNumLocalDofs<FVElementGeometry>()>

Constructor & Destructor Documentation

◆ LocalResidual()

template<class TypeTag >
Dumux::Experimental::LocalResidual< TypeTag >::LocalResidual ( const Problem *  problem,
const TimeLoop timeLoop = nullptr 
)
inline

Member Function Documentation

◆ addToElementFluxAndSourceResidual()

template<class TypeTag >
void Dumux::Experimental::LocalResidual< TypeTag >::addToElementFluxAndSourceResidual ( ElementResidualVector residual,
const Problem &  problem,
const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  curElemVars,
const ElementBoundaryTypes &  bcTypes 
) const
inline

◆ addToElementStorageResidual()

template<class TypeTag >
void Dumux::Experimental::LocalResidual< TypeTag >::addToElementStorageResidual ( ElementResidualVector residual,
const Problem &  problem,
const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  prevElemVars,
const ElementVariables &  curElemVars 
) const
inline

◆ asImp() [1/2]

template<class TypeTag >
Implementation & Dumux::Experimental::LocalResidual< TypeTag >::asImp ( )
inlineprotected

◆ asImp() [2/2]

template<class TypeTag >
const Implementation & Dumux::Experimental::LocalResidual< TypeTag >::asImp ( ) const
inlineprotected

◆ evalFlux() [1/2]

template<class TypeTag >
template<class SubControlVolumeFace >
NumEqVector Dumux::Experimental::LocalResidual< TypeTag >::evalFlux ( const Problem &  problem,
const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  elemVars,
const SubControlVolumeFace &  scvf 
) const
inline
Parameters
problemThe problem to solve
elementThe DUNE Codim<0> entity for which the residual ought to be calculated
fvGeometryThe finite-volume geometry of the element
elemVarsThe variables for all local dofs of the element at the current time level
scvfThe sub control volume face the flux term is integrated over

◆ evalFlux() [2/2]

template<class TypeTag >
template<class SubControlVolumeFace >
void Dumux::Experimental::LocalResidual< TypeTag >::evalFlux ( ElementResidualVector residual,
const Problem &  problem,
const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  elemVars,
const ElementBoundaryTypes &  elemBcTypes,
const SubControlVolumeFace &  scvf 
) const
inline
Parameters
residualThe residual vector to fill
problemThe problem to solve
elementThe DUNE Codim<0> entity for which the residual ought to be calculated
fvGeometryThe finite-volume geometry of the element
elemVarsThe variables for all local dofs of the element at the current time level
elemBcTypesThe boundary types for the boundary entities of an element
scvfThe sub control volume face the flux term is integrated over

◆ evalFluxAndSource()

template<class TypeTag >
ElementResidualVector Dumux::Experimental::LocalResidual< TypeTag >::evalFluxAndSource ( const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  elemVars,
const ElementBoundaryTypes &  bcTypes 
) const
inline
Parameters
elementThe DUNE Codim<0> entity for which the residual ought to be calculated
fvGeometryThe finite-volume geometry of the element
elemVarsThe variables for all local dofs of the element at the current time level
bcTypesThe element boundary types

◆ evalSource()

template<class TypeTag >
template<class SubControlVolume >
void Dumux::Experimental::LocalResidual< TypeTag >::evalSource ( ElementResidualVector residual,
const Problem &  problem,
const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  curElemVars,
const SubControlVolume &  scv 
) const
inline
Parameters
residualThe residual vector to fill
problemThe problem to solve
elementThe DUNE Codim<0> entity for which the residual ought to be calculated
fvGeometryThe finite-volume geometry of the element
curElemVarsThe variables for all local dofs of the element at the current time level
scvThe sub control volume the source term is integrated over

Compute source with the model specific residual

subtract source from local rate (sign convention in user interface)

◆ evalStorage() [1/2]

template<class TypeTag >
ElementResidualVector Dumux::Experimental::LocalResidual< TypeTag >::evalStorage ( const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  prevElemVars,
const ElementVariables &  curElemVars 
) const
inline
Parameters
elementThe DUNE Codim<0> entity for which the residual ought to be calculated
fvGeometryThe finite-volume geometry of the element
prevElemVarsThe variables for all local dofs of the element at the previous time level
curElemVarsThe variables for all local dofs of the element at the current time level

◆ evalStorage() [2/2]

template<class TypeTag >
template<class SubControlVolume >
void Dumux::Experimental::LocalResidual< TypeTag >::evalStorage ( ElementResidualVector residual,
const Problem &  problem,
const Element &  element,
const FVElementGeometry &  fvGeometry,
const ElementVariables &  prevElemVars,
const ElementVariables &  curElemVars,
const SubControlVolume &  scv 
) const
inline
Parameters
residualThe residual vector to fill
problemThe problem to solve
elementThe DUNE Codim<0> entity for which the residual ought to be calculated
fvGeometryThe finite-volume geometry of the element
prevElemVarsThe variables for all local dofs of the element at the previous time level
curElemVarsThe variables for all local dofs of the element at the current time level
scvThe sub control volume the storage term is integrated over

Compute storage with the model specific storage residual

◆ fluxIntegral()

template<class TypeTag >
template<class SubControlVolumeFace >
NumEqVector Dumux::Experimental::LocalResidual< TypeTag >::fluxIntegral ( const FVElementGeometry &  fvGeometry,
const ElementVariables &  elemVars,
const SubControlVolumeFace &  scvf 
) const
inline
Parameters
fvGeometryThe finite-volume geometry of the element
elemVarsThe variables associated with the element stencil
scvfThe sub-control volume over which we integrate the flux
Note
has to be implemented by the model specific residual class

◆ isStationary()

template<class TypeTag >
bool Dumux::Experimental::LocalResidual< TypeTag >::isStationary ( ) const
inline

◆ problem()

template<class TypeTag >
const Problem & Dumux::Experimental::LocalResidual< TypeTag >::problem ( ) const
inline

◆ sourceIntegral()

template<class TypeTag >
template<class SubControlVolume >
NumEqVector Dumux::Experimental::LocalResidual< TypeTag >::sourceIntegral ( const FVElementGeometry &  fvGeometry,
const ElementVariables &  elemVars,
const SubControlVolume &  scv 
) const
inline
Parameters
fvGeometryThe finite-volume geometry of the element
elemVarsThe variables associated with the element stencil
scvThe sub-control volume over which we integrate the source term
Note
This is the default implementation for all models as sources are computed in the user interface of the problem

◆ storageIntegral()

template<class TypeTag >
template<class SubControlVolume >
NumEqVector Dumux::Experimental::LocalResidual< TypeTag >::storageIntegral ( const FVElementGeometry &  fvGeometry,
const ElementVariables &  elemVars,
const SubControlVolume &  scv,
bool  isPreviousTimeLevel 
) const
inline
Parameters
fvGeometryThe finite-volume geometry of the element
elemVarsThe variables associated with the element stencil
scvThe sub-control volume over which we integrate the source term
isPreviousTimeLevelIf set to true, the storage integral term is evaluated on the previous time level.
Note
has to be implemented by the model specific residual class

◆ timeLoop()

template<class TypeTag >
const TimeLoop & Dumux::Experimental::LocalResidual< TypeTag >::timeLoop ( ) const
inline

the time loop for instationary problems calling this for stationary leads to undefined behaviour


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