Skip to content

Use the default Newton W cutoff in the DFG example solver - #62

Merged
xtalax merged 4 commits into
masterfrom
perf/dfg-example-solver
Nov 5, 2026
Merged

xtalax merged 4 commits into
masterfrom
perf/dfg-example-solver

Conversation

@xtalax-droid

@xtalax-droid xtalax-droid commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

The DFG example forced a W refactorization on every step with new_W_dt_cutoff = 0. With the default NLNewton cutoff, 2D-1 (16,430 dofs, tend 60) refactorizes 35 times instead of 197. Solve time drops from about 18.5 to 20.5 s to about 7.8 s (2.4x), with 288 accepted steps instead of 289. cD, cL and Δp are identical to 10 digits (5.5794364082, 0.0105832589, 0.1175842628); the NavierStokes test prints the same values.

The only change is dropping new_W_dt_cutoff = 0 from DFG_ALG in examples/dfg_cylinder/dfg_cylinder.jl, plus a short comment: UMFPACK's default has no iterative refinement and its residual grows above about 60k dofs (measured on the example's W matrices: about 1e-13 at 5k dofs, 1e-12 at 62k, 8e-8 at 125k, 2e-4 at 248k; root cause is UMFPACK's relative pivot tolerance of 0.1, and Julia turns off UMFPACK's iterative refinement), while it is accurate at this size (5e-14 at 16,430). Above about 60k dofs use KLUFactorization() until pivot_tolerance/strategy are available in a released LinearSolve, then UMFPACKFactorization(control = (; strategy = 3, irstep = 2)). irstep = 2 alone is not sufficient at high resolution (2.7e-9 at 248k dofs), and it costs most of the remaining time at this size, so it is not used here.

Docs: docs/src/navier_stokes.md shows the same solver call, so its snippet (line 38) now reads DFBDF(linsolve = UMFPACKFactorization()) and the Linear solver note gains the UMFPACK accuracy sentence with the 60k-dof advice (a hand edit; the page is not generated from the example). Not changed: the README showcase keeps its own setting (on the showcase, dropping the cutoff gains at most 8%); other uses of new_W_dt_cutoff = 0 are untouched: src/frontend.jl:436 (docstring), docs/src/getting_started.md:131, test/shared/frontend.jl:10, test/shared/frontend_tests/api_example.jl:62, benchmarks/accuracy_convdiff.jl:32,46; benchmarks/navier_stokes/ns_cylinder.jl uses DFG_ALG and speeds up automatically.

Local results on Julia 1.12: GROUP=NavierStokes passes 15 of 15 (1m30), Runic 1.13 clean, Codex approved. Measured on a shared box (load 1.6 to 15), two runs each back to back.


🤖 Posted by an AI agent · harness: Claude Code 2.1.318 · model: claude-sonnet-5-5
Review: unreviewed
Session: 43e03fde-3384-4386-bae9-03e81f19ba7c

t and others added 2 commits November 5, 2026 01:57
new_W_dt_cutoff = 0 refactorized the W matrix on every step (197 factorizations); the default cutoff needs 35 and gives identical cD, cL and dp to 10 digits, with 2.4x less solve time at 16,430 dofs.

Agent-Harness: Claude Code 2.1.318
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>
The page showed NLNewton(new_W_dt_cutoff = 0), which the example no longer
uses, and gains a note on UMFPACK accuracy above about 60k dofs.

Agent-Harness: Claude Code 2.1.312
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>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master 1627046... master / 1627046...
construction/heat P1 10x10 6.11 ± 0.14 ms 6.05 ± 0.18 ms 1.01 ± 0.037
construction/heat P1 20x20 8.37 ± 0.14 ms 8.09 ± 0.12 ms 1.03 ± 0.023
time_to_load 5.29 ± 0.023 s 5.37 ± 0.12 s 0.985 ± 0.023
Memory benchmarks
master 1627046... master / 1627046...
construction/heat P1 10x10 0.0393 M allocs: 2.11 MB 0.0393 M allocs: 2.11 MB 1
construction/heat P1 20x20 0.0702 M allocs: 4.73 MB 0.0702 M allocs: 4.73 MB 1
time_to_load 0.2 k allocs: 11.8 kB 0.2 k allocs: 11.8 kB 1

t and others added 2 commits November 5, 2026 02:19
Agent-Harness: Claude Code 2.1.312
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>
Agent-Harness: Claude Code 2.1.312
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>
@xtalax
xtalax merged commit d973585 into master Nov 5, 2026
48 checks passed
Sign up for free to 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