Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a looser tolerance on pitch for HexGrid roughly equal check #2058

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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"
  • Loading branch information
drewj-tp committed Jan 20, 2025
commit 401b40232b50be910c1027595e936291ad4a59c0
4 changes: 2 additions & 2 deletions armi/reactor/grids/hexagonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 isclose, sqrt
from typing import List, Optional, Tuple

import numpy as np
Expand Down Expand Up @@ -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, rel_tol=1e-4)
and other.cornersUp == self.cornersUp
)