GANDALF is a hybrid self-gravitating fluid dynamics and collisional N-body code primarily designed for investigating star formation and planet formation problems that cannot be analysed by traditional `pen and paper' mathematics. Such problems require computer simulations to study the details of what happens in any given scenario.
GANDALF is the successor code to SEREN (Hubber et al. 2011), which itself was a self-gravitating hydrodynamical code with N-body components attached. Although based on many of the SEREN routines, GANDALF has been largely re-written from scratch in C++ using more optimal algorithms and data structures. For typical star formation problems, GANDALF runs approx. 3 times faster on similar architecture.
GANDALF uses various implementations of Smoothed Particle Hydrodynamics (SPH) to perform hydrodynamical simulations of gas clouds undergoing gravitational collapse to form new stars (or other objects). Such simulations include simulations of the gravo-turbulent fragmentation of molecular clouds and prestellar cores, the evolution, accretion and fragmentation of protoplanetary discs and mechanical and radiative feedback from young stars into the surrounding gas cloud.
GANDALF can perform simulations of pure N-body dynamics using high accuracy N-body integrators. If the gas of a stellar system can be ignored, or it has already been ejected by stellar feedback, then the main dynamics of the system is governed principally by N-body dynamics. Such systems may include proto-multiple systems formed from individual star forming cores, or the large-scale dynamical evolution
Hybrid hydrodynamics & N-body dynamics
GANDALF can model the intermediate phase of cluster evolution, where a significant fraction of the gas has formed stars, but the remaining gas is important gravitationally and can affect the long-term evolution of the cloud. Although many codes include both the gas and stars, GANDALF includes a conservative implementation of the coupled equations of motion that allows the gaseous component to be integrated to the high-accuracy required by many traditional N-body codes.
Python interface and interactive simulations
GANDALF is not just restricted to being used as a `number-crunching' simulation code, but can also provide visualisation via its python interface as well as interactive `on-the-fly' simulations.
GANDALF was written in C++ in order to take advantage of the benefits of object-oriented design in large projects. Since GANDALF has multiple implementations for the same feature (e.g. different hydrodynamics methods for the gas, different integration schemes to move particles), the code is designed so that each algorithmic feature has a standard format and interface. This makes adding additional implementations easier since each feature already has a well-defined structure that can be adhered to.
Status & Features
The latest version of GANDALF contains the following features
- 2 `flavours' of SPH :
- 1, 2 or 3 dimensions
- Barnes-Hut Octal tree for efficient neighbour finding and calculation of gravitational forces (Barnes & Hut 1986)
- Periodic boundary conditions (independent for each dimension)
- Ewald periodic gravity (Hernquist, Bouchet & Suto 1991, Klessen 1997)
- 2nd order Leapfrog kick-drift-kick and drift-kick-drift
- Block timesteps and neighbour-timestep checking for safety (Saitoh & Makino 2009)
- Various flavours of artificial dissipation :
- Sink particles (Bate, Bonnell & Price 1995) with smooth accretion (Hubber, Walch & Whitworth 2013)
- Various N-body algorithms and optimisations
- Parallelized using OpenMP
- Produces output compatable with the SPLASH visualisation program.
- Meshless Finite-Volume Hydrodynamics (Gaburov & Nitadori 2011, Hopkins 2015)
- MPI parallelization
- Improved sub-system integration