From 931fab066269ac80e46d465f25ca7f7dd9775606 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 20 Jan 2025 07:52:48 -0800 Subject: [PATCH] Use a looser tolerance on pitch for HexGrid roughly equal check We don't need a super strict check to make sure the grids are roughly equal. The ideal of the method is to check that one index location in one grid would be in approximately the same spatial location in the other grid. Otherwise we can't accurately rotate the position within the grid. This problem came up in some shuffling work where two assemblies had ever so slightly different pitches, on the order of hundreths of a percent. The strict `other.pitch == self.pitch` failed even though, for the purposes of this method, the two grids are "roughly equal" --- armi/reactor/grids/hexagonal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armi/reactor/grids/hexagonal.py b/armi/reactor/grids/hexagonal.py index 262307826..d33db9cd2 100644 --- a/armi/reactor/grids/hexagonal.py +++ b/armi/reactor/grids/hexagonal.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections import deque -from math import sqrt +from math import sqrt, isclose from typing import List, Optional, Tuple import numpy as np @@ -639,6 +639,6 @@ def _roughlyEqual(self, other) -> bool: return True return ( isinstance(other, HexGrid) - and other.pitch == self.pitch + and isclose(self.pitch, other.pitch) and other.cornersUp == self.cornersUp )