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 "PCNSFVHLLCBC.h" 11 : #include "PCNSFVHLLC.h" 12 : #include "NS.h" 13 : #include "SinglePhaseFluidProperties.h" 14 : 15 : InputParameters 16 540 : PCNSFVHLLCBC::validParams() 17 : { 18 540 : InputParameters params = FVFluxBC::validParams(); 19 540 : params.addRequiredParam<UserObjectName>(NS::fluid, "Fluid properties userobject"); 20 540 : return params; 21 0 : } 22 : 23 270 : PCNSFVHLLCBC::PCNSFVHLLCBC(const InputParameters & parameters) 24 : : FVFluxBC(parameters), 25 540 : _fluid(UserObjectInterface::getUserObject<SinglePhaseFluidProperties>(NS::fluid)), 26 270 : _specific_internal_energy_elem(getADMaterialProperty<Real>(NS::specific_internal_energy)), 27 270 : _vel_elem(getADMaterialProperty<RealVectorValue>(NS::velocity)), 28 270 : _speed_elem(getADMaterialProperty<Real>(NS::speed)), 29 270 : _rho_elem(getADMaterialProperty<Real>(NS::density)), 30 270 : _pressure_elem(getADMaterialProperty<Real>(NS::pressure)), 31 270 : _rho_et_elem(getADMaterialProperty<Real>(NS::total_energy_density)), 32 270 : _ht_elem(getADMaterialProperty<Real>(NS::specific_total_enthalpy)), 33 540 : _eps_elem(getMaterialProperty<Real>(NS::porosity)) 34 : { 35 270 : } 36 : 37 : ADReal 38 2490 : PCNSFVHLLCBC::computeQpResidual() 39 : { 40 : 41 2490 : _normal_speed_elem = _normal * _vel_elem[_qp]; 42 2490 : preComputeWaveSpeed(); 43 : 44 2490 : auto wave_speeds = PCNSFVHLLC::waveSpeed(_rho_elem[_qp], 45 2490 : _vel_elem[_qp], 46 2490 : _specific_internal_energy_elem[_qp], 47 2490 : _eps_elem[_qp], 48 2490 : _rho_boundary, 49 2490 : _vel_boundary, 50 2490 : _specific_internal_energy_boundary, 51 : _eps_boundary, 52 : _fluid, 53 2490 : _normal); 54 2490 : _SL = std::move(wave_speeds[0]); 55 2490 : _SM = std::move(wave_speeds[1]); 56 2490 : _SR = std::move(wave_speeds[2]); 57 : 58 2490 : if (_SL >= 0) 59 0 : return fluxElem(); 60 2490 : else if (_SR <= 0) 61 0 : return fluxBoundary(); 62 : else 63 : { 64 2490 : if (_SM >= 0) 65 : { 66 1245 : ADReal f = _eps_elem[_qp] * _rho_elem[_qp] * (_SL - _normal_speed_elem) / (_SL - _SM); 67 3735 : return fluxElem() + _SL * (f * hllcElem() - conservedVariableElem()); 68 : } 69 : else 70 : { 71 2490 : ADReal f = _eps_boundary * _rho_boundary * (_SR - _normal_speed_boundary) / (_SR - _SM); 72 3735 : return fluxBoundary() + _SR * (f * hllcBoundary() - conservedVariableBoundary()); 73 : } 74 : } 75 : mooseError("Should never get here"); 76 : return 0; 77 : }