Research project
In Progress

Cosmological N-body Simulator Development

A validation-first simulator for a reproducible dark-matter N-body baseline and LSS signal studies

Cosmological N-body Simulator Development

Institution

Personal Research

Collaboration

Independent Project

Timeline

Jul 2026 - Present

Updated:
Tags:cosmologyn-bodyc++20scientific-computing

Project Overview

Cosmological N-body Simulator is a C++20 cosmological N-body simulator under active development.

The objective is to produce results that can be compared with published studies and independent codes when the initial conditions, cosmology, units, force calculation and halo definitions are matched. The immediate research task is to quantify the converged ranges of the matter power spectrum, halo mass function, two-point correlation function and basic halo properties before studying the nonlinear transfer of early-Universe signals.

The source includes an experimental path that applies a bounded scalar response to the linear matter spectrum. It is not a direct primordial non-Gaussian initial condition or a detection result.

Current Scope

The reference path is serial CIC Particle-Mesh gravity with global KDK integration in a periodic comoving box. TreePM, MPI PM and CUDA/cuFFT paths are preliminary implementation or validation routes and do not carry production accuracy or performance claims. The figures and individual runs shown here are not scientific detections.

Current Implementation

A reproducible DMO pipeline connecting initial conditions, native analysis products and presentation.

BaselinePeriodic CIC Particle-Mesh + KDK
Initial ConditionsGaussian 1LPT / 2LPT
ProductsHDF5 Snapshot / Restart / Halo Catalogue
AnalysisFoF / SO / HMF / Landy–Szalay 2pCF
PresentationNative products + MySimPlot
StatusBaseline implemented; convergence domain under validation
Evolution of large-scale structure from z=4.0 to z=0.0
Evolution of large-scale structure from z=4.0 to z=0.0

Run configuration used on this page

  • Box size: L=128h1MpcL=128\,h^{-1}\,\mathrm{Mpc}
  • Particle lattice: 2563256^3
  • PM and IC meshes: 2563256^3 each
  • Cosmology: ΛCDM\Lambda\mathrm{CDM}, h=0.6766h=0.6766, Ωm=0.3111\Omega_{\mathrm{m}}=0.3111
  • Initial conditions: 1LPT at zstart=49z_{\mathrm{start}}=49
  • Outputs: z=4,3,2,1,0z=4,3,2,1,0

Numerical and Mass Resolution

The calculations below use only values recorded in Cosmology_Simulation/configs/user_run.toml and the native metadata for the corresponding run. Particle sampling, PM resolution, IC resolution and softening control different numerical errors and are therefore not combined into one universal resolution value.

Total particle count

Np=2563=16,777,216N_{\mathrm{p}}=256^3=16{,}777{,}216

Mean particle spacing

dmean=LN=128256=0.5h1Mpcd_{\mathrm{mean}}=\frac{L}{N}=\frac{128}{256}=0.5\,h^{-1}\,\mathrm{Mpc}

Because the PM and IC meshes also contain 256 cells per dimension,

ΔxPM=ΔxIC=0.5h1Mpc\Delta x_{\mathrm{PM}}=\Delta x_{\mathrm{IC}}=0.5\,h^{-1}\,\mathrm{Mpc}

The corresponding particle, PM-mesh and IC-mesh Nyquist references are also equal:

kNyq=πNL=6.283hMpc1k_{\mathrm{Nyq}}=\frac{\pi N}{L}=6.283\,h\,\mathrm{Mpc}^{-1}

Particle mass

The code mass unit is 1010h1M10^{10}\,h^{-1}\,M_{\odot}, and the critical density in this unit system is ρcrit,0=27.752823482\rho_{\mathrm{crit},0}=27.752823482. The particle mass is

mp=ρcrit,0Ωm(LN)3m_{\mathrm{p}}=\rho_{\mathrm{crit},0}\,\Omega_{\mathrm{m}}\left(\frac{L}{N}\right)^3mp=27.752823482×0.3111×(0.5)3=1.079237923m_{\mathrm{p}}=27.752823482\times0.3111\times(0.5)^3=1.079237923

Therefore the mass resolution of this run is

mp=1.079×1010h1Mm_{\mathrm{p}}=1.079\times10^{10}\,h^{-1}\,M_{\odot}

Minimum FoF catalogue mass

The native analysis includes groups containing at least 32 particles.

Mselect=32mp=3.454×1011h1MM_{\mathrm{select}}=32\,m_{\mathrm{p}}=3.454\times10^{11}\,h^{-1}\,M_{\odot}

This is a catalogue selection floor, not a convergence-qualified completeness limit or physical reliability threshold.

Softening

The configured value softening_comoving_Mpc_h = -1 is resolved by the simulator's default rule:

ϵ=dmean30=0.0167h1Mpc\epsilon=\frac{d_{\mathrm{mean}}}{30}=0.0167\,h^{-1}\,\mathrm{Mpc}

Softening and the PM cell size are reference scales. The trusted domain must be established through convergence runs that vary particle number, mesh, timestep and solver.

Analysis Products and Presentation

The simulator owns the scientific definitions of halo finding, mass, pair counts and native analysis products. The separate MySimPlot repository is a presentation layer that verifies native manifests and SHA-256 identities before rendering. It does not redefine halo membership, masses or estimators, and it applies no smoothing, fitting or fallback estimator.

The differential and cumulative halo-mass-function normalizations are

dndlnM=NbinL3ΔlnM\frac{\mathrm{d}n}{\mathrm{d}\ln M}=\frac{N_{\mathrm{bin}}}{L^3\,\Delta\ln M}n(M)=N(MhM)L3n(\geq M)=\frac{N(M_{\mathrm{h}}\geq M)}{L^3}

Error bars are central Garwood intervals for Poisson counting uncertainty only; they exclude cosmic variance and inter-bin covariance.

Halo Mass Function at z=4 Figure: FoF halo mass function at z=4z=4. The native catalogue uses linking length b=0.2b=0.2 and a minimum 32-particle selection. The plot shows the differential distribution, cumulative abundance and exact bin counts. The displayed minimum mass is a catalogue inclusion floor, not a completeness limit.

Development Plan

  1. Establish the convergence domain by varying particle number, PM and IC meshes, starting redshift and timestep.
  2. Compare fields and summary statistics with an independent code using matched initial conditions.
  3. After baseline validation, extend the bounded early-Universe response study to higher-order statistics and halo observables.

Research Limitations

The current model is dark-matter-only. Finite volume and resolution, cosmic variance, halo finding, baryonic physics and observational selection can alter the measured signals. Interpretations of new-physics signatures will therefore be limited to domains supported by convergence tests, independent-code comparisons and separate statistical validation.