Calculates the local residual and its Jacobian for a single element of the grid. More...

#include <fvbaseadlocallinearizer.hh>

Public Member Functions

 FvBaseAdLocalLinearizer ()
 
 ~FvBaseAdLocalLinearizer ()
 
void init (Simulator &simulator)
 Initialize the local Jacobian object. More...
 
void linearize (const Element &element)
 Compute an element's local Jacobian matrix and evaluate its residual. More...
 
void linearize (ElementContext &elemCtx)
 Compute an element's local Jacobian matrix and evaluate its residual. More...
 
Scalar numericEpsilon (const ElementContext &elemCtx, int dofIdx, int pvIdx) const
 Returns the epsilon value which is added and removed from the current solution. More...
 
LocalResidual & localResidual ()
 Return reference to the local residual. More...
 
const LocalResidual & localResidual () const
 Return reference to the local residual. More...
 
const MatrixBlock & jacobian (int domainScvIdx, int rangeScvIdx) const
 Returns the local Jacobian matrix of the residual of a sub-control volume. More...
 
const MatrixBlock & jacobianStorage (int dofIdx) const
 Returns the local Jacobian matrix the storage term of a sub-control volume. More...
 
const VectorBlock & residual (int dofIdx) const
 Returns the local residual of a sub-control volume. More...
 
const VectorBlock & residualStorage (int dofIdx) const
 Returns the local storage term of a sub-control volume. More...
 

Static Public Member Functions

static void registerParameters ()
 Register all run-time parameters for the local jacobian. More...
 
static Scalar baseEpsilon ()
 Returns the unweighted epsilon value used to calculate the local derivatives. More...
 

Protected Member Functions

Implementation & asImp_ ()
 
const Implementation & asImp_ () const
 
const Simulatorsimulator_ () const
 
const Problem & problem_ () const
 
const Model & model_ () const
 
void resize_ (const ElementContext &elemCtx)
 Resize all internal attributes to the size of the element. More...
 
void reset_ (const ElementContext &elemCtx)
 Reset the all relevant internal attributes to 0. More...
 
void updateLocalLinearization_ (const ElementContext &elemCtx, int primaryDofIdx)
 Updates the current local Jacobian matrix with the partial derivatives of all equations in regard to the primary variable 'pvIdx' at vertex 'dofIdx' . More...
 

Static Protected Member Functions

static int numericDifferenceMethod_ ()
 Returns the numeric difference method which is applied. More...
 

Protected Attributes

SimulatorsimulatorPtr_
 
Model * modelPtr_
 
ElementContext * internalElemContext_
 
LocalBlockVector residual_
 
LocalBlockVector residualStorage_
 
LocalBlockMatrix jacobian_
 
LocalStorageMatrix jacobianStorage_
 
LocalResidual localResidual_
 

Detailed Description

template<class TypeTag>
class Ewoms::FvBaseAdLocalLinearizer< TypeTag >

Calculates the local residual and its Jacobian for a single element of the grid.

This class uses automatic differentiation to calculate the partial derivatives (the alternative is finite differences).

Constructor & Destructor Documentation

template<class TypeTag >
Ewoms::FvBaseAdLocalLinearizer< TypeTag >::FvBaseAdLocalLinearizer ( )
inline

Member Function Documentation

template<class TypeTag >
Implementation& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::asImp_ ( )
inlineprotected
template<class TypeTag >
const Implementation& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::asImp_ ( ) const
inlineprotected
template<class TypeTag >
static Scalar Ewoms::FvBaseAdLocalLinearizer< TypeTag >::baseEpsilon ( )
inlinestatic

Returns the unweighted epsilon value used to calculate the local derivatives.

References GET_PROP_VALUE.

Referenced by Ewoms::FvBaseAdLocalLinearizer< TypeTag >::numericEpsilon().

template<class TypeTag >
void Ewoms::FvBaseAdLocalLinearizer< TypeTag >::init ( Simulator simulator)
inline

Initialize the local Jacobian object.

At this point we can assume that everything has been allocated, although some objects may not yet be completely initialized.

Parameters
simulatorThe simulator object of the simulation.

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::internalElemContext_, and Ewoms::FvBaseAdLocalLinearizer< TypeTag >::simulatorPtr_.

template<class TypeTag >
const MatrixBlock& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::jacobian ( int  domainScvIdx,
int  rangeScvIdx 
) const
inline

Returns the local Jacobian matrix of the residual of a sub-control volume.

