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