LCOV - code coverage report
Current view: top level - include/mesh - QuadSubChannelMesh.h (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31730 (e8b711) with base e0c998 Lines: 30 33 90.9 %
Date: 2025-10-29 16:55:46 Functions: 18 21 85.7 %
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             : /**
      16             :  * Creates the mesh of subchannels in a quadrilateral lattice.
      17             :  */
      18             : class QuadSubChannelMesh : public SubChannelMesh
      19             : {
      20             : public:
      21             :   QuadSubChannelMesh(const InputParameters & parameters);
      22             :   QuadSubChannelMesh(const QuadSubChannelMesh & other_mesh);
      23             :   virtual std::unique_ptr<MooseMesh> safeClone() const override;
      24             :   virtual void buildMesh() override;
      25             : 
      26   478614269 :   virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
      27             :   {
      28   478614269 :     return _nodes[i_chan][iz];
      29             :   }
      30             : 
      31     1691994 :   virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override
      32             :   {
      33     1691994 :     return _pin_nodes[i_pin][iz];
      34             :   }
      35             : 
      36             :   /**
      37             :    * Duct functions not applicable to quad channel
      38             :    *
      39             :    * Over-writing to avoid abstract template definition in this class
      40             :    */
      41             :   ///@{
      42           0 :   virtual Node * getDuctNodeFromChannel(Node *) override { return nullptr; }
      43           0 :   virtual Node * getChannelNodeFromDuct(Node *) override { return nullptr; }
      44           0 :   virtual const std::vector<Node *> getDuctNodes() const override { return std::vector<Node *>(); }
      45             :   ///@}
      46             : 
      47         730 :   virtual unsigned int getNumOfChannels() const override
      48             :   {
      49         730 :     return processor_id() == 0 ? _n_channels : 0;
      50             :   }
      51         223 :   virtual unsigned int getNumOfGapsPerLayer() const override
      52             :   {
      53         223 :     return processor_id() == 0 ? _n_gaps : 0;
      54             :   }
      55         223 :   virtual unsigned int getNumOfPins() const override { return processor_id() == 0 ? _n_pins : 0; }
      56       68556 :   virtual bool pinMeshExist() const override { return _pin_mesh_exist; }
      57         223 :   virtual bool ductMeshExist() const override { return false; }
      58             :   virtual const std::pair<unsigned int, unsigned int> &
      59    90781728 :   getGapChannels(unsigned int i_gap) const override
      60             :   {
      61    90781728 :     return _gap_to_chan_map[i_gap];
      62             :   }
      63             :   virtual const std::pair<unsigned int, unsigned int> &
      64       22680 :   getGapPins(unsigned int i_gap) const override
      65             :   {
      66       22680 :     return _gap_to_pin_map[i_gap];
      67             :   }
      68    26957472 :   virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
      69             :   {
      70    26957472 :     return _chan_to_gap_map[i_chan];
      71             :   }
      72       21886 :   virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
      73             :   {
      74       21886 :     return _pin_to_chan_map[i_pin];
      75             :   }
      76      327246 :   virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
      77             :   {
      78      327246 :     return _chan_to_pin_map[i_chan];
      79             :   }
      80     6588201 :   virtual const Real & getPitch() const override { return _pitch; }
      81    98866008 :   virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
      82             :   {
      83    98866008 :     return _sign_id_crossflow_map[i_chan][i_local];
      84             :   }
      85             :   /// Number of subchannels in the -x direction
      86        5091 :   virtual const unsigned int & getNx() const { return _nx; }
      87             :   /// Number of subchannels in the -y direction
      88         627 :   virtual const unsigned int & getNy() const { return _ny; }
      89             :   /**
      90             :    * Returns the side gap, not to be confused with the gap between pins, this refers to the gap
      91             :    * next to the duct. Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m]
      92             :    */
      93             :   const Real & getSideGap() const { return _side_gap; }
      94             : 
      95             :   unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
      96             :   virtual unsigned int channelIndex(const Point & point) const override;
      97             : 
      98             :   unsigned int getPinIndexFromPoint(const Point & p) const override;
      99             :   virtual unsigned int pinIndex(const Point & p) const override;
     100             : 
     101     2640880 :   virtual EChannelType getSubchannelType(unsigned int index) const override
     102             :   {
     103     2640880 :     return _subch_type[index];
     104             :   }
     105             : 
     106    46625616 :   virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
     107             :   {
     108    46625616 :     return _gij_map[axial_index][gap_index];
     109             :   }
     110             : 
     111             : protected:
     112             :   /// number of subchannels in the x direction
     113             :   unsigned int _nx;
     114             :   /// number of subchannels in the y direction
     115             :   unsigned int _ny;
     116             :   /// number of subchannels in total
     117             :   unsigned int _n_channels;
     118             :   /// Number of gaps per layer
     119             :   unsigned int _n_gaps;
     120             :   /// Number of pins
     121             :   unsigned int _n_pins;
     122             :   /**
     123             :    * The side gap, not to be confused with the gap between pins, this refers to the gap
     124             :    * next to the duct or else the distance between the subchannel centroid to the duct wall.
     125             :    * Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m]
     126             :    */
     127             :   Real _side_gap;
     128             :   /// vector of subchannel nodes
     129             :   std::vector<std::vector<Node *>> _nodes;
     130             :   /// vector of fuel pin nodes
     131             :   std::vector<std::vector<Node *>> _pin_nodes;
     132             :   /// vector of gap (interface between pairs of neighboring subchannels) nodes
     133             :   std::vector<std::vector<Node *>> _gapnodes;
     134             :   /// map relating gap index to subchannel index
     135             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
     136             :   /// map relating gap index to fuel pin index
     137             :   std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
     138             :   /// map relating subchannel index to gap index
     139             :   std::vector<std::vector<unsigned int>> _chan_to_gap_map;
     140             :   /// map relating subchannel index to fuel pin index
     141             :   std::vector<std::vector<unsigned int>> _chan_to_pin_map;
     142             :   /// map relating fuel pin index to subchannel index
     143             :   std::vector<std::vector<unsigned int>> _pin_to_chan_map;
     144             :   /// Matrix used to give local sign to crossflow quantities
     145             :   std::vector<std::vector<double>> _sign_id_crossflow_map;
     146             :   /// Vector to store gap size
     147             :   std::vector<std::vector<Real>> _gij_map;
     148             :   /// Subchannel type
     149             :   std::vector<EChannelType> _subch_type;
     150             :   /// Flag that informs the solver whether there is a Pin Mesh or not
     151             :   bool _pin_mesh_exist;
     152             : 
     153             : public:
     154             :   static InputParameters validParams();
     155             : 
     156             :   /**
     157             :    * Generate pin centers
     158             :    *
     159             :    * @param nx number of channels in x-direction (must be more than 1)
     160             :    * @param ny number of channels in y-direction (must be more than 1)
     161             :    * @param elev elevation in z-direction
     162             :    * @param pin_centers Positions in 3D space of pin centers
     163             :    */
     164             :   static void generatePinCenters(
     165             :       unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector<Point> & pin_centers);
     166             : 
     167             :   friend class SCMQuadSubChannelMeshGenerator;
     168             :   friend class SCMQuadPinMeshGenerator;
     169             :   friend class QuadSubChannel1PhaseProblem;
     170             : };

Generated by: LCOV version 1.14