www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
RDGFluxBase Class Referenceabstract

Abstract base class for computing and caching internal or boundary fluxes for RDG. More...

#include <RDGFluxBase.h>

Inheritance diagram for RDGFluxBase:
[legend]

Public Member Functions

 RDGFluxBase (const InputParameters &parameters)
 
virtual void execute () override
 
virtual void initialize () override
 
virtual void finalize () override
 
virtual void threadJoin (const UserObject &) override
 
virtual const std::vector< Real > & getFlux (const unsigned int iside, const dof_id_type ielem, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal) const
 Gets the flux vector for an element/side combination. More...
 
virtual const DenseMatrix< Real > & getJacobian (const bool get_first_jacobian, const unsigned int iside, const dof_id_type ielem, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal) const
 Gets the flux Jacobian matrix for an element/side combination. More...
 
virtual void calcFlux (const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal, std::vector< Real > &flux) const =0
 Calculates the flux vector given "left" and "right" states. More...
 
virtual void calcJacobian (const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal, DenseMatrix< Real > &jac1, DenseMatrix< Real > &jac2) const =0
 Calculates the flux Jacobian matrices given "left" and "right" states. More...
 

Protected Attributes

unsigned int _cached_flux_elem_id
 element ID of the cached flux values More...
 
unsigned int _cached_flux_side_id
 side ID of the cached flux values More...
 
unsigned int _cached_jacobian_elem_id
 element ID of the cached Jacobian values More...
 
unsigned int _cached_jacobian_side_id
 side ID of the cached Jacobian values More...
 
std::vector< Real > _flux
 flux vector More...
 
DenseMatrix< Real > _jac1
 Jacobian matrix contribution to the "left" cell. More...
 
DenseMatrix< Real > _jac2
 Jacobian matrix contribution to the "right" cell. More...
 

Detailed Description

Abstract base class for computing and caching internal or boundary fluxes for RDG.

Here a call to compute flux computes the flux for all equations in the system, so to avoid duplicating the calculations, a wrapper is used to cache the system flux for an element/side combination.

Definition at line 27 of file RDGFluxBase.h.

Constructor & Destructor Documentation

◆ RDGFluxBase()

RDGFluxBase::RDGFluxBase ( const InputParameters &  parameters)

Definition at line 22 of file RDGFluxBase.C.

23  : ThreadedGeneralUserObject(parameters),
24  _cached_flux_elem_id(libMesh::invalid_uint),
25  _cached_flux_side_id(libMesh::invalid_uint),
26  _cached_jacobian_elem_id(libMesh::invalid_uint),
27  _cached_jacobian_side_id(libMesh::invalid_uint)
28 {
29 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
Definition: RDGFluxBase.h:118
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
Definition: RDGFluxBase.h:123
unsigned int _cached_jacobian_side_id
side ID of the cached Jacobian values
Definition: RDGFluxBase.h:125
unsigned int _cached_flux_side_id
side ID of the cached flux values
Definition: RDGFluxBase.h:120

Member Function Documentation

◆ calcFlux()

virtual void RDGFluxBase::calcFlux ( const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  normal,
std::vector< Real > &  flux 
) const
pure virtual

Calculates the flux vector given "left" and "right" states.

This function is called only if the values are not already cached.

Parameters
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]normalvector of unit normal
[out]fluxflux vector

Referenced by getFlux().

◆ calcJacobian()

virtual void RDGFluxBase::calcJacobian ( const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  normal,
DenseMatrix< Real > &  jac1,
DenseMatrix< Real > &  jac2 
) const
pure virtual

Calculates the flux Jacobian matrices given "left" and "right" states.

This function is called only if the values are not already cached.

Parameters
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]normalvector of unit normal
[out]jac1Jacobian matrix contribution to the "left" cell
[out]jac2Jacobian matrix contribution to the "right" cell

Referenced by getJacobian().

◆ execute()

void RDGFluxBase::execute ( )
overridevirtual

Definition at line 41 of file RDGFluxBase.C.

42 {
43 }

◆ finalize()

void RDGFluxBase::finalize ( )
overridevirtual

Definition at line 46 of file RDGFluxBase.C.

47 {
48 }

◆ getFlux()

const std::vector< Real > & RDGFluxBase::getFlux ( const unsigned int  iside,
const dof_id_type  ielem,
const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  normal 
) const
virtual

Gets the flux vector for an element/side combination.

If the element/side is cached, the cached values are used. Otherwise the values are computed, cached, and returned.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]normalvector of unit normal
Returns
flux vector for an element/side combination

Definition at line 56 of file RDGFluxBase.C.

