Skip to content

Fix non-deterministic boundary node ordering in panel-type constraints#464

Open
timryanb wants to merge 1 commit into
smdogroup:masterfrom
timryanb:non-determ-fix
Open

Fix non-deterministic boundary node ordering in panel-type constraints#464
timryanb wants to merge 1 commit into
smdogroup:masterfrom
timryanb:non-determ-fix

Conversation

@timryanb

Copy link
Copy Markdown
Collaborator

_getComponentBoundaryNodes built the boundary edge list by calling list() on a set difference (allEdges - dupEdges). Python set iteration order is an implementation detail that varies with Python version — the tuple hash algorithm changed between 3.7 and 3.8 — so the "first" boundary edge, and therefore the rotational ordering of the resulting node chain, was not guaranteed to be the same across environments.

This caused tests that compare ordered constraint-value arrays against hardcoded references to fail on CI while passing locally when the two environments ran different Python versions.

Change: Replace list(allEdges - dupEdges) with sorted(allEdges - dupEdges). Sorting by (min_node_id, max_node_id) is entirely deterministic regardless of Python version or hash seed, and has no effect on correctness — boundary node connectivity is unchanged, only the starting point of the traversal is now fixed.

@timryanb timryanb requested review from A-CGray and eirikurj July 10, 2026 15:01
funcsSens[key][self.coordName] = self.funcsSens[key].copy()
self.constraintsSensUpToDate[conName] = True

def _getComponentBoundaryNodes(self, compIDs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave it up to you whether you want to do this in this PR, but I feel like we should move this method to the meshloader class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants