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 1106 : 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 693716 : 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 512810 : virtual const std::vector<Real> & getZBlockage() const { return _z_blockage; } 44 : 45 : /** 46 : * Get index of blocked subchannels 47 : */ 48 512810 : virtual const std::vector<unsigned int> & getIndexBlockage() const { return _index_blockage; } 49 : 50 : /** 51 : * Get area reduction of blocked subchannels 52 : */ 53 512810 : virtual const std::vector<Real> & getReductionBlockage() const { return _reduction_blockage; } 54 : 55 : /** 56 : * Return lateral loss coefficient 57 : */ 58 381 : virtual const Real & getKij() const { return _kij; } 59 : 60 : /** 61 : * Return the number of axial cells 62 : */ 63 5138 : virtual unsigned int getNumOfAxialCells() const { return processor_id() == 0 ? _n_cells : 0; } 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 * getChannelNodeFromDuct(Node * channel_node) = 0; 79 : 80 : /** 81 : * Function that gets the duct node from the channel node 82 : */ 83 : virtual Node * getDuctNodeFromChannel(Node * channel_node) = 0; 84 : 85 : /** 86 : * Return the number of channels per layer 87 : */ 88 : virtual unsigned int getNumOfChannels() const = 0; 89 : 90 : /** 91 : * Return if Pin Mesh exists or not 92 : */ 93 : virtual bool pinMeshExist() const = 0; 94 : 95 : /** 96 : * Return if Duct Mesh exists or not 97 : */ 98 : virtual bool ductMeshExist() const = 0; 99 : 100 : /** 101 : * Return the number of gaps per layer 102 : */ 103 : virtual unsigned int getNumOfGapsPerLayer() const = 0; 104 : 105 : /** 106 : * Return the number of pins 107 : */ 108 : virtual unsigned int getNumOfPins() const = 0; 109 : 110 : /** 111 : * Return a pair of subchannel indices for a given gap index 112 : */ 113 : virtual const std::pair<unsigned int, unsigned int> & 114 : getGapChannels(unsigned int i_gap) const = 0; 115 : 116 : /** 117 : * Return a pair of pin indices for a given gap index 118 : */ 119 : virtual const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const = 0; 120 : 121 : /** 122 : * Return a vector of gap indices for a given channel index 123 : */ 124 : virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const = 0; 125 : 126 : /** 127 : * Return a vector of channel indices for a given Pin index 128 : */ 129 : virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const = 0; 130 : 131 : /** 132 : * Return a vector of pin indices for a given channel index 133 : */ 134 : virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const = 0; 135 : 136 : /** 137 : * Return the pitch between 2 subchannels 138 : */ 139 23701479 : virtual const Real & getPitch() const { return _pitch; } 140 : 141 : /** 142 : * Return Pin diameter 143 : */ 144 30082039 : virtual const Real & getPinDiameter() const { return _pin_diameter; } 145 : 146 : /** 147 : * Return a sign for the crossflow given a subchannel index and local neighbor index 148 : */ 149 : virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const = 0; 150 : 151 : /** 152 : * Return unheated length at entry 153 : */ 154 4610173 : virtual const Real & getHeatedLengthEntry() const { return _unheated_length_entry; } 155 : 156 : /** 157 : * Return heated length 158 : */ 159 4610458 : virtual const Real & getHeatedLength() const { return _heated_length; } 160 : 161 : /** 162 : * Return unheated length at exit 163 : */ 164 216 : virtual const Real & getHeatedLengthExit() const { return _unheated_length_exit; } 165 : 166 : /** 167 : * Return a subchannel index for a given physical point `p` 168 : */ 169 : virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const = 0; 170 : 171 : virtual unsigned int channelIndex(const Point & point) const = 0; 172 : 173 : /** 174 : * Return a pin index for a given physical point `p` 175 : */ 176 : virtual unsigned int getPinIndexFromPoint(const Point & p) const = 0; 177 : 178 : virtual unsigned int pinIndex(const Point & p) const = 0; 179 : 180 : /** 181 : * Return the type of the subchannel for given subchannel index 182 : */ 183 : virtual EChannelType getSubchannelType(unsigned int index) const = 0; 184 : 185 : /** 186 : * Return gap width for a given gap index 187 : */ 188 : virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const = 0; 189 : 190 : /** 191 : * Function that return the vector with the maps to the nodes if they exist 192 : */ 193 : virtual const std::vector<Node *> getDuctNodes() const = 0; 194 : 195 : protected: 196 : /// unheated length of the fuel Pin at the entry of the assembly 197 : Real _unheated_length_entry; 198 : /// heated length of the fuel Pin 199 : Real _heated_length; 200 : /// unheated length of the fuel Pin at the exit of the assembly 201 : Real _unheated_length_exit; 202 : /// axial location of nodes 203 : std::vector<Real> _z_grid; 204 : /// axial form loss coefficient per computational cell 205 : std::vector<std::vector<Real>> _k_grid; 206 : /// axial location of the spacers 207 : std::vector<Real> _spacer_z; 208 : /// form loss coefficient of the spacers 209 : std::vector<Real> _spacer_k; 210 : /// axial location of blockage (inlet, outlet) [m] 211 : std::vector<Real> _z_blockage; 212 : /// index of subchannels affected by blockage 213 : std::vector<unsigned int> _index_blockage; 214 : /// area reduction of subchannels affected by blockage 215 : std::vector<Real> _reduction_blockage; 216 : /// Lateral form loss coefficient 217 : Real _kij; 218 : /// Distance between the neighbor fuel pins, pitch 219 : Real _pitch; 220 : /// fuel Pin diameter 221 : Real _pin_diameter; 222 : /// number of axial cells 223 : unsigned int _n_cells; 224 : 225 : public: 226 : /// x,y coordinates of the subchannel centroids 227 : std::vector<std::vector<Real>> _subchannel_position; 228 : static InputParameters validParams(); 229 : 230 : /** 231 : * Generate the spacing in z-direction using heated and unteaded lengths 232 : */ 233 : static void generateZGrid(Real unheated_length_entry, 234 : Real heated_length, 235 : Real unheated_length_exit, 236 : unsigned int n_cells, 237 : std::vector<Real> & z_grid); 238 : };