Warning I generated 2048^3 ICs (subsampled from a 3072^3) with this IC code and those simulations were wrong. However, 1024^3 simulations generated with this were fine. Presumably, something is wrong with (at least) the subsample fraction logic - do not use the subsampling features in this code -- i.e., set both GlassTileFacSampleNumerator
and GlassTileFacSampleNumerator = 1
.
This repo contains 2LPT IC generation code from Roman Scoccimarro. Original code can be found here
- The code has been updated with lots of checks about INT overflow and 64 bit ID overflows.
- Dependency on Numerical Recipes in C has been replaced with
gsl
- This code can accept P(k) generated by CAMB (contribution from Greg Poole)
- Can generate consistent particle IDs across simulations of different resolutions (contribution from Greg Poole)
Note this version produces a header compatible with standard public Gadget2. In particular,
the number of particles in excess of INT_MAX (~2e9) is stored in npartTotalHighWord
in the header, rather than npartTotal[2]
.
- An MPI capable compiler
mpicc
- Double precision MPI FFTW2 libraries (
fftw2.1.5
) gsl
library
- Setup the
Makefile
options according to the simulation IC. Default options are matched to running a single-species dark matter only cosmological simulation. - Check the paths to
MPI
,FFTW
andGSL
libraries - Typing
make
should generate the executable
If you are running convergence tests, then the particle IDs for
the lower resolution simulation can be sampled from the particle IDs
of the highest resolution simulation you want to compare to. The generated IDs
will not be contiguous anymore but the particle in the same spatial location should get
an identical ID as the particle in the hi-res simulation. Since the particle
ID is essentially set by the hi-res simulation, the low-res simulation
might require 64bit IDs just to store consistent IDs. The code will check
at runtime if the generated particle IDs are too large to fit into 32bit
integers (only relevant when USE_64BITID
Makefile option is not
set during compilation).
The implementation requires two integers, GlassTileFacSampleNumerator
and
GlassTileFacSampleDenom
, to be specified in the parameter file. The final
number of particles is set by choose GlassTileFacSampleNumerator
particles out
of GlassTileFacSampleDenom
hi-res particles.
- To generate a
1024^3
subsample from a3072^3
hi-res, setNmesh=3072
,Nsample=1024
,GlassTileFac=3072
,GlassTileFacSampleNumerator=1
andGlassTileFacSampleDenom=3
. - To generate a
2048^3
subsample from a3072^3
hi-res, setNmesh=3072
,Nsample=2048
,GlassTileFac=3072
,GlassTileFacSampleNumerator=2
andGlassTileFacSampleDenom=3
.
NOTE: The previous examples assume that there is only one particle in the glass file; if that is not your case, then reduce GlassTileFac
by the number of particles in the glass file. Nparticles_in_glass_file * GlassTileFac
should equal TotNumPart^(1/3)
in the hi-res simulation.
- Edit the parameter file. See example parameter file provided in example.params
- Launch the MPI process
mpirun -np Ncpus ./2LPTic simulation.param
(refer to your computing cluster documentation for submitting and running jobs)
Author is Roman Scoccimarro (I think based on N-GenIC developed by Volker Springel). Current repo contains contribution from Greg Poole for the CAMB P(k) handling and consistent particle IDs generation.
Maintained by Manodeep Sinha. Any new bugs are probably my fault.