N-body simulation - Blue Planet

"So who is the real Mr. Tines? The monster who'd smash a world, or the nice guy I'm hearing now?"
-- The Blabber, Vernor Vinge.

S I T E   M A P

λ Serpentis II

22-Nov-02 - Finally got round to fixing a minor but annoying bug (where I resized the display window to the wrong size on occasion), and took the opportunity to tidy up the control panel part, and allow for collisions (assumed inelastic, for simplicity, as it's still "Game Over" at that point).

It's still all Java 1.0.2, because it doesn't need any more.


The simulation uses a generalised N-body algorithm, converted to Java from the Fortran code by Sverre Aarseth and given in Binney & Tremaine's Galactic Dynamics. Two instances are used in this applet : the left hand display shows the system with the moons having negligible mass, and velocities for circular orbits as stated; the right has the moons with mass (and the planet with corresponding velocities to keep the centre of mass stationary in the display).

The relative angle of the two moon at the start of the simulation can be controlled by the slider below (the figure above giving the separation in degrees), with the outer moon (grey) moving around its orbit (the outer light blue circle); while the inner moon (green) remains fixed in its orbit (inner light blue circle).

The system is set running by hitting the button. The time elapsed in days is given in the line below the frame, plus the energy (in arbitrary units) of the massive system - which should remain constant, but will vary slightly due to compuational noise. A scale bar is given, and the displays rescale to fit any extreme excursione by any moon.

If a moon is ejected from the system, or collides with another body this will be logged above the status line.

Alas! Either your browser is not one for which I've been able to get XHTML object tags to work, or perhaps it's not Java enabled!





Download the source

Download the class archive which can also be run as a Java application. Simply add the archive to your classpath and then


java Nbody

or use the appropriate classpath modifier on the command line. Or write the following in the body of a web page in the same directory as the downloaded archive

<applet code="Nbody.class" 
archive="nbodyzip.zip" 
height="150" width="250" >
</applet>

and view it in your Java enabled browser.


Made with Cascading Style Sheets

This document maintained by domain webmaster - tines at ravna and tines dot com.

Material Copyright © 2000-2003 Mr. Tines

S I T E   M A P
Hosted by www.Geocities.ws

1