PyRoll: A Python Gravity Well Simulation


PyRoll, a program written in Python with GLUT (PyGLUT), is designed to model a gravity well.  The program has a framework that makes it easy to modify it to allow for the modeling of other surfaces. 

Gravity Wells

A gravity well represents the potential of an object at a certain point, relative to a fixed "large" mass.  By setting the height of an object proportional to its gravitational potential energy, we wind up with a system that models the solar system.

Since the equation for gravitational potential is:

g= C/r= C/sqrt(x^2+y^2), we end up with an object that looks like a funnel.

How the Program Works

About every twentieth of a second on a P4, the program derives an approximation of the slope of our surface at the point where our object/ "ball" is.  It then comes up with approximations of the object's new acceleration, velocity, and displacement.

Running the Program

To execute (run) the program, go to the directory where the program currently is, and run the command:


The following controls are available:

R: Restart
Q: Quit
F: Friction (to be implemented at a later date.


A copy of the program's documentation may be downloaded here.

Source Code

A copy of the source code may be obtained here.