Repository navigation
Label shell Inner/Outer cells by connectivity, not centroid radius - #1100
Conversation
Replace centroid-radius classification with wall-seeded connected components blocked by the tagged internal surface. Exchange partition-facet/component data without gathering the mesh; preserve overlap and empty-rank consistency and reject invalid topology. Gadi reproduced a real outer tetrahedron with all four vertices on r=2 and centroid r=1.99706. Raw Gmsh tags are correct; the prior classification was not. Five synthetic tests pass serial/MPI8 through source bootstrap, and the exact failing raw mesh gives 64410 inner and 38484 outer cells with all 7968 interface faces separating regions on both partitions. Fresh installed-package gates follow. Underworld development team with AI support from Claude Code (cherry picked from commit 2da2843)
… in parallel Two refinements of SphericalShellInternalBoundary leave new Internal vertices on the chords of the coarse surface. A cell just outside that surface has its centroid below radiusInternal, and development's radius test labels it Inner: 1363 cells on the test mesh, so 1363 Internal facets have Inner cells on both sides. The new test asserts two exact properties: every Internal facet separates an Inner cell from an Outer cell, and the Inner count is 64 times the unrefined one. The file moves to tests/parallel/ under a free number (1175; 1107 is taken on development) and gets a serial batch line too: its assertions do not depend on the rank count. Underworld development team with AI support from Claude Code
Adversarial review of #1100 (H3, second review desk)Verdict: READY at 8b60c56, on green CI (one shard was still running). The connectivity labelling is correct and collective-safe in every case we built. Two Low test gaps. Reviewed against development Findings
C1's three checks
Attacks that failed
IssuesWe found no open issue for the mislabelling. #1033 (gthyagi's) carries the same commit. Not testedRanks above 5; a 3-D shell where a region has no wall facet on any rank except via many hops; the 42-minute Underworld development team with AI support from Claude Code |
SphericalShellInternalBoundarylabels its Inner and Outer cells by comparing each cell's centroid radius withradiusInternal. That is wrong for a cell that lies outside the faceted internal surface but has its centroid inside the sphere. This PR labels the cells by connectivity instead: start from the cells on the Lower and Upper walls and spread, never crossing an Internal facet.The fix is @gthyagi's, cut out of #1033 as a unit of its own (his commit
2da28433, cherry-picked ontodevelopmentwith authorship kept; it touched only these three files). He found the case on Gadi: a tetrahedron with four vertices at r = 2 and its centroid at r = 1.99706.The defect on development
On unrefined meshes we could not reproduce it on our host (12 shells, no mislabelled cell). With two refinements it is systematic: refinement leaves new Internal vertices on the chords of the coarse surface, so cells just outside it have centroids below
radiusInternal.Shell 0.547 / 0.8 / 1.0, cell size 0.3,
refinement=2(98,112 cells, 4,096 Internal facets):extract_region("Inner")on development therefore returns 1,363 cells from the wrong side.What we added
assert 2733 == 4096), in serial and at np 3.tests/parallel/test_1175_shell_region_labels.py(1107 is taken on development) with a serial batch line as well; its assertions do not depend on the rank count.What changes for users
Every
SphericalShellInternalBoundarynow runs the connectivity labelling at construction, in parallel too. It raises, collectively, if a wall or Internal label is missing, if the Internal surface does not separate the walls, or if a region is empty. Unrefined meshes we probed get the same labels as before.Verification (hyperion, PETSc int32, MPICH 5.0.1, head 8b60c56)
tests/parallel/test_1175at np 1, 2, 3, 4, 5extract_region(test_0001,0502,0771,0772,1018_rotated_freeslip,1064,1070)test_0770_submesh_extract_mpi(2 failures)test_0770at np 3 on developmentscripts/check_test_coverage.pyNot reviewed in depth yet: the cost of the labelling at large rank counts (it exchanges Python lists with
alltoalleach sweep), and np above 5.Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)
level_*andtier_*markers (S8)maybe_/try_/do_) and no commented-out code (S3, S4).array/mesh.X.coords— nowith ....access(...), nomesh.data(S7)pixi.toml/pixi.lockor other dependency changes riding in an unrelated PRUnderworld development team with AI support from Claude Code