The base class for the finite volume discretization schemes. More...

#include <fvbasediscretization.hh>

Inheritance diagram for Opm::FvBaseDiscretization< TypeTag >:
Inheritance graph

Classes

class  BlockVectorWrapper
 

Public Member Functions

 FvBaseDiscretization (Simulator &simulator)
 
 ~FvBaseDiscretization ()
 
void finishInit ()
 Apply the initial conditions to the model. More...
 
bool enableGridAdaptation () const
 Returns whether the grid ought to be adapted to the solution during the simulation. More...
 
void applyInitialSolution ()
 Applies the initial solution for all degrees of freedom to which the model applies. More...
 
void prefetch (const Element &) const
 Allows to improve the performance by prefetching all data which is associated with a given element. More...
 
NewtonMethod & newtonMethod ()
 Returns the newton method object. More...
 
const NewtonMethod & newtonMethod () const
 Returns the newton method object. More...
 
const IntensiveQuantities * thermodynamicHint (unsigned globalIdx, unsigned timeIdx) const
 Return the thermodynamic hint for a entity on the grid at given time. More...
 
const IntensiveQuantities * cachedIntensiveQuantities (unsigned globalIdx, unsigned timeIdx) const
 Return the cached intensive quantities for a entity on the grid at given time. More...
 
void updateCachedIntensiveQuantities (const IntensiveQuantities &intQuants, unsigned globalIdx, unsigned timeIdx) const
 Update the intensive quantity cache for a entity on the grid at given time. More...
 
void setIntensiveQuantitiesCacheEntryValidity (unsigned globalIdx, unsigned timeIdx, bool newValue) const
 Invalidate the cache for a given intensive quantities object. More...
 
void invalidateIntensiveQuantitiesCache (unsigned timeIdx) const
 Invalidate the whole intensive quantity cache for time index. More...
 
void invalidateAndUpdateIntensiveQuantities (unsigned timeIdx) const
 
template<class GridViewType >
void invalidateAndUpdateIntensiveQuantities (unsigned timeIdx, const GridViewType &gridView) const
 
void shiftIntensiveQuantityCache (unsigned numSlots=1)
 Move the intensive quantities for a given time index to the back. More...
 
bool enableStorageCache () const
 Returns true iff the storage term is cached. More...
 
void setEnableStorageCache (bool enableStorageCache)
 Set the value of enable storage cache. More...
 
const EqVector & cachedStorage (unsigned globalIdx, unsigned timeIdx) const
 Retrieve an entry of the cache for the storage term. More...
 
void updateCachedStorage (unsigned globalIdx, unsigned timeIdx, const EqVector &value) const
 Set an entry of the cache for the storage term. More...
 
Scalar globalResidual (GlobalEqVector &dest, const SolutionVector &u) const
 Compute the global residual for an arbitrary solution vector. More...
 
Scalar globalResidual (GlobalEqVector &dest) const
 Compute the global residual for the current solution vector. More...
 
void globalStorage (EqVector &storage, unsigned timeIdx=0) const
 Compute the integral over the domain of the storage terms of all conservation quantities. More...
 
void checkConservativeness (Scalar tolerance=-1, bool verbose=false) const
 Ensure that the difference between the storage terms of the last and of the current time step is consistent with the source and boundary terms. More...
 
Scalar dofTotalVolume (unsigned globalIdx) const
 Returns the volume $\mathrm{[m^3]}$ of a given control volume. More...
 
bool isLocalDof (unsigned globalIdx) const
 Returns if the overlap of the volume ofa degree of freedom is non-zero. More...
 
Scalar gridTotalVolume () const
 Returns the volume $\mathrm{[m^3]}$ of the whole grid which represents the spatial domain. More...
 
const SolutionVector & solution (unsigned timeIdx) const
 Reference to the solution at a given history index as a block vector. More...
 
SolutionVector & solution (unsigned timeIdx)
 
const Linearizer & linearizer () const
 Returns the operator linearizer for the global jacobian of the problem. More...
 
Linearizer & linearizer ()
 Returns the object which linearizes the global system of equations at the current solution. More...
 
const LocalLinearizer & localLinearizer (unsigned openMpThreadId) const
 Returns the local jacobian which calculates the local stiffness matrix for an arbitrary element. More...
 
LocalLinearizer & localLinearizer (unsigned openMpThreadId)
 
const LocalResidual & localResidual (unsigned openMpThreadId) const
 Returns the object to calculate the local residual function. More...
 
LocalResidual & localResidual (unsigned openMpThreadId)
 
Scalar primaryVarWeight (unsigned globalDofIdx, unsigned pvIdx) const
 Returns the relative weight of a primary variable for calculating relative errors. More...
 
