Uh oh!
There was an error while loading. Please reload this page.
Regression test: Nitsche boundary tangent for anisotropic stress at the FD floor (issue #239) - #509
Merged
Merged
Conversation
The 7% snes_test_jacobian defect reported for annulus + Nitsche + transverse isotropy was the boundary form of the #457 layout bug: the Nitsche consistency term injects the constitutive traction sigma(u).n into the boundary f0, and its uu_G1 (= d f0/dL) — the first boundary block with non-trivial fc/gc structure — was assembled as its fc/gc transpose by the old permutedims form. PR #493's explicit-index boundary loops fixed it: re-measured on current development, all four issue configurations sit at the FD floor (annulus+Nitsche+TI: 0.069 -> 2.4e-11) and Newton converges in one step. Add the regression test with the file's FD-oracle pattern: the assembled boundary uu_G1 must match a central-difference derivative of the boundary residual read through PETSc's [fc*Nc+gc, dg] convention, with a guard that the TI oracle block is genuinely fc/gc-asymmetric (a transposed read fails at 0.65 rel — verified) and an isotropic control. The scalar-viscosity symmetry/penalty terms flagged as mechanism 2 in the issue are internally consistent (residual and Jacobian derive from the same expression) — a non-standard Nitsche variant for anisotropy, not a tangent inconsistency; documented in the test module docstring. Underworld development team with AI support from Claude Code
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a regression test to pin the fix for issue #239 (Nitsche boundary Jacobian layout for anisotropic constitutive models) on the current development branch by comparing the assembled Nitsche boundary uu_G1 block against a finite-difference oracle derived from the boundary residual.
Changes:
- Extend the existing Stokes Jacobian layout regression test module docstring to document issue #239 and how it relates to the earlier layout defect class.
- Add an annulus + Nitsche free-slip setup helper for both TI (anisotropic) and isotropic cases.
- Add a new parametrized test that checks
uu_G1 = ∂(boundary f0)/∂Lmatches a central-difference oracle, with an anisotropy guard to ensure the test can detect an fc/gc transpose.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test-only. Pins the resolution of #239 on current development.
The 7%
snes_test_jacobianinconsistency for Nitsche + transverse isotropy was the boundaryuu_G1(the block carrying the Nitsche consistency traction σ(u)·n) assembled as its fc/gc transpose by the oldpermutedimstranslation — the #457/#493 defect class, invisible to isotropic stress because that block is fc/gc-symmetric. #493's explicit-index boundary loops fixed it: annulus + Nitsche + TI now measures 2.4e-11 (was 0.069) and Newton converges in 1 iteration (was ~23 oscillating).The new tests (
test_nitsche_boundary_uu_g1_matches_fd_oracle[ti|iso]) compare the assembled Nitsche boundaryuu_G1against an FD oracle of the boundary residual through PETSc's[fc*Nc+gc, dg]convention, with a built-in guard that the TI oracle block is genuinely fc/gc-asymmetric so the test cannot pass by symmetry (negative control: a transposed read fails at 0.65 rel).Gate:
pytest tests -m "level_1 and tier_a"→ 557 passed, 0 failed (the two new tests included).Underworld development team with AI support from Claude Code