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

#include <NSEnergyInviscidFlux.h>

Inheritance diagram for NSEnergyInviscidFlux:
[legend]

Public Member Functions

 NSEnergyInviscidFlux (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 VariableValue & _enthalpy
 
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

Definition at line 18 of file NSEnergyInviscidFlux.h.

Constructor & Destructor Documentation

NSEnergyInviscidFlux::NSEnergyInviscidFlux ( const InputParameters &  parameters)

Definition at line 25 of file NSEnergyInviscidFlux.C.

26  : NSKernel(parameters), _enthalpy(coupledValue(NS::enthalpy))
27 {
28 }
const std::string enthalpy
Definition: NS.h:26
NSKernel(const InputParameters &parameters)
Definition: NSKernel.C:39
const VariableValue & _enthalpy

Member Function Documentation

Real NSEnergyInviscidFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 51 of file NSEnergyInviscidFlux.C.

52 {
53  // Derivative of this kernel wrt rho*E
54  const RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
55 
56  // Ratio of specific heats
57  const Real gam = _fp.gamma();
58 
59  // -gamma * phi_j * (U*grad(phi_i))
60  return -gam * _phi[_j][_qp] * (vel * _grad_test[_i][_qp]);
61 }
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:63
const VariableValue & _w_vel
Definition: NSKernel.h:36
const VariableValue & _u_vel
Definition: NSKernel.h:34
virtual Real gamma(Real v=0., Real u=0.) const override
Compute the ratio of specific heats.
const VariableValue & _v_vel
Definition: NSKernel.h:35
Real NSEnergyInviscidFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 64 of file NSEnergyInviscidFlux.C.

65 {
66  if (isNSVariable(jvar))
67  {
68  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
69  Real V2 = vel.norm_sq();
70 
71  // Ratio of specific heats
72  const Real gam = _fp.gamma();
73 
74  // Derivative wrt density
75  if (jvar == _rho_var_number)
76  return -((0.5 * (gam - 1) * V2 - _enthalpy[_qp]) * _phi[_j][_qp] *
77  (vel * _grad_test[_i][_qp]));
78 
79  // Derivatives wrt momentums
80  else if ((jvar == _rhou_var_number) || (jvar == _rhov_var_number) || (jvar == _rhow_var_number))
81  {
82  // Map jvar into jlocal = {0,1,2}, regardless of how Moose has numbered things.
83  unsigned jlocal = 0;
84 
85  if (jvar == _rhov_var_number)
86  jlocal = 1;
87  else if (jvar == _rhow_var_number)
88  jlocal = 2;
89 
90  // Scale the velocity vector by the scalar (1-gamma)*vel(jlocal)
91  vel *= (1.0 - gam) * vel(jlocal);
92 
93  // Add in the enthalpy in the jlocal'th entry
94  vel(jlocal) += _enthalpy[_qp];
95 
96  // Return -1 * (vel * grad(phi_i)) * phi_j
97  return -(vel * _grad_test[_i][_qp]) * _phi[_j][_qp];
98  }
99 
100  else
101  {
102  std::ostringstream oss;
103  oss << "Invalid jvar=" << jvar << " requested!\n"
104  << "Did not match:\n"
105  << " _rho_var_number =" << _rho_var_number << "\n"
106  << " _rhou_var_number=" << _rhou_var_number << "\n"
107  << " _rhov_var_number=" << _rhov_var_number << "\n"
108  << " _rhow_var_number=" << _rhow_var_number << std::endl;
109  mooseError(oss.str());
110  }
111  }
112  else
113  return 0.0;
114 }
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:63
const VariableValue & _w_vel
Definition: NSKernel.h:36
unsigned _rhov_var_number
Definition: NSKernel.h:54
unsigned _rho_var_number
Definition: NSKernel.h:52
unsigned _rhow_var_number
Definition: NSKernel.h:55
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:76
const VariableValue & _u_vel
Definition: NSKernel.h:34
virtual Real gamma(Real v=0., Real u=0.) const override
Compute the ratio of specific heats.
const VariableValue & _v_vel
Definition: NSKernel.h:35
unsigned _rhou_var_number
Definition: NSKernel.h:53
const VariableValue & _enthalpy
Real NSEnergyInviscidFlux::computeQpResidual ( )
protectedvirtual

Definition at line 31 of file NSEnergyInviscidFlux.C.

32 {
33  // H = total enthalpy = E + P/rho
34  // => rho * u * H = rho * u ( E + P/rho)
35  // = u ( rho*E + P)
36 
37  // velocity vector
38  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
39 
40  // Multiply vector U by the scalar value (rho*E + P) to get rho * U * H
41  // vel *= (_u[_qp] + _pressure[_qp]);
42 
43  // Multiply velocity vector by the scalar (rho * H)
44  vel *= (_rho[_qp] * _enthalpy[_qp]);
45 
46  // Return -1 * vel * grad(phi_i)
47  return -(vel * _grad_test[_i][_qp]);
48 }
const VariableValue & _w_vel
Definition: NSKernel.h:36
const VariableValue & _rho
Definition: NSKernel.h:38
const VariableValue & _u_vel
Definition: NSKernel.h:34
const VariableValue & _v_vel
Definition: NSKernel.h:35
const VariableValue & _enthalpy
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(), 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)
protectedinherited

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
protectedinherited

Definition at line 59 of file NSKernel.h.

const VariableValue& NSEnergyInviscidFlux::_enthalpy
protected

Definition at line 29 of file NSEnergyInviscidFlux.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

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