This class stores an array of IntensiveQuantities objects, one intensive quantities object for each of the element's vertices. More...

#include <fvbaseelementcontext.hh>

Public Member Functions

 FvBaseElementContext (const Simulator &simulator)
 The constructor. More...
 
void updateAll (const Element &elem)
 Construct all volume and extensive quantities of an element from scratch. More...
 
void updateStencil (const Element &elem)
 Compute the finite volume geometry for an element. More...
 
void updatePrimaryStencil (const Element &elem)
 Update the primary topological part of the stencil, but nothing else. More...
 
void updateStencilTopology (const Element &elem)
 Update the topological part of the stencil, but nothing else. More...
 
void updateAllIntensiveQuantities ()
 Compute the intensive quantities of all sub-control volumes of the current element for all time indices. More...
 
void updateIntensiveQuantities (unsigned timeIdx)
 Compute the intensive quantities of all sub-control volumes of the current element for a single time index. More...
 
void updatePrimaryIntensiveQuantities (unsigned timeIdx)
 Compute the intensive quantities of all sub-control volumes of the current element for a single time index. More...
 
void updateIntensiveQuantities (const PrimaryVariables &priVars, unsigned dofIdx, unsigned timeIdx)
 Compute the intensive quantities of a single sub-control volume of the current element for a single time index. More...
 
void updateAllExtensiveQuantities ()
 Compute the extensive quantities of all sub-control volume faces of the current element for all time indices. More...
 
void updateExtensiveQuantities (unsigned timeIdx)
 Compute the extensive quantities of all sub-control volume faces of the current element for a single time index. More...
 
void setFocusDofIndex (unsigned dofIdx)
 Sets the degree of freedom on which the simulator is currently "focused" on. More...
 
unsigned focusDofIndex () const
 Returns the degree of freedom on which the simulator is currently "focused" on. More...
 
LinearizationType linearizationType () const
 Returns the linearization type. More...
 
const Simulator & simulator () const
 Return a reference to the simulator. More...
 
const Problem & problem () const
 Return a reference to the problem. More...
 
const Model & model () const
 Return a reference to the model. More...
 
const GridView & gridView () const
 Return a reference to the grid view. More...
 
const Element & element () const
 Return the current element. More...
 
size_t numDof (unsigned timeIdx) const
 Return the number of sub-control volumes of the current element. More...
 
size_t numPrimaryDof (unsigned timeIdx) const
 Return the number of primary degrees of freedom of the current element. More...
 
size_t numInteriorFaces (unsigned timeIdx) const
 Return the number of non-boundary faces which need to be considered for the flux apporixmation. More...
 
size_t numBoundaryFaces (unsigned timeIdx) const
 Return the number of boundary faces which need to be considered for the flux apporixmation. More...
 
const Stencil & stencil (unsigned) const
 Return the current finite element geometry. More...
 
decltype(auto) pos (unsigned dofIdx, unsigned) const
 Return the position of a local entities in global coordinates. More...
 
unsigned globalSpaceIndex (unsigned dofIdx, unsigned timeIdx) const
 Return the global spatial index for a sub-control volume. More...
 
Scalar dofVolume (unsigned dofIdx, unsigned timeIdx) const
 Return the element-local volume associated with a degree of freedom. More...
 
Scalar dofTotalVolume (unsigned dofIdx, unsigned timeIdx) const
 Return the total volume associated with a degree of freedom. More...
 
bool onBoundary () const
 Returns whether the current element is on the domain's boundary. More...
 
const IntensiveQuantities & intensiveQuantities (unsigned dofIdx, unsigned timeIdx) const
 Return a reference to the intensive quantities of a sub-control volume at a given time. More...
 
const IntensiveQuantities * thermodynamicHint (unsigned dofIdx, unsigned timeIdx) const
 Return the thermodynamic hint for a given local index. More...
 
IntensiveQuantities & intensiveQuantities (unsigned dofIdx, unsigned timeIdx)
 Return a reference to the intensive quantities of a sub-control volume at a given time. More...
 
const PrimaryVariables & primaryVars (unsigned dofIdx, unsigned timeIdx) const
 Return the primary variables for a given local index. More...
 
