https://mooseframework.inl.gov
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 
10 #include "NSWeakStagnationBaseBC.h"
11 
12 // FluidProperties includes
14 
15 // Full specialization of the validParams function for this object
16 
19 {
21  params.addClassDescription(
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 
41 void
42 NSWeakStagnationBaseBC::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))
51  p_s = _stagnation_pressure *
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 
58 Real
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 
66 Real
68 {
69  return _u_vel[_qp] * _u_vel[_qp] + _v_vel[_qp] * _v_vel[_qp] + _w_vel[_qp] * _w_vel[_qp];
70 }
71 
72 Real
74 {
75  return _sx * _normals[_qp](0) + _sy * _normals[_qp](1) + _sz * _normals[_qp](2);
76 }
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...
const MooseArray< Point > & _normals
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual Real rho_from_p_T(Real p, Real T) const override
static const std::string rho_s
Definition: NS.h:118
const VariableValue & _w_vel
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
NSWeakStagnationBaseBC(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _v_vel
const IdealGasFluidProperties & _fp
void staticValues(Real &T_s, Real &p_s, Real &rho_s)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const VariableValue & _u_vel
static InputParameters validParams()
MooseUnits pow(const MooseUnits &, int)