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