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

A base class for computing/caching fluxes at boundaries. More...

#include <BoundaryFluxBase.h>

Inheritance diagram for BoundaryFluxBase:
[legend]

Public Member Functions

 BoundaryFluxBase (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, const std::vector< Real > &uvec1, const RealVectorValue &dwave, THREAD_ID tid) const
 Get the boundary flux vector. More...
 
virtual void calcFlux (unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, std::vector< Real > &flux) const =0
 Solve the Riemann problem on the boundary face. More...
 
virtual const DenseMatrix< Real > & getJacobian (unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, THREAD_ID tid) const
 Get the boundary Jacobian matrix. More...
 
virtual void calcJacobian (unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, DenseMatrix< Real > &jac1) const =0
 Compute the Jacobian matrix on the boundary face. More...
 

Protected Attributes

unsigned int _cached_side_id
 
dof_id_type _cached_elem_id
 
std::vector< std::vector< Real > > _flux
 Threaded storage for fluxes. More...
 
std::vector< DenseMatrix< Real > > _jac1
 Threaded storage for jacobians. More...
 

Static Private Attributes

static Threads::spin_mutex _mutex
 

Detailed Description

A base class for computing/caching fluxes at boundaries.

Notes:

  1. When systems of equations are being solved, the fluxes are treated as vectors. To avoid recomputing the flux at the boundary, we compute it just once and then when it is needed, we just return the cached value.
  2. Derived classes need to override calcFlux and calcJacobian.

Definition at line 30 of file BoundaryFluxBase.h.

Constructor & Destructor Documentation

BoundaryFluxBase::BoundaryFluxBase ( const InputParameters &  parameters)

Definition at line 21 of file BoundaryFluxBase.C.

22  : GeneralUserObject(parameters)
23 {
24  _flux.resize(libMesh::n_threads());
25  _jac1.resize(libMesh::n_threads());
26 }
std::vector< DenseMatrix< Real > > _jac1
Threaded storage for jacobians.
std::vector< std::vector< Real > > _flux
Threaded storage for fluxes.

Member Function Documentation

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

Solve the Riemann problem on the boundary face.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the host side
[in]dwavevector of unit normal
[out]fluxflux vector for conservation equations

Implemented in CNSFVFreeInflowBoundaryFlux, CNSFVHLLCInflowOutflowBoundaryFlux, CNSFVHLLCSlipBoundaryFlux, CNSFVRiemannInvariantBoundaryFlux, AEFVFreeOutflowBoundaryFlux, and CNSFVFreeOutflowBoundaryFlux.

Referenced by getFlux().

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

Compute the Jacobian matrix on the boundary face.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the host side
[in]dwavevector of unit normal
[out]jac1Jacobian matrix contribution

Implemented in CNSFVFreeInflowBoundaryFlux, CNSFVHLLCInflowOutflowBoundaryFlux, CNSFVHLLCSlipBoundaryFlux, CNSFVRiemannInvariantBoundaryFlux, AEFVFreeOutflowBoundaryFlux, and CNSFVFreeOutflowBoundaryFlux.

Referenced by getJacobian().

void BoundaryFluxBase::execute ( )
virtual

Definition at line 36 of file BoundaryFluxBase.C.

37 {
38 }
void BoundaryFluxBase::finalize ( )
virtual

Definition at line 41 of file BoundaryFluxBase.C.

42 {
43 }
const std::vector< Real > & BoundaryFluxBase::getFlux ( unsigned int  iside,
dof_id_type  ielem,
const std::vector< Real > &  uvec1,
const RealVectorValue &  dwave,
THREAD_ID  tid 
) const
virtual

Get the boundary flux vector.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the host side
[in]dwavevector of unit normal

Definition at line 46 of file BoundaryFluxBase.C.

Referenced by CNSFVBC::computeQpResidual(), and AEFVBC::computeQpResidual().

51 {
52  Threads::spin_mutex::scoped_lock lock(_mutex);
53  if (_cached_elem_id != ielem || _cached_side_id != iside)
54  {
55  _cached_elem_id = ielem;
56  _cached_side_id = iside;
57 
58  calcFlux(iside, ielem, uvec1, dwave, _flux[tid]);
59  }
60  return _flux[tid];
61 }
unsigned int _cached_side_id
static Threads::spin_mutex _mutex
std::vector< std::vector< Real > > _flux
Threaded storage for fluxes.
dof_id_type _cached_elem_id
virtual void calcFlux(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, std::vector< Real > &flux) const =0
Solve the Riemann problem on the boundary face.
const DenseMatrix< Real > & BoundaryFluxBase::getJacobian ( unsigned int  iside,
dof_id_type  ielem,
const std::vector< Real > &  uvec1,
const RealVectorValue &  dwave,
THREAD_ID  tid 
) const
virtual

Get the boundary Jacobian matrix.

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the host side
[in]dwavevector of unit normal

Definition at line 64 of file BoundaryFluxBase.C.

Referenced by CNSFVBC::computeQpJacobian(), AEFVBC::computeQpJacobian(), and CNSFVBC::computeQpOffDiagJacobian().

69 {
70  Threads::spin_mutex::scoped_lock lock(_mutex);
71  if (_cached_elem_id != ielem || _cached_side_id != iside)
72  {
73  _cached_elem_id = ielem;
74  _cached_side_id = iside;
75 
76  calcJacobian(iside, ielem, uvec1, dwave, _jac1[tid]);
77  }
78  return _jac1[tid];
79 }
unsigned int _cached_side_id
static Threads::spin_mutex _mutex
std::vector< DenseMatrix< Real > > _jac1
Threaded storage for jacobians.
virtual void calcJacobian(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, DenseMatrix< Real > &jac1) const =0
Compute the Jacobian matrix on the boundary face.
dof_id_type _cached_elem_id
void BoundaryFluxBase::initialize ( )
virtual

Definition at line 29 of file BoundaryFluxBase.C.

30 {
31  _cached_elem_id = 0;
32  _cached_side_id = libMesh::invalid_uint;
33 }
unsigned int _cached_side_id
dof_id_type _cached_elem_id

Member Data Documentation

dof_id_type BoundaryFluxBase::_cached_elem_id
mutableprotected

Definition at line 95 of file BoundaryFluxBase.h.

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

unsigned int BoundaryFluxBase::_cached_side_id
mutableprotected

Definition at line 94 of file BoundaryFluxBase.h.

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

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

Threaded storage for fluxes.

Definition at line 98 of file BoundaryFluxBase.h.

Referenced by BoundaryFluxBase(), and getFlux().

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

Threaded storage for jacobians.

Definition at line 101 of file BoundaryFluxBase.h.

Referenced by BoundaryFluxBase(), and getJacobian().

Threads::spin_mutex BoundaryFluxBase::_mutex
staticprivate

Definition at line 104 of file BoundaryFluxBase.h.

Referenced by getFlux(), and getJacobian().


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