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