https://mooseframework.inl.gov
NSEnergyInviscidBC.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 // Navier-Stokes includes
11 #include "NSEnergyInviscidBC.h"
12 #include "NS.h"
13 
14 // FluidProperties includes
16 
19 {
21  params.addClassDescription("This class corresponds to the inviscid part of the 'natural' "
22  "boundary condition for the energy equation.");
23  params.addRequiredCoupledVar(NS::temperature, "temperature");
24  return params;
25 }
26 
28  : NSIntegratedBC(parameters),
29  _temperature(coupledValue(NS::temperature)),
30  // Object for computing deriviatives of pressure
31  _pressure_derivs(*this)
32 {
33 }
34 
35 Real
37 {
38  return (_rho_et[_qp] + pressure) * un * _test[_i][_qp];
39 }
40 
41 Real
43 {
44  // return (rho*(cv*_temperature[_qp] + 0.5*u.norm_sq()) + pressure) * (u*_normals[_qp]) *
45  // _test[_i][_qp];
46  // We can also expand pressure in terms of rho... does this make a difference?
47  // Then we don't use the input pressure value.
48  return rho * (_fp.gamma() * _fp.cv() * _temperature[_qp] + 0.5 * u.norm_sq()) *
49  (u * _normals[_qp]) * _test[_i][_qp];
50 }
51 
52 // (U4+p) * d(u.n)/dX
53 Real
55 {
56  Real result = 0.0;
57 
58  switch (var_number)
59  {
60  case 0: // density
61  {
62  // Velocity vector object
64 
65  result = -(vel * _normals[_qp]);
66  break;
67  }
68 
69  case 1:
70  case 2:
71  case 3: // momentums
72  result = _normals[_qp](var_number - 1);
73  break;
74 
75  case 4: // energy
76  result = 0.;
77  break;
78 
79  default:
80  mooseError("Shouldn't get here!");
81  break;
82  }
83 
84  // Notice the division by _rho[_qp] here. This comes from taking the
85  // derivative wrt to either density or momentum.
86  return (_rho_et[_qp] + pressure) / _rho[_qp] * result * _phi[_j][_qp] * _test[_i][_qp];
87 }
88 
89 // d(U4)/dX * (u.n)
90 Real
91 NSEnergyInviscidBC::qpJacobianTermB(unsigned var_number, Real un)
92 {
93  Real result = 0.0;
94  switch (var_number)
95  {
96  case 0: // density
97  case 1:
98  case 2:
99  case 3: // momentums
100  {
101  result = 0.;
102  break;
103  }
104 
105  case 4: // energy
106  {
107  result = _phi[_j][_qp] * un * _test[_i][_qp];
108  break;
109  }
110 
111  default:
112  mooseError("Shouldn't get here!");
113  break;
114  }
115 
116  return result;
117 }
118 
119 // d(p)/dX * (u.n)
120 Real
121 NSEnergyInviscidBC::qpJacobianTermC(unsigned var_number, Real un)
122 {
123  return _pressure_derivs.get_grad(var_number) * _phi[_j][_qp] * un * _test[_i][_qp];
124 }
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
static InputParameters validParams()
Real get_grad(unsigned i)
The primary interfaces for computing pressure derivatives.
const VariableValue & _w_vel
const VariableValue & _rho
unsigned int _i
NSEnergyInviscidBC(const InputParameters &parameters)
static const std::string temperature
Definition: NS.h:59
Real qpJacobianTermC(unsigned var_number, Real un)
const VariablePhiValue & _phi
unsigned int _qp
auto norm_sq() const -> decltype(std::norm(Real()))
NSPressureDerivs< NSEnergyInviscidBC > _pressure_derivs
Real qpResidualHelper(Real pressure, Real un)
const VariableValue & _rho_et
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _v_vel
const IdealGasFluidProperties & _fp
Real qpJacobianTermA(unsigned var_number, Real pressure)
static const std::string pressure
Definition: NS.h:56
Real qpJacobianTermB(unsigned var_number, Real un)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const VariableValue & _temperature
const VariableValue & _u_vel
static InputParameters validParams()