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 517 : unsigned int getNumOfPins() const override { return processor_id() == 0 ? _npins : 0; } 40 : 41 6422649 : Node * getPinNode(unsigned int i_pin, unsigned int iz) const override 42 : { 43 6422649 : 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 rings 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 369116799 : Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override 80 : { 81 369116799 : return _nodes[i_chan][iz]; 82 : } 83 : 84 2041 : unsigned int getNumOfChannels() const override { return processor_id() == 0 ? _n_channels : 0; } 85 : 86 155 : unsigned int getNumOfGapsPerLayer() const override { return processor_id() == 0 ? _n_gaps : 0; } 87 : 88 65983080 : const std::pair<unsigned int, unsigned int> & getGapChannels(unsigned int i_gap) const override 89 : { 90 65983080 : 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 16604700 : const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override 99 : { 100 16604700 : return _chan_to_gap_map[i_chan]; 101 : } 102 : 103 64935392 : const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override 104 : { 105 64935392 : 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 333926880 : EChannelType getSubchannelType(unsigned int index) const override { return _subch_type[index]; } 112 : 113 37352940 : Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override 114 : { 115 37352940 : return _gij_map[axial_index][gap_index]; 116 : } 117 : 118 : const std::pair<unsigned int, unsigned int> & getSweepFlowGaps(unsigned int i_chan) const 119 : { 120 : return _gap_pairs_sf[i_chan]; 121 : } 122 : 123 : const std::pair<unsigned int, unsigned int> & getSweepFlowChans(unsigned int i_chan) const 124 : { 125 973500 : return _chan_pairs_sf[i_chan]; 126 : } 127 : 128 211248 : const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override 129 : { 130 211248 : return _pin_to_chan_map[i_pin]; 131 : } 132 : 133 1420143 : const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override 134 : { 135 1420143 : return _chan_to_pin_map[i_chan]; 136 : } 137 : 138 : unsigned int getPinIndexFromPoint(const Point & p) const override; 139 : unsigned int pinIndex(const Point & p) const override; 140 : 141 : protected: 142 : /// number of rings of fuel pins 143 : unsigned int _n_rings; 144 : /// number of subchannels 145 : unsigned int _n_channels; 146 : /// the distance between flat surfaces of the duct facing each other 147 : Real _flat_to_flat; 148 : /// wire diameter 149 : Real _dwire; 150 : /// wire lead length 151 : Real _hwire; 152 : /// the gap thickness between the duct and peripheral fuel pins 153 : Real _duct_to_pin_gap; 154 : 155 : /// nodes 156 : std::vector<std::vector<Node *>> _nodes; 157 : /// pin nodes 158 : std::vector<std::vector<Node *>> _pin_nodes; 159 : 160 : /// stores the channel pairs for each gap 161 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map; 162 : /// stores the fuel pins belonging to each gap 163 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map; 164 : /// stores the gaps that forms each subchannel 165 : std::vector<std::vector<unsigned int>> _chan_to_gap_map; 166 : 167 : /// Defines the global cross-flow direction -1 or 1 for each subchannel and 168 : /// for all gaps that are belonging to the corresponding subchannel. 169 : /// Given a subchannel and a gap, if the neighbor subchannel index belonging to the same gap is 170 : /// lower, set it to -1, otherwise set it to 1. 171 : std::vector<std::vector<Real>> _sign_id_crossflow_map; 172 : 173 : /// gap size 174 : std::vector<std::vector<Real>> _gij_map; 175 : 176 : /// x,y coordinates of the fuel pins 177 : std::vector<Point> _pin_position; 178 : 179 : /// fuel pins that are belonging to each ring 180 : std::vector<std::vector<Real>> _pins_in_rings; 181 : 182 : /// stores the fuel pins belonging to each subchannel 183 : std::vector<std::vector<unsigned int>> _chan_to_pin_map; 184 : 185 : /// number of fuel pins 186 : unsigned int _npins; 187 : /// number of gaps 188 : unsigned int _n_gaps; 189 : 190 : /// subchannel type 191 : std::vector<EChannelType> _subch_type; 192 : /// gap type 193 : std::vector<EChannelType> _gap_type; 194 : 195 : /// sweeping flow model gap pairs per channel to specify directional edge flow 196 : std::vector<std::pair<unsigned int, unsigned int>> _gap_pairs_sf; 197 : /// sweeping flow model channel pairs to specify directional edge flow 198 : std::vector<std::pair<unsigned int, unsigned int>> _chan_pairs_sf; 199 : 200 : /// channel indices corresponding to a given pin index 201 : std::vector<std::vector<unsigned int>> _pin_to_chan_map; 202 : 203 : public: 204 : static InputParameters validParams(); 205 : 206 : /** 207 : * Calculates and stores the pin positions/centers for a hexagonal assembly 208 : * containing the given number of rings in a triangular/alternating row grid 209 : * spaced 'pitch' apart. The points are generated such that the duct is 210 : * centered at the given center point. 211 : */ 212 : static void 213 : pinPositions(std::vector<Point> & positions, unsigned int nrings, Real pitch, Point center); 214 : 215 : friend class SCMTriSubChannelMeshGenerator; 216 : friend class SCMTriDuctMeshGenerator; 217 : friend class SCMTriPinMeshGenerator; 218 : friend class SCMDetailedTriPinMeshGenerator; 219 : friend class TriSubChannel1PhaseProblem; 220 : 221 : /// number of corners in the duct x-sec 222 : static const unsigned int N_CORNERS = 6; 223 : };