We provide a lot of examples for REBOUND. We think examples are the easiest way to learn how to use REBOUND. This is a list of all examples that come with REBOUND. You can find all the source code for these in the examples and ipython_examples directories.
The examples are sorted by topic. Note that some examples use the C version, other the python version of REBOUND. Often, the syntax is very similar and you might want to look at the c examples even if you want to write python code and vice verse.
All examples in this section are related to simulations of planetary systems.
The following examples are good if you’re just starting to use REBOUND.
If you want to capture close encounters and collisions between particles, have a look at the following examples.
The following examples demonstrate how to calculate orbital elements.
If you are interested in simulating a planetary system in which there are many small particles, have a look at the following examples.
Some more advanced topics are covered in the following examples.
- Advanced settings for WHFast: Extra speed, accuracy, and additional forces (iPython)
- High Order Symplectic Integrators (C)
- Resonances of Jupiter’s moons, Io, Europa, and Ganymede (iPython)
- Calculating Transit Timing Variations (TTV) with REBOUND (iPython)
- Loading Hyperbolic Orbits into REBOUND (iPython)
- High Order Symplectic Integrators (iPython)
- Embedded Operator Splitting (EOS) Methods (iPython)
Checkpoints and Simulation Archive¶
All examples in this section demonstrate how to store, reload and restart simulations. They also show how to use the Simulation Archive. It is a framework that allows you to not only restart simulations, but recreate them bit-by-bit in a machine independent way. With the simulation archive you can run a simulation first, then think later about how you want to analyze it.
Variational Equations and Chaos detectors¶
REBOUND supports first and second order variational equations. Varational equations have several advantages over shadow particles when calculating chaos indicators such as Lyapunov exponents. They can also be used in optimization problems. For more details on variational equations and the math behind them, have a look at the paper Rein and Tamayo 2016 and the following examples.
If you are interested in chaos indicators such as MEGNO, have a look at the following examples.
REBOUND lets you add additional forces to your simulations. These can be used to simulate radiation drag, general relativistic corrections, planet migration or any other force that you can come up with. The following list has a few simple examples. You might also want to check out REBOUNDx which is an add-on to REBOUND that has many additional forces already implemented, so you don’t have to do the work.
The examples in this section show how to use REBOUND for simulations in which particles are colliding with each other. Note that this is a different type of simulation than simulations of colliding planets. Here, particles collide often with each other. In the planet case, they collide with each other very rarely.
REBOUND has a built in Barnes-Hut oct tree for collision detection and gravity. This allows you, for example, to simulate large gravitationally interacting systems.
The following examples show simulations integrating particles in planetary rings. They use values characteristic for Saturn’s rings but can also be used for other ring systems.
REBOUND comes with several built-in visualization tools. Most of the C examples can be run with OPENGL visualization (just edit the make file in the corresponding directory). If you use Jupyter notebooks, you can use a webGL widget that interactively runs in your notebook. REBOUND also comes with tools that can be used to visualize orbits using the matplotlib library. The following examples illustrate the visualization feature for python.
The following examples illustrate how to remove particles from simulations, i.e. after a collision.
And finally, the following examples didn’t fit anywhere else. They for example show how to use hashes to identify particles.