www.mooseframework.org
CNSFVBC.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #include "CNSFVBC.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<IntegratedBC>();
15 
16  params.addClassDescription("A boundary condition object for the CNS equations.");
17 
18  MooseEnum component("mass x-momentum y-momentum z-momentum total-energy");
19 
20  params.addParam<MooseEnum>("component", component, "Choose one of the conservation equations");
21 
22  params.addRequiredCoupledVar("rho", "Conserved variable: rho");
23 
24  params.addRequiredCoupledVar("rhou", "Conserved variable: rhou");
25 
26  params.addCoupledVar("rhov", "Conserved variable: rhov");
27 
28  params.addCoupledVar("rhow", "Conserved variable: rhow");
29 
30  params.addRequiredCoupledVar("rhoe", "Conserved variable: rhoe");
31 
32  params.addRequiredParam<UserObjectName>("flux", "The name of boundary flux object to use");
33 
34  return params;
35 }
36 
37 CNSFVBC::CNSFVBC(const InputParameters & parameters)
38  : IntegratedBC(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  _rho1(getMaterialProperty<Real>("rho")),
46  _rhou1(getMaterialProperty<Real>("rhou")),
47  _rhov1(getMaterialProperty<Real>("rhov")),
48  _rhow1(getMaterialProperty<Real>("rhow")),
49  _rhoe1(getMaterialProperty<Real>("rhoe")),
50  _flux(getUserObject<BoundaryFluxBase>("flux")),
51  _rho_var(coupled("rho")),
52  _rhou_var(coupled("rhou")),
53  _rhov_var(isCoupled("rhov") ? coupled("rhov") : zero),
54  _rhow_var(isCoupled("rhow") ? coupled("rhow") : zero),
55  _rhoe_var(coupled("rhoe"))
56 {
57  _jmap.insert(std::pair<unsigned int, unsigned int>(_rho_var, 0));
58  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhou_var, 1));
59  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhov_var, 2));
60  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhow_var, 3));
61  _jmap.insert(std::pair<unsigned int, unsigned int>(_rhoe_var, 4));
62 }
63 
64 Real
66 {
73 
74  std::vector<Real> uvec1 = {_rho1[_qp], _rhou1[_qp], _rhov1[_qp], _rhow1[_qp], _rhoe1[_qp]};
75 
77 
78  const std::vector<Real> & flux =
79  _flux.getFlux(_current_side, _current_elem->id(), uvec1, _normals[_qp], _tid);
80 
81  return flux[_component] * _test[_i][_qp];
82 }
83 
84 Real
86 {
87  std::vector<Real> uvec1 = {_rhoc1[_qp], _rhouc1[_qp], _rhovc1[_qp], _rhowc1[_qp], _rhoec1[_qp]};
88 
90 
91  const DenseMatrix<Real> & fjac1 =
92  _flux.getJacobian(_current_side, _current_elem->id(), uvec1, _normals[_qp], _tid);
93 
94  return fjac1(_component, _component) * _phi[_j][_qp] * _test[_i][_qp];
95 }
96 
97 Real
99 {
100  std::vector<Real> uvec1 = {_rhoc1[_qp], _rhouc1[_qp], _rhovc1[_qp], _rhowc1[_qp], _rhoec1[_qp]};
101 
103 
104  const DenseMatrix<Real> & fjac1 =
105  _flux.getJacobian(_current_side, _current_elem->id(), uvec1, _normals[_qp], _tid);
106 
107  return fjac1(_component, _jmap[jvar]) * _phi[_j][_qp] * _test[_i][_qp];
108 }
const VariableValue & _rhowc1
Definition: CNSFVBC.h:63
Real component(const SymmTensor &symm_tensor, unsigned int index)
const MaterialProperty< Real > & _rho1
extrapolated variable values at side center
Definition: CNSFVBC.h:67
unsigned int _rhoe_var
Definition: CNSFVBC.h:80
const MaterialProperty< Real > & _rhoe1
Definition: CNSFVBC.h:71
A base class for computing/caching fluxes at boundaries.
std::map< unsigned int, unsigned int > _jmap
Definition: CNSFVBC.h:82
const BoundaryFluxBase & _flux
fluid properties object
Definition: CNSFVBC.h:74
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.
InputParameters validParams< CNSFVBC >()
Definition: CNSFVBC.C:12
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: CNSFVBC.C:98
const MaterialProperty< Real > & _rhow1
Definition: CNSFVBC.h:70
const VariableValue & _rhoec1
Definition: CNSFVBC.h:64
const MaterialProperty< Real > & _rhov1
Definition: CNSFVBC.h:69
CNSFVBC(const InputParameters &parameters)
Definition: CNSFVBC.C:37
MooseEnum _component
choose an equation
Definition: CNSFVBC.h:54
virtual Real computeQpJacobian()
Definition: CNSFVBC.C:85
unsigned int _rhov_var
Definition: CNSFVBC.h:78
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.
const VariableValue & _rhouc1
Definition: CNSFVBC.h:61
unsigned int _rhou_var
Definition: CNSFVBC.h:77
unsigned int _rhow_var
Definition: CNSFVBC.h:79
unsigned int _rho_var
Definition: CNSFVBC.h:76
const MaterialProperty< Real > & _rhou1
Definition: CNSFVBC.h:68
virtual Real computeQpResidual()
Definition: CNSFVBC.C:65
const VariableValue & _rhoc1
"1" denotes the "host" state "2" denotes the "ghost" state
Definition: CNSFVBC.h:60
const VariableValue & _rhovc1
Definition: CNSFVBC.h:62