LCOV - code coverage report
Current view: top level - src/functormaterials - ChurchillChuHTCFunctorMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 25 27 92.6 %
Date: 2025-09-04 07:53:51 Functions: 4 22 18.2 %
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 "ChurchillChuHTCFunctorMaterial.h"
      11             : 
      12             : registerMooseObject("HeatTransferApp", ChurchillChuHTCFunctorMaterial);
      13             : registerMooseObject("HeatTransferApp", ADChurchillChuHTCFunctorMaterial);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17          41 : ChurchillChuHTCFunctorMaterialTempl<is_ad>::validParams()
      18             : {
      19          41 :   InputParameters params = FunctorMaterial::validParams();
      20          41 :   params.addClassDescription("Computes a heat transfer coefficient using the Churchill-Chu "
      21             :                              "correlation for natural convection.");
      22          82 :   params.addRequiredParam<MooseFunctorName>("Pr", "Fluid Prandtl number functor");
      23          82 :   params.addRequiredParam<MooseFunctorName>("Gr", "Grashof number functor");
      24          82 :   params.addRequiredParam<MooseFunctorName>("k_fluid",
      25             :                                             "Fluid thermal conductivity functor [W/(m-K)]");
      26          82 :   params.addRequiredParam<Real>("diameter", "Cylinder diameter [m]");
      27          82 :   params.addRequiredParam<std::string>(
      28             :       "htc_name", "Name to give the heat transfer coefficient functor material property");
      29             : 
      30          41 :   return params;
      31           0 : }
      32             : 
      33             : template <bool is_ad>
      34          22 : ChurchillChuHTCFunctorMaterialTempl<is_ad>::ChurchillChuHTCFunctorMaterialTempl(
      35             :     const InputParameters & parameters)
      36             :   : FunctorMaterial(parameters),
      37          22 :     _Pr(getFunctor<GenericReal<is_ad>>("Pr")),
      38          44 :     _Gr(getFunctor<GenericReal<is_ad>>("Gr")),
      39          44 :     _k_fluid(getFunctor<GenericReal<is_ad>>("k_fluid")),
      40          66 :     _diameter(getParam<Real>("diameter"))
      41             : {
      42          88 :   addFunctorProperty<GenericReal<is_ad>>(
      43          44 :       getParam<std::string>("htc_name"),
      44          18 :       [this](const auto & r, const auto & t) -> GenericReal<is_ad>
      45             :       {
      46          18 :         const auto Pr = _Pr(r, t);
      47          18 :         const auto Gr = _Gr(r, t);
      48          18 :         const auto k_fluid = _k_fluid(r, t);
      49           0 :         const auto Ra = Gr * Pr;
      50          36 :         const auto numerator = 0.387 * std::pow(Ra, 1.0 / 6.0);
      51          54 :         const auto denominator = std::pow(1 + std::pow(0.559 / Pr, 9.0 / 16.0), 8.0 / 27.0);
      52          36 :         const auto root_Nu = 0.6 + numerator / denominator;
      53             :         const auto Nu = Utility::pow<2>(root_Nu);
      54             : 
      55          18 :         return Nu * k_fluid / _diameter;
      56             :       });
      57          44 : }
      58             : 
      59             : template class ChurchillChuHTCFunctorMaterialTempl<false>;
      60             : template class ChurchillChuHTCFunctorMaterialTempl<true>;

Generated by: LCOV version 1.14