User Tools

Site Tools



Gasoline Is A Modern SPH Simulation Code For Astrophysical Problems. Gasoline is written in modern C. All you need to build it is the MDL helper library and a C compiler. For more information please visit

Building Gasoline

Gasoline is pretty simple to compile. All you need is a C compiler (gcc/icc/clang/etc.), the machine dependent library, and the code for gasoline itself.

Fetch Prerequisites

Gasoline and the mdl library are both hosted by the N-Body Shop on github. If you have a github account with SSH keys enabled, you can fetch these repositories over git+ssh:

  • Clone into the public repository
$ git clone
$ git clone

If you don't have a github account, or your SSH keys are not set up, you can use HTTP to fetch the code. Note that some HPC facilities will block HTTP/HTTPS in their firewall rules, so if these fail with an HTTP 405 code (or other errors), you may need to use SSH.

Configure The Makefile

Gasoline uses a very simple build system: a single makefile! In the gasoline repository you have just cloned, you should find a file, Makefile.default. This is the skeleton Makefile you will use to build your copy of gasoline. First, copy this to Makefile:

cp Makefile.default Makefile

Next, you will open Makefile in your text editor of choice. By default, Gasoline is configured to build with “standard” physics options for doing galaxy/ISM/cosmological simulations, using gcc as the compiler. If you wish to use a different compiler, simply change the CC variable.

The Mode section (MODE_DEF) will allow you to select different sets of physics modules for different types of problems (Collisional planet formation, pure N-body with a stripped-down code, or a gravitational glass builder for making initial conditions). You can also select which SPH smoothing kernel to use in the Kernel section (KERNEL_DEF). We recommend sticking with the Wendland C4 kernel unless you need to.

If you want to run with radiative cooling, you will need to choose a cooling model from the Cooling section (the COOLING_OBJ and COOLING_DEF pairs). If you want to disable cooling altogether, choose the final pair, with COOLING_DEF set to -DNOCOOLING. Cooling can also be disabled in the parameter file by setting bGasIsothermal = 1 or bGasAdiabatic = 1.

There are a number of extra modules for doing physics, controlling outputs and performance, as well as debugging in the Extra Features section (EXTRA_DEF). Some of these components conflict with each other, and will warn the user during compile time of their incompatibility. Finally, if you wish to use either the PNG writer for the frame dumping module, or the turbulent driver, you will need to uncomment, and possibly configure some extra options in the Libraries section.

Compile Gasoline

Once you have set up your Makefile, you are ready to compile the code. Gasoline uses the mdl library to allow it to run on a variety of different architectures. Luckily, most large parallel machines are x86_64 architecture with support for MPI, so in general, if you are running in parallel on your desktop, make pthread will be the platform you choose, and when you are running on a distributed-memory machine, make mpi will be the platform to choose. If you are running on an older machine with Quadrics interconnects, use qmpi for your platform. If your machine uses the older LAM/MPI communication protocal, compile with make lam_mpi. If you are using the Charm++ AMPI, select it with make ampi. Finally, if you wish to run with no parallel support, you can use the null mdl platform.

When make completes building gasoline, you should have an executable called gasoline in your source directory. You are now ready to run Gasoline!

Building Gasoline with Grackle cooling support

Currently, Gasoline only supports Grackle 2.1.

  • To build Gasoline with Grackle cooling, first fetch the code:
$ hg clone [[ ]]
  • Then make sure you are on the grackle-2.1 tag:
$ hg update grackle-2.1\

Instructions on building grackle can be found on the grackle website

Once your grackle install is working, run a make install to put the library somewhere you have permissions to write (the default is ~/local).

You then simply need to set up your Makefile to use grackle:

$ COOLING_OBJ = cooling_grackle.o                                                                              
$ COOLING_DEF = -DCOOLING_GRACKLE -I/path/to/grackle_header_directory
$ COOLING_LIB = /path/to/ -lhdf5

Then, compile as usual and you should have a Gasoline build with Grackle cooling!

gasoline.txt · Last modified: 2019/07/07 20:24 by Wiki Admin