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 : 14 : #include <map> 15 : #include <vector> 16 : #include <memory> // std::unique_ptr 17 : #include <utility> // std::pair 18 : 19 : /** 20 : * Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies 21 : */ 22 : class TriSubChannelMesh : public SubChannelMesh 23 : { 24 : public: 25 : TriSubChannelMesh(const InputParameters & parameters); 26 : TriSubChannelMesh(const TriSubChannelMesh & other_mesh); 27 : 28 : std::unique_ptr<MooseMesh> safeClone() const override; 29 : void buildMesh() override; 30 : 31 : /** 32 : * Compute undeformed bundle-average inlet hydraulic quantities from generated mesh geometry 33 : */ 34 : void computeAssemblyHydraulicParameters(); 35 : 36 : Real getSubchannelFlowArea(unsigned int i_chan, Real z) const override; 37 : Real getSubchannelWettedPerimeter(unsigned int i_chan) const override; 38 : 39 439 : unsigned int getNumOfPins() const override { return processor_id() == 0 ? _npins : 0; } 40 : 41 11249504 : Node * getPinNode(unsigned int i_pin, unsigned int iz) const override 42 : { 43 11249504 : return _pin_nodes[i_pin][iz]; 44 : } 45 : 46 : /** 47 : * Return the the gap thickness between the duct and peripheral fuel pins 48 : */ 49 : const Real & getDuctToPinGap() const { return _duct_to_pin_gap; } 50 : 51 : /** 52 : * Return the number of fuel-pin rings, counting the center pin as the first ring 53 : */ 54 : const unsigned int & getNumOfRings() const { return _n_rings; } 55 : 56 : /** 57 : * Return Pin index given subchannel index and local neighbor index 58 : */ 59 : const unsigned int & getPinIndex(const unsigned int channel_idx, const unsigned int neighbor_idx) 60 : { 61 : return _chan_to_pin_map[channel_idx][neighbor_idx]; 62 : } 63 : 64 : /** 65 : * Return wire diameter 66 : */ 67 : const Real & getWireDiameter() const { return _dwire; } 68 : 69 : /** 70 : * Return flat to flat [m] 71 : */ 72 : const Real & getFlatToFlat() const { return _flat_to_flat; } 73 : 74 : /** 75 : * Return the wire lead length 76 : */ 77 : const Real & getWireLeadLength() const { return _hwire; } 78 : 79 347735262 : Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override 80 : { 81 347735262 : return _nodes[i_chan][iz]; 82 : } 83 : 84 1999 : unsigned int getNumOfChannels() const override { return processor_id() == 0 ? _n_channels : 0; } 85 : 86 141 : unsigned int getNumOfGapsPerLayer() const override { return processor_id() == 0 ? _n_gaps : 0; } 87 : 88 62086920 : const std::pair<unsigned int, unsigned int> & getGapChannels(unsigned int i_gap) const override 89 : { 90 62086920 : return _gap_to_chan_map[i_gap]; 91 : } 92 : 93 5400 : const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const override 94 : { 95 5400 : return _gap_to_pin_map[i_gap]; 96 : } 97 : 98 15629910 : const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override 99 : { 100 15629910 : return _chan_to_gap_map[i_chan]; 101 : } 102 : 103 61229792 : const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override 104 : { 105 61229792 : return _sign_id_crossflow_map[i_chan][i_local]; 106 : } 107 : 108 : unsigned int getSubchannelIndexFromPoint(const Point & p) const override; 109 : unsigned int channelIndex(const Point & point) const override; 110 : 111 321723564 : EChannelType getSubchannelType(unsigned int index) const override { return _subch_type[index]; } 112 : 113 35113440 : Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override 114 : { 115 35113440 : return _gij_map[axial_index][gap_index]; 116 : } 117 : 118 : /** 119 : * Set the gap width for a given axial cell and gap index 120 : */ 121 : void setGapWidth(unsigned int axial_index, unsigned int gap_index, Real gap_width) 122 : { 123 1800 : _gij_map[axial_index][gap_index] = gap_width; 124 1800 : } 125 : 126 : const std::pair<unsigned int, unsigned int> & getSweepFlowGaps(unsigned int i_chan) const 127 : { 128 : return _gap_pairs_sf[i_chan]; 129 : } 130 : 131 : const std::pair<unsigned int, unsigned int> & getSweepFlowChans(unsigned int i_chan) const 132 : { 133 883230 : return _chan_pairs_sf[i_chan]; 134 : } 135 : 136 303735 : const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override 137 : { 138 303735 : return _pin_to_chan_map[i_pin]; 139 : } 140 : 141 2217537 : const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override 142 : { 143 2217537 : return _chan_to_pin_map[i_chan]; 144 : } 145 : 146 : unsigned int getPinIndexFromPoint(const Point & p) const override; 147 : unsigned int pinIndex(const Point & p) const override; 148 : 149 : protected: 150 : /// number of fuel-pin rings, counting the center pin as the first ring 151 : unsigned int _n_rings; 152 : /// number of subchannels 153 : unsigned int _n_channels; 154 : /// the distance between flat surfaces of the duct facing each other 155 : Real _flat_to_flat; 156 : /// wire diameter 157 : Real _dwire; 158 : /// wire lead length 159 : Real _hwire; 160 : /// the gap thickness between the duct and peripheral fuel pins 161 : Real _duct_to_pin_gap; 162 : 163 : /// nodes 164 : std::vector<std::vector<Node *>> _nodes; 165 : /// pin nodes 166 : std::vector<std::vector<Node *>> _pin_nodes; 167 : 168 : /// stores the channel pairs for each gap 169 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map; 170 : /// stores the fuel pins belonging to each gap 171 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map; 172 : /// stores the gaps that forms each subchannel 173 : std::vector<std::vector<unsigned int>> _chan_to_gap_map; 174 : 175 : /// Defines the global cross-flow direction -1 or 1 for each subchannel and 176 : /// for all gaps that are belonging to the corresponding subchannel. 177 : /// Given a subchannel and a gap, if the neighbor subchannel index belonging to the same gap is 178 : /// lower, set it to -1, otherwise set it to 1. 179 : std::vector<std::vector<Real>> _sign_id_crossflow_map; 180 : 181 : /// gap size 182 : std::vector<std::vector<Real>> _gij_map; 183 : 184 : /// x,y coordinates of the fuel pins 185 : std::vector<Point> _pin_position; 186 : 187 : /// fuel pins that are belonging to each ring 188 : std::vector<std::vector<Real>> _pins_in_rings; 189 : 190 : /// stores the fuel pins belonging to each subchannel 191 : std::vector<std::vector<unsigned int>> _chan_to_pin_map; 192 : 193 : /// number of fuel pins 194 : unsigned int _npins; 195 : /// number of gaps 196 : unsigned int _n_gaps; 197 : 198 : /// subchannel type 199 : std::vector<EChannelType> _subch_type; 200 : /// gap type 201 : std::vector<EChannelType> _gap_type; 202 : 203 : /// sweeping flow model gap pairs per channel to specify directional edge flow 204 : std::vector<std::pair<unsigned int, unsigned int>> _gap_pairs_sf; 205 : /// sweeping flow model channel pairs to specify directional edge flow 206 : std::vector<std::pair<unsigned int, unsigned int>> _chan_pairs_sf; 207 : 208 : /// channel indices corresponding to a given pin index 209 : std::vector<std::vector<unsigned int>> _pin_to_chan_map; 210 : 211 : public: 212 : static InputParameters validParams(); 213 : 214 : /** 215 : * Calculates and stores the pin positions/centers for a hexagonal assembly 216 : * containing the given number of rings in a triangular/alternating row grid 217 : * spaced 'pitch' apart. The points are generated such that the duct is 218 : * centered at the given center point. 219 : */ 220 : static void 221 : pinPositions(std::vector<Point> & positions, unsigned int nrings, Real pitch, Point center); 222 : 223 : friend class SCMTriAssemblyMeshGenerator; 224 : friend class SCMTriDuctMeshGenerator; 225 : friend class SCMDetailedTriAssemblyMeshGenerator; 226 : 227 : /// number of corners in the duct x-sec 228 : static const unsigned int N_CORNERS = 6; 229 : };