Line data Source code
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 "CNSFVHLLCSpecifiedMassFluxAndTemperatureBC.h" 11 : #include "NS.h" 12 : #include "Function.h" 13 : #include "SinglePhaseFluidProperties.h" 14 : 15 : InputParameters 16 846 : CNSFVHLLCSpecifiedMassFluxAndTemperatureBC::validParams() 17 : { 18 846 : auto params = CNSFVHLLCBC::validParams(); 19 846 : params.addRequiredParam<FunctionName>(NS::momentum_x, 20 : "The x component of the inlet superficial momentum"); 21 846 : params.addParam<FunctionName>(NS::momentum_y, 22 : "The y component of the inlet superficial momentum"); 23 846 : params.addParam<FunctionName>(NS::momentum_z, 24 : "The z component of the inlet superficial momentum"); 25 846 : params.addRequiredParam<FunctionName>(NS::temperature, "temperature specified as a function"); 26 846 : return params; 27 0 : } 28 : 29 447 : CNSFVHLLCSpecifiedMassFluxAndTemperatureBC::CNSFVHLLCSpecifiedMassFluxAndTemperatureBC( 30 447 : const InputParameters & parameters) 31 : : CNSFVHLLCBC(parameters), 32 447 : _rhou_boundary(getFunction(NS::momentum_x)), 33 447 : _rhov_boundary(isParamValid(NS::momentum_y) ? &getFunction(NS::momentum_y) : nullptr), 34 447 : _rhow_boundary(isParamValid(NS::momentum_z) ? &getFunction(NS::momentum_z) : nullptr), 35 894 : _temperature_boundary(getFunction(NS::temperature)) 36 : { 37 447 : if (_mesh.dimension() > 1 && !_rhov_boundary) 38 0 : mooseError("If the mesh dimension is greater than 1, a function for the y superficial momentum " 39 : "must be provided"); 40 447 : if (_mesh.dimension() > 2 && !_rhow_boundary) 41 0 : mooseError("If the mesh dimension is greater than 2, a function for the z superficial momentum " 42 : "must be provided"); 43 447 : } 44 : 45 : void 46 28931 : CNSFVHLLCSpecifiedMassFluxAndTemperatureBC::preComputeWaveSpeed() 47 : { 48 : // rho implicit -> 1 numerical bc 49 28931 : _rho_boundary = _rho_elem[_qp]; 50 : 51 28931 : RealVectorValue mass_flux_boundary(_rhou_boundary.value(_t, _face_info->faceCentroid()), 0, 0); 52 28931 : _vel_boundary.assign(ADRealVectorValue(mass_flux_boundary(0) / _rho_boundary, 0, 0)); 53 28931 : if (_rhov_boundary) 54 : { 55 27236 : mass_flux_boundary(1) = _rhov_boundary->value(_t, _face_info->faceCentroid()); 56 27236 : _vel_boundary(1) = mass_flux_boundary(1) / _rho_boundary; 57 : } 58 28931 : if (_rhow_boundary) 59 : { 60 0 : mass_flux_boundary(2) = _rhow_boundary->value(_t, _face_info->faceCentroid()); 61 0 : _vel_boundary(2) = mass_flux_boundary(2) / _rho_boundary; 62 : } 63 28931 : _normal_speed_boundary = _normal * _vel_boundary; 64 : 65 28931 : const ADReal T_boundary = _temperature_boundary.value(_t, _face_info->faceCentroid()); 66 28931 : const ADReal v_boundary = 1 / _rho_boundary; 67 28931 : _specific_internal_energy_boundary = _fluid.e_from_T_v(T_boundary, v_boundary); 68 57862 : _et_boundary = _specific_internal_energy_boundary + 0.5 * _vel_boundary * _vel_boundary; 69 28931 : _rho_et_boundary = _rho_boundary * _et_boundary; 70 28931 : _pressure_boundary = _fluid.p_from_T_v(T_boundary, v_boundary); 71 28931 : _ht_boundary = _et_boundary + _pressure_boundary / _rho_boundary; 72 28931 : }