You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
evaluate() returns large negative values for a non-negative expression (sqrt invariant) at in-domain points near a boundary singularity #641
uw.function.evaluate returns large negative values for an expression whose range is
provably non-negative, at points inside the domain.
Unknowns.Einv2 is sympy.sqrt((E**2).trace()/2) — the square root of a sum of squares
of a real symmetric tensor. It cannot be negative for any velocity field.
Lid-driven cavity, UnstructuredSimplexBox at cellSize=1/8, P2/P1, direct solve:
negative in-domain samples:
coord [0.00536 0.86533] value -0.49758
coord [0.00783 0.83353] value -0.09049
coord [0.01006 0.87349] value -0.42628
All three hug the left wall just below the lid corner — the cavity's velocity
singularity, where Einv2 is large and varying sharply. Magnitudes of −0.1 to −0.5 are
not round-off.
Properties:
Reproducible. Identical values whether the points are evaluated in a batch of 1620
or one at a time, so it is not a batching or ordering effect.
In-domain. The same run has 815 points deliberately placed outside the box, and
all of those came back positive. The defect is not extrapolation.
Independent of the grad-div penalty. Present at penalty=0 (min −0.4976) and penalty=10 (min −0.4838) alike.
A negative square root means the value returned is not the expression evaluated at that
point. The plausible shape is that a representation of the scalar is being interpolated
rather than the expression being evaluated pointwise from the field, and interpolation of
a sharply peaked non-negative function undershoots. Not confirmed — it needs someone who
knows the evaluate path to say which branch is taken here.
Why this surfaced
tests/test_0112_swarm_add_particles.py::test_swarm_access_write_after_add_particles
accumulates 0.5 * evaluate(Einv2, swarm.data) and asserts the running total is
non-negative. That premise is unsound for as long as this bug exists. The test currently
passes only because the accumulation happens to stay positive; perturbing the velocity
field slightly (we hit it by changing Stokes.DEFAULT_PENALTY) flips it negative and the
test fails deterministically — 4/4 runs, while 4/4 pass unperturbed. It reads as a
penalty regression and is nothing of the sort.
Probe-pass verdict: still live, much reduced, on development 01dec8d, serial, on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH). The lid-driven cavity (simplex box cellSize=1/8, P2/P1, unit viscosity) is solved, and st.Unknowns.Einv2 is evaluated:
The issue's points are now positive and of the right size. Two of 5,000 points are still slightly negative, both in the bottom-right corner, where Einv2 tends to zero. That is undershoot in the L2 projection that recovers the derivative; the evaluate locator fix (#1117) gives the same numbers. Size M, in derivative recovery. A clamp at evaluation would hide it rather than fix it.
Underworld development team with AI support from Claude Code
Still live on development c2f8b4f (H1's probe, 2026-11-20). The minimum of Einv2 is -0.0050, at 26 of 40,000 grid points (the bottom corners and the vortex centre). That's identical to 176958a, so the recent locator changes didn't reach it.
Underworld development team with AI support from Claude Code
Activity
Restore the field-decomposition path for single-field solvers
Fault networks in parallel: the split keeps its multigrid tail, the w…
Rebuild P2 boundary-recovery vertices from the midpoints, and exonera…
Review of 06c6db0: a refresh keeps the units and the description
lmoresi commentedon Nov 13, 2026
Probe-pass verdict: still live, much reduced, on development 01dec8d, serial, on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH). The lid-driven cavity (simplex box cellSize=1/8, P2/P1, unit viscosity) is solved, and
st.Unknowns.Einv2is evaluated:The issue's points are now positive and of the right size. Two of 5,000 points are still slightly negative, both in the bottom-right corner, where Einv2 tends to zero. That is undershoot in the L2 projection that recovers the derivative; the evaluate locator fix (#1117) gives the same numbers. Size M, in derivative recovery. A clamp at evaluation would hide it rather than fix it.
Underworld development team with AI support from Claude Code
lmoresi commentedon Nov 20, 2026
Still live on development c2f8b4f (H1's probe, 2026-11-20). The minimum of Einv2 is -0.0050, at 26 of 40,000 grid points (the bottom corners and the vortex centre). That's identical to 176958a, so the recent locator changes didn't reach it.
Underworld development team with AI support from Claude Code
Generated by Claude Code