From 9475a1b6d1f2c8a83acd58294e380e19842a25dd Mon Sep 17 00:00:00 2001 From: Oscar Smith Date: Tue, 3 Sep 2024 11:41:07 -0400 Subject: [PATCH 1/3] specialize `ODEProblem` Otherwise the alg and prob were disagreeing about the chunksize (since prepare_alg thought we weren't FunctionWrappered since it didn't know we were an ODE yet) --- src/solve.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solve.jl b/src/solve.jl index 9da11cd..9fd5470 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -52,7 +52,7 @@ function SciMLBase.__solve(prob::SciMLBase.AbstractSteadyStateProblem, alg::Dyna (callback = CallbackSet(callback, odesolve_kwargs[:callback])) # Construct and solve the ODEProblem - odeprob = ODEProblem{isinplace(prob)}(f, prob.u0, tspan, prob.p) + odeprob = ODEProblem{isinplace(prob), true}(f, prob.u0, tspan, prob.p) odesol = solve(odeprob, alg.alg, args...; abstol, reltol, kwargs..., odesolve_kwargs..., callback, save_end = true) From 07dac7127a03eb7766fceb794b97c43e60adb664 Mon Sep 17 00:00:00 2001 From: Oscar Smith Date: Tue, 3 Sep 2024 11:54:45 -0400 Subject: [PATCH 2/3] add test --- test/core.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/core.jl b/test/core.jl index 92470d1..7b62ae8 100644 --- a/test/core.jl +++ b/test/core.jl @@ -35,6 +35,11 @@ end sol = solve(prob, DynamicSS(CVODE_BDF()), dt = 1.0) @test SciMLBase.successful_retcode(sol.retcode) + # test autodiff + sol = solve(prob, DynamicSS(Rodas5P())) + + @test SciMLBase.successful_retcode(sol.retcode) + # scalar save_idxs scalar_sol = solve(prob, DynamicSS(CVODE_BDF()), dt = 1.0, save_idxs = 1) @test scalar_sol[1] ≈ sol[1] From cd70ba7e9317e2a6bd3fbe1afd8bb083c14e10b1 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 4 Sep 2024 08:43:43 -0400 Subject: [PATCH 3/3] Update core.jl --- test/core.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core.jl b/test/core.jl index 7b62ae8..18b5034 100644 --- a/test/core.jl +++ b/test/core.jl @@ -42,7 +42,7 @@ end # scalar save_idxs scalar_sol = solve(prob, DynamicSS(CVODE_BDF()), dt = 1.0, save_idxs = 1) - @test scalar_sol[1] ≈ sol[1] + @test scalar_sol[1] ≈ sol[1] atol=1e-6 f(du, sol.u, p, 0) @test du≈[0, 0] atol=1e-6