SciML / OrdinaryDiffEq.jl

High performance ordinary differential equation (ODE) and differential-algebraic equation (DAE) solvers, including neural ordinary differential equations (neural ODEs) and scientific machine learning (SciML)
https://diffeq.sciml.ai/latest/
Other
521 stars 198 forks source link

autoswitch solvers can cause the stiff solver to fail #2198

Closed oscardssmith closed 1 month ago

oscardssmith commented 1 month ago
julia>  using OrdinaryDiffEq
julia> function exrober(du, u, p, t)
           y₁, y₂, y₃ = u
           k₁, k₂, k₃ = p
           du .= vcat([-k₁ * y₁ + k₃ * y₂ * y₃,
             k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2,
             k₂ * y₂^2], u[4:end])
       end
julia> prob1 = ODEProblem(exrober, vcat([1,0,0], ones(470)),(0.0,100.0),(0.04,3e7,1e4))
julia> prob2 = ODEProblem(exrober, vcat([1,0,0], ones(480)),(0.0,100.0),(0.04,3e7,1e4))
julia> solve(prob1, AutoTsit5(FBDF())) #works
julia> solve(prob2, AutoTsit5(FBDF())) #hits maxiters, tries to switch to FBDF but the FBDF nonlinear solve never converges
julia> solve(prob2, FBDF()) #works