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 "CNSFVHLLCMomentumBC.h" 11 : 12 : registerMooseObject("NavierStokesApp", CNSFVHLLCSpecifiedMassFluxAndTemperatureMomentumBC); 13 : registerMooseObject("NavierStokesApp", CNSFVHLLCSpecifiedPressureMomentumBC); 14 : 15 : template <typename T> 16 : void 17 592 : CNSFVHLLCMomentumBC<T>::addCommonParams(InputParameters & params) 18 : { 19 1184 : MooseEnum momentum_component("x=0 y=1 z=2"); 20 1184 : params.addRequiredParam<MooseEnum>( 21 : "momentum_component", 22 : momentum_component, 23 : "The component of the momentum equation that this kernel applies to."); 24 592 : } 25 : 26 : template <typename T> 27 : InputParameters 28 296 : CNSFVHLLCMomentumBC<T>::validParams() 29 : { 30 296 : InputParameters params = T::validParams(); 31 296 : addCommonParams(params); 32 296 : params.addClassDescription("Implements the momentum boundary flux portion of the free-flow HLLC " 33 : "discretization given specified mass fluxes and fluid temperature"); 34 296 : return params; 35 0 : } 36 : 37 : template <> 38 : InputParameters 39 296 : CNSFVHLLCMomentumBC<CNSFVHLLCSpecifiedPressureBC>::validParams() 40 : { 41 296 : InputParameters params = CNSFVHLLCSpecifiedPressureBC::validParams(); 42 296 : addCommonParams(params); 43 296 : params.addClassDescription("Implements the momentum boundary flux portion of the free-flow HLLC " 44 : "discretization given specified pressure"); 45 296 : return params; 46 0 : } 47 : 48 : template <typename T> 49 314 : CNSFVHLLCMomentumBC<T>::CNSFVHLLCMomentumBC(const InputParameters & params) 50 628 : : T(params), _index(this->template getParam<MooseEnum>("momentum_component")) 51 : { 52 314 : } 53 : 54 : template <typename T> 55 : ADReal 56 14183 : CNSFVHLLCMomentumBC<T>::fluxElem() 57 : { 58 14183 : return this->_normal_speed_elem * this->_rho_elem[this->_qp] * 59 14183 : this->_vel_elem[this->_qp](_index) + 60 28366 : this->_normal(_index) * this->_pressure_elem[this->_qp]; 61 : } 62 : 63 : template <typename T> 64 : ADReal 65 14183 : CNSFVHLLCMomentumBC<T>::fluxBoundary() 66 : { 67 14183 : return this->_normal_speed_boundary * this->_rho_boundary * this->_vel_boundary(_index) + 68 14183 : this->_normal(_index) * this->_pressure_boundary; 69 : } 70 : 71 : template <typename T> 72 : ADReal 73 14183 : CNSFVHLLCMomentumBC<T>::hllcElem() 74 : { 75 14183 : auto vel_nonnormal = this->_vel_elem[this->_qp] - this->_normal_speed_elem * this->_normal; 76 14183 : return this->_normal(_index) * this->_SM + vel_nonnormal(_index); 77 : 78 : // For some reason, the below expression doesn't give as good results as the 79 : // above one. 80 : // return this->_normal(_index) * (_SM - this->_normal_speed_elem) + 81 : // this->_vel_elem[this->_qp](_index); 82 : } 83 : 84 : template <typename T> 85 : ADReal 86 14183 : CNSFVHLLCMomentumBC<T>::hllcBoundary() 87 : { 88 14183 : auto vel_nonnormal = this->_vel_boundary - this->_normal_speed_boundary * this->_normal; 89 14183 : return this->_normal(_index) * this->_SM + vel_nonnormal(_index); 90 : 91 : // For some reason, the below expression doesn't give as good results as the 92 : // above one. 93 : // return this->_normal(_index) * (_SM - this->_normal_speed_boundary) + 94 : // this->_vel_elem[this->_qp](_index); 95 : } 96 : 97 : template <typename T> 98 : ADReal 99 14183 : CNSFVHLLCMomentumBC<T>::conservedVariableElem() 100 : { 101 14183 : return this->_rho_elem[this->_qp] * this->_vel_elem[this->_qp](_index); 102 : } 103 : 104 : template <typename T> 105 : ADReal 106 14183 : CNSFVHLLCMomentumBC<T>::conservedVariableBoundary() 107 : { 108 14183 : return this->_rho_boundary * this->_vel_boundary(_index); 109 : } 110 : 111 : template class CNSFVHLLCMomentumBC<CNSFVHLLCSpecifiedMassFluxAndTemperatureBC>; 112 : template class CNSFVHLLCMomentumBC<CNSFVHLLCSpecifiedPressureBC>;