From 76d3bded416b5d707621cc37d2013f22d295870d Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Tue, 6 Aug 2024 15:31:27 +0530 Subject: [PATCH 1/2] feat: perform limited DAE initialization for null integrators/solutions --- src/solve.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/solve.jl b/src/solve.jl index 1b0a7c54e..6de8273f4 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -626,6 +626,9 @@ end function build_null_integrator(prob::AbstractDEProblem, args...; kwargs...) sol = solve(prob, args...; kwargs...) + # The DAE initialization in `build_null_solution` may change the parameter + # object `prob.p` via `@set!`, hence use the "new" prob instead of the "old" one. + prob = sol.prob return NullODEIntegrator{ isinplace(prob), typeof(prob), eltype(prob.tspan), typeof(sol), typeof(prob.f), typeof(prob.p) @@ -675,7 +678,12 @@ function build_null_solution(prob::AbstractDEProblem, args...; end timeseries = [Float64[] for i in 1:length(ts)] - + + if SciMLBase.has_initializeprob(prob.f) && SciMLBase.has_initializeprobpmap(prob.f) + initializeprob = prob.f.initializeprob + nlsol = solve(initializeprob) + @set! prob.p = prob.f.initializeprobpmap(prob, nlsol) + end build_solution(prob, nothing, ts, timeseries, retcode = ReturnCode.Success) end From 4b2540ac7da4cc3536a8cc49251fd354eab36c50 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Mon, 7 Oct 2024 18:50:09 +0530 Subject: [PATCH 2/2] build: bump SciMLBase compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 86a6246d3..7892d2351 100644 --- a/Project.toml +++ b/Project.toml @@ -94,7 +94,7 @@ Printf = "1.9" RecursiveArrayTools = "3" Reexport = "1.0" ReverseDiff = "1" -SciMLBase = "2.53.0" +SciMLBase = "2.56.0" SciMLOperators = "0.3" SciMLStructures = "1.5" Setfield = "1"