For what reason an ODE solver could run for ever?

1 view (last 30 days)
I am running a simulation with ODE4 and it seems that it will never end(3 hours now).I have already run it before with less time,like t=0:0.1:1000 and it took like 20 minutes to run.Now I doubled the time(t=0:0.1:2000) and i was expecting a running time of 40 minutes,propotional to my previous run.But not.What could cause it?
  2 Comments
Andrew Reibold
Andrew Reibold on 26 Nov 2014
"My code takes longer when there are more equations to solve. [This makes sense] However, my code took longer than I expected it to. Why?"
Not nearly enough information to address this. We can only troubleshoot with what you provide us
Mike Hosea
Mike Hosea on 26 Nov 2014
Did you mean ODE45 or actually ODE4? I don't know what ODE4 looks like. If it is a fixed step method, I would say Mohammad is on the right track. If variable step, then there are several possibilities such as those mentioned by Star Strider I would probably suspect first.

Sign in to comment.

Accepted Answer

Mohammad Abouali
Mohammad Abouali on 26 Nov 2014
It could be various reason.
How do you store the variables? Once running the code for twice the time t_max=2000, are you storing them all? do you require more memory? If your memory footprint is changing by increasing total time, you shouldn't expect linear increase in computer time to solve the problem.
So, in short the answer to your question highly depends on how you coded your program.
Another thing that comes to my mind is that have you checked for stability? has your code destabilized and generated NaN?
You could check your memory consumption, pay special attention to cached memory being used. If it is spiking, between the two runs, it means that you do not have enough memory for longer runs. Try to change your code to reduce it's memory footprint with increasing simulation time.
But as I said, there could be other reason for this.
  1 Comment
Dimitrios
Dimitrios on 26 Nov 2014
I didnt expect to be this,but actually it is spiking.Need a new laptop :/

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!