Introduction

Here is my second release of Kaliope - a code for solving N-body problems written in C++. It is loosely based upon the series of books entitled The Kali Code by Piet Hut and Jun Makino. You can download these books for free at www.artcompsci.org

Below are links to two MPEG movie clips which will give you an idea of what an N-Body simulator does. Kaliope only creates data output in text format, so the output was processed via a small Perl script (included in the tarball distribution) and the convert utility found in the ImageMagick software library.

clip 1
clip 2

Downloading and Compiling the Code

To download a gzipped tarball of the code, right click on the link below:

Download kaliope-0.3.tar.gz

To unpack and compile the code type the following commands at your UNIX/Linux prompt denoted by '$':

$ tar -xzvf kaliope-0.3.tar.gz 
$ cd kaliope
$ make
Note that I've only compiled this code on my laptop with GCC 3.3.5, your mileage may vary with other versions of GCC and other compilers.

If the code compiled, and linked without errors (warnings are OK), then you should have files named mkcluster and kaliope in the src subdirectory of the directory created by unpacking the tarball. You can easily check to see if an executable was created by typing the following commands at your UNIX/Linux prompt:

$ cd src
$ ls -l
If the build/compile worked properly, then you'll see files named mkcluster and kaliope in the src directory.

Running the Program

Next to run and test the code, we'll use a pre-made input file located in the input subdirectory of the src directory. Type the following command at your prompt:

$ ./kaliope -i input/figure8.in --tf=2 -o out

After you've run the code, you can look at the output using gnuplot. Just type gnuplot at your UNIX/Linux prompt, to start an interactive session, and then type the following commands at the gnuplot prompt:

gnuplot> plot 'out' using 3:4 every 3::0
gnuplot> replot 'out' using 3:4 every 3::1
gnuplot> replot 'out' using 3:4 every 3::2

You should get something that looks like the image below. The image shows the paths of three bodies of equal mass as they begin to orbit each other in a figure-8 configuration. The interesting thing about this configuration is that it is stable. Whereas most 3-body configurations are unstable and eventually exhibit chaotic behavior.


Documentation

I am not currently working on this code, but hopefully it may be useful to you. The input file format is simply one line per body, where each body has the format:

[body number : unsigned int] [mass : real] [x : real] [y : real] [z : real] [v_x : real] [v_y : real] [v_z : real]

Quotes

I believe that a scientist looking at nonscientific problems is just as dumb as the next guy. Richard Feynman (1918 - 1988)

Click the refresh button to see a different quote.