diff --git a/src/OrdinaryDiffEq.jl b/src/OrdinaryDiffEq.jl index ae6b2001ab..505f8c72ac 100644 --- a/src/OrdinaryDiffEq.jl +++ b/src/OrdinaryDiffEq.jl @@ -108,7 +108,7 @@ import ADTypes: AbstractADType, import Polyester using MacroTools, Adapt -using SciMLStructures: canonicalize, Tunable +using SciMLStructures: canonicalize, Tunable, isscimlstructure const CompiledFloats = Union{Float32, Float64, ForwardDiff.Dual{ diff --git a/src/initialize_dae.jl b/src/initialize_dae.jl index 2618ea1b79..9404d9531f 100644 --- a/src/initialize_dae.jl +++ b/src/initialize_dae.jl @@ -528,9 +528,10 @@ function _initialize_dae!(integrator, prob::ODEProblem, if isAD csize = count(algebraic_vars) if !(p isa SciMLBase.NullParameters) && typeof(_u) !== typeof(u) - try + if isscimlstructure(p) csize = max(csize, length(canonicalize(Tunable(), p)[1])) - catch + else + csize = max(csize, length(p)) end end chunk = ForwardDiff.pickchunksize(csize)