LCOV - code coverage report
Current view: top level - src/materials - ADWallHeatTransferCoefficientWeismanMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 50 52 96.2 %
Date: 2025-07-30 13:02:48 Functions: 3 3 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 "ADWallHeatTransferCoefficientWeismanMaterial.h"
      11             : #include "SinglePhaseFluidProperties.h"
      12             : #include "FlowModelSinglePhase.h"
      13             : #include "Numerics.h"
      14             : 
      15             : registerMooseObject("ThermalHydraulicsApp", ADWallHeatTransferCoefficientWeismanMaterial);
      16             : 
      17             : InputParameters
      18         277 : ADWallHeatTransferCoefficientWeismanMaterial::validParams()
      19             : {
      20         277 :   InputParameters params = Material::validParams();
      21         554 :   params.addParam<MaterialPropertyName>("Hw",
      22             :                                         FlowModelSinglePhase::HEAT_TRANSFER_COEFFICIENT_WALL,
      23             :                                         "Heat transfer coefficient material property");
      24         554 :   params.addParam<MaterialPropertyName>(
      25             :       "rho", FlowModelSinglePhase::DENSITY, "Density of the fluid");
      26         554 :   params.addParam<MaterialPropertyName>("vel", FlowModelSinglePhase::VELOCITY, "Fluid velocity");
      27         554 :   params.addParam<MaterialPropertyName>(
      28             :       "D_h", FlowModelSinglePhase::HYDRAULIC_DIAMETER, "Hydraulic diameter");
      29         554 :   params.addParam<MaterialPropertyName>(
      30             :       "cp", FlowModelSinglePhase::SPECIFIC_HEAT_CONSTANT_PRESSURE, "Specific heat of the fluid");
      31         554 :   params.addParam<MaterialPropertyName>(
      32             :       "mu", FlowModelSinglePhase::DYNAMIC_VISCOSITY, "Dynamic viscosity of the fluid");
      33         554 :   params.addParam<MaterialPropertyName>(
      34             :       "k", FlowModelSinglePhase::THERMAL_CONDUCTIVITY, "Heat conductivity of the fluid");
      35         554 :   params.addParam<MaterialPropertyName>(
      36             :       "T", FlowModelSinglePhase::TEMPERATURE, "Fluid temperature");
      37         554 :   params.addParam<MaterialPropertyName>("T_wall", FlowModel::TEMPERATURE_WALL, "Wall temperature");
      38         554 :   params.addRequiredParam<Real>(
      39             :       "PoD", "The Pitch-to-diameter ratio value being assigned into the property");
      40         554 :   MooseEnum bundle_array("SQUARE TRIANGULAR", "SQUARE");
      41         554 :   params.addParam<MooseEnum>("bundle_array", bundle_array, "The type of the rod bundle array");
      42         277 :   params.addClassDescription(
      43             :       "Computes wall heat transfer coefficient for water using the Weisman correlation");
      44         277 :   return params;
      45         277 : }
      46             : 
      47         216 : ADWallHeatTransferCoefficientWeismanMaterial::ADWallHeatTransferCoefficientWeismanMaterial(
      48         216 :     const InputParameters & parameters)
      49             :   : Material(parameters),
      50         216 :     _Hw(declareADProperty<Real>("Hw")),
      51         432 :     _rho(getADMaterialProperty<Real>("rho")),
      52         432 :     _vel(getADMaterialProperty<Real>("vel")),
      53         432 :     _D_h(getADMaterialProperty<Real>("D_h")),
      54         432 :     _k(getADMaterialProperty<Real>("k")),
      55         432 :     _mu(getADMaterialProperty<Real>("mu")),
      56         432 :     _cp(getADMaterialProperty<Real>("cp")),
      57         432 :     _T(getADMaterialProperty<Real>("T")),
      58         432 :     _T_wall(getADMaterialProperty<Real>("T_wall")),
      59         432 :     _PoD(getParam<Real>("PoD")),
      60         648 :     _bundle_array(getParam<MooseEnum>("bundle_array").getEnum<Bundle_array>())
      61             : {
      62         216 : }
      63             : 
      64             : void
      65        4302 : ADWallHeatTransferCoefficientWeismanMaterial::computeQpProperties()
      66             : {
      67        4302 :   switch (_bundle_array)
      68             :   {
      69          11 :     case Bundle_array::SQUARE:
      70             :     {
      71          11 :       if (_PoD > 1.3 || _PoD < 1.1)
      72           2 :         mooseDoOnce(mooseWarning(
      73             :             "The Weisman correlation for square arrays is valid when P/D is between 1.1 "
      74             :             "and 1.3. Be aware that using values out of this range may lead to "
      75             :             "significant errors in your results!"));
      76           9 :       ADReal Pr = THM::Prandtl(_cp[_qp], _mu[_qp], _k[_qp]);
      77           9 :       ADReal Re = std::max(1.0, THM::Reynolds(1., _rho[_qp], _vel[_qp], _D_h[_qp], _mu[_qp]));
      78           9 :       ADReal n = (_T[_qp] < _T_wall[_qp]) ? 0.4 : 0.3;
      79           9 :       ADReal Nu = 0.023 * std::pow(Re, 4. / 5.) * std::pow(Pr, n) * (1.826 * _PoD - 1.0430);
      80           9 :       _Hw[_qp] = THM::wallHeatTransferCoefficient(Nu, _k[_qp], _D_h[_qp]);
      81             :       break;
      82             :     }
      83        4291 :     case Bundle_array::TRIANGULAR:
      84             :     {
      85        4291 :       if (_PoD > 1.5 || _PoD < 1.1)
      86           2 :         mooseDoOnce(mooseWarning(
      87             :             "The Weisman correlation for triangular arrays is valid when P/D is between 1.1 "
      88             :             "and 1.5. Be aware that using values out of this range may lead to "
      89             :             "significant errors in your results!"));
      90        4289 :       ADReal Pr = THM::Prandtl(_cp[_qp], _mu[_qp], _k[_qp]);
      91        4289 :       ADReal Re = std::max(1.0, THM::Reynolds(1., _rho[_qp], _vel[_qp], _D_h[_qp], _mu[_qp]));
      92        4298 :       ADReal n = (_T[_qp] < _T_wall[_qp]) ? 0.4 : 0.3;
      93        4289 :       ADReal Nu = 0.023 * std::pow(Re, 4. / 5.) * std::pow(Pr, n) * (1.130 * _PoD - 0.2609);
      94        4289 :       _Hw[_qp] = THM::wallHeatTransferCoefficient(Nu, _k[_qp], _D_h[_qp]);
      95             :       break;
      96             :     }
      97           0 :     default:
      98           0 :       mooseError("Invalid 'bundle_array' parameter.");
      99             :   }
     100        4298 : }

Generated by: LCOV version 1.14