www.mooseframework.org
Public Member Functions | Protected Attributes | Static Private 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 ()
 
virtual void initialize ()
 
virtual void finalize ()
 
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, THREAD_ID tid) 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, THREAD_ID tid) 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_elem_id
 
unsigned int _cached_neig_id
 
std::vector< std::vector< Real > > _flux
 flux vector of this side More...
 
std::vector< DenseMatrix< Real > > _jac1
 Jacobian matrix contribution to the "left" cell. More...
 
std::vector< DenseMatrix< Real > > _jac2
 Jacobian matrix contribution to the "right" cell. More...
 

Static Private Attributes

static Threads::spin_mutex _mutex
 

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 32 of file InternalSideFluxBase.h.

Constructor & Destructor Documentation

InternalSideFluxBase::InternalSideFluxBase ( const InputParameters &  parameters)

Definition at line 22 of file InternalSideFluxBase.C.

23  : GeneralUserObject(parameters)
24 {
25  _flux.resize(libMesh::n_threads());
26  _jac1.resize(libMesh::n_threads());
27  _jac2.resize(libMesh::n_threads());
28 }
std::vector< DenseMatrix< Real > > _jac1
Jacobian matrix contribution to the "left" cell.
std::vector< DenseMatrix< Real > > _jac2
Jacobian matrix contribution to the "right" cell.
std::vector< std::vector< Real > > _flux
flux vector of this side

Member Function Documentation

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 CNSFVHLLCInternalSideFlux, and AEFVUpwindInternalSideFlux.

Referenced by getFlux().

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 CNSFVHLLCInternalSideFlux, and AEFVUpwindInternalSideFlux.

Referenced by getJacobian().

void InternalSideFluxBase::execute ( )
virtual

Definition at line 38 of file InternalSideFluxBase.C.

39 {
40 }
void InternalSideFluxBase::finalize ( )
virtual

Definition at line 43 of file InternalSideFluxBase.C.

44 {
45 }
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,
THREAD_ID  tid 
) 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 48 of file InternalSideFluxBase.C.

Referenced by CNSFVKernel::computeQpResidual(), and AEFVKernel::computeQpResidual().

55 {
56  Threads::spin_mutex::scoped_lock lock(_mutex);
57  if (_cached_elem_id != ielem || _cached_neig_id != ineig)
58  {
59  _cached_elem_id = ielem;
60  _cached_neig_id = ineig;
61 
62  calcFlux(iside, ielem, ineig, uvec1, uvec2, dwave, _flux[tid]);
63  }
64  return _flux[tid];
65 }
static Threads::spin_mutex _mutex
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< std::vector< Real > > _flux
flux vector of this side
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,
THREAD_ID  tid 
) 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 68 of file InternalSideFluxBase.C.

Referenced by CNSFVKernel::computeQpJacobian(), AEFVKernel::computeQpJacobian(), and CNSFVKernel::computeQpOffDiagJacobian().

76 {
77  Threads::spin_mutex::scoped_lock lock(_mutex);
78  if (_cached_elem_id != ielem || _cached_neig_id != ineig)
79  {
80  _cached_elem_id = ielem;
81  _cached_neig_id = ineig;
82 
83  calcJacobian(iside, ielem, ineig, uvec1, uvec2, dwave, _jac1[tid], _jac2[tid]);
84  }
85 
86  if (type == Moose::Element)
87  return _jac1[tid];
88  else
89  return _jac2[tid];
90 }
static Threads::spin_mutex _mutex
std::vector< DenseMatrix< Real > > _jac1
Jacobian matrix contribution to the "left" cell.
std::vector< DenseMatrix< Real > > _jac2
Jacobian matrix contribution to the "right" cell.
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.
void InternalSideFluxBase::initialize ( )
virtual

Definition at line 31 of file InternalSideFluxBase.C.

32 {
33  _cached_elem_id = 0;
34  _cached_neig_id = 0;
35 }

Member Data Documentation

unsigned int InternalSideFluxBase::_cached_elem_id
mutableprotected

Definition at line 115 of file InternalSideFluxBase.h.

Referenced by getFlux(), getJacobian(), and initialize().

unsigned int InternalSideFluxBase::_cached_neig_id
mutableprotected

Definition at line 116 of file InternalSideFluxBase.h.

Referenced by getFlux(), getJacobian(), and initialize().

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

flux vector of this side

Definition at line 119 of file InternalSideFluxBase.h.

Referenced by getFlux(), and InternalSideFluxBase().

std::vector<DenseMatrix<Real> > InternalSideFluxBase::_jac1
mutableprotected

Jacobian matrix contribution to the "left" cell.

Definition at line 121 of file InternalSideFluxBase.h.

Referenced by getJacobian(), and InternalSideFluxBase().

std::vector<DenseMatrix<Real> > InternalSideFluxBase::_jac2
mutableprotected

Jacobian matrix contribution to the "right" cell.

Definition at line 123 of file InternalSideFluxBase.h.

Referenced by getJacobian(), and InternalSideFluxBase().

Threads::spin_mutex InternalSideFluxBase::_mutex
staticprivate

Definition at line 126 of file InternalSideFluxBase.h.

Referenced by getFlux(), and getJacobian().


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