Skip to content

Commit

Permalink
Merge pull request #27053 from lewisgross1296/hexgrid_ring_fix
Browse files Browse the repository at this point in the history
Fix off-by-one error in HexagonalGridPositions.C
  • Loading branch information
GiudGiud authored Aug 10, 2024
2 parents 55dca4d + 36ea7dd commit b5af7eb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
17 changes: 14 additions & 3 deletions modules/reactor/src/positions/HexagonalGridPositions.C
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,20 @@ HexagonalGridPositions::HexagonalGridPositions(const InputParameters & parameter
std::set<unsigned int>(getParam<std::vector<unsigned int>>("include_in_pattern").begin(),
getParam<std::vector<unsigned int>>("include_in_pattern").end()))
{
if (MooseUtils::absoluteFuzzyGreaterThan(_nr * _pin_pitch * sqrt(3), _lattice_flat_to_flat))
paramError("lattice_flat_to_flat",
"Bundle pitch is too small to fit this many rings at that pin pitch");
if (_nr == 1)
{
if (MooseUtils::absoluteFuzzyGreaterThan(_pin_pitch, _lattice_flat_to_flat))
paramError("lattice_flat_to_flat",
"For one ring, the lattice flat to flat must be at least the pin pitch");
}
else
{
if (MooseUtils::absoluteFuzzyGreaterThan((3 * _nr - 1) * _pin_pitch / sqrt(3),
_lattice_flat_to_flat))
paramError("lattice_flat_to_flat",
"Lattice flat to flat distance is less than the minimum (3 * nr - 1) * pin_pitch "
"/ sqrt(3) given nr rings with a pitch of pin_pitch");
}
if ((_include_in_pattern.empty() && _pattern.size()) ||
(_include_in_pattern.size() && _pattern.empty()))
paramError(
Expand Down
18 changes: 18 additions & 0 deletions modules/reactor/test/tests/positions/tests
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,22 @@
detail = 'a three-dimensional cartesian grid with some positions excluded.'
[]
[]

[errors]
requirement = "The system shall error"
[1ring_too_big]
type = RunException
input = 'hexagonal_grid_positions.i'
cli_args = "Positions/hex_grid/nr=1 Positions/hex_grid/lattice_flat_to_flat=0.49"
expect_err = "For one ring, the lattice flat to flat must be at least the pin pitch"
detail = 'if the hexagonal lattice flat-to-flat specified is too small for a single pin to fit,'
[]
[more_rings_too_big]
type = RunException
input = 'hexagonal_grid_positions.i'
cli_args = "Positions/hex_grid/lattice_flat_to_flat=1.43"
expect_err = "Lattice flat to flat distance is less than the minimum"
detail = 'and if the hexagonal lattice flat-to-flat specified is too small for the rings of pins to fit.'
[]
[]
[]

0 comments on commit b5af7eb

Please sign in to comment.