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