Skip to content
Back to projects
software

Solar Sim

N-body gravitational simulator written in C, ported to WebAssembly, initializable from real NASA Horizons orbital data.

Language
C, compiled to WebAssembly
Data source
NASA JPL Horizons API
  • C
  • JavaScript
  • WebAssembly
  • Physics
Preview render from Solar Sim

Rendered preview

  • N-body gravitational simulator in C, ported to WebAssembly to run directly in the browser
  • Multiple numerical integrators and arbitrary starting dates, initializable from real orbital parameters

An N-body gravitational simulator written in C and ported to WebAssembly, so it runs directly in the browser instead of needing a native build.

It supports multiple numerical integrators and arbitrary starting dates, and can initialize its state from real orbital parameters pulled live from NASA’s Horizons API. For the web version, due to webassembly not working with libcurl, a small C program is ran to gather most possible starting vectors.

Manual memory management and efficient data structures in the C core make it run roughly 100x faster than the iniital Python version of the same simulation.