Scalar eqWeight (unsigned, unsigned) const
 Returns the relative weight of an equation. More...
 
Scalar relativeDofError (unsigned vertexIdx, const PrimaryVariables &pv1, const PrimaryVariables &pv2) const
 Returns the relative error between two vectors of primary variables. More...
 
bool update ()
 Try to progress the model to the next timestep. More...
 
void syncOverlap ()
 Syncronize the values of the primary variables on the degrees of freedom that overlap with the neighboring processes. More...
 
void updateBegin ()
 Called by the update() method before it tries to apply the newton method. This is primary a hook which the actual model can overload. More...
 
void updateSuccessful ()
 Called by the update() method if it was successful. More...
 
void adaptGrid ()
 Called by the update() method when the grid should be refined. More...
 
void updateFailed ()
 Called by the update() method if it was unsuccessful. This is primary a hook which the actual model can overload. More...
 
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. More...
 
template<class Restarter >
void serialize (Restarter &)
 Serializes the current state of the model. More...
 
template<class Restarter >
void deserialize (Restarter &)
 Deserializes the state of the model. More...
 
template<class DofEntity >
void serializeEntity (std::ostream &outstream, const DofEntity &dof)
 Write the current solution for a degree of freedom to a restart file. More...
 
template<class DofEntity >
void deserializeEntity (std::istream &instream, const DofEntity &dof)
 Reads the current solution variables for a degree of freedom from a restart file. More...
 
size_t numGridDof () const
 Returns the number of degrees of freedom (DOFs) for the computational grid. More...
 
size_t numAuxiliaryDof () const
 Returns the number of degrees of freedom (DOFs) of the auxiliary equations. More...
 
size_t numTotalDof () const
 Returns the total number of degrees of freedom (i.e., grid plux auxiliary DOFs) More...
 
const DofMapper & dofMapper () const
 Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices. More...
 
const VertexMapper & vertexMapper () const
 Returns the mapper for vertices to indices. More...
 
const ElementMapper & elementMapper () const
 Returns the mapper for elements to indices. More...
 
void resetLinearizer ()
 Resets the Jacobian matrix linearizer, so that the boundary types can be altered. More...
 
std::string primaryVarName (unsigned pvIdx) const
 Given an primary variable index, return a human readable name. More...
 
std::string eqName (unsigned eqIdx) const
 Given an equation index, return a human readable name. More...
 
void updatePVWeights (const ElementContext &) const
 Update the weights of all primary variables within an element given the complete set of intensive quantities. More...
 
void addOutputModule (BaseOutputModule< TypeTag > *newModule)
 Add an module for writing visualization output after a timestep. More...
 
template<class VtkMultiWriter >
void addConvergenceVtkFields (VtkMultiWriter &writer, const SolutionVector &u, const GlobalEqVector &deltaU) const
 Add the vector fields for analysing the convergence of the newton method to the a VTK writer. More...
 
void prepareOutputFields () const
 Prepare the quantities relevant for the current solution to be appended to the output writers. More...
 
void appendOutputFields (BaseOutputWriter &writer) const
 Append the quantities relevant for the current solution to an output writer. More...
 
const GridView & gridView () const
 Reference to the grid view of the spatial domain. More...
 
void addAuxiliaryModule (BaseAuxiliaryModule< TypeTag > *auxMod)
 Add a module for an auxiliary equation. More...
 
void clearAuxiliaryModules ()
 Causes the list of auxiliary equations to be cleared. More...
 
size_t numAuxiliaryModules () const
 Returns the number of modules for auxiliary equations. More...
 
BaseAuxiliaryModule< TypeTag > * auxiliaryModule (unsigned auxEqModIdx)
 Returns a given module for auxiliary equations. More...
 
const BaseAuxiliaryModule< TypeTag > * auxiliaryModule (unsigned auxEqModIdx) const
 Returns a given module for auxiliary equations. More...
 
bool storeIntensiveQuantities () const
 Returns true if the cache for intensive quantities is enabled. More...
 
const TimerprePostProcessTimer () const
 
const TimerlinearizeTimer () const
 
const TimersolveTimer () const
 
const TimerupdateTimer () const
 
template<class Serializer >
void serializeOp (Serializer &serializer)
 
bool operator== (const FvBaseDiscretization &rhs) const
 

Static Public Member Functions

static void registerParameters ()
 Register all run-time parameters for the model. More...
 
static std::string discretizationName ()
 Returns a string of discretization's human-readable name. More...
 

Protected Member Functions

SolutionVector & mutableSolution (unsigned timeIdx) const
 
void resizeAndResetIntensiveQuantitiesCache_ ()
 
