DifferentialEquations.jl icon indicating copy to clipboard operation
DifferentialEquations.jl copied to clipboard

SavedValues seems to be not in solution sol (as needed for ensemble simulations)

Open MartinOtter opened this issue 5 years ago • 1 comments

Assume additional variables are computed with the SavedValues callback:

prob = ODEProblem((du,u,p,t) -> du .= u, rand(4,4), (0.0,1.0))
saved_values = SavedValues(Float64, Tuple{Float64,Float64})
cb = SavingCallback((u,t,integrator)->(tr(u),norm(u)), saved_values, saveat=0.0:0.1:1.0)
sol = solve(prob, Tsit5(), callback=cb)

It seems that saved_values is not stored in sol. This probably means that for ensemble simulations, it is not possible to store additional variables?

A simple remedy would be to include saved_values in sol (that is sol.saved_values).

MartinOtter avatar Jan 16 '20 16:01 MartinOtter

Indeed I've been thinking that we need something good for explicit algebraic variables, but making it work nicely with the interpolation is where I got stuck. Maybe just not interpolating and having a save function is good enough for now for these use cases.

ChrisRackauckas avatar Jan 19 '20 21:01 ChrisRackauckas