www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
AEFVUpwindInternalSideFlux Class Reference

Upwind numerical flux scheme for the advection equation using a cell-centered finite volume method. More...

#include <AEFVUpwindInternalSideFlux.h>

Inheritance diagram for AEFVUpwindInternalSideFlux:
[legend]

Public Member Functions

 AEFVUpwindInternalSideFlux (const InputParameters &parameters)
 
virtual ~AEFVUpwindInternalSideFlux ()
 
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 override
 Solve the Riemann problem. 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 override
 Compute the Jacobian matrix. More...
 
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 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...
 

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

Detailed Description

Upwind numerical flux scheme for the advection equation using a cell-centered finite volume method.

Definition at line 24 of file AEFVUpwindInternalSideFlux.h.

Constructor & Destructor Documentation

AEFVUpwindInternalSideFlux::AEFVUpwindInternalSideFlux ( const InputParameters &  parameters)

Definition at line 20 of file AEFVUpwindInternalSideFlux.C.

21  : InternalSideFluxBase(parameters)
22 {
23 }
InternalSideFluxBase(const InputParameters &parameters)
AEFVUpwindInternalSideFlux::~AEFVUpwindInternalSideFlux ( )
virtual

Definition at line 25 of file AEFVUpwindInternalSideFlux.C.

25 {}

Member Function Documentation

void AEFVUpwindInternalSideFlux::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
overridevirtual

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

Implements InternalSideFluxBase.

Definition at line 28 of file AEFVUpwindInternalSideFlux.C.

35 {
36  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
37  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
38 
39  // assign the size of flux vector, e.g. = 1 for the advection equation
40  flux.resize(1);
41 
42  // assume a constant velocity on the left
43  RealVectorValue uadv1(1.0, 1.0, 1.0);
44 
45  // assume a constant velocity on the right
46  RealVectorValue uadv2(1.0, 1.0, 1.0);
47 
48  // normal velocity on the left and right
49  Real vdon1 = uadv1 * dwave;
50  Real vdon2 = uadv2 * dwave;
51 
52  // calculate the so-called a^plus and a^minus
53  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
54  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
55 
56  // finally calculate the flux
57  flux[0] = aplus * uvec1[0] + amins * uvec2[0];
58 }
void AEFVUpwindInternalSideFlux::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
overridevirtual

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

Implements InternalSideFluxBase.

Definition at line 61 of file AEFVUpwindInternalSideFlux.C.

69 {
70  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
71  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
72 
73  // assign the size of Jacobian matrix, e.g. = (1, 1) for the advection equation
74  jac1.resize(1, 1);
75  jac2.resize(1, 1);
76 
77  // assume a constant velocity on the left
78  RealVectorValue uadv1(1.0, 1.0, 1.0);
79 
80  // assume a constant velocity on the right
81  RealVectorValue uadv2(1.0, 1.0, 1.0);
82 
83  // normal velocity on the left and right
84  Real vdon1 = uadv1 * dwave;
85  Real vdon2 = uadv2 * dwave;
86 
87  // calculate the so-called a^plus and a^minus
88  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
89  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
90 
91  // finally calculate the Jacobian matrix
92  jac1(0, 0) = aplus;
93  jac2(0, 0) = amins;
94 }
void InternalSideFluxBase::execute ( )
virtualinherited

Definition at line 38 of file InternalSideFluxBase.C.

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

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
virtualinherited

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
virtualinherited

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 ( )
virtualinherited

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
mutableprotectedinherited
unsigned int InternalSideFluxBase::_cached_neig_id
mutableprotectedinherited
std::vector<std::vector<Real> > InternalSideFluxBase::_flux
mutableprotectedinherited

flux vector of this side

Definition at line 119 of file InternalSideFluxBase.h.

Referenced by InternalSideFluxBase::getFlux(), and InternalSideFluxBase::InternalSideFluxBase().

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

Jacobian matrix contribution to the "left" cell.

Definition at line 121 of file InternalSideFluxBase.h.

Referenced by InternalSideFluxBase::getJacobian(), and InternalSideFluxBase::InternalSideFluxBase().

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

Jacobian matrix contribution to the "right" cell.

Definition at line 123 of file InternalSideFluxBase.h.

Referenced by InternalSideFluxBase::getJacobian(), and InternalSideFluxBase::InternalSideFluxBase().


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