LCOV - code coverage report
Current view: top level - src/components - Component2D.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 278 309 90.0 %
Date: 2025-07-30 13:02:48 Functions: 16 17 94.1 %
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 "Component2D.h"
      11             : #include "THMMesh.h"
      12             : #include "THMEnums.h"
      13             : 
      14             : const std::map<std::string, Component2D::ExternalBoundaryType>
      15             :     Component2D::_external_boundary_type_to_enum{{"INNER", ExternalBoundaryType::INNER},
      16             :                                                  {"OUTER", ExternalBoundaryType::OUTER},
      17             :                                                  {"START", ExternalBoundaryType::START},
      18             :                                                  {"END", ExternalBoundaryType::END}};
      19             : 
      20             : MooseEnum
      21         604 : Component2D::getExternalBoundaryTypeMooseEnum(const std::string & name)
      22             : {
      23         604 :   return THM::getMooseEnum<ExternalBoundaryType>(name, _external_boundary_type_to_enum);
      24             : }
      25             : 
      26             : template <>
      27             : Component2D::ExternalBoundaryType
      28         302 : THM::stringToEnum(const std::string & s)
      29             : {
      30         302 :   return stringToEnum<Component2D::ExternalBoundaryType>(
      31         302 :       s, Component2D::_external_boundary_type_to_enum);
      32             : }
      33             : 
      34             : InputParameters
      35        3386 : Component2D::validParams()
      36             : {
      37        3386 :   InputParameters params = GeneratedMeshComponent::validParams();
      38        3386 :   return params;
      39             : }
      40             : 
      41        1692 : Component2D::Component2D(const InputParameters & params)
      42        1692 :   : GeneratedMeshComponent(params), _n_regions(0), _total_elem_number(0), _axial_offset(0.0)
      43             : {
      44        1692 : }
      45             : 
      46             : void
      47        1645 : Component2D::check() const
      48             : {
      49        1645 :   GeneratedMeshComponent::check();
      50             : 
      51        3290 :   if (getParam<std::vector<std::string>>("axial_region_names").size())
      52         624 :     checkEqualSize<std::string, Real>("axial_region_names", "length");
      53        1333 :   else if (_n_sections > 1)
      54           2 :     logError("If there is more than 1 axial region, then the parameter 'axial_region_names' must "
      55             :              "be specified.");
      56        1645 : }
      57             : 
      58             : bool
      59         242 : Component2D::hasBlock(const std::string & name) const
      60             : {
      61         242 :   return std::find(_names.begin(), _names.end(), name) != _names.end();
      62             : }
      63             : 
      64             : void
      65        1676 : Component2D::build2DMesh()
      66             : {
      67        1676 :   unsigned int n_axial_positions = _node_locations.size();
      68             :   std::vector<std::vector<unsigned int>> node_ids(
      69        1676 :       n_axial_positions, std::vector<unsigned int>(_total_elem_number + 1));
      70             : 
      71             :   // loop over axial positions
      72       31258 :   for (unsigned int i = 0; i < n_axial_positions; i++)
      73             :   {
      74       29582 :     Point p(_node_locations[i], _axial_offset, 0);
      75             : 
      76       29582 :     Node * nd = addNode(p);
      77       29582 :     node_ids[i][0] = nd->id();
      78             : 
      79             :     // loop over regions
      80             :     unsigned int l = 1;
      81       76169 :     for (unsigned int j = 0; j < _n_regions; j++)
      82             :     {
      83       46587 :       Real elem_length = _width[j] / _n_part_elems[j];
      84      273003 :       for (unsigned int k = 0; k < _n_part_elems[j]; k++, l++)
      85             :       {
      86      226416 :         p(1) += elem_length;
      87      226416 :         nd = addNode(p);
      88      226416 :         node_ids[i][l] = nd->id();
      89             :       }
      90             :     }
      91             :   }
      92             : 
      93        1676 :   auto & boundary_info = mesh().getMesh().get_boundary_info();
      94             : 
      95             :   // create elements from nodes
      96             :   unsigned int i = 0;
      97        3740 :   for (unsigned int i_section = 0; i_section < _n_sections; i_section++)
      98             :   {
      99             :     // element axial index for end of axial section
     100             :     unsigned int i_section_end = 0;
     101        4590 :     for (unsigned int ii_section = 0; ii_section <= i_section; ++ii_section)
     102        2526 :       i_section_end += _n_elems[ii_section];
     103        2064 :     i_section_end -= 1;
     104             : 
     105       29970 :     for (unsigned int i_local = 0; i_local < _n_elems[i_section]; i_local++)
     106             :     {
     107             :       unsigned int j = 0;
     108       72161 :       for (unsigned int j_section = 0; j_section < _n_regions; j_section++)
     109      259837 :         for (unsigned int j_local = 0; j_local < _n_part_elems[j_section]; j_local++)
     110             :         {
     111      215582 :           Elem * elem = addElementQuad4(
     112      215582 :               node_ids[i][j + 1], node_ids[i][j], node_ids[i + 1][j], node_ids[i + 1][j + 1]);
     113      215582 :           elem->subdomain_id() = _subdomain_ids[j_section];
     114             : 
     115             :           // exterior axial boundaries (all radial sections)
     116      215582 :           if (i == 0)
     117             :           {
     118       10834 :             boundary_info.add_side(elem, 0, _start_bc_id);
     119       10834 :             _boundary_info[_boundary_name_start].push_back(
     120       10834 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     121             :           }
     122      215582 :           if (i == _n_elem - 1)
     123             :           {
     124       10834 :             boundary_info.add_side(elem, 2, _end_bc_id);
     125       10834 :             _boundary_info[_boundary_name_end].push_back(
     126       10834 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     127             :           }
     128             : 
     129             :           // exterior axial boundaries (per radial section)
     130      215582 :           if (_names.size() > 1)
     131             :           {
     132      120919 :             if (i == 0)
     133             :             {
     134        4607 :               boundary_info.add_side(elem, 0, _radial_start_bc_id[j_section]);
     135        4607 :               _boundary_info[_boundary_names_radial_start[j_section]].push_back(
     136        4607 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     137             :             }
     138      120919 :             if (i == _n_elem - 1)
     139             :             {
     140        4607 :               boundary_info.add_side(elem, 2, _radial_end_bc_id[j_section]);
     141        4607 :               _boundary_info[_boundary_names_radial_end[j_section]].push_back(
     142        4607 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     143             :             }
     144             :           }
     145             : 
     146             :           // interior axial boundaries (per radial section)
     147       35859 :           if (_n_sections > 1 && _axial_region_names.size() == _n_sections &&
     148      251333 :               i_section != _n_sections - 1 && i == i_section_end)
     149             :           {
     150        2663 :             const unsigned int k = i_section * _n_regions + j_section;
     151        2663 :             boundary_info.add_side(elem, 2, _interior_axial_per_radial_section_bc_id[k]);
     152        2663 :             _boundary_info[_boundary_names_interior_axial_per_radial_section[k]].push_back(
     153        2663 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     154             :           }
     155             : 
     156             :           // exterior radial boundaries (all axial sections)
     157      215582 :           if (j == 0)
     158             :           {
     159       27906 :             boundary_info.add_side(elem, 1, _inner_bc_id);
     160       27906 :             _boundary_info[_boundary_name_inner].push_back(
     161       27906 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     162             :           }
     163      215582 :           if (j == _total_elem_number - 1)
     164             :           {
     165       27906 :             boundary_info.add_side(elem, 3, _outer_bc_id);
     166       27906 :             _boundary_info[_boundary_name_outer].push_back(
     167       27906 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     168             :           }
     169             : 
     170             :           // exterior radial boundaries (per axial section)
     171      215582 :           if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     172             :           {
     173       35751 :             if (j == 0)
     174             :             {
     175        5987 :               boundary_info.add_side(elem, 1, _axial_inner_bc_id[i_section]);
     176        5987 :               _boundary_info[_boundary_names_axial_inner[i_section]].push_back(
     177        5987 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     178             :             }
     179       35751 :             if (j == _total_elem_number - 1)
     180             :             {
     181        5987 :               boundary_info.add_side(elem, 3, _axial_outer_bc_id[i_section]);
     182        5987 :               _boundary_info[_boundary_names_axial_outer[i_section]].push_back(
     183        5987 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     184             :             }
     185             :           }
     186             : 
     187             :           // interior radial boundaries (all axial sections)
     188      215582 :           if (_n_regions > 1 && _names.size() == _n_regions && j_section != 0)
     189             :           {
     190             :             unsigned int j_section_begin = 0;
     191      148676 :             for (unsigned int jj_section = 0; jj_section < j_section; ++jj_section)
     192       84699 :               j_section_begin += _n_part_elems[jj_section];
     193             : 
     194       63977 :             if (j == j_section_begin)
     195             :             {
     196       16349 :               boundary_info.add_side(elem, 1, _inner_radial_bc_id[j_section - 1]);
     197       16349 :               _boundary_info[_boundary_names_inner_radial[j_section - 1]].push_back(
     198       16349 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     199             :             }
     200             :           }
     201             : 
     202             :           j++;
     203             :         }
     204             : 
     205       27906 :       i++;
     206             :     }
     207             :   }
     208        1676 : }
     209             : 
     210             : void
     211          12 : Component2D::build2DMesh2ndOrder()
     212             : {
     213          12 :   unsigned int n_axial_positions = _node_locations.size();
     214             :   std::vector<std::vector<unsigned int>> node_ids(
     215          12 :       n_axial_positions, std::vector<unsigned int>(2 * _total_elem_number + 1));
     216             : 
     217             :   // loop over axial positions
     218          52 :   for (unsigned int i = 0; i < n_axial_positions; i++)
     219             :   {
     220          40 :     Point p(_node_locations[i], _axial_offset, 0);
     221             : 
     222          40 :     const Node * nd = addNode(p);
     223          40 :     node_ids[i][0] = nd->id();
     224             : 
     225             :     // loop over regions
     226             :     unsigned int l = 1;
     227         140 :     for (unsigned int j = 0; j < _n_regions; j++)
     228             :     {
     229         100 :       Real elem_length = _width[j] / (2. * _n_part_elems[j]);
     230         320 :       for (unsigned int k = 0; k < 2. * _n_part_elems[j]; k++, l++)
     231             :       {
     232         220 :         p(1) += elem_length;
     233         220 :         nd = addNode(p);
     234         220 :         node_ids[i][l] = nd->id();
     235             :       }
     236             :     }
     237             :   }
     238             : 
     239          12 :   auto & boundary_info = mesh().getMesh().get_boundary_info();
     240             : 
     241             :   // create elements from nodes
     242             :   unsigned int i = 0;
     243          24 :   for (unsigned int i_section = 0; i_section < _n_sections; i_section++)
     244          26 :     for (unsigned int i_local = 0; i_local < _n_elems[i_section]; i_local++)
     245             :     {
     246             :       unsigned int j = 0;
     247          48 :       for (unsigned int j_section = 0; j_section < _n_regions; j_section++)
     248          72 :         for (unsigned int j_local = 0; j_local < _n_part_elems[j_section]; j_local++)
     249             :         {
     250          38 :           Elem * elem = addElementQuad9(node_ids[2 * i][2 * j],
     251             :                                         node_ids[2 * i][2 * (j + 1)],
     252             :                                         node_ids[2 * (i + 1)][2 * (j + 1)],
     253             :                                         node_ids[2 * (i + 1)][2 * j],
     254          38 :                                         node_ids[2 * i][(2 * j) + 1],
     255          38 :                                         node_ids[(2 * i) + 1][2 * (j + 1)],
     256          38 :                                         node_ids[2 * (i + 1)][(2 * j) + 1],
     257          38 :                                         node_ids[(2 * i) + 1][(2 * j)],
     258          38 :                                         node_ids[(2 * i) + 1][(2 * j) + 1]);
     259          38 :           elem->subdomain_id() = _subdomain_ids[j_section];
     260             : 
     261          38 :           if (i == 0)
     262             :           {
     263          34 :             boundary_info.add_side(elem, 0, _start_bc_id);
     264          34 :             _boundary_info[_boundary_name_start].push_back(
     265          34 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     266             :           }
     267          38 :           if (i == _n_elem - 1)
     268             :           {
     269          34 :             boundary_info.add_side(elem, 2, _end_bc_id);
     270          34 :             _boundary_info[_boundary_name_end].push_back(
     271          34 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     272             :           }
     273          38 :           if (_names.size() > 1)
     274             :           {
     275          30 :             if (i == 0)
     276             :             {
     277          30 :               boundary_info.add_side(elem, 0, _radial_start_bc_id[j_section]);
     278          30 :               _boundary_info[_boundary_names_radial_start[j_section]].push_back(
     279          30 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     280             :             }
     281          30 :             if (i == _n_elem - 1)
     282             :             {
     283          30 :               boundary_info.add_side(elem, 2, _radial_end_bc_id[j_section]);
     284          30 :               _boundary_info[_boundary_names_radial_end[j_section]].push_back(
     285          30 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     286             :             }
     287             :           }
     288             : 
     289          38 :           if (j == 0)
     290             :           {
     291          14 :             boundary_info.add_side(elem, 3, _inner_bc_id);
     292          14 :             _boundary_info[_boundary_name_inner].push_back(
     293          14 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     294             :           }
     295          38 :           if (j == _total_elem_number - 1)
     296             :           {
     297          14 :             boundary_info.add_side(elem, 1, _outer_bc_id);
     298          14 :             _boundary_info[_boundary_name_outer].push_back(
     299          14 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     300             :           }
     301             : 
     302          38 :           if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     303             :           {
     304           0 :             if (j == 0)
     305             :             {
     306           0 :               boundary_info.add_side(elem, 1, _axial_inner_bc_id[i_section]);
     307           0 :               _boundary_info[_boundary_names_axial_inner[i_section]].push_back(
     308           0 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     309             :             }
     310           0 :             if (j == _total_elem_number - 1)
     311             :             {
     312           0 :               boundary_info.add_side(elem, 3, _axial_outer_bc_id[i_section]);
     313           0 :               _boundary_info[_boundary_names_axial_outer[i_section]].push_back(
     314           0 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     315             :             }
     316             :           }
     317             : 
     318             :           // interior radial boundaries
     319          38 :           if (_n_regions > 1 && _names.size() == _n_regions && j_section != 0)
     320             :           {
     321             :             unsigned int j_section_begin = 0;
     322          50 :             for (unsigned int jj_section = 0; jj_section < j_section; ++jj_section)
     323          30 :               j_section_begin += _n_part_elems[jj_section];
     324             : 
     325          20 :             if (j == j_section_begin)
     326             :             {
     327          20 :               boundary_info.add_side(elem, 1, _inner_radial_bc_id[j_section - 1]);
     328          20 :               _boundary_info[_boundary_names_inner_radial[j_section - 1]].push_back(
     329          20 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     330             :             }
     331             :           }
     332             : 
     333             :           j++;
     334             :         }
     335             : 
     336          14 :       i++;
     337             :     }
     338          12 : }
     339             : 
     340             : void
     341        1692 : Component2D::buildMesh()
     342             : {
     343        1692 :   if (_n_part_elems.size() != _n_regions || _width.size() != _n_regions)
     344             :     return;
     345             : 
     346             :   // Assign subdomain to each transverse region
     347        4052 :   for (unsigned int i = 0; i < _n_regions; i++)
     348             :   {
     349             :     // The coordinate system for MOOSE is always XYZ, even for axisymmetric
     350             :     // components, since we do the RZ integration ourselves until we can set
     351             :     // arbitrary number of axis symmetries in MOOSE.
     352        4728 :     setSubdomainInfo(mesh().getNextSubdomainId(), genName(_name, _names[i]), Moose::COORD_XYZ);
     353             :   }
     354             : 
     355             :   // Create boundary IDs and associated boundary names
     356        1688 :   _inner_bc_id = mesh().getNextBoundaryId();
     357        1688 :   _outer_bc_id = mesh().getNextBoundaryId();
     358        3376 :   _boundary_name_inner = genName(name(), "inner");
     359        3376 :   _boundary_name_outer = genName(name(), "outer");
     360        1688 :   _boundary_name_to_area[_boundary_name_inner] = computeRadialBoundaryArea(_length, 0.0);
     361        1688 :   _boundary_name_to_area[_boundary_name_outer] =
     362        1688 :       computeRadialBoundaryArea(_length, getTotalWidth());
     363        1688 :   if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     364        1000 :     for (unsigned int i = 0; i < _n_sections; i++)
     365             :     {
     366         690 :       _axial_inner_bc_id.push_back(mesh().getNextBoundaryId());
     367         690 :       _axial_outer_bc_id.push_back(mesh().getNextBoundaryId());
     368             :       const BoundaryName boundary_name_axial_inner =
     369         690 :           genName(name(), _axial_region_names[i], "inner");
     370             :       const BoundaryName boundary_name_axial_outer =
     371         690 :           genName(name(), _axial_region_names[i], "outer");
     372         690 :       _boundary_names_axial_inner.push_back(boundary_name_axial_inner);
     373         690 :       _boundary_names_axial_outer.push_back(boundary_name_axial_outer);
     374         690 :       _boundary_name_to_area[boundary_name_axial_inner] =
     375         690 :           computeRadialBoundaryArea(_lengths[i], 0.0);
     376         690 :       _boundary_name_to_area[boundary_name_axial_outer] =
     377         690 :           computeRadialBoundaryArea(_lengths[i], getTotalWidth());
     378             :     }
     379             : 
     380             :   // exterior axial boundaries
     381        1688 :   _start_bc_id = mesh().getNextBoundaryId();
     382        1688 :   _end_bc_id = mesh().getNextBoundaryId();
     383        3376 :   _boundary_name_start = genName(name(), "start");
     384        3376 :   _boundary_name_end = genName(name(), "end");
     385        1688 :   _boundary_name_to_area[_boundary_name_start] = computeAxialBoundaryArea(0.0, getTotalWidth());
     386        1688 :   _boundary_name_to_area[_boundary_name_end] = computeAxialBoundaryArea(0.0, getTotalWidth());
     387        1688 :   if (_names.size() > 1)
     388             :   {
     389         397 :     Real y1 = 0.0;
     390        1470 :     for (unsigned int i = 0; i < _names.size(); i++)
     391             :     {
     392        1073 :       const Real y2 = y1 + _width[i];
     393             : 
     394        1073 :       _radial_start_bc_id.push_back(mesh().getNextBoundaryId());
     395        1073 :       _radial_end_bc_id.push_back(mesh().getNextBoundaryId());
     396        1073 :       const BoundaryName boundary_name_radial_start = genName(name(), _names[i], "start");
     397        1073 :       const BoundaryName boundary_name_radial_end = genName(name(), _names[i], "end");
     398        1073 :       _boundary_names_radial_start.push_back(boundary_name_radial_start);
     399        1073 :       _boundary_names_radial_end.push_back(boundary_name_radial_end);
     400        1073 :       _boundary_name_to_area[boundary_name_radial_start] = computeAxialBoundaryArea(y1, y2);
     401        1073 :       _boundary_name_to_area[boundary_name_radial_end] = computeAxialBoundaryArea(y1, y2);
     402        1073 :       if (i != _names.size() - 1)
     403             :       {
     404         676 :         _inner_radial_bc_id.push_back(mesh().getNextBoundaryId());
     405         676 :         const BoundaryName boundary_name_inner_radial = genName(name(), _names[i], _names[i + 1]);
     406         676 :         _boundary_names_inner_radial.push_back(boundary_name_inner_radial);
     407         676 :         _boundary_name_to_area[boundary_name_inner_radial] = computeRadialBoundaryArea(_length, y2);
     408             :       }
     409        1073 :       y1 = y2;
     410             :     }
     411             :   }
     412             : 
     413             :   // interior axial boundaries
     414        1688 :   if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     415         690 :     for (unsigned int i = 0; i < _n_sections - 1; i++)
     416             :     {
     417         380 :       Real y1 = 0.0;
     418        1044 :       for (unsigned int j = 0; j < _names.size(); j++)
     419             :       {
     420         664 :         const Real y2 = y1 + _width[j];
     421             : 
     422         664 :         _interior_axial_per_radial_section_bc_id.push_back(mesh().getNextBoundaryId());
     423             :         const BoundaryName boundary_name_interior_axial_per_radial_section =
     424         664 :             genName(name(), _names[j], _axial_region_names[i] + ":" + _axial_region_names[i + 1]);
     425         664 :         _boundary_names_interior_axial_per_radial_section.push_back(
     426             :             boundary_name_interior_axial_per_radial_section);
     427         664 :         _boundary_name_to_area[boundary_name_interior_axial_per_radial_section] =
     428         664 :             computeAxialBoundaryArea(y1, y2);
     429         664 :         y1 = y2;
     430             :       }
     431             :     }
     432             : 
     433             :   // Build the mesh
     434        1688 :   if (usingSecondOrderMesh())
     435          12 :     build2DMesh2ndOrder();
     436             :   else
     437        1676 :     build2DMesh();
     438             : 
     439             :   // Set boundary names
     440        1688 :   auto & binfo = mesh().getMesh().get_boundary_info();
     441        1688 :   binfo.sideset_name(_inner_bc_id) = _boundary_name_inner;
     442        1688 :   binfo.sideset_name(_outer_bc_id) = _boundary_name_outer;
     443        1688 :   if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     444        1000 :     for (unsigned int i = 0; i < _n_sections; i++)
     445             :     {
     446         690 :       binfo.sideset_name(_axial_inner_bc_id[i]) = _boundary_names_axial_inner[i];
     447         690 :       binfo.sideset_name(_axial_outer_bc_id[i]) = _boundary_names_axial_outer[i];
     448             :     }
     449        1688 :   binfo.sideset_name(_start_bc_id) = _boundary_name_start;
     450        1688 :   binfo.sideset_name(_end_bc_id) = _boundary_name_end;
     451        1688 :   if (_names.size() > 1)
     452        1470 :     for (unsigned int i = 0; i < _names.size(); i++)
     453             :     {
     454        1073 :       binfo.sideset_name(_radial_start_bc_id[i]) = _boundary_names_radial_start[i];
     455        1073 :       binfo.sideset_name(_radial_end_bc_id[i]) = _boundary_names_radial_end[i];
     456        1073 :       if (i != _names.size() - 1)
     457         676 :         binfo.sideset_name(_inner_radial_bc_id[i]) = _boundary_names_inner_radial[i];
     458             :     }
     459        2352 :   for (unsigned int k = 0; k < _interior_axial_per_radial_section_bc_id.size(); k++)
     460         664 :     binfo.sideset_name(_interior_axial_per_radial_section_bc_id[k]) =
     461         664 :         _boundary_names_interior_axial_per_radial_section[k];
     462             : }
     463             : 
     464             : bool
     465        2627 : Component2D::isBoundaryInVector(const BoundaryName & boundary_name,
     466             :                                 const std::vector<BoundaryName> & boundary_name_vector) const
     467             : {
     468        2627 :   return std::find(boundary_name_vector.begin(), boundary_name_vector.end(), boundary_name) !=
     469        2627 :          boundary_name_vector.end();
     470             : }
     471             : 
     472             : bool
     473        1998 : Component2D::hasBoundary(const BoundaryName & boundary_name) const
     474             : {
     475        1998 :   checkSetupStatus(MESH_PREPARED);
     476             : 
     477        2016 :   return hasExternalBoundary(boundary_name) ||
     478        2016 :          isBoundaryInVector(boundary_name, _boundary_names_interior_axial_per_radial_section) ||
     479          18 :          isBoundaryInVector(boundary_name, _boundary_names_inner_radial);
     480             : }
     481             : 
     482             : bool
     483        2562 : Component2D::hasExternalBoundary(const BoundaryName & boundary_name) const
     484             : {
     485        2562 :   checkSetupStatus(MESH_PREPARED);
     486             : 
     487        2050 :   return boundary_name == _boundary_name_inner || boundary_name == _boundary_name_outer ||
     488        1494 :          boundary_name == _boundary_name_start || boundary_name == _boundary_name_end ||
     489        1108 :          isBoundaryInVector(boundary_name, _boundary_names_axial_inner) ||
     490         646 :          isBoundaryInVector(boundary_name, _boundary_names_axial_outer) ||
     491        2748 :          isBoundaryInVector(boundary_name, _boundary_names_radial_start) ||
     492          30 :          isBoundaryInVector(boundary_name, _boundary_names_radial_end);
     493             : }
     494             : 
     495             : Component2D::ExternalBoundaryType
     496         891 : Component2D::getExternalBoundaryType(const BoundaryName & boundary_name) const
     497             : {
     498         891 :   checkSetupStatus(MESH_PREPARED);
     499             : 
     500        1714 :   if (boundary_name == _boundary_name_inner ||
     501         823 :       isBoundaryInVector(boundary_name, _boundary_names_axial_inner))
     502         128 :     return ExternalBoundaryType::INNER;
     503        1095 :   else if (boundary_name == _boundary_name_outer ||
     504         332 :            isBoundaryInVector(boundary_name, _boundary_names_axial_outer))
     505         549 :     return ExternalBoundaryType::OUTER;
     506         356 :   else if (boundary_name == _boundary_name_start ||
     507         142 :            isBoundaryInVector(boundary_name, _boundary_names_radial_start))
     508         112 :     return ExternalBoundaryType::START;
     509         102 :   else if (boundary_name == _boundary_name_end ||
     510           0 :            isBoundaryInVector(boundary_name, _boundary_names_radial_end))
     511         102 :     return ExternalBoundaryType::END;
     512           0 :   else if (hasBoundary(boundary_name))
     513           0 :     mooseError(name(), ": The boundary '", boundary_name, "' is an interior boundary.");
     514             :   else
     515           0 :     mooseError(name(), ": The boundary '", boundary_name, "' does not exist on this component.");
     516             : }
     517             : 
     518             : const std::vector<std::tuple<dof_id_type, unsigned short int>> &
     519         801 : Component2D::getBoundaryInfo(const BoundaryName & boundary_name) const
     520             : {
     521         801 :   checkSetupStatus(MESH_PREPARED);
     522             : 
     523         801 :   if (_boundary_info.find(boundary_name) != _boundary_info.end())
     524         801 :     return _boundary_info.at(boundary_name);
     525             :   else
     526           0 :     mooseError(name(), ": The boundary '", boundary_name, "' does not exist on this component.");
     527             : }
     528             : 
     529             : const std::vector<std::tuple<dof_id_type, unsigned short int>> &
     530           0 : Component2D::getBoundaryInfo(const ExternalBoundaryType & boundary_type) const
     531             : {
     532           0 :   checkSetupStatus(MESH_PREPARED);
     533             : 
     534           0 :   switch (boundary_type)
     535             :   {
     536           0 :     case ExternalBoundaryType::INNER:
     537           0 :       return getBoundaryInfo(_boundary_name_inner);
     538           0 :     case ExternalBoundaryType::OUTER:
     539           0 :       return getBoundaryInfo(_boundary_name_outer);
     540           0 :     case ExternalBoundaryType::START:
     541           0 :       return getBoundaryInfo(_boundary_name_start);
     542           0 :     case ExternalBoundaryType::END:
     543           0 :       return getBoundaryInfo(_boundary_name_end);
     544           0 :     default:
     545           0 :       mooseError(name(), ": Invalid external boundary type.");
     546             :   }
     547             : }
     548             : 
     549             : const BoundaryName &
     550        1351 : Component2D::getExternalBoundaryName(const ExternalBoundaryType & boundary_type) const
     551             : {
     552        1351 :   checkSetupStatus(MESH_PREPARED);
     553             : 
     554        1351 :   switch (boundary_type)
     555             :   {
     556         809 :     case ExternalBoundaryType::OUTER:
     557         809 :       return _boundary_name_outer;
     558         536 :     case ExternalBoundaryType::INNER:
     559         536 :       return _boundary_name_inner;
     560           6 :     case ExternalBoundaryType::START:
     561           6 :       return _boundary_name_start;
     562           0 :     case ExternalBoundaryType::END:
     563           0 :       return _boundary_name_end;
     564           0 :     default:
     565           0 :       mooseError(name(), ": Invalid external boundary type.");
     566             :   }
     567             : }
     568             : 
     569             : const Real &
     570         292 : Component2D::getBoundaryArea(const BoundaryName & boundary_name) const
     571             : {
     572         292 :   checkSetupStatus(MESH_PREPARED);
     573             : 
     574         292 :   if (_boundary_name_to_area.find(boundary_name) != _boundary_name_to_area.end())
     575         292 :     return _boundary_name_to_area.at(boundary_name);
     576             :   else
     577           0 :     mooseError(name(), ": The boundary '", boundary_name, "' does not exist on this component.");
     578             : }

Generated by: LCOV version 1.14