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

A base class for computing and caching internal side flux. More...

#include <InternalSideFluxBase.h>

Inheritance diagram for InternalSideFluxBase:
[legend]

Public Member Functions

 InternalSideFluxBase (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 (unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave) const
 Get the flux vector. More...
 
virtual void calcFlux (unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave, std::vector< Real > &flux) const =0
 Solve the Riemann problem. More...
 
virtual const DenseMatrix< Real > & getJacobian (Moose::DGResidualType type, unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave) const
 Get the Jacobian matrix. More...
 
virtual void calcJacobian (unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave, DenseMatrix< Real > &jac1, DenseMatrix< Real > &jac2) const =0
 Compute the Jacobian matrix. More...
 

Protected Attributes

unsigned int _cached_flux_elem_id
 element ID of the cached flux values More...
 
unsigned int _cached_flux_neig_id
 neighbor element 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_neig_id
 neighbor element ID of the cached Jacobian values More...
 
std::vector< Real > _flux
 flux vector of this side 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

A base class for computing and caching internal side flux.

Notes:

  1. When solving a system of equations, fluxes are threated as vectors of all variables. To avoid recomputing the flux for each equation, we compute it once and store it. Then, when the flux is needed by another equation, this class just returns the cached value.
  2. Derived classes need to provide computing of the fluxes and their jacobians, i.e., they need to implement calcFlux and calcJacobian.

Definition at line 33 of file InternalSideFluxBase.h.

Constructor & Destructor Documentation

◆ InternalSideFluxBase()

InternalSideFluxBase::InternalSideFluxBase ( const InputParameters &  parameters)

Definition at line 21 of file InternalSideFluxBase.C.

22  : ThreadedGeneralUserObject(parameters),
23  _cached_flux_elem_id(libMesh::invalid_uint),
24  _cached_flux_neig_id(libMesh::invalid_uint),
25  _cached_jacobian_elem_id(libMesh::invalid_uint),
26  _cached_jacobian_neig_id(libMesh::invalid_uint)
27 {
28 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
unsigned int _cached_jacobian_neig_id
neighbor element ID of the cached Jacobian values
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
unsigned int _cached_flux_neig_id
neighbor element ID of the cached flux values

Member Function Documentation

◆ calcFlux()

virtual void InternalSideFluxBase::calcFlux ( unsigned int  iside,
dof_id_type  ielem,
dof_id_type  ineig,
const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  dwave,
std::vector< Real > &  flux 
) const
pure virtual

Solve the Riemann problem.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]ineigglobal index of the neighbor element
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]dwavevector of unit normal
[out]fluxflux vector across the side

Implemented in AEFVUpwindInternalSideFlux.

Referenced by getFlux().

◆ calcJacobian()

virtual void InternalSideFluxBase::calcJacobian ( unsigned int  iside,
dof_id_type  ielem,
dof_id_type  ineig,
const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  dwave,
DenseMatrix< Real > &  jac1,
DenseMatrix< Real > &  jac2 
) const
pure virtual

Compute the Jacobian matrix.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]ineigglobal index of the neighbor element
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]dwavevector of unit normal
[out]jac1Jacobian matrix contribution to the "left" cell
[out]jac2Jacobian matrix contribution to the "right" cell

Implemented in AEFVUpwindInternalSideFlux.

Referenced by getJacobian().

◆ execute()

void InternalSideFluxBase::execute ( )
overridevirtual

Definition at line 40 of file InternalSideFluxBase.C.

41 {
42 }

◆ finalize()

void InternalSideFluxBase::finalize ( )
overridevirtual

Definition at line 45 of file InternalSideFluxBase.C.

46 {
47 }

◆ getFlux()

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

Get the flux vector.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]ineigglobal index of the neighbor element
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]dwavevector of unit normal

Definition at line 55 of file InternalSideFluxBase.C.

Referenced by AEFVKernel::computeQpResidual().