Parameters
domainScvIdxThe local index of the sub control volume which contains the independents
rangeScvIdxThe local index of the sub control volume which contains the local residual

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::jacobian_.

template<class TypeTag >
const MatrixBlock& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::jacobianStorage ( int  dofIdx) const
inline

Returns the local Jacobian matrix the storage term of a sub-control volume.

Parameters
dofIdxThe local index of sub control volume

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::jacobianStorage_.

template<class TypeTag >
void Ewoms::FvBaseAdLocalLinearizer< TypeTag >::linearize ( const Element &  element)
inline

Compute an element's local Jacobian matrix and evaluate its residual.

The local Jacobian for a given context is defined as the derivatives of the residuals of all degrees of freedom featured by the stencil with regard to the primary variables of the stencil's "primary" degrees of freedom. Adding the local Jacobians for all elements in the grid will give the global Jacobian 'grad f(x)'.

Parameters
elementThe grid element for which the local residual and its local Jacobian should be calculated.

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::internalElemContext_.

template<class TypeTag >
void Ewoms::FvBaseAdLocalLinearizer< TypeTag >::linearize ( ElementContext &  elemCtx)
inline

Compute an element's local Jacobian matrix and evaluate its residual.

The local Jacobian for a given context is defined as the derivatives of the residuals of all degrees of freedom featured by the stencil with regard to the primary variables of the stencil's "primary" degrees of freedom. Adding the local Jacobians for all elements in the grid will give the global Jacobian 'grad f(x)'.

After calling this method the ElementContext is in an undefined state, so do not use it anymore!

Parameters
elemCtxThe element execution context for which the local residual and its local Jacobian should be calculated.

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::localResidual_, Ewoms::FvBaseAdLocalLinearizer< TypeTag >::model_(), Ewoms::FvBaseAdLocalLinearizer< TypeTag >::reset_(), Ewoms::FvBaseAdLocalLinearizer< TypeTag >::resize_(), and Ewoms::FvBaseAdLocalLinearizer< TypeTag >::updateLocalLinearization_().

template<class TypeTag >
LocalResidual& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::localResidual ( )
inline

Return reference to the local residual.

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::localResidual_.

template<class TypeTag >
const LocalResidual& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::localResidual ( ) const
inline

Return reference to the local residual.

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::localResidual_.

template<class TypeTag >
const Model& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::model_ ( ) const
inlineprotected
template<class TypeTag >
static int Ewoms::FvBaseAdLocalLinearizer< TypeTag >::numericDifferenceMethod_ ( )
inlinestaticprotected

Returns the numeric difference method which is applied.

References EWOMS_GET_PARAM.

template<class TypeTag >
Scalar Ewoms::FvBaseAdLocalLinearizer< TypeTag >::numericEpsilon ( const ElementContext &  elemCtx,
int  dofIdx,
int  pvIdx 
) const
inline

Returns the epsilon value which is added and removed from the current solution.

Parameters
elemCtxThe element execution context for which the local residual and its gradient should be calculated.
dofIdxThe local index of the element's vertex for which the local derivative ought to be calculated.
pvIdxThe index of the primary variable which gets varied

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::baseEpsilon().

template<class TypeTag >
const Problem& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::problem_ ( ) const
inlineprotected
template<class TypeTag >
static void Ewoms::FvBaseAdLocalLinearizer< TypeTag >::registerParameters ( )
inlinestatic

Register all run-time parameters for the local jacobian.

template<class TypeTag >
const VectorBlock& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::residual ( int  dofIdx) const
inline

Returns the local residual of a sub-control volume.

Parameters
dofIdxThe local index of the sub control volume

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::residual_.

template<class TypeTag >
const VectorBlock& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::residualStorage ( int  dofIdx) const
inline

Returns the local storage term of a sub-control volume.

Parameters
dofIdxThe local index of the sub control volume

References Ewoms::FvBaseAdLocalLinearizer< TypeTag >::residualStorage_.

template<class TypeTag >
const Simulator& Ewoms::FvBaseAdLocalLinearizer< TypeTag >::simulator_ ( ) const
inlineprotected
template<class TypeTag >
void Ewoms::FvBaseAdLocalLinearizer< TypeTag >::updateLocalLinearization_ ( const ElementContext &  elemCtx,
int  primaryDofIdx 
)
inlineprotected

Member Data Documentation

template<class TypeTag >
Model* Ewoms::FvBaseAdLocalLinearizer< TypeTag >::modelPtr_
protected

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