APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Erratic simulation speed while varying "Steps Per Display" to compensate for changing time increment.

Return to the OSP Programming forum
Login to post to this thread

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?

Current Replies - View all
Re: Simulation speed surg...   (Wolfgang - )
Re: Re: Simulation speed ...   (Stephen Salser - )
Re: Re: Re: Simulation sp...   (Wolfgang - )
OSP Projects:
Open Source Physics - EJS Modeling
Physlet Physics
Physlet Quantum Physics
STP Book