template<class Context >
void supplementInitialSolution_ (PrimaryVariables &, const Context &, unsigned, unsigned)
 
void registerOutputModules_ ()
 Register all output modules which make sense for the model. More...
 
LocalResidual & localResidual_ ()
 Reference to the local residal object. More...
 
bool verbose_ () const
 Returns whether messages should be printed. More...
 
Implementation & asImp_ ()
 
const Implementation & asImp_ () const
 

Protected Attributes

Simulator & simulator_
 
GridView gridView_
 
ElementMapper elementMapper_
 
VertexMapper vertexMapper_
 
std::vector< BaseAuxiliaryModule< TypeTag > * > auxEqModules_
 
NewtonMethod newtonMethod_
 
Timer prePostProcessTimer_
 
Timer linearizeTimer_
 
Timer solveTimer_
 
Timer updateTimer_
 
std::vector< LocalLinearizer > localLinearizer_
 
Linearizer * linearizer_
 
IntensiveQuantitiesVector intensiveQuantityCache_ [historySize]
 
std::vector< unsigned char > intensiveQuantityCacheUpToDate_ [historySize]
 
std::array< std::unique_ptr< DiscreteFunction >, historySize > solution_
 
std::list< BaseOutputModule< TypeTag > * > outputModules_
 
Scalar gridTotalVolume_
 
std::vector< Scalar > dofTotalVolume_
 
std::vector< bool > isLocalDof_
 
GlobalEqVector storageCache_ [historySize]
 
bool enableGridAdaptation_
 
bool enableIntensiveQuantityCache_
 
bool enableStorageCache_
 
bool enableThermodynamicHints_
 

Detailed Description

template<class TypeTag>
class Opm::FvBaseDiscretization< TypeTag >

The base class for the finite volume discretization schemes.

Constructor & Destructor Documentation

◆ FvBaseDiscretization()

◆ ~FvBaseDiscretization()

Member Function Documentation

◆ adaptGrid()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::adaptGrid ( )
inline

Called by the update() method when the grid should be refined.

◆ addAuxiliaryModule()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::addAuxiliaryModule ( BaseAuxiliaryModule< TypeTag > *  auxMod)
inline

Add a module for an auxiliary equation.

This module can add additional degrees of freedom and additional off-diagonal elements, but the number of equations per DOF needs to be the same as for the "main" model.

For example, auxiliary modules can be used to specify non-neighboring connections, well equations or model couplings via mortar DOFs. Auxiliary equations are completely optional, though.

References Opm::BaseAuxiliaryModule< TypeTag >::applyInitial(), Opm::FvBaseDiscretization< TypeTag >::auxEqModules_, Opm::FvBaseDiscretization< TypeTag >::enableGridAdaptation_, Opm::FvBaseDiscretization< TypeTag >::numTotalDof(), Opm::BaseAuxiliaryModule< TypeTag >::setDofOffset(), and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ addConvergenceVtkFields()

template<class TypeTag >
template<class VtkMultiWriter >
void Opm::FvBaseDiscretization< TypeTag >::addConvergenceVtkFields ( VtkMultiWriter writer,
const SolutionVector &  u,
const GlobalEqVector &  deltaU 
) const
inline

Add the vector fields for analysing the convergence of the newton method to the a VTK writer.

Parameters
writerThe writer object to which the fields should be added.
uThe solution function
deltaUThe delta of the solution function before and after the Newton update

References Opm::VtkMultiWriter< GridView, vtkFormat >::allocateManagedScalarBuffer(), Opm::FvBaseDiscretization< TypeTag >::asImp_(), and Opm::FvBaseDiscretization< TypeTag >::numGridDof().

◆ addOutputModule()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::addOutputModule ( BaseOutputModule< TypeTag > *  newModule)
inline

Add an module for writing visualization output after a timestep.

References Opm::FvBaseDiscretization< TypeTag >::outputModules_.

◆ advanceTimeLevel()

template<class TypeTag >
void Opm::FvBaseDiscretization< 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.

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), Opm::FvBaseDiscretization< TypeTag >::enableGridAdaptation_, and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ appendOutputFields()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::appendOutputFields ( BaseOutputWriter writer) const
inline

Append the quantities relevant for the current solution to an output writer.

References Opm::FvBaseDiscretization< TypeTag >::outputModules_.

◆ applyInitialSolution()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::applyInitialSolution ( )
inline

◆ asImp_() [1/2]

◆ asImp_() [2/2]

template<class TypeTag >
const Implementation & Opm::FvBaseDiscretization< TypeTag >::asImp_ ( ) const
inlineprotected

◆ auxiliaryModule() [1/2]

