For what reason an ODE solver could run for ever?

1 次查看(过去 30 天)
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 个评论
Andrew Reibold
Andrew Reibold 2014-11-26
"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 2014-11-26
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.

请先登录,再进行评论。

采纳的回答

Mohammad Abouali
Mohammad Abouali 2014-11-26
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by