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 29 of file NSKernel.h.

Constructor & Destructor Documentation

◆ NSKernel()

NSKernel::NSKernel ( const InputParameters &  parameters)

Definition at line 41 of file NSKernel.C.

42  : Kernel(parameters),
43  // Coupled variables
44  _u_vel(coupledValue(NS::velocity_x)),
45  _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
46  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
47 
48  _rho(coupledValue(NS::density)),
49  _rho_u(coupledValue(NS::momentum_x)),
50  _rho_v(_mesh.dimension() >= 2 ? coupledValue(NS::momentum_y) : _zero),
51  _rho_w(_mesh.dimension() == 3 ? coupledValue(NS::momentum_z) : _zero),
52  _rho_E(coupledValue(NS::total_energy)),
53 
54  // Gradients
55  _grad_rho(coupledGradient(NS::density)),
56  _grad_rho_u(coupledGradient(NS::momentum_x)),
57  _grad_rho_v(_mesh.dimension() >= 2 ? coupledGradient(NS::momentum_y) : _grad_zero),
58  _grad_rho_w(_mesh.dimension() == 3 ? coupledGradient(NS::momentum_z) : _grad_zero),
59  _grad_rho_E(coupledGradient(NS::total_energy)),
60 
61  // Variable numberings
62  _rho_var_number(coupled(NS::density)),
63  _rhou_var_number(coupled(NS::momentum_x)),
64  _rhov_var_number(_mesh.dimension() >= 2 ? coupled(NS::momentum_y) : libMesh::invalid_uint),
65  _rhow_var_number(_mesh.dimension() == 3 ? coupled(NS::momentum_z) : libMesh::invalid_uint),
66  _rhoE_var_number(coupled(NS::total_energy)),
67 
68  // Material properties
69  _dynamic_viscosity(getMaterialProperty<Real>("dynamic_viscosity")),
70  _viscous_stress_tensor(getMaterialProperty<RealTensorValue>("viscous_stress_tensor")),
71 
72  // FluidProperties UserObject
73  _fp(getUserObject<IdealGasFluidProperties>("fluid_properties"))
74 {
75 }

Member Function Documentation

◆ isNSVariable()

bool NSKernel::isNSVariable ( unsigned  var)
protected

◆ mapVarNumber()

unsigned NSKernel::mapVarNumber ( unsigned  var)
protected

Definition at line 88 of file NSKernel.C.

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 }

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

Member Data Documentation

◆ _dynamic_viscosity

const MaterialProperty<Real>& NSKernel::_dynamic_viscosity
protected

Definition at line 61 of file NSKernel.h.

◆ _fp

const IdealGasFluidProperties& NSKernel::_fp
protected

◆ _grad_rho

const VariableGradient& NSKernel::_grad_rho
protected

◆ _grad_rho_E

const VariableGradient& NSKernel::_grad_rho_E
protected

◆ _grad_rho_u

const VariableGradient& NSKernel::_grad_rho_u
protected

◆ _grad_rho_v

const VariableGradient& NSKernel::_grad_rho_v
protected

◆ _grad_rho_w

const VariableGradient& NSKernel::_grad_rho_w
protected

◆ _rho

const VariableValue& NSKernel::_rho
protected

◆ _rho_E

const VariableValue& NSKernel::_rho_E
protected

Definition at line 44 of file NSKernel.h.

◆ _rho_u

const VariableValue& NSKernel::_rho_u
protected

◆ _rho_v

const VariableValue& NSKernel::_rho_v
protected

◆ _rho_var_number

unsigned NSKernel::_rho_var_number
protected

◆ _rho_w

const VariableValue& NSKernel::_rho_w
protected

◆ _rhoE_var_number

unsigned NSKernel::_rhoE_var_number
protected

◆ _rhou_var_number

unsigned NSKernel::_rhou_var_number
protected

◆ _rhov_var_number

unsigned NSKernel::_rhov_var_number
protected

◆ _rhow_var_number

unsigned NSKernel::_rhow_var_number
protected

◆ _u_vel

const VariableValue& NSKernel::_u_vel
protected

◆ _v_vel

const VariableValue& NSKernel::_v_vel
protected

◆ _viscous_stress_tensor

const MaterialProperty<RealTensorValue>& NSKernel::_viscous_stress_tensor
protected

◆ _w_vel

const VariableValue& NSKernel::_w_vel
protected

The documentation for this class was generated from the following files:
NS::velocity_x
const std::string velocity_x
Definition: NS.h:22
NSKernel::_dynamic_viscosity
const MaterialProperty< Real > & _dynamic_viscosity
Definition: NSKernel.h:61
NSKernel::_grad_rho
const VariableGradient & _grad_rho
Definition: NSKernel.h:47
NSKernel::_rhou_var_number
unsigned _rhou_var_number
Definition: NSKernel.h:55
IdealGasFluidProperties
Ideal gas fluid properties Default parameters are for air at atmospheric pressure and temperature.
Definition: IdealGasFluidProperties.h:26
libMesh
Definition: RANFSNormalMechanicalContact.h:24
NS::velocity_y
const std::string velocity_y
Definition: NS.h:23
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
NS::velocity_z
const std::string velocity_z
Definition: NS.h:24
NSKernel::_rhoE_var_number
unsigned _rhoE_var_number
Definition: NSKernel.h:58
NS::momentum_y
const std::string momentum_y
Definition: NS.h:18
NSKernel::_rhow_var_number
unsigned _rhow_var_number
Definition: NSKernel.h:57
NSKernel::_rho
const VariableValue & _rho
Definition: NSKernel.h:40
NSKernel::_rhov_var_number
unsigned _rhov_var_number
Definition: NSKernel.h:56
NS
Definition: NS.h:14
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
NS::density
const std::string density
Definition: NS.h:16
NSKernel::_grad_rho_w
const VariableGradient & _grad_rho_w
Definition: NSKernel.h:50
NSKernel::_rho_v
const VariableValue & _rho_v
Definition: NSKernel.h:42
NS::momentum_z
const std::string momentum_z
Definition: NS.h:19
NSKernel::_rho_var_number
unsigned _rho_var_number
Definition: NSKernel.h:54
NS::momentum_x
const std::string momentum_x
Definition: NS.h:17
NSKernel::_grad_rho_E
const VariableGradient & _grad_rho_E
Definition: NSKernel.h:51
NSKernel::_w_vel
const VariableValue & _w_vel
Definition: NSKernel.h:38
NSKernel::_fp
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:65
NSKernel::_grad_rho_u
const VariableGradient & _grad_rho_u
Definition: NSKernel.h:48
NSKernel::_grad_rho_v
const VariableGradient & _grad_rho_v
Definition: NSKernel.h:49
NS::total_energy
const std::string total_energy
Definition: NS.h:20
NSKernel::_rho_E
const VariableValue & _rho_E
Definition: NSKernel.h:44