Repository navigation
Fix SUPG with an explicit coordinate-dependent b, a constant tau, and a quotient tau - #92
xtalax-droid wants to merge 3 commits into
Conversation
compile_coeffs decided linearity by expand(ex - linear) == 0, which leaves floating-point residue for a constant tau (0.05 * 0.25 against its derivative) and cannot cancel a quotient tau such as hK / (2|b|) with coordinate-dependent b. Both fell through to the per-shape-function kernel, which rejects the Hessian slots and hK. The test now also accepts a term whose arithmetic-only expression vanishes when the trial slots, or the test slots, are zeroed, which together with the existing coefficient check implies it is c * trial * w. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
SUPG(tau; b = [1 + y, x]) kept the PDESystem's independent variables, which the kernels cannot evaluate (UndefVarError on y). The front end now rewrites tau and b onto the coordinate and time slots before the weak form is built; a b read from the equation is already in slots. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Seven advection-diffusion discretizations on an 8x8 quadrilateral grid (Galerkin, and SUPG with constant or quotient tau, constant, equation-read and explicit coordinate-dependent b) are compared with a Ferrite element loop. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #92 Reviewed head: 66da879 Risk assessment
Review reportVERDICT: CHANGES Riskmedium (M2: coordinate substitution changes numerical coefficients on an already-working SUPG path; confirmed regression) Blocking findings
Non-blocking findingsNone. What I ranAI reviewer: codex-cli 0.164.0, model gpt-6.1-sol; local session identified above, with no session URL available. Reviewed the code diff without reading PR metadata, author ratings, or other reviews. No root Set the requested
What I did not verifyCI failure causes or green CI, other Julia/dependency versions, QA, documentation builds, or unlisted test groups. All commands I started have exited; no fixes, checkout edits, commits, pushes, or GitHub posts were made. AUTHOR_GRADE: {"task":"bugfix","score":3,"difficulty":3,"rounds":1,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"The intended SUPG regressions are reproduced on base and fixed at head; 1765 repository assertions pass. A targeted coordinate-renaming probe nevertheless confirms a new silent hK symbol-collision regression: two matrix comparisons fail at head and pass on base."} Head link: 66da879 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
Problem
Three
test_space = SUPG(...)forms failed on a plain advection–diffusion system on a quadrilateral grid, while Galerkin worked on the same system:bthat names the coordinates (SUPG(0.05; b = [1 + y, x])) raisedUndefVarError: y, because the PDESystem's coordinates were never mapped onto the kernel coordinate slots.(hK, b) -> hK / (2 * sqrt(b[1]^2 + b[2]^2))) raised "needs the Hessian slots or the element size", because theexpand-based linearity check cannot cancel the quotient.SUPG(0.05)) with constantbraised the same error, because the check leaves floating-point residue (about 1.7e-18).Fix
compile_coeffsalso accepts a term as linear when an arithmetic-only walk finds it vanishes with the trial slots zeroed and with the test slots zeroed. Together with the existing check that the coefficients are free of the slots, this implies the term isc·trial·w.bonto the coordinate and time slots before building the weak form (_slotted).Tests
A new testset in
test/shared/frontend_tests/supg.jlcomparesoperators(...).Mand.Kon an 8x8 quadrilateral grid against a Ferrite element assembly of the SUPG operator. It covers Galerkin and six SUPG forms (constant or quotient τ, with constant, equation-read, or explicit coordinate-dependentb). The three failing cases error before the fix and pass after. The Assembly, WeakForm, Kernels, Interface, Integration and Frontend test groups pass locally.Codex review: approve, no findings.
Review notes
compile_coeffsnow applies to every non-nonlinear kind, not only sources. Soundness relies on the later coefficient-dependence check and on the walk being restricted to+,*,/of the slots._slottedwraps a function τ in a closure; code that callstest_weightdirectly with the original SUPG would still see unsubstituted coordinates.🤖 Posted by an AI agent · harness: Claude Code 2.1.322 · model: claude-sonnet-5-5
Review: unreviewed
Session: 43e03fde-3384-4386-bae9-03e81f19ba7c