www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
NSEnergyViscousFlux Class Reference

Viscous flux terms in energy equation. More...

#include <NSEnergyViscousFlux.h>

Inheritance diagram for NSEnergyViscousFlux:
[legend]

Public Member Functions

 NSEnergyViscousFlux (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
bool isNSVariable (unsigned var)
 Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compressible NS equations. More...
 
unsigned mapVarNumber (unsigned var)
 

Protected Attributes

NSViscStressTensorDerivs< NSEnergyViscousFlux_vst_derivs
 
const VariableValue & _u_vel
 
const VariableValue & _v_vel
 
const VariableValue & _w_vel
 
const VariableValue & _rho
 
const VariableValue & _rho_u
 
const VariableValue & _rho_v
 
const VariableValue & _rho_w
 
const VariableValue & _rho_E
 
const VariableGradient & _grad_rho
 
const VariableGradient & _grad_rho_u
 
const VariableGradient & _grad_rho_v
 
const VariableGradient & _grad_rho_w
 
const VariableGradient & _grad_rho_E
 
unsigned _rho_var_number
 
unsigned _rhou_var_number
 
unsigned _rhov_var_number
 
unsigned _rhow_var_number
 
unsigned _rhoE_var_number
 
const MaterialProperty< Real > & _dynamic_viscosity
 
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
 
const IdealGasFluidProperties_fp
 

Friends

template<class U >
class NSViscStressTensorDerivs
 

Detailed Description

Viscous flux terms in energy equation.

Definition at line 25 of file NSEnergyViscousFlux.h.

Constructor & Destructor Documentation

◆ NSEnergyViscousFlux()

NSEnergyViscousFlux::NSEnergyViscousFlux ( const InputParameters &  parameters)

Definition at line 23 of file NSEnergyViscousFlux.C.

24  : NSKernel(parameters), _vst_derivs(*this)
25 {
26 }
NSViscStressTensorDerivs< NSEnergyViscousFlux > _vst_derivs
NSKernel(const InputParameters &parameters)
Definition: NSKernel.C:41

Member Function Documentation

◆ computeQpJacobian()

Real NSEnergyViscousFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 39 of file NSEnergyViscousFlux.C.

40 {
41  // No dependence of this term on U_4!
42  return 0.0;
43 }

◆ computeQpOffDiagJacobian()

Real NSEnergyViscousFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 46 of file NSEnergyViscousFlux.C.

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 }
const VariableValue & _rho_u
Definition: NSKernel.h:42
const VariableValue & _rho
Definition: NSKernel.h:41
Real dtau(unsigned k, unsigned ell, unsigned m)
The primary interface for computing viscous stress tensor derivatives.
const VariableValue & _rho_v
Definition: NSKernel.h:43
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:78
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:63
NSViscStressTensorDerivs< NSEnergyViscousFlux > _vst_derivs
const VariableValue & _rho_w
Definition: NSKernel.h:44
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:88

◆ computeQpResidual()

Real NSEnergyViscousFlux::computeQpResidual ( )
protectedvirtual

Definition at line 29 of file NSEnergyViscousFlux.C.

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 }
const VariableValue & _w_vel
Definition: NSKernel.h:39
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:63
const VariableValue & _u_vel
Definition: NSKernel.h:37
const VariableValue & _v_vel
Definition: NSKernel.h:38

◆ isNSVariable()

bool NSKernel::isNSVariable ( unsigned  var)
protectedinherited

Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compressible NS equations.

Definition at line 78 of file NSKernel.C.

Referenced by NSSUPGEnergy::computeJacobianHelper(), NSSUPGMass::computeJacobianHelper(), NSSUPGMomentum::computeJacobianHelper(), NSMassInviscidFlux::computeQpOffDiagJacobian(), NSEnergyInviscidFlux::computeQpOffDiagJacobian(), NSMomentumInviscidFluxWithGradP::computeQpOffDiagJacobian(), NSMomentumInviscidFlux::computeQpOffDiagJacobian(), computeQpOffDiagJacobian(), NSMomentumViscousFlux::computeQpOffDiagJacobian(), and NSEnergyThermalFlux::computeQpOffDiagJacobian().

79 {
80  if (var == _rho_var_number || var == _rhou_var_number || var == _rhov_var_number ||
81  var == _rhow_var_number || var == _rhoE_var_number)
82  return true;
83  else
84  return false;
85 }
unsigned _rhov_var_number
Definition: NSKernel.h:57
unsigned _rho_var_number
Definition: NSKernel.h:55
unsigned _rhow_var_number
Definition: NSKernel.h:58
unsigned _rhoE_var_number
Definition: NSKernel.h:59
unsigned _rhou_var_number
Definition: NSKernel.h:56

◆ mapVarNumber()

unsigned NSKernel::mapVarNumber ( unsigned  var)
protectedinherited

Definition at line 88 of file NSKernel.C.

