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