LCOV - code coverage report
Current view: top level - src/components - HeatStructureCylindrical.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 44 45 97.8 %
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 "HeatStructureCylindrical.h"
      11             : 
      12             : registerMooseObject("ThermalHydraulicsApp", HeatStructureCylindrical);
      13             : 
      14             : InputParameters
      15        2640 : HeatStructureCylindrical::validParams()
      16             : {
      17        2640 :   InputParameters params = HeatStructureCylindricalBase::validParams();
      18             : 
      19        5280 :   params.addRequiredParam<std::vector<std::string>>("names", "Name of each radial region");
      20        5280 :   params.addRequiredParam<std::vector<Real>>("widths", "Width of each radial region [m]");
      21        5280 :   params.addRequiredParam<std::vector<unsigned int>>("n_part_elems",
      22             :                                                      "Number of elements of each radial region");
      23        5280 :   params.addDeprecatedParam<std::vector<std::string>>(
      24             :       "materials",
      25             :       "Material name for each transverse region",
      26             :       "HeatStructureMaterials are deprecated. Please make corresponding SolidProperties objects "
      27             :       "and replace the heat structure parameter 'materials' with the parameters 'solid_properties' "
      28             :       "and 'solid_properties_T_ref'. See heat structure documentation for more information.");
      29        5280 :   params.addParam<std::vector<UserObjectName>>(
      30             :       "solid_properties", "Solid properties object name for each radial region");
      31        5280 :   params.addParam<std::vector<Real>>(
      32             :       "solid_properties_T_ref",
      33             :       {},
      34             :       "Density reference temperatures for each radial region. This is required if "
      35             :       "'solid_properties' is provided. The density in each region will be a constant value "
      36             :       "computed by evaluating the density function at the reference temperature.");
      37        5280 :   params.addParam<Real>("num_rods", 1.0, "Number of rods represented by this heat structure");
      38        5280 :   params.addParam<Real>("inner_radius", 0., "Inner radius of the heat structure [m]");
      39             : 
      40        2640 :   params.addClassDescription("Cylindrical heat structure");
      41             : 
      42        2640 :   return params;
      43           0 : }
      44             : 
      45        1320 : HeatStructureCylindrical::HeatStructureCylindrical(const InputParameters & params)
      46        1320 :   : HeatStructureCylindricalBase(params)
      47             : {
      48        3960 :   _names = getParam<std::vector<std::string>>("names");
      49        1320 :   _n_regions = _names.size();
      50        3220 :   for (unsigned int i = 0; i < _names.size(); i++)
      51        1900 :     _name_index[_names[i]] = i;
      52             : 
      53        3996 :   _material_names = isParamValid("materials") ? getParam<std::vector<std::string>>("materials")
      54        1320 :                                               : std::vector<std::string>{};
      55             : 
      56        3960 :   _width = getParam<std::vector<Real>>("widths");
      57        1320 :   _total_width = std::accumulate(_width.begin(), _width.end(), 0.0);
      58             : 
      59        2640 :   _n_part_elems = getParam<std::vector<unsigned int>>("n_part_elems");
      60        3216 :   for (unsigned int i = 0; i < _n_part_elems.size(); i++)
      61        1896 :     _total_elem_number += _n_part_elems[i];
      62             : 
      63        2640 :   _num_rods = getParam<Real>("num_rods");
      64             : 
      65        2640 :   _inner_radius = getParam<Real>("inner_radius");
      66             : 
      67        1320 :   if (_width.size() == _n_regions)
      68             :   {
      69        1318 :     std::vector<Real> r(_n_regions + 1, _inner_radius);
      70        3212 :     for (unsigned int i = 0; i < _n_regions; i++)
      71             :     {
      72        1894 :       r[i + 1] = r[i] + _width[i];
      73        1894 :       _volume.push_back(_num_rods * M_PI * (r[i + 1] * r[i + 1] - r[i] * r[i]) * _length);
      74             :     }
      75             :   }
      76        1320 : }
      77             : 
      78             : void
      79        1310 : HeatStructureCylindrical::check() const
      80             : {
      81        1310 :   HeatStructureCylindricalBase::check();
      82             : 
      83        2620 :   checkEqualSize<std::string, unsigned int>("names", "n_part_elems");
      84        2620 :   checkEqualSize<std::string, Real>("names", "widths");
      85        2620 :   if (isParamValid("materials"))
      86          36 :     checkEqualSize<std::string, std::string>("names", "materials");
      87        2620 :   if (isParamValid("solid_properties"))
      88             :   {
      89        2334 :     checkEqualSize<UserObjectName, std::string>("solid_properties", "names");
      90        2334 :     checkEqualSize<UserObjectName, Real>("solid_properties", "solid_properties_T_ref");
      91             :   }
      92        3930 :   checkMutuallyExclusiveParameters({"materials", "solid_properties"}, false);
      93        2620 : }

Generated by: LCOV version 1.14