Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Introduction

Oliver Hahn edited this page Oct 21, 2025 · 12 revisions

monofonIC - MUSIC for single resolution simulations

Why a single-resolution version of MUSIC?

While the original MUSIC code was designed to provide initial conditions for zoom initial conditions, which are most important for galaxy formation simulations, it was always limited for applications to large-scale cosmological simulations (mostly by practical means, such as no MPI parallelism, which requires a lot of memory/node to generate ICs). After all, excellent codes for non-zoom ICs existed, such as Pueblas & Scoccimarro's 2LPT-IC code, rendering the need for yet another tool a low priority.

With the need for ever increasing precision of theoretical predictions, it seems now necessary to go to higher order perturbation theory (PT) to achieve good convergence (particularly in higher order statistics). You can read a lot about this aspect in our recent paper Michaux et al. (2020) where we demonstrate the impact of discreteness errors and higher order (3LPT) on simulation results.

In addition, an accurate treatment of baryons (and possibly further components in the future) within an LPT framework has been missing from all IC generators. Thanks to recent progress (see Rampf et al. 2020), we know now how we can include at least some aspects in a rigorous LPT framework. Also, PPT (Uhlemann et al. 2019, Rampf et al. 2020) can be used to put Eulerian baryon fields on the same PT footing as Lagrangian fluid elements with LPT (see also Hahn et al. 2020).

Finally, we grew tired of having to run an Einstein-Boltzmann code (such as CAMB or CLASS) first, and then making sure that the output is consistently used in the IC generation.

Since many of these aspects are arguably more important for simulations which focus on cosmology, rather than galaxy formation, we decided that the first incarnation of MUSIC2 shall be limited to single resolution simulations only (i.e. no zooms yet). We called this version 'monofonIC' to stay with the 'MUSIC' theme.

In addition, this version with its high order LPT/PPT implementations can be used for rapid predictions of large-scale structure (use e.g. the generic HDF5 output format to get CDM and baryon density and velocity fields).

The current status

The current version of monofonIC MUSIC2 has the following 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, SWIFT, and Gadget-2/3, 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.

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

Contributors

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

How monofonIC Works Internally

This section provides a technical overview of monofonIC's internal workflow for those interested in understanding the code structure or contributing to development.

flowchart TB
    Start([monofonIC Started]) --> Init[Initialize MPI/OpenMP/FFTW]
    Init --> ParseConfig[Parse Configuration File]

    ParseConfig --> InitPlugins[Initialize Plugins]
    InitPlugins --> RNG[RNG Plugin<br/>NGENIC/MUSIC1/PANPHASIA]
    InitPlugins --> TF[Transfer Function<br/>CLASS/CAMB/E-Hu]
    InitPlugins --> Cosmo[Cosmology Calc<br/>Growth, Pk]
    InitPlugins --> Output[Output Plugin<br/>SWIFT/Gadget/etc]

    RNG --> Setup
    TF --> Setup
    Cosmo --> Setup
    Output --> Setup

    Setup[Read Parameters & Allocate Grids] --> GenNoise[Generate White Noise]

    GenNoise --> ApplyFix{Mode<br/>Fixing?}
    ApplyFix -->|Yes| FixModes[Normalize<br/>Amplitudes]
    ApplyFix -->|No| ApplyInv
    FixModes --> ApplyInv{Invert<br/>Phases?}
    ApplyInv -->|Yes| InvertPhase[Invert for<br/>Paired Sim]
    ApplyInv -->|No| Phi1
    InvertPhase --> Phi1

    Phi1[Compute φ⁽¹⁾ = -δ/k²] --> CheckOrder{LPT<br/>Order?}

    CheckOrder -->|1LPT| Scale
    CheckOrder -->|≥2LPT| Phi2[Compute φ⁽²⁾]

    Phi2 --> Check3{3LPT?}
    Check3 -->|No| Scale
    Check3 -->|Yes| Phi3[Compute φ⁽³⁾ and A⁽³⁾]
    Phi3 --> Scale

    Scale[Scale with Growth Factors<br/> D, E, Fa, Fb, Fc] --> LoopSpecies{For Each<br/>Species}

    LoopSpecies --> OutType{Output<br/>Type?}

    OutType -->|Particles/Lag Grid| Displacements[Compute Displacements<br/>x = q + Σ∇φ⁽ⁱ⁾ + ∇×A3]
    OutType -->|Eulerian PPT| PPT[Compute PPT<br/>ψ, ρ, v fields]

    Displacements --> Velocities[Compute Velocities<br/>v = dx/dt]

    Velocities --> BaryonVrel{Baryon<br/>+Vrel?}
    BaryonVrel -->|Yes| AddVrel[Add CDM-Baryon<br/>Relative velocity]
    BaryonVrel -->|No| ParticleQ
    AddVrel --> ParticleQ

    ParticleQ{Make<br/>Particles?}
    ParticleQ -->|Yes| Lattice[Generate Lattice<br/>sc/bcc/fcc/glass]
    ParticleQ -->|No| GridOut

    Lattice --> MassQ{Variable<br/>Masses?}
    MassQ -->|Yes| SetMass[Set from ρ field]
    MassQ -->|No| WriteP
    SetMass --> WriteP[Write Particles]

    PPT --> WriteF[Write Fields]
    GridOut[Write Grid] --> MoreSpecies
    WriteP --> MoreSpecies
    WriteF --> MoreSpecies

    MoreSpecies{More<br/>Species?}
    MoreSpecies -->|Yes| LoopSpecies
    MoreSpecies -->|No| Finalize

    Finalize[Write Diagnostics<br/>& Power Spectra] --> Cleanup[MPI Finalize<br/>& Cleanup]
    Cleanup --> End([Done])

    
Loading

The future

If you want to contribute to the future development of MUSIC2, or are thinking about a possible research project in its context, don't hesitate to get in touch.

Clone this wiki locally