LCOV - code coverage report
Current view: top level - src/userobjects - HexagonalSubchannelGapBin.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: f3518d Lines: 36 42 85.7 %
Date: 2025-10-01 10:06:53 Functions: 5 7 71.4 %
Legend: Lines: hit not hit

          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          34 :                                                0. /*rotation_around_axis*/));
      60             : 
      61          34 :   if (_axis == 0) // x vertical axis
      62           0 :     _directions = {1, 2};
      63          34 :   else if (_axis == 1) // y vertical axis
      64           0 :     _directions = {0, 2};
      65             :   else // z vertical axis
      66          34 :     _directions = {0, 1};
      67             : 
      68             :   // the bin centers are the gap centers
      69             :   const auto & gap_centers = _hex_lattice->gapCenters();
      70        1282 :   for (const auto & gap : gap_centers)
      71        1248 :     _bin_centers.push_back(gap);
      72          34 : }
      73             : 
      74             : unsigned int
      75     4571342 : HexagonalSubchannelGapBin::bin(const Point & p) const
      76             : {
      77     4571342 :   return _hex_lattice->gapIndex(p);
      78             : }
      79             : 
      80             : unsigned int
      81      210736 : HexagonalSubchannelGapBin::num_bins() const
      82             : {
      83      210736 :   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    86853024 : HexagonalSubchannelGapBin::gapIndexAndDistance(const Point & point,
     101             :                                                unsigned int & index,
     102             :                                                Real & distance) const
     103             : {
     104    86853024 :   _hex_lattice->gapIndexAndDistance(point, index, distance);
     105    86853024 : }

Generated by: LCOV version 1.14