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

A DGKernel for the CNS equations. More...

#include <CNSFVKernel.h>

Inheritance diagram for CNSFVKernel:
[legend]

Public Member Functions

 CNSFVKernel (const InputParameters &parameters)
 
virtual ~CNSFVKernel ()
 

Protected Member Functions

virtual Real computeQpResidual (Moose::DGResidualType type)
 
virtual Real computeQpJacobian (Moose::DGJacobianType type)
 
virtual Real computeQpOffDiagJacobian (Moose::DGJacobianType type, unsigned int jvar)
 

Protected Attributes

MooseEnum _component
 choose an equation More...
 
const VariableValue & _rhoc1
 
const VariableValue & _rhouc1
 
const VariableValue & _rhovc1
 
const VariableValue & _rhowc1
 
const VariableValue & _rhoec1
 
const VariableValue & _rhoc2
 
const VariableValue & _rhouc2
 
const VariableValue & _rhovc2
 
const VariableValue & _rhowc2
 
const VariableValue & _rhoec2
 
const MaterialProperty< Real > & _rho1
 
const MaterialProperty< Real > & _rhou1
 
const MaterialProperty< Real > & _rhov1
 
const MaterialProperty< Real > & _rhow1
 
const MaterialProperty< Real > & _rhoe1
 
const MaterialProperty< Real > & _rho2
 
const MaterialProperty< Real > & _rhou2
 
const MaterialProperty< Real > & _rhov2
 
const MaterialProperty< Real > & _rhow2
 
const MaterialProperty< Real > & _rhoe2
 
const InternalSideFluxBase_flux
 fluid properties object More...
 
unsigned int _rho_var
 
unsigned int _rhou_var
 
unsigned int _rhov_var
 
unsigned int _rhow_var
 
unsigned int _rhoe_var
 
std::map< unsigned int, unsigned int > _jmap
 

Detailed Description

A DGKernel for the CNS equations.

Notes:

  1. This dgkernel itself does not do any complex calculation. It gets the internal side flux vector and Jacobian matrix from the internal side flux user object being called.
  2. In general, an approximate Riemann solver should be used in the internal flux user object for calculating the flux
  3. If a system of governing equations is being solved, the flux vector and Jacobian matrix are calculated only once for the first equation and cached for use for the rest of the equations in the system.
  4. On the "left" and "right" states of the internal side, the variable values are interpolated from the reconstructed linear polynomials in the "left" and "right "element, respectively, which are provided from the corresponding material kernel.

Definition at line 41 of file CNSFVKernel.h.

Constructor & Destructor Documentation

CNSFVKernel::CNSFVKernel ( const InputParameters &  parameters)

Definition at line 37 of file CNSFVKernel.C.

