OpenSPH main page


OpenSPH is an integrator of hydrodynamic equations using SPH discretization in space, currently specialized on simulations of asteroid impacts. The code is being developed on Astronomical Institute of Charles University in Prague. It aims to provide a fast, versatile and easily extensible SPH solver utilizing modern CPU features (SSE/AVX instruction sets).

Getting the code

The code can be downloaded from GitLab repository. Using git, you can clone the code with

git clone https://sevecekp@gitlab.com/sevecekp/sph.git
cd sph
git checkout devel


The code uses many c++14 features and will migrate to c++17 when it gets implemented by mainstream compilers. The compilation has been tested on gcc 6.3.1 and clang 4.0.0. Prerequisities of the code are:

  • git (to get the code from the repository, skip if you already have the code)
  • up-to-date version of gcc or clang compiler
  • QMake (tested with version 3.1)
  • Eigen (for solving sparse systems)

Another optional dependencies of the code are:

  • wxWidgets (needed for graphical interface of the code)
  • Catch (C++ unit testing framework)
  • Google Benchmark (comparing perfomance of different solvers, code settings, etc.)

The compilation should be as easy as

qmake CONFIG+=version sph.pro

where version can be one of:

  • release - full-speed version of the code. This is the default option if no build version is specified
  • debug - debugging build with no optimizations (SLOW)
  • assert - build with all optimizations and additional sanity checks
  • profile - full-speed build that measures durations of various segments of the code and print run statistics

Running a basic impact simulation

The code can be executed with default settings, in which case it will use the following:

Only thing that needs to be set up by the user is the initial conditions of the simulation. For the impact experiment, this can be easily done with InitialConditions object.

See file cli/main.cpp for an example of a simple impact simulation.

Examples of the code usage

See Examples

Implemented components of the code

See List of implemented SPH solvers, algorithms and equations

Bug reports, ideas, question

Feel free to contact me at sevecek@sirrah.troja.mff.cuni.cz. Any feedback is highly appreciated.

See also