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 "HexagonalSubchannelGapBin.h"
20 :
21 : registerMooseObject("CardinalApp", HexagonalSubchannelGapBin);
22 :
23 : InputParameters
24 68 : HexagonalSubchannelGapBin::validParams()
25 : {
26 68 : InputParameters params = PlaneSpatialBinUserObject::validParams();
27 136 : params.addRequiredRangeCheckedParam<Real>(
28 : "bundle_pitch", "bundle_pitch > 0", "Bundle pitch, or flat-to-flat distance across bundle");
29 136 : params.addRequiredRangeCheckedParam<Real>(
30 : "pin_pitch", "pin_pitch > 0", "Pin pitch, or distance between pin centers");
31 136 : params.addRequiredRangeCheckedParam<Real>(
32 : "pin_diameter", "pin_diameter > 0", "Pin outer diameter");
33 136 : params.addRequiredRangeCheckedParam<unsigned int>(
34 : "n_rings", "n_rings >= 1", "Number of pin rings, including the centermost pin as a 'ring'");
35 :
36 136 : MooseEnum directions("x y z", "z");
37 136 : params.addParam<MooseEnum>(
38 : "axis", directions, "vertical axis of the reactor (x, y, or z) along which pins are aligned");
39 68 : params.addClassDescription(
40 : "Creates a unique spatial bin for each subchannel in a hexagonal lattice");
41 68 : return params;
42 68 : }
43 :
44 34 : HexagonalSubchannelGapBin::HexagonalSubchannelGapBin(const InputParameters & parameters)
45 : : PlaneSpatialBinUserObject(parameters),
46 34 : _bundle_pitch(getParam<Real>("bundle_pitch")),
47 68 : _pin_pitch(getParam<Real>("pin_pitch")),
48 68 : _pin_diameter(getParam<Real>("pin_diameter")),
49 68 : _n_rings(getParam<unsigned int>("n_rings")),
50 68 : _axis(parameters.get<MooseEnum>("axis"))
51 : {
52 34 : _hex_lattice.reset(new HexagonalLatticeUtils(_bundle_pitch,
53 34 : _pin_pitch,
54 34 : _pin_diameter,
55 : 0.0 /* wire diameter, unused */,
56 : 1.0 /* wire pitch, unused */,
57 34 : _n_rings,
58 34 : _axis));
59 :
60 34 : if (_axis == 0) // x vertical axis
61 0 : _directions = {1, 2};
62 34 : else if (_axis == 1) // y vertical axis
63 0 : _directions = {0, 2};
64 : else // z vertical axis
65 34 : _directions = {0, 1};
66 :
67 : // the bin centers are the gap centers
68 : const auto & gap_centers = _hex_lattice->gapCenters();
69 1282 : for (const auto & gap : gap_centers)
70 1248 : _bin_centers.push_back(gap);
71 34 : }
72 :
73 : unsigned int
74 4571342 : HexagonalSubchannelGapBin::bin(const Point & p) const
75 : {
76 4571342 : return _hex_lattice->gapIndex(p);
77 : }
78 :
79 : unsigned int
80 210736 : HexagonalSubchannelGapBin::num_bins() const
81 : {
82 210736 : return _hex_lattice->nGaps();
83 : }
84 :
85 : Real
86 0 : HexagonalSubchannelGapBin::distanceFromGap(const Point & point,
87 : const unsigned int & gap_index) const
88 : {
89 0 : return _hex_lattice->distanceFromGap(point, gap_index);
90 : }
91 :
92 : unsigned int
93 0 : HexagonalSubchannelGapBin::gapIndex(const Point & point) const
94 : {
95 0 : return _hex_lattice->gapIndex(point);
96 : }
97 :
98 : void
99 86853024 : HexagonalSubchannelGapBin::gapIndexAndDistance(const Point & point,
100 : unsigned int & index,
101 : Real & distance) const
102 : {
103 86853024 : _hex_lattice->gapIndexAndDistance(point, index, distance);
104 86853024 : }
|