www.mooseframework.org
NSMomentumInviscidBC.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 "NSMomentumInviscidBC.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<NSIntegratedBC>();
14  params.addClassDescription("his class corresponds to the inviscid part of the 'natural' boundary "
15  "condition for the momentum equations.");
16  params.addRequiredParam<unsigned>(
17  "component", "(0,1,2) = (x,y,z) for which momentum component this BC is applied to");
18  return params;
19 }
20 
21 NSMomentumInviscidBC::NSMomentumInviscidBC(const InputParameters & parameters)
22  : NSIntegratedBC(parameters),
23  _component(getParam<unsigned>("component")),
24  // Object for computing deriviatives of pressure
25  _pressure_derivs(*this)
26 {
27 }
28 
29 Real
31 {
32  // n . (Ip) . v
33 
34  // The pressure contribution: p * n(component) * phi_i
35  Real press_term = pressure * _normals[_qp](_component) * _test[_i][_qp];
36 
37  // Return value, or print it first if debugging...
38  return press_term;
39 }
40 
41 Real
43 {
44  return _normals[_qp](_component) * _pressure_derivs.get_grad(var_number) * _phi[_j][_qp] *
45  _test[_i][_qp];
46 }
47 
48 Real
50 {
51  // n . (rho*uu) . v = rho*(u.n)*(u.v) = (rho*u)(u.n) . v
52 
53  // The "inviscid" contribution: (rho*u)(u.n) . v
54  Real conv_term = rhou_udotn * _test[_i][_qp];
55 
56  // Return value, or print it first if debugging...
57  return conv_term;
58 }
59 
60 Real
62 {
63  // Velocity vector object
64  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
65 
66  // Variable to store convective contribution to boundary integral.
67  Real conv_term = 0.0;
68 
69  // Inviscid components
70  switch (var_number)
71  {
72  case 0: // density
73  // Note: the minus sign here is correct, it comes from differentiating wrt U_0
74  // (rho) which is in the denominator.
75  conv_term = -vel(_component) * (vel * _normals[_qp]) * _phi[_j][_qp] * _test[_i][_qp];
76  break;
77 
78  case 1:
79  case 2:
80  case 3: // momentums
81  if (var_number - 1 == _component)
82  // See Eqn. (68) from the notes for the inviscid boundary terms
83  conv_term = ((vel * _normals[_qp]) + vel(_component) * _normals[_qp](_component)) *
84  _phi[_j][_qp] * _test[_i][_qp];
85  else
86  // off-diagonal
87  conv_term =
88  vel(_component) * _normals[_qp](var_number - 1) * _phi[_j][_qp] * _test[_i][_qp];
89  break;
90 
91  case 4: // energy
92  // No derivative wrt energy
93  conv_term = 0.0;
94  break;
95 
96  default:
97  mooseError("Shouldn't get here!");
98  break;
99  }
100 
101  // Return the result. We could return it directly from the switch statement, but this is
102  // convenient for printing...
103  return conv_term;
104 }
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Real get_grad(unsigned i)
The primary interfaces for computing pressure derivatives.
Real convectiveQpResidualHelper(Real rhou_udotn)
const VariableValue & _w_vel
Real convectiveQpJacobianHelper(unsigned var_number)
NSMomentumInviscidBC(const InputParameters &parameters)
Real pressureQpJacobianHelper(unsigned var_number)
InputParameters validParams< NSIntegratedBC >()
const VariableValue & _v_vel
const std::string pressure
Definition: NS.h:24
InputParameters validParams< NSMomentumInviscidBC >()
Real pressureQpResidualHelper(Real pressure)
const VariableValue & _u_vel
NSPressureDerivs< NSMomentumInviscidBC > _pressure_derivs