Click here to run the simulation (This works best in Firefox)

Controls

The flat side of the sail is a mirror so point it toward the sun to gain or lose momentum from sunlight.

Left Arrow        rotate counterclockwise
Right Arrow rotate clockwise
Plus zoom in
Minus zoom out
Ctrl-Left move screen left
Ctrl-Right move screen right
Ctrl-Up move screen up
Ctrl-Down move screen down

About

In this simulation you can explore the inner planets with a solar sail! Point the flat mirror side towards the sun to escape from the solar system or point it in the direction of your velocity to lose momentum and get close to the sun. You may be able to get into the orbit of one of the planets if you try really hard.

The orbits of most bodies are drawn so you can see where they're going. The path drawn for the sail ignores light pressure, so it shows the path of the sail as long as the mirror stays pointed away from the sun. Orbits aren't drawn for those that aren't in elliptical orbits (i.e. the sun or the sail if it has escaped the sun's gravity).

Time passes slower when the sail is in a faster orbit, closer to the sun. You can see the planets going faster when you're close to the sun and slower when you're far. Simulation time is scaled so it takes 40 seconds of real time to complete a circular orbit.

This simulation is pretty accurate with the exceptions that the sail is about 300 times less massive than a modern sail would be. In particular it's about 300 times less massive than the Ikaros craft, which means that its acceleration is 300 times Ikaros' acceleration.

Implementation

I wrote this in C++ and translated it to Javacript using the emscripten compiler. Emscripten uses LLVM to compile C/C++ to Javascript and includes implementations in Javascript of some common C libraries. I used the SDL GUI library and the OpenGL graphics library. These libraries are currently only partially supported by emscripten.

The physics simlation is a general n-body simulation. Elliptical orbits are drawn only for bodies whose acceleration is dominated by one other body (usually the sun). These drawn orbits approximate the n-body system with a 2-body system.