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

Protected Attributes

const Real _velocity
 advective velocity More...
 
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

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

Definition at line 26 of file AEFVUpwindInternalSideFlux.h.

Constructor & Destructor Documentation

◆ AEFVUpwindInternalSideFlux()

AEFVUpwindInternalSideFlux::AEFVUpwindInternalSideFlux ( const InputParameters &  parameters)

Definition at line 25 of file AEFVUpwindInternalSideFlux.C.

26  : InternalSideFluxBase(parameters), _velocity(getParam<Real>("velocity"))
27 {
28 }
InternalSideFluxBase(const InputParameters &parameters)
const Real _velocity
advective velocity

◆ ~AEFVUpwindInternalSideFlux()

AEFVUpwindInternalSideFlux::~AEFVUpwindInternalSideFlux ( )
virtual

Definition at line 30 of file AEFVUpwindInternalSideFlux.C.

30 {}

Member Function Documentation

◆ calcFlux()

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 33 of file AEFVUpwindInternalSideFlux.C.

40 {
41  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
42  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
43 
44  // assign the size of flux vector, e.g. = 1 for the advection equation
45  flux.resize(1);
46 
47  // assume a constant velocity on the left
48  RealVectorValue uadv1(_velocity, 0.0, 0.0);
49 
50  // assume a constant velocity on the right
51  RealVectorValue uadv2(_velocity, 0.0, 0.0);
52 
53  // normal velocity on the left and right
54  Real vdon1 = uadv1 * dwave;
55  Real vdon2 = uadv2 * dwave;
56 
57  // calculate the so-called a^plus and a^minus
58  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
59  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
60 
61  // finally calculate the flux
62  flux[0] = aplus * uvec1[0] + amins * uvec2[0];
63 }
const Real _velocity
advective velocity

◆ calcJacobian()

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 66 of file AEFVUpwindInternalSideFlux.C.

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

◆ execute()

void InternalSideFluxBase::execute ( )
overridevirtualinherited

Definition at line 40 of file InternalSideFluxBase.C.

41 {
42 }

◆ finalize()

void InternalSideFluxBase::finalize ( )
overridevirtualinherited

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

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 &  )
overridevirtualinherited

Definition at line 50 of file InternalSideFluxBase.C.

51 {
52 }

Member Data Documentation

◆ _cached_flux_elem_id

unsigned int InternalSideFluxBase::_cached_flux_elem_id
mutableprotectedinherited

element ID of the cached flux values

Definition at line 116 of file InternalSideFluxBase.h.

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

◆ _cached_flux_neig_id

unsigned int InternalSideFluxBase::_cached_flux_neig_id
mutableprotectedinherited

neighbor element ID of the cached flux values

Definition at line 118 of file InternalSideFluxBase.h.

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

◆ _cached_jacobian_elem_id

unsigned int InternalSideFluxBase::_cached_jacobian_elem_id
mutableprotectedinherited

element ID of the cached Jacobian values

Definition at line 121 of file InternalSideFluxBase.h.

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

◆ _cached_jacobian_neig_id

unsigned int InternalSideFluxBase::_cached_jacobian_neig_id
mutableprotectedinherited

neighbor element ID of the cached Jacobian values

Definition at line 123 of file InternalSideFluxBase.h.

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

◆ _flux

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

flux vector of this side

Definition at line 126 of file InternalSideFluxBase.h.

Referenced by InternalSideFluxBase::getFlux().

◆ _jac1

DenseMatrix<Real> InternalSideFluxBase::_jac1
mutableprotectedinherited

Jacobian matrix contribution to the "left" cell.

Definition at line 128 of file InternalSideFluxBase.h.

Referenced by InternalSideFluxBase::getJacobian().

◆ _jac2

DenseMatrix<Real> InternalSideFluxBase::_jac2
mutableprotectedinherited

Jacobian matrix contribution to the "right" cell.

Definition at line 130 of file InternalSideFluxBase.h.

Referenced by InternalSideFluxBase::getJacobian().

◆ _velocity

const Real AEFVUpwindInternalSideFlux::_velocity
protected

advective velocity

Definition at line 51 of file AEFVUpwindInternalSideFlux.h.

Referenced by calcFlux(), and calcJacobian().


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