Referenced by NSSUPGEnergy::computeJacobianHelper(), NSSUPGMass::computeJacobianHelper(), NSSUPGMomentum::computeJacobianHelper(), NSMassInviscidFlux::computeQpOffDiagJacobian(), NSMomentumInviscidFluxWithGradP::computeQpOffDiagJacobian(), NSMomentumInviscidFlux::computeQpOffDiagJacobian(), computeQpOffDiagJacobian(), NSMomentumViscousFlux::computeQpOffDiagJacobian(), and NSEnergyThermalFlux::computeQpOffDiagJacobian().

89 {
90  // Convert the Moose numbering to:
91  // 0 for rho
92  // 1 for rho*u
93  // 2 for rho*v
94  // 3 for rho*w
95  // 4 for rho*e
96  // regardless of the problem dimension, etc.
97  unsigned mapped_var_number = 99;
98 
99  if (var == _rho_var_number)
100  mapped_var_number = 0;
101  else if (var == _rhou_var_number)
102  mapped_var_number = 1;
103  else if (var == _rhov_var_number)
104  mapped_var_number = 2;
105  else if (var == _rhow_var_number)
106  mapped_var_number = 3;
107  else if (var == _rhoE_var_number)
108  mapped_var_number = 4;
109  else
110  mooseError("Invalid var!");
111 
112  return mapped_var_number;
113 }
unsigned _rhov_var_number
Definition: NSKernel.h:57
unsigned _rho_var_number
Definition: NSKernel.h:55
unsigned _rhow_var_number
Definition: NSKernel.h:58
unsigned _rhoE_var_number
Definition: NSKernel.h:59
unsigned _rhou_var_number
Definition: NSKernel.h:56

Friends And Related Function Documentation

◆ NSViscStressTensorDerivs

template<class U >
friend class NSViscStressTensorDerivs
friend

Definition at line 41 of file NSEnergyViscousFlux.h.

Member Data Documentation

◆ _dynamic_viscosity

const MaterialProperty<Real>& NSKernel::_dynamic_viscosity
protectedinherited

Definition at line 62 of file NSKernel.h.

◆ _fp

const IdealGasFluidProperties& NSKernel::_fp
protectedinherited

◆ _grad_rho

const VariableGradient& NSKernel::_grad_rho
protectedinherited

◆ _grad_rho_E

const VariableGradient& NSKernel::_grad_rho_E
protectedinherited

◆ _grad_rho_u

const VariableGradient& NSKernel::_grad_rho_u
protectedinherited

◆ _grad_rho_v

const VariableGradient& NSKernel::_grad_rho_v
protectedinherited

◆ _grad_rho_w

const VariableGradient& NSKernel::_grad_rho_w
protectedinherited

◆ _rho

const VariableValue& NSKernel::_rho
protectedinherited

◆ _rho_E

const VariableValue& NSKernel::_rho_E
protectedinherited

Definition at line 45 of file NSKernel.h.

◆ _rho_u

const VariableValue& NSKernel::_rho_u
protectedinherited

Definition at line 42 of file NSKernel.h.

Referenced by computeQpOffDiagJacobian(), and NSMassInviscidFlux::computeQpResidual().

◆ _rho_v

const VariableValue& NSKernel::_rho_v
protectedinherited

Definition at line 43 of file NSKernel.h.

Referenced by computeQpOffDiagJacobian(), and NSMassInviscidFlux::computeQpResidual().

◆ _rho_var_number

unsigned NSKernel::_rho_var_number
protectedinherited

◆ _rho_w

const VariableValue& NSKernel::_rho_w
protectedinherited

Definition at line 44 of file NSKernel.h.

Referenced by computeQpOffDiagJacobian(), and NSMassInviscidFlux::computeQpResidual().

◆ _rhoE_var_number

unsigned NSKernel::_rhoE_var_number
protectedinherited

◆ _rhou_var_number

unsigned NSKernel::_rhou_var_number
protectedinherited

◆ _rhov_var_number

unsigned NSKernel::_rhov_var_number
protectedinherited

◆ _rhow_var_number

unsigned NSKernel::_rhow_var_number
protectedinherited

◆ _u_vel

const VariableValue& NSKernel::_u_vel
protectedinherited

◆ _v_vel

const VariableValue& NSKernel::_v_vel
protectedinherited

◆ _viscous_stress_tensor

const MaterialProperty<RealTensorValue>& NSKernel::_viscous_stress_tensor
protectedinherited

◆ _vst_derivs

NSViscStressTensorDerivs<NSEnergyViscousFlux> NSEnergyViscousFlux::_vst_derivs
protected

Definition at line 37 of file NSEnergyViscousFlux.h.

Referenced by computeQpOffDiagJacobian().

◆ _w_vel

const VariableValue& NSKernel::_w_vel
protectedinherited

The documentation for this class was generated from the following files: