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