LCOV - code coverage report
Current view: top level - src/functormaterials - ConjugateHTNumbersFunctorMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 37 39 94.9 %
Date: 2025-07-30 13:02:48 Functions: 4 28 14.3 %
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 "ConjugateHTNumbersFunctorMaterial.h"
      11             : #include "HeatTransferUtils.h"
      12             : #include "SinglePhaseFluidProperties.h"
      13             : #include "PhysicalConstants.h"
      14             : 
      15             : registerMooseObject("ThermalHydraulicsApp", ConjugateHTNumbersFunctorMaterial);
      16             : registerMooseObject("ThermalHydraulicsApp", ADConjugateHTNumbersFunctorMaterial);
      17             : 
      18             : template <bool is_ad>
      19             : InputParameters
      20          41 : ConjugateHTNumbersFunctorMaterialTempl<is_ad>::validParams()
      21             : {
      22          41 :   InputParameters params = FunctorMaterial::validParams();
      23             : 
      24          41 :   params.addClassDescription(
      25             :       "Computes several non-dimensional numbers for conjugate heat transfer.");
      26             : 
      27          82 :   params.addRequiredParam<MooseFunctorName>("p_fluid", "Fluid pressure functor");
      28          82 :   params.addRequiredParam<MooseFunctorName>("T_fluid", "Fluid temperature functor");
      29          82 :   params.addRequiredParam<MooseFunctorName>("T_solid", "Solid temperature functor");
      30          82 :   params.addRequiredParam<Real>("length", "Characteristic length [m]");
      31          82 :   params.addRequiredParam<std::string>("Pr_name",
      32             :                                        "Name to give the Prandtl number functor material property");
      33          82 :   params.addRequiredParam<std::string>("Gr_name",
      34             :                                        "Name to give the Grashof number functor material property");
      35          82 :   params.addRequiredParam<UserObjectName>("fluid_properties",
      36             :                                           "The SinglePhaseFluidProperties object for the fluid");
      37             : 
      38          41 :   return params;
      39           0 : }
      40             : 
      41             : template <bool is_ad>
      42          22 : ConjugateHTNumbersFunctorMaterialTempl<is_ad>::ConjugateHTNumbersFunctorMaterialTempl(
      43             :     const InputParameters & parameters)
      44             :   : FunctorMaterial(parameters),
      45          22 :     _p_fluid(getFunctor<GenericReal<is_ad>>("p_fluid")),
      46          44 :     _T_fluid(getFunctor<GenericReal<is_ad>>("T_fluid")),
      47          44 :     _T_solid(getFunctor<GenericReal<is_ad>>("T_solid")),
      48          44 :     _length(getParam<Real>("length")),
      49          44 :     _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
      50             : {
      51          88 :   addFunctorProperty<GenericReal<is_ad>>(
      52          44 :       getParam<std::string>("Pr_name"),
      53          90 :       [this](const auto & r, const auto & t) -> GenericReal<is_ad>
      54             :       {
      55          18 :         const auto p = _p_fluid(r, t);
      56          18 :         const auto T = _T_fluid(r, t);
      57          18 :         const auto cp = _fp.cp_from_p_T(p, T);
      58          18 :         const auto mu = _fp.mu_from_p_T(p, T);
      59          18 :         const auto k = _fp.k_from_p_T(p, T);
      60             : 
      61          18 :         return HeatTransferUtils::prandtl(cp, mu, k);
      62             :       });
      63             : 
      64          88 :   addFunctorProperty<GenericReal<is_ad>>(
      65          44 :       getParam<std::string>("Gr_name"),
      66         126 :       [this](const auto & r, const auto & t) -> GenericReal<is_ad>
      67             :       {
      68          18 :         const auto p_fluid = _p_fluid(r, t);
      69          18 :         const auto T_fluid = _T_fluid(r, t);
      70          18 :         const auto T_solid = _T_solid(r, t);
      71          18 :         const auto beta_fluid = _fp.beta_from_p_T(p_fluid, T_fluid);
      72          18 :         const auto rho_fluid = _fp.rho_from_p_T(p_fluid, T_fluid);
      73          18 :         const auto mu_fluid = _fp.mu_from_p_T(p_fluid, T_fluid);
      74             : 
      75           0 :         return HeatTransferUtils::grashof(beta_fluid,
      76             :                                           T_solid,
      77             :                                           T_fluid,
      78             :                                           _length,
      79             :                                           rho_fluid,
      80             :                                           mu_fluid,
      81          18 :                                           PhysicalConstants::acceleration_of_gravity);
      82             :       });
      83          66 : }
      84             : 
      85             : template class ConjugateHTNumbersFunctorMaterialTempl<false>;
      86             : template class ConjugateHTNumbersFunctorMaterialTempl<true>;

Generated by: LCOV version 1.14