Hands-on Numerical Astrophysics School for Exoplanetary Sciences, SPP1992 Summer School, Kloster Höchst, Germany, June 25-29, 2018

Monday 14:00-17:00 N-body modelling

(animated gifs by Cristopher Moore)

In the first session of the summer school, we will focus on the (gravitational) N-body problem: The numerical solution of the equations of motion for N gravitationally interacting particles/bodies.

The astrophysical domains that require N-body simulations are celestial mechanics (planetary systems), star clusters, galaxy dynamics and cosmology.

In our programming session, we will use the REBOUND code by Hanno Rein and focus on collisional N-body simulations, that is planetary systems.

There are two different versions of the code available: C and python. We will use the C version (without any parallelization, that is no MPI and no OpenMP). You do not need to install the python version.


Prerequisites: working C compiler
for data analysis, we will need python3 with modules matplotlib, numpy or gnuplot or your preferred postprocessing plotting tool. Please clone the code from Hanno's git repository via
git clone http://github.com/hannorein/rebound

If you have libglfw3-dev and libglfw3 installed on your system, rebound offers a nice X interface showing the simulation. However, we will not need this at all costs, since we will use rebound's i/o functions and analyse the simulation in a postprocess step. The code sources include some examples. Please verify that you can compile and run the example "simplest". Add export OPENGL=0 at the head of your makefile.
cd rebound/examples/simplest && make && ./rebound
You should get the following output in your terminal (last lines shown)

Well done, you're ready for the coding session!

If you have no experience with the programming language C, you might want to look into some of the basics. There are very good beginner tutorial on the web for free, such as the C-programming tutorial from Alex Allain. Be sure to pass Lesson 1. We will not need many features of the C language but basic knowledge is required for the coding session.

The slides from the lecture.

The exercise sheet from the hands-on session.

Please contact me if you face any problems in these steps.

last update: 2018-06-26