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 <utility> // std::pair 14 : #include <map> 15 : 16 : #include "MooseMesh.h" 17 : #include "SubChannelEnums.h" 18 : 19 : /** 20 : * Base class for subchannel meshes 21 : */ 22 : class SubChannelMesh : public MooseMesh 23 : { 24 : public: 25 : SubChannelMesh(const InputParameters & parameters); 26 : SubChannelMesh(const SubChannelMesh & other_mesh); 27 : 28 : /** 29 : * Get axial location of layers 30 : */ 31 938 : virtual const std::vector<Real> & getZGrid() const { return _z_grid; } 32 : 33 : /** 34 : * Get axial index of point 35 : */ 36 : virtual unsigned int getZIndex(const Point & point) const; 37 : 38 : /** 39 : * Get axial cell location and value of loss coefficient 40 : */ 41 794495 : virtual const std::vector<std::vector<Real>> & getKGrid() const { return _k_grid; } 42 : 43 : /** 44 : * Get axial location of blockage (in,out) [m] 45 : */ 46 31210 : virtual const std::vector<Real> & getZBlockage() const { return _z_blockage; } 47 : 48 : /** 49 : * Get index of blocked subchannels 50 : */ 51 31210 : virtual const std::vector<unsigned int> & getIndexBlockage() const { return _index_blockage; } 52 : 53 : /** 54 : * Get area reduction of blocked subchannels 55 : */ 56 31210 : virtual const std::vector<Real> & getReductionBlockage() const { return _reduction_blockage; } 57 : 58 : /** 59 : * Return lateral loss coefficient 60 : */ 61 301 : virtual const Real & getKij() const { return _kij; } 62 : 63 : /** 64 : * Return the number of axial cells 65 : */ 66 4249 : virtual unsigned int getNumOfAxialCells() const { return processor_id() == 0 ? _n_cells : 0; } 67 : 68 : /** 69 : * Get the subchannel mesh node for a given channel index and elevation index 70 : */ 71 : virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const = 0; 72 : 73 : /** 74 : * Get the pin mesh node for a given pin index and elevation index 75 : */ 76 : virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const = 0; 77 : 78 : /** 79 : * Function that gets the channel node from the duct node 80 : */ 81 : Node * getChannelNodeFromDuct(Node * duct_node) const; 82 : 83 : /** 84 : * Function that gets the duct node from the channel node 85 : */ 86 : Node * getDuctNodeFromChannel(Node * channel_node) const; 87 : 88 : /** 89 : * Return the number of channels per layer 90 : */ 91 : virtual unsigned int getNumOfChannels() const = 0; 92 : 93 : /** 94 : * Return if Pin Mesh exists or not 95 : */ 96 368132 : bool pinMeshExist() const { return _pin_mesh_exist; } 97 : 98 : /** 99 : * Return if Duct Mesh exists or not 100 : */ 101 301 : bool ductMeshExist() const { return _duct_mesh_exist; } 102 : 103 : /** 104 : * Return the number of gaps per layer 105 : */ 106 : virtual unsigned int getNumOfGapsPerLayer() const = 0; 107 : 108 : /** 109 : * Return the number of pins 110 : */ 111 : virtual unsigned int getNumOfPins() const = 0; 112 : 113 : /** 114 : * Return a pair of subchannel indices for a given gap index 115 : */ 116 : virtual const std::pair<unsigned int, unsigned int> & 117 : getGapChannels(unsigned int i_gap) const = 0; 118 : 119 : /** 120 : * Return a pair of pin indices for a given gap index 121 : */ 122 : virtual const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const = 0; 123 : 124 : /** 125 : * Return a vector of gap indices for a given channel index 126 : */ 127 : virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const = 0; 128 : 129 : /** 130 : * Return a vector of channel indices for a given Pin index 131 : */ 132 : virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const = 0; 133 : 134 : /** 135 : * Return a vector of pin indices for a given channel index 136 : */ 137 : virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const = 0; 138 : 139 : /** 140 : * Return the undeformed pitch between 2 subchannels 141 : */ 142 21708065 : virtual const Real & getPitch() const { return _pitch; } 143 : 144 : /** 145 : * Return undeformed Pin diameter 146 : */ 147 30389107 : virtual const Real & getPinDiameter() const { return _pin_diameter; } 148 : 149 : /** 150 : * Return undeformed bundle inlet flow area 151 : */ 152 415 : Real getAssemblyFlowArea() const { return _assembly_flow_area; } 153 : 154 : /** 155 : * Return undeformed bundle inlet wetted perimeter 156 : */ 157 : Real getAssemblyWettedPerimeter() const { return _assembly_wetted_perimeter; } 158 : 159 : /** 160 : * Return undeformed bundle-average hydraulic diameter 161 : */ 162 256 : Real getAssemblyHydraulicDiameter() const { return _assembly_hydraulic_diameter; } 163 : 164 : /** 165 : * Return undeformed flow area for a subchannel at an axial location, including any blockage 166 : * reduction 167 : */ 168 : virtual Real getSubchannelFlowArea(unsigned int i_chan, Real z) const = 0; 169 : 170 : /** 171 : * Return undeformed wetted perimeter for a subchannel 172 : */ 173 : virtual Real getSubchannelWettedPerimeter(unsigned int i_chan) const = 0; 174 : 175 : /** 176 : * Return a sign for the crossflow given a subchannel index and local neighbor index 177 : */ 178 : virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const = 0; 179 : 180 : /** 181 : * Return unheated length at entry 182 : */ 183 3815915 : virtual const Real & getHeatedLengthEntry() const { return _unheated_length_entry; } 184 : 185 : /** 186 : * Return heated length 187 : */ 188 3816148 : virtual const Real & getHeatedLength() const { return _heated_length; } 189 : 190 : /** 191 : * Return unheated length at exit 192 : */ 193 226 : virtual const Real & getHeatedLengthExit() const { return _unheated_length_exit; } 194 : 195 : /** 196 : * Return a subchannel index for a given physical point `p` 197 : */ 198 : virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const = 0; 199 : 200 : virtual unsigned int channelIndex(const Point & point) const = 0; 201 : 202 : /** 203 : * Return a pin index for a given physical point `p` 204 : */ 205 : virtual unsigned int getPinIndexFromPoint(const Point & p) const = 0; 206 : 207 : virtual unsigned int pinIndex(const Point & p) const = 0; 208 : 209 : /** 210 : * Return the type of the subchannel for given subchannel index 211 : */ 212 : virtual EChannelType getSubchannelType(unsigned int index) const = 0; 213 : 214 : /** 215 : * Return gap width for a given gap index 216 : */ 217 : virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const = 0; 218 : 219 : /** 220 : * Function that returns the vector with the duct nodes 221 : * 222 : */ 223 52 : const std::vector<Node *> & getDuctNodes() const { return _duct_nodes; } 224 : 225 : /** 226 : * Function that sets the channel-to-duct maps 227 : */ 228 : void setChannelToDuctMaps(const std::vector<Node *> & duct_nodes); 229 : 230 : bool _pin_mesh_exist = false; 231 : bool _duct_mesh_exist = false; 232 : 233 : protected: 234 : /// unheated length of the fuel Pin at the entry of the assembly 235 : Real _unheated_length_entry; 236 : /// heated length of the fuel Pin 237 : Real _heated_length; 238 : /// unheated length of the fuel Pin at the exit of the assembly 239 : Real _unheated_length_exit; 240 : 241 : /// axial location of nodes 242 : std::vector<Real> _z_grid; 243 : /// axial form loss coefficient per computational cell 244 : std::vector<std::vector<Real>> _k_grid; 245 : 246 : /// A list of all mesh nodes that form the (elements of) the duct 247 : /// mesh that surrounds the pins/subchannels. 248 : std::vector<Node *> _duct_nodes; 249 : 250 : /// Maps between channel nodes and duct nodes 251 : std::map<Node *, Node *> _chan_to_duct_node_map; 252 : std::map<Node *, Node *> _duct_node_to_chan_map; 253 : 254 : /// axial location of the spacers 255 : std::vector<Real> _spacer_z; 256 : /// form loss coefficient of the spacers 257 : std::vector<Real> _spacer_k; 258 : 259 : /// axial location of blockage (inlet, outlet) [m] 260 : std::vector<Real> _z_blockage; 261 : /// index of subchannels affected by blockage 262 : std::vector<unsigned int> _index_blockage; 263 : /// area reduction of subchannels affected by blockage 264 : std::vector<Real> _reduction_blockage; 265 : 266 : /// Lateral form loss coefficient 267 : Real _kij; 268 : /// Distance between the neighbor fuel pins, pitch 269 : Real _pitch; 270 : /// fuel Pin diameter 271 : Real _pin_diameter; 272 : /// Undeformed bundle inlet flow area 273 : Real _assembly_flow_area; 274 : /// Undeformed bundle inlet wetted perimeter 275 : Real _assembly_wetted_perimeter; 276 : /// Undeformed bundle-average hydraulic diameter 277 : Real _assembly_hydraulic_diameter; 278 : 279 : /// number of axial cells 280 : unsigned int _n_cells; 281 : 282 : public: 283 : /// x,y coordinates of the subchannel centroids 284 : std::vector<std::vector<Real>> _subchannel_position; 285 : 286 : static InputParameters validParams(); 287 : 288 : /** 289 : * Generate the spacing in z-direction using heated and unteaded lengths 290 : */ 291 : static void generateZGrid(Real unheated_length_entry, 292 : Real heated_length, 293 : Real unheated_length_exit, 294 : unsigned int n_cells, 295 : std::vector<Real> & z_grid); 296 : };