LCOV - code coverage report
Current view: top level - src/scmclosures - SCMHTCClosureBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #32971 (54bef8) with base c6cf66 Lines: 39 42 92.9 %
Date: 2026-05-29 20:40:47 Functions: 5 5 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 "SCMHTCClosureBase.h"
      11             : #include "SCM.h"
      12             : #include "SubChannelApp.h"
      13             : 
      14             : #include <cmath>
      15             : 
      16             : InputParameters
      17         855 : SCMHTCClosureBase::validParams()
      18             : {
      19         855 :   InputParameters params = SCMClosureBase::validParams();
      20         855 :   return params;
      21             : }
      22             : 
      23         464 : SCMHTCClosureBase::SCMHTCClosureBase(const InputParameters & parameters)
      24         464 :   : SCMClosureBase(parameters)
      25             : {
      26         464 :   if (_subproblem.hasVariable(SubChannelApp::PIN_DIAMETER))
      27             :     _Dpin_soln =
      28         816 :         std::make_unique<SolutionHandle>(_subproblem.getVariable(0, SubChannelApp::PIN_DIAMETER));
      29         464 : }
      30             : 
      31             : NusseltPreInfo
      32      899387 : SCMHTCClosureBase::computeNusseltNumberPreInfo(const NusseltStruct & nusselt_args) const
      33             : {
      34             :   NusseltPreInfo info;
      35      899387 :   info.Re = nusselt_args.Re;
      36      899387 :   info.Pr = nusselt_args.Pr;
      37             : 
      38      899387 :   const auto pitch = _subchannel_mesh.getPitch();
      39             :   Real D;
      40      899387 :   const bool is_duct = (nusselt_args.i_pin == std::numeric_limits<unsigned int>::max());
      41      899387 :   if (!is_duct)
      42             :   {
      43      874967 :     if (_Dpin_soln)
      44             :     {
      45      874967 :       const auto * pin_node = _subchannel_mesh.getPinNode(nusselt_args.i_pin, nusselt_args.iz);
      46      874967 :       if ((*_Dpin_soln)(pin_node) > 0)
      47      874967 :         D = (*_Dpin_soln)(pin_node);
      48             :       else
      49           0 :         mooseError(name(),
      50             :                    "The diameter of the pin is equal or smaller than zero, "
      51             :                    "please initialize the auxiliary variable Dpin.");
      52             :     }
      53             :     else
      54           0 :       D = _subchannel_mesh.getPinDiameter();
      55             :   }
      56             :   else
      57       24420 :     D = _subchannel_mesh.getPinDiameter();
      58             : 
      59      899387 :   info.poD = pitch / D;
      60      899387 :   info.subch_type = _subchannel_mesh.getSubchannelType(nusselt_args.i_ch);
      61             : 
      62      899387 :   info.laminar_Nu = (info.subch_type == EChannelType::CENTER)
      63      899387 :                         ? 3.73
      64      192796 :                         : (info.subch_type == EChannelType::EDGE ? 3.59 : 3.52);
      65             :   /// transient range Re limits-Updated-Cheng-Todreas 2018
      66      899387 :   info.ReL = 320 * std::pow(10.0, (info.poD - 1.0));
      67      899387 :   info.ReT = 1e4 * std::pow(10.0, 0.7 * (info.poD - 1.0));
      68             : 
      69      899387 :   return info;
      70             : }
      71             : 
      72             : Real
      73      899387 : SCMHTCClosureBase::computeHTC(const FrictionStruct & friction_args,
      74             :                               const NusseltStruct & nusselt_args,
      75             :                               const Real k) const
      76             : {
      77             :   // Compute HTC
      78      899387 :   auto Nu = computeNusseltNumber(friction_args, nusselt_args);
      79      899387 :   auto Dh_i = 4.0 * friction_args.S / friction_args.w_perim;
      80      899387 :   const auto htc = Nu * k / Dh_i;
      81      899387 :   if (!std::isfinite(htc) || htc < 0.0)
      82           3 :     mooseError(name(), ": The heat transfer coefficient must be non-negative and finite.");
      83      899384 :   return htc;
      84             : }
      85             : 
      86             : Real
      87      899387 : SCMHTCClosureBase::blendTurbulentNusseltNumber(const NusseltPreInfo & info,
      88             :                                                const Real turbulent_nusselt) const
      89             : {
      90      899387 :   if (info.Re <= info.ReL)
      91           0 :     return info.laminar_Nu;
      92             : 
      93      899387 :   if (info.Re >= info.ReT)
      94             :     return turbulent_nusselt;
      95             : 
      96      157415 :   const Real weight = (info.Re - info.ReL) / (info.ReT - info.ReL);
      97      157415 :   return weight * turbulent_nusselt + (1.0 - weight) * info.laminar_Nu;
      98             : }

Generated by: LCOV version 1.14