www.mooseframework.org
NSTemperatureL2.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // Navier-Stokes includes
11 #include "NSTemperatureL2.h"
12 #include "NS.h"
13 
14 // MOOSE includes
15 #include "MooseMesh.h"
16 
17 registerMooseObject("NavierStokesApp", NSTemperatureL2);
18 
21 {
23  params.addClassDescription(
24  "This class was originally used to solve for the temperature using an L2-projection.");
25  params.addRequiredCoupledVar(NS::velocity_x, "x-direction velocity component");
26  params.addCoupledVar(NS::velocity_y, "y-direction velocity component"); // only reqiured in >= 2D
27  params.addCoupledVar(NS::velocity_z, "z-direction velocity component"); // only required in 3D
28  params.addRequiredCoupledVar("rhoe", "Total energy");
29  params.addRequiredCoupledVar(NS::density, "Density");
30  return params;
31 }
32 
34  : Kernel(parameters),
35  _rho_var(coupled(NS::density)),
36  _rho(coupledValue(NS::density)),
37  _rhoe_var(coupled("rhoe")),
38  _rhoe(coupledValue("rhoe")),
39  _u_vel_var(coupled(NS::velocity_x)),
40  _u_vel(coupledValue(NS::velocity_x)),
41  _v_vel_var(_mesh.dimension() >= 2 ? coupled(NS::velocity_y) : libMesh::invalid_uint),
42  _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
43  _w_vel_var(_mesh.dimension() == 3 ? coupled(NS::velocity_z) : libMesh::invalid_uint),
44  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
45  _c_v(getMaterialProperty<Real>("c_v"))
46 {
47 }
48 
49 Real
51 {
52  Real value = 1.0 / _c_v[_qp];
53 
54  const Real et = _rhoe[_qp] / _rho[_qp];
55  const RealVectorValue vec(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
56 
57  value *= et - ((vec * vec) / 2.0);
58 
59  // L2-projection
60  return (_u[_qp] - value) * _test[_i][_qp];
61 }
62 
63 Real
65 {
66  return _phi[_j][_qp] * _test[_i][_qp];
67 }
68 
69 Real
71 {
72  if (jvar == _rho_var)
73  {
74  const Real et = (_rhoe[_qp] / (-_rho[_qp] * _rho[_qp])) * _phi[_j][_qp];
75  Real value = et / _c_v[_qp];
76 
77  return -value * _test[_i][_qp];
78  }
79  else if (jvar == _rhoe_var)
80  {
81  const Real et = _phi[_j][_qp] / _rho[_qp];
82  Real value = et / _c_v[_qp];
83 
84  return -value * _test[_i][_qp];
85  }
86 
87  return 0.0;
88 }
const VariableValue & _w_vel
registerMooseObject("NavierStokesApp", NSTemperatureL2)
static InputParameters validParams()
const unsigned int invalid_uint
This class was originally used to solve for the temperature using an L2-projection.
static InputParameters validParams()
static const std::string velocity_z
Definition: NS.h:48
virtual Real computeQpResidual()
static const std::string density
Definition: NS.h:33
static const std::string velocity_x
Definition: NS.h:46
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const VariableValue & _rhoe
const VariableValue & _rho
const VariableTestValue & _test
unsigned int _rho_var
unsigned int _i
static const std::string velocity_y
Definition: NS.h:47
virtual const OutputTools< Real >::VariableValue & value()
NSTemperatureL2(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
const VariableValue & _u_vel
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _rhoe_var
const MaterialProperty< Real > & _c_v
void addClassDescription(const std::string &doc_string)
const VariablePhiValue & _phi
const VariableValue & _u
unsigned int _qp
const VariableValue & _v_vel
virtual Real computeQpJacobian()