Code to compute polyspectrum from a 3D grid following the method described in Watkinson et al. (2017).
IMPORTANT:: The current input file only supports powerspectra and bispectra. Test results analogue to Fig. 7 in Watkinson et al. (2017) can be found here. Suggestions for improvements (particularly run time) are very welcome and can be sent to [email protected].
- fftw3 library:
fftw3 >= 3.3.3
- MPI library
- fftw3 & fftw3-mpi library:
fftw3 >= 3.3.3
Go to the FFTW webpage to install fftw3. Ensure to compile the library with the enable-mpi
flag for parallel runs
$ ./configure --enable-mpi $ make $ make install
Note: To create the dynamic libraries, run configure with the --enable-shared
flag.
$ git clone https://github.com/annehutter/polyspectrum.git $ make
This will download the code and first test case from the github directory and compile the source code.
The first test case can then be run by
$ ./polyspectrum iniFile.ini
iniFile.ini
contains all input parameters that are needed for any runs. For a different simulation the code does not need to be recompiled but just this parameter file iniFile.ini to be adapted.
The following parameters are specified in iniFile.ini
:
gridsize
: size of the 3D grid along one axisboxsize
: comoving boxsize in Mpc/hgasInputsInDoublePrecision
: set to 0 for single, 1 for double precision for density fields being readionInputsInDoublePrecision
: set to 0 for single, 1 for double precision for ionization fields being readdensityFile
: path to 3D density gridionFile
: path to 3D ionization grid
hubble_h
: H = 100*hubble_h km/s/Mpcomega_b
: baryon density parameteromega_m
: matter density parameteromega_l
: lambda density parameterY
: mass fraction of Helium in the primordial gas (assumed to consist of H and He)
whichField
: field from which the polyspectrum is calculated; options are:DENS
for density,XHII
for ionization fraction andXHI_DENS
for neutral gas densityuseOnlyPhase
:1
yields the phase-only bispectrumn
: number of vectors, i.e.n=2
yields powerspectrum,n=3
yields bispectrumequilateral
:1
yields bispectrum for equilateral triangles withnumValues
providing the number of k-values depending on the box and gridsize of the simulation box, for all values not equal to1
non-equilateral triangles are computedk1
: length of first vector in Mpc/hk2
: length of second vector in Mpc/h (if n>2)numValues
: set to 1, if only single value for polyspectrum should be calculated; for >1 andn>2
number of k bins alongtheta = 0 to 180
theta
: angle betweenk1
andk2
in radkbinwidth
: bin width in k-space in units of grid cells for computing the bispectrakbinningCase
:DEFAULT
assumes for all k vectors a binwidth in k-space ofkbinwidth
,GIVEN_BINNING
assumes fork1
andk2
a binwidth in k-space ofkbinwidth
and fork3
a width that corresponds tocosThetaBinwidth
,DERIVED_BINNING
assumes fork1
andk2
a binwidth in k-space ofkbinwidth
and fork3
it derives the binwidth from the allowed ranges given by the uncertainties ofk1
andk2
cosThetaBinwidth
: binwidth in cos(theta)
output_dir
: directory where output should be writtenoutput_basename
: output name of the runwrite_numpolygons
:1
if output files should contain number of polygons, otherwise they are not included in the output