https://mooseframework.inl.gov
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 
12 registerMooseObject("NavierStokesApp", NSEnergyViscousFlux);
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 
27 Real
29 {
30  // (tau * u) * grad(phi)
33 
34  return vec * _grad_test[_i][_qp];
35 }
36 
37 Real
39 {
40  // No dependence of this term on U_4!
41  return 0.0;
42 }
43 
44 Real
46 {
47  if (isNSVariable(jvar))
48  {
49 
50  // Convenience variables
52 
53  Real rho = _rho[_qp];
54  Real phij = _phi[_j][_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 }
virtual Real computeQpJacobian()
Viscous flux terms in energy equation.
const VariableValue & _rho_u
Definition: NSKernel.h:39
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Definition: NSKernel.h:25
static InputParameters validParams()
const VariableValue & _w_vel
Definition: NSKernel.h:36
const VariableValue & _rho
Definition: NSKernel.h:38
static constexpr std::size_t dim
Real dtau(unsigned k, unsigned ell, unsigned m)
The primary interface for computing viscous stress tensor derivatives.
const VariableValue & _rho_v
Definition: NSKernel.h:40
TensorValue< Real > RealTensorValue
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:79
virtual Real computeQpResidual()
unsigned int _i
virtual const OutputTools< Real >::VariableValue & value()
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:60
registerMooseObject("NavierStokesApp", NSEnergyViscousFlux)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _u_vel
Definition: NSKernel.h:34
const VariableTestGradient & _grad_test
const VariableValue & _v_vel
Definition: NSKernel.h:35
NSViscStressTensorDerivs< NSEnergyViscousFlux > _vst_derivs
IntRange< T > make_range(T beg, T end)
void addClassDescription(const std::string &doc_string)
static const std::string velocity
Definition: NS.h:45
const VariableValue & _rho_w
Definition: NSKernel.h:41
NSEnergyViscousFlux(const InputParameters &parameters)
static InputParameters validParams()
Definition: NSKernel.C:23
const VariablePhiValue & _phi
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:89
static const std::string k
Definition: NS.h:130
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
unsigned int _qp