Erratic simulation speed while varying "Steps Per Display" to compensate for changing time increment.
post and replies
Return to the Erratic simulation speed while varying "Steps Per Display" to compensate for changing time increment. thread
Login to post to this thread
Simulation speed surges forward when varying the time increment and "Steps Per Display".
 August 11, 2016 at 1:57

Stephen Salser
8 Posts

I tried to change the "Steps Per Display" so that finer calculations with a sorter time increment could be done only when necessary (for example when a close approach is imminent ).
I arranged it so that the product of "Steps Per Display" and the time interval is constant.
When I vary them slowly, the simulation works beautifully and maintains a constant speed even over four orders of magnitude in the "Steps Per Display".
However, when the "Steps Per Display" is reduced suddenly the simulation surges forward discontinuously, sometimes by several seconds.
Is there an elegant way to fix this problem so that finer calculations can automatically be applied when a collision is about to occur, and fewer calculations can be done once the collision is over?

Re: Simulation speed surges forward when varying the time increment and "Steps Per Display".  August 11 2016 7:43

Wolfgang
141 Posts

You do not need to adjust the steps per display to achieve a constant evolution time step while adjusting the numerical time step. OSP ODE solvers with adaptive time step size, such as the RK4 CashKarp solver, advance the ODE with a constant time time step. The ODE solver takes many small internal (hidden from the user) time steps using the CashKarp algorithm to maintain the requested accuracy. This approach is much more efficient that having the user adjust the steps per display.

Re: Re: Simulation speed surges forward when varying the time increment and "Steps Per Display".  August 11 2016 2:20

Stephen Salser
8 Posts

Thank you so much for the information. It helps enormously!
Is there any way for the ejs user to monitor the size of the extra hidden steps that the solver is using so as to better appreciate and understand how hard the solver is working?
Also, is there any good, in depth comparison of the different OSP ODE solvers and the strategies they employ?
P.S. I have a question about the best methods to compensate for errors in mechanical energy conservation, but I will start a new thread. I am new to discussion forums, so please let me know if I am doing anything wrong. Your help is much appreciated.

Re: Re: Re: Simulation speed surges forward when varying the time increment and "Steps Per Display".  August 11 2016 2:30

Wolfgang
141 Posts

See Appendix A in Chapter 3 of an Introduction to Computer Simulation Methods.
http://www.compadre.org/osp/items/detail.cfm?ID=7375

