LCOV - code coverage report
Current view: top level - include/mesh - SubChannelMesh.h (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 12 12 100.0 %
Date: 2025-09-04 07:58:06 Functions: 12 12 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 <vector>
      13             : #include "MooseMesh.h"
      14             : #include "SubChannelEnums.h"
      15             : 
      16             : /**
      17             :  * Base class for subchannel meshes
      18             :  */
      19             : class SubChannelMesh : public MooseMesh
      20             : {
      21             : public:
      22             :   SubChannelMesh(const InputParameters & parameters);
      23             :   SubChannelMesh(const SubChannelMesh & other_mesh);
      24             : 
      25             :   /**
      26             :    * Get axial location of layers
      27             :    */
      28         919 :   virtual const std::vector<Real> & getZGrid() const { return _z_grid; }
      29             : 
      30             :   /**
      31             :    * Get axial index of point
      32             :    */
      33             :   virtual unsigned int getZIndex(const Point & point) const;
      34             : 
      35             :   /**
      36             :    * Get axial cell location and value of loss coefficient
      37             :    */
      38      692546 :   virtual const std::vector<std::vector<Real>> & getKGrid() const { return _k_grid; }
      39             : 
      40             :   /**
      41             :    * Get axial location of blockage (in,out) [m]
      42             :    */
      43      509204 :   virtual const std::vector<Real> & getZBlockage() const { return _z_blockage; }
      44             : 
      45             :   /**
      46             :    * Get index of blocked subchannels
      47             :    */
      48      509204 :   virtual const std::vector<unsigned int> & getIndexBlockage() const { return _index_blockage; }
      49             : 
      50             :   /**
      51             :    * Get area reduction of blocked subchannels
      52             :    */
      53      509204 :   virtual const std::vector<Real> & getReductionBlockage() const { return _reduction_blockage; }
      54             : 
      55             :   /**
      56             :    * Return lateral loss coefficient
      57             :    */
      58         244 :   virtual const Real & getKij() const { return _kij; }
      59             : 
      60             :   /**
      61             :    * Return the number of axial cells
      62             :    */
      63        4759 :   virtual const unsigned int & getNumOfAxialCells() const { return _n_cells; }
      64             : 
      65             :   /**
      66             :    * Get the subchannel mesh node for a given channel index and elevation index
      67             :    */
      68             :   virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const = 0;
      69             : 
      70             :   /**
      71             :    * Get the pin mesh node for a given pin index and elevation index
      72             :    */
      73             :   virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const = 0;
      74             : 
      75             :   /**
      76             :    * Function that gets the channel node from the duct node
      77             :    */
      78             :   virtual Node * getChanNodeFromDuct(Node * duct_node) = 0;
      79             : 
      80             :   /**
      81             :    * Function that gets the channel node from the duct node
      82             :    */
      83             :   virtual Node * getChannelNodeFromDuct(Node * channel_node) = 0;
      84             : 
      85             :   /**
      86             :    * Function that gets the duct node from the channel node
      87             :    */
      88             :   virtual Node * getDuctNodeFromChannel(Node * channel_node) = 0;
      89             : 
      90             :   /**
      91             :    * Return the number of channels per layer
      92             :    */
      93             :   virtual const unsigned int & getNumOfChannels() const = 0;
      94             : 
      95             :   /**
      96             :    * Return if Pin Mesh exists or not
      97             :    */
      98             :   virtual bool pinMeshExist() const = 0;
      99             : 
     100             :   /**
     101             :    * Return if Duct Mesh exists or not
     102             :    */
     103             :   virtual bool ductMeshExist() const = 0;
     104             : 
     105             :   /**
     106             :    * Return the number of gaps per layer
     107             :    */
     108             :   virtual const unsigned int & getNumOfGapsPerLayer() const = 0;
     109             : 
     110             :   /**
     111             :    * Return the number of pins
     112             :    */
     113             :   virtual const unsigned int & getNumOfPins() const = 0;
     114             : 
     115             :   /**
     116             :    * Return a pair of subchannel indices for a given gap index
     117             :    */
     118             :   virtual const std::pair<unsigned int, unsigned int> &
     119             :   getGapChannels(unsigned int i_gap) const = 0;
     120             : 
     121             :   /**
     122             :    * Return a pair of pin indices for a given gap index
     123             :    */
     124             :   virtual const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const = 0;
     125             : 
     126             :   /**
     127             :    * Return a vector of gap indices for a given channel index
     128             :    */
     129             :   virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const = 0;
     130             : 
     131             :   /**
     132             :    * Return a vector of channel indices for a given Pin index
     133             :    */
     134             :   virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const = 0;
     135             : 
     136             :   /**
     137             :    * Return a vector of pin indices for a given channel index
     138             :    */
     139             :   virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const = 0;
     140             : 
     141             :   /**
     142             :    * Return the pitch between 2 subchannels
     143             :    */
     144    23662038 :   virtual const Real & getPitch() const { return _pitch; }
     145             : 
     146             :   /**
     147             :    * Return Pin diameter
     148             :    */
     149    30061732 :   virtual const Real & getPinDiameter() const { return _pin_diameter; }
     150             : 
     151             :   /**
     152             :    * Return a sign for the crossflow given a subchannel index and local neighbor index
     153             :    */
     154             :   virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const = 0;
     155             : 
     156             :   /**
     157             :    * Return unheated length at entry
     158             :    */
     159     4602203 :   virtual const Real & getHeatedLengthEntry() const { return _unheated_length_entry; }
     160             : 
     161             :   /**
     162             :    * Return heated length
     163             :    */
     164     4602468 :   virtual const Real & getHeatedLength() const { return _heated_length; }
     165             : 
     166             :   /**
     167             :    * Return unheated length at exit
     168             :    */
     169         186 :   virtual const Real & getHeatedLengthExit() const { return _unheated_length_exit; }
     170             : 
     171             :   /**
     172             :    * Return a subchannel index for a given physical point `p`
     173             :    */
     174             :   virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const = 0;
     175             : 
     176             :   virtual unsigned int channelIndex(const Point & point) const = 0;
     177             : 
     178             :   /**
     179             :    * Return a pin index for a given physical point `p`
     180             :    */
     181             :   virtual unsigned int getPinIndexFromPoint(const Point & p) const = 0;
     182             : 
     183             :   virtual unsigned int pinIndex(const Point & p) const = 0;
     184             : 
     185             :   /**
     186             :    * Return the type of the subchannel for given subchannel index
     187             :    */
     188             :   virtual EChannelType getSubchannelType(unsigned int index) const = 0;
     189             : 
     190             :   /**
     191             :    * Return gap width for a given gap index
     192             :    */
     193             :   virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const = 0;
     194             : 
     195             :   /**
     196             :    * Function that return the vector with the maps to the nodes if they exist
     197             :    */
     198             :   virtual const std::vector<Node *> getDuctNodes() const = 0;
     199             : 
     200             : protected:
     201             :   /// unheated length of the fuel Pin at the entry of the assembly
     202             :   Real _unheated_length_entry;
     203             :   /// heated length of the fuel Pin
     204             :   Real _heated_length;
     205             :   /// unheated length of the fuel Pin at the exit of the assembly
     206             :   Real _unheated_length_exit;
     207             :   /// axial location of nodes
     208             :   std::vector<Real> _z_grid;
     209             :   /// axial form loss coefficient per computational cell
     210             :   std::vector<std::vector<Real>> _k_grid;
     211             :   /// axial location of the spacers
     212             :   std::vector<Real> _spacer_z;
     213             :   /// form loss coefficient of the spacers
     214             :   std::vector<Real> _spacer_k;
     215             :   /// axial location of blockage (inlet, outlet) [m]
     216             :   std::vector<Real> _z_blockage;
     217             :   /// index of subchannels affected by blockage
     218             :   std::vector<unsigned int> _index_blockage;
     219             :   /// area reduction of subchannels affected by blockage
     220             :   std::vector<Real> _reduction_blockage;
     221             :   /// Lateral form loss coefficient
     222             :   Real _kij;
     223             :   /// Distance between the neighbor fuel pins, pitch
     224             :   Real _pitch;
     225             :   /// fuel Pin diameter
     226             :   Real _pin_diameter;
     227             :   /// number of axial cells
     228             :   unsigned int _n_cells;
     229             : 
     230             : public:
     231             :   /// x,y coordinates of the subchannel centroids
     232             :   std::vector<std::vector<Real>> _subchannel_position;
     233             :   static InputParameters validParams();
     234             : 
     235             :   /**
     236             :    * Generate the spacing in z-direction using heated and unteaded lengths
     237             :    */
     238             :   static void generateZGrid(Real unheated_length_entry,
     239             :                             Real heated_length,
     240             :                             Real unheated_length_exit,
     241             :                             unsigned int n_cells,
     242             :                             std::vector<Real> & z_grid);
     243             : };

Generated by: LCOV version 1.14