template<class TypeTag >
BaseAuxiliaryModule< TypeTag > * Opm::FvBaseDiscretization< TypeTag >::auxiliaryModule ( unsigned  auxEqModIdx)
inline

Returns a given module for auxiliary equations.

References Opm::FvBaseDiscretization< TypeTag >::auxEqModules_.

◆ auxiliaryModule() [2/2]

template<class TypeTag >
const BaseAuxiliaryModule< TypeTag > * Opm::FvBaseDiscretization< TypeTag >::auxiliaryModule ( unsigned  auxEqModIdx) const
inline

Returns a given module for auxiliary equations.

References Opm::FvBaseDiscretization< TypeTag >::auxEqModules_.

◆ cachedIntensiveQuantities()

template<class TypeTag >
const IntensiveQuantities * Opm::FvBaseDiscretization< TypeTag >::cachedIntensiveQuantities ( unsigned  globalIdx,
unsigned  timeIdx 
) const
inline

Return the cached intensive quantities for a entity on the grid at given time.

Attention
If no up-to date intensive quantities are available, this method will return 0.
Parameters
globalIdxThe global space index for the entity where a hint is requested.
timeIdxThe index used by the time discretization.

References Opm::FvBaseDiscretization< TypeTag >::enableIntensiveQuantityCache_, Opm::FvBaseDiscretization< TypeTag >::enableStorageCache_, Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCache_, and Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCacheUpToDate_.

Referenced by Opm::FvBaseDiscretization< TypeTag >::thermodynamicHint().

◆ cachedStorage()

template<class TypeTag >
const EqVector & Opm::FvBaseDiscretization< TypeTag >::cachedStorage ( unsigned  globalIdx,
unsigned  timeIdx 
) const
inline

Retrieve an entry of the cache for the storage term.

This is supposed to represent a DOF's total amount of conservation quantities per volume unit at a given time. The user is responsible for making sure that the value of this is correct and that it can be used before this method is called.

Parameters
globalDofIdxThe index of the relevant degree of freedom in a grid-global vector
timeIdxThe relevant index for the time discretization

References Opm::FvBaseDiscretization< TypeTag >::enableStorageCache_, and Opm::FvBaseDiscretization< TypeTag >::storageCache_.

◆ checkConservativeness()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::checkConservativeness ( Scalar  tolerance = -1,
bool  verbose = false 
) const
inline

Ensure that the difference between the storage terms of the last and of the current time step is consistent with the source and boundary terms.

This method is purely intented for debugging purposes. If the program is compiled with optimizations enabled, it becomes a no-op.

References Opm::FvBaseDiscretization< TypeTag >::globalStorage(), and Opm::FvBaseDiscretization< TypeTag >::simulator_.

◆ clearAuxiliaryModules()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::clearAuxiliaryModules ( )
inline

Causes the list of auxiliary equations to be cleared.

Note that this method implies recreateMatrix()

References Opm::FvBaseDiscretization< TypeTag >::auxEqModules_, Opm::FvBaseDiscretization< TypeTag >::linearizer_, and Opm::FvBaseDiscretization< TypeTag >::newtonMethod_.

◆ deserialize()

template<class TypeTag >
template<class Restarter >
void Opm::FvBaseDiscretization< TypeTag >::deserialize ( Restarter &  )
inline

Deserializes the state of the model.

Template Parameters
RestarterThe type of the serializer class
Parameters
resThe serializer object

◆ deserializeEntity()

template<class TypeTag >
template<class DofEntity >
void Opm::FvBaseDiscretization< TypeTag >::deserializeEntity ( std::istream &  instream,
const DofEntity &  dof 
)
inline

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

Parameters
instreamThe stream from which the vertex data should be deserialized from
dofThe Dune entity which's data should be deserialized

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ discretizationName()

template<class TypeTag >
static std::string Opm::FvBaseDiscretization< TypeTag >::discretizationName ( )
inlinestatic

Returns a string of discretization's human-readable name.

◆ dofMapper()

template<class TypeTag >
const DofMapper & Opm::FvBaseDiscretization< TypeTag >::dofMapper ( ) const
inline

Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices.

Referenced by Opm::FvBaseDiscretization< TypeTag >::finishInit(), and Opm::FvBaseDiscretization< TypeTag >::globalResidual().

◆ dofTotalVolume()

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::dofTotalVolume ( unsigned  globalIdx) const
inline

Returns the volume $\mathrm{[m^3]}$ of a given control volume.

Parameters
globalIdxThe global index of the degree of freedom

References Opm::FvBaseDiscretization< TypeTag >::dofTotalVolume_.

◆ elementMapper()

template<class TypeTag >
const ElementMapper & Opm::FvBaseDiscretization< TypeTag >::elementMapper ( ) const
inline

