Skip to content

Conversation

@dschwen
Copy link
Member

@dschwen dschwen commented Oct 30, 2025

Reason

When using patch_update_strategy=iteration with dynamic mesh changes (e.g., ElementSubdomainModifier changing element subdomains), NearestNodeLocator fails in parallel
with the error: "The nearest neighbor lies outside the ghosted set of elements."

This occurs because:

  1. Subdomain changes can cause boundary nodes to appear/disappear on contact surfaces
  2. Geometric search validation checks if elements are ghosted BEFORE the deferred ghosting is applied
  3. In parallel, the validation tries to access processor_id() of elements that aren't yet ghosted, causing false errors

The issue is particularly problematic for problems with:

  • Moving phase boundaries tracked by ElementSubdomainModifier
  • Contact constraints on boundaries affected by subdomain changes
  • Multi-processor simulations with iteration-based patch updates

Design

Replace overly strict ghosting validation in NearestNodeLocator::findNodes() and NearestNodeLocator::updatePatch() with a more appropriate check:

Previous validation (too strict):

  • Checked if elements were in the current ghosted set (ghost) OR pending ghosting set (new_ghost)
  • Attempted to query processor_id() of elements that may not be accessible yet
  • Failed for elements correctly computed for ghosting but not yet applied

New validation (appropriate):

  • Only validates that elements are accessible (not remote_elem or nullptr)
  • Trusts that the ghosting patch computation is correct
  • Defers strict validation until ghosting is actually applied by the framework

Additionally:

  • Track pending ghosted elements in new_ghost set initialized from _new_ghosted_elems
  • Accumulate newly computed ghosting into new_ghost for proper tracking across iterations

Impact

API Changes: None - this is an internal fix to validation logic

Behavior Changes:

  • More lenient validation that allows deferred ghosting to work correctly in parallel
  • Eliminates false positive errors when boundaries change dynamically
  • Maintains safety by still catching truly inaccessible elements

User Impact:

  • Users with patch_update_strategy=iteration and dynamic boundaries (ElementSubdomainModifier, phase field, etc.) will no longer see spurious ghosting errors in parallel
  • No input file changes required
  • patch_update_strategy=always users see no change (already worked)

Testing:

  • Fixes parallel failures in contact problems with subdomain changes
  • Serial behavior unchanged
  • All existing tests should pass

@moosebuild
Copy link
Contributor

Job Test, step Results summary on 0561c0c wanted to post the following:

Framework test summary

Compared against d8769bb in job civet.inl.gov/job/3367375.

Removed tests

Added tests

Run time changes

Modules test summary

Compared against d8769bb in job civet.inl.gov/job/3367375.

Removed tests

Added tests

Run time changes

@moosebuild
Copy link
Contributor

Job Documentation, step Docs: sync website on 0561c0c wanted to post the following:

View the site here

This comment will be updated on new commits.

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