https://mooseframework.inl.gov
NSSUPGMass.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "NSSUPGMass.h"
11 
12 registerMooseObject("NavierStokesApp", NSSUPGMass);
13 
16 {
17  // Initialize the params object from the base class
19  params.addClassDescription(
20  "Compute residual and Jacobian terms form the SUPG terms in the mass equation.");
21  return params;
22 }
23 
24 NSSUPGMass::NSSUPGMass(const InputParameters & parameters) : NSSUPGBase(parameters) {}
25 
26 Real
28 {
29  // From "Component SUPG contributions" section of the notes,
30  // the mass equation is stabilized by taum and the gradient of
31  // phi_i dotted with the momentum equation strong residuals.
32  // Note that the momentum equation strong residuals are stored
33  // in entries 1,2,3 of the "_strong_residuals" vector, regardless
34  // of what dimension we're solving in.
35  RealVectorValue Ru(
37 
38  // Separate variable just for printing purposes...
39  Real result = _taum[_qp] * (Ru * _grad_test[_i][_qp]);
40 
41  return result;
42 }
43 
44 Real
46 {
47  // This is the density equation, so pass the on-diagonal variable number
49 }
50 
51 Real
53 {
54  return computeJacobianHelper(jvar);
55 }
56 
57 Real
59 {
60  if (isNSVariable(var))
61  {
62 
63  // Convert the Moose numbering to canonical NS variable numbering.
64  unsigned m = mapVarNumber(var);
65 
66  // Time derivative contributions only for momentum
67  Real time_part = 0.;
68 
69  // The derivative of "udot" wrt u for each of the momentum variables.
70  // This is always 1/dt unless you are using BDF2...
71  Real d_udot_du[3] = {_d_rhoudot_du[_qp], _d_rhovdot_du[_qp], _d_rhowdot_du[_qp]};
72 
73  switch (m)
74  {
75  case 1:
76  case 2:
77  case 3:
78  // time_part = _grad_test[_i][_qp](m-1) * (_phi[_j][_qp]/_subproblem.parent()->dt());
79  time_part = _grad_test[_i][_qp](m - 1) * (_phi[_j][_qp] * d_udot_du[m - 1]);
80  break;
81  }
82 
83  // Store result so we can print it before returning
84  Real result =
85  _taum[_qp] * (time_part + _grad_test[_i][_qp] * (_calA[_qp][m] * _grad_phi[_j][_qp]));
86 
87  return result;
88  }
89  else
90  return 0.0;
91 }
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: NSSUPGMass.C:52
const VariablePhiGradient & _grad_phi
static InputParameters validParams()
Definition: NSSUPGMass.C:15
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:79
virtual Real computeQpJacobian()
Definition: NSSUPGMass.C:45
const MaterialProperty< Real > & _taum
Definition: NSSUPGBase.h:37
Compute residual and Jacobian terms form the SUPG terms in the mass equation.
Definition: NSSUPGMass.h:20
static InputParameters validParams()
Definition: NSSUPGBase.C:18
registerMooseObject("NavierStokesApp", NSSUPGMass)
unsigned int _i
virtual Real computeQpResidual()
Definition: NSSUPGMass.C:27
Real computeJacobianHelper(unsigned var)
Definition: NSSUPGMass.C:58
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableTestGradient & _grad_test
const MaterialProperty< std::vector< RealTensorValue > > & _calA
Definition: NSSUPGBase.h:42
const MaterialProperty< std::vector< Real > > & _strong_residuals
Definition: NSSUPGBase.h:39
void addClassDescription(const std::string &doc_string)
const VariableValue & _d_rhovdot_du
Definition: NSSUPGBase.h:61
This class acts as a base class for stabilization kernels.
Definition: NSSUPGBase.h:21
const VariablePhiValue & _phi
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:89
NSSUPGMass(const InputParameters &parameters)
Definition: NSSUPGMass.C:24
unsigned int _qp