38  : DGKernel(parameters),
39  _component(getParam<MooseEnum>("component")),
40  _rhoc1(coupledValue("rho")),
41  _rhouc1(coupledValue("rhou")),
42  _rhovc1(isCoupled("rhov") ? coupledValue("rhov") : _zero),
43  _rhowc1(isCoupled("rhow") ? coupledValue("rhow") : _zero),
44  _rhoec1(coupledValue("rhoe")),
45  _rhoc2(coupledNeighborValue("rho")),
46  _rhouc2(coupledNeighborValue("rhou")),
47  _rhovc2(isCoupled("rhov") ? coupledNeighborValue("rhov") : _zero),
48  _rhowc2(isCoupled("rhow") ? coupledNeighborValue("rhow") : _zero),
49  _rhoec2(coupledNeighborValue("rhoe")),
50  _rho1(getMaterialProperty<Real>("rho")),
51  _rhou1(getMaterialProperty<Real>("rhou")),
52  _rhov1(getMaterialProperty<Real>("rhov")),
53  _rhow1(getMaterialProperty<Real>("rhow")),
54  _rhoe1(getMaterialProperty<Real>("rhoe")),
55  _rho2(getNeighborMaterialProperty<Real>("rho")),
56  _rhou2(getNeighborMaterialProperty<Real>("rhou")),
57  _rhov2(getNeighborMaterialProperty<Real>("rhov")),
58  _rhow2(getNeighborMaterialProperty<Real>("rhow")),
59  _rhoe2(getNeighborMaterialProperty<Real>("rhoe")),
60  _flux(getUserObject<InternalSideFluxBase>("flux")),
61  _rho_var(coupled("rho")),
62  _rhou_var(coupled("rhou")),
63  _rhov_var(isCoupled("rhov") ? coupled("rhov") : zero),
64  _rhow_var(isCoupled("rhow") ? coupled("rhow") : zero),
65  _rhoe_var(coupled("rhoe"))
66 {
67  _jmap.insert(std::pair<unsigned int, unsigned int>(_rho_var, 0));
68  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhou_var, 1));
69  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhov_var, 2));
70  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhow_var, 3));
71  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhoe_var, 4));
72 }
const MaterialProperty< Real > & _rho1
Definition: CNSFVKernel.h:71
const MaterialProperty< Real > & _rho2
Definition: CNSFVKernel.h:76
const VariableValue & _rhovc2
Definition: CNSFVKernel.h:66
const VariableValue & _rhouc1
Definition: CNSFVKernel.h:60
const VariableValue & _rhoec2
Definition: CNSFVKernel.h:68
unsigned int _rho_var
Definition: CNSFVKernel.h:85
const MaterialProperty< Real > & _rhoe1
Definition: CNSFVKernel.h:75
const VariableValue & _rhowc2
Definition: CNSFVKernel.h:67
const MaterialProperty< Real > & _rhou1
Definition: CNSFVKernel.h:72
unsigned int _rhov_var
Definition: CNSFVKernel.h:87
const VariableValue & _rhoc2
Definition: CNSFVKernel.h:64
const VariableValue & _rhouc2
Definition: CNSFVKernel.h:65
std::map< unsigned int, unsigned int > _jmap
Definition: CNSFVKernel.h:91
const MaterialProperty< Real > & _rhow1
Definition: CNSFVKernel.h:74
const VariableValue & _rhovc1
Definition: CNSFVKernel.h:61
MooseEnum _component
choose an equation
Definition: CNSFVKernel.h:53
unsigned int _rhou_var
Definition: CNSFVKernel.h:86
const VariableValue & _rhoc1
Definition: CNSFVKernel.h:59
const MaterialProperty< Real > & _rhow2
Definition: CNSFVKernel.h:79
const MaterialProperty< Real > & _rhou2
Definition: CNSFVKernel.h:77
const MaterialProperty< Real > & _rhov1
Definition: CNSFVKernel.h:73
const MaterialProperty< Real > & _rhov2
Definition: CNSFVKernel.h:78
const InternalSideFluxBase & _flux
fluid properties object
Definition: CNSFVKernel.h:83
const VariableValue & _rhowc1
Definition: CNSFVKernel.h:62
const VariableValue & _rhoec1
Definition: CNSFVKernel.h:63
unsigned int _rhow_var
Definition: CNSFVKernel.h:88
unsigned int _rhoe_var
Definition: CNSFVKernel.h:89
const MaterialProperty< Real > & _rhoe2
Definition: CNSFVKernel.h:80
CNSFVKernel::~CNSFVKernel ( )
virtual

Definition at line 74 of file CNSFVKernel.C.

74 {}

Member Function Documentation

Real CNSFVKernel::computeQpJacobian ( Moose::DGJacobianType  type)
protectedvirtual

input variables are the original constant monomial from the "left" and "right" cells

Definition at line 108 of file CNSFVKernel.C.

109 {
111 
112  std::vector<Real> uvec1 = {_rhoc1[_qp], _rhouc1[_qp], _rhovc1[_qp], _rhowc1[_qp], _rhoec1[_qp]};
113 
114  std::vector<Real> uvec2 = {_rhoc2[_qp], _rhouc2[_qp], _rhovc2[_qp], _rhowc2[_qp], _rhoec2[_qp]};
115 
116  const DenseMatrix<Real> & fjac1 = _flux.getJacobian(Moose::Element,
117  _current_side,
118  _current_elem->id(),
119  _neighbor_elem->id(),
120  uvec1,
121  uvec2,
122  _normals[_qp],
123  _tid);
124 
125  const DenseMatrix<Real> & fjac2 = _flux.getJacobian(Moose::Neighbor,
126  _current_side,
127  _current_elem->id(),
128  _neighbor_elem->id(),
129  uvec1,
130  uvec2,
131  _normals[_qp],
132  _tid);
133 
134  Real re = 0.;
135  switch (type)
136  {
137  case Moose::ElementElement:
138  re = fjac1(_component, _component) * _phi[_j][_qp] * _test[_i][_qp];
139  break;
140  case Moose::ElementNeighbor:
141  re = fjac2(_component, _component) * _phi_neighbor[_j][_qp] * _test[_i][_qp];
142  break;
143  case Moose::NeighborElement:
144  re = -fjac1(_component, _component) * _phi[_j][_qp] * _test_neighbor[_i][_qp];
145  break;
146  case Moose::NeighborNeighbor:
147  re = -fjac2(_component, _component) * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
148  break;
149  }
150  return re;
151 }
const VariableValue & _rhovc2
Definition: CNSFVKernel.h:66
const VariableValue & _rhouc1
Definition: CNSFVKernel.h:60
const VariableValue & _rhoec2
Definition: CNSFVKernel.h:68
const VariableValue & _rhowc2
Definition: CNSFVKernel.h:67
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.
const VariableValue & _rhoc2
Definition: CNSFVKernel.h:64
const VariableValue & _rhouc2
Definition: CNSFVKernel.h:65
const VariableValue & _rhovc1
Definition: CNSFVKernel.h:61
MooseEnum _component
choose an equation
Definition: CNSFVKernel.h:53
const VariableValue & _rhoc1
Definition: CNSFVKernel.h:59
const InternalSideFluxBase & _flux
fluid properties object
Definition: CNSFVKernel.h:83
const VariableValue & _rhowc1
Definition: CNSFVKernel.h:62
const VariableValue & _rhoec1
Definition: CNSFVKernel.h:63
Real CNSFVKernel::computeQpOffDiagJacobian ( Moose::DGJacobianType  type,
unsigned int  jvar 
)
protectedvirtual

