Skip to content

bugfix: Avoid PETSc IS size query during boundary rebuild#287

Open
gthyagi wants to merge 1 commit into
underworldcode:release/v3.1.0from
gthyagi:bugfix/imported-dmplex-boundary-is
Open

bugfix: Avoid PETSc IS size query during boundary rebuild#287
gthyagi wants to merge 1 commit into
underworldcode:release/v3.1.0from
gthyagi:bugfix/imported-dmplex-boundary-is

Conversation

@gthyagi

@gthyagi gthyagi commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #285.

This changes the UW_Boundaries rebuild in _dm_unstack_bcs() to test the returned PETSc IS object by truthiness instead of calling getSize() before setting the stratum.

Root cause

Imported DMPlex meshes can include non-boundary labels such as an Elements / cell-region label. During boundary label reconstruction, label.getStratumIS() may return an empty or otherwise problematic PETSc IS for those labels. Calling label_is.getSize() on that object can trigger a PETSc-level abort before the Stokes system is assembled, which is what issue #285 reports for tests/test_1012_stokesImportedDMPlex.py::test_stokes_essential_bc_imported_dmplex.

The new check follows the existing safer PETSc-object truthiness pattern and avoids dereferencing the IS only to determine whether it is usable.

Validation

  • ./uw build
  • PYTHONFAULTHANDLER=1 ./uw python -X faulthandler -m pytest tests/test_1012_stokesImportedDMPlex.py::test_stokes_essential_bc_imported_dmplex -ra -vv -s passed
  • ./uw python -m pytest tests/test_1012_stokesImportedDMPlex.py tests/test_0502_boundary_integrals.py -ra -q passed: 23 passed
  • ./uw python -m pytest tests/test_0001_meshes.py tests/test_0830_mesh_adapt_variable_transfer.py -ra -q passed: 16 passed, 5 skipped
  • ./uw python -m pytest tests/test_1001_poisson_constants.py -ra -q passed: 6 passed
  • ./uw test completed with unrelated existing failures in memprobe/kdtree and AMR swarm migration tests: 6 failed, 618 passed, 14 skipped, 753 deselected, 7 xfailed, 1 xpassed

Notes

The patch is intentionally minimal: it preserves _dm_unstack_bcs() label reconstruction behavior while avoiding the PETSc IS.getSize() call that reproduces the segfault path.

@gthyagi gthyagi requested a review from jcgraciosa June 26, 2026 03:42
@gthyagi gthyagi marked this pull request as ready for review June 26, 2026 03:43
@gthyagi gthyagi requested a review from lmoresi as a code owner June 26, 2026 03:43
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.

1 participant