Gadget functionality for Julia
Author LudwigBoess
1 Star
Updated Last
2 Years Ago
Started In
December 2018

The MIT License Documentation Status Build Status

!!!!! DEPRECATED !!!!!

This package is no longer under development. Instead all functionality is broken into smaller packages to make them more user friendly and lightweight.

The individual packages are:

Usecase Package
Reading/Writing snapshots GadgetIO.jl
Unit conversion GadgetUnits.jl
Mapping SPH data to a grid SPHtoGrid.jl
LMB_SPECTRAL_CRS utility SpectralCRsUtility.jl
Analytic solutions for test problems AnalyticMHDTestSolutions.jl
Make ICs for shocktubes BuildShocktubes.jl
Construct a Hernquist DM halo HernquistHalo.jl


This package provides some basic functionality to work with the SPH code "Gadget" by Volker Springel (doi:10.1111/j.1365-2966.2005.09655.x).

These functionalities are: reading and writing data in snapshot format 1+2, reading the subfind output, basic mapping of sph data to a grid. Additionally I provide some exact riemann solvers for shocktube tests, unit conversion and other utility. This list will extend over time.

Documentation can be found here.

Any help and contribution is greatly appreciated, as this is still a work in progress. Please see the section on contributing.


Reading Data

If you want to read a simulation snapshot into memory with GadJet.jl, it's as easy as this:

    data = read_snap(filename)

This will return a dictionary with the header information in data["Header"] and the blocks sorted by particle type.

As an example, this is how you would access the positions of the gas particles:


If you only want to read a specific block for a single particle type (e.g. positions of gas particles) you can use the function with a specified blockname and particle type like so:

    pos = read_snap(filename, "POS", 0)

This will return an array of the datatype of your simulation, usually Float32.

Quick Visualisation

For a quick glimpse at your data you can use the glimpse function (yes, I thought hard about this one...)

    image = glimpse(filename)

This will return a 500x500 pixel image of the whole box, centered on the center of mass.

If you want to look at a specific range you can provide an array with the center coordinates as center_pos = [x, y, z] and the extent in x, y and z direction with dx, dy, dz.

    image = glimpse(filename, center_pos, dx, dy, dz)


If you want to contribute to this project I would greatly appreciate your help!

Please feel free to contact me:

Stuff I want to improve in the near future:

  • Speedup of the sph mapping (done!).
  • Peano-Hilbert key based reading of large snapshots (done!).
  • Add unit conversion (done!).

Used By Packages

No packages found.