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

This class is responsible for computing residuals and Jacobian terms for the k * grad(T) * grad(phi) term in the Navier-Stokes energy equation. More...

#include <NSEnergyThermalFlux.h>

Inheritance diagram for NSEnergyThermalFlux:
[legend]

Public Member Functions

 NSEnergyThermalFlux (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

const VariableGradient & _grad_temp
 
const MaterialProperty< Real > & _thermal_conductivity
 
NSTemperatureDerivs< NSEnergyThermalFlux_temp_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
 

Private Member Functions

Real computeJacobianHelper_value (unsigned var_number)
 

Private Attributes

std::vector< const VariableGradient * > _gradU
 

Friends

template<class U >
class NSTemperatureDerivs
 

Detailed Description

This class is responsible for computing residuals and Jacobian terms for the k * grad(T) * grad(phi) term in the Navier-Stokes energy equation.

Definition at line 27 of file NSEnergyThermalFlux.h.

Constructor & Destructor Documentation

◆ NSEnergyThermalFlux()

NSEnergyThermalFlux::NSEnergyThermalFlux ( const InputParameters &  parameters)

Definition at line 28 of file NSEnergyThermalFlux.C.

29  : NSKernel(parameters),
30  _grad_temp(coupledGradient(NS::temperature)),
31  _thermal_conductivity(getMaterialProperty<Real>("thermal_conductivity")),
32  // Temperature derivative computing object
33  _temp_derivs(*this)
34 {
35  // Store pointers to all variable gradients in a single vector.
36  _gradU.resize(5);
37  _gradU[0] = &_grad_rho;
38  _gradU[1] = &_grad_rho_u;
39  _gradU[2] = &_grad_rho_v;
40  _gradU[3] = &_grad_rho_w;
41  _gradU[4] = &_grad_rho_E;
42 }
NSTemperatureDerivs< NSEnergyThermalFlux > _temp_derivs
const VariableGradient & _grad_rho_w
Definition: NSKernel.h:51
const std::string temperature
Definition: NS.h:27
const VariableGradient & _grad_rho
Definition: NSKernel.h:48
const VariableGradient & _grad_rho_u
Definition: NSKernel.h:49
const VariableGradient & _grad_temp
std::vector< const VariableGradient * > _gradU
const MaterialProperty< Real > & _thermal_conductivity
const VariableGradient & _grad_rho_v
Definition: NSKernel.h:50
const VariableGradient & _grad_rho_E
Definition: NSKernel.h:52
NSKernel(const InputParameters &parameters)
Definition: NSKernel.C:41

Member Function Documentation

◆ computeJacobianHelper_value()

Real NSEnergyThermalFlux::computeJacobianHelper_value ( unsigned  var_number)
private

Definition at line 69 of file NSEnergyThermalFlux.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

70 {
71  // The value to return
72  Real result = 0.0;
73 
74  // I used "ell" here as the loop counter since it matches the
75  // "\ell" used in my LaTeX notes.
76  for (unsigned int ell = 0; ell < 3; ++ell)
77  {
78  // Accumulate the first dot product term
79  Real intermediate_result = _temp_derivs.get_grad(var_number) * _grad_phi[_j][_qp](ell);
80 
81  // Now accumulate the Hessian term
82  Real hess_term = 0.0;
83  for (unsigned n = 0; n < 5; ++n)
84  {
85  // hess_term += get_hess(m,n) * gradU[n](ell); // ideally... but you can't have a
86  // vector<VariableGradient&> :-(
87  hess_term += _temp_derivs.get_hess(var_number, n) *
88  (*_gradU[n])[_qp](ell); // dereference pointer to get value
89  }
90 
91  // Accumulate the second dot product term
92  intermediate_result += hess_term * _phi[_j][_qp];
93 
94  // Hit intermediate_result with the test function, accumulate in the final value
95  result += intermediate_result * _grad_test[_i][_qp](ell);
96  }
97 
98  // Return result, don't forget to multiply by "k"!
99  return _thermal_conductivity[_qp] * result;
100 }
Real get_grad(unsigned i)
The primary interfaces for computing temperature derivatives.
NSTemperatureDerivs< NSEnergyThermalFlux > _temp_derivs
std::vector< const VariableGradient * > _gradU
const MaterialProperty< Real > & _thermal_conductivity
Real get_hess(unsigned i, unsigned j)

◆ computeQpJacobian()

Real NSEnergyThermalFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 52 of file NSEnergyThermalFlux.C.

53 {
54  // The "on-diagonal" Jacobian for the energy equation
55  // corresponds to variable number 4.
56  return computeJacobianHelper_value(/*var_number=*/4);
57 }
Real computeJacobianHelper_value(unsigned var_number)

◆ computeQpOffDiagJacobian()

Real NSEnergyThermalFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 60 of file NSEnergyThermalFlux.C.

61 {
62  if (isNSVariable(jvar))
64  else
65  return 0.0;
66 }
Real computeJacobianHelper_value(unsigned var_number)
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:78
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:88

◆ computeQpResidual()

Real NSEnergyThermalFlux::computeQpResidual ( )
protectedvirtual

Definition at line 45 of file NSEnergyThermalFlux.C.

46 {
47  // k * grad(T) * grad(phi)
48  return _thermal_conductivity[_qp] * (_grad_temp[_qp] * _grad_test[_i][_qp]);
49 }
const VariableGradient & _grad_temp
const MaterialProperty< Real > & _thermal_conductivity

◆ 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(), NSEnergyViscousFlux::computeQpOffDiagJacobian(), NSMomentumViscousFlux::computeQpOffDiagJacobian(), and 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(), NSEnergyViscousFlux::computeQpOffDiagJacobian(), NSMomentumInviscidFlux::computeQpOffDiagJacobian(), NSMomentumViscousFlux::computeQpOffDiagJacobian(), and 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

◆ NSTemperatureDerivs

template<class U >
friend class NSTemperatureDerivs
friend

Definition at line 49 of file NSEnergyThermalFlux.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

◆ _grad_temp

const VariableGradient& NSEnergyThermalFlux::_grad_temp
protected

Definition at line 38 of file NSEnergyThermalFlux.h.

Referenced by computeQpResidual().

◆ _gradU

std::vector<const VariableGradient *> NSEnergyThermalFlux::_gradU
private

Definition at line 64 of file NSEnergyThermalFlux.h.

Referenced by computeJacobianHelper_value(), and NSEnergyThermalFlux().

◆ _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

◆ _rho_v

const VariableValue& NSKernel::_rho_v
protectedinherited

◆ _rho_var_number

unsigned NSKernel::_rho_var_number
protectedinherited

◆ _rho_w

const VariableValue& NSKernel::_rho_w
protectedinherited

◆ _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

◆ _temp_derivs

NSTemperatureDerivs<NSEnergyThermalFlux> NSEnergyThermalFlux::_temp_derivs
protected

Definition at line 45 of file NSEnergyThermalFlux.h.

Referenced by computeJacobianHelper_value().

◆ _thermal_conductivity

const MaterialProperty<Real>& NSEnergyThermalFlux::_thermal_conductivity
protected

Definition at line 41 of file NSEnergyThermalFlux.h.

Referenced by computeJacobianHelper_value(), and computeQpResidual().

◆ _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

◆ _w_vel

const VariableValue& NSKernel::_w_vel
protectedinherited

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