www.mooseframework.org
NSTemperatureL2.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 // Navier-Stokes includes
9 #include "NSTemperatureL2.h"
10 #include "NS.h"
11 
12 // MOOSE includes
13 #include "MooseMesh.h"
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<Kernel>();
20  params.addClassDescription(
21  "This class was originally used to solve for the temperature using an L2-projection.");
22  params.addRequiredCoupledVar(NS::velocity_x, "x-direction velocity component");
23  params.addCoupledVar(NS::velocity_y, "y-direction velocity component"); // only reqiured in >= 2D
24  params.addCoupledVar(NS::velocity_z, "z-direction velocity component"); // only required in 3D
25  params.addRequiredCoupledVar("rhoe", "Total energy");
26  params.addRequiredCoupledVar(NS::density, "Density");
27  return params;
28 }
29 
30 NSTemperatureL2::NSTemperatureL2(const InputParameters & parameters)
31  : Kernel(parameters),
32  _rho_var(coupled(NS::density)),
33  _rho(coupledValue(NS::density)),
34  _rhoe_var(coupled("rhoe")),
35  _rhoe(coupledValue("rhoe")),
36  _u_vel_var(coupled(NS::velocity_x)),
37  _u_vel(coupledValue(NS::velocity_x)),
38  _v_vel_var(_mesh.dimension() >= 2 ? coupled(NS::velocity_y) : libMesh::invalid_uint),
39  _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
40  _w_vel_var(_mesh.dimension() == 3 ? coupled(NS::velocity_z) : libMesh::invalid_uint),
41  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
42  _c_v(getMaterialProperty<Real>("c_v"))
43 {
44 }
45 
46 Real
48 {
49  Real value = 1.0 / _c_v[_qp];
50 
51  const Real et = _rhoe[_qp] / _rho[_qp];
52  const RealVectorValue vec(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
53 
54  value *= et - ((vec * vec) / 2.0);
55 
56  // L2-projection
57  return (_u[_qp] - value) * _test[_i][_qp];
58 }
59 
60 Real
62 {
63  return _phi[_j][_qp] * _test[_i][_qp];
64 }
65 
66 Real
68 {
69  if (jvar == _rho_var)
70  {
71  const Real et = (_rhoe[_qp] / (-_rho[_qp] * _rho[_qp])) * _phi[_j][_qp];
72  Real value = et / _c_v[_qp];
73 
74  return -value * _test[_i][_qp];
75  }
76  else if (jvar == _rhoe_var)
77  {
78  const Real et = _phi[_j][_qp] / _rho[_qp];
79  Real value = et / _c_v[_qp];
80 
81  return -value * _test[_i][_qp];
82  }
83 
84  return 0.0;
85 }
Definition: NS.h:13
const VariableValue & _w_vel
const std::string velocity_z
Definition: NS.h:23
virtual Real computeQpResidual()
const std::string density
Definition: NS.h:15
const std::string velocity_x
Definition: NS.h:21
const VariableValue & _rhoe
const VariableValue & _rho
unsigned int _rho_var
const std::string velocity_y
Definition: NS.h:22
NSTemperatureL2(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const VariableValue & _u_vel
unsigned int _rhoe_var
const MaterialProperty< Real > & _c_v
InputParameters validParams< NSTemperatureL2 >()
const VariableValue & _v_vel
virtual Real computeQpJacobian()