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 : #include "SubChannelEnums.h" 14 : 15 : /** 16 : * Creates the mesh of subchannels in a quadrilateral lattice. 17 : */ 18 : class QuadSubChannelMesh : public SubChannelMesh 19 : { 20 : public: 21 : QuadSubChannelMesh(const InputParameters & parameters); 22 : QuadSubChannelMesh(const QuadSubChannelMesh & other_mesh); 23 : virtual std::unique_ptr<MooseMesh> safeClone() const override; 24 : virtual void buildMesh() override; 25 : 26 478719183 : virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override 27 : { 28 478719183 : return _nodes[i_chan][iz]; 29 : } 30 : 31 1720908 : virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override 32 : { 33 1720908 : return _pin_nodes[i_pin][iz]; 34 : } 35 : 36 : /** 37 : * Duct functions not applicable to quad channel 38 : * 39 : * Over-writing to avoid abstract template definition in this class 40 : */ 41 : ///@{ 42 0 : virtual Node * getChanNodeFromDuct(Node *) override { return nullptr; } 43 0 : virtual Node * getDuctNodeFromChannel(Node *) override { return nullptr; } 44 0 : virtual Node * getChannelNodeFromDuct(Node *) override { return nullptr; } 45 0 : virtual const std::vector<Node *> getDuctNodes() const override { return std::vector<Node *>(); } 46 : ///@} 47 : 48 550 : virtual const unsigned int & getNumOfChannels() const override { return _n_channels; } 49 142 : virtual const unsigned int & getNumOfGapsPerLayer() const override { return _n_gaps; } 50 142 : virtual const unsigned int & getNumOfPins() const override { return _n_pins; } 51 64872 : virtual bool pinMeshExist() const override { return _pin_mesh_exist; } 52 142 : virtual bool ductMeshExist() const override { return false; } 53 : virtual const std::pair<unsigned int, unsigned int> & 54 90755808 : getGapChannels(unsigned int i_gap) const override 55 : { 56 90755808 : return _gap_to_chan_map[i_gap]; 57 : } 58 : virtual const std::pair<unsigned int, unsigned int> & 59 22680 : getGapPins(unsigned int i_gap) const override 60 : { 61 22680 : return _gap_to_pin_map[i_gap]; 62 : } 63 26944512 : virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override 64 : { 65 26944512 : return _chan_to_gap_map[i_chan]; 66 : } 67 21508 : virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override 68 : { 69 21508 : return _pin_to_chan_map[i_pin]; 70 : } 71 322926 : virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override 72 : { 73 322926 : return _chan_to_pin_map[i_chan]; 74 : } 75 6580944 : virtual const Real & getPitch() const override { return _pitch; } 76 98840088 : virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override 77 : { 78 98840088 : return _sign_id_crossflow_map[i_chan][i_local]; 79 : } 80 : /// Number of subchannels in the -x direction 81 4992 : virtual const unsigned int & getNx() const { return _nx; } 82 : /// Number of subchannels in the -y direction 83 528 : virtual const unsigned int & getNy() const { return _ny; } 84 : /** 85 : * Returns the side gap, not to be confused with the gap between pins, this refers to the gap 86 : * next to the duct. Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m] 87 : */ 88 : const Real & getSideGap() const { return _side_gap; } 89 : 90 : unsigned int getSubchannelIndexFromPoint(const Point & p) const override; 91 : virtual unsigned int channelIndex(const Point & point) const override; 92 : 93 : unsigned int getPinIndexFromPoint(const Point & p) const override; 94 : virtual unsigned int pinIndex(const Point & p) const override; 95 : 96 2636738 : virtual EChannelType getSubchannelType(unsigned int index) const override 97 : { 98 2636738 : return _subch_type[index]; 99 : } 100 : 101 46616976 : virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override 102 : { 103 46616976 : return _gij_map[axial_index][gap_index]; 104 : } 105 : 106 : protected: 107 : /// number of subchannels in the x direction 108 : unsigned int _nx; 109 : /// number of subchannels in the y direction 110 : unsigned int _ny; 111 : /// number of subchannels in total 112 : unsigned int _n_channels; 113 : /// Number of gaps per layer 114 : unsigned int _n_gaps; 115 : /// Number of pins 116 : unsigned int _n_pins; 117 : /** 118 : * The side gap, not to be confused with the gap between pins, this refers to the gap 119 : * next to the duct or else the distance between the subchannel centroid to the duct wall. 120 : * Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m] 121 : */ 122 : Real _side_gap; 123 : /// vector of subchannel nodes 124 : std::vector<std::vector<Node *>> _nodes; 125 : /// vector of fuel pin nodes 126 : std::vector<std::vector<Node *>> _pin_nodes; 127 : /// vector of gap (interface between pairs of neighboring subchannels) nodes 128 : std::vector<std::vector<Node *>> _gapnodes; 129 : /// map relating gap index to subchannel index 130 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map; 131 : /// map relating gap index to fuel pin index 132 : std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map; 133 : /// map relating subchannel index to gap index 134 : std::vector<std::vector<unsigned int>> _chan_to_gap_map; 135 : /// map relating subchannel index to fuel pin index 136 : std::vector<std::vector<unsigned int>> _chan_to_pin_map; 137 : /// map relating fuel pin index to subchannel index 138 : std::vector<std::vector<unsigned int>> _pin_to_chan_map; 139 : /// Matrix used to give local sign to crossflow quantities 140 : std::vector<std::vector<double>> _sign_id_crossflow_map; 141 : /// Vector to store gap size 142 : std::vector<std::vector<Real>> _gij_map; 143 : /// Subchannel type 144 : std::vector<EChannelType> _subch_type; 145 : /// Flag that informs the solver whether there is a Pin Mesh or not 146 : bool _pin_mesh_exist; 147 : 148 : public: 149 : static InputParameters validParams(); 150 : 151 : /** 152 : * Generate pin centers 153 : * 154 : * @param nx number of channels in x-direction (must be more than 1) 155 : * @param ny number of channels in y-direction (must be more than 1) 156 : * @param elev elevation in z-direction 157 : * @param pin_centers Positions in 3D space of pin centers 158 : */ 159 : static void generatePinCenters( 160 : unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector<Point> & pin_centers); 161 : 162 : friend class SCMQuadSubChannelMeshGenerator; 163 : friend class SCMQuadPinMeshGenerator; 164 : friend class QuadSubChannel1PhaseProblem; 165 : };