bool haveStashedIntensiveQuantities () const
 Returns true if no intensive quanties are stashed. More...
 
int stashedDofIdx () const
 Return the (local) index of the DOF for which the primary variables were stashed. More...
 
void stashIntensiveQuantities (unsigned dofIdx)
 Stash the intensive quantities for a degree of freedom on internal memory. More...
 
void restoreIntensiveQuantities (unsigned dofIdx)
 Restores the intensive quantities for a degree of freedom from internal memory. More...
 
const GradientCalculator & gradientCalculator () const
 Return a reference to the gradient calculation class of the chosen spatial discretization. More...
 
const ExtensiveQuantities & extensiveQuantities (unsigned fluxIdx, unsigned) const
 Return a reference to the extensive quantities of a sub-control volume face. More...
 
bool enableStorageCache () const
 Returns true iff the cache for the storage term ought to be used for this context. More...
 
void setEnableStorageCache (bool yesno)
 Specifies if the cache for the storage term ought to be used for this context. More...
 

Static Public Member Functions

static void * operator new (size_t size)
 
static void operator delete (void *ptr)
 

Protected Member Functions

void updateIntensiveQuantities_ (unsigned timeIdx, size_t numDof)
 Update the first 'n' intensive quantities objects from the primary variables. More...
 
void updateSingleIntQuants_ (const PrimaryVariables &priVars, unsigned dofIdx, unsigned timeIdx)
 

Protected Attributes

IntensiveQuantities intensiveQuantitiesStashed_
 
PrimaryVariables priVarsStashed_
 
GradientCalculator gradientCalculator_
 
std::vector< DofStore_, aligned_allocator< DofStore_, alignof(DofStore_)> > dofVars_
 
std::vector< ExtensiveQuantities, aligned_allocator< ExtensiveQuantities, alignof(ExtensiveQuantities)> > extensiveQuantities_
 
const Simulator * simulatorPtr_
 
const Element * elemPtr_
 
const GridView gridView_
 
Stencil stencil_
 
int stashedDofIdx_
 
int focusDofIdx_
 
bool enableStorageCache_
 

Detailed Description

template<class TypeTag>
class Opm::FvBaseElementContext< TypeTag >

This class stores an array of IntensiveQuantities objects, one intensive quantities object for each of the element's vertices.

Constructor & Destructor Documentation

◆ FvBaseElementContext()

Member Function Documentation

◆ dofTotalVolume()

template<class TypeTag >
Scalar Opm::FvBaseElementContext< TypeTag >::dofTotalVolume ( unsigned  dofIdx,
unsigned  timeIdx 
) const
inline

Return the total volume associated with a degree of freedom.

"Total" means the volume controlled by a degree of freedom disregarding the element. (For example in the vertex-centered finite volume method, a control volume typically encompasses parts of multiple elements.)

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::globalSpaceIndex(), and Opm::FvBaseElementContext< TypeTag >::model().

◆ dofVolume()

template<class TypeTag >
Scalar Opm::FvBaseElementContext< TypeTag >::dofVolume ( unsigned  dofIdx,
unsigned  timeIdx 
) const
inline

Return the element-local volume associated with a degree of freedom.

In the case of the vertex-centered finite volume method, this is different from the total volume because a finite volume usually spans multiple elements...

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::stencil().

◆ element()

template<class TypeTag >
const Element & Opm::FvBaseElementContext< TypeTag >::element ( ) const
inline

◆ enableStorageCache()

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

Returns true iff the cache for the storage term ought to be used for this context.

If it is used, intensive quantities can only be accessed for the most recent time index. (time index 0.)

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

◆ extensiveQuantities()

template<class TypeTag >
const ExtensiveQuantities & Opm::FvBaseElementContext< TypeTag >::extensiveQuantities ( unsigned  fluxIdx,
unsigned   
) const
inline

Return a reference to the extensive quantities of a sub-control volume face.

Parameters
fluxIdxThe local index of the sub-control volume face for which the extensive quantities are requested
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::extensiveQuantities_.

◆ focusDofIndex()

template<class TypeTag >
unsigned Opm::FvBaseElementContext< TypeTag >::focusDofIndex ( ) const
inline

