www.mooseframework.org
NSWeakStagnationBaseBC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 template <>
17 InputParameters
19 {
20  InputParameters params = validParams<NSIntegratedBC>();
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 
31 NSWeakStagnationBaseBC::NSWeakStagnationBaseBC(const InputParameters & parameters)
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 }
IdealGasFluidProperties::cp
virtual Real cp() const
Definition: IdealGasFluidProperties.h:119
IdealGasFluidProperties.h
NSWeakStagnationBaseBC.h
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
validParams< NSIntegratedBC >
InputParameters validParams< NSIntegratedBC >()
Definition: NSIntegratedBC.C:22
NSIntegratedBC::_w_vel
const VariableValue & _w_vel
Definition: NSIntegratedBC.h:37
NSWeakStagnationBaseBC::_stagnation_pressure
Real _stagnation_pressure
Must be implemented in derived classes.
Definition: NSWeakStagnationBaseBC.h:45
NSWeakStagnationBaseBC::_stagnation_temperature
Real _stagnation_temperature
Definition: NSWeakStagnationBaseBC.h:46
NSWeakStagnationBaseBC::rhoStatic
Real rhoStatic()
Definition: NSWeakStagnationBaseBC.C:59
IdealGasFluidProperties::rho_from_p_T
virtual Real rho_from_p_T(Real p, Real T) const override
Definition: IdealGasFluidProperties.C:301
IdealGasFluidProperties::gamma
virtual Real gamma() const
Definition: IdealGasFluidProperties.h:117
NSWeakStagnationBaseBC::_sz
Real _sz
Definition: NSWeakStagnationBaseBC.h:53
NSWeakStagnationBaseBC::NSWeakStagnationBaseBC
NSWeakStagnationBaseBC(const InputParameters &parameters)
Definition: NSWeakStagnationBaseBC.C:31
NSIntegratedBC
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Definition: NSIntegratedBC.h:29
NSWeakStagnationBaseBC::staticValues
void staticValues(Real &T_s, Real &p_s, Real &rho_s)
Definition: NSWeakStagnationBaseBC.C:42
NSIntegratedBC::_v_vel
const VariableValue & _v_vel
Definition: NSIntegratedBC.h:36
NSIntegratedBC::_u_vel
const VariableValue & _u_vel
Definition: NSIntegratedBC.h:35
NSWeakStagnationBaseBC::sdotn
Real sdotn()
Definition: NSWeakStagnationBaseBC.C:73
NSWeakStagnationBaseBC::_sx
Real _sx
Definition: NSWeakStagnationBaseBC.h:51
NSIntegratedBC::_fp
const IdealGasFluidProperties & _fp
Definition: NSIntegratedBC.h:62
NSWeakStagnationBaseBC::_sy
Real _sy
Definition: NSWeakStagnationBaseBC.h:52
NSWeakStagnationBaseBC::velmag2
Real velmag2()
Definition: NSWeakStagnationBaseBC.C:67
validParams< NSWeakStagnationBaseBC >
InputParameters validParams< NSWeakStagnationBaseBC >()
Definition: NSWeakStagnationBaseBC.C:18