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

This class couples together all the variables for the compressible Navier-Stokes equations to allow them to be used in derived Kernel classes. More...

#include <NSKernel.h>

Inheritance diagram for NSKernel:
[legend]

Public Member Functions

 NSKernel (const InputParameters &parameters)
 

Protected Member Functions

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

Detailed Description

This class couples together all the variables for the compressible Navier-Stokes equations to allow them to be used in derived Kernel classes.

This prevents duplication of lines of code between e.g. the momentum and energy equations, since they have a lot in common.

Definition at line 27 of file NSKernel.h.

Constructor & Destructor Documentation

NSKernel::NSKernel ( const InputParameters &  parameters)

Definition at line 39 of file NSKernel.C.

40  : Kernel(parameters),
41  // Coupled variables
42  _u_vel(coupledValue(NS::velocity_x)),
43  _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
44  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
45 
46  _rho(coupledValue(NS::density)),
47  _rho_u(coupledValue(NS::momentum_x)),
48  _rho_v(_mesh.dimension() >= 2 ? coupledValue(NS::momentum_y) : _zero),
49  _rho_w(_mesh.dimension() == 3 ? coupledValue(NS::momentum_z) : _zero),
50  _rho_E(coupledValue(NS::total_energy)),
51 
52  // Gradients
53  _grad_rho(coupledGradient(NS::density)),
54  _grad_rho_u(coupledGradient(NS::momentum_x)),
55  _grad_rho_v(_mesh.dimension() >= 2 ? coupledGradient(NS::momentum_y) : _grad_zero),
56  _grad_rho_w(_mesh.dimension() == 3 ? coupledGradient(NS::momentum_z) : _grad_zero),
57  _grad_rho_E(coupledGradient(NS::total_energy)),
58 
59  // Variable numberings
60  _rho_var_number(coupled(NS::density)),
61  _rhou_var_number(coupled(NS::momentum_x)),
62  _rhov_var_number(_mesh.dimension() >= 2 ? coupled(NS::momentum_y) : libMesh::invalid_uint),
63  _rhow_var_number(_mesh.dimension() == 3 ? coupled(NS::momentum_z) : libMesh::invalid_uint),
64  _rhoE_var_number(coupled(NS::total_energy)),
65 
66  // Material properties
67  _dynamic_viscosity(getMaterialProperty<Real>("dynamic_viscosity")),
68  _viscous_stress_tensor(getMaterialProperty<RealTensorValue>("viscous_stress_tensor")),
69 
70  // FluidProperties UserObject
71  _fp(getUserObject<IdealGasFluidProperties>("fluid_properties"))
72 {
73 }
Definition: NS.h:13
const std::string momentum_x
Definition: NS.h:16
const VariableValue & _rho_u
Definition: NSKernel.h:39
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:63
const VariableValue & _w_vel
Definition: NSKernel.h:36
const VariableValue & _rho
Definition: NSKernel.h:38
const VariableGradient & _grad_rho_w
Definition: NSKernel.h:48
const std::string velocity_z
Definition: NS.h:23
const MaterialProperty< Real > & _dynamic_viscosity
Definition: NSKernel.h:59
const std::string density
Definition: NS.h:15
const VariableValue & _rho_E
Definition: NSKernel.h:42
unsigned _rhov_var_number
Definition: NSKernel.h:54
unsigned _rho_var_number
Definition: NSKernel.h:52
const std::string velocity_x
Definition: NS.h:21
const VariableValue & _rho_v
Definition: NSKernel.h:40
const VariableGradient & _grad_rho
Definition: NSKernel.h:45
unsigned _rhow_var_number
Definition: NSKernel.h:55
const std::string velocity_y
Definition: NS.h:22
const VariableGradient & _grad_rho_u
Definition: NSKernel.h:46
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:60
unsigned _rhoE_var_number
Definition: NSKernel.h:56
const VariableGradient & _grad_rho_v
Definition: NSKernel.h:47
const std::string momentum_y
Definition: NS.h:17
const VariableValue & _u_vel
Definition: NSKernel.h:34
const VariableValue & _v_vel
Definition: NSKernel.h:35
const VariableGradient & _grad_rho_E
Definition: NSKernel.h:49
const std::string total_energy
Definition: NS.h:19
const std::string momentum_z
Definition: NS.h:18
const VariableValue & _rho_w
Definition: NSKernel.h:41
Ideal gas fluid properties.
unsigned _rhou_var_number
Definition: NSKernel.h:53

Member Function Documentation

bool NSKernel::isNSVariable ( unsigned  var)
protected

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 NSEnergyThermalFlux::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)
protected

Definition at line 86 of file NSKernel.C.

Referenced by NSSUPGEnergy::computeJacobianHelper(), NSSUPGMass::computeJacobianHelper(), NSSUPGMomentum::computeJacobianHelper(), NSMassInviscidFlux::computeQpOffDiagJacobian(), NSMomentumInviscidFluxWithGradP::computeQpOffDiagJacobian(), NSMomentumInviscidFlux::computeQpOffDiagJacobian(), NSEnergyViscousFlux::computeQpOffDiagJacobian(), NSMomentumViscousFlux::computeQpOffDiagJacobian(), and NSEnergyThermalFlux::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

Member Data Documentation

const MaterialProperty<Real>& NSKernel::_dynamic_viscosity
protected

Definition at line 59 of file NSKernel.h.

const IdealGasFluidProperties& NSKernel::_fp
protected
const VariableGradient& NSKernel::_grad_rho
protected
const VariableGradient& NSKernel::_grad_rho_E
protected
const VariableGradient& NSKernel::_grad_rho_u
protected
const VariableGradient& NSKernel::_grad_rho_v
protected
const VariableGradient& NSKernel::_grad_rho_w
protected
const VariableValue& NSKernel::_rho
protected
const VariableValue& NSKernel::_rho_E
protected

Definition at line 42 of file NSKernel.h.

const VariableValue& NSKernel::_rho_u
protected
const VariableValue& NSKernel::_rho_v
protected
unsigned NSKernel::_rho_var_number
protected
const VariableValue& NSKernel::_rho_w
protected
unsigned NSKernel::_rhoE_var_number
protected
unsigned NSKernel::_rhou_var_number
protected
unsigned NSKernel::_rhov_var_number
protected
unsigned NSKernel::_rhow_var_number
protected
const VariableValue& NSKernel::_u_vel
protected
const VariableValue& NSKernel::_v_vel
protected
const MaterialProperty<RealTensorValue>& NSKernel::_viscous_stress_tensor
protected
const VariableValue& NSKernel::_w_vel
protected

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