LCOV - code coverage report
Current view: top level - include/mesh - QuadSubChannelMesh.h (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #32971 (54bef8) with base c6cf66 Lines: 23 23 100.0 %
Date: 2026-05-29 20:40:47 Functions: 14 14 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 "SubChannelMesh.h"
      13             : #include "SubChannelEnums.h"
      14             : 
      15             : #include <map>
      16             : #include <vector>
      17             : #include <memory>  // for unique_ptr
      18             : #include <utility> // for std::pair
      19             : 
      20             : /**
      21             :  * Creates the mesh of subchannels in a quadrilateral lattice.
      22             :  */
      23             : class QuadSubChannelMesh : public SubChannelMesh
      24             : {
      25             : public:
      26             :   QuadSubChannelMesh(const InputParameters & parameters);
      27             :   QuadSubChannelMesh(const QuadSubChannelMesh & other_mesh);
      28             : 
      29             :   std::unique_ptr<MooseMesh> safeClone() const override;
      30             :   void buildMesh() override;
      31             : 
      32             :   /**
      33             :    * Compute undeformed bundle-average inlet hydraulic quantities from generated mesh geometry
      34             :    */
      35             :   void computeAssemblyHydraulicParameters();
      36             : 
      37             :   Real getSubchannelFlowArea(unsigned int i_chan, Real z) const override;
      38             :   Real getSubchannelWettedPerimeter(unsigned int i_chan) const override;
      39             : 
      40   833852332 :   Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
      41             :   {
      42   833852332 :     return _nodes[i_chan][iz];
      43             :   }
      44             : 
      45     1043488 :   Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
      46             :   {
      47     1043488 :     return _pin_nodes[i_pin][iz];
      48             :   }
      49             : 
      50         512 :   unsigned int getNumOfChannels() const override { return processor_id() == 0 ? _n_channels : 0; }
      51         146 :   unsigned int getNumOfGapsPerLayer() const override { return processor_id() == 0 ? _n_gaps : 0; }
      52         146 :   unsigned int getNumOfPins() const override { return processor_id() == 0 ? _n_pins : 0; }
      53             : 
      54   144749400 :   const std::pair<unsigned int, unsigned int> & getGapChannels(unsigned int i_gap) const override
      55             :   {
      56   144749400 :     return _gap_to_chan_map[i_gap];
      57             :   }
      58        1080 :   const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const override
      59             :   {
      60        1080 :     return _gap_to_pin_map[i_gap];
      61             :   }
      62    43156290 :   const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
      63             :   {
      64    43156290 :     return _chan_to_gap_map[i_chan];
      65             :   }
      66       33345 :   const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
      67             :   {
      68       33345 :     return _pin_to_chan_map[i_pin];
      69             :   }
      70      225926 :   const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
      71             :   {
      72      225926 :     return _chan_to_pin_map[i_chan];
      73             :   }
      74     9859764 :   const Real & getPitch() const override { return _pitch; }
      75   192597720 :   const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
      76             :   {
      77   192597720 :     return _sign_id_crossflow_map[i_chan][i_local];
      78             :   }
      79             : 
      80             :   /// Number of subchannels in the -x direction
      81             :   const unsigned int & getNx() const { return _nx; }
      82             :   /// Number of subchannels in the -y direction
      83             :   const unsigned int & getNy() const { return _ny; }
      84             : 
      85             :   /**
      86             :    * Returns the side gap, not to be confused with the gap between pins, this refers to the gap
      87             :    * next to the duct. Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m]
      88             :    */
      89             :   const Real & getSideGap() const { return _side_gap; }
      90             : 
      91             :   unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
      92             :   unsigned int channelIndex(const Point & point) const override;
      93             : 
      94             :   unsigned int getPinIndexFromPoint(const Point & p) const override;
      95             :   unsigned int pinIndex(const Point & p) const override;
      96             : 
      97     7297771 :   EChannelType getSubchannelType(unsigned int index) const override { return _subch_type[index]; }
      98             : 
      99    73304160 :   Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
     100             :   {
     101    73304160 :     return _gij_map[axial_index][gap_index];
     102             :   }
     103             : 
     104             : protected:
     105             :   /// number of subchannels in the x direction
     106             :   unsigned int _nx;
     107             :   /// number of subchannels in the y direction
     108             :   unsigned int _ny;
     109             :   /// number of subchannels in total
     110             :   unsigned int _n_channels;
     111             :   /// Number of gaps per layer
     112             :   unsigned int _n_gaps;
     113             :   /// Number of pins
     114             :   unsigned int _n_pins;
     115             : 
     116             :   /**
     117             :    * The side gap, not to be confused with the gap between pins, this refers to the gap
     118             :    * next to the duct or else the distance between the subchannel centroid to the duct wall.
     119             :    * Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m]
     120             :    */
     121             :   Real _side_gap;
     122             : 
     123             :   /// vector of subchannel nodes
     124             :   std::vector<std::vector<Node *>> _nodes;
     125             :   /// vector of fuel pin nodes
     126             :   std::vector<std::vector<Node *>> _pin_nodes;
     127             :   /// vector of gap (interface between pairs of neighboring subchannels) nodes
     128             :   std::vector<std::vector<Node *>> _gapnodes;
     129             : 
     130             :   /// map relating gap index to subchannel index
     131             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
     132             :   /// map relating gap index to fuel pin index
     133             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
     134             :   /// map relating subchannel index to gap index
     135             :   std::vector<std::vector<unsigned int>> _chan_to_gap_map;
     136             :   /// map relating subchannel index to fuel pin index
     137             :   std::vector<std::vector<unsigned int>> _chan_to_pin_map;
     138             :   /// map relating fuel pin index to subchannel index
     139             :   std::vector<std::vector<unsigned int>> _pin_to_chan_map;
     140             : 
     141             :   /// Matrix used to give local sign to crossflow quantities
     142             :   std::vector<std::vector<double>> _sign_id_crossflow_map;
     143             :   /// Vector to store gap size
     144             :   std::vector<std::vector<Real>> _gij_map;
     145             :   /// Subchannel type
     146             :   std::vector<EChannelType> _subch_type;
     147             : 
     148             : public:
     149             :   static InputParameters validParams();
     150             : 
     151             :   /**
     152             :    * Generate pin centers
     153             :    *
     154             :    * @param nx number of channels in x-direction (must be more than 1)
     155             :    * @param ny number of channels in y-direction (must be more than 1)
     156             :    * @param elev elevation in z-direction
     157             :    * @param pin_centers Positions in 3D space of pin centers
     158             :    */
     159             :   static void generatePinCenters(
     160             :       unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector<Point> & pin_centers);
     161             : 
     162             :   friend class SCMQuadSubChannelMeshGenerator;
     163             :   friend class SCMQuadPinMeshGenerator;
     164             :   friend class QuadSubChannel1PhaseProblem;
     165             : };

Generated by: LCOV version 1.14