https://mooseframework.inl.gov
CNSFVHLLCStagnationInletBC.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 
12 #include "NS.h"
13 
16 {
18  params.addRequiredParam<PostprocessorName>("stagnation_temperature",
19  "Specified inlet stagnation temperature.");
20  params.addRequiredParam<PostprocessorName>("stagnation_pressure",
21  "Specified inlet stagnation pressure.");
22  return params;
23 }
24 
26  : CNSFVHLLCBC(parameters),
27  _stagnation_temperature(this->getPostprocessorValue("stagnation_temperature")),
28  _stagnation_pressure(this->getPostprocessorValue("stagnation_pressure")),
29  _cp(getADMaterialProperty<Real>(NS::cp)),
30  _cv(getADMaterialProperty<Real>(NS::cv))
31 {
32  // we need to distinguish between ideal gas and non-ideal gas
33  const IdealGasFluidProperties * fluid_ideal_gas =
34  dynamic_cast<const IdealGasFluidProperties *>(&_fluid);
35  if (!fluid_ideal_gas)
36  paramError(
37  NS::fluid,
38  "Navier-Stokes module supports stagnation inlet BCs only for IdealGasFluidProperties. "
39  "Non-ideal "
40  "fluid "
41  "properties do not implement the necessary interfaces to support isentropic processes.");
42 }
43 
44 void
46 {
49 
50  // for convenience compute the square of the speed
51  ADReal speed_sq = _speed_elem[_qp] * _speed_elem[_qp];
52 
53  // Compute inlet temperature
54  ADReal T_inlet = _stagnation_temperature - 0.5 * speed_sq / _cp[_qp];
55 
56  // Compute inlet pressure using isentropic relation
57  ADReal gamma = _cp[_qp] / _cv[_qp];
58  _p_boundary =
59  _stagnation_pressure * std::pow(_stagnation_temperature / T_inlet, -gamma / (gamma - 1.));
60 
61  // Compute total energy from stagnation values.
62  _specific_internal_energy_boundary = _cv[_qp] * T_inlet + 0.5 * speed_sq;
63 
64  _rho_boundary = _fluid.rho_from_p_T(_p_boundary, T_inlet);
66 }
static const std::string cv
Definition: NS.h:122
ADReal _p_boundary
pressure on the boundary side
const ADMaterialProperty< Real > & _cv
isochoric specific heat
const PostprocessorValue & _stagnation_pressure
stagnation pressure
static InputParameters validParams()
Definition: CNSFVHLLCBC.C:16
static const std::string fluid
Definition: NS.h:87
DualNumber< Real, DNDerivativeType, true > ADReal
const ADMaterialProperty< RealVectorValue > & _vel_elem
void addRequiredParam(const std::string &name, const std::string &doc_string)
const unsigned int _qp
static const std::string cp
Definition: NS.h:121
CNSFVHLLCStagnationInletBC(const InputParameters &parameters)
ADReal _ht_boundary
enthalpy on the boundary side
void paramError(const std::string &param, Args... args) const
const ADMaterialProperty< Real > & _speed_elem
ADReal _normal_speed_boundary
these quantities must be computed in preComputeWaveSpeed
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Base clase for HLLC boundary condition for Euler equation.
Definition: CNSFVHLLCBC.h:20
static InputParameters validParams()
ADReal _specific_internal_energy_boundary
Ideal gas fluid properties Default parameters are for air at atmospheric pressure and temperature...
const ADMaterialProperty< Real > & _cp
isobaric specific heat
ADReal _normal_speed_elem
speeds normal to the interface on the element side
MooseUnits pow(const MooseUnits &, int)
ADRealVectorValue _vel_boundary
const SinglePhaseFluidProperties & _fluid
fluid properties
virtual void preComputeWaveSpeed() override
this function is a call back for setting quantities for computing wave speed before calling the wave ...
const PostprocessorValue & _stagnation_temperature
stagnation temperature