LCOV - code coverage report
Current view: top level - include/meshgenerators - TriPinHexAssemblyGenerator.h (source / functions) Hit Total Coverage
Test: idaholab/moose reactor: #31405 (292dce) with base fef103 Lines: 11 11 100.0 %
Date: 2025-09-04 07:56:24 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             : #pragma once
      11             : 
      12             : #include "PolygonMeshGeneratorBase.h"
      13             : 
      14             : /**
      15             :  * This TriPinHexAssemblyGenerator object is a base class to be inherited for polygon
      16             :  * mesh generators.
      17             :  */
      18             : class TriPinHexAssemblyGenerator : public PolygonMeshGeneratorBase
      19             : {
      20             : public:
      21             :   static InputParameters validParams();
      22             : 
      23             :   TriPinHexAssemblyGenerator(const InputParameters & parameters);
      24             : 
      25             :   std::unique_ptr<MeshBase> generate() override;
      26             : 
      27             : protected:
      28             :   /// Radii of concentric circles in the three diamond sections
      29             :   const std::vector<std::vector<Real>> _ring_radii;
      30             :   /// Whether the generated mesh contains ring regions
      31             :   const std::vector<bool> _has_rings;
      32             :   /// Numbers of radial layers in each ring region in the three diamond sections
      33             :   const std::vector<std::vector<unsigned int>> _ring_intervals;
      34             :   /// Block ids of the ring regions in the three diamond sections
      35             :   const std::vector<std::vector<subdomain_id_type>> _ring_block_ids;
      36             :   /// Block names of the ring regions in the three diamond sections
      37             :   const std::vector<std::vector<SubdomainName>> _ring_block_names;
      38             :   /// Type of hexagon_size parameter
      39             :   const PolygonSizeStyle _hexagon_size_style;
      40             :   /// Length of the side of the hexagon
      41             :   const Real _side_length;
      42             :   /// Offset distance of the circle centers from the center of each diamond section
      43             :   const Real _ring_offset;
      44             :   /// Whether the radii need to be corrected for polygonization during meshing
      45             :   const bool _preserve_volumes;
      46             :   /// Assembly orientation option
      47             :   const enum class AssmOrient { pin_up, pin_down } _assembly_orientation;
      48             :   /// Mesh sector number of each polygon side
      49             :   const unsigned int _num_sectors_per_side;
      50             :   /// Numbers of radial intervals of the background regions
      51             :   const unsigned int _background_intervals;
      52             :   /// Block ids of the background region
      53             :   const std::vector<subdomain_id_type> _background_block_ids;
      54             :   /// Block names of the background region
      55             :   const std::vector<SubdomainName> _background_block_names;
      56             :   /// Boundary ID of mesh's external boundary
      57             :   const boundary_id_type _external_boundary_id;
      58             :   /// Boundary name of mesh's external boundary
      59             :   const std::string _external_boundary_name;
      60             :   /// Name of extra integer ID to be assigned to each of the three pin domains
      61             :   const std::string _pin_id_name;
      62             :   /// Values of extra integer ID to be assigned to each of the three pin domains
      63             :   const std::vector<dof_id_type> _pin_id_values;
      64             :   /// MeshMetaData: maximum node id of the background region
      65             :   dof_id_type & _node_id_background_meta;
      66             : 
      67             :   /**
      68             :    * Generates a single-pin diamond section mesh, which is one-third of the triple-pin hexagonal
      69             :    * assembly mesh.
      70             :    * @param side_length side length of the hexagon assembly to be generated.
      71             :    * @param ring_offset offset of the center of the ring region from the center of the diamond
      72             :    * @param ring_radii radii of major concentric circles in the diamond section
      73             :    * @param ring_intervals number of radial mesh intervals of the major concentric circles
      74             :    * @param has_rings whether the section contains any ring regions
      75             :    * @param preserve_volumes whether the radii of the rings are modified to preserve volumes
      76             :    * @param num_sectors_per_side number of azimuthal sectors per side
      77             :    * @param background_intervals number of radial meshing intervals in background region (area
      78             :    * outside the rings)
      79             :    * @param block_ids_new customized block ids for the regions
      80             :    * @param node_id_background_meta reference to the first node's id of the background region
      81             :    * @return a mesh of a single-pin diamond section mesh
      82             :    */
      83             :   std::unique_ptr<ReplicatedMesh>
      84             :   buildSinglePinSection(const Real side_length,
      85             :                         const Real ring_offset,
      86             :                         const std::vector<Real> ring_radii,
      87             :                         const std::vector<unsigned int> ring_intervals,
      88             :                         const bool has_rings,
      89             :                         const bool preserve_volumes,
      90             :                         const unsigned int num_sectors_per_side,
      91             :                         const unsigned int background_intervals,
      92             :                         const std::vector<subdomain_id_type> block_ids_new,
      93             :                         dof_id_type & node_id_background_meta);
      94             : 
      95             : private:
      96             :   /**
      97             :    * Helper for getting a parameter that describes rings
      98             :    */
      99             :   template <typename T>
     100             :   std::vector<std::vector<T>> getRingParamValues(const std::string & param_name) const;
     101             : };
     102             : 
     103             : template <typename T>
     104             : std::vector<std::vector<T>>
     105         243 : TriPinHexAssemblyGenerator::getRingParamValues(const std::string & param_name) const
     106             : {
     107         972 :   std::vector<std::vector<T>> value = {{}, {}, {}};
     108             : 
     109         243 :   if (isParamValid(param_name))
     110             :   {
     111             :     const auto & param_value = getParam<std::vector<std::vector<T>>>(param_name);
     112         243 :     if (param_value.size() == 1)
     113         195 :       value = {param_value[0], param_value[0], param_value[0]};
     114         204 :     else if (param_value.size() == 3)
     115         186 :       value = param_value;
     116          18 :     else if (param_value.size() != 0) // override case where you want to unset it
     117           6 :       paramError(param_name, "This parameter must have a size of one or three.");
     118             :   }
     119             : 
     120         237 :   return value;
     121          39 : }

Generated by: LCOV version 1.14