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