www.mooseframework.org
NSEnergyViscousFlux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "NSEnergyViscousFlux.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<NSKernel>();
14  params.addClassDescription("Viscous flux terms in energy equation.");
15  return params;
16 }
17 
18 NSEnergyViscousFlux::NSEnergyViscousFlux(const InputParameters & parameters)
19  : NSKernel(parameters), _vst_derivs(*this)
20 {
21 }
22 
23 Real
25 {
26  // (tau * u) * grad(phi)
27  RealVectorValue velocity(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
28  RealVectorValue vec = _viscous_stress_tensor[_qp] * velocity;
29 
30  return vec * _grad_test[_i][_qp];
31 }
32 
33 Real
35 {
36  // No dependence of this term on U_4!
37  return 0.0;
38 }
39 
40 Real
42 {
43  if (isNSVariable(jvar))
44  {
45 
46  // Convenience variables
47  const RealTensorValue & tau = _viscous_stress_tensor[_qp];
48 
49  Real rho = _rho[_qp];
50  Real phij = _phi[_j][_qp];
51  RealVectorValue U(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
52 
53  // Map jvar into the variable m for our problem, regardless of
54  // how Moose has numbered things.
55  unsigned m = mapVarNumber(jvar);
56 
57  // Compute Jacobian terms based on the value of m
58  switch (m)
59  {
60  case 0: // Density
61  {
62  // Return value
63  Real value = 0.0;
64 
65  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
66  {
67  Real intermediate_value = 0.0;
68 
69  for (unsigned ell = 0; ell < LIBMESH_DIM; ++ell)
70  intermediate_value +=
71  (U(ell) / rho * (-tau(k, ell) * phij / rho + _vst_derivs.dtau(k, ell, 0)));
72 
73  // Hit accumulated value with test function
74  value += intermediate_value * _grad_test[_i][_qp](k);
75  } // end for k
76 
77  return value;
78  }
79 
80  case 1:
81  case 2:
82  case 3: // Momentums
83  {
84  // Return value
85  Real value = 0.0;
86 
87  // "local" version of m, mapped to 0, 1, 2, for indexing
88  // into Point objects.
89  const unsigned int m_local = m - 1;
90 
91  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
92  {
93  Real intermediate_value = tau(k, m_local) * phij / rho;
94 
95  for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
96  intermediate_value += _vst_derivs.dtau(k, ell, m) * U(ell) /
97  rho; // Note: pass 'm' to dtau, it will convert it internally
98 
99  // Hit accumulated value with test function
100  value += intermediate_value * _grad_test[_i][_qp](k);
101  } // end for k
102 
103  return value;
104  }
105 
106  default:
107  return 0.0;
108  } // end switch (m)
109  }
110  else
111  return 0.0;
112 }
virtual Real computeQpJacobian()
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:27
const VariableValue & _w_vel
Definition: NSKernel.h:36
const VariableValue & _rho
Definition: NSKernel.h:38
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
InputParameters validParams< NSKernel >()
Definition: NSKernel.C:20
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:76
virtual Real computeQpResidual()
InputParameters validParams< NSEnergyViscousFlux >()
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:60
const VariableValue & _u_vel
Definition: NSKernel.h:34
const VariableValue & _v_vel
Definition: NSKernel.h:35
NSViscStressTensorDerivs< NSEnergyViscousFlux > _vst_derivs
const VariableValue & _rho_w
Definition: NSKernel.h:41
NSEnergyViscousFlux(const InputParameters &parameters)
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:86
virtual Real computeQpOffDiagJacobian(unsigned int jvar)