input variables are the original constant monomial from the "left" and "right" cells

Definition at line 154 of file CNSFVKernel.C.

155 {
157 
158  std::vector<Real> uvec1 = {_rhoc1[_qp], _rhouc1[_qp], _rhovc1[_qp], _rhowc1[_qp], _rhoec1[_qp]};
159 
160  std::vector<Real> uvec2 = {_rhoc2[_qp], _rhouc2[_qp], _rhovc2[_qp], _rhowc2[_qp], _rhoec2[_qp]};
161 
162  const DenseMatrix<Real> & fjac1 = _flux.getJacobian(Moose::Element,
163  _current_side,
164  _current_elem->id(),
165  _neighbor_elem->id(),
166  uvec1,
167  uvec2,
168  _normals[_qp],
169  _tid);
170 
171  const DenseMatrix<Real> & fjac2 = _flux.getJacobian(Moose::Neighbor,
172  _current_side,
173  _current_elem->id(),
174  _neighbor_elem->id(),
175  uvec1,
176  uvec2,
177  _normals[_qp],
178  _tid);
179 
180  Real re = 0.;
181  switch (type)
182  {
183  case Moose::ElementElement:
184  re = fjac1(_component, _jmap[jvar]) * _phi[_j][_qp] * _test[_i][_qp];
185  break;
186  case Moose::ElementNeighbor:
187  re = fjac2(_component, _jmap[jvar]) * _phi_neighbor[_j][_qp] * _test[_i][_qp];
188  break;
189  case Moose::NeighborElement:
190  re = -fjac1(_component, _jmap[jvar]) * _phi[_j][_qp] * _test_neighbor[_i][_qp];
191  break;
192  case Moose::NeighborNeighbor:
193  re = -fjac2(_component, _jmap[jvar]) * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
194  break;
195  }
196  return re;
197 }
const VariableValue & _rhovc2
Definition: CNSFVKernel.h:66
const VariableValue & _rhouc1
Definition: CNSFVKernel.h:60
const VariableValue & _rhoec2
Definition: CNSFVKernel.h:68
const VariableValue & _rhowc2
Definition: CNSFVKernel.h:67
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.
const VariableValue & _rhoc2
Definition: CNSFVKernel.h:64
const VariableValue & _rhouc2
Definition: CNSFVKernel.h:65
std::map< unsigned int, unsigned int > _jmap
Definition: CNSFVKernel.h:91
const VariableValue & _rhovc1
Definition: CNSFVKernel.h:61
MooseEnum _component
choose an equation
Definition: CNSFVKernel.h:53
const VariableValue & _rhoc1
Definition: CNSFVKernel.h:59
const InternalSideFluxBase & _flux
fluid properties object
Definition: CNSFVKernel.h:83
const VariableValue & _rhowc1
Definition: CNSFVKernel.h:62
const VariableValue & _rhoec1
Definition: CNSFVKernel.h:63
Real CNSFVKernel::computeQpResidual ( Moose::DGResidualType  type)
protectedvirtual

the size of flux vector is five 0 for mass 1 for x-momentum 2 for y-momentum 3 for z-momentum 4 for total-energy

input variables are the reconstructed linear monomial extrapolated at side center from "left" and "right" cells

Definition at line 77 of file CNSFVKernel.C.