Returns the mapper for elements to indices.

References Opm::FvBaseDiscretization< TypeTag >::elementMapper_.

◆ enableGridAdaptation()

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::enableGridAdaptation ( ) const
inline

Returns whether the grid ought to be adapted to the solution during the simulation.

References Opm::FvBaseDiscretization< TypeTag >::enableGridAdaptation_.

◆ enableStorageCache()

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::enableStorageCache ( ) const
inline

Returns true iff the storage term is cached.

Be aware that calling the *CachedStorage() methods if the storage cache is disabled will crash the program.

References Opm::FvBaseDiscretization< TypeTag >::enableStorageCache_.

Referenced by Opm::FvBaseDiscretization< TypeTag >::resizeAndResetIntensiveQuantitiesCache_(), Opm::FvBaseDiscretization< TypeTag >::setEnableStorageCache(), and Opm::FvBaseDiscretization< TypeTag >::shiftIntensiveQuantityCache().

◆ eqName()

template<class TypeTag >
std::string Opm::FvBaseDiscretization< TypeTag >::eqName ( unsigned  eqIdx) const
inline

Given an equation index, return a human readable name.

Parameters
eqIdxThe index of the conservation equation of interest.

◆ eqWeight()

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::eqWeight ( unsigned  ,
unsigned   
) const
inline

Returns the relative weight of an equation.

Parameters
globalVertexIdxThe global index of the vertex
eqIdxThe index of the equation

◆ finishInit()

◆ globalResidual() [1/2]

◆ globalResidual() [2/2]

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::globalResidual ( GlobalEqVector &  dest,
const SolutionVector &  u 
) const
inline

Compute the global residual for an arbitrary solution vector.

Parameters
destStores the result
uThe solution for which the residual ought to be calculated

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), Opm::FvBaseDiscretization< TypeTag >::mutableSolution(), and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ globalStorage()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::globalStorage ( EqVector &  storage,
unsigned  timeIdx = 0 
) const
inline

◆ gridTotalVolume()

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::gridTotalVolume ( ) const
inline

Returns the volume $\mathrm{[m^3]}$ of the whole grid which represents the spatial domain.

References Opm::FvBaseDiscretization< TypeTag >::gridTotalVolume_.

◆ gridView()

◆ invalidateAndUpdateIntensiveQuantities() [1/2]

◆ invalidateAndUpdateIntensiveQuantities() [2/2]

◆ invalidateIntensiveQuantitiesCache()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::invalidateIntensiveQuantitiesCache ( unsigned  timeIdx) const
inline

◆ isLocalDof()

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::isLocalDof ( unsigned  globalIdx) const
inline

Returns if the overlap of the volume ofa degree of freedom is non-zero.

Parameters
globalIdxThe global index of the degree of freedom

References Opm::FvBaseDiscretization< TypeTag >::isLocalDof_.

◆ linearizer() [1/2]

template<class TypeTag >
Linearizer & Opm::FvBaseDiscretization< TypeTag >::linearizer ( )
inline

Returns the object which linearizes the global system of equations at the current solution.

References Opm::FvBaseDiscretization< TypeTag >::linearizer_.

◆ linearizer() [2/2]

template<class TypeTag >
const Linearizer & Opm::FvBaseDiscretization< TypeTag >::linearizer ( ) const
inline

Returns the operator linearizer for the global jacobian of the problem.

References Opm::FvBaseDiscretization< TypeTag >::linearizer_.

◆ linearizeTimer()

template<class TypeTag >
const Timer & Opm::FvBaseDiscretization< TypeTag >::linearizeTimer ( ) const
inline

◆ localLinearizer() [1/2]

template<class TypeTag >
LocalLinearizer & Opm::FvBaseDiscretization< TypeTag >::localLinearizer ( unsigned  openMpThreadId)
inline

◆ localLinearizer() [2/2]

template<class TypeTag >
const LocalLinearizer & Opm::FvBaseDiscretization< TypeTag >::localLinearizer ( unsigned  openMpThreadId) const
inline

Returns the local jacobian which calculates the local stiffness matrix for an arbitrary element.

The local stiffness matrices of the element are used by the jacobian linearizer to produce a global linerization of the problem.

References Opm::FvBaseDiscretization< TypeTag >::localLinearizer_.

◆ localResidual() [1/2]

template<class TypeTag >
LocalResidual & Opm::FvBaseDiscretization< TypeTag >::localResidual ( unsigned  openMpThreadId)
inline

◆ localResidual() [2/2]

template<class TypeTag >
const LocalResidual & Opm::FvBaseDiscretization< TypeTag >::localResidual ( unsigned  openMpThreadId) const
inline

Returns the object to calculate the local residual function.

