DifferentialEquations.jl Solution handling with ArrayPartition?

Hello everyone,

I have a very simple question, yet one I can’t seem to work out easily.
Is there a straighforward way to access the different parts of an ArrayPartition solution that we have obtained with DifferentialEquations.jl?

E.g., if we do something along the lines of

u0 = ArrayPartition(a, b, c)
prob = ODEProblem(du_dt!, u0, tspan, p)
sol = solve(prob, Tsit5())

Is there a quick and easy way to obtain the a part of the solution at all timepoints?

Thanks in advance!

Something like getindex.(getfield.(sol.u, :x), 1) ?

2 Likes