https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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)
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
44void
46{
47 using std::pow;
48
51
52 // for convenience compute the square of the speed
53 ADReal speed_sq = _speed_elem[_qp] * _speed_elem[_qp];
54
55 // Compute inlet temperature
56 ADReal T_inlet = _stagnation_temperature - 0.5 * speed_sq / _cp[_qp];
57
58 // Compute inlet pressure using isentropic relation
59 ADReal gamma = _cp[_qp] / _cv[_qp];
61 _stagnation_pressure * pow(_stagnation_temperature / T_inlet, -gamma / (gamma - 1.));
62
63 // Compute total energy from stagnation values.
64 _specific_internal_energy_boundary = _cv[_qp] * T_inlet + 0.5 * speed_sq;
65
66 _rho_boundary = _fluid.rho_from_p_T(_p_boundary, T_inlet);
68}
DualNumber< Real, DNDerivativeType, true > ADReal
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
ADReal _specific_internal_energy_boundary
const SinglePhaseFluidProperties & _fluid
fluid properties
ADReal _normal_speed_elem
speeds normal to the interface on the element side
const ADMaterialProperty< RealVectorValue > & _vel_elem
ADRealVectorValue _vel_boundary
const ADMaterialProperty< Real > & _speed_elem
ADReal _normal_speed_boundary
these quantities must be computed in preComputeWaveSpeed
Base clase for HLLC boundary condition for Euler equation.
Definition CNSFVHLLCBC.h:21
static InputParameters validParams()
Definition CNSFVHLLCBC.C:16
virtual void preComputeWaveSpeed() override
this function is a call back for setting quantities for computing wave speed before calling the wave ...
ADReal _p_boundary
pressure on the boundary side
static InputParameters validParams()
ADReal _ht_boundary
enthalpy on the boundary side
CNSFVHLLCStagnationInletBC(const InputParameters &parameters)
const ADMaterialProperty< Real > & _cp
isobaric specific heat
const ADMaterialProperty< Real > & _cv
isochoric specific heat
const PostprocessorValue & _stagnation_temperature
stagnation temperature
const PostprocessorValue & _stagnation_pressure
stagnation pressure
const unsigned int _qp
Ideal gas fluid properties Default parameters are for air at atmospheric pressure and temperature.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void paramError(const std::string &param, Args... args) const
static const std::string fluid
Definition NS.h:88