Returns the degree of freedom on which the simulator is currently "focused" on.

References Opm::FvBaseElementContext< TypeTag >::focusDofIdx_.

◆ globalSpaceIndex()

template<class TypeTag >
unsigned Opm::FvBaseElementContext< TypeTag >::globalSpaceIndex ( unsigned  dofIdx,
unsigned  timeIdx 
) const
inline

Return the global spatial index for a sub-control volume.

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::stencil().

Referenced by Opm::FvBaseElementContext< TypeTag >::dofTotalVolume(), and Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities_().

◆ gradientCalculator()

template<class TypeTag >
const GradientCalculator & Opm::FvBaseElementContext< TypeTag >::gradientCalculator ( ) const
inline

Return a reference to the gradient calculation class of the chosen spatial discretization.

References Opm::FvBaseElementContext< TypeTag >::gradientCalculator_.

◆ gridView()

template<class TypeTag >
const GridView & Opm::FvBaseElementContext< TypeTag >::gridView ( ) const
inline

Return a reference to the grid view.

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

◆ haveStashedIntensiveQuantities()

template<class TypeTag >
bool Opm::FvBaseElementContext< TypeTag >::haveStashedIntensiveQuantities ( ) const
inline

Returns true if no intensive quanties are stashed.

In most cases quantities are stashed only if a partial derivative is to be calculated via finite difference methods.

References Opm::FvBaseElementContext< TypeTag >::stashedDofIdx_.

◆ intensiveQuantities() [1/2]

template<class TypeTag >
IntensiveQuantities & Opm::FvBaseElementContext< TypeTag >::intensiveQuantities ( unsigned  dofIdx,
unsigned  timeIdx 
)
inline

Return a reference to the intensive quantities of a sub-control volume at a given time.

If the time step index is not given, return the volume variables for the current time.

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, and Opm::FvBaseElementContext< TypeTag >::numDof().

◆ intensiveQuantities() [2/2]

template<class TypeTag >
const IntensiveQuantities & Opm::FvBaseElementContext< TypeTag >::intensiveQuantities ( unsigned  dofIdx,
unsigned  timeIdx 
) const
inline

Return a reference to the intensive quantities of a sub-control volume at a given time.

If the time step index is not given, return the volume variables for the current time.

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, Opm::FvBaseElementContext< TypeTag >::enableStorageCache_, Opm::FvBaseElementContext< TypeTag >::numDof(), and Opm::FvBaseElementContext< TypeTag >::problem().

Referenced by Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities_().

◆ linearizationType()

template<class TypeTag >
LinearizationType Opm::FvBaseElementContext< TypeTag >::linearizationType ( ) const
inline

Returns the linearization type.

References Opm::FvBaseElementContext< TypeTag >::model().

◆ model()

◆ numBoundaryFaces()

template<class TypeTag >
size_t Opm::FvBaseElementContext< TypeTag >::numBoundaryFaces ( unsigned  timeIdx) const
inline

Return the number of boundary faces which need to be considered for the flux apporixmation.

References Opm::FvBaseElementContext< TypeTag >::stencil().

◆ numDof()

◆ numInteriorFaces()

template<class TypeTag >
size_t Opm::FvBaseElementContext< TypeTag >::numInteriorFaces ( unsigned  timeIdx) const
inline

Return the number of non-boundary faces which need to be considered for the flux apporixmation.

References Opm::FvBaseElementContext< TypeTag >::stencil().

Referenced by Opm::FvBaseElementContext< TypeTag >::updateExtensiveQuantities().

◆ numPrimaryDof()

template<class TypeTag >
size_t Opm::FvBaseElementContext< TypeTag >::numPrimaryDof ( unsigned  timeIdx) const
inline

Return the number of primary degrees of freedom of the current element.

References Opm::FvBaseElementContext< TypeTag >::stencil().

Referenced by Opm::FvBaseElementContext< TypeTag >::updatePrimaryIntensiveQuantities().

◆ onBoundary()

template<class TypeTag >
bool Opm::FvBaseElementContext< TypeTag >::onBoundary ( ) const
inline

Returns whether the current element is on the domain's boundary.

References Opm::FvBaseElementContext< TypeTag >::element().

