LCOV - code coverage report
Current view: top level - src/components - Component2D.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 278 309 90.0 %
Date: 2026-05-29 20:41:18 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         322 : Component2D::getExternalBoundaryTypeMooseEnum(const std::string & name)
      22             : {
      23         322 :   return THM::getMooseEnum<ExternalBoundaryType>(name, _external_boundary_type_to_enum);
      24             : }
      25             : 
      26             : template <>
      27             : Component2D::ExternalBoundaryType
      28         161 : THM::stringToEnum(const std::string & s)
      29             : {
      30         161 :   return stringToEnum<Component2D::ExternalBoundaryType>(
      31         161 :       s, Component2D::_external_boundary_type_to_enum);
      32             : }
      33             : 
      34             : InputParameters
      35        1874 : Component2D::validParams()
      36             : {
      37        1874 :   InputParameters params = GeneratedMeshComponent::validParams();
      38        1874 :   return params;
      39             : }
      40             : 
      41         936 : Component2D::Component2D(const InputParameters & params)
      42         936 :   : GeneratedMeshComponent(params), _n_regions(0), _total_elem_number(0), _axial_offset(0.0)
      43             : {
      44         936 : }
      45             : 
      46             : void
      47         903 : Component2D::check() const
      48             : {
      49         903 :   GeneratedMeshComponent::check();
      50             : 
      51        1806 :   if (getParam<std::vector<std::string>>("axial_region_names").size())
      52         374 :     checkEqualSize<std::string, Real>("axial_region_names", "length");
      53         716 :   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         903 : }
      57             : 
      58             : bool
      59         108 : Component2D::hasBlock(const std::string & name) const
      60             : {
      61         108 :   return std::find(_names.begin(), _names.end(), name) != _names.end();
      62             : }
      63             : 
      64             : void
      65         922 : Component2D::build2DMesh()
      66             : {
      67         922 :   unsigned int n_axial_positions = _node_locations.size();
      68             :   std::vector<std::vector<unsigned int>> node_ids(
      69         922 :       n_axial_positions, std::vector<unsigned int>(_total_elem_number + 1));
      70             : 
      71             :   // loop over axial positions
      72       17721 :   for (unsigned int i = 0; i < n_axial_positions; i++)
      73             :   {
      74       16799 :     Point p(_node_locations[i], _axial_offset, 0);
      75             : 
      76       16799 :     Node * nd = addNode(p);
      77       16799 :     node_ids[i][0] = nd->id();
      78             : 
      79             :     // loop over regions
      80             :     unsigned int l = 1;
      81       43379 :     for (unsigned int j = 0; j < _n_regions; j++)
      82             :     {
      83       26580 :       Real elem_length = _width[j] / _n_part_elems[j];
      84      155835 :       for (unsigned int k = 0; k < _n_part_elems[j]; k++, l++)
      85             :       {
      86      129255 :         p(1) += elem_length;
      87      129255 :         nd = addNode(p);
      88      129255 :         node_ids[i][l] = nd->id();
      89             :       }
      90             :     }
      91             :   }
      92             : 
      93         922 :   auto & boundary_info = mesh().getMesh().get_boundary_info();
      94             : 
      95             :   // create elements from nodes
      96             :   unsigned int i = 0;
      97        2085 :   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        2619 :     for (unsigned int ii_section = 0; ii_section <= i_section; ++ii_section)
     102        1456 :       i_section_end += _n_elems[ii_section];
     103        1163 :     i_section_end -= 1;
     104             : 
     105       17040 :     for (unsigned int i_local = 0; i_local < _n_elems[i_section]; i_local++)
     106             :     {
     107             :       unsigned int j = 0;
     108       41161 :       for (unsigned int j_section = 0; j_section < _n_regions; j_section++)
     109      148711 :         for (unsigned int j_local = 0; j_local < _n_part_elems[j_section]; j_local++)
     110             :         {
     111      123427 :           Elem * elem = addElementQuad4(
     112      123427 :               node_ids[i][j + 1], node_ids[i][j], node_ids[i + 1][j], node_ids[i + 1][j + 1]);
     113      123427 :           elem->subdomain_id() = _subdomain_ids[j_section];
     114             : 
     115             :           // exterior axial boundaries (all radial sections)
     116      123427 :           if (i == 0)
     117             :           {
     118        5828 :             boundary_info.add_side(elem, 0, _start_bc_id);
     119        5828 :             _boundary_info[_boundary_name_start].push_back(
     120        5828 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     121             :           }
     122      123427 :           if (i == _n_elem - 1)
     123             :           {
     124        5828 :             boundary_info.add_side(elem, 2, _end_bc_id);
     125        5828 :             _boundary_info[_boundary_name_end].push_back(
     126        5828 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     127             :           }
     128             : 
     129             :           // exterior axial boundaries (per radial section)
     130      123427 :           if (_names.size() > 1)
     131             :           {
     132       71397 :             if (i == 0)
     133             :             {
     134        2664 :               boundary_info.add_side(elem, 0, _radial_start_bc_id[j_section]);
     135        2664 :               _boundary_info[_boundary_names_radial_start[j_section]].push_back(
     136        2664 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     137             :             }
     138       71397 :             if (i == _n_elem - 1)
     139             :             {
     140        2664 :               boundary_info.add_side(elem, 2, _radial_end_bc_id[j_section]);
     141        2664 :               _boundary_info[_boundary_names_radial_end[j_section]].push_back(
     142        2664 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     143             :             }
     144             :           }
     145             : 
     146             :           // interior axial boundaries (per radial section)
     147       22961 :           if (_n_sections > 1 && _axial_region_names.size() == _n_sections &&
     148      146280 :               i_section != _n_sections - 1 && i == i_section_end)
     149             :           {
     150        1738 :             const unsigned int k = i_section * _n_regions + j_section;
     151        1738 :             boundary_info.add_side(elem, 2, _interior_axial_per_radial_section_bc_id[k]);
     152        1738 :             _boundary_info[_boundary_names_interior_axial_per_radial_section[k]].push_back(
     153        1738 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     154             :           }
     155             : 
     156             :           // exterior radial boundaries (all axial sections)
     157      123427 :           if (j == 0)
     158             :           {
     159       15877 :             boundary_info.add_side(elem, 1, _inner_bc_id);
     160       15877 :             _boundary_info[_boundary_name_inner].push_back(
     161       15877 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     162             :           }
     163      123427 :           if (j == _total_elem_number - 1)
     164             :           {
     165       15877 :             boundary_info.add_side(elem, 3, _outer_bc_id);
     166       15877 :             _boundary_info[_boundary_name_outer].push_back(
     167       15877 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     168             :           }
     169             : 
     170             :           // exterior radial boundaries (per axial section)
     171      123427 :           if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     172             :           {
     173       22853 :             if (j == 0)
     174             :             {
     175        3715 :               boundary_info.add_side(elem, 1, _axial_inner_bc_id[i_section]);
     176        3715 :               _boundary_info[_boundary_names_axial_inner[i_section]].push_back(
     177        3715 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     178             :             }
     179       22853 :             if (j == _total_elem_number - 1)
     180             :             {
     181        3715 :               boundary_info.add_side(elem, 3, _axial_outer_bc_id[i_section]);
     182        3715 :               _boundary_info[_boundary_names_axial_outer[i_section]].push_back(
     183        3715 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     184             :             }
     185             :           }
     186             : 
     187             :           // interior radial boundaries (all axial sections)
     188      123427 :           if (_n_regions > 1 && _names.size() == _n_regions && j_section != 0)
     189             :           {
     190             :             unsigned int j_section_begin = 0;
     191       98218 :             for (unsigned int jj_section = 0; jj_section < j_section; ++jj_section)
     192       55483 :               j_section_begin += _n_part_elems[jj_section];
     193             : 
     194       42735 :             if (j == j_section_begin)
     195             :             {
     196        9407 :               boundary_info.add_side(elem, 1, _inner_radial_bc_id[j_section - 1]);
     197        9407 :               _boundary_info[_boundary_names_inner_radial[j_section - 1]].push_back(
     198        9407 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     199             :             }
     200             :           }
     201             : 
     202             :           j++;
     203             :         }
     204             : 
     205       15877 :       i++;
     206             :     }
     207             :   }
     208         922 : }
     209             : 
     210             : void
     211          10 : Component2D::build2DMesh2ndOrder()
     212             : {
     213          10 :   unsigned int n_axial_positions = _node_locations.size();
     214             :   std::vector<std::vector<unsigned int>> node_ids(
     215          10 :       n_axial_positions, std::vector<unsigned int>(2 * _total_elem_number + 1));
     216             : 
     217             :   // loop over axial positions
     218          44 :   for (unsigned int i = 0; i < n_axial_positions; i++)
     219             :   {
     220          34 :     Point p(_node_locations[i], _axial_offset, 0);
     221             : 
     222          34 :     const Node * nd = addNode(p);
     223          34 :     node_ids[i][0] = nd->id();
     224             : 
     225             :     // loop over regions
     226             :     unsigned int l = 1;
     227         116 :     for (unsigned int j = 0; j < _n_regions; j++)
     228             :     {
     229          82 :       Real elem_length = _width[j] / (2. * _n_part_elems[j]);
     230         266 :       for (unsigned int k = 0; k < 2. * _n_part_elems[j]; k++, l++)
     231             :       {
     232         184 :         p(1) += elem_length;
     233         184 :         nd = addNode(p);
     234         184 :         node_ids[i][l] = nd->id();
     235             :       }
     236             :     }
     237             :   }
     238             : 
     239          10 :   auto & boundary_info = mesh().getMesh().get_boundary_info();
     240             : 
     241             :   // create elements from nodes
     242             :   unsigned int i = 0;
     243          20 :   for (unsigned int i_section = 0; i_section < _n_sections; i_section++)
     244          22 :     for (unsigned int i_local = 0; i_local < _n_elems[i_section]; i_local++)
     245             :     {
     246             :       unsigned int j = 0;
     247          40 :       for (unsigned int j_section = 0; j_section < _n_regions; j_section++)
     248          60 :         for (unsigned int j_local = 0; j_local < _n_part_elems[j_section]; j_local++)
     249             :         {
     250          32 :           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          32 :                                         node_ids[2 * i][(2 * j) + 1],
     255          32 :                                         node_ids[(2 * i) + 1][2 * (j + 1)],
     256          32 :                                         node_ids[2 * (i + 1)][(2 * j) + 1],
     257          32 :                                         node_ids[(2 * i) + 1][(2 * j)],
     258          32 :                                         node_ids[(2 * i) + 1][(2 * j) + 1]);
     259          32 :           elem->subdomain_id() = _subdomain_ids[j_section];
     260             : 
     261          32 :           if (i == 0)
     262             :           {
     263          28 :             boundary_info.add_side(elem, 0, _start_bc_id);
     264          28 :             _boundary_info[_boundary_name_start].push_back(
     265          28 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     266             :           }
     267          32 :           if (i == _n_elem - 1)
     268             :           {
     269          28 :             boundary_info.add_side(elem, 2, _end_bc_id);
     270          28 :             _boundary_info[_boundary_name_end].push_back(
     271          28 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     272             :           }
     273          32 :           if (_names.size() > 1)
     274             :           {
     275          24 :             if (i == 0)
     276             :             {
     277          24 :               boundary_info.add_side(elem, 0, _radial_start_bc_id[j_section]);
     278          24 :               _boundary_info[_boundary_names_radial_start[j_section]].push_back(
     279          24 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
     280             :             }
     281          24 :             if (i == _n_elem - 1)
     282             :             {
     283          24 :               boundary_info.add_side(elem, 2, _radial_end_bc_id[j_section]);
     284          24 :               _boundary_info[_boundary_names_radial_end[j_section]].push_back(
     285          24 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
     286             :             }
     287             :           }
     288             : 
     289          32 :           if (j == 0)
     290             :           {
     291          12 :             boundary_info.add_side(elem, 3, _inner_bc_id);
     292          12 :             _boundary_info[_boundary_name_inner].push_back(
     293          12 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
     294             :           }
     295          32 :           if (j == _total_elem_number - 1)
     296             :           {
     297          12 :             boundary_info.add_side(elem, 1, _outer_bc_id);
     298          12 :             _boundary_info[_boundary_name_outer].push_back(
     299          12 :                 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     300             :           }
     301             : 
     302          32 :           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          32 :           if (_n_regions > 1 && _names.size() == _n_regions && j_section != 0)
     320             :           {
     321             :             unsigned int j_section_begin = 0;
     322          40 :             for (unsigned int jj_section = 0; jj_section < j_section; ++jj_section)
     323          24 :               j_section_begin += _n_part_elems[jj_section];
     324             : 
     325          16 :             if (j == j_section_begin)
     326             :             {
     327          16 :               boundary_info.add_side(elem, 1, _inner_radial_bc_id[j_section - 1]);
     328          16 :               _boundary_info[_boundary_names_inner_radial[j_section - 1]].push_back(
     329          16 :                   std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
     330             :             }
     331             :           }
     332             : 
     333             :           j++;
     334             :         }
     335             : 
     336          12 :       i++;
     337             :     }
     338          10 : }
     339             : 
     340             : void
     341         936 : Component2D::buildMesh()
     342             : {
     343         936 :   if (_n_part_elems.size() != _n_regions || _width.size() != _n_regions)
     344             :     return;
     345             : 
     346             :   // Assign subdomain to each transverse region
     347        2254 :   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        2644 :     setSubdomainInfo(mesh().getNextSubdomainId(), genName(_name, _names[i]), Moose::COORD_XYZ);
     353             :   }
     354             : 
     355             :   // Create boundary IDs and associated boundary names
     356         932 :   _inner_bc_id = mesh().getNextBoundaryId();
     357         932 :   _outer_bc_id = mesh().getNextBoundaryId();
     358        1864 :   _boundary_name_inner = genName(name(), "inner");
     359        1864 :   _boundary_name_outer = genName(name(), "outer");
     360         932 :   _boundary_name_to_area[_boundary_name_inner] = computeRadialBoundaryArea(_length, 0.0);
     361         932 :   _boundary_name_to_area[_boundary_name_outer] =
     362         932 :       computeRadialBoundaryArea(_length, getTotalWidth());
     363         932 :   if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     364         603 :     for (unsigned int i = 0; i < _n_sections; i++)
     365             :     {
     366         418 :       _axial_inner_bc_id.push_back(mesh().getNextBoundaryId());
     367         418 :       _axial_outer_bc_id.push_back(mesh().getNextBoundaryId());
     368             :       const BoundaryName boundary_name_axial_inner =
     369         418 :           genName(name(), _axial_region_names[i], "inner");
     370             :       const BoundaryName boundary_name_axial_outer =
     371         418 :           genName(name(), _axial_region_names[i], "outer");
     372         418 :       _boundary_names_axial_inner.push_back(boundary_name_axial_inner);
     373         418 :       _boundary_names_axial_outer.push_back(boundary_name_axial_outer);
     374         418 :       _boundary_name_to_area[boundary_name_axial_inner] =
     375         418 :           computeRadialBoundaryArea(_lengths[i], 0.0);
     376         418 :       _boundary_name_to_area[boundary_name_axial_outer] =
     377         418 :           computeRadialBoundaryArea(_lengths[i], getTotalWidth());
     378             :     }
     379             : 
     380             :   // exterior axial boundaries
     381         932 :   _start_bc_id = mesh().getNextBoundaryId();
     382         932 :   _end_bc_id = mesh().getNextBoundaryId();
     383        1864 :   _boundary_name_start = genName(name(), "start");
     384        1864 :   _boundary_name_end = genName(name(), "end");
     385         932 :   _boundary_name_to_area[_boundary_name_start] = computeAxialBoundaryArea(0.0, getTotalWidth());
     386         932 :   _boundary_name_to_area[_boundary_name_end] = computeAxialBoundaryArea(0.0, getTotalWidth());
     387         932 :   if (_names.size() > 1)
     388             :   {
     389         230 :     Real y1 = 0.0;
     390         850 :     for (unsigned int i = 0; i < _names.size(); i++)
     391             :     {
     392         620 :       const Real y2 = y1 + _width[i];
     393             : 
     394         620 :       _radial_start_bc_id.push_back(mesh().getNextBoundaryId());
     395         620 :       _radial_end_bc_id.push_back(mesh().getNextBoundaryId());
     396         620 :       const BoundaryName boundary_name_radial_start = genName(name(), _names[i], "start");
     397         620 :       const BoundaryName boundary_name_radial_end = genName(name(), _names[i], "end");
     398         620 :       _boundary_names_radial_start.push_back(boundary_name_radial_start);
     399         620 :       _boundary_names_radial_end.push_back(boundary_name_radial_end);
     400         620 :       _boundary_name_to_area[boundary_name_radial_start] = computeAxialBoundaryArea(y1, y2);
     401         620 :       _boundary_name_to_area[boundary_name_radial_end] = computeAxialBoundaryArea(y1, y2);
     402         620 :       if (i != _names.size() - 1)
     403             :       {
     404         390 :         _inner_radial_bc_id.push_back(mesh().getNextBoundaryId());
     405         390 :         const BoundaryName boundary_name_inner_radial = genName(name(), _names[i], _names[i + 1]);
     406         390 :         _boundary_names_inner_radial.push_back(boundary_name_inner_radial);
     407         390 :         _boundary_name_to_area[boundary_name_inner_radial] = computeRadialBoundaryArea(_length, y2);
     408             :       }
     409         620 :       y1 = y2;
     410             :     }
     411             :   }
     412             : 
     413             :   // interior axial boundaries
     414         932 :   if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     415         418 :     for (unsigned int i = 0; i < _n_sections - 1; i++)
     416             :     {
     417         233 :       Real y1 = 0.0;
     418         658 :       for (unsigned int j = 0; j < _names.size(); j++)
     419             :       {
     420         425 :         const Real y2 = y1 + _width[j];
     421             : 
     422         425 :         _interior_axial_per_radial_section_bc_id.push_back(mesh().getNextBoundaryId());
     423             :         const BoundaryName boundary_name_interior_axial_per_radial_section =
     424         425 :             genName(name(), _names[j], _axial_region_names[i] + ":" + _axial_region_names[i + 1]);
     425         425 :         _boundary_names_interior_axial_per_radial_section.push_back(
     426             :             boundary_name_interior_axial_per_radial_section);
     427         425 :         _boundary_name_to_area[boundary_name_interior_axial_per_radial_section] =
     428         425 :             computeAxialBoundaryArea(y1, y2);
     429         425 :         y1 = y2;
     430             :       }
     431             :     }
     432             : 
     433             :   // Build the mesh
     434         932 :   if (usingSecondOrderMesh())
     435          10 :     build2DMesh2ndOrder();
     436             :   else
     437         922 :     build2DMesh();
     438             : 
     439             :   // Set boundary names
     440         932 :   auto & binfo = mesh().getMesh().get_boundary_info();
     441         932 :   binfo.sideset_name(_inner_bc_id) = _boundary_name_inner;
     442         932 :   binfo.sideset_name(_outer_bc_id) = _boundary_name_outer;
     443         932 :   if (_n_sections > 1 && _axial_region_names.size() == _n_sections)
     444         603 :     for (unsigned int i = 0; i < _n_sections; i++)
     445             :     {
     446         418 :       binfo.sideset_name(_axial_inner_bc_id[i]) = _boundary_names_axial_inner[i];
     447         418 :       binfo.sideset_name(_axial_outer_bc_id[i]) = _boundary_names_axial_outer[i];
     448             :     }
     449         932 :   binfo.sideset_name(_start_bc_id) = _boundary_name_start;
     450         932 :   binfo.sideset_name(_end_bc_id) = _boundary_name_end;
     451         932 :   if (_names.size() > 1)
     452         850 :     for (unsigned int i = 0; i < _names.size(); i++)
     453             :     {
     454         620 :       binfo.sideset_name(_radial_start_bc_id[i]) = _boundary_names_radial_start[i];
     455         620 :       binfo.sideset_name(_radial_end_bc_id[i]) = _boundary_names_radial_end[i];
     456         620 :       if (i != _names.size() - 1)
     457         390 :         binfo.sideset_name(_inner_radial_bc_id[i]) = _boundary_names_inner_radial[i];
     458             :     }
     459        1357 :   for (unsigned int k = 0; k < _interior_axial_per_radial_section_bc_id.size(); k++)
     460         425 :     binfo.sideset_name(_interior_axial_per_radial_section_bc_id[k]) =
     461         425 :         _boundary_names_interior_axial_per_radial_section[k];
     462             : }
     463             : 
     464             : bool
     465        1446 : Component2D::isBoundaryInVector(const BoundaryName & boundary_name,
     466             :                                 const std::vector<BoundaryName> & boundary_name_vector) const
     467             : {
     468        1446 :   return std::find(boundary_name_vector.begin(), boundary_name_vector.end(), boundary_name) !=
     469        1446 :          boundary_name_vector.end();
     470             : }
     471             : 
     472             : bool
     473        1062 : Component2D::hasBoundary(const BoundaryName & boundary_name) const
     474             : {
     475        1062 :   checkSetupStatus(MESH_PREPARED);
     476             : 
     477        1080 :   return hasExternalBoundary(boundary_name) ||
     478        1080 :          isBoundaryInVector(boundary_name, _boundary_names_interior_axial_per_radial_section) ||
     479          18 :          isBoundaryInVector(boundary_name, _boundary_names_inner_radial);
     480             : }
     481             : 
     482             : bool
     483        1354 : Component2D::hasExternalBoundary(const BoundaryName & boundary_name) const
     484             : {
     485        1354 :   checkSetupStatus(MESH_PREPARED);
     486             : 
     487        1066 :   return boundary_name == _boundary_name_inner || boundary_name == _boundary_name_outer ||
     488         834 :          boundary_name == _boundary_name_start || boundary_name == _boundary_name_end ||
     489         644 :          isBoundaryInVector(boundary_name, _boundary_names_axial_inner) ||
     490         384 :          isBoundaryInVector(boundary_name, _boundary_names_axial_outer) ||
     491        1480 :          isBoundaryInVector(boundary_name, _boundary_names_radial_start) ||
     492          30 :          isBoundaryInVector(boundary_name, _boundary_names_radial_end);
     493             : }
     494             : 
     495             : Component2D::ExternalBoundaryType
     496         458 : Component2D::getExternalBoundaryType(const BoundaryName & boundary_name) const
     497             : {
     498         458 :   checkSetupStatus(MESH_PREPARED);
     499             : 
     500         878 :   if (boundary_name == _boundary_name_inner ||
     501         420 :       isBoundaryInVector(boundary_name, _boundary_names_axial_inner))
     502          68 :     return ExternalBoundaryType::INNER;
     503         546 :   else if (boundary_name == _boundary_name_outer ||
     504         156 :            isBoundaryInVector(boundary_name, _boundary_names_axial_outer))
     505         292 :     return ExternalBoundaryType::OUTER;
     506         162 :   else if (boundary_name == _boundary_name_start ||
     507          64 :            isBoundaryInVector(boundary_name, _boundary_names_radial_start))
     508          54 :     return ExternalBoundaryType::START;
     509          44 :   else if (boundary_name == _boundary_name_end ||
     510           0 :            isBoundaryInVector(boundary_name, _boundary_names_radial_end))
     511          44 :     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         419 : Component2D::getBoundaryInfo(const BoundaryName & boundary_name) const
     520             : {
     521         419 :   checkSetupStatus(MESH_PREPARED);
     522             : 
     523         419 :   if (_boundary_info.find(boundary_name) != _boundary_info.end())
     524         419 :     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         704 : Component2D::getExternalBoundaryName(const ExternalBoundaryType & boundary_type) const
     551             : {
     552         704 :   checkSetupStatus(MESH_PREPARED);
     553             : 
     554         704 :   switch (boundary_type)
     555             :   {
     556         378 :     case ExternalBoundaryType::OUTER:
     557         378 :       return _boundary_name_outer;
     558         320 :     case ExternalBoundaryType::INNER:
     559         320 :       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         152 : Component2D::getBoundaryArea(const BoundaryName & boundary_name) const
     571             : {
     572         152 :   checkSetupStatus(MESH_PREPARED);
     573             : 
     574         152 :   if (_boundary_name_to_area.find(boundary_name) != _boundary_name_to_area.end())
     575         152 :     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