Repository navigation
Stokes_Constrained: keep the section's symmetries when the multipliers are pinned (P3 velocity 26% low) - #1250
Conversation
…s are pinned The section rebuilt to constrain the multipliers' interior dofs copied dofs and constraints field by field but not the field symmetries, which orient the dofs of a point a cell sees reversed. A P3 edge has two dofs, so every cell next to a reversed edge read its velocity in the wrong order: the constrained solve with a P3 velocity was 26% below the essential-wall one (found in the review of #1200). copy_section_symmetries gives the new section the old one's. Also: the SolverReset docstring says discretisation() drops the nullspace objects (#1203 review nit). Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict on 76c55a0: ready to merge on green from this review.
How it was runBuilds:
Every parallel run was under the MPI supervisor with a timeout, pinned to four cores. Findings
1. The #1200 probe: constraint against essential wallsSetup:
Measured: max |v| for each solve, and the L2 norm of the difference of the two velocity fields relative to the essential field's L2 norm. This branch's figures are identical at np 1, 2 and 3:
Rank with no cells: we used the region held by rank 0 from
The rebuild and 2. No regression for P2We reran the eight-case bit-identity comparison from the #1200 review, twice per build at np 1 and 2. It covers:
Results:
3. The symmetry copy
The rebuild was the only place in the solvers that builds a DOF section field by field for an FE field. The other 4. Collectives
5. The SolverReset docstring lineIt is accurate. What was run
The 22 serial files were 0033, 0062, 0786, 0818, 1010, 1011, 1012, 1013 (x2), 1014 (x2), 1017, 1019, 1023, 1024, 1050, 1061, 1062, 1063, 1064, 1065 and 1066. They ran with Not run:
Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
Stokes_Constrained with a P3 velocity was wrong by about 26%; the rebuilt section lost its field symmetries.
Found by H1 (the session that reviews pull requests) in item 3 of the review of #1200, and present on development. Not filed: the maintainer asked for it to be fixed directly, so this text is the report.
The defect
Holding the side walls' normal velocity by
add_constraint_bcposes the same problem as holding it byadd_essential_bc((0.0, None), ...).Unit box, Bottom no-slip, Left and Right normal held, body force (0, cos(πx)(1+y)), P3 velocity and P2 pressure, on development:
How the deficit behaves:
The cause
_constrain_interior_multipliers_in_sectionpins the multipliers' dofs away from their boundary. It does this by building a new local section, field by field, from the old one, then callingdm.setLocalSection. It copied the dofs and the constraints, but not the section's symmetries.A field's symmetry (
PetscSectionSym, set from the dual space when the DS builds the section) orients the dofs of a point that a cell sees in reversed orientation.With the reduction switched off (
_reduce_interior_multiplier = False), the P3 constrained solve equals the essential solution. That isolates the cause to the rebuilt section.The fix
A small
cdefhelper,copy_section_symmetries(source, target), inpetsc_extras.pxi. It copies the section-level symmetry and each field's symmetry (PetscSectionGet/SetSym,PetscSectionGet/SetFieldSym; petsc4py does not expose them). The reduction calls it beforesetUp().The other places that build a section by hand (
fault_split,_vertex_section_dm, the smoothing graph) hold cell or vertex values only, so they have no multi-dof points to orient.After the fix, as relative max velocity differences, constrained against essential:
Test
tests/parallel/test_1200_constrained_stokes_p3_velocity_parallel.py, tier B, in batch 3 ofscripts/test.sh. It compares the whole constrained velocity field against the essential-wall field, for quads and simplices, and for P2 and P3 multipliers. The tolerance is 1e-6 of the scale for the P3 multiplier and 1e-5 for the P2.Also in this PR
The
SolverResetdocstring now says thatdiscretisation()(and soconditions()) drops the nullspace objects, a nit from the review of #1203.Runs
Side finding, not this PR:
test_1061_stress_forward_history::test_the_forward_history_with_its_read_back_smoothing_holds_the_maxwell_start_upfails on this host.abs(0.5265 - 0.5185) = 0.0080, against a tolerance of 0.003, in 67 minutes. It failed twice, on the build before and after the merge.NavierStokeswithout constraint conditions, so the changed section rebuild returns before it does anything.Measured on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).
Underworld development team with AI support from Claude Code