Skip to content

Commit d6af49b

Browse files
committed
use non SciMLOperator W_prototype
1 parent 77e0f19 commit d6af49b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function do_newJW(integrator, alg, nlsolver, repeat_step)::NTuple{2, Bool}
391391
# TODO: add `isJcurrent` support for Rosenbrock solvers
392392
if !isnewton(nlsolver)
393393
isfreshJ = !(integrator.alg isa CompositeAlgorithm) &&
394-
(integrator.iter > 1 && errorfail && !integrator.u_modified)
394+
(!integrator.u_modified)
395395
return !isfreshJ, true
396396
end
397397
isfirstcall(nlsolver) && return true, true
@@ -684,9 +684,9 @@ function build_J_W(alg, u, uprev, p, t, dt, f::F, ::Type{uEltypeNoUnits},
684684
# TODO - if jvp given, make it SciMLOperators.FunctionOperator
685685
# TODO - make mass matrix a SciMLOperator so it can be updated with time. Default to IdentityOperator
686686
islin, isode = islinearfunction(f, alg)
687-
if isdefined(f, :W_prototype) && (f.W_prototype isa AbstractSciMLOperator)
688-
# We use W_prototype when it is provided as a SciMLOperator, and in this case we require jac_prototype to be a SciMLOperator too.
689-
if !(f.jac_prototype isa AbstractSciMLOperator)
687+
if isdefined(f, :W_prototype) && !isnothing(f.W_prototype)
688+
# If W_prototype is a SciMLOperator, we require jac_prototype to be a SciMLOperator too.
689+
if f.W_prototype isa AbstractSciMLOperator && !(f.jac_prototype isa AbstractSciMLOperator)
690690
error("SciMLOperator for W_prototype only supported when jac_prototype is a SciMLOperator, but got $(typeof(f.jac_prototype))")
691691
end
692692
W = f.W_prototype

0 commit comments

Comments
 (0)