https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NSWeakStagnationBaseBC.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
11
12// FluidProperties includes
14
15// Full specialization of the validParams function for this object
16
19{
22 "This is the base class for 'weakly-imposed' stagnation boundary conditions.");
23 params.addRequiredParam<Real>("stagnation_pressure", "The specifed stagnation pressure");
24 params.addRequiredParam<Real>("stagnation_temperature", "The specifed stagnation temperature");
25 params.addRequiredParam<Real>("sx", "x-component of specifed flow direction");
26 params.addRequiredParam<Real>("sy", "y-component of specifed flow direction");
27 params.addParam<Real>("sz", 0.0, "z-component of specifed flow direction"); // only required in 3D
28 return params;
29}
30
32 : NSIntegratedBC(parameters),
33 _stagnation_pressure(getParam<Real>("stagnation_pressure")),
34 _stagnation_temperature(getParam<Real>("stagnation_temperature")),
35 _sx(getParam<Real>("sx")),
36 _sy(getParam<Real>("sy")),
37 _sz(getParam<Real>("sz"))
38{
39}
40
41void
42NSWeakStagnationBaseBC::staticValues(Real & T_s, Real & p_s, Real & rho_s)
43{
44 // T_s = T_0 - |u|^2/2/cp
45 T_s = _stagnation_temperature - 0.5 * this->velmag2() / _fp.cp();
46
47 if (T_s < 0.)
48 mooseError("Negative temperature detected in NSWeakStagnationBaseBC!");
49
50 // p_s = p_0 * (T_0/T)^(-gam/(gam-1))
52 std::pow(_stagnation_temperature / T_s, -_fp.gamma() / (_fp.gamma() - 1.));
53
54 // Compute static rho from static pressure and temperature using equation of state.
55 rho_s = _fp.rho_from_p_T(p_s, T_s);
56}
57
58Real
60{
61 Real T_s = 0., p_s = 0., rho_s = 0.;
62 staticValues(T_s, p_s, rho_s);
63 return rho_s;
64}
65
66Real
71
72Real
74{
75 return _sx * _normals[_qp](0) + _sy * _normals[_qp](1) + _sz * _normals[_qp](2);
76}
virtual Real rho_from_p_T(Real p, Real T) const override
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
const MooseArray< Point > & _normals
void mooseError(Args &&... args) const
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 & _u_vel
const IdealGasFluidProperties & _fp
Real _stagnation_pressure
Must be implemented in derived classes.
void staticValues(Real &T_s, Real &p_s, Real &rho_s)
static InputParameters validParams()
NSWeakStagnationBaseBC(const InputParameters &parameters)