Skip to content

Regression test: Nitsche boundary tangent for anisotropic stress at the FD floor (issue #239) - #509

Merged
lmoresi merged 1 commit into
developmentfrom
bugfix/nitsche-ti-239
Aug 8, 2026
Merged

Regression test: Nitsche boundary tangent for anisotropic stress at the FD floor (issue #239)#509
lmoresi merged 1 commit into
developmentfrom
bugfix/nitsche-ti-239

Conversation

@lmoresi

Copy link
Copy Markdown
Member

Test-only. Pins the resolution of #239 on current development.

The 7% snes_test_jacobian inconsistency for Nitsche + transverse isotropy was the boundary uu_G1 (the block carrying the Nitsche consistency traction σ(u)·n) assembled as its fc/gc transpose by the old permutedims translation — 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 boundary uu_G1 against 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

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)/∂L matches 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.

@lmoresi
lmoresi merged commit c79572d into developmentAug 8, 2026
3 checks passed
@lmoresi
lmoresi deleted the bugfix/nitsche-ti-239 branch August 8, 2026 03:49
Sign up for freeto 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.

2 participants

@lmoresi