www.mooseframework.org
NSWeakStagnationBaseBC.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 /****************************************************************/
8 
9 // FluidProperties includes
11 
12 // Full specialization of the validParams function for this object
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<NSIntegratedBC>();
18  params.addClassDescription(
19  "This is the base class for 'weakly-imposed' stagnation boundary conditions.");
20  params.addRequiredParam<Real>("stagnation_pressure", "The specifed stagnation pressure");
21  params.addRequiredParam<Real>("stagnation_temperature", "The specifed stagnation temperature");
22  params.addRequiredParam<Real>("sx", "x-component of specifed flow direction");
23  params.addRequiredParam<Real>("sy", "y-component of specifed flow direction");
24  params.addParam<Real>("sz", 0.0, "z-component of specifed flow direction"); // only required in 3D
25  return params;
26 }
27 
28 NSWeakStagnationBaseBC::NSWeakStagnationBaseBC(const InputParameters & parameters)
29  : NSIntegratedBC(parameters),
30  _stagnation_pressure(getParam<Real>("stagnation_pressure")),
31  _stagnation_temperature(getParam<Real>("stagnation_temperature")),
32  _sx(getParam<Real>("sx")),
33  _sy(getParam<Real>("sy")),
34  _sz(getParam<Real>("sz"))
35 {
36 }
37 
38 void
39 NSWeakStagnationBaseBC::staticValues(Real & T_s, Real & p_s, Real & rho_s)
40 {
41  // T_s = T_0 - |u|^2/2/cp
42  T_s = _stagnation_temperature - 0.5 * this->velmag2() / _fp.cp();
43 
44  if (T_s < 0.)
45  mooseError("Negative temperature detected in NSWeakStagnationBaseBC!");
46 
47  // p_s = p_0 * (T_0/T)^(-gam/(gam-1))
48  p_s = _stagnation_pressure *
49  std::pow(_stagnation_temperature / T_s, -_fp.gamma() / (_fp.gamma() - 1.));
50 
51  // Compute static rho from static pressure and temperature using equation of state.
52  rho_s = _fp.rho(p_s, T_s);
53 }
54 
55 Real
57 {
58  Real T_s = 0., p_s = 0., rho_s = 0.;
59  staticValues(T_s, p_s, rho_s);
60  return rho_s;
61 }
62 
63 Real
65 {
66  return _u_vel[_qp] * _u_vel[_qp] + _v_vel[_qp] * _v_vel[_qp] + _w_vel[_qp] * _w_vel[_qp];
67 }
68 
69 Real
71 {
72  return _sx * _normals[_qp](0) + _sy * _normals[_qp](1) + _sz * _normals[_qp](2);
73 }
InputParameters validParams< NSWeakStagnationBaseBC >()
Real _stagnation_pressure
Must be implemented in derived classes.
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
const VariableValue & _w_vel
virtual Real cp(Real v=0., Real u=0.) const override
Specific heat.
NSWeakStagnationBaseBC(const InputParameters &parameters)
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
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.
void staticValues(Real &T_s, Real &p_s, Real &rho_s)
const VariableValue & _u_vel