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 24 of file NSEnergyThermalFlux.h.

Constructor & Destructor Documentation

NSEnergyThermalFlux::NSEnergyThermalFlux ( const InputParameters &  parameters)

Definition at line 24 of file NSEnergyThermalFlux.C.

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

Member Function Documentation

Real NSEnergyThermalFlux::computeJacobianHelper_value ( unsigned  var_number)
private

Definition at line 65 of file NSEnergyThermalFlux.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

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

Definition at line 48 of file NSEnergyThermalFlux.C.

49 {
50  // The "on-diagonal" Jacobian for the energy equation
51  // corresponds to variable number 4.
52  return computeJacobianHelper_value(/*var_number=*/4);
53 }
Real computeJacobianHelper_value(unsigned var_number)
Real NSEnergyThermalFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 56 of file NSEnergyThermalFlux.C.

57 {
58  if (isNSVariable(jvar))
60  else
61  return 0.0;
62 }
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:76
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:86
Real NSEnergyThermalFlux::computeQpResidual ( )
protectedvirtual

Definition at line 41 of file NSEnergyThermalFlux.C.

42 {
43  // k * grad(T) * grad(phi)
44  return _thermal_conductivity[_qp] * (_grad_temp[_qp] * _grad_test[_i][_qp]);
45 }
const VariableGradient & _grad_temp
const MaterialProperty< Real > & _thermal_conductivity
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 76 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().

77 {
78  if (var == _rho_var_number || var == _rhou_var_number || var == _rhov_var_number ||
79  var == _rhow_var_number || var == _rhoE_var_number)
80  return true;
81  else
82  return false;
83 }
unsigned _rhov_var_number
Definition: NSKernel.h:54
unsigned _rho_var_number
Definition: NSKernel.h:52
unsigned _rhow_var_number
Definition: NSKernel.h:55
unsigned _rhoE_var_number
Definition: NSKernel.h:56
unsigned _rhou_var_number
Definition: NSKernel.h:53
unsigned NSKernel::mapVarNumber ( unsigned  var)
protectedinherited

Definition at line 86 of file NSKernel.C.

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

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

Friends And Related Function Documentation

template<class U >
friend class NSTemperatureDerivs
friend

Definition at line 46 of file NSEnergyThermalFlux.h.

Member Data Documentation

const MaterialProperty<Real>& NSKernel::_dynamic_viscosity
protectedinherited

Definition at line 59 of file NSKernel.h.

const IdealGasFluidProperties& NSKernel::_fp
protectedinherited
const VariableGradient& NSKernel::_grad_rho
protectedinherited
const VariableGradient& NSKernel::_grad_rho_E
protectedinherited
const VariableGradient& NSKernel::_grad_rho_u
protectedinherited
const VariableGradient& NSKernel::_grad_rho_v
protectedinherited
const VariableGradient& NSKernel::_grad_rho_w
protectedinherited
const VariableGradient& NSEnergyThermalFlux::_grad_temp
protected

Definition at line 35 of file NSEnergyThermalFlux.h.

Referenced by computeQpResidual().

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

Definition at line 61 of file NSEnergyThermalFlux.h.

Referenced by computeJacobianHelper_value(), and NSEnergyThermalFlux().

const VariableValue& NSKernel::_rho
protectedinherited
const VariableValue& NSKernel::_rho_E
protectedinherited

Definition at line 42 of file NSKernel.h.

const VariableValue& NSKernel::_rho_u
protectedinherited
const VariableValue& NSKernel::_rho_v
protectedinherited
unsigned NSKernel::_rho_var_number
protectedinherited
const VariableValue& NSKernel::_rho_w
protectedinherited
unsigned NSKernel::_rhoE_var_number
protectedinherited
unsigned NSKernel::_rhou_var_number
protectedinherited
unsigned NSKernel::_rhov_var_number
protectedinherited
unsigned NSKernel::_rhow_var_number
protectedinherited
NSTemperatureDerivs<NSEnergyThermalFlux> NSEnergyThermalFlux::_temp_derivs
protected

Definition at line 42 of file NSEnergyThermalFlux.h.

Referenced by computeJacobianHelper_value().

const MaterialProperty<Real>& NSEnergyThermalFlux::_thermal_conductivity
protected

Definition at line 38 of file NSEnergyThermalFlux.h.

Referenced by computeJacobianHelper_value(), and computeQpResidual().

const VariableValue& NSKernel::_u_vel
protectedinherited
const VariableValue& NSKernel::_v_vel
protectedinherited
const MaterialProperty<RealTensorValue>& NSKernel::_viscous_stress_tensor
protectedinherited
const VariableValue& NSKernel::_w_vel
protectedinherited

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