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 25 of file NSMomentumInviscidFlux.h.

Constructor & Destructor Documentation

◆ NSMomentumInviscidFlux()

NSMomentumInviscidFlux::NSMomentumInviscidFlux ( const InputParameters &  parameters)

Definition at line 33 of file NSMomentumInviscidFlux.C.

34  : NSKernel(parameters),
35  _pressure(coupledValue(NS::pressure)),
36  _component(getParam<unsigned int>("component"))
37 {
38 }
const VariableValue & _pressure
const unsigned int _component
const std::string pressure
Definition: NS.h:26
NSKernel(const InputParameters &parameters)
Definition: NSKernel.C:41

Member Function Documentation

◆ computeJacobianHelper()

Real NSMomentumInviscidFlux::computeJacobianHelper ( unsigned int  m)
private

Definition at line 74 of file NSMomentumInviscidFlux.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

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

◆ computeQpJacobian()

Real NSMomentumInviscidFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 58 of file NSMomentumInviscidFlux.C.

59 {
60  // The on-diagonal entry corresponds to variable number _component+1.
62 }
const unsigned int _component
Real computeJacobianHelper(unsigned int m)

◆ computeQpOffDiagJacobian()

Real NSMomentumInviscidFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 65 of file NSMomentumInviscidFlux.C.

66 {
67  if (isNSVariable(jvar))
68  return computeJacobianHelper(mapVarNumber(jvar));
69  else
70  return 0.0;
71 }
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:78
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:88
Real computeJacobianHelper(unsigned int m)

◆ computeQpResidual()

Real NSMomentumInviscidFlux::computeQpResidual ( )
protectedvirtual

Definition at line 41 of file NSMomentumInviscidFlux.C.

42 {
43  // For _component = k,
44 
45  // (rho*u) * u_k = (rho*u_k) * u <- we write it this way
46  RealVectorValue vec(_u[_qp] * _u_vel[_qp], // (U_k) * u_1
47  _u[_qp] * _v_vel[_qp], // (U_k) * u_2
48  _u[_qp] * _w_vel[_qp]); // (U_k) * u_3
49 
50  // (rho*u_k) * u + e_k * P [ e_k = unit vector in k-direction ]
51  vec(_component) += _pressure[_qp];
52 
53  // -((rho*u_k) * u + e_k * P) * grad(phi)
54  return -(vec * _grad_test[_i][_qp]);
55 }
const VariableValue & _w_vel
Definition: NSKernel.h:39
const VariableValue & _pressure
const unsigned int _component
const VariableValue & _u_vel
Definition: NSKernel.h:37
const VariableValue & _v_vel
Definition: NSKernel.h:38

◆ 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(), NSEnergyInviscidFlux::computeQpOffDiagJacobian(), NSMomentumInviscidFluxWithGradP::computeQpOffDiagJacobian(), 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(), 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

◆ _component

const unsigned int NSMomentumInviscidFlux::_component
protected

◆ _dynamic_viscosity

const MaterialProperty<Real>& NSKernel::_dynamic_viscosity
protectedinherited

Definition at line 62 of file NSKernel.h.

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

◆ _pressure

const VariableValue& NSMomentumInviscidFlux::_pressure
protected

Definition at line 36 of file NSMomentumInviscidFlux.h.

Referenced by computeQpResidual().

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