Simulation speed surges forward when varying the time increment and "Steps Per Display".

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". -

Wolfgang
191 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 Cash-Karp 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 Cash-Karp 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". -

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.