78 {
85 
86  std::vector<Real> uvec1 = {_rho1[_qp], _rhou1[_qp], _rhov1[_qp], _rhow1[_qp], _rhoe1[_qp]};
87 
88  std::vector<Real> uvec2 = {_rho2[_qp], _rhou2[_qp], _rhov2[_qp], _rhow2[_qp], _rhoe2[_qp]};
89 
91  const std::vector<Real> & flux = _flux.getFlux(
92  _current_side, _current_elem->id(), _neighbor_elem->id(), uvec1, uvec2, _normals[_qp], _tid);
93 
94  Real re = 0.;
95  switch (type)
96  {
97  case Moose::Element:
98  re = flux[_component] * _test[_i][_qp];
99  break;
100  case Moose::Neighbor:
101  re = -flux[_component] * _test_neighbor[_i][_qp];
102  break;
103  }
104  return re;
105 }
const MaterialProperty< Real > & _rho1
Definition: CNSFVKernel.h:71
const MaterialProperty< Real > & _rho2
Definition: CNSFVKernel.h:76
const MaterialProperty< Real > & _rhoe1
Definition: CNSFVKernel.h:75
const MaterialProperty< Real > & _rhou1
Definition: CNSFVKernel.h:72
const MaterialProperty< Real > & _rhow1
Definition: CNSFVKernel.h:74
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.
MooseEnum _component
choose an equation
Definition: CNSFVKernel.h:53
const MaterialProperty< Real > & _rhow2
Definition: CNSFVKernel.h:79
const MaterialProperty< Real > & _rhou2
Definition: CNSFVKernel.h:77
const MaterialProperty< Real > & _rhov1
Definition: CNSFVKernel.h:73
const MaterialProperty< Real > & _rhov2
Definition: CNSFVKernel.h:78
const InternalSideFluxBase & _flux
fluid properties object
Definition: CNSFVKernel.h:83
const MaterialProperty< Real > & _rhoe2
Definition: CNSFVKernel.h:80

Member Data Documentation

MooseEnum CNSFVKernel::_component
protected

choose an equation

Definition at line 53 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

const InternalSideFluxBase& CNSFVKernel::_flux
protected

fluid properties object

Definition at line 83 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

std::map<unsigned int, unsigned int> CNSFVKernel::_jmap
protected

Definition at line 91 of file CNSFVKernel.h.

Referenced by CNSFVKernel(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& CNSFVKernel::_rho1
protected

Definition at line 71 of file CNSFVKernel.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& CNSFVKernel::_rho2
protected

Definition at line 76 of file CNSFVKernel.h.

Referenced by computeQpResidual().

unsigned int CNSFVKernel::_rho_var
protected

Definition at line 85 of file CNSFVKernel.h.

Referenced by CNSFVKernel().

const VariableValue& CNSFVKernel::_rhoc1
protected

Definition at line 59 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const VariableValue& CNSFVKernel::_rhoc2
protected

Definition at line 64 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& CNSFVKernel::_rhoe1
protected

Definition at line 75 of file CNSFVKernel.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& CNSFVKernel::_rhoe2
protected

Definition at line 80 of file CNSFVKernel.h.

Referenced by computeQpResidual().

unsigned int CNSFVKernel::_rhoe_var
protected

Definition at line 89 of file CNSFVKernel.h.

Referenced by CNSFVKernel().

const VariableValue& CNSFVKernel::_rhoec1
protected

Definition at line 63 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const VariableValue& CNSFVKernel::_rhoec2
protected

Definition at line 68 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& CNSFVKernel::_rhou1
protected

Definition at line 72 of file CNSFVKernel.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& CNSFVKernel::_rhou2
protected

Definition at line 77 of file CNSFVKernel.h.

Referenced by computeQpResidual().

unsigned int CNSFVKernel::_rhou_var
protected

Definition at line 86 of file CNSFVKernel.h.

Referenced by CNSFVKernel().

const VariableValue& CNSFVKernel::_rhouc1
protected

Definition at line 60 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const VariableValue& CNSFVKernel::_rhouc2
protected

Definition at line 65 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& CNSFVKernel::_rhov1
protected

Definition at line 73 of file CNSFVKernel.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& CNSFVKernel::_rhov2
protected

Definition at line 78 of file CNSFVKernel.h.

Referenced by computeQpResidual().

unsigned int CNSFVKernel::_rhov_var
protected

Definition at line 87 of file CNSFVKernel.h.

Referenced by CNSFVKernel().

const VariableValue& CNSFVKernel::_rhovc1
protected

Definition at line 61 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const VariableValue& CNSFVKernel::_rhovc2
protected

Definition at line 66 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& CNSFVKernel::_rhow1
protected

Definition at line 74 of file CNSFVKernel.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& CNSFVKernel::_rhow2
protected

Definition at line 79 of file CNSFVKernel.h.

Referenced by computeQpResidual().

unsigned int CNSFVKernel::_rhow_var
protected

Definition at line 88 of file CNSFVKernel.h.

Referenced by CNSFVKernel().

const VariableValue& CNSFVKernel::_rhowc1
protected

Definition at line 62 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const VariableValue& CNSFVKernel::_rhowc2
protected

Definition at line 67 of file CNSFVKernel.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().


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