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

Compute residual and Jacobian terms form the SUPG terms in the energy equation. More...

#include <NSSUPGEnergy.h>

Inheritance diagram for NSSUPGEnergy:
[legend]

Public Member Functions

 NSSUPGEnergy (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 MaterialProperty< RealTensorValue > & _viscous_stress_tensor
 
const MaterialProperty< Real > & _dynamic_viscosity
 
const MaterialProperty< Real > & _thermal_conductivity
 
const MaterialProperty< Real > & _hsupg
 
const MaterialProperty< Real > & _tauc
 
const MaterialProperty< Real > & _taum
 
const MaterialProperty< Real > & _taue
 
const MaterialProperty< std::vector< Real > > & _strong_residuals
 
const MaterialProperty< std::vector< RealTensorValue > > & _calA
 
const MaterialProperty< std::vector< RealTensorValue > > & _calC
 
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _calE
 
const VariableValue & _d_rhodot_du
 
const VariableValue & _d_rhoudot_du
 
const VariableValue & _d_rhovdot_du
 
const VariableValue & _d_rhowdot_du
 
const VariableValue & _d_rhoEdot_du
 
const VariableValue & _temperature
 
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 IdealGasFluidProperties_fp
 

Private Member Functions

Real computeJacobianHelper (unsigned var)
 

Detailed Description

Compute residual and Jacobian terms form the SUPG terms in the energy equation.

Definition at line 25 of file NSSUPGEnergy.h.

Constructor & Destructor Documentation

◆ NSSUPGEnergy()

NSSUPGEnergy::NSSUPGEnergy ( const InputParameters &  parameters)

Definition at line 27 of file NSSUPGEnergy.C.

27 : NSSUPGBase(parameters) {}
NSSUPGBase(const InputParameters &parameters)
Definition: NSSUPGBase.C:28

Member Function Documentation

◆ computeJacobianHelper()

Real NSSUPGEnergy::computeJacobianHelper ( unsigned  var)
private

Definition at line 90 of file NSSUPGEnergy.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

91 {
92  if (isNSVariable(var))
93  {
94  // Convert the Moose numbering to canonical NS variable numbering.
95  unsigned mapped_var_number = mapVarNumber(var);
96 
97  // Convenience vars
98 
99  // Velocity vector
100  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
101 
102  // Velocity vector magnitude squared
103  Real velmag2 = vel.norm_sq();
104 
105  // Ratio of specific heats
106  const Real gam = _fp.gamma();
107 
108  // Shortcuts for shape function gradients at current qp.
109  RealVectorValue grad_test_i = _grad_test[_i][_qp];
110  RealVectorValue grad_phi_j = _grad_phi[_j][_qp];
111 
112  // ...
113 
114  // 1.) taum- and taue-proportional terms present for any variable:
115 
116  //
117  // Art. Diffusion matrix for taum-proportional term = (diag(H) + (1-gam)*S) * A_{ell}
118  //
119  RealTensorValue mom_mat;
120  mom_mat(0, 0) = mom_mat(1, 1) = mom_mat(2, 2) = _enthalpy[_qp]; // (diag(H)
121  mom_mat += (1. - gam) * _calC[_qp][0] * _calC[_qp][0].transpose(); // + (1-gam)*S)
122  mom_mat = mom_mat * _calA[_qp][mapped_var_number]; // * A_{ell}
123  Real mom_term = _taum[_qp] * grad_test_i * (mom_mat * grad_phi_j);
124 
125  //
126  // Art. Diffusion matrix for taue-proportinal term = gam * E_{ell},
127  // where E_{ell} = C_k * E_{k ell} for any k, summation over k *not* implied.
128  //
129  RealTensorValue ene_mat = gam * _calC[_qp][0] * _calE[_qp][0][mapped_var_number];
130  Real ene_term = _taue[_qp] * grad_test_i * (ene_mat * grad_phi_j);
131 
132  // 2.) Terms only present if the variable is one of the momentums
133  Real mass_term = 0.;
134 
135  switch (mapped_var_number)
136  {
137  case 1:
138  case 2:
139  case 3:
140  {
141  // Variable for zero-based indexing into local matrices and vectors.
142  unsigned m_local = mapped_var_number - 1;
143 
144  //
145  // Art. Diffusion matrix for tauc-proportional term = (0.5*(gam-1.)*velmag2 - H)*C_m
146  //
147  RealTensorValue mass_mat =
148  (0.5 * (gam - 1.) * velmag2 - _enthalpy[_qp]) * _calC[_qp][m_local];
149  mass_term = _tauc[_qp] * grad_test_i * (mass_mat * grad_phi_j);
150 
151  // Don't even need to break, no other cases to fall through to...
152  break;
153  }
154  }
155 
156  // Sum up values and return
157  return mass_term + mom_term + ene_term;
158  }
159  else
160  return 0.0;
161 }
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:66
const VariableValue & _w_vel
Definition: NSKernel.h:39
const MaterialProperty< std::vector< RealTensorValue > > & _calC
Definition: NSSUPGBase.h:48
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:78
const MaterialProperty< Real > & _taum
Definition: NSSUPGBase.h:40
const VariableValue & _u_vel
Definition: NSKernel.h:37
const MaterialProperty< std::vector< RealTensorValue > > & _calA
Definition: NSSUPGBase.h:45
const VariableValue & _v_vel
Definition: NSKernel.h:38
const MaterialProperty< Real > & _tauc
Definition: NSSUPGBase.h:39
const VariableValue & _enthalpy
Definition: NSSUPGBase.h:72
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _calE
Definition: NSSUPGBase.h:51
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:88
const MaterialProperty< Real > & _taue
Definition: NSSUPGBase.h:41

◆ computeQpJacobian()

Real NSSUPGEnergy::computeQpJacobian ( )
protectedvirtual

Definition at line 77 of file NSSUPGEnergy.C.

78 {
79  // This is the energy equation, so pass the on-diagonal variable number.
81 }
Real computeJacobianHelper(unsigned var)
Definition: NSSUPGEnergy.C:90
unsigned _rhoE_var_number
Definition: NSKernel.h:59

◆ computeQpOffDiagJacobian()

Real NSSUPGEnergy::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 84 of file NSSUPGEnergy.C.

85 {
86  return computeJacobianHelper(jvar);
87 }
Real computeJacobianHelper(unsigned var)
Definition: NSSUPGEnergy.C:90

◆ computeQpResidual()

Real NSSUPGEnergy::computeQpResidual ( )
protectedvirtual

Definition at line 30 of file NSSUPGEnergy.C.

31 {
32  // See "Component SUPG contributions" section of notes for details.
33 
34  // Values to be summed up and returned
35  Real mass_term = 0.0;
36  Real mom_term = 0.0;
37  Real energy_term = 0.0;
38 
39  // Ratio of specific heats
40  const Real gam = _fp.gamma();
41 
42  // Velocity vector
43  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
44 
45  // Velocity vector magnitude squared
46  Real velmag2 = vel.norm_sq();
47 
48  // Velocity vector, dotted with the test function gradient
49  Real U_grad_phi = vel * _grad_test[_i][_qp];
50 
51  // Vector object of momentum equation strong residuals
52  RealVectorValue Ru(
53  _strong_residuals[_qp][1], _strong_residuals[_qp][2], _strong_residuals[_qp][3]);
54 
55  // 1.) The mass-residual term:
56  Real mass_coeff = (0.5 * (gam - 1.0) * velmag2 - _enthalpy[_qp]) * U_grad_phi;
57 
58  mass_term = _tauc[_qp] * mass_coeff * _strong_residuals[_qp][0];
59 
60  // 2.) The momentum-residual term:
61  Real mom_term1 = _enthalpy[_qp] * (_grad_test[_i][_qp] * Ru);
62  Real mom_term2 = (1.0 - gam) * U_grad_phi * (vel * Ru);
63 
64  mom_term = _taum[_qp] * (mom_term1 + mom_term2);
65 
66  // 3.) The energy-residual term:
67  energy_term = _taue[_qp] * gam * U_grad_phi * _strong_residuals[_qp][4];
68 
69  // For printing purposes only
70  Real result = mass_term + mom_term + energy_term;
71  // Moose::out << "result[" << _qp << "]=" << result << std::endl;
72 
73  return result;
74 }
const IdealGasFluidProperties & _fp
Definition: NSKernel.h:66
const VariableValue & _w_vel
Definition: NSKernel.h:39
const MaterialProperty< Real > & _taum
Definition: NSSUPGBase.h:40
const VariableValue & _u_vel
Definition: NSKernel.h:37
const VariableValue & _v_vel
Definition: NSKernel.h:38
const MaterialProperty< std::vector< Real > > & _strong_residuals
Definition: NSSUPGBase.h:42
const MaterialProperty< Real > & _tauc
Definition: NSSUPGBase.h:39
const VariableValue & _enthalpy
Definition: NSSUPGBase.h:72
const MaterialProperty< Real > & _taue
Definition: NSSUPGBase.h:41

◆ 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 computeJacobianHelper(), NSSUPGMass::computeJacobianHelper(), NSSUPGMomentum::computeJacobianHelper(), NSMassInviscidFlux::computeQpOffDiagJacobian(), NSEnergyInviscidFlux::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 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

◆ _calA

const MaterialProperty<std::vector<RealTensorValue> >& NSSUPGBase::_calA
protectedinherited

◆ _calC

const MaterialProperty<std::vector<RealTensorValue> >& NSSUPGBase::_calC
protectedinherited

Definition at line 48 of file NSSUPGBase.h.

Referenced by computeJacobianHelper(), and NSSUPGMomentum::computeJacobianHelper().

◆ _calE

const MaterialProperty<std::vector<std::vector<RealTensorValue> > >& NSSUPGBase::_calE
protectedinherited

Definition at line 51 of file NSSUPGBase.h.

Referenced by computeJacobianHelper(), and NSSUPGMomentum::computeJacobianHelper().

◆ _d_rhodot_du

const VariableValue& NSSUPGBase::_d_rhodot_du
protectedinherited

Definition at line 62 of file NSSUPGBase.h.

◆ _d_rhoEdot_du

const VariableValue& NSSUPGBase::_d_rhoEdot_du
protectedinherited

Definition at line 66 of file NSSUPGBase.h.

◆ _d_rhoudot_du

const VariableValue& NSSUPGBase::_d_rhoudot_du
protectedinherited

Definition at line 63 of file NSSUPGBase.h.

Referenced by NSSUPGMass::computeJacobianHelper().

◆ _d_rhovdot_du

const VariableValue& NSSUPGBase::_d_rhovdot_du
protectedinherited

Definition at line 64 of file NSSUPGBase.h.

Referenced by NSSUPGMass::computeJacobianHelper().

◆ _d_rhowdot_du

const VariableValue& NSSUPGBase::_d_rhowdot_du
protectedinherited

Definition at line 65 of file NSSUPGBase.h.

Referenced by NSSUPGMass::computeJacobianHelper().

◆ _dynamic_viscosity

const MaterialProperty<Real>& NSSUPGBase::_dynamic_viscosity
protectedinherited

Definition at line 34 of file NSSUPGBase.h.

◆ _enthalpy

const VariableValue& NSSUPGBase::_enthalpy
protectedinherited

Definition at line 72 of file NSSUPGBase.h.

Referenced by computeJacobianHelper(), 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

◆ _hsupg

const MaterialProperty<Real>& NSSUPGBase::_hsupg
protectedinherited

Definition at line 38 of file NSSUPGBase.h.

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

◆ _strong_residuals

const MaterialProperty<std::vector<Real> >& NSSUPGBase::_strong_residuals
protectedinherited

◆ _tauc

const MaterialProperty<Real>& NSSUPGBase::_tauc
protectedinherited

◆ _taue

const MaterialProperty<Real>& NSSUPGBase::_taue
protectedinherited

◆ _taum

const MaterialProperty<Real>& NSSUPGBase::_taum
protectedinherited

◆ _temperature

const VariableValue& NSSUPGBase::_temperature
protectedinherited

Definition at line 69 of file NSSUPGBase.h.

◆ _thermal_conductivity

const MaterialProperty<Real>& NSSUPGBase::_thermal_conductivity
protectedinherited

Definition at line 35 of file NSSUPGBase.h.

◆ _u_vel

const VariableValue& NSKernel::_u_vel
protectedinherited

◆ _v_vel

const VariableValue& NSKernel::_v_vel
protectedinherited

◆ _viscous_stress_tensor

const MaterialProperty<RealTensorValue>& NSSUPGBase::_viscous_stress_tensor
protectedinherited

Definition at line 33 of file NSSUPGBase.h.

◆ _w_vel

const VariableValue& NSKernel::_w_vel
protectedinherited

The documentation for this class was generated from the following files: