Skip to content

2D boundary-flux recovery: degree-3 traces return silently WRONG flux (P3 edge DOFs collapse onto one coordinate key) #459

Description

@lmoresi

Found by the PR #456 adversarial review, pre-existing (byte-identical wrong values on development before that batch — not a regression from the P1/P2 dispatch fix).

Defect

boundary_flux on a 2D wall with a degree-3 field returns finite but wrong values: probe measured flux in the range −0.57…−0.74 against an exact −1.0. Mechanism: both P3 edge DOFs report the same edge-point coordinate from the coordinate section, so _key() collapses them onto one dictionary key in nodeR — one reaction silently overwrites the other — and the recovery then proceeds down the P2 (vertex-midpoint-vertex) path as if nothing were wrong. The new mixed-trace guard cannot catch it because the keys collapse cleanly.

Fix direction

_desmear should reject traces whose field reports more boundary DOFs than distinct coordinate keys (a cheap, exact detection of the collapse), or explicitly reject trace degree > 2 with a legible NotImplementedError, until a genuine P3 line-mass is worth implementing.

Probe: pr456_probes/probe3_p3_trace.py / probe3b_p3_old_vs_new.py from the review session (session scratchpad; reproduce with a degree-3 Poisson on a StructuredQuadBox, unit flux through the top wall).

Underworld development team with AI support from Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions