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