https://mooseframework.inl.gov
CNSFVHLLCSpecifiedMassFluxAndTemperatureBC.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 
11 #include "NS.h"
12 #include "Function.h"
14 
17 {
18  auto params = CNSFVHLLCBC::validParams();
19  params.addRequiredParam<FunctionName>(NS::momentum_x,
20  "The x component of the inlet superficial momentum");
21  params.addParam<FunctionName>(NS::momentum_y,
22  "The y component of the inlet superficial momentum");
23  params.addParam<FunctionName>(NS::momentum_z,
24  "The z component of the inlet superficial momentum");
25  params.addRequiredParam<FunctionName>(NS::temperature, "temperature specified as a function");
26  return params;
27 }
28 
30  const InputParameters & parameters)
31  : CNSFVHLLCBC(parameters),
32  _rhou_boundary(getFunction(NS::momentum_x)),
33  _rhov_boundary(isParamValid(NS::momentum_y) ? &getFunction(NS::momentum_y) : nullptr),
34  _rhow_boundary(isParamValid(NS::momentum_z) ? &getFunction(NS::momentum_z) : nullptr),
35  _temperature_boundary(getFunction(NS::temperature))
36 {
37  if (_mesh.dimension() > 1 && !_rhov_boundary)
38  mooseError("If the mesh dimension is greater than 1, a function for the y superficial momentum "
39  "must be provided");
40  if (_mesh.dimension() > 2 && !_rhow_boundary)
41  mooseError("If the mesh dimension is greater than 2, a function for the z superficial momentum "
42  "must be provided");
43 }
44 
45 void
47 {
48  // rho implicit -> 1 numerical bc
50 
51  RealVectorValue mass_flux_boundary(_rhou_boundary.value(_t, _face_info->faceCentroid()), 0, 0);
52  _vel_boundary.assign(ADRealVectorValue(mass_flux_boundary(0) / _rho_boundary, 0, 0));
53  if (_rhov_boundary)
54  {
55  mass_flux_boundary(1) = _rhov_boundary->value(_t, _face_info->faceCentroid());
56  _vel_boundary(1) = mass_flux_boundary(1) / _rho_boundary;
57  }
58  if (_rhow_boundary)
59  {
60  mass_flux_boundary(2) = _rhow_boundary->value(_t, _face_info->faceCentroid());
61  _vel_boundary(2) = mass_flux_boundary(2) / _rho_boundary;
62  }
64 
66  const ADReal v_boundary = 1 / _rho_boundary;
67  _specific_internal_energy_boundary = _fluid.e_from_T_v(T_boundary, v_boundary);
70  _pressure_boundary = _fluid.p_from_T_v(T_boundary, v_boundary);
72 }
static const std::string momentum_x
Definition: NS.h:35
const FaceInfo * _face_info
void preComputeWaveSpeed() override
this function is a call back for setting quantities for computing wave speed before calling the wave ...
static InputParameters validParams()
Definition: CNSFVHLLCBC.C:16
const Point & faceCentroid() const
static const std::string temperature
Definition: NS.h:59
DualNumber< Real, DNDerivativeType, true > ADReal
ADReal _pressure_boundary
const ADMaterialProperty< Real > & _rho_elem
const unsigned int _qp
virtual unsigned int dimension() const
Real & _t
ADRealVectorValue _normal
CNSFVHLLCSpecifiedMassFluxAndTemperatureBC(const InputParameters &parameters)
static const std::string momentum_y
Definition: NS.h:36
ADReal _normal_speed_boundary
these quantities must be computed in preComputeWaveSpeed
Base clase for HLLC boundary condition for Euler equation.
Definition: CNSFVHLLCBC.h:20
void assign(const TypeVector< T2 > &)
void mooseError(Args &&... args) const
static const std::string momentum_z
Definition: NS.h:37
ADReal _specific_internal_energy_boundary
virtual Real value(Real t, const Point &p) const
ADRealVectorValue _vel_boundary
MooseMesh & _mesh
const SinglePhaseFluidProperties & _fluid
fluid properties