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 : /** 15 : * Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies 16 : */ 17 : class TriSubChannelMesh : public SubChannelMesh 18 : { 19 : public: 20 : TriSubChannelMesh(const InputParameters & parameters); 21 : TriSubChannelMesh(const TriSubChannelMesh & other_mesh); 22 : virtual std::unique_ptr<MooseMesh> safeClone() const override; 23 : virtual void buildMesh() override; 24 : 25 543 : virtual unsigned int getNumOfPins() const override { return processor_id() == 0 ? _npins : 0; } 26 : 27 3074854 : virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override 28 : { 29 3074854 : return _pin_nodes[i_pin][iz]; 30 : } 31 : 32 311456 : virtual bool pinMeshExist() const override { return _pin_mesh_exist; } 33 158 : virtual bool ductMeshExist() const override { return _duct_mesh_exist; } 34 : 35 : /** 36 : * Return the the gap thickness between the duct and peripheral fuel pins 37 : */ 38 14882733 : virtual const Real & getDuctToPinGap() const { return _duct_to_pin_gap; } 39 : 40 : /** 41 : * Return the number of rings 42 : */ 43 9 : virtual const unsigned int & getNumOfRings() const { return _n_rings; } 44 : 45 : /** 46 : * Return Pin index given subchannel index and local neighbor index 47 : */ 48 0 : virtual const unsigned int & getPinIndex(const unsigned int channel_idx, 49 : const unsigned int neighbor_idx) 50 : { 51 0 : return _chan_to_pin_map[channel_idx][neighbor_idx]; 52 : } 53 : 54 : /** 55 : * Return wire diameter 56 : */ 57 23453895 : virtual const Real & getWireDiameter() const { return _dwire; } 58 : 59 : /** 60 : * Return flat to flat [m] 61 : */ 62 9 : virtual const Real & getFlatToFlat() const { return _flat_to_flat; } 63 : 64 : /** 65 : * Return the wire lead length 66 : */ 67 23453895 : virtual const Real & getWireLeadLength() const { return _hwire; } 68 : 69 431164050 : virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override 70 : { 71 431164050 : return _nodes[i_chan][iz]; 72 : } 73 2471 : virtual unsigned int getNumOfChannels() const override 74 : { 75 2471 : return processor_id() == 0 ? _n_channels : 0; 76 : } 77 158 : virtual unsigned int getNumOfGapsPerLayer() const override 78 : { 79 158 : return processor_id() == 0 ? _n_gaps : 0; 80 : } 81 : virtual const std::pair<unsigned int, unsigned int> & 82 79183800 : getGapChannels(unsigned int i_gap) const override 83 : { 84 79183800 : return _gap_to_chan_map[i_gap]; 85 : } 86 : virtual const std::pair<unsigned int, unsigned int> & 87 170748 : getGapPins(unsigned int i_gap) const override 88 : { 89 170748 : return _gap_to_pin_map[i_gap]; 90 : } 91 20090196 : virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override 92 : { 93 20090196 : return _chan_to_gap_map[i_chan]; 94 : } 95 76630968 : virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override 96 : { 97 76630968 : return _sign_id_crossflow_map[i_chan][i_local]; 98 : } 99 : 100 : virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const override; 101 : virtual unsigned int channelIndex(const Point & point) const override; 102 : 103 296942796 : virtual EChannelType getSubchannelType(unsigned int index) const override 104 : { 105 296942796 : return _subch_type[index]; 106 : } 107 : 108 59641560 : virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override 109 : { 110 59641560 : return _gij_map[axial_index][gap_index]; 111 : } 112 : 113 0 : virtual const std::pair<unsigned int, unsigned int> & getSweepFlowGaps(unsigned int i_chan) const 114 : { 115 0 : return _gap_pairs_sf[i_chan]; 116 : } 117 : 118 1396080 : virtual const std::pair<unsigned int, unsigned int> & getSweepFlowChans(unsigned int i_chan) const 119 : { 120 1396080 : return _chan_pairs_sf[i_chan]; 121 : } 122 : 123 47322 : virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override 124 : { 125 47322 : return _pin_to_chan_map[i_pin]; 126 : } 127 : 128 666612 : virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override 129 : { 130 666612 : return _chan_to_pin_map[i_chan]; 131 : } 132 : 133 : virtual unsigned int getPinIndexFromPoint(const Point & p) const override; 134 : virtual unsigned int pinIndex(const Point & p) const override; 135 : 136 : /** 137 : * Function that gets the channel node from the duct node 138 : */ 139 : void setChannelToDuctMaps(const std::vector<Node *> & duct_nodes); 140 : 141 : /** 142 : * Function that gets the duct node from the channel node 143 : */ 144 60480 : virtual Node * getDuctNodeFromChannel(Node * channel_node) override 145 : { 146 60480 : return _chan_to_duct_node_map[channel_node]; 147 : } 148 : 149 : /** 150 : * Function that gets the channel node from the duct node 151 : */ 152 6156 : virtual Node * getChannelNodeFromDuct(Node * channel_node) override 153 : { 154 6156 : return _duct_node_to_chan_map[channel_node]; 155 : } 156 : 157 : /** 158 : * Function that return the vector with the maps to the nodes 159 : */ 160 30 : virtual const std::vector<Node *> getDuctNodes() const override { return _duct_nodes; } 161 : 162 : protected: 163 : /// number of rings of fuel pins 164 : unsigned int _n_rings; 165 : /// number of subchannels 166 : unsigned int _n_channels; 167 : /// the distance between flat surfaces of the duct facing each other 168 : Real _flat_to_flat; 169 : /// wire diameter 170 : Real _dwire; 171 : /// wire lead length 172 : Real _hwire; 173 : /// the gap thickness between the duct and peripheral fuel pins 174 : Real _duct_to_pin_gap; 175 : /// nodes 176 : std::vector<std::vector<Node *>> _nodes; 177 : /// pin nodes 178 : std::vector<std::vector<Node *>> _pin_nodes; 179 : 180 : /// A list of all mesh nodes that form the (elements of) the hexagonal duct 181 : /// mesh that surrounds the pins/subchannels. 182 : std::vector<Node *> _duct_nodes; 183 : /// A map for providing the closest/corresponding duct node associated 184 : /// with each subchannel node. i.e. a map of subchannel mesh nodes to duct mesh nodes. 185 : std::map<Node *, Node *> _chan_to_duct_node_map; 186 : /// A map for providing the closest/corresponding subchannel node associated 187 : /// with each duct node. i.e. a map of duct mesh nodes to subchannel mesh nodes. 188 : std::map<Node *, Node *> _duct_node_to_chan_map; 189 : 190 : /// stores the channel pairs for each gap 191 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map; 192 : /// stores the fuel pins belonging to each gap 193 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map; 194 : /// stores the gaps that forms each subchannel 195 : std::vector<std::vector<unsigned int>> _chan_to_gap_map; 196 : /// Defines the global cross-flow direction -1 or 1 for each subchannel and 197 : /// for all gaps that are belonging to the corresponding subchannel. 198 : /// Given a subchannel and a gap, if the neighbor subchannel index belonging to the same gap is lower, 199 : /// set it to -1, otherwise set it to 1. 200 : std::vector<std::vector<Real>> _sign_id_crossflow_map; 201 : /// gap size 202 : std::vector<std::vector<Real>> _gij_map; 203 : /// x,y coordinates of the fuel pins 204 : std::vector<Point> _pin_position; 205 : /// fuel pins that are belonging to each ring 206 : std::vector<std::vector<Real>> _pins_in_rings; 207 : /// stores the fuel pins belonging to each subchannel 208 : std::vector<std::vector<unsigned int>> _chan_to_pin_map; 209 : /// number of fuel pins 210 : unsigned int _npins; 211 : /// number of gaps 212 : unsigned int _n_gaps; 213 : /// subchannel type 214 : std::vector<EChannelType> _subch_type; 215 : /// gap type 216 : std::vector<EChannelType> _gap_type; 217 : /// sweeping flow model gap pairs per channel to specify directional edge flow 218 : std::vector<std::pair<unsigned int, unsigned int>> _gap_pairs_sf; 219 : /// sweeping flow model channel pairs to specify directional edge flow 220 : std::vector<std::pair<unsigned int, unsigned int>> _chan_pairs_sf; 221 : /// TODO: channel indices corresponding to a given pin index 222 : std::vector<std::vector<unsigned int>> _pin_to_chan_map; 223 : /// Flag that informs the solver whether there is a Pin Mesh or not 224 : bool _pin_mesh_exist; 225 : /// Flag that informs the solver whether there is a Duct Mesh or not 226 : bool _duct_mesh_exist; 227 : 228 : public: 229 : static InputParameters validParams(); 230 : 231 : /** 232 : * Calculates and stores the pin positions/centers for a hexagonal assembly 233 : * containing the given number of rings in a triangular/alternating row grid 234 : * spaced 'pitch' apart. The points are generated such that the duct is 235 : * centered at the given center point. 236 : */ 237 : static void 238 : rodPositions(std::vector<Point> & positions, unsigned int nrings, Real pitch, Point center); 239 : 240 : friend class SCMTriSubChannelMeshGenerator; 241 : friend class SCMTriDuctMeshGenerator; 242 : friend class SCMTriPinMeshGenerator; 243 : friend class SCMDetailedTriPinMeshGenerator; 244 : friend class TriSubChannel1PhaseProblem; 245 : 246 : /// number of corners in the duct x-sec 247 : static const unsigned int N_CORNERS = 6; 248 : };