◆ operator delete()

template<class TypeTag >
static void Opm::FvBaseElementContext< TypeTag >::operator delete ( void *  ptr)
inlinestatic

References Opm::aligned_free().

◆ operator new()

template<class TypeTag >
static void * Opm::FvBaseElementContext< TypeTag >::operator new ( size_t  size)
inlinestatic

References Opm::aligned_alloc().

◆ pos()

template<class TypeTag >
decltype(auto) Opm::FvBaseElementContext< TypeTag >::pos ( unsigned  dofIdx,
unsigned   
) const
inline

Return the position of a local entities in global coordinates.

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::stencil_.

◆ primaryVars()

template<class TypeTag >
const PrimaryVariables & Opm::FvBaseElementContext< TypeTag >::primaryVars ( unsigned  dofIdx,
unsigned  timeIdx 
) const
inline

Return the primary variables for a given local index.

Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, and Opm::FvBaseElementContext< TypeTag >::numDof().

◆ problem()

template<class TypeTag >
const Problem & Opm::FvBaseElementContext< TypeTag >::problem ( ) const
inline

◆ restoreIntensiveQuantities()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::restoreIntensiveQuantities ( unsigned  dofIdx)
inline

Restores the intensive quantities for a degree of freedom from internal memory.

Parameters
dofIdxThe local index of the degree of freedom in the current element.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, Opm::FvBaseElementContext< TypeTag >::intensiveQuantitiesStashed_, Opm::FvBaseElementContext< TypeTag >::priVarsStashed_, and Opm::FvBaseElementContext< TypeTag >::stashedDofIdx_.

◆ setEnableStorageCache()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::setEnableStorageCache ( bool  yesno)
inline

Specifies if the cache for the storage term ought to be used for this context.

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

◆ setFocusDofIndex()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::setFocusDofIndex ( unsigned  dofIdx)
inline

Sets the degree of freedom on which the simulator is currently "focused" on.

I.e., in the case of automatic differentiation, all derivatives are with regard to the primary variables of that degree of freedom. Only "primary" DOFs can be focused on.

References Opm::FvBaseElementContext< TypeTag >::focusDofIdx_.

◆ simulator()

template<class TypeTag >
const Simulator & Opm::FvBaseElementContext< TypeTag >::simulator ( ) const
inline

◆ stashedDofIdx()

template<class TypeTag >
int Opm::FvBaseElementContext< TypeTag >::stashedDofIdx ( ) const
inline

Return the (local) index of the DOF for which the primary variables were stashed.

If none, then this returns -1.

References Opm::FvBaseElementContext< TypeTag >::stashedDofIdx_.

◆ stashIntensiveQuantities()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::stashIntensiveQuantities ( unsigned  dofIdx)
inline

Stash the intensive quantities for a degree of freedom on internal memory.

Parameters
dofIdxThe local index of the degree of freedom in the current element.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, Opm::FvBaseElementContext< TypeTag >::intensiveQuantitiesStashed_, Opm::FvBaseElementContext< TypeTag >::numDof(), Opm::FvBaseElementContext< TypeTag >::priVarsStashed_, and Opm::FvBaseElementContext< TypeTag >::stashedDofIdx_.

◆ stencil()

template<class TypeTag >
const Stencil & Opm::FvBaseElementContext< TypeTag >::stencil ( unsigned  ) const
inline

◆ thermodynamicHint()

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

Return the thermodynamic hint for a given local index.

See also
Discretization::thermodynamicHint(int, int)
Parameters
dofIdxThe local index of the degree of freedom in the current element.
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, and Opm::FvBaseElementContext< TypeTag >::numDof().

◆ updateAll()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateAll ( const Element &  elem)
inline

Construct all volume and extensive quantities of an element from scratch.

Parameters
elemThe DUNE Codim<0> entity for which the volume variables ought to be calculated

◆ updateAllExtensiveQuantities()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateAllExtensiveQuantities ( )
inline

Compute the extensive quantities of all sub-control volume faces of the current element for all time indices.

◆ updateAllIntensiveQuantities()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateAllIntensiveQuantities ( )
inline