61 {
62  if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside)
63  {
64  _cached_flux_elem_id = ielem;
65  _cached_flux_side_id = iside;
66 
67  calcFlux(uvec1, uvec2, normal, _flux);
68  }
69  return _flux;
70 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
Definition: RDGFluxBase.h:118
virtual void calcFlux(const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal, std::vector< Real > &flux) const =0
Calculates the flux vector given "left" and "right" states.
std::vector< Real > _flux
flux vector
Definition: RDGFluxBase.h:128
unsigned int _cached_flux_side_id
side ID of the cached flux values
Definition: RDGFluxBase.h:120

◆ getJacobian()

const DenseMatrix< Real > & RDGFluxBase::getJacobian ( const bool  get_first_jacobian,
const unsigned int  iside,
const dof_id_type  ielem,
const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  normal 
) const
virtual

Gets the flux Jacobian matrix for an element/side combination.

If the element/side is cached, the cached values are used. Otherwise the values are computed, cached, and returned. The user decides which Jacobian to receive (either with respect to first solution vector or second solution vector). If the user wants both, then the function can just be called a second time with the other Jacobian requested - since that Jacobian is already cached, no redundant calculations will occur.

Parameters
[in]get_first_jacobianget the Jacobian w.r.t. the first solution; else get the Jacobian w.r.t. the second solution
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]normalvector of unit normal
Returns
flux Jacobian matrix for an element/side combination

Definition at line 73 of file RDGFluxBase.C.

79 {
80  if (_cached_jacobian_elem_id != ielem || _cached_jacobian_side_id != iside)
81  {
84 
85  calcJacobian(uvec1, uvec2, normal, _jac1, _jac2);
86  }
87 
88  if (get_first_jacobian)
89  return _jac1;
90  else
91  return _jac2;
92 }
DenseMatrix< Real > _jac1
Jacobian matrix contribution to the "left" cell.
Definition: RDGFluxBase.h:130
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
Definition: RDGFluxBase.h:123
unsigned int _cached_jacobian_side_id
side ID of the cached Jacobian values
Definition: RDGFluxBase.h:125
DenseMatrix< Real > _jac2
Jacobian matrix contribution to the "right" cell.
Definition: RDGFluxBase.h:132
virtual void calcJacobian(const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal, DenseMatrix< Real > &jac1, DenseMatrix< Real > &jac2) const =0
Calculates the flux Jacobian matrices given "left" and "right" states.

◆ initialize()

void RDGFluxBase::initialize ( )
overridevirtual

Definition at line 32 of file RDGFluxBase.C.

33 {
34  _cached_flux_elem_id = libMesh::invalid_uint;
35  _cached_flux_side_id = libMesh::invalid_uint;
36  _cached_jacobian_elem_id = libMesh::invalid_uint;
37  _cached_jacobian_side_id = libMesh::invalid_uint;
38 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
Definition: RDGFluxBase.h:118
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
Definition: RDGFluxBase.h:123
unsigned int _cached_jacobian_side_id
side ID of the cached Jacobian values
Definition: RDGFluxBase.h:125
unsigned int _cached_flux_side_id
side ID of the cached flux values
Definition: RDGFluxBase.h:120

◆ threadJoin()

void RDGFluxBase::threadJoin ( const UserObject &  )
overridevirtual

Definition at line 51 of file RDGFluxBase.C.

52 {
53 }

Member Data Documentation

◆ _cached_flux_elem_id

unsigned int RDGFluxBase::_cached_flux_elem_id
mutableprotected

element ID of the cached flux values

Definition at line 118 of file RDGFluxBase.h.

Referenced by getFlux(), and initialize().

◆ _cached_flux_side_id

unsigned int RDGFluxBase::_cached_flux_side_id
mutableprotected

side ID of the cached flux values

Definition at line 120 of file RDGFluxBase.h.

Referenced by getFlux(), and initialize().

◆ _cached_jacobian_elem_id

unsigned int RDGFluxBase::_cached_jacobian_elem_id
mutableprotected

element ID of the cached Jacobian values

Definition at line 123 of file RDGFluxBase.h.

Referenced by getJacobian(), and initialize().

◆ _cached_jacobian_side_id

unsigned int RDGFluxBase::_cached_jacobian_side_id
mutableprotected

side ID of the cached Jacobian values

Definition at line 125 of file RDGFluxBase.h.

Referenced by getJacobian(), and initialize().

◆ _flux

std::vector<Real> RDGFluxBase::_flux
mutableprotected

flux vector

Definition at line 128 of file RDGFluxBase.h.

Referenced by getFlux().

◆ _jac1

DenseMatrix<Real> RDGFluxBase::_jac1
mutableprotected

Jacobian matrix contribution to the "left" cell.

Definition at line 130 of file RDGFluxBase.h.

Referenced by getJacobian().

◆ _jac2

DenseMatrix<Real> RDGFluxBase::_jac2
mutableprotected

Jacobian matrix contribution to the "right" cell.

Definition at line 132 of file RDGFluxBase.h.

Referenced by getJacobian().


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