https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NSEnergyViscousFlux.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 "NSEnergyViscousFlux.h"
11
13
16{
18 params.addClassDescription("Viscous flux terms in energy equation.");
19 return params;
20}
21
23 : NSKernel(parameters), _vst_derivs(*this)
24{
25}
26
27Real
29{
30 // (tau * u) * grad(phi)
31 RealVectorValue velocity(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
32 RealVectorValue vec = _viscous_stress_tensor[_qp] * velocity;
33
34 return vec * _grad_test[_i][_qp];
35}
36
37Real
39{
40 // No dependence of this term on U_4!
41 return 0.0;
42}
43
44Real
46{
47 if (isNSVariable(jvar))
48 {
49
50 // Convenience variables
51 const RealTensorValue & tau = _viscous_stress_tensor[_qp];
52
53 Real rho = _rho[_qp];
54 Real phij = _phi[_j][_qp];
55 RealVectorValue U(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
56
57 // Map jvar into the variable m for our problem, regardless of
58 // how Moose has numbered things.
59 unsigned m = mapVarNumber(jvar);
60
61 // Compute Jacobian terms based on the value of m
62 switch (m)
63 {
64 case 0: // Density
65 {
66 // Return value
67 Real value = 0.0;
68
69 for (const auto k : make_range(Moose::dim))
70 {
71 Real intermediate_value = 0.0;
72
73 for (unsigned ell = 0; ell < LIBMESH_DIM; ++ell)
74 intermediate_value +=
75 (U(ell) / rho * (-tau(k, ell) * phij / rho + _vst_derivs.dtau(k, ell, 0)));
76
77 // Hit accumulated value with test function
78 value += intermediate_value * _grad_test[_i][_qp](k);
79 } // end for k
80
81 return value;
82 }
83
84 case 1:
85 case 2:
86 case 3: // Momentums
87 {
88 // Return value
89 Real value = 0.0;
90
91 // "local" version of m, mapped to 0, 1, 2, for indexing
92 // into Point objects.
93 const unsigned int m_local = m - 1;
94
95 for (const auto k : make_range(Moose::dim))
96 {
97 Real intermediate_value = tau(k, m_local) * phij / rho;
98
99 for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
100 intermediate_value += _vst_derivs.dtau(k, ell, m) * U(ell) /
101 rho; // Note: pass 'm' to dtau, it will convert it internally
102
103 // Hit accumulated value with test function
104 value += intermediate_value * _grad_test[_i][_qp](k);
105 } // end for k
106
107 return value;
108 }
109
110 default:
111 return 0.0;
112 } // end switch (m)
113 }
114 else
115 return 0.0;
116}
const double rho
registerMooseObject("NavierStokesApp", NSEnergyViscousFlux)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariablePhiValue & _phi
const VariableTestGradient & _grad_test
virtual const OutputTools< Real >::VariableValue & value()
Viscous flux terms in energy equation.
NSEnergyViscousFlux(const InputParameters &parameters)
virtual Real computeQpJacobian()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
virtual Real computeQpResidual()
NSViscStressTensorDerivs< NSEnergyViscousFlux > _vst_derivs
static InputParameters validParams()
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Definition NSKernel.h:26
unsigned mapVarNumber(unsigned var)
Definition NSKernel.C:89
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition NSKernel.C:79
const VariableValue & _rho_u
Definition NSKernel.h:39
const VariableValue & _rho_v
Definition NSKernel.h:40
static InputParameters validParams()
Definition NSKernel.C:23
const VariableValue & _rho_w
Definition NSKernel.h:41
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition NSKernel.h:60
const VariableValue & _u_vel
Definition NSKernel.h:34
const VariableValue & _rho
Definition NSKernel.h:38
const VariableValue & _v_vel
Definition NSKernel.h:35
const VariableValue & _w_vel
Definition NSKernel.h:36
Real dtau(unsigned k, unsigned ell, unsigned m)
The primary interface for computing viscous stress tensor derivatives.
static constexpr std::size_t dim