2

I have a large system of about 1000 differential equations, such as

function HR(du,u,p,t)
        du[1,:] .= u[2,:] .- a*u[1,:].^3 .+ b.*u[1,:].^2 .+ I .-u[3,:] .+(ϵ/N)*sum(u[1,:])
        du[2,:] .= c .- d.*u[1,:].^2 .- u[2,:]
        du[3,:] .= r.*(s.*(u[1,:] .+ k) .- u[3,:])
end

for which I provide a matrix of initial conditions u0 (3 rows by 1000 columns). The letters a,b,c,d,I... are global variables. Solving the ODEs works fine as long as the time span (tspan) does not exceed 1000.0.

tspan=1000.0
prob = ODEProblem(HR, u0, tspan)
sol = solve(prob, Tsit5(),
            alias_u0=true,
            save_idxs=idxs,
            save_at=0.1,
            reltol=1e-5, abstol=1e-5,
            progress = true,
            maxiters = 1e7
            )

Solving this takes less than one minute but when I increase tspan my computer crashes. Why does it happen? How could I increase tspan without increasing runtime too much or crashing my computer?

I've thought about doing it for time windows: solve the ODEs to tspan=1000.0 once, get the final conditions, use them as initial conditions and solve the ODEs again, in a loop. In the end I just amend each solution. But I'm not sure if this is the best way to get around this problem because it still crashes my computer.

Any tips or explanation as to why this happens?

  • Please be more specific in "my computer crashes". If that requires a reboot it is a serious problem in the julia language compiler. If you get a memory violation, this could be a serious problem in the solver package. If the IDE terminates, ... – Lutz Lehmann Apr 11 '22 at 06:21
  • How large do your values get, how much memory does the solver use for the solution samples? (Does sol contain "dense output" data?) – Lutz Lehmann Apr 11 '22 at 06:29
  • 1
    Are you on an old version? It should be throwing a warning about `save_at=0.1` being incorrect. Fixing that would help ensure it doesn't over-save. – Chris Rackauckas Apr 12 '22 at 12:18

0 Answers0