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

The inviscid flux (convective + pressure terms) for the momentum conservation equations. More...

#include <NSMomentumInviscidFlux.h>

Inheritance diagram for NSMomentumInviscidFlux:
[legend]

Public Member Functions

 NSMomentumInviscidFlux (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 & _pressure
 
const unsigned int _component
 
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 (unsigned int m)
 

Detailed Description

The inviscid flux (convective + pressure terms) for the momentum conservation equations.

Definition at line 22 of file NSMomentumInviscidFlux.h.

Constructor & Destructor Documentation

NSMomentumInviscidFlux::NSMomentumInviscidFlux ( const InputParameters &  parameters)

Definition at line 29 of file NSMomentumInviscidFlux.C.

30  : NSKernel(parameters),
31  _pressure(coupledValue(NS::pressure)),
32  _component(getParam<unsigned int>("component"))
33 {
34 }
const VariableValue & _pressure
const unsigned int _component
const std::string pressure
Definition: NS.h:24
NSKernel(const InputParameters &parameters)
Definition: NSKernel.C:39

Member Function Documentation

Real NSMomentumInviscidFlux::computeJacobianHelper ( unsigned int  m)
private

Definition at line 70 of file NSMomentumInviscidFlux.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

71 {
72  const RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
73 
74  // Ratio of specific heats
75  const Real gam = _fp.gamma();
76 
77  switch (m)
78  {
79  case 0: // density
80  {
81  const Real V2 = vel.norm_sq();
82  return vel(_component) * (vel * _grad_test[_i][_qp]) -
83  0.5 * (gam - 1.0) * V2 * _grad_test[_i][_qp](_component);
84  }
85 
86  case 1:
87  case 2:
88  case 3: // momentums
89  {
90  // Map m into m_local = {0,1,2}
91  unsigned int m_local = m - 1;
92 
93  // Kronecker delta
94  const Real delta_kl = (_component == m_local ? 1. : 0.);
95 
96  return -1.0 * (vel(_component) * _grad_test[_i][_qp](m_local) +
97  delta_kl * (vel * _grad_test[_i][_qp]) +
98  (1. - gam) * vel(m_local) * _grad_test[_i][_qp](_component)) *
99  _phi[_j][_qp];
100  }
101 
102  case 4: // energy
103  return -1.0 * (gam - 1.0) * _phi[_j][_qp] * _grad_test[_i][_qp](_component);
104  }
105 
106  mooseError("Shouldn't get here!");
107 }
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:63
const VariableValue & _w_vel
Definition: NSKernel.h:36
const unsigned int _component
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 NSMomentumInviscidFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 54 of file NSMomentumInviscidFlux.C.

55 {
56  // The on-diagonal entry corresponds to variable number _component+1.
58 }
const unsigned int _component
Real computeJacobianHelper(unsigned int m)
Real NSMomentumInviscidFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 61 of file NSMomentumInviscidFlux.C.

62 {
63  if (isNSVariable(jvar))
64  return computeJacobianHelper(mapVarNumber(jvar));
65  else
66  return 0.0;
67 }
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 computeJacobianHelper(unsigned int m)
Real NSMomentumInviscidFlux::computeQpResidual ( )
protectedvirtual

Definition at line 37 of file NSMomentumInviscidFlux.C.

38 {
39  // For _component = k,
40 
41  // (rho*u) * u_k = (rho*u_k) * u <- we write it this way
42  RealVectorValue vec(_u[_qp] * _u_vel[_qp], // (U_k) * u_1
43  _u[_qp] * _v_vel[_qp], // (U_k) * u_2
44  _u[_qp] * _w_vel[_qp]); // (U_k) * u_3
45 
46  // (rho*u_k) * u + e_k * P [ e_k = unit vector in k-direction ]
47  vec(_component) += _pressure[_qp];
48 
49  // -((rho*u_k) * u + e_k * P) * grad(phi)
50  return -(vec * _grad_test[_i][_qp]);
51 }
const VariableValue & _w_vel
Definition: NSKernel.h:36
const VariableValue & _pressure
const unsigned int _component
const VariableValue & _u_vel
Definition: NSKernel.h:34
const VariableValue & _v_vel
Definition: NSKernel.h:35
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(), 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(), 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 unsigned int NSMomentumInviscidFlux::_component
protected
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 VariableValue& NSMomentumInviscidFlux::_pressure
protected

Definition at line 33 of file NSMomentumInviscidFlux.h.

Referenced by computeQpResidual().

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: