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 "FinEfficiencyFunctorMaterial.h" 11 : 12 : registerMooseObject("HeatTransferApp", FinEfficiencyFunctorMaterial); 13 : registerMooseObject("HeatTransferApp", ADFinEfficiencyFunctorMaterial); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 41 : FinEfficiencyFunctorMaterialTempl<is_ad>::validParams() 18 : { 19 41 : InputParameters params = FunctorMaterial::validParams(); 20 41 : params.addClassDescription("Computes fin efficiency."); 21 82 : params.addRequiredParam<MooseFunctorName>("heat_transfer_coefficient", 22 : "Heat transfer coefficient functor [W/(m^2-K)]"); 23 82 : params.addRequiredParam<MooseFunctorName>("thermal_conductivity", 24 : "Thermal conductivity functor [W/(m-K)]"); 25 82 : params.addRequiredParam<MooseFunctorName>("fin_height", "Fin height functor [m]"); 26 82 : params.addRequiredParam<MooseFunctorName>( 27 : "fin_perimeter_area_ratio", 28 : "Functor for the ratio of the fin perimeter to its cross-sectional area [1/m]"); 29 82 : params.addParam<MooseFunctorName>("fin_efficiency_name", 30 : "fin_efficiency", 31 : "Name to give the fin efficiency functor material property"); 32 41 : return params; 33 0 : } 34 : 35 : template <bool is_ad> 36 22 : FinEfficiencyFunctorMaterialTempl<is_ad>::FinEfficiencyFunctorMaterialTempl( 37 : const InputParameters & parameters) 38 : : FunctorMaterial(parameters), 39 22 : _htc(getFunctor<GenericReal<is_ad>>("heat_transfer_coefficient")), 40 44 : _k(getFunctor<GenericReal<is_ad>>("thermal_conductivity")), 41 44 : _L(getFunctor<GenericReal<is_ad>>("fin_height")), 42 66 : _P_over_Ac(getFunctor<GenericReal<is_ad>>("fin_perimeter_area_ratio")) 43 : { 44 88 : addFunctorProperty<GenericReal<is_ad>>( 45 44 : getParam<MooseFunctorName>("fin_efficiency_name"), 46 18 : [this](const auto & r, const auto & t) -> GenericReal<is_ad> 47 : { 48 18 : const auto htc = _htc(r, t); 49 18 : const auto k = _k(r, t); 50 18 : const auto L = _L(r, t); 51 18 : const auto P_over_Ac = _P_over_Ac(r, t); 52 0 : const auto m = std::sqrt(htc * P_over_Ac / k); 53 18 : const auto mL = m * L; 54 0 : return std::tanh(mL) / mL; 55 : }); 56 44 : } 57 : 58 : template class FinEfficiencyFunctorMaterialTempl<false>; 59 : template class FinEfficiencyFunctorMaterialTempl<true>;