www.mooseframework.org
NSMassInviscidFlux.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 "NSMassInviscidFlux.h"
11 
12 registerMooseObject("NavierStokesApp", NSMassInviscidFlux);
13 
16 {
18  params.addClassDescription("This class computes the inviscid flux in the mass equation.");
19  return params;
20 }
21 
23 
24 Real
26 {
27  const RealVectorValue mom(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
28 
29  // -(rho*U) * grad(phi), negative sign comes from integration-by-parts
30  return -(mom * _grad_test[_i][_qp]);
31 }
32 
33 Real
35 {
36  // This seems weird at first glance, but remember we have to differentiate
37  // wrt the *conserved* variables
38  //
39  // [ U_0 ] = [ rho ]
40  // [ U_1 ] = [ rho * u_1 ]
41  // [ U_2 ] = [ rho * u_2 ]
42  // [ U_3 ] = [ rho * u_3 ]
43  // [ U_4 ] = [ rho * E ]
44  //
45  // and the inviscid mass flux residual, in terms of these variables, is:
46  //
47  // f(U) = ( U_k * dphi_i/dx_k ), summation over k=1,2,3
48  //
49  // ie. does not depend on U_0, the on-diagonal Jacobian component.
50  return 0.0;
51 }
52 
53 Real
55 {
56  if (isNSVariable(jvar))
57  {
58  // Map jvar into the variable m for our problem, regardless of
59  // how Moose has numbered things.
60  unsigned int m = mapVarNumber(jvar);
61 
62  switch (m)
63  {
64  // Don't handle the on-diagonal case here
65  // case 0: // density
66  case 1:
67  case 2:
68  case 3: // momentums
69  return -_phi[_j][_qp] * _grad_test[_i][_qp](m - 1);
70 
71  case 4: // energy
72  return 0.0;
73 
74  default:
75  mooseError("Should not get here!");
76  break;
77  }
78  }
79  else
80  return 0.0;
81 }
const VariableValue & _rho_u
Definition: NSKernel.h:39
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Definition: NSKernel.h:25
virtual Real computeQpJacobian()
static InputParameters validParams()
const VariableValue & _rho_v
Definition: NSKernel.h:40
virtual Real computeQpResidual()
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:79
unsigned int _i
unsigned int _j
registerMooseObject("NavierStokesApp", NSMassInviscidFlux)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
NSMassInviscidFlux(const InputParameters &parameters)
const VariableTestGradient & _grad_test
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const VariableValue & _rho_w
Definition: NSKernel.h:41
static InputParameters validParams()
Definition: NSKernel.C:23
const VariablePhiValue & _phi
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:89
unsigned int _qp