https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NSTemperatureL2.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
18
21{
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
49Real
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
63Real
68
69Real
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}
registerMooseObject("NavierStokesApp", NSTemperatureL2)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()
const VariableValue & _u
virtual const OutputTools< Real >::VariableValue & value()
This class was originally used to solve for the temperature using an L2-projection.
const VariableValue & _rhoe
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
unsigned int _rhoe_var
const VariableValue & _u_vel
unsigned int _rho_var
const VariableValue & _v_vel
const VariableValue & _rho
static InputParameters validParams()
const VariableValue & _w_vel
NSTemperatureL2(const InputParameters &parameters)
const MaterialProperty< Real > & _c_v
virtual Real computeQpJacobian()
virtual Real computeQpResidual()
static const std::string density
Definition NS.h:34
static const std::string velocity_y
Definition NS.h:48
static const std::string velocity_z
Definition NS.h:49
static const std::string velocity_x
Definition NS.h:47
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...