NSSUPGMass.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "NSSUPGMass.h"
8
9 template <>
10 InputParameters
12 {
13  // Initialize the params object from the base class
14  InputParameters params = validParams<NSSUPGBase>();
16  "Compute residual and Jacobian terms form the SUPG terms in the mass equation.");
17  return params;
18 }
19
20 NSSUPGMass::NSSUPGMass(const InputParameters & parameters) : NSSUPGBase(parameters) {}
21
22 Real
24 {
25  // From "Component SUPG contributions" section of the notes,
26  // the mass equation is stabilized by taum and the gradient of
27  // phi_i dotted with the momentum equation strong residuals.
28  // Note that the momentum equation strong residuals are stored
29  // in entries 1,2,3 of the "_strong_residuals" vector, regardless
30  // of what dimension we're solving in.
31  RealVectorValue Ru(
32  _strong_residuals[_qp][1], _strong_residuals[_qp][2], _strong_residuals[_qp][3]);
33
34  // Separate variable just for printing purposes...
35  Real result = _taum[_qp] * (Ru * _grad_test[_i][_qp]);
36
37  return result;
38 }
39
40 Real
42 {
43  // This is the density equation, so pass the on-diagonal variable number
45 }
46
47 Real
49 {
50  return computeJacobianHelper(jvar);
51 }
52
53 Real
55 {
56  if (isNSVariable(var))
57  {
58
59  // Convert the Moose numbering to canonical NS variable numbering.
60  unsigned m = mapVarNumber(var);
61
62  // Time derivative contributions only for momentum
63  Real time_part = 0.;
64
65  // The derivative of "udot" wrt u for each of the momentum variables.
66  // This is always 1/dt unless you are using BDF2...
67  Real d_udot_du[3] = {_d_rhoudot_du[_qp], _d_rhovdot_du[_qp], _d_rhowdot_du[_qp]};
68
69  switch (m)
70  {
71  case 1:
72  case 2:
73  case 3:
74  // time_part = _grad_test[_i][_qp](m-1) * (_phi[_j][_qp]/_subproblem.parent()->dt());
75  time_part = _grad_test[_i][_qp](m - 1) * (_phi[_j][_qp] * d_udot_du[m - 1]);
76  break;
77  }
78
79  // Store result so we can print it before returning
80  Real result =
82
83  return result;
84  }
85  else
86  return 0.0;
87 }
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: NSSUPGMass.C:48
InputParameters validParams< NSSUPGBase >()
Definition: NSSUPGBase.C:17
InputParameters validParams< NSSUPGMass >()
Definition: NSSUPGMass.C:11
const VariableValue & _d_rhoudot_du
Definition: NSSUPGBase.h:60
unsigned _rho_var_number
Definition: NSKernel.h:52
const VariableValue & _d_rhowdot_du
Definition: NSSUPGBase.h:62
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:76
virtual Real computeQpJacobian()
Definition: NSSUPGMass.C:41
const MaterialProperty< Real > & _taum
Definition: NSSUPGBase.h:37
virtual Real computeQpResidual()
Definition: NSSUPGMass.C:23
Real computeJacobianHelper(unsigned var)
Definition: NSSUPGMass.C:54
const MaterialProperty< std::vector< RealTensorValue > > & _calA
Definition: NSSUPGBase.h:42
const MaterialProperty< std::vector< Real > > & _strong_residuals
Definition: NSSUPGBase.h:39
const VariableValue & _d_rhovdot_du
Definition: NSSUPGBase.h:61
This class acts as a base class for stabilization kernels.
Definition: NSSUPGBase.h:23
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:86
NSSUPGMass(const InputParameters &parameters)
Definition: NSSUPGMass.C:20