Loading...
Searching...
No Matches
Opm::FvBaseElementContext< TypeTag > Class Template Reference

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

## Static Public Member Functions

static void * | operator new (std::size_t size)
static void | operator delete (void *ptr)

## Protected Types

template<class T>
using | AlignedVector = std::vector<T, aligned_allocator<T, alignof(T)>>

## Protected Member Functions

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

## Protected Attributes

IntensiveQuantities | intensiveQuantitiesStashed_
PrimaryVariables | priVarsStashed_
GradientCalculator | gradientCalculator_
AlignedVector< DofStore_ > | dofVars_
AlignedVector< ExtensiveQuantities > | extensiveQuantities_
const Simulator * | simulatorPtr_ {}
const Element * | elemPtr_ {}
const GridView | gridView_
Stencil | stencil_
int | stashedDofIdx_ {-1}
int | focusDofIdx_ {-1}
bool | enableStorageCache_ {false}

## 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.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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.)

## 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

  fluxIdx | The local index of the sub-control volume face for which the extensive quantities are requested
  timeIdx | The index of the solution vector used by the time discretization.

## focusDofIndex()

template<class TypeTag>

unsigned Opm::FvBaseElementContext< TypeTag >::focusDofIndex | ( |  | ) | const

inline

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

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## linearizationType()

template<class TypeTag>

LinearizationType Opm::FvBaseElementContext< TypeTag >::linearizationType | ( |  | ) | const

inline

Returns the linearization type.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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

  dofIdx | The local index of the degree of freedom in the current element.

## 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.

## 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.

## 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

  dofIdx | The local index of the degree of freedom in the current element.

## stencil()

template<class TypeTag>

const Stencil & Opm::FvBaseElementContext< TypeTag >::stencil | ( | unsigned |  | ) | const

inline

Return the current finite element geometry.

Parameters

  timeIdx | The index of the solution vector used by the time discretization.

## 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

  dofIdx | The local index of the degree of freedom in the current element.
  timeIdx | The index of the solution vector used by the time discretization.

## 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

  elem | The DUNE Codim<0> entity for which the volume variables ought to be calculated

## 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

  timeIdx | The index of the solution vector used by the time discretization.

## 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

  priVars | The PrimaryVariables which should be used to calculate the intensive quantities.
  dofIdx | The local index in the current element of the sub-control volume which should be updated.
  timeIdx | The 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

  timeIdx | The index of the solution vector used by the time discretization.

## updateIntensiveQuantities_()

template<class TypeTag>

void Opm::FvBaseElementContext< TypeTag >::updateIntensiveQuantities_ | ( | unsigned | timeIdx,
|  | std::size_t | numDof )

inline protected

Update the first 'n' intensive quantities objects from the primary variables.

This method considers the intensive quantities cache.

## 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

  timeIdx | The index of the solution vector used by the time discretization.

## 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

  elem | The grid element for which the finite volume geometry ought to be computed.

## updateStencil()

template<class TypeTag>

void Opm::FvBaseElementContext< TypeTag >::updateStencil | ( | const Element & | elem | ) |

inline

Compute the finite volume geometry for an element.

Parameters

  elem | The grid element for which the finite volume geometry ought to be computed.

## updateStencilTopology()

template<class TypeTag>

void Opm::FvBaseElementContext< TypeTag >::updateStencilTopology | ( | const Element & | elem | ) |

inline

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

Parameters

  elem | The grid element for which the finite volume geometry ought to be computed.

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

- opm/models/discretization/common/fvbaseelementcontext.hh