Repository navigation
Pair boundary quadrature points by face orientation on 3-D triangular faces (#1188) - #1195
Conversation
Five exact checks of boundary terms on faces not at orientation 0 in their cell: the first moment of a natural load, the moments of its Jacobian, the moment of a boundary integral, a Nitsche condition with a radial normal under a rigid rotation, and an internal load assembled from either support cell. All five fail on development (aee3fa6): 0.66567 for 2/3, 0.49899 for 1/2, 0.33283 for 1/3, 1.5e-2 of the scale, and 534 of 534 loaded nodes moved. Underworld development team with AI support from Claude Code
… faces (#1188) PETSc's boundary residual, Jacobian and integral pair the physical point of face quadrature point q with the cell's face tabulation at q (reversed for a negative orientation). On a triangular face at any orientation other than 0 the two are different points, so a term written in the coordinates is evaluated at one point and spread with the basis of another. uw_face_orientation.h wraps PETSc's own three integrators on each FE of a 3-D simplex mesh. For each face at orientation o != 0 it rewrites the face's affine map so that q lands at the point of the cell's tabulation, hands the face over at orientation 0, calls PETSc's integrator and restores the face. The orientation maps come from PETSc's reference triangle. Faces at 0 and 2-D meshes are untouched. The install refuses, on every rank together, a 3-D mesh with coordinates of degree other than 1 and a face cell type other than a triangle. The TODO(BUG) on internal natural conditions in the SNES solvers described this defect (the 0.027 % of #265 was the 3-D internal-boundary shell); it is replaced by a statement of what now holds. Underworld development team with AI support from Claude Code
|
Adversarial review record, pre-PR. A fresh reviewer read the diff against the PETSc 3.25.3 and main sources (febasic.c, fe.c, fegeom.c, plexfem.c, dtds.c, dmfield.c) and ran its own probes. We applied its findings before the PR; each is listed with what was done.
Confirmed by the reviewer:
Points the hub raised, answered before the PR:
Issue state:
Underworld development team with AI support from Claude Code |
|
Verdict: READY with conditions at 7cc95a1. The fix does what it says in parallel. On the #1150 shell, np 8 now matches np 1 to round-off, including the face whose two cells sit on different ranks. Two random partitions that split up to 478 of the 540 Internal faces also match np 1 to round-off. 2-D is bit-identical to development. The conditions are small:
Parallel review by H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)), at 8 cores. Logs are kept by the reviewer. Builds.
1. The PR's five testsSerial, on the branch: 5 passed in 18 s. Serial, on development (the branch's test file run on the development build): all 5 fail, as the PR says.
Parallel, file as committed: SEGV at np 2 and np 4, on both builds.
Parallel, with a parallel-safe copy. The table's np 2 / 4 / 8 columns come from a copy of the file with the test logic unchanged and these edits:
With those edits, all 5 pass at np 2, 4 and 8 with no change in tolerance. The swap test on its own cannot reach a partition seam: on this mesh no Internal face is split at np ≤ 8. Section 2 covers the seam. 2. #1150's probes, np 1, 2, 4 and 8, both buildsInternal load by node (
Multiplier unknowns and residual moments (
The #1150 headline solve (
3. 2-D against development, np 2 and 4Two cases:
Results:
4. Install-time refusals on a rank with no cellsThere are three refusals, all
How they were triggered:
5. Custom multigrid on a refined 3-D shellThe case:
Issues settled
What passed
What was not run
Conditions
Underworld development team with AI support from Claude Code |
The test file segfaulted under mpirun at np 2 and above, on development as well: a rank holding none of a boundary's faces called getIndices on an empty stratum. It now guards the empty stratum, takes its counts and maxima over all ranks, and swaps only the Internal faces whose two cells are on the rank. scripts/test.sh runs it at np 4 in the test_* mpirun phase. DMPlexIsSimplex is false on a rank with no cells, so that rank returned before the triangle-quadrature refusal while the others raised. The ranks now agree on the flag over the DM's communicator before the early return. Underworld development team with AI support from Claude Code
|
Both conditions are fixed in 5332029.
The PR body now lists #1150 as fixed by this branch, citing H1's numbers. Underworld development team with AI support from Claude Code |
The default partition splits no Internal face of #1150's shell at np 4, so CI never reached #1150's case. A sixth check deals the shell's cells to the ranks at random (seeds 1 and 2, a shell partitioner set where the plex is read, before distribution) and compares the moments of the Internal load, summed over every rank, with the default partition's to 1e-13 of their scale. Under MPI it asserts that each random partition splits some face. The reference is taken in the same run: gmsh builds a slightly different shell on different machines (3220 cells here, 3241 on our Linux workstation), so a stored baseline would not hold. On one rank the three partitions are one; with the supports swapped instead, the largest moment moves by 3.4e-3 on development and 1.1e-16 on this branch. Underworld development team with AI support from Claude Code
|
bfb9b6c adds a sixth check, so that CI reaches #1150's case: the default partition splits no Internal face of #1150's shell at np 4. How it works.
Why the reference is taken in the same run, not stored.
Sensitivity, one rank.
np 2, 4 and 8 on both builds is for H1 to run. Underworld development team with AI support from Claude Code |
|
Re-check of #1195 at bfb9b6c: READY. Both conditions are met. From H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)), on a build of the head. The new partition case (
The whole file on the branch ( The install-time refusals at np 8, with a rank that holds no cells.
The triangle refusal is now collective: A note on how this was measured, so others don't fall into the same trap.
#1150 stays settled, as measured at 7cc95a1. The only compiled change since is the Underworld development team with AI support from Claude Code |
What this fixes
In 3-D, PETSc's boundary residual, boundary Jacobian and boundary integral pair two different points on a triangular face whose orientation in its cell is not 0. They read the coordinates at the physical point of face quadrature point q, and the basis and fields at the cell's tabulation point q. A triangle has six orientations. A refined mesh puts about a fifth of its wall faces at orientations other than 0, and an interior face assembled from its second cell sits at a negative one. On those faces, a term written in the coordinates (a load, a radial normal) is evaluated at one point and spread with the basis of another. The total of a load stays right but its moments do not, and an internal load depends on which of a face's two cells assembles it. In parallel, the partition decides which cell that is. 2-D is not affected: an edge has only two orientations, and the reversal PETSc applies is correct for it.
Issue #1188 has the diagnosis and a PETSc-only reproducer.
The change
src/underworld3/cython/uw_face_orientation.hwraps PETSc's own three boundary integrators (integratebdresidual,integratebdjacobian,integratebd) on each FE of a 3-D simplex mesh.DMPlexOrientPointon it).It is installed after each
createDSin the scalar, vector, multi-component and Stokes solvers, and on theBdIntegralsandbox. The coarse multigrid levels and the adjoint share these FE objects.The install refuses two cases with
PETSC_ERR_SUP, collectively on the mesh's communicator. The ranks first agree whether the mesh is a simplex mesh, since a rank with no cells does not see one:Inside the wrapper, PETSc-internal assertions check what the install guarantees: affine faces, an auxiliary field on the cells, and orientations in range before any face is changed.
The TODO(BUG) on internal natural conditions in
petsc_generic_snes_solvers.pyxdescribed this defect: the 0.027 % in #265 was the 3-D internal-boundary shell. It is replaced by a statement of what now holds.docs/developer/guides/boundary-condition-rulings.mdgains a paragraph saying the same, and that hexahedral faces are not covered.Tests
tests/test_1188_boundary_terms_on_rotated_faces.py(level 1, tier B) has five checks. Each first asserts that its fixture has faces at orientations other than 0.BdIntegralof T x with T = x over TopThe test was committed first (35583db), and all five fail on development. The file runs serially and, from
scripts/test.sh, under mpirun at np 4. A rank may hold none of a boundary's faces, so counts and maxima are taken over all ranks.Coordinate matches: none in the library. The swap test compares rows by position after asserting that the two coordinate arrays are exactly equal, since both builds use one mesh. The internal-surface faces are selected by boundary label.
Not covered by the Python tests:
Measured, one rank, conda-forge PETSc 3.25.3, macOS on a 12-core Apple M4 (serial runs only)
PETSc-only reproducer with the wrapper, 135 runs. Largest error over the exact moments, for walls that are whole planes:
2-D is unchanged.
Unit cube, natural load against the exact integral: 163 of 369 nodes wrong at refinement 1 and 864 of 1409 at refinement 2 on development. None are wrong on this branch.
Nitsche with a radial normal, rigid rotation on a shell: 1.5e-2 to 2.9e-16 at refinement 1, and 9.2e-3 to 5.4e-16 at refinement 2. The face-normal and default-normal results are unchanged.
Kramer, Davies & Wilson (2021), delta-forced Stokes on a shell with an internal surface (l = 2, m = 0, free boundaries):
The errors move by about 0.3 % of themselves. Discretisation error dominates this benchmark, so it does not show the defect, and no result we have published moves.
Cost: the boundary share of assembly (with loads on all three shell surfaces minus without), best of 5, at refinement 2 (153472 cells, 19200 boundary faces, 6270 not at 0):
These are laptop wall times, and the differences are within the run-to-run spread.
Suites: 186 passed across the 3-D boundary, shell, Nitsche, rotated free-slip, multigrid, adjoint and boundary-flux files, and
test_0052(collective guard scan).check_test_coverage.pyandcheck_deprecated_patterns.pypass.Probes and outputs are in the campaigns repository, under
issue-sweep/internal-face-orientation/(includingsideload/). The draft PETSc report, with this as its proposed fix, is underupstream/and has not been sent.Parallel
H1 (the session that runs our parallel checks on a 96-thread Linux workstation, MPICH) ran the branch at np 1 to 8. Its review is on this PR.
Stokes_Constrainedsolve at np 8 agrees with np 4 to 1.8e-8 relative in L2, within the solver tolerance. On development the difference is 1.55e-5.H1 set two conditions, both fixed in 5332029:
Issues
fixed-in-PR. Hexahedral faces are left open on it.fixed-in-PR.Underworld development team with AI support from Claude Code