Skip to content

Support matrix-free linear solvers for DAEProblems in DFBDF - #4861

Open
xtalax wants to merge 12 commits into
SciML:masterfrom
xtalax:dae-krylov
Open

xtalax wants to merge 12 commits into
SciML:masterfrom
xtalax:dae-krylov

Conversation

@xtalax

@xtalax xtalax commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #1673. DFBDF on an in-place DAEProblem with a matrix-free linear solver (for example linsolve = KrylovJL_GMRES()) failed with FieldError: 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_W always built the ODE operator WOperator(f.mass_matrix, γ, J), which represents W = M - γJ. A DAEFunction has no mass matrix, and its Newton matrix has a different form: ∂F/∂u + cj * ∂F/∂(du).

Change

  • OrdinaryDiffEqDifferentiation/src/operators.jl adds DAENewtonResidual and DAEPushforward, wrapped in the existing JVPCache by a new dae_jvp_cache. W * v is computed as one pushforward of x ↦ F(du + cj * (x - u0), x) at x = u0, which is exactly (∂F/∂u + cj * ∂F/∂(du)) * v. The shifted du buffer is passed as a DifferentiationInterface Cache context so that it takes the Dual element type under ForwardDiff. update_coefficients!(J::JVPCache, u, p, t) gains an optional du keyword that sets the DAE linearization point (du, u). cj is set with set_dae_jvp_cj!.
  • In build_J_W, for a DAEFunction the matrix-free branch returns J = W = dae_jvp_cache(...). The ODE path is unchanged.
  • In calc_W!, a DAE JVPCache W gets its cj set when new_W is true.
  • In compute_step! (newton.jl), a DAE JVPCache W is relinearized at the current Newton iterate with update_coefficients!(W, ustep, p, tstep; du = ztmp).
  • In build_nlsolver (utils.jl), the separate DAE Jacobian cache is skipped when J isa JVPCache, because a matrix-free W never forms J_u or J_du. This case's Krylov solve also gets an absolute tolerance. The next section explains why.
  • OrdinaryDiffEqDifferentiation goes from 3.12.4 to 3.13.0. OrdinaryDiffEqNonlinearSolve keeps its version and its 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 DAE JVPCache is built. Verified: it precompiles against the registered 3.12.4 with no warnings. JVPCache is 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's precs is nothing, the same condition as in wrapprecs. 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 reach reltol relative to that residual. It returned MaxIters, 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 residual tmp + f - cj * z rounds the differential rows to exactly zero.

With user-supplied precs, the residual is not weighted, so the bound is not applied and LinearSolve's default abstol is 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 with precs = Returns((I, I)), the solve went Unstable at 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 with precs = Returns((I, I)) on the mass-matrix form of the same problem goes Unstable at 1e-9 with 33 convergence failures. The reason is that LinearSolve's default abstol (√eps) then applies to the raw residual. Proper preconditioning support for DAEs (concrete_jac = true together with precs) 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:

  • A 4-state du + u problem, checked against exp(-1), with njacs == 0.
  • A semi-explicit index-1 DAE with a singular ∂F/∂(du), solved under both AutoForwardDiff and AutoFiniteDiff at 1e-9 and compared against dense DFBDF, with njacs == 0.
  • The same DAE with a user-supplied precs, compared against dense DFBDF at 1e-6.