61 {
62  if (_cached_flux_elem_id != ielem || _cached_flux_neig_id != ineig)
63  {
64  _cached_flux_elem_id = ielem;
65  _cached_flux_neig_id = ineig;
66 
67  calcFlux(iside, ielem, ineig, uvec1, uvec2, dwave, _flux);
68  }
69  return _flux;
70 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
virtual void calcFlux(unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave, std::vector< Real > &flux) const =0
Solve the Riemann problem.
std::vector< Real > _flux
flux vector of this side
unsigned int _cached_flux_neig_id
neighbor element ID of the cached flux values

◆ getJacobian()

const DenseMatrix< Real > & InternalSideFluxBase::getJacobian ( Moose::DGResidualType  type,
unsigned int  iside,
dof_id_type  ielem,
dof_id_type  ineig,
const std::vector< Real > &  uvec1,
const std::vector< Real > &  uvec2,
const RealVectorValue &  dwave 
) const
virtual

Get the Jacobian matrix.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]ineigglobal index of the neighbor element
[in]uvec1vector of variables on the "left"
[in]uvec2vector of variables on the "right"
[in]dwavevector of unit normal

Definition at line 73 of file InternalSideFluxBase.C.

Referenced by AEFVKernel::computeQpJacobian().

80 {
81  if (_cached_jacobian_elem_id != ielem || _cached_jacobian_neig_id != ineig)
82  {
85 
86  calcJacobian(iside, ielem, ineig, uvec1, uvec2, dwave, _jac1, _jac2);
87  }
88 
89  if (type == Moose::Element)
90  return _jac1;
91  else
92  return _jac2;
93 }
virtual void calcJacobian(unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave, DenseMatrix< Real > &jac1, DenseMatrix< Real > &jac2) const =0
Compute the Jacobian matrix.
unsigned int _cached_jacobian_neig_id
neighbor element ID of the cached Jacobian values
DenseMatrix< Real > _jac2
Jacobian matrix contribution to the "right" cell.
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
DenseMatrix< Real > _jac1
Jacobian matrix contribution to the "left" cell.

◆ initialize()

void InternalSideFluxBase::initialize ( )
overridevirtual

Definition at line 31 of file InternalSideFluxBase.C.

32 {
33  _cached_flux_elem_id = libMesh::invalid_uint;
34  _cached_flux_neig_id = libMesh::invalid_uint;
35  _cached_jacobian_elem_id = libMesh::invalid_uint;
36  _cached_jacobian_neig_id = libMesh::invalid_uint;
37 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
unsigned int _cached_jacobian_neig_id
neighbor element ID of the cached Jacobian values
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
unsigned int _cached_flux_neig_id
neighbor element ID of the cached flux values

◆ threadJoin()

void InternalSideFluxBase::threadJoin ( const UserObject &  )
overridevirtual

Definition at line 50 of file InternalSideFluxBase.C.

51 {
52 }

Member Data Documentation

◆ _cached_flux_elem_id

unsigned int InternalSideFluxBase::_cached_flux_elem_id
mutableprotected

element ID of the cached flux values

Definition at line 116 of file InternalSideFluxBase.h.

Referenced by getFlux(), and initialize().

◆ _cached_flux_neig_id

unsigned int InternalSideFluxBase::_cached_flux_neig_id
mutableprotected

neighbor element ID of the cached flux values

Definition at line 118 of file InternalSideFluxBase.h.

Referenced by getFlux(), and initialize().

◆ _cached_jacobian_elem_id

unsigned int InternalSideFluxBase::_cached_jacobian_elem_id
mutableprotected

element ID of the cached Jacobian values

Definition at line 121 of file InternalSideFluxBase.h.

Referenced by getJacobian(), and initialize().

◆ _cached_jacobian_neig_id

unsigned int InternalSideFluxBase::_cached_jacobian_neig_id
mutableprotected

neighbor element ID of the cached Jacobian values

Definition at line 123 of file InternalSideFluxBase.h.

Referenced by getJacobian(), and initialize().

◆ _flux

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

flux vector of this side

Definition at line 126 of file InternalSideFluxBase.h.

Referenced by getFlux().

◆ _jac1

DenseMatrix<Real> InternalSideFluxBase::_jac1
mutableprotected

Jacobian matrix contribution to the "left" cell.

Definition at line 128 of file InternalSideFluxBase.h.

Referenced by getJacobian().

◆ _jac2

DenseMatrix<Real> InternalSideFluxBase::_jac2
mutableprotected

Jacobian matrix contribution to the "right" cell.

Definition at line 130 of file InternalSideFluxBase.h.

Referenced by getJacobian().


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