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 21 of file NSEnergyInviscidFlux.h.

Constructor & Destructor Documentation

◆ NSEnergyInviscidFlux()

NSEnergyInviscidFlux::NSEnergyInviscidFlux ( const InputParameters &  parameters)

Definition at line 29 of file NSEnergyInviscidFlux.C.

30  : NSKernel(parameters), _enthalpy(coupledValue(NS::enthalpy))
31 {
32 }
const std::string enthalpy
Definition: NS.h:28
NSKernel(const InputParameters &parameters)
Definition: NSKernel.C:41
const VariableValue & _enthalpy

Member Function Documentation

◆ computeQpJacobian()

Real NSEnergyInviscidFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 55 of file NSEnergyInviscidFlux.C.

56 {
57  // Derivative of this kernel wrt rho*E
58  const RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
59 
60  // Ratio of specific heats
61  const Real gam = _fp.gamma();
62 
63  // -gamma * phi_j * (U*grad(phi_i))
64  return -gam * _phi[_j][_qp] * (vel * _grad_test[_i][_qp]);
65 }
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:66
const VariableValue & _w_vel
Definition: NSKernel.h:39
const VariableValue & _u_vel
Definition: NSKernel.h:37
const VariableValue & _v_vel
Definition: NSKernel.h:38

◆ computeQpOffDiagJacobian()

Real NSEnergyInviscidFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 68 of file NSEnergyInviscidFlux.C.

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

◆ computeQpResidual()

Real NSEnergyInviscidFlux::computeQpResidual ( )
protectedvirtual

Definition at line 35 of file NSEnergyInviscidFlux.C.

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

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

Member Data Documentation

◆ _dynamic_viscosity

const MaterialProperty<Real>& NSKernel::_dynamic_viscosity
protectedinherited

Definition at line 62 of file NSKernel.h.

◆ _enthalpy

const VariableValue& NSEnergyInviscidFlux::_enthalpy
protected

Definition at line 32 of file NSEnergyInviscidFlux.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

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

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

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