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 22 of file NSSUPGEnergy.h.

Constructor & Destructor Documentation

NSSUPGEnergy::NSSUPGEnergy ( const InputParameters &  parameters)

Definition at line 22 of file NSSUPGEnergy.C.

22 : NSSUPGBase(parameters) {}
NSSUPGBase(const InputParameters &parameters)
Definition: NSSUPGBase.C:26

Member Function Documentation

Real NSSUPGEnergy::computeJacobianHelper ( unsigned  var)
private

Definition at line 85 of file NSSUPGEnergy.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

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

Definition at line 72 of file NSSUPGEnergy.C.

73 {
74  // This is the energy equation, so pass the on-diagonal variable number.
76 }
Real computeJacobianHelper(unsigned var)
Definition: NSSUPGEnergy.C:85
unsigned _rhoE_var_number
Definition: NSKernel.h:56
Real NSSUPGEnergy::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 79 of file NSSUPGEnergy.C.

80 {
81  return computeJacobianHelper(jvar);
82 }
Real computeJacobianHelper(unsigned var)
Definition: NSSUPGEnergy.C:85
Real NSSUPGEnergy::computeQpResidual ( )
protectedvirtual

Definition at line 25 of file NSSUPGEnergy.C.

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

Definition at line 45 of file NSSUPGBase.h.

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

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

Definition at line 48 of file NSSUPGBase.h.

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

const VariableValue& NSSUPGBase::_d_rhodot_du
protectedinherited

Definition at line 59 of file NSSUPGBase.h.

const VariableValue& NSSUPGBase::_d_rhoEdot_du
protectedinherited

Definition at line 63 of file NSSUPGBase.h.

const VariableValue& NSSUPGBase::_d_rhoudot_du
protectedinherited

Definition at line 60 of file NSSUPGBase.h.

Referenced by NSSUPGMass::computeJacobianHelper().

const VariableValue& NSSUPGBase::_d_rhovdot_du
protectedinherited

Definition at line 61 of file NSSUPGBase.h.

Referenced by NSSUPGMass::computeJacobianHelper().

const VariableValue& NSSUPGBase::_d_rhowdot_du
protectedinherited

Definition at line 62 of file NSSUPGBase.h.

Referenced by NSSUPGMass::computeJacobianHelper().

const MaterialProperty<Real>& NSSUPGBase::_dynamic_viscosity
protectedinherited

Definition at line 31 of file NSSUPGBase.h.

const VariableValue& NSSUPGBase::_enthalpy
protectedinherited

Definition at line 69 of file NSSUPGBase.h.

Referenced by computeJacobianHelper(), 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 MaterialProperty<Real>& NSSUPGBase::_hsupg
protectedinherited

Definition at line 35 of file NSSUPGBase.h.

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 MaterialProperty<std::vector<Real> >& NSSUPGBase::_strong_residuals
protectedinherited
const MaterialProperty<Real>& NSSUPGBase::_tauc
protectedinherited
const MaterialProperty<Real>& NSSUPGBase::_taue
protectedinherited
const MaterialProperty<Real>& NSSUPGBase::_taum
protectedinherited
const VariableValue& NSSUPGBase::_temperature
protectedinherited

Definition at line 66 of file NSSUPGBase.h.

const MaterialProperty<Real>& NSSUPGBase::_thermal_conductivity
protectedinherited

Definition at line 32 of file NSSUPGBase.h.

const VariableValue& NSKernel::_u_vel
protectedinherited
const VariableValue& NSKernel::_v_vel
protectedinherited
const MaterialProperty<RealTensorValue>& NSSUPGBase::_viscous_stress_tensor
protectedinherited

Definition at line 30 of file NSSUPGBase.h.

const VariableValue& NSKernel::_w_vel
protectedinherited

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