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