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.

Best methods to compensate for runaway mechanical energy.

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

What are the best methods for keeping mechanical energy from running away in a many-body simulation? - August 11, 2016 at 2:48
Stephen Salser
8 Posts

Here are two approaches I have tried to keep mechanical energy from running away in a many body simulation of coulomb interactions.

1.  The approach that worked fairly well was to introduce small velocity dependent drag forces with coefficients that depend on how much too high or too low the total mechanical energy is.  When the mechanical energy is too high, the drag coefficients are positive and the particles slow down, but when the mechanical energy is too low, the drag coefficients are negative and the particles speed up.  To make this work well I also had to limit the intensity of the interactions by setting the coulomb force to zero below a particular cutoff radius -- in effect treating each particle pair as if it were a hollow sphere interacting with a point-like particle, but not specifying which is which.  I treated the potential energy in a consistent way, and things became fairly stable.  The disadvantage of this method is that ALL particles are slowed down when the bulk of the mechanical energy runaway typically involves just the particles that are interacting very strongly.  

2.  The approach that totally failed was to try to adjust the velocities of the particles manually either in the "Fixed relations" page or in the "Prelim code".  If the adjustments were made in "Fixed relations", then events like wall collisions were no longer handled properly.  If the adjustments were made in "Prelim code", the ODE solver appeared to compensate for my manual changes.  For example, if I clamped the velocities to zero in the "Prelim code" the ODE solver appeared to vary the velocity anyway, while keeping the particles position fixed, as if the particles were simultaneously accelerating and standing still.

My conclusion was that it is better to compensate for errors in a way that uses physically meaningful changes like modifications in the interaction force law or the addition of compensatory drag forces.

Are there other more elegant methods I should be aware of for many-body simulations?

P.S.  I was very interested in looking at the "Particles and Walls" simulation that is pictured at the front of "Easy Java Simulations -- The Manual" by Francisco Esquembre, but I couldn't find a download that worked for me and/or could be opened in the EjsS environment.

Post edited August 11, 2016 at 2:53 PM EST.

Current Replies - View all
Re: What are the best met...   (lookang - August 12, 2016 at 12:46)
OSP Projects:
Open Source Physics - EJS Modeling
Physlet Physics
Physlet Quantum Physics
STP Book