Before this change, the first two cases fail with the original FieldError on 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):

  • OrdinaryDiffEqBDF: 15 testsets with 809 passes and no failures. After the follow-up commit, "DAE Krylov Tests" was rerun on its own: 11/11.
  • OrdinaryDiffEqDifferentiation: 17 testsets with 224 passes and no failures.
  • OrdinaryDiffEqNonlinearSolve, QA group: run against the follow-up commit. JET has 13 passes and 33 broken. Aqua, including the ExplicitImports checks, passes 41/41.
  • OrdinaryDiffEqNonlinearSolve, Core group: the pre-existing Newton Tests error (fix NLNewton BackTracking when FD residual-norm slope is noisy #4714) aborts 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:
    • "Newton Tests" errors with LineSearchException: Search direction is not a direction of descent (Trapezoid with NLNewton(relax = BackTracking()) on an ODE). Unmodified master ab07f5de9 gives 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.
    • "NonlinearSolveAlg No-Init Inner Solver Tests" has 4 failures in functional matrix: rober-mm iip. Unmodified master ab07f5de9 with the same in-repo siblings gives the identical result: 98 pass and 4 fail.
    • A @test_nowarn in "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 LineSearchException above (#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:

Solver Result Wall time Steps Rejects Convergence failures nf
dense DFBDF Success 5.5 s (warm) 439 0 0 5,686
DFBDF + GMRES, ForwardDiff stopped at budget, t = 4.37 903 s 226 2 0 595,568
DFBDF + GMRES, FiniteDiff stopped at budget, t = 4.38 904 s 227 2 0 598,095

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)

  • Out-of-place DAEs with a matrix-free linear solver still hit the original FieldError.
  • Krylov with concrete_jac = true on a DAEProblem still hits the original FieldError. Proper preconditioning support for DAEs (concrete_jac = true together with precs) is the natural follow-up.
  • GPU arrays were not tested.
  • Raise the OrdinaryDiffEqNonlinearSolve floor to 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

xtalax and others added 2 commits October 13, 2026 01:31
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>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — independent AI review; not reviewed by @ChrisRackauckas.
🤖 Automated review coordination from an AI agent.

Fresh independent Codex CLI 0.163.0 / gpt-6-astra review of 336aca8 : CHANGES, high risk H4. Three blockers were verified by execution.

  1. Residual scaling can give Success with the wrong solution (OrdinaryDiffEqNonlinearSolve/src/utils.jl:952). This exact public regression returns [1,1,1,1] after four accepted steps for both backends, instead of fill(exp(-1),4):
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
end

Observed: 2 passed, 2 failed, 0 errors. Dense DFBDF errors are about1.53e-9 and3.05e-9. Changing only the runtime Krylov cache's abstol from0.001 to0 restores successful GMRES errors1.53e-9/2.22e-9. Residual scaling must be accounted for in the stopping criterion and Newton correction; reducing a constant to accommodate this one example is insufficient.

  1. FiniteDiff JVP steps miss the amplified derivative displacement (OrdinaryDiffEqDifferentiation/src/operators.jl:230,264). The executed public model is:
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 [exp(-t),exp(-2t)] because the first residual's additional factor is positive. Matrix-free ForwardDiff has maximum error2.35520e-8. Matrix-free FiniteDiff reports Success with maximum error1.36337e284 and infinite computed algebraic-constraint error.

A separate analytic operator check at u=[1,1], du=[-1,-2] has exact matrix [3(cj+1) 0; -2 1]. At v=[1,0.5], FiniteDiff relative error is0.0124473 for cj=1e6 and11716.7 for cj=1e10; scaling v down to1e-10 does not remove it. The perturbation is selected in state space while the wrapper displaces du by cj times that amount. Use perturbations appropriate to both arguments/shift, or properly scaled partial JVPs, and add analytic large-shift plus nonlinear-derivative accuracy coverage. The AD moving-point formula passed its analytic controls.

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.

  1. A new private import is hidden by a QA exemption (OrdinaryDiffEqNonlinearSolve.jl:71, test/qa/qa.jl:65). Base.ispublic(OrdinaryDiffEqDifferentiation,:JVPCache) is false, with no rendered documentation entry found. Submitted QA passes41/41. Removing only the new exemption in a scratch QA copy gives 39 passed, 1 error, specifically NonPublicExplicitImportsException for JVPCache. Use a documented public interface or declare/document the needed owner interface together, then remove the exemption.

Release coordination: this head's Differentiation 3.13.0 plus registered NonlinearSolve 2.9.9 is compat-allowed but the decay GMRES solve throws MethodError: no method matching similar(::JVPCache...). The modified consumer also declares 2.9.9. Validate and publish a coherent consumer/owner combination.

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; fd_direction_tests.jl remains unverified. QA initially failed with watcher EMFILE; the unchanged assertions ran with Revise's documented JULIA_REVISE_POLL=1 polling transport (JET13pass/33existingbroken, Aqua41pass); the negative public-import control used the same setting. No tests were skipped or weakened. Full monorepo QA/Core, docs, dependency-floor matrix, GPU, performance claim, and sibling integration remain unverified.

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.
Conversation: local session 01a15ca3-5696-7ea3-bbac-ba551b6975af (no session URL).