Compute the intensive quantities of all sub-control volumes of the current element for all time indices.

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

◆ updateExtensiveQuantities()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateExtensiveQuantities ( unsigned  timeIdx)
inline

Compute the extensive quantities of all sub-control volume faces of the current element for a single time index.

Parameters
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::extensiveQuantities_, Opm::FvBaseElementContext< TypeTag >::gradientCalculator_, and Opm::FvBaseElementContext< TypeTag >::numInteriorFaces().

◆ updateIntensiveQuantities() [1/2]

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities ( const PrimaryVariables &  priVars,
unsigned  dofIdx,
unsigned  timeIdx 
)
inline

Compute the intensive quantities of a single sub-control volume of the current element for a single time index.

Parameters
priVarsThe PrimaryVariables which should be used to calculate the intensive quantities.
dofIdxThe local index in the current element of the sub-control volume which should be updated.
timeIdxThe index of the solution vector used by the time discretization.

◆ updateIntensiveQuantities() [2/2]

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities ( unsigned  timeIdx)
inline

Compute the intensive quantities of all sub-control volumes of the current element for a single time index.

Parameters
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::numDof(), and Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities_().

◆ updateIntensiveQuantities_()

◆ updatePrimaryIntensiveQuantities()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updatePrimaryIntensiveQuantities ( unsigned  timeIdx)
inline

Compute the intensive quantities of all sub-control volumes of the current element for a single time index.

Parameters
timeIdxThe index of the solution vector used by the time discretization.

References Opm::FvBaseElementContext< TypeTag >::numPrimaryDof(), and Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities_().

◆ updatePrimaryStencil()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updatePrimaryStencil ( const Element &  elem)
inline

Update the primary topological part of the stencil, but nothing else.

Parameters
elemThe grid element for which the finite volume geometry ought to be computed.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, Opm::FvBaseElementContext< TypeTag >::elemPtr_, and Opm::FvBaseElementContext< TypeTag >::stencil_.

◆ updateSingleIntQuants_()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateSingleIntQuants_ ( const PrimaryVariables &  priVars,
unsigned  dofIdx,
unsigned  timeIdx 
)
inlineprotected

◆ updateStencil()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateStencil ( const Element &  elem)
inline

Compute the finite volume geometry for an element.

Parameters
elemThe grid element for which the finite volume geometry ought to be computed.

References Opm::FvBaseElementContext< TypeTag >::dofVars_, Opm::FvBaseElementContext< TypeTag >::elemPtr_, Opm::FvBaseElementContext< TypeTag >::extensiveQuantities_, and Opm::FvBaseElementContext< TypeTag >::stencil_.

◆ updateStencilTopology()

template<class TypeTag >
void Opm::FvBaseElementContext< TypeTag >::updateStencilTopology ( const Element &  elem)
inline

Update the topological part of the stencil, but nothing else.

Parameters
elemThe grid element for which the finite volume geometry ought to be computed.

References Opm::FvBaseElementContext< TypeTag >::elemPtr_, and Opm::FvBaseElementContext< TypeTag >::stencil_.

Member Data Documentation

◆ dofVars_

◆ elemPtr_

◆ enableStorageCache_

◆ extensiveQuantities_

template<class TypeTag >
std::vector<ExtensiveQuantities, aligned_allocator<ExtensiveQuantities, alignof(ExtensiveQuantities)> > Opm::FvBaseElementContext< TypeTag >::extensiveQuantities_
protected

◆ focusDofIdx_

◆ gradientCalculator_

template<class TypeTag >
GradientCalculator Opm::FvBaseElementContext< TypeTag >::gradientCalculator_
protected

◆ gridView_

template<class TypeTag >
const GridView Opm::FvBaseElementContext< TypeTag >::gridView_
protected

◆ intensiveQuantitiesStashed_

template<class TypeTag >
IntensiveQuantities Opm::FvBaseElementContext< TypeTag >::intensiveQuantitiesStashed_
protected

◆ priVarsStashed_

template<class TypeTag >
PrimaryVariables Opm::FvBaseElementContext< TypeTag >::priVarsStashed_
protected

◆ simulatorPtr_

◆ stashedDofIdx_

◆ stencil_


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