-
Notifications
You must be signed in to change notification settings - Fork 4
QuickStart
This guide will get you from zero to running monofonIC in about 30 minutes. You'll generate initial conditions for a small cosmological simulation using default settings. Thanks to Lukas Winkler for the inspiration on this quick start format! See his excellent SWIFT quick start guide.
- Linux or macOS operating system
- C++14 compatible compiler (GCC 7+, Clang 5+, or Intel C++)
- CMake 3.9 or newer
Ubuntu/Debian:
sudo apt update
sudo apt install build-essential cmake git \
libfftw3-dev libfftw3-mpi-dev \
libgsl-dev \
libhdf5-dev libhdf5-mpi-dev \
libopenmpi-dev \
pkg-configmacOS (Homebrew):
brew install cmake git fftw gsl hdf5 open-mpi pkg-config gccNote: On macOS, use GNU compilers instead of Apple Clang (see Building MUSIC2 for details).
git clone https://github.com/cosmo-sims/monofonIC.git
cd monofonICmkdir build
cd build
cmake ..
make -j4This creates the monofonIC executable in the build/ directory. Compilation takes 2-5 minutes.
Troubleshooting: If CMake can't find libraries, specify paths manually:
FFTW3_ROOT=/path/to/fftw HDF5_ROOT=/path/to/hdf5 cmake ..Edit the example configuration file:
cd .. # back to monofonIC root directory
cp example.conf quickstart.conf
nano quickstart.conf # or use your preferred editorMake these changes to quickstart.conf:
-
Enable SWIFT output (around line 154):
[output] format = SWIFT filename = ics_swift.hdf5 UseLongids = true
-
Set thread count (around line 125):
[execution] NumThreads = 4 # adjust to your CPU core count
-
Verify cosmology settings (around line 39): The example file uses Planck 2018 parameters and CLASS for the transfer function - this is fine for a quick test.
Save and exit.
./build/monofonIC quickstart.confCheck that the file was created:
ls -lh ics_swift.hdf5Inspect the HDF5 structure (optional but recommended):
# Install h5glance if not already available
pip install h5glance
# View file structure
h5glance ics_swift.hdf5Expected structure:
ics_swift.hdf5
├── Header (metadata: box size, particle counts, cosmology)
├── PartType1 (dark matter particles)
│ ├── Coordinates [2097152 × 3]
│ ├── Velocities [2097152 × 3]
│ ├── Masses [2097152]
│ └── ParticleIDs [2097152]
You've generated initial conditions for:
- Simulation type: Dark matter only (no baryons)
- Box size: 300 Mpc/h (comoving)
- Particle count: 128³ = 2,097,152 particles
- Starting redshift: z = 24
- Perturbation order: 3LPT (third-order Lagrangian perturbation theory)
- Cosmology: Planck 2018 (EE+BAO+SN)
To actually evolve these initial conditions forward in time, you need a simulation code. See the excellent guide:
- Running Cosmological N-body Simulations with SWIFT - walks through running SWIFT with your newly created ICs
Now that you have the basics working, explore:
- Configuration File - comprehensive reference of all options
- Sample Configuration - annotated example with explanations
- Output Plugins - formats for different simulation codes (Gadget, AREPO, RAMSES, HACC)
- Glossary - understand technical terms (LPT, transfer functions, etc.)
- Building MUSIC2 - advanced compile-time options and optimization
- Installing Libraries - manual installation of FFTW3, GSL, HDF5
- Check existing GitHub Issues
- See CONTRIBUTING.md for how to report bugs or request features
Have fun generating cosmological initial conditions with monofonIC!