https://mooseframework.inl.gov
Loading...
Searching...
No Matches
INSTemperature.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#include "INSTemperature.h"
11#include "MooseMesh.h"
12
14
17{
19
20 params.addClassDescription("This class computes the residual and Jacobian contributions for the "
21 "incompressible Navier-Stokes temperature (energy) equation.");
22 // Coupled variables
23 params.addRequiredCoupledVar("u", "x-velocity");
24 params.addCoupledVar("v", "y-velocity"); // only required in 2D and 3D
25 params.addCoupledVar("w", "z-velocity"); // only required in 3D
26
27 // Optional parameters
28 params.addParam<MaterialPropertyName>("rho_name", "rho", "density name");
29 params.addParam<MaterialPropertyName>("k_name", "k", "thermal conductivity name");
30 params.addParam<MaterialPropertyName>("cp_name", "cp", "specific heat name");
31
32 return params;
33}
34
36 : Kernel(parameters),
37
38 // Coupled variables
39 _u_vel(coupledValue("u")),
40 _v_vel(_mesh.dimension() >= 2 ? coupledValue("v") : _zero),
41 _w_vel(_mesh.dimension() == 3 ? coupledValue("w") : _zero),
42
43 // Variable numberings
44 _u_vel_var_number(coupled("u")),
45 _v_vel_var_number(_mesh.dimension() >= 2 ? coupled("v") : libMesh::invalid_uint),
46 _w_vel_var_number(_mesh.dimension() == 3 ? coupled("w") : libMesh::invalid_uint),
47
48 // Material Properties
49 _rho(getMaterialProperty<Real>("rho_name")),
50 _k(getMaterialProperty<Real>("k_name")),
51 _cp(getMaterialProperty<Real>("cp_name"))
52{
53}
54
55Real
57{
58 // The convection part, rho * cp u.grad(T) * v.
59 // Note: _u is the temperature variable, _grad_u is its gradient.
60 Real convective_part = _rho[_qp] * _cp[_qp] *
61 (_u_vel[_qp] * _grad_u[_qp](0) + _v_vel[_qp] * _grad_u[_qp](1) +
62 _w_vel[_qp] * _grad_u[_qp](2)) *
63 _test[_i][_qp];
64
65 // Thermal conduction part, k * grad(T) * grad(v)
66 Real conduction_part = _k[_qp] * _grad_u[_qp] * _grad_test[_i][_qp];
67
68 return convective_part + conduction_part;
69}
70
71Real
73{
74 RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
75
76 Real convective_part = _rho[_qp] * _cp[_qp] * (U * _grad_phi[_j][_qp]) * _test[_i][_qp];
77 Real conduction_part = _k[_qp] * (_grad_phi[_j][_qp] * _grad_test[_i][_qp]);
78
79 return convective_part + conduction_part;
80}
81
82Real
84{
85 if (jvar == _u_vel_var_number)
86 {
87 Real convective_part = _rho[_qp] * _cp[_qp] * _phi[_j][_qp] * _grad_u[_qp](0) * _test[_i][_qp];
88 return convective_part;
89 }
90
91 else if (jvar == _v_vel_var_number)
92 {
93 Real convective_part = _rho[_qp] * _cp[_qp] * _phi[_j][_qp] * _grad_u[_qp](1) * _test[_i][_qp];
94 return convective_part;
95 }
96
97 else if (jvar == _w_vel_var_number)
98 {
99 Real convective_part = _rho[_qp] * _cp[_qp] * _phi[_j][_qp] * _grad_u[_qp](2) * _test[_i][_qp];
100 return convective_part;
101 }
102 else
103 return 0;
104}
registerMooseObject("NavierStokesApp", INSTemperature)
This class computes the residual and Jacobian contributions for the incompressible Navier-Stokes temp...
unsigned _v_vel_var_number
virtual Real computeQpResidual()
const MaterialProperty< Real > & _rho
virtual Real computeQpOffDiagJacobian(unsigned jvar)
unsigned _u_vel_var_number
const VariableValue & _w_vel
unsigned _w_vel_var_number
const MaterialProperty< Real > & _k
const MaterialProperty< Real > & _cp
const VariableValue & _v_vel
INSTemperature(const InputParameters &parameters)
static InputParameters validParams()
const VariableValue & _u_vel
virtual Real computeQpJacobian()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, 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 VariableGradient & _grad_u
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()
const VariablePhiGradient & _grad_phi
const VariableTestGradient & _grad_test
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...