LCOV - code coverage report
Current view: top level - src/functormaterials - FinEfficiencyFunctorMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 23 26 88.5 %
Date: 2026-05-29 20:37:03 Functions: 3 22 13.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14