1
0
Fork 0
mirror of https://github.com/cosmo-sims/monofonIC.git synced 2025-11-15 12:15:17 +01:00
High order LPT/PPT cosmological IC generator for single resolution cosmological simulations
Find a file
2025-11-14 12:01:15 +01:00
.github/workflows Included installation of scipy for Github CI 2025-11-13 16:42:34 +01:00
external pin to a specific class version 2025-10-29 13:35:42 +01:00
include remove unused variable 2025-11-14 11:50:16 +01:00
src remove unused variable 2025-11-14 11:50:16 +01:00
testing/RAMSES updated RAMSES example files 2020-08-22 17:59:25 +02:00
tests Added tests for the LPT implementation by comparing with analytical solutions and make default 'TransferComponent: matter' to be consistent with test references. 2025-11-13 15:02:53 +01:00
.gitignore ignore test config output 2025-10-27 18:24:33 +01:00
.gitmodules include class with cmake fetch (rm submodule) 2020-08-27 11:09:21 -05:00
bitbucket-pipelines.yml update bitbucket pipelines 2025-10-25 23:21:12 +02:00
CITATION.bib Create CITATION.bib 2024-07-09 21:41:11 +02:00
CMakeLists.txt another try to get the class version, hopefully now works on github... 2025-10-25 23:03:56 +02:00
CONTRIBUTING.md CONTRIBUTING.md edited online with Bitbucket 2020-08-21 14:41:28 +00:00
Doxyfile.in improved code documentation, added doxygen target 2023-06-08 03:36:24 +02:00
example.conf write text output into current directory 2025-11-14 11:39:02 +01:00
FindFFTW3.cmake add genericio output plugin, fix memory leak in fftw plans, modernize CMakeLists 2020-08-21 11:47:53 -05:00
LICENSE Add LICENSE 2020-08-16 11:39:48 +02:00
README.md Merge branch 'master' of https://github.com/cosmo-sims/monofonIC into transfer_regression_testing 2025-11-13 21:31:50 +01:00
version.cmake add git descr instead of tag in versioning output 2020-08-23 23:32:12 +02:00

ascl:2008.024 Test Suite (Regression & MPI)

MUSIC2 - monofonIC

Modular high-precision IC generator for cosmological simulations. MUSIC2-monofonIC is for non-zoom full box ICs (use MUSIC for zooms).

Note that this program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.

The full manual is available here as a wiki. Quick instructions can be found below.

Currently supported features (the list is growing, so check back):

  • Support for up to 3rd order Lagrangian perturbation theory (i.e. 1,2, and 3LPT)

  • Support for PPT (Semiclassical PT for Eulerian grids) up to 2nd order

  • Support for mixed CDM+baryon sims

  • Multiple Einstein-Boltzmann modules: direct interface with CLASS, file input from CAMB, and fitting formulae (Eisenstein&Hu).

  • Multiple output modules for RAMSES, Arepo, Gadget-2/3, SWIFT, and HACC via plugins.

  • Multiple random number modules (MUSIC1,NGenIC,Panphasia,...) (A new MUSIC2 module is in development)

  • Multiple pre-IC modules (various Bravais lattices, glass)

  • Hybrid parallelization with MPI+OpenMP/threads.

  • Requires FFTW v3, GSL (and HDF5 for output for some codes), as well as a CMake build system and a reasonably new C++17 compliant compiler.

New modules/plugins can be easily added (see how to contribute in CONTRIBUTING.md file)

Contributors

  • HACC file format plugin: Michael Buehlmann
  • SWIFT file format plugin: Matthieu Schaller
  • primordial non-Gaussianity support: Thomas Montandon, Adrian Gutierrez Adame
  • PANPHASIA2 module: Adrian Jenkins

Contributing and Licensing

See file CONTRIBUTING.md on how to contribute to the development.

The software is licensed under GPL v3 (see file LICENSE).

Please note the separate licensing for Panphasia (see external/panphasia/LICENSE).

Citing in scientific publications or presentations

If you use MUSIC2-monofonIC in your scientific work, you are required to acknowledge this by linking to this repository and citing the relevant papers:

  • For total matter sims, or 3LPT/PLT related aspects: Michaux et al. 2020 arXiv:2008.09588

  • For baryon+CDM sims, or PPT numerics related aspects: Hahn et al. 2020 arXiv:2008.09124

You can find the respective BibTeX entries in the enclosed CITATION.bib file.

Acknowledgments

We acknowledge support from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programmes during the development of this software (Grant agreement No. 679145).

Build Instructions

Clone code including submodules (currently only CLASS is used as a submodule):

  git clone git@github.com:cosmo-sims/monofonIC.git

Create build directory, configure, and build:

  mkdir monofonic/build; cd monofonic/build
  ccmake ..
  make

this should create an executable in the build directory.

If you run into problems with CMake not being able to find your local FFTW3 or HDF5 installation, it is best to give the path directly as

  FFTW3_ROOT=<path> HDF5_ROOT=<path> ccmake ..

make sure to delete previous files generated by CMake before reconfiguring like this.

If you want to build on macOS, then it is strongly recommended to use GNU (or Intel) compilers instead of Apple's Clang. Install them e.g. via homebrew and then configure cmake to use them instead of the macOS default compiler via

  CC=gcc-13 CXX=g++-13 ccmake ..

This is necessary since Apple's compilers haven't supported OpenMP for years.

Running

There is an example parameter file 'example.conf' in the main directory. Possible options are explained in it, it can be run as a simple argument, e.g. from within the build directory:

  ./monofonIC ../example.conf

If you want to run with MPI, you need to enable MPI support via ccmake. Then you can launch in hybrid MPI+threads mode by specifying the desired number of threads per task in the config file, and the number of tasks to be launched via

  mpirun -np 16 ./monofonIC <path to config file>

It will then run with 16 tasks times the number of threads per task specified in the config file.

Test Suite

monofonIC includes a basic regression testing framework to catch breaking changes and ensure code reliability.

Test Coverage:

  • 5 Regression Tests: Cover different LPT orders (1LPT, 2LPT, 3LPT), particle loads (sc, bcc), output formats (Generic, Gadget, SWIFT), and baryon physics
  • 1 MPI Consistency Test: Verifies identical results across 1, 2, and 4 MPI tasks to catch parallelization bugs
  • All tests run automatically in GitHub Actions CI on every push and pull request

Running Tests Locally:

# From build directory
cd build

# Generate reference files (first time only)
bash ../tests/scripts/generate_references.sh

# Run all tests
ctest --output-on-failure

# Run specific test category
ctest -R test_mpi_consistency --verbose
ctest -L regression -LE mpi

Tests use small 32³ grids and complete in ~2.5 seconds total. Comparisons use hybrid tolerance: exact for integers, 1e-9 relative tolerance for floats. See tests/README.md for detailed documentation on adding new tests and regenerating references.