LCOV - code coverage report
Current view: top level - include/mesh - TriInterWrapperMesh.h (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 19 30 63.3 %
Date: 2025-09-04 07:58:06 Functions: 13 20 65.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 "InterWrapperMesh.h"
      13             : 
      14             : /**
      15             :  * Mesh class for triangular, edge and corner inter_wrappers for hexagonal lattice fuel assemblies
      16             :  */
      17             : class TriInterWrapperMesh : public InterWrapperMesh
      18             : {
      19             : public:
      20             :   TriInterWrapperMesh(const InputParameters & parameters);
      21             :   TriInterWrapperMesh(const TriInterWrapperMesh & other_mesh);
      22             :   virtual std::unique_ptr<MooseMesh> safeClone() const override;
      23             :   virtual void buildMesh() override;
      24             : 
      25         110 :   virtual const unsigned int & getNumOfAssemblies() const override { return _n_assemblies; }
      26             : 
      27           0 :   virtual Node * getPinNode(unsigned int, unsigned) const override { return nullptr; }
      28             : 
      29          39 :   virtual bool pinMeshExist() const override { return false; }
      30           0 :   virtual bool ductMeshExist() const override { return false; }
      31             : 
      32       50400 :   virtual const Real & getDuctToPinGap() const { return _duct_to_pin_gap; }
      33             : 
      34             :   /**
      35             :    * Return Pin index given inter_wrapper index and local neighbor index
      36             :    */
      37       61200 :   virtual const unsigned int & getPinIndex(const unsigned int channel_idx,
      38             :                                            const unsigned int neighbor_idx)
      39             :   {
      40       61200 :     return _chan_to_pin_map[channel_idx][neighbor_idx];
      41             :   }
      42             : 
      43    15599880 :   virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
      44             :   {
      45    15599880 :     return _nodes[i_chan][iz];
      46             :   }
      47          39 :   virtual const unsigned int & getNumOfChannels() const override { return _n_channels; }
      48          39 :   virtual const unsigned int & getNumOfGapsPerLayer() const override { return _n_gaps; }
      49             :   virtual const std::pair<unsigned int, unsigned int> &
      50     2880000 :   getGapChannels(unsigned int i_gap) const override
      51             :   {
      52     2880000 :     return _gap_to_chan_map[i_gap];
      53             :   }
      54     1008000 :   virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
      55             :   {
      56     1008000 :     return _chan_to_gap_map[i_chan];
      57             :   }
      58           0 :   virtual const std::vector<double> & getGapMap() const override { return _gij_map; }
      59     2880000 :   virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
      60             :   {
      61     2880000 :     return _sign_id_crossflow_map[i_chan][i_local];
      62             :   }
      63             : 
      64             :   virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
      65             :   virtual unsigned int channelIndex(const Point & point) const override;
      66             : 
      67       75600 :   virtual EChannelType getSubchannelType(unsigned int index) const override
      68             :   {
      69       75600 :     return _subch_type[index];
      70             :   }
      71             : 
      72     1440000 :   virtual Real getGapWidth(unsigned int gap_index) const override { return _gij_map[gap_index]; }
      73             : 
      74           0 :   virtual const std::pair<unsigned int, unsigned int> & getSweepFlowGaps(unsigned int i_chan) const
      75             :   {
      76           0 :     return _gap_pairs_sf[i_chan];
      77             :   }
      78             : 
      79           0 :   virtual const std::pair<unsigned int, unsigned int> & getSweepFlowChans(unsigned int i_chan) const
      80             :   {
      81           0 :     return _chan_pairs_sf[i_chan];
      82             :   }
      83             : 
      84           0 :   virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
      85             :   {
      86           0 :     return _pin_to_chan_map[i_pin];
      87             :   }
      88             : 
      89           0 :   virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
      90             :   {
      91           0 :     return _chan_to_pin_map[i_chan];
      92             :   }
      93             : 
      94       50400 :   virtual const bool & getIsTightSide() const { return _tight_side_bypass; }
      95             : 
      96             :   virtual unsigned int getPinIndexFromPoint(const Point & p) const override;
      97             :   virtual unsigned int pinIndex(const Point & p) const override;
      98             : 
      99             :   /**
     100             :    * Setup the internal maps when there is a outside duct present
     101             :    */
     102             :   void setChannelToDuctMaps(const std::vector<Node *> & duct_nodes);
     103             : 
     104             : protected:
     105             :   /// number of rings of fuel pins
     106             :   unsigned int _n_rings;
     107             :   /// number of subchannels
     108             :   unsigned int _n_channels;
     109             :   /// the distance between flat surfaces of the duct facing each other
     110             :   Real _flat_to_flat;
     111             :   /// the gap thickness between the duct and peripheral fuel pins
     112             :   Real _duct_to_pin_gap;
     113             :   /// nodes
     114             :   std::vector<std::vector<Node *>> _nodes;
     115             : 
     116             :   /// A list of all mesh nodes that form the (elements of) the hexagonal duct
     117             :   /// mesh that surrounds the pins/intertices.
     118             :   std::vector<Node *> _duct_nodes;
     119             :   /// A map for providing the closest/corresponding duct node associated
     120             :   /// with each interstice node. i.e. a map of interstice mesh nodes to duct mesh nodes.
     121             :   std::map<Node *, Node *> _chan_to_duct_node_map;
     122             :   /// A map for providing the closest/corresponding interstice node associated
     123             :   /// with each duct node. i.e. a map of duct mesh nodes to interstice mesh nodes.
     124             :   std::map<Node *, Node *> _duct_node_to_chan_map;
     125             : 
     126             :   /// stores the channel pairs for each gap
     127             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
     128             :   /// stores the fuel pins belonging to each gap
     129             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
     130             :   /// stores the gaps that forms each interstice
     131             :   std::vector<std::vector<unsigned int>> _chan_to_gap_map;
     132             :   /// Defines the global cross-flow direction -1 or 1 for each interstice and
     133             :   /// for all gaps that are belonging to the corresponding interstice.
     134             :   /// Given a interstice and a gap, if the neighbor interstice index belonging to the same gap is lower,
     135             :   /// set it to -1, otherwise set it to 1.
     136             :   std::vector<std::vector<Real>> _sign_id_crossflow_map;
     137             :   /// gap size
     138             :   std::vector<Real> _gij_map;
     139             :   /// x,y coordinates of the interstice
     140             :   std::vector<std::vector<Real>> _subchannel_position;
     141             :   /// x,y coordinates of the fuel pins
     142             :   std::vector<Point> _pin_position;
     143             :   /// fuel pins that are belonging to each ring
     144             :   std::vector<std::vector<Real>> _pins_in_rings;
     145             :   /// stores the fuel pins belonging to each interstice
     146             :   std::vector<std::vector<unsigned int>> _chan_to_pin_map;
     147             :   /// number of assemblies
     148             :   unsigned int _n_assemblies;
     149             :   /// number of gaps
     150             :   unsigned int _n_gaps;
     151             :   /// interstice type
     152             :   std::vector<EChannelType> _subch_type;
     153             :   /// gap type
     154             :   std::vector<EChannelType> _gap_type;
     155             :   /// sweeping flow model gap pairs per channel to specify directional edge flow
     156             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_pairs_sf;
     157             :   /// sweeping flow model channel pairs to specify directional edge flow
     158             :   std::vector<std::pair<unsigned int, unsigned int>> _chan_pairs_sf;
     159             :   /// TODO: channel indices corresponding to a given pin index
     160             :   std::vector<std::vector<unsigned int>> _pin_to_chan_map;
     161             :   /// whether the side bypass shape follows the assemblies
     162             :   bool _tight_side_bypass;
     163             : 
     164             : public:
     165             :   static InputParameters validParams();
     166             : 
     167             :   /**
     168             :    * Calculates and stores the Pin positions/centers for a hexagonal assembly
     169             :    * containing the given number of rings in a triangular/alternating row grid
     170             :    * spaced 'assembly_pitch' apart.  The points are generated such that the duct is
     171             :    * centered at the given center point.
     172             :    */
     173             :   static void rodPositions(std::vector<Point> & positions,
     174             :                            unsigned int nrings,
     175             :                            Real assembly_pitch,
     176             :                            Point center);
     177             : 
     178             :   friend class SCMTriInterWrapperMeshGenerator;
     179             : 
     180             :   /// number of corners in the duct x-sec
     181             :   static const unsigned int N_CORNERS = 6;
     182             : };

Generated by: LCOV version 1.14