https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
35Real
37{
38 return (_rho_et[_qp] + pressure) * un * _test[_i][_qp];
39}
40
41Real
42NSEnergyInviscidBC::qpResidualHelper(Real rho, RealVectorValue u, Real /*pressure*/)
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
53Real
54NSEnergyInviscidBC::qpJacobianTermA(unsigned var_number, Real pressure)
55{
56 Real result = 0.0;
57
58 switch (var_number)
59 {
60 case 0: // density
61 {
62 // Velocity vector object
63 RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
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)
90Real
91NSEnergyInviscidBC::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)
120Real
121NSEnergyInviscidBC::qpJacobianTermC(unsigned var_number, Real un)
122{
123 return _pressure_derivs.get_grad(var_number) * _phi[_j][_qp] * un * _test[_i][_qp];
124}
const double rho
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _i
unsigned int _j
const VariablePhiValue & _phi
const MooseArray< Point > & _normals
const VariableTestValue & _test
void mooseError(Args &&... args) const
NSPressureDerivs< NSEnergyInviscidBC > _pressure_derivs
const VariableValue & _temperature
NSEnergyInviscidBC(const InputParameters &parameters)
static InputParameters validParams()
Real qpResidualHelper(Real pressure, Real un)
Real qpJacobianTermA(unsigned var_number, Real pressure)
Real qpJacobianTermC(unsigned var_number, Real un)
Real qpJacobianTermB(unsigned var_number, Real un)
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
const VariableValue & _w_vel
const VariableValue & _v_vel
static InputParameters validParams()
const VariableValue & _rho
const VariableValue & _u_vel
const VariableValue & _rho_et
const IdealGasFluidProperties & _fp
Real get_grad(unsigned i)
The primary interfaces for computing pressure derivatives.
static const std::string temperature
Definition NS.h:60