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