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 79 : 0. /*rotation_around_axis*/)); 65 : 66 79 : if (_axis == 0) // x vertical axis 67 0 : _directions = {1, 2}; 68 79 : else if (_axis == 1) // y vertical axis 69 0 : _directions = {0, 2}; 70 : else // z vertical axis 71 79 : _directions = {0, 1}; 72 : 73 79 : if (_pin_centered_bins) 74 : { 75 : // the bin centers are the pin centroids 76 368 : for (const auto & p : _hex_lattice->pinCenters()) 77 340 : _bin_centers.push_back(p); 78 : 79 : // except for the last bin, which is just the enclosing region; we 80 : // just pick one point in this region 81 : Real x; 82 28 : if (_n_rings % 2 == 0) 83 : x = 0.0; 84 : else 85 12 : x = 0.5 * _hex_lattice->pinPitch(); 86 : 87 28 : Point leftover(x, _bundle_pitch / 2.0 - _hex_lattice->pinBundleSpacing() / 2.0, 0.0); 88 28 : _bin_centers.push_back(leftover); 89 : } 90 : else 91 : { 92 : // the bin centers are the channel centroids 93 573 : for (unsigned int i = 0; i < _hex_lattice->nInteriorChannels(); ++i) 94 : { 95 522 : auto corners = _hex_lattice->interiorChannelCornerCoordinates(i); 96 522 : _bin_centers.push_back(_hex_lattice->channelCentroid(corners)); 97 522 : } 98 : 99 429 : for (unsigned int i = 0; i < _hex_lattice->nEdgeChannels(); ++i) 100 : { 101 378 : auto corners = _hex_lattice->edgeChannelCornerCoordinates(i); 102 378 : _bin_centers.push_back(_hex_lattice->channelCentroid(corners)); 103 378 : } 104 : 105 357 : for (unsigned int i = 0; i < _hex_lattice->nCornerChannels(); ++i) 106 : { 107 306 : auto corners = _hex_lattice->cornerChannelCornerCoordinates(i); 108 306 : _bin_centers.push_back(_hex_lattice->channelCentroid(corners)); 109 306 : } 110 : } 111 79 : } 112 : 113 : unsigned int 114 49066410 : HexagonalSubchannelBin::bin(const Point & p) const 115 : { 116 49066410 : if (_pin_centered_bins) 117 131680 : return _hex_lattice->pinIndex(p); 118 : else 119 48934730 : return _hex_lattice->channelIndex(p); 120 : } 121 : 122 : unsigned int 123 59293 : HexagonalSubchannelBin::num_bins() const 124 : { 125 59293 : if (_pin_centered_bins) 126 76 : return _hex_lattice->nPins() + 1; 127 : else 128 59217 : return _hex_lattice->nChannels(); 129 : }