diff --git a/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl b/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl index e92e309c5c..bcfbfcb48c 100644 --- a/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl +++ b/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl @@ -115,6 +115,12 @@ const TryAgain = SlowConvergence DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing isdiscretecache(cache) = false +@static if isdefined(DiffEqBase, :unitfulvalue) + unitfulvalue(x) = DiffEqBase.unitfulvalue(x) +else + unitfulvalue(x) = DiffEqBase.ForwardDiff.value(x) +end + include("doc_utils.jl") include("misc_utils.jl") diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index d1f8a689b1..6dbd14e4f7 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -232,11 +232,11 @@ function DiffEqBase.__init( abstol_internal = false elseif abstol === nothing if uBottomEltypeNoUnits == uBottomEltype - abstol_internal = DiffEqBase.ForwardDiff.value(real(convert(uBottomEltype, + abstol_internal = unitfulvalue(real(convert(uBottomEltype, oneunit(uBottomEltype) * 1 // 10^6))) else - abstol_internal = DiffEqBase.ForwardDiff.value.(real.(oneunit.(u) .* 1 // 10^6)) + abstol_internal = unitfulvalue.(real.(oneunit.(u) .* 1 // 10^6)) end else abstol_internal = real.(abstol) @@ -246,10 +246,10 @@ function DiffEqBase.__init( reltol_internal = false elseif reltol === nothing if uBottomEltypeNoUnits == uBottomEltype - reltol_internal = DiffEqBase.ForwardDiff.value(real(convert(uBottomEltype, + reltol_internal = unitfulvalue(real(convert(uBottomEltype, oneunit(uBottomEltype) * 1 // 10^3))) else - reltol_internal = DiffEqBase.ForwardDiff.value.(real.(oneunit.(u) .* 1 // 10^3)) + reltol_internal = unitfulvalue.(real.(oneunit.(u) .* 1 // 10^3)) end else reltol_internal = real.(reltol)