References Opm::FvBaseDiscretization< TypeTag >::asImp_().

Referenced by Opm::FvBaseDiscretization< TypeTag >::globalStorage().

◆ localResidual_()

template<class TypeTag >
LocalResidual & Opm::FvBaseDiscretization< TypeTag >::localResidual_ ( )
inlineprotected

Reference to the local residal object.

References Opm::FvBaseDiscretization< TypeTag >::localLinearizer_.

◆ mutableSolution()

template<class TypeTag >
SolutionVector & Opm::FvBaseDiscretization< TypeTag >::mutableSolution ( unsigned  timeIdx) const
inlineprotected

◆ newtonMethod() [1/2]

template<class TypeTag >
NewtonMethod & Opm::FvBaseDiscretization< TypeTag >::newtonMethod ( )
inline

Returns the newton method object.

References Opm::FvBaseDiscretization< TypeTag >::newtonMethod_.

◆ newtonMethod() [2/2]

template<class TypeTag >
const NewtonMethod & Opm::FvBaseDiscretization< TypeTag >::newtonMethod ( ) const
inline

Returns the newton method object.

References Opm::FvBaseDiscretization< TypeTag >::newtonMethod_.

◆ numAuxiliaryDof()

template<class TypeTag >
size_t Opm::FvBaseDiscretization< TypeTag >::numAuxiliaryDof ( ) const
inline

Returns the number of degrees of freedom (DOFs) of the auxiliary equations.

References Opm::FvBaseDiscretization< TypeTag >::auxEqModules_.

Referenced by Opm::FvBaseDiscretization< TypeTag >::numTotalDof().

◆ numAuxiliaryModules()

template<class TypeTag >
size_t Opm::FvBaseDiscretization< TypeTag >::numAuxiliaryModules ( ) const
inline

Returns the number of modules for auxiliary equations.

References Opm::FvBaseDiscretization< TypeTag >::auxEqModules_.

◆ numGridDof()

template<class TypeTag >
size_t Opm::FvBaseDiscretization< TypeTag >::numGridDof ( ) const
inline

Returns the number of degrees of freedom (DOFs) for the computational grid.

Referenced by Opm::FvBaseDiscretization< TypeTag >::addConvergenceVtkFields().

◆ numTotalDof()

template<class TypeTag >
size_t Opm::FvBaseDiscretization< TypeTag >::numTotalDof ( ) const
inline

Returns the total number of degrees of freedom (i.e., grid plux auxiliary DOFs)

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), and Opm::FvBaseDiscretization< TypeTag >::numAuxiliaryDof().

Referenced by Opm::FvBaseDiscretization< TypeTag >::addAuxiliaryModule().

◆ operator==()

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::operator== ( const FvBaseDiscretization< TypeTag > &  rhs) const
inline

◆ prefetch()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::prefetch ( const Element &  ) const
inline

Allows to improve the performance by prefetching all data which is associated with a given element.

◆ prepareOutputFields()

◆ prePostProcessTimer()

template<class TypeTag >
const Timer & Opm::FvBaseDiscretization< TypeTag >::prePostProcessTimer ( ) const
inline

◆ primaryVarName()

template<class TypeTag >
std::string Opm::FvBaseDiscretization< TypeTag >::primaryVarName ( unsigned  pvIdx) const
inline

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

Parameters
pvIdxThe index of the primary variable of interest.

◆ primaryVarWeight()

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::primaryVarWeight ( unsigned  globalDofIdx,
unsigned  pvIdx 
) const
inline

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

Parameters
globalDofIdxThe global index of the degree of freedom
pvIdxThe index of the primary variable

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ registerOutputModules_()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::registerOutputModules_ ( )
inlineprotected

Register all output modules which make sense for the model.

This method is supposed to be overloaded by the actual models, or else only the primary variables can be written to the result files.

References Opm::FvBaseDiscretization< TypeTag >::outputModules_, and Opm::FvBaseDiscretization< TypeTag >::simulator_.

◆ registerParameters()

template<class TypeTag >
static void Opm::FvBaseDiscretization< TypeTag >::registerParameters ( )
inlinestatic

◆ relativeDofError()

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::relativeDofError ( unsigned  vertexIdx,
const PrimaryVariables &  pv1,
const PrimaryVariables &  pv2 
) const
inline

Returns the relative error between two vectors of primary variables.

Parameters
vertexIdxThe global index of the control volume's associated vertex
pv1The first vector of primary variables
pv2The second vector of primary variables

References Opm::FvBaseDiscretization< TypeTag >::asImp_().

◆ resetLinearizer()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::resetLinearizer ( )
inline

Resets the Jacobian matrix linearizer, so that the boundary types can be altered.

