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