Line data Source code
1 : /********************************************************************/ 2 : /* SOFTWARE COPYRIGHT NOTIFICATION */ 3 : /* Cardinal */ 4 : /* */ 5 : /* (c) 2021 UChicago Argonne, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /* */ 8 : /* Prepared by UChicago Argonne, LLC */ 9 : /* Under Contract No. DE-AC02-06CH11357 */ 10 : /* With the U. S. Department of Energy */ 11 : /* */ 12 : /* Prepared by Battelle Energy Alliance, LLC */ 13 : /* Under Contract No. DE-AC07-05ID14517 */ 14 : /* With the U. S. Department of Energy */ 15 : /* */ 16 : /* See LICENSE for full restrictions */ 17 : /********************************************************************/ 18 : 19 : #include "HexagonalSubchannelBin.h" 20 : 21 : registerMooseObject("CardinalApp", HexagonalSubchannelBin); 22 : 23 : InputParameters 24 159 : HexagonalSubchannelBin::validParams() 25 : { 26 159 : InputParameters params = SpatialBinUserObject::validParams(); 27 318 : params.addRequiredRangeCheckedParam<Real>( 28 : "bundle_pitch", "bundle_pitch > 0", "Bundle pitch, or flat-to-flat distance across bundle"); 29 318 : params.addRequiredRangeCheckedParam<Real>( 30 : "pin_pitch", "pin_pitch > 0", "Pin pitch, or distance between pin centers"); 31 318 : params.addRequiredRangeCheckedParam<Real>( 32 : "pin_diameter", "pin_diameter > 0", "Pin outer diameter"); 33 318 : params.addRequiredRangeCheckedParam<unsigned int>( 34 : "n_rings", "n_rings >= 1", "Number of pin rings, including the centermost pin as a 'ring'"); 35 318 : params.addParam<bool>( 36 : "pin_centered_bins", 37 318 : false, 38 : "Whether the bins should be channel-centered (false) or pin-centered (true)"); 39 : 40 318 : MooseEnum directions("x y z", "z"); 41 318 : params.addParam<MooseEnum>( 42 : "axis", directions, "vertical axis of the reactor (x, y, or z) along which pins are aligned"); 43 159 : params.addClassDescription( 44 : "Creates a unique spatial bin for each subchannel in a hexagonal lattice"); 45 159 : return params; 46 159 : } 47 : 48 79 : HexagonalSubchannelBin::HexagonalSubchannelBin(const InputParameters & parameters) 49 : : SpatialBinUserObject(parameters), 50 79 : _bundle_pitch(getParam<Real>("bundle_pitch")), 51 158 : _pin_pitch(getParam<Real>("pin_pitch")), 52 158 : _pin_diameter(getParam<Real>("pin_diameter")), 53 158 : _n_rings(getParam<unsigned int>("n_rings")), 54 79 : _axis(parameters.get<MooseEnum>("axis")), 55 237 : _pin_centered_bins(getParam<bool>("pin_centered_bins")) 56 : { 57 79 : _hex_lattice.reset(new HexagonalLatticeUtils(_bundle_pitch, 58 79 : _pin_pitch, 59 79 : _pin_diameter, 60 : 0.0 /* wire diameter, unused */, 61 : 1.0 /* wire pitch, unused */, 62 79 : _n_rings, 63 79 : _axis)); 64 : 65 79 : if (_axis == 0) // x vertical axis 66 0 : _directions = {1, 2}; 67 79 : else if (_axis == 1) // y vertical axis 68 0 : _directions = {0, 2}; 69 : else // z vertical axis 70 79 : _directions = {0, 1}; 71 : 72 79 : if (_pin_centered_bins) 73 : { 74 : // the bin centers are the pin centroids 75 368 : for (const auto & p : _hex_lattice->pinCenters()) 76 340 : _bin_centers.push_back(p); 77 : 78 : // except for the last bin, which is just the enclosing region; we 79 : // just pick one point in this region 80 : Real x; 81 28 : if (_n_rings % 2 == 0) 82 : x = 0.0; 83 : else 84 12 : x = 0.5 * _hex_lattice->pinPitch(); 85 : 86 28 : Point leftover(x, _bundle_pitch / 2.0 - _hex_lattice->pinBundleSpacing() / 2.0, 0.0); 87 28 : _bin_centers.push_back(leftover); 88 : } 89 : else 90 : { 91 : // the bin centers are the channel centroids 92 573 : for (unsigned int i = 0; i < _hex_lattice->nInteriorChannels(); ++i) 93 : { 94 522 : auto corners = _hex_lattice->interiorChannelCornerCoordinates(i); 95 1044 : _bin_centers.push_back(_hex_lattice->channelCentroid(corners)); 96 : } 97 : 98 429 : for (unsigned int i = 0; i < _hex_lattice->nEdgeChannels(); ++i) 99 : { 100 378 : auto corners = _hex_lattice->edgeChannelCornerCoordinates(i); 101 756 : _bin_centers.push_back(_hex_lattice->channelCentroid(corners)); 102 : } 103 : 104 357 : for (unsigned int i = 0; i < _hex_lattice->nCornerChannels(); ++i) 105 : { 106 306 : auto corners = _hex_lattice->cornerChannelCornerCoordinates(i); 107 612 : _bin_centers.push_back(_hex_lattice->channelCentroid(corners)); 108 : } 109 : } 110 79 : } 111 : 112 : unsigned int 113 49066410 : HexagonalSubchannelBin::bin(const Point & p) const 114 : { 115 49066410 : if (_pin_centered_bins) 116 131680 : return _hex_lattice->pinIndex(p); 117 : else 118 48934730 : return _hex_lattice->channelIndex(p); 119 : } 120 : 121 : unsigned int 122 59293 : HexagonalSubchannelBin::num_bins() const 123 : { 124 59293 : if (_pin_centered_bins) 125 76 : return _hex_lattice->nPins() + 1; 126 : else 127 59217 : return _hex_lattice->nChannels(); 128 : }