References Opm::FvBaseDiscretization< TypeTag >::linearizer_, and Opm::FvBaseDiscretization< TypeTag >::simulator_.

Referenced by Opm::FvBaseDiscretizationFemAdapt< TypeTag >::adaptGrid().

◆ resizeAndResetIntensiveQuantitiesCache_()

◆ serialize()

template<class TypeTag >
template<class Restarter >
void Opm::FvBaseDiscretization< TypeTag >::serialize ( Restarter &  )
inline

Serializes the current state of the model.

Template Parameters
RestarterThe type of the serializer class
Parameters
resThe serializer object

◆ serializeEntity()

template<class TypeTag >
template<class DofEntity >
void Opm::FvBaseDiscretization< TypeTag >::serializeEntity ( std::ostream &  outstream,
const DofEntity &  dof 
)
inline

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

Parameters
outstreamThe stream into which the vertex data should be serialized to
dofThe Dune entity which's data should be serialized

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ serializeOp()

template<class TypeTag >
template<class Serializer >
void Opm::FvBaseDiscretization< TypeTag >::serializeOp ( Serializer &  serializer)
inline

◆ setEnableStorageCache()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::setEnableStorageCache ( bool  enableStorageCache)
inline

Set the value of enable storage cache.

Be aware that calling the *CachedStorage() methods if the storage cache is disabled will crash the program.

References Opm::FvBaseDiscretization< TypeTag >::enableStorageCache(), and Opm::FvBaseDiscretization< TypeTag >::enableStorageCache_.

◆ setIntensiveQuantitiesCacheEntryValidity()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::setIntensiveQuantitiesCacheEntryValidity ( unsigned  globalIdx,
unsigned  timeIdx,
bool  newValue 
) const
inline

Invalidate the cache for a given intensive quantities object.

Parameters
globalIdxThe global space index for the entity where a hint is to be set.
timeIdxThe index used by the time discretization.

References Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCacheUpToDate_, and Opm::FvBaseDiscretization< TypeTag >::storeIntensiveQuantities().

Referenced by Opm::FvBaseDiscretization< TypeTag >::invalidateAndUpdateIntensiveQuantities().

◆ shiftIntensiveQuantityCache()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::shiftIntensiveQuantityCache ( unsigned  numSlots = 1)
inline

Move the intensive quantities for a given time index to the back.

This method should only be called by the time discretization.

Parameters
numSlotsThe number of time step slots for which the hints should be shifted.

References Opm::FvBaseDiscretization< TypeTag >::enableStorageCache(), Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCache_, Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCacheUpToDate_, Opm::FvBaseDiscretization< TypeTag >::simulator_, and Opm::FvBaseDiscretization< TypeTag >::storeIntensiveQuantities().

◆ solution() [1/2]

template<class TypeTag >
SolutionVector & Opm::FvBaseDiscretization< TypeTag >::solution ( unsigned  timeIdx)
inline

◆ solution() [2/2]

◆ solveTimer()

template<class TypeTag >
const Timer & Opm::FvBaseDiscretization< TypeTag >::solveTimer ( ) const
inline

◆ storeIntensiveQuantities()

◆ supplementInitialSolution_()

template<class TypeTag >
template<class Context >
void Opm::FvBaseDiscretization< TypeTag >::supplementInitialSolution_ ( PrimaryVariables &  ,
const Context &  ,
unsigned  ,
unsigned   
)
inlineprotected

◆ syncOverlap()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::syncOverlap ( )
inline

Syncronize the values of the primary variables on the degrees of freedom that overlap with the neighboring processes.

By default, this method does nothing...

◆ thermodynamicHint()

template<class TypeTag >
const IntensiveQuantities * Opm::FvBaseDiscretization< TypeTag >::thermodynamicHint ( unsigned  globalIdx,
unsigned  timeIdx 
) const
inline

Return the thermodynamic hint for a entity on the grid at given time.

The hint is defined as a IntensiveQuantities object which is supposed to be "close" to the IntensiveQuantities of the current solution. It can be used as a good starting point for non-linear solvers when having to solve non-linear relations while updating the intensive quantities. (This may yield a major performance boost depending on how the physical models require.)

Attention
If no up-to date intensive quantities are available, or if hints have been disabled, this method will return 0.
Parameters
globalIdxThe global space index for the entity where a hint is requested.
timeIdxThe index used by the time discretization.

References Opm::FvBaseDiscretization< TypeTag >::cachedIntensiveQuantities(), and Opm::FvBaseDiscretization< TypeTag >::enableThermodynamicHints_.

◆ update()

◆ updateBegin()

template<class TypeTag >
void Opm::FvBaseDiscretization< 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.

