LCOV - code coverage report
Current view: top level - src/postprocessors - ConvectiveHeatTransferSideIntegral.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 26 29 89.7 %
Date: 2025-09-04 07:53:51 Functions: 6 6 100.0 %
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 "ConvectiveHeatTransferSideIntegral.h"
      11             : 
      12             : #include "metaphysicl/raw_type.h"
      13             : 
      14             : registerMooseObject("HeatTransferApp", ConvectiveHeatTransferSideIntegral);
      15             : registerMooseObject("HeatTransferApp", ADConvectiveHeatTransferSideIntegral);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19         869 : ConvectiveHeatTransferSideIntegralTempl<is_ad>::validParams()
      20             : {
      21         869 :   InputParameters params = SideIntegralPostprocessor::validParams();
      22         869 :   params.addClassDescription("Computes the total convective heat transfer across a boundary.");
      23             : 
      24        1738 :   params.addRequiredCoupledVar("T_solid", "The solid temperature.");
      25        1738 :   params.addCoupledVar("T_fluid_var", "The fluid temperature.");
      26        1738 :   params.addCoupledVar("htc_var", "HTC variable");
      27        1738 :   params.addParam<MaterialPropertyName>("T_fluid",
      28             :                                         "Name of the fluid temperature material property");
      29        1738 :   params.addParam<MaterialPropertyName>("htc", "Name of alpha_wall material property");
      30         869 :   return params;
      31           0 : }
      32             : 
      33             : template <bool is_ad>
      34         465 : ConvectiveHeatTransferSideIntegralTempl<is_ad>::ConvectiveHeatTransferSideIntegralTempl(
      35             :     const InputParameters & parameters)
      36             :   : SideIntegralPostprocessor(parameters),
      37         465 :     _T_wall(coupledValue("T_solid")),
      38         553 :     _T_fluid(isCoupled("T_fluid_var") ? &coupledValue("T_fluid_var") : nullptr),
      39        1684 :     _T_fluid_mat(isParamValid("T_fluid") ? &getGenericMaterialProperty<Real, is_ad>("T_fluid")
      40             :                                          : nullptr),
      41         509 :     _hw(isCoupled("htc_var") ? &coupledValue("htc_var") : nullptr),
      42        2237 :     _hw_mat(isParamValid("htc") ? &getGenericMaterialProperty<Real, is_ad>("htc") : nullptr)
      43             : {
      44         930 :   if (isCoupled("htc_var") == isParamValid("htc"))
      45           0 :     paramError("htc", "Either htc_var OR htc must be provided (exactly one, not both).");
      46             : 
      47         930 :   if (isCoupled("T_fluid_var") == isParamValid("T_fluid"))
      48           0 :     paramError("T_fluid",
      49             :                "Either ",
      50             :                "T_fluid",
      51             :                " OR ",
      52             :                "T_fluid_var",
      53             :                " must be provided (exactly one, not both).");
      54         465 : }
      55             : 
      56             : template <bool is_ad>
      57             : Real
      58       30650 : ConvectiveHeatTransferSideIntegralTempl<is_ad>::computeQpIntegral()
      59             : {
      60             :   Real hw;
      61       30650 :   if (_hw)
      62         144 :     hw = (*_hw)[_qp];
      63             :   else
      64       30506 :     hw = MetaPhysicL::raw_value((*_hw_mat)[_qp]);
      65             : 
      66             :   Real Tf;
      67       30650 :   if (_T_fluid)
      68         288 :     Tf = (*_T_fluid)[_qp];
      69             :   else
      70       30362 :     Tf = MetaPhysicL::raw_value((*_T_fluid_mat)[_qp]);
      71             : 
      72       30650 :   return hw * (_T_wall[_qp] - Tf);
      73             : }
      74             : 
      75             : template class ConvectiveHeatTransferSideIntegralTempl<false>;
      76             : template class ConvectiveHeatTransferSideIntegralTempl<true>;

Generated by: LCOV version 1.14