Repository navigation
Conversation
DFBDF on an in-place DAEProblem with a matrix-free linear solver such as `linsolve = KrylovJL_GMRES()` failed with `FieldError: type DAEFunction has no field mass_matrix`. The matrix-free branch of `build_J_W` always built the ODE operator `WOperator(f.mass_matrix, γ, J)`, but a DAEFunction has no mass matrix and its Newton matrix has a different form. For a DAEFunction that branch now returns a `JVPCache` that applies the DAE Newton matrix `∂F/∂u + cj * ∂F/∂(du)` as a single pushforward of `x ↦ F(du + cj * (x - u0), x)` at `x = u0`. The shifted `du` buffer is passed as a DifferentiationInterface `Cache` context so that it takes the Dual element type under ForwardDiff. `calc_W!` sets `cj` when W is rebuilt, and the Newton step relinearizes the operator at the current iterate. `build_nlsolver` skips the separate DAE Jacobian cache in this case, since a matrix-free W never forms J_u or J_du. The Krylov solve for this case is also given an absolute tolerance of `κ / 20 * sqrt(n)` in the weighted residual norm, which is the inexact Newton rule IDA uses. Without it, at tolerance 1e-9 the second Newton iteration's GMRES solve could not reach `reltol` relative to the already tiny residual, because the DAE residual is evaluated at full precision and so has a roundoff floor of about `eps * cj * |dz|`. GMRES then returned MaxIters and Newton treated the step as divergent; the first step collapsed with 161 convergence failures under ForwardDiff. The ODE mass-matrix path does not hit this because its residual rounds the differential rows to exactly zero. Out-of-place DAEs and Krylov with `concrete_jac = true` still take the old code path and are not covered here. Fixes SciML#1673 Agent-Harness: Claude Code 2.1.296 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The DAE Krylov `abstol = κ / 20 * sqrt(n)` is a bound on the weighted residual. The residual is weighted only when `wrapprecs` adds the weight preconditioners, which it does only when the linear solver's `precs` is `nothing`. With user-supplied `precs` the bound landed in unweighted units, where it is far too loose. GMRES then returned without moving off its initial guess, and the solve went `Unstable` at every tolerance from 1e-5 to 1e-8. The bound is now applied only with the weights, and user `precs` keep LinearSolve's default `abstol`. A test covers a user-supplied `precs` against dense DFBDF. OrdinaryDiffEqNonlinearSolve now reaches the DAE linearization point through `update_coefficients!(W, u, p, t; du)` instead of a new `set_dae_jvp_point!`, and its compat floor and version are back at OrdinaryDiffEqDifferentiation 3.10 and 2.9.9. NonlinearSolve's CI resolves the registered Differentiation, and on 3.12.4 the new branch cannot be reached, because no DAE `JVPCache` is built there. The only new import, `JVPCache`, exists in 3.12.4, so the package loads there without warnings. It is added to the ExplicitImports non-public allowlist alongside the other Differentiation internals. Agent-Harness: Claude Code 2.1.296 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Fresh independent Codex CLI 0.163.0 / gpt-6-astra review of 336aca8 : CHANGES, high risk H4. Three blockers were verified by execution.
using OrdinaryDiffEqBDF, LinearSolve, ADTypes, SciMLBase, Test
f!(r,d,u,p,t)=(@. r=1e-12*(d+u); nothing)
p=DAEProblem(f!,-ones(4),ones(4),(0.,1.))
@testset "Residual scale must not change solution" begin
for ad in (AutoForwardDiff(),AutoFiniteDiff())
sol=solve(p,DFBDF(;linsolve=KrylovJL_GMRES(),autodiff=ad);abstol=1e-8,reltol=1e-8)
@test SciMLBase.successful_retcode(sol)
@test sol.u[end] ≈ fill(exp(-1),4) rtol=1e-5
end
endObserved: 2 passed, 2 failed, 0 errors. Dense DFBDF errors are about1.53e-9 and3.05e-9. Changing only the runtime Krylov cache's
function manufactured!(r,d,u,p,t)
r[1]=(d[1]+u[1])*(1+d[1]^2+u[2]^2)
r[2]=u[2]-u[1]^2
nothing
end
p=DAEProblem(manufactured!,[-1.,-2.],[1.,1.],(0.,1.);
differential_vars=[true,false])
sol=solve(p,DFBDF(;autodiff=AutoFiniteDiff(),linsolve=KrylovJL_GMRES());
abstol=1e-7,reltol=1e-7)Its exact solution is A separate analytic operator check at Dense DFBDF also aborts on this manufactured model on unchanged master. That is a separate baseline failure, being assigned its own investigation; it is not evidence against this PR. The direct matrix and independent analytic solution establish the matrix-free findings.
Release coordination: this head's Differentiation 3.13.0 plus registered NonlinearSolve 2.9.9 is compat-allowed but the decay GMRES solve throws Validation used Julia 1.12.7, DifferentiationInterface 0.7.21, FiniteDiff 2.33.0, LinearSolve 5.18.2, four Julia/precompile threads and BLAS/OMP1. BDF Core899pass/2existingbroken; selected Differentiation202pass and NonlinearSolve187pass; PR tests11/11, moving-point analytic checks30/30 and consistent reinitialization16/16. The first broader run was interrupted after over an hour during compilation; Reviewer: Codex CLI 0.163.0, model gpt-6-astra; local session 01a15d7d-6492-79b3-9221-2ea2f5121281 (no session URL). Provisional risk preceded the redacted PR body and prior-attempt scripts; those scripts/environments were inspected and rerun. Failed first-attempt model capacity produced no verdict. Links
🤖 Posted by an AI agent — harness: Codex CLI 0.163.0 · model: gpt-6.1-sol. |
…plit FD JVP, no private import - Krylov stopping test: replace the fixed weighted abstol (kappa/20*sqrt(n)), which accepted dz = 0 for a residual scaled by 1e-12 and returned Success with u = u0, with abstol = reltol * ||P b1||, where b1 is the step's first Newton residual. Both terms of the test now scale with F. A zero correction is accepted only once F has fallen to reltol of its predictor value, and late iterates are not held to reltol of a residual already at the roundoff floor of W*dz. The linsolve's init abstol is 0. This also applies with user precs, which now track dense DFBDF to 1e-9. - FiniteDiff JVP: a single difference of F(du + cj*(x - u0), x) steps du by cj times a step sized for u. A finite-difference backend now applies dF/du*v + cj*(dF/d(du)*v) as two pushforwards (DAESplitPushforward), each stepped on its own argument. AD backends keep the single pushforward. nf counts both. - NonlinearSolve no longer imports JVPCache; it identifies the matrix-free DAE W as the AbstractSciMLOperator it already imports, and the JVPCache QA exemption is removed. dolinsolve takes an abstol keyword. - Versions: NonlinearSolve 2.10.0. OrdinaryDiffEqBDF 2.4.14 raises its floors to Differentiation 3.13 and NonlinearSolve 2.10, so a BDF that reaches this path cannot resolve against NonlinearSolve 2.9.9. - Tests: the reviewer's scaled-residual regression (both backends), an analytic Newton-matrix check at cj = 1, 1e6, 1e10 (both backends), and a solve of a manufactured model nonlinear in du against its exact solution. Agent-Harness: Claude Code 2.1.306 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Conflicts resolved: the finite-difference DAESplitPushforward carries the row matching (rowof) like DAEPushforward, and dae_rowof reads it from either. Agent-Harness: Claude Code 2.1.306 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Conflicts resolved: the DAE Krylov abstol is now set per step in compute_step! relative to the first Newton residual (init abstol 0 for any operator W, including DAEWOperator); the separated DAE Jacobian cache is skipped when J is an operator; JVPCache is no longer imported into NonlinearSolve (is_sparse_csc stays); NonlinearSolve goes to 2.10.1 on top of SciML#4861's 2.10.0; wrapprecs docs drop the old kappa/20 abstol rationale. Agent-Harness: Claude Code 2.1.306 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Thanks for the review. All four points are addressed in 979e873 (a no-conflict merge of master, then the fix commit). I reproduced each one on 336aca8 before fixing it: the numbers matched the review exactly. Everything below was measured on the new head. 1. Residual scaling ( The fixed weighted
where
I tried two other scale-free criteria and rejected both:
The chosen criterion applies with user Your regression, verbatim (whitespace is Runic's): 2. FiniteDiff JVP at large A finite-difference backend now applies
Both the analytic operator check ( 3. Private import OrdinaryDiffEqNonlinearSolve no longer imports
4. Release coordination Reproduced: registered OrdinaryDiffEqBDF 2.4.13 and OrdinaryDiffEqNonlinearSolve 2.9.9, with this Differentiation, throw Changes:
With these changes, developing this BDF into an environment pinned to NonlinearSolve 2.9.9 fails with Why the floors are on BDF rather than NonlinearSolve:
Tests on the new head
All of the NonlinearSolve Core failures are pre-existing on master:
I did not rebuild the 2,613-state TinyFDTD problem. As a stand-in for the original motivation, I used a 2,001-state staggered-grid 1D Maxwell Not run: full monorepo Core/QA, GPU, downgrade, docs. The stacked PRs #4866 and #4868 have this merged in, with no rebase or force-push. Their own DAE Krylov test files pass. 🤖 Posted by an AI agent · harness: Claude Code 2.1.307 · model: claude-opus-5-5 |
Agent-Harness: Claude Code 2.1.307 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com> # Conflicts: # lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl
The QA env develops the repository root, whose [sources] bring in the in-repo OrdinaryDiffEqBDF. BDF now needs Differentiation 3.13 and NonlinearSolve 2.10, which are not registered yet, so the env's own direct deps on them must come from the repository too, as the StochasticDiffEq QA envs already do. Agent-Harness: Claude Code 2.1.307 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.307 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.307 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.307 Agent-Model: claude-opus-5-5 Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
|
CI follow-up in 7a0af25: the
#4866 and #4868 have this commit merged in. The 🤖 Posted by an AI agent · harness: Claude Code 2.1.307 · model: claude-opus-5-5 |
Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a196b2-2e22-7750-a6d1-f0e614c41741, reviewed head 7a0af25
Review written by the reviewer named above in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands. Summary: Enables matrix-free Krylov solves for in-place DAE problems by applying the combined DAE Newton matrix and scaling linear stopping tolerances with the residual. The regression fails on the merge-base and all 25 added assertions pass on the target head; no blocking defect was found, with stale descriptive documentation remaining. Blast radius: In-place DAE algorithms using a non-concrete linear solver, principally DFBDF; shared differentiation operators, JVP evaluation accounting, and NLNewton linear tolerances. Concrete DAE and default ODE branches retain their existing construction and tolerance paths. Evidence: Head regression file: 25/25 assertions pass, including ForwardDiff, FiniteDiff, scaled residuals, analytic Newton actions, and manufactured trajectories. The first added regression testset errors on merge-base d2adddd with the original missing-mass_matrix error. An independent probe passes 12 rowwise analytic cache-refresh checks and eight trajectory checks; additional harness errors limit its conclusions. BDF Core CI independently reports 25/25 DAE Krylov passes. Of 192 checks, 187 succeed, four fail, and one is skipped; baseline comparison and remaining uncertainty are detailed below. Blocking findingsNone. Non-blocking findings
What I ranAll three Julia processes ran sequentially on Julia 1.13.2, aarch64, with gh pr view 4861 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid
git -C src fetch origin '+refs/pull/4861/head:refs/remotes/pr/4861' master
git -C src checkout --detach refs/remotes/pr/4861
git -C src rev-parse HEAD origin/master
git -C src diff origin/master...HEAD
git -C src merge-base origin/master HEAD
sha256sum INITIAL.md > INITIAL.sha256
git -C src log -1 --no-merges --format=%B
gh issue view 1673 --repo SciML/OrdinaryDiffEq.jl --json title,body,state
gh pr view 4861 --repo SciML/OrdinaryDiffEq.jl --json title,body,commits,statusCheckRollup
gh pr checks 4861 --repo SciML/OrdinaryDiffEq.jl --json name,state,link
gh run list --repo SciML/OrdinaryDiffEq.jl --branch master --event push --limit 5 --json databaseId,conclusion,headSha,url,workflowNameThese completed successfully. The head equals the target. The fetched master tip is the Base field above; the three-dot diff and base regression use merge-base d2adddd. No root AGENTS.md or CLAUDE.md was present. The initial unfiltered Run 1, head, exit 0: JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no run_head.jlThe runner activates a separate Run 2, merge-base, exit 1: git -C src archive d2adddd99f8e595fc3b9bec6e524b058641522f3 | tar -x -C base
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --project=env-base run_base.jlA separate snapshot and environment use the same resolved dependency graph, with the six developed sibling paths redirected to base source. The runner imports the common dependencies and executes lines 8–51 of the added regression file, preserving its first testset and assertions. It omits the import of the newly introduced helper names so execution reaches the original solver defect instead of failing at import. Output: Thus the added end-to-end regression fails before and passes after. The later scaled-residual and operator-specific testsets were not separately executed on base. Run 3, independent adversarial probe, exit 1: JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --project=env probe.jlThe probe differentiates a separate nonlinear residual with an explicitly derived two-row Newton action while changing u, du, parameters, time, and cj on the same cache. Both ForwardDiff and FiniteDiff pass all 12 componentwise comparisons, including cj=1e10; componentwise bounds avoid masking a wrong algebraic row with a large differential row. A nonautonomous decay trajectory, six matrix-state BICGSTAB trajectories across DFBDF/DABDF2/DImplicitEuler and both backends, and one Float32-state/Float64-time trajectory pass their analytic accuracy assertions: 20 numerical assertions pass in total. Return-code assertions error because the reviewer runner omitted the explicit import of successful_retcode. The reinit probe also used an unsupported du0 keyword and stopped before the second solve. An explicit CI logs inspected with
What I did not verifyI did not run a complete package or downstream suite, benchmarks, GPU execution of the new matrix-free DAE operator, Enzyme/Mooncake/Zygote/Reactant backends for that operator, MPI, or another platform. ForwardDiff and FiniteDiff paths were exercised locally and in BDF CI; no GPU-specific kernel, reverse-mode rule, Reactant path, or MPI implementation is added by this diff. Existing GPU CI success does not establish coverage of the new matrix-free configuration. Out-of-place matrix-free DAEs and concrete_jac=true with Krylov remain outside this fix. I did not establish bitwise equality on default solver trajectories, complete the reinit probe, or validate its return-code assertions because of the stated reviewer harness errors. I did not diagnose the unmatched ModelingToolkit downstream failure or certify it as unrelated. Only three Julia runs were used, each once; no prior review was consulted and nothing was posted upstream. 🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5 |
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Resolve OrdinaryDiffEqNonlinearSolve compat (keep Differentiation 3.13 floor, take upstream BDF 2.4.1 floor). Bump OrdinaryDiffEqBDF to 2.4.15 since 2.4.14 is already tagged upstream. Agent-Harness: Claude Code 2.1.325 Agent-Model: claude-sonnet-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Upstream master already releases OrdinaryDiffEqDifferentiation 3.13.0, so the new dae_jvp_cache and dolinsolve abstol changes on this branch need a new version. The BDF, Rosenbrock and NonlinearSolve floors move from 3.13 to 3.14 to match. Agent-Harness: Claude Code 2.1.325 Agent-Model: claude-haiku-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
…recs Brings the upstream/master merge and BDF 2.4.15 bump from SciML#4861 into this stacked branch. Agent-Harness: Claude Code 2.1.325 Agent-Model: claude-sonnet-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
…owmatch Brings the upstream/master merge and BDF 2.4.15 bump from SciML#4861 into this stacked branch. Agent-Harness: Claude Code 2.1.325 Agent-Model: claude-sonnet-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
|
Update: merged current master into this branch (merge commit, no history rewrite) and re-read the earlier review comments.
🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5 |
OrdinaryDiffEqDifferentiation 3.14.0 is unregistered, so the 3.14 floors in BDF, Rosenbrock and NonlinearSolve cannot resolve in sublibrary CI and the downgrade jobs. Restore the floors to the values on upstream/master (BDF 3.3, Rosenbrock 3.13, NonlinearSolve 3.10); raise them to 3.14 in a follow-up once OrdinaryDiffEqDifferentiation 3.14.0 is released. Agent-Harness: Claude Code 2.1.325 Agent-Model: claude-sonnet-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
|
Update: the first CI run on this PR failed at dependency resolution in three jobs ( This pushes a follow-up commit that restores the floors to values the registry can satisfy (BDF "3.3", NonlinearSolve "3.10", Rosenbrock "3.13"). Local check after the change: the NonlinearSolve test environment resolves against the registry, and 🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5 |
compute_step! sets the matrix-free DAE Krylov abstol from norm(Pl \ b1), applying the left preconditioner with ldiv!. Under KrylovJL(; ldiv = false) Krylov.jl applies it with mul!; its own M, N, W, atol and rtol keywords replace the preconditioners, inner product or tolerances; LinearSolve calls methods such as DQGMRES without Pl; and CG and MINRES measure sqrt(r' * (Pl \ r)). Each tested another norm against that tolerance: KrylovJL_GMRES(; ldiv = false) with the default weights accepted a zero correction and returned Success with u = u0. build_nlsolver now throws an ArgumentError for any of those keywords and for any KrylovJL method other than GMRES, FGMRES and BiCGStab. Agent-Harness: Claude Code 2.1.325 Agent-Model: claude-opus-5-5 Agent-Session: e8ff393f-88de-4244-97f6-60f2e09fe20b Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
|
Update: one more commit (235b02c) after the approval, so the approval may need re-confirming. While triaging stacked follow-ups I found that the matrix-free DAE Krylov path returned the initial state with The commit adds 🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5 |
Summary
Fixes #1673.
DFBDFon an in-placeDAEProblemwith a matrix-free linear solver (for examplelinsolve = KrylovJL_GMRES()) failed withFieldError: type DAEFunction has no field mass_matrix. With this change it solves, and no Jacobian is formed (njacs == 0).Cause
The matrix-free branch of
build_J_Walways built the ODE operatorWOperator(f.mass_matrix, γ, J), which representsW = M - γJ. ADAEFunctionhas no mass matrix, and its Newton matrix has a different form:∂F/∂u + cj * ∂F/∂(du).Change
OrdinaryDiffEqDifferentiation/src/operators.jladdsDAENewtonResidualandDAEPushforward, wrapped in the existingJVPCacheby a newdae_jvp_cache.W * vis computed as one pushforward ofx ↦ F(du + cj * (x - u0), x)atx = u0, which is exactly(∂F/∂u + cj * ∂F/∂(du)) * v. The shifteddubuffer is passed as a DifferentiationInterfaceCachecontext so that it takes the Dual element type under ForwardDiff.update_coefficients!(J::JVPCache, u, p, t)gains an optionaldukeyword that sets the DAE linearization point(du, u).cjis set withset_dae_jvp_cj!.build_J_W, for aDAEFunctionthe matrix-free branch returnsJ = W = dae_jvp_cache(...). The ODE path is unchanged.calc_W!, a DAEJVPCacheW gets itscjset whennew_Wis true.compute_step!(newton.jl), a DAEJVPCacheW is relinearized at the current Newton iterate withupdate_coefficients!(W, ustep, p, tstep; du = ztmp).build_nlsolver(utils.jl), the separate DAE Jacobian cache is skipped whenJ isa JVPCache, because a matrix-free W never formsJ_uorJ_du. This case's Krylov solve also gets an absolute tolerance. The next section explains why.OrdinaryDiffEqDifferentiation = "3.10"floor, following the repo convention of raising floors after the dependency is released. Its only new import,JVPCache, already exists in 3.12.4, and on 3.12.4 the new branches cannot be reached because no DAEJVPCacheis built. Verified: it precompiles against the registered 3.12.4 with no warnings.JVPCacheis added to the ExplicitImports non-public allowlist next to the other Differentiation internals. The NonlinearSolve floor should be raised to 3.13 once OrdinaryDiffEqDifferentiation 3.13 is released.Inexact Newton tolerance for the Krylov solve
When OrdinaryDiffEq's own weight preconditioning is active, the DAE Krylov solve is given
abstol = κ / 20 * sqrt(n)in the weighted (left-preconditioned) residual space. Weight preconditioning is active when the linear solver'sprecsisnothing, the same condition as inwrapprecs. This is the inexact Newton rule IDA uses: stop the linear solve once the residual is a small fraction of the Newton convergence threshold.It is needed because of a failure found during testing. A DAE residual is evaluated at full precision, so a late Newton iteration's residual is already tiny and has a roundoff floor of about
eps * cj * |dz|. At tolerance 1e-9, the second Newton iteration's GMRES solve could not reachreltolrelative to that residual. It returnedMaxIters, and Newton treated the step as divergent. Without the abstol, the first step collapsed with 161 nonlinear convergence failures under ForwardDiff. With it, there are 0 convergence failures at 1e-6 and 1e-9 under both ForwardDiff and FiniteDiff. At 1e-9, DFBDF+GMRES takes 151 steps against 153 for dense DFBDF, and at 1e-6 it takes 49 against 49. The ODE mass-matrix path does not hit this problem, because its residualtmp + f - cj * zrounds the differential rows to exactly zero.With user-supplied
precs, the residual is not weighted, so the bound is not applied and LinearSolve's defaultabstolis used. Applying the weighted bound in unweighted units makes it far too loose. GMRES then returns without leaving its initial guess, and on the semi-explicit test DAE withprecs = Returns((I, I)), the solve wentUnstableat every tolerance from 1e-5 to 1e-8. With the guard, the same solve succeeds at 1e-5, 1e-6 and 1e-7 (relative error against dense of 1.5e-6, 2.9e-7 and 3.1e-8). It needs 5,705 steps at 1e-8 and fails at 1e-9. The ODE mass-matrix path behaves the same way, independent of this PR: FBDF + GMRES withprecs = Returns((I, I))on the mass-matrix form of the same problem goesUnstableat 1e-9 with 33 convergence failures. The reason is that LinearSolve's defaultabstol(√eps) then applies to the raw residual. Proper preconditioning support for DAEs (concrete_jac = truetogether withprecs) is left as a follow-up.Tests
New file
lib/OrdinaryDiffEqBDF/test/dae_krylov_tests.jl, registered in the BDF Core group, with 11 assertions:du + uproblem, checked againstexp(-1), withnjacs == 0.∂F/∂(du), solved under bothAutoForwardDiffandAutoFiniteDiffat 1e-9 and compared against denseDFBDF, withnjacs == 0.precs, compared against denseDFBDFat 1e-6.Before this change, the first two cases fail with the original
FieldErroron the released OrdinaryDiffEqBDF 2.4.12 / OrdinaryDiffEqDifferentiation 3.12.4.The end-to-end coverage lives in OrdinaryDiffEqBDF, whose
[sources]path-develops OrdinaryDiffEqDifferentiation and OrdinaryDiffEqNonlinearSolve. BDF CI therefore exercises the new code in both.Local results (Julia 1.12.6,
GROUP=Core,--check-bounds=yes):runtests.jl. Every Core test file was therefore run individually, in order, each in its own@safetestset, from a scratch runner outside the repo (TestEnv, with the in-repo siblings developed). That gave 29 testsets with 1012 passes and 40 broken. All failures are pre-existing:LineSearchException: Search direction is not a direction of descent(Trapezoid withNLNewton(relax = BackTracking())on an ODE). Unmodified masterab07f5de9gives the identical result: 4 pass and 1 error. This is the failure targeted by fix NLNewton BackTracking when FD residual-norm slope is noisy #4714.functional matrix: rober-mm iip. Unmodified masterab07f5de9with the same in-repo siblings gives the identical result: 98 pass and 4 fail.@test_nowarnin "Mass Matrix Tests with Singular Mass Matrices" failed once because of a profiling signal sent to the test process during the run. Its output landed in the redirected stderr. Rerunning that testset alone gives 26/26.CI note: the OrdinaryDiffEqNonlinearSolve Core job is expected to fail regardless of this PR. One cause is the Newton
LineSearchExceptionabove (#4714). The other is that the package has no[sources], so its CI resolves registered siblings; see #4667.Limitations: large problems need a preconditioner
As an exploratory check (not part of the test suite), this was run on a 2,613-state MethodOfLines staggered-grid FDTD
DAEProblem(1D TF/SF,tspan = (0, 8),abstol = reltol = 1e-8,dtmax = 0.025), without a preconditioner. Each GMRES run had a 900 s wall-clock budget that includes compilation:The matrix-free path is robust here: it has no convergence failures, and its step count keeps pace with the dense solver, so there is no step-size collapse. It is slow, though. It uses about 2,600 function evaluations per step against about 13 for dense, roughly 300 times the dense wall time over the full span. Final-state agreement with dense was not measured, because neither run reached the end of the span within the budget.
A separate experiment on the same problem found two more things. First, unpreconditioned GMRES needs about 2,300 iterations per solve, because the residual rows that ModelingToolkit generates are not aligned with the unknowns (the diagonal is zero). Second, a user-supplied row-permutation, Jacobi, ILU0 or LU preconditioner makes DFBDF+GMRES 4 to 6 times faster than dense, at 1.0 to 1.3 s against 5.9 s. For this problem class, a preconditioner is recommended.
Not covered (follow-ups)
FieldError.concrete_jac = trueon aDAEProblemstill hits the originalFieldError. Proper preconditioning support for DAEs (concrete_jac = truetogether withprecs) is the natural follow-up.OrdinaryDiffEqDifferentiation = "3.13"after 3.13 is released.🤖 Posted by an AI agent · harness: Claude Code 2.1.296 · model: claude-opus-5-5
Review: unreviewed
Session: aa65e380-52df-443a-9f57-8c20c56babb9