xtalax and others added 2 commits October 21, 2026 18:31
…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>
xtalax added a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Oct 22, 2026
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>
xtalax added a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Oct 22, 2026
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>
@xtalax

xtalax commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

🤖 Automated reply from an AI agent posting as @xtalax. Not yet reviewed by @xtalax.

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 (utils.jl / newton.jl)

The fixed weighted abstol = κ/20·√n is gone. Every Krylov solve of a step now stops at

‖P(b − W dz)‖ ≤ reltol · (‖P b‖ + ‖P b₁‖),

where b₁ is the step's first Newton residual. Concretely, compute_step! sets abstol = reltol·‖P b₁‖ on the first Newton iteration of each step, and the cache is initialized with abstol = 0.

  • Both terms scale with F, so rescaling the residual gives the same dz.
  • A zero Newton correction can be accepted only after F has fallen to reltol of its value at the predictor. It is no longer accepted because the residual happens to be small in absolute units.
  • The ‖P b₁‖ term is what keeps the original motivation intact. A late iterate's b sits near the roundoff floor of W*dz, and a pure relative test asks for reltol of that floor, which can't be reached.

I tried two other scale-free criteria and rejected both:

Criterion What went wrong
Pure relative, reltol against the current ‖P b‖ Reproduces the roundoff stall. The semi-explicit test DAE at 1e-9 under ForwardDiff goes Unstable with 1,043 nonlinear convergence failures.
Relative with a forcing term of κ Too loose for DAEs. Differential rows of W scale with cj, algebraic rows don't, so the algebraic rows are under-solved. Your manufactured model under FiniteDiff then returns Success with error 2e25 after 27,152 convergence failures.

The chosen criterion applies with user precs too. precs = Returns((I, I)) on the semi-explicit DAE now tracks dense DFBDF at every tolerance from 1e-5 to 1e-9, with relative errors from 3.1e-6 down to 1.9e-10. Previously it needed 5,705 steps at 1e-8 and failed at 1e-9. That test's tolerance is tightened from 1e-6 to 1e-9.

Your regression, verbatim (whitespace is Runic's): [1,1,1,1] → error 1.53e-9 (ForwardDiff) and 1.44e-9 (FiniteDiff).

2. FiniteDiff JVP at large cj (operators.jl)

A finite-difference backend now applies ∂F/∂u·v + cj·(∂F/∂(du)·v) as two pushforwards, through a new DAESplitPushforward. Each pushforward steps only its own argument, so du gets a step sized for du. AD backends keep the single pushforward, which was already exact. nf counts both pushforwards.

Check Before After
Analytic operator, cj = 1e6 (relative error) 0.0124 1.99e-8
Analytic operator, cj = 1e10 (relative error) 11,717 1.99e-8
Manufactured model, FiniteDiff (max error vs exact) 1.36e284 8.0e-9
Manufactured model, ForwardDiff (max error vs exact) 2.36e-8 7.7e-9

Both the analytic operator check (cj = 1, 1e6, 1e10, both backends) and the manufactured-model solve against its exact solution are now tests.

3. Private import

OrdinaryDiffEqNonlinearSolve no longer imports JVPCache, and the QA exemption is removed.

  • It identifies the matrix-free DAE W by AbstractSciMLOperator, which it already imports; that name's existing QA entry is unchanged. On the DAE path, the only operator W that build_J_W returns is dae_jvp_cache.
  • It relinearizes through update_coefficients!(W, u, p, t; du). That du keyword is documented on Differentiation's method.
  • The per-step abstol goes through the existing dolinsolve, which gains an abstol keyword. No new name is imported.

4. Release coordination

Reproduced: registered OrdinaryDiffEqBDF 2.4.13 and OrdinaryDiffEqNonlinearSolve 2.9.9, with this Differentiation, throw MethodError: no method matching similar(::JVPCache…).

Changes:

  • OrdinaryDiffEqNonlinearSolve goes to 2.10.0.
  • OrdinaryDiffEqBDF goes to 2.4.14 and raises its floors to OrdinaryDiffEqDifferentiation = "3.13" and OrdinaryDiffEqNonlinearSolve = "2.10".

With these changes, developing this BDF into an environment pinned to NonlinearSolve 2.9.9 fails with Unsatisfiable requirements … restricted to versions 2.10.0 - 2 by OrdinaryDiffEqBDF.

Why the floors are on BDF rather than NonlinearSolve:

  • The DAE algorithms (DFBDF, DABDF2, DImplicitEuler) live in OrdinaryDiffEqBDF, so it is the only package that reaches this code path.
  • BDF's [sources] path-develop both siblings, and CI develops [sources] transitively on LTS, so its CI resolves.
  • NonlinearSolve has had no [sources] since Publish the nonlinear solver developer interface #4141, so its CI resolves registered siblings. Raising its own Differentiation floor to the unreleased 3.13 would leave its CI unresolvable until 3.13 is registered.
  • NonlinearSolve 2.10 with Differentiation ≤ 3.12 is coherent: no DAE JVPCache is built there, so the new branches are unreachable, and DAE + Krylov fails as it does on master today.
  • The floor convention from Correct NonlinearSolve downgrade dependency floors #4394 is "raise floors when the consumer needs the feature", as FIRK did for Differentiation 3.11 in Bump OrdinaryDiffEqFIRK Differentiation floor to 3.11 #4418. That is what the BDF change does. The NonlinearSolve floor can follow once Differentiation 3.13 is registered.

Tests on the new head

Suite Result
OrdinaryDiffEqBDF Core (--check-bounds=yes) 913 pass, 2 broken (pre-existing). DAE Krylov Tests 25/25
OrdinaryDiffEqDifferentiation Core + Sparse all 17 testsets pass
OrdinaryDiffEqDifferentiation QA JET 1, Aqua 19, JVPCache allocation 13 pass + 2 broken
OrdinaryDiffEqNonlinearSolve QA (Pkg.test, GROUP=QA) JET 13 pass / 33 broken (as before); Aqua 41/41, without the JVPCache exemption
OrdinaryDiffEqNonlinearSolve Core (each file in its own @safetestset, in-repo siblings developed) 1025 pass, 5 fail, 1 error, 40 broken

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 DAEProblem with PEC walls as algebraic rows. At 1e-6, 1e-8 and 1e-9, under both ForwardDiff and FiniteDiff, it ran with 0 nonlinear convergence failures and step counts within 3% of dense DFBDF. ForwardDiff took about 10 JVPs per Newton iteration.

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
Review: unreviewed
Session: aa65e380-52df-443a-9f57-8c20c56babb9

xtalax added a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Oct 22, 2026
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>
xtalax added a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Oct 22, 2026
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>
xtalax added a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Oct 22, 2026
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>
xtalax added a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Oct 22, 2026
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>
@xtalax

xtalax commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

CI follow-up in 7a0af25: the lib/OrdinaryDiffEqIMEXMultistep [QA] failure ("Unsatisfiable requirements … OrdinaryDiffEqNonlinearSolve … restricted to versions 2.10.0 - 2 by OrdinaryDiffEqBDF") came from this PR's new BDF floors.

  • Cause. On Julia ≥ 1.11, IMEXMultistep's QA environment develops the repository root, and the root's [sources] bring in the in-repo BDF 2.4.14. The QA environment also lists OrdinaryDiffEqNonlinearSolve and OrdinaryDiffEqDifferentiation as direct dependencies without [sources], so those two resolved to the registered 2.9.9 and 3.12.4, which conflict with BDF's new floors.
  • Fix. lib/OrdinaryDiffEqIMEXMultistep/test/qa/Project.toml now gets both packages from the repository through [sources], as the StochasticDiffEqLeaping, StochasticDiffEqWeak and StochasticDiffEqImplicit QA environments already do.
  • Verified with GROUP=QA Pkg.test() on Julia 1.12.6. The environment resolves to the in-repo NonlinearSolve 2.10.0 and Differentiation 3.13.0. Aqua passes 21/21, JET 1/1, and the allocation tests are 2 broken, with no failures or errors. Discontinuity restart passes 72/72.

#4866 and #4868 have this commit merged in. The ModelingToolkit.jl/InterfaceI downstream failure is components.jl:446 ("Causal connections generate causal equations"), which fails the same way on master's latest Downstream run at d2adddd.

🤖 Posted by an AI agent · harness: Claude Code 2.1.307 · model: claude-opus-5-5
Review: unreviewed
Session: aa65e380-52df-443a-9f57-8c20c56babb9

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a196b2-2e22-7750-a6d1-f0e614c41741, reviewed head 7a0af25

  • Verdict: MERGE-WITH-ISSUES
  • Risk: medium-low (ML2: specialized non-default DAE/Krylov path with independent analytic evidence; the blind medium assessment's missing-before/after modifier is resolved by local execution.)
  • Round / slot: 1 / 1
  • Blocking priorities: none

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 findings

None.

Non-blocking findings

  1. [P3] Refresh the PR description to match the final stopping rule and test coverage — confirmed by reading lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl:804 and lib/OrdinaryDiffEqBDF/test/dae_krylov_tests.jl:54. The description still says the weighted absolute bound is kappa/20 times sqrt(n), that user preconditioners retain LinearSolve's default absolute tolerance, and that there are 11 assertions. The head instead uses reltol times the first preconditioned residual norm for both preconditioner configurations and contains 25 assertions, including the scaled-residual and large-cj regressions. Update that narrative and the obsolete version/import statements so readers can assess the code actually proposed.

What I ran

All three Julia processes ran sequentially on Julia 1.13.2, aarch64, with JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1, an isolated temporary directory, the designated shared depot followed by default depots, and timeout 3600. No package-wide suite or Pkg.test() was run. In the command descriptions below, SHARED_DEPOT denotes the assigned depot; no absolute machine paths are reproduced.

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,workflowName

These 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 gh pr checks exited 1 because CI contains failures. The newest non-merge commit has Agent-Harness Claude Code 2.1.307 and Agent-Model claude-opus-5-5.

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.jl

The runner activates a separate env, develops the in-repository DiffEqBase, OrdinaryDiffEqCore, Differentiation, NonlinearSolve, SDIRK, and BDF together, adds the direct imports needed by the test, and includes lib/OrdinaryDiffEqBDF/test/dae_krylov_tests.jl unchanged. Resolved dependencies include LinearSolve 5.18.3, SciMLBase 3.58.0, SciMLOperators 1.30.4, ADTypes 1.24.0, and ForwardDiff 1.4.6. Output:

VERSION=1.13.2
DFBDF with a matrix-free linear solver on a DAEProblem | 11 / 11
Residual scale must not change solution               |  4 /  4
Matrix-free DAE Newton matrix at a large cj            | 10 / 10

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.jl

A 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:

FieldError: type DAEFunction has no field `mass_matrix`
DFBDF with a matrix-free linear solver on a DAEProblem | 1 error

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.jl

The 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 (nothing, nothing) preconditioner probe fails in standalone LinearSolve before reaching the DAE, so it is not evidence of a PR defect. These limitations were not hidden or rerun.

CI logs inspected with gh run view <id> --repo SciML/OrdinaryDiffEq.jl --log-failed, using a writable local gh cache after its default cache location proved read-only:

  • PR Sublibrary CI: BDF Core succeeds on Julia 1 and lts; Differentiation Core, QA, Sparse and ModelingToolkit, NonlinearSolve QA, and IMEXMultistep QA succeed. The BDF Core log, additionally retrieved with --job 119961797104 --log, reports DAE Krylov Tests | 25 25. NonlinearSolve Core on Julia 1 and lts fails with LineSearchException: Search direction is not a direction of descent. Step length: 0.0 in Newton Tests.
  • Recent master Sublibrary CI: the same NonlinearSolve Newton Tests exception appears, with four passes and one error. This supports treating that specific failure as pre-existing.
  • PR IntegrationTest: SciMLSensitivity Core4 errors in EnsembleThreads() with Enzyme AssertionError: mi2 !== nothing in parallelrules.jl. ModelingToolkit InterfaceI fails an equation-orientation isequal assertion in components.jl:446.
  • Recent master IntegrationTest: the identical Core4 Enzyme assertion appears. The ModelingToolkit equation-orientation failure was not established on master and is not claimed to be pre-existing.

What I did not verify

I 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
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74

xtalax and others added 3 commits November 2, 2026 16:05
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>
xtalax-droid pushed a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Nov 16, 2026
…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>
xtalax-droid pushed a commit to xtalax/OrdinaryDiffEq.jl that referenced this pull request Nov 16, 2026
…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>
@xtalax-droid

Copy link
Copy Markdown

Update: merged current master into this branch (merge commit, no history rewrite) and re-read the earlier review comments.

  • Both earlier reviews' code points were already addressed in 979e873; nothing further was open in the code.
  • Upstream master already has OrdinaryDiffEqDifferentiation 3.13.0, so the new dae_jvp_cache and dolinsolve abstol changes now ship as Differentiation 3.14.0, and the BDF, Rosenbrock and NonlinearSolve compat floors require 3.14. OrdinaryDiffEqBDF is bumped to 2.4.15 because 2.4.14 is already tagged.
  • Local results after the merge: BDF GROUP=Core passed; dae_krylov_tests.jl 25/25, bdf_reinit_tests.jl 754/754, bdf_restart_tests.jl 521/521.
  • CI on the previous head was held for workflow approval, so the new run also needs approval from a maintainer.

🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5
Review: unreviewed
Session: e8ff393f-88de-4244-97f6-60f2e09fe20b

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>
@xtalax-droid

Copy link
Copy Markdown

Update: the first CI run on this PR failed at dependency resolution in three jobs (downgrade-sublibraries for lib/OrdinaryDiffEqNonlinearSolve and lib/StochasticDiffEqLeaping, and sublibrary-ci Core on Julia 1 for lib/OrdinaryDiffEqNonlinearSolve). The previous commit raised the OrdinaryDiffEqDifferentiation compat floors to 3.14, but the registry only has Differentiation up to 3.12.5, so those environments had no versions left.

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"). OrdinaryDiffEqDifferentiation stays at 3.14.0, BDF at 2.4.15 and NonlinearSolve at 2.10.0. The new DAE code needs Differentiation 3.14.0, so the floors should be raised to 3.14 in a follow-up change once 3.14.0 is registered; until then a resolver could pair the new BDF/NonlinearSolve with an older Differentiation.

Local check after the change: the NonlinearSolve test environment resolves against the registry, and dae_krylov_tests.jl passes 25/25. I could not reproduce the downgrade job locally (its resolver script crashes on this host), so that job is the one to watch on the next run. The remaining NonlinearSolve Core failure seen on other PRs (LineSearchException in newton_tests.jl) is pre-existing and unrelated.


🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5
Review: unreviewed
Session: e8ff393f-88de-4244-97f6-60f2e09fe20b

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>
@xtalax-droid

Copy link
Copy Markdown

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 Success for some Krylov configurations: KrylovJL_GMRES(; ldiv = false) with the default preconditioner (LinearSolve's warm-start residual applies the preconditioner with ldiv! regardless of ldiv, and the default InvPreconditioner then inverts the weights under mul!), and likewise the Krylov.jl keywords M, N, W, atol and rtol, and methods such as DQGMRES, CG and MINRES whose residual is not measured as norm(Pl \ r). The default KrylovJL_GMRES() (ldiv = true) was not affected.

The commit adds check_dae_krylov in lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl, called once from build_nlsolver (not per step). It throws an ArgumentError for ldiv = false, for those keywords, and for any KrylovJL method other than GMRES, FGMRES and BiCGStab. A new testset in dae_krylov_tests.jl adds 12 assertions (6 must throw, 6 check GMRES, FGMRES and BiCGStab against the dense reference); the two throwing cases tried on the previous head did not throw there. dae_krylov_tests.jl passes 37/37 locally.


🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5
Review: unreviewed
Session: e8ff393f-88de-4244-97f6-60f2e09fe20b

This branch has not been deployed

No deployments
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.

Matrix-free Linear Solve support for DAEProblem

4 participants