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
Newton tangent is NaN at rest for a fractional (non-half) power of the strain-rate invariant: the Jacobian guard covers half-integer powers only #841
What happens. A viscosity written on the bare invariant with a fractional power, for example the bounded shear-thinning law
edot=stokes.Unknowns.Einv2# a bare sqrt(g), not a named expressioneta=1/ (1+edot**sympy.Rational(1, 3))
has a finite residual at rest, but its consistent (Newton) Jacobian is NaN there. SymPy merges sqrt(g)**(1/3) into g**(1/6); the guard in _jacobian_unwrap adds 1e-36 to the base of half-integer powers only (exp.q == 2, on both JIT routes: _jit_graph.guard_half_integer_powers and the expanded route's _guard_sqrts), so the derivative g**(-5/6) * dg/dL is Inf * 0 = NaN at v = 0. The solve raises PETSc error 77 ("Computed maximum singular value as zero"). The alpha-blended kernel inherits it at alpha = 0 (0 * NaN = NaN).
Measured (16-cell box, driven lid): consistent_jacobian=False converges in 5 iterations; True raises error 77 on both routes, J(0) norm nan. With the invariant wrapped in a named expression the graph route converges (its node body sqrt(g) is guarded) and the expanded route still raises.
Why it matters now. On development the Newton tangent is opt-in. PR #794 makes it the default (one automatic cold Picard step through the blended kernel), so every cold solve of such a law raises.
Fix. Guard every non-integer power whose base has free symbols, on both routes. In floating point x + 1e-36 == x for any base above about 1e-20, so values and tangents away from rest are unchanged; only kernels that contain such powers change text. Found by the adversarial review of the #794 merge.
The fix is in PR #794 (4cdc00d): the guard covers every non-integer exponent on a base with free symbols, on both JIT routes; test_1067 carries the regression on both routes. Labelled fixed-in-PR until #794 merges.
Activity
The Newton tangent guard covers every fractional power, on both JIT r…
Review record for #794, round 3: the merge with development (tier 2, #…
lmoresi commentedon Oct 11, 2026
The fix is in PR #794 (4cdc00d): the guard covers every non-integer exponent on a base with free symbols, on both JIT routes;
test_1067carries the regression on both routes. Labelledfixed-in-PRuntil #794 merges.Merge origin/bugfix/picard-warmup-791 (tier 2 graph codegen, #841 guard)
lmoresi commentedon Oct 12, 2026
Fixed by #794 (merged to development, c97eb9e).