◆ updateCachedIntensiveQuantities()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::updateCachedIntensiveQuantities ( const IntensiveQuantities &  intQuants,
unsigned  globalIdx,
unsigned  timeIdx 
) const
inline

Update the intensive quantity cache for a entity on the grid at given time.

Parameters
intQuantsThe IntensiveQuantities object hint for a given degree of freedom.
globalIdxThe global space index for the entity where a hint is to be set.
timeIdxThe index used by the time discretization.

References Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCache_, Opm::FvBaseDiscretization< TypeTag >::intensiveQuantityCacheUpToDate_, and Opm::FvBaseDiscretization< TypeTag >::storeIntensiveQuantities().

◆ updateCachedStorage()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::updateCachedStorage ( unsigned  globalIdx,
unsigned  timeIdx,
const EqVector &  value 
) const
inline

Set an entry of the cache for the storage term.

This is supposed to represent a DOF's total amount of conservation quantities per volume unit at a given time. The user is responsible for making sure that the storage cache is enabled before this method is called.

Parameters
globalDofIdxThe index of the relevant degree of freedom in a grid-global vector
timeIdxThe relevant index for the time discretization
valueThe new value of the cache for the storage term

References Opm::FvBaseDiscretization< TypeTag >::enableStorageCache_, and Opm::FvBaseDiscretization< TypeTag >::storageCache_.

◆ updateFailed()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::updateFailed ( )
inline

Called by the update() method if it was unsuccessful. This is primary a hook which the actual model can overload.

References Opm::FvBaseDiscretization< TypeTag >::asImp_(), Opm::FvBaseDiscretization< TypeTag >::invalidateAndUpdateIntensiveQuantities(), and Opm::FvBaseDiscretization< TypeTag >::solution().

◆ updatePVWeights()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::updatePVWeights ( const ElementContext &  ) const
inline

Update the weights of all primary variables within an element given the complete set of intensive quantities.

◆ updateSuccessful()

template<class TypeTag >
void Opm::FvBaseDiscretization< TypeTag >::updateSuccessful ( )
inline

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

◆ updateTimer()

template<class TypeTag >
const Timer & Opm::FvBaseDiscretization< TypeTag >::updateTimer ( ) const
inline

◆ verbose_()

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::verbose_ ( ) const
inlineprotected

Returns whether messages should be printed.

References Opm::FvBaseDiscretization< TypeTag >::gridView_.

◆ vertexMapper()

template<class TypeTag >
const VertexMapper & Opm::FvBaseDiscretization< TypeTag >::vertexMapper ( ) const
inline

Returns the mapper for vertices to indices.

References Opm::FvBaseDiscretization< TypeTag >::vertexMapper_.

Member Data Documentation

◆ auxEqModules_

◆ dofTotalVolume_

template<class TypeTag >
std::vector<Scalar> Opm::FvBaseDiscretization< TypeTag >::dofTotalVolume_
protected

◆ elementMapper_

template<class TypeTag >
ElementMapper Opm::FvBaseDiscretization< TypeTag >::elementMapper_
protected

◆ enableGridAdaptation_

◆ enableIntensiveQuantityCache_

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::enableIntensiveQuantityCache_
protected

◆ enableStorageCache_

◆ enableThermodynamicHints_

template<class TypeTag >
bool Opm::FvBaseDiscretization< TypeTag >::enableThermodynamicHints_
protected

◆ gridTotalVolume_

template<class TypeTag >
Scalar Opm::FvBaseDiscretization< TypeTag >::gridTotalVolume_
protected

◆ gridView_

◆ intensiveQuantityCache_

◆ intensiveQuantityCacheUpToDate_

◆ isLocalDof_

template<class TypeTag >
std::vector<bool> Opm::FvBaseDiscretization< TypeTag >::isLocalDof_
protected

◆ linearizer_

◆ linearizeTimer_

template<class TypeTag >
Timer Opm::FvBaseDiscretization< TypeTag >::linearizeTimer_
protected

◆ localLinearizer_

◆ newtonMethod_

◆ outputModules_

◆ prePostProcessTimer_

template<class TypeTag >
Timer Opm::FvBaseDiscretization< TypeTag >::prePostProcessTimer_
protected

◆ simulator_

◆ solution_

◆ solveTimer_

template<class TypeTag >
Timer Opm::FvBaseDiscretization< TypeTag >::solveTimer_
protected

◆ storageCache_

◆ updateTimer_

template<class TypeTag >
Timer Opm::FvBaseDiscretization< TypeTag >::updateTimer_
protected

◆ vertexMapper_

template<class TypeTag >
VertexMapper Opm::FvBaseDiscretization< TypeTag >::vertexMapper_
protected

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