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