Skip to content

Commit 88400a3

Browse files
Disable J reuse for operator-based W (Krylov solvers)
WOperator and AbstractSciMLOperator wrap J internally for Krylov solvers. A stale J degrades Krylov convergence, causing order loss (e.g. Rodas5P+Enzyme+KrylovJL dropping from order 5 to 1.7). Always recompute J for these W types. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
1 parent 089ea9a commit 88400a3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ function _rosenbrock_jac_reuse_decision(integrator, cache, dtgamma)
5454
return (true, true)
5555
end
5656

57+
# Operator-based W (WOperator for Krylov solvers, AbstractSciMLOperator):
58+
# always recompute. Krylov convergence depends on W quality, and stale J
59+
# in the operator causes convergence degradation.
60+
if cache.W isa WOperator || cache.W isa AbstractSciMLOperator
61+
return (true, true)
62+
end
63+
5764
# Linear problems: J is constant, never needs recomputation after first eval.
5865
# But W still depends on dtgamma, so always rebuild W.
5966
islin, _ = islinearfunction(integrator)

0 commit comments

Comments
 (0)