-
Couldn't load subscription status.
- Fork 299
Enable disconnected neighbor detection across disconnected boundary pairs in libMesh #4283
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
base: devel
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this, in principle, and the MOOSE test failures should be trivial to fix. Hopefully the distributed unit test sweep failures won't be much harder.
e5f64ed to
120b7c1
Compare
|
Do we have discussion of the problem motivating this anywhere on Github that we can link to, for future reference? I know there's been multiple discussions of the "MOOSE can abuse neighbor pointers" issue somewhere, but I can't recall whether any were here rather than on Slack or over video. I'm not sure how relevant the discussions would be, because IIRC in most of them my opinion had been "we should come up with a different mechanism for MOOSE to use instead of |
|
Ooh. One thing I missed in the review: this has a good chance of failing in interesting ways as soon as we use it in the presence of refined elements on either side of the pseudo-neighbor links, doesn't it? And we don't have any coverage of that, do we? We need another unit test or two; it'd probably be adequate to just refactor your existing test but refine both elements in the second test and refine just one element in the third. |
|
Thank you, @roystgnr ! I tried to add MOOSE #12033 and MOOSE #21161 to the Motivation section of the PR so that others can easily look up the historical context. |
|
Gah, I forgot to re-activate CI for you. Sorry! I'm going to have you sent an Associates team invite so any future pushes can auto-activate CI. |
|
Jobs manually activated, hopefully the last time that's necessary; let me know if the invite doesn't get to you or gives you any problems. |
|
I'm also adding a few optional recipes that I'm not 100% sure will pass; I don't want to merge if this passes here only to find we have to fix something up for our devel->master merges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only definite fix we need is for that random whitespace futzing that got left around.
Oh, but we might also need to #ifdef LIBMESH_HAVE_SOLVER around those tests, since they involve a solve(); I'm not sure any of our regular recipes use such a decimated libMesh, but better safe than sorry.
src/base/periodic_boundaries.C
Outdated
| (e->processor_id() == mesh.processor_id()), | ||
| "Periodic boundary neighbor not found"); | ||
| (e->processor_id() == mesh.processor_id()), | ||
| "Periodic boundary neighbor not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any substantive changes left in periodic_boundaries.C? You can revert the whitespace regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I will revert it! Thanks, @roystgnr!
BTW, I have received the Associates team invite. Thanks!
src/mesh/unstructured_mesh.C
Outdated
| element->neighbor_ptr(ms) != remote_elem) | ||
| continue; | ||
|
|
||
| for (const auto & [id, boundary_ptr] : *db) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wow - speaking of whitespace issues. The first build failure I looked at (and probably most of the rest) was from a -Werror=misleading-indentation warning:
this 'if' clause does not guard... [-Werror=misleading-indentation]
if (element->neighbor_ptr(ms) != nullptr &&
^~
../src/mesh/unstructured_mesh.C:1018:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
for (const auto & [id, boundary_ptr] : *db)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to fix the indent here in the commit 64e4597. Thanks!
99faccb to
64e4597
Compare
|
Well, the good news is that the invite went through and CI is autorunning now. The bad news is that we're failing multiple recipes. "Test mac" is a red herring, but the distributed-mesh test looks like a real failure and I can't even imagine what is going on in the --disable-amr and --disable-deprecated tests. |
|
Thank you, Roy, for your feedback. I think this issue is related to whether disconnected elements are being added as ghosted elements. I recently implemented a RelationshipManager in MOOSE, which allows me to properly handle disconnected neighbors on distributed meshes. However, this functionality is not yet available on the libMesh side. I plan to add a GhostingFunctor for disconnected neighbors in libMesh to see if that resolves the issue. Thanks again for taking the time to look into this. |
1a50621 to
a8a8602
Compare
…n also access them. (b) add geometry-based detection of disconnected neighbors via paired boundaries - Introduced `Elem::geometrically_equal()` for tolerance-based geometric comparison of elements. - Replaced `_has_disconnected_neighbor` with `_boundary_id_pairs` for boundary-pair registration. - Updated `UnstructuredMesh::find_neighbors()` to auto-detect disconnected neighbors using geometric matching and paired boundaries.
- Introduced PeriodicBoundaries::disconnected_neighbor() to locate geometrically coincident elements across disconnected boundaries using PointLocator. - Replaced legacy geometry-based neighbor search in UnstructuredMesh::find_neighbors() with unified PeriodicBoundaries-based logic.
- Moved new MeshBase functions out of the header to use forward declarations, reducing unnecessary includes. - Reverted the PeriodicBoundaries::neighbor() logic to allow self-matching, since the existing boundary ID check already prevents unintended self-detections in periodic boundary cases.
(a) Revert periodic BC source file (b) Fix indentation in UnstructuredMesh::find_neighbors and wrap tests (c) involving solve() in DisconnectedNeighborTest with #ifdef LIBMESH_HAVE_SOLVER guards to ensure correct conditional compilation.
The DisconnectedNeighborTest::testTempJump fails in certain CI environments (e.g., 'Test No AMR' recipe), potentially due to issues with the default solver/preconditioner selection, numerical errors (0 vs 0.05), or SEGVs observed in logs. To attempt to bypass these issues and diagnose the failure, this commit explicitly sets the linear solver to GMRES and no preconditioner.
Introduce `include_internal_boundary` switch to `side_with_boundary_id()` so we can locate boundaries even when a neighbor exists (e.g. manually disconnected interfaces). This fixes interface-side lookup in the temperature jump CZM-style test without requiring AMR fallback. Updated the test to explicitly use include_internal_boundary=true for interface IDs.
…l interface support This change introduces correct handling of intentionally disconnected interfaces (e.g., CZM or jump conditions) on distributed meshes: - Replace ID-based lookup in `MapBasedDisconnectedGhosting` with direct `Elem*` neighbor mapping to avoid invalid lookups post-renumbering. - Register the disconnected ghosting functor in `find_neighbors()` so ghosting stays consistent with the neighbor graph established by `prepare_for_use()`. - Extend `BoundaryInfo::side_with_boundary_id()` to optionally allow internal/logical boundaries when explicitly requested by the caller. - Fix face FE assembly under `--disable-deprecated` by explicitly requesting shape and map computations before reinit() calls. - Remove older per-test ghosting setup now handled by the mesh.
a8a8602 to
0bcdbb4
Compare
Restore previous behavior in `side_with_boundary_id()`. When AMR is disabled, internal boundaries incorrectly returned invalid_uint. Add fallback return for non-external sides. Add `testInternalBoundary()` to verify correct side detection on a QUAD4 mesh. Update `disconnected_neighbor_test` to use default API.
This commit removes the `map_based_disconnected_ghosting` implementation and fully migrates the build/runtime logic to `disconnected_neighbor_coupling`.
- Remove map_based_disconnected_ghosting.{h,C} and all associated build rules
- Add disconnected_neighbor_coupling.{h,C} into all Makefile targets
- Drop ghosting implementation in UnstructuredMesh::find_neighbors()
- Update tests to use `DisconnectedNeighborCoupling` directly
- Enable fine-mesh test (testTempJumpRefine)
0adca9c to
6708c6d
Compare
a7b9cfb to
71680c0
Compare
- Ensure boundary ID is added to a locally owned elem - Select valid left-bottom elem with neighbor for internal side
Motivation
Currently, libMesh assumes physical continuity (base on node ID) between neighboring elements, which limits its ability to handle cases where two regions share coincident boundaries but are geometrically disconnected -- for instance, across interfaces with discontinuous fields or temperature jumps.
This PR introduces a mechanism to explicitly register disconnected boundary pairs, enabling the framework to reconstruct logical neighbor relationships even when elements are not directly connected in the mesh topology (base on node ID).
This functionality is particularly relevant for methods such as the Cohesive Zone Method (CZM), where field continuity is enforced weakly across interfaces.
This work is motivated by long-standing MOOSE discussions about “fake” or “pseudo” neighbors -- element pairs that were once topological neighbors but become disconnected due to node replacement (e.g., in
BreakMeshByBlockGenerator).See the following issues for historical context:
This PR effectively formalizes that capability at the libMesh level, turning what was previously a MOOSE-side workaround into a supported feature.
Design
MeshBase(add_disconnected_boundaries()andget_disconnected_boundaries()) that allows users to register and access disconnected boundary pairs. These pairs are stored asPeriodicBoundariesobjects and used during neighbor search to establish logical connections between geometrically separated regions.UnstructuredMesh::find_neighbors()to detect and link virtual (fake, or disconnected) neighbors across disconnected interfaces (boundaries). A new regression test (disconnected_neighbor_test.C) verifies correct neighbor mapping and demonstrates a temperature-jump interface problem that matches the analytical solution.Impact
Facilitates coupling between subdomains separated by non-matching meshes or duplicated boundaries.