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 a.k.hutter@rug.nl.
- 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:DENSfor density,XHIIfor ionization fraction andXHI_DENSfor neutral gas densityuseOnlyPhase:1yields the phase-only bispectrumn: number of vectors, i.e.n=2yields powerspectrum,n=3yields bispectrumequilateral:1yields bispectrum for equilateral triangles withnumValuesproviding the number of k-values depending on the box and gridsize of the simulation box, for all values not equal to1non-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>2number of k bins alongtheta = 0 to 180theta: angle betweenk1andk2in radkbinwidth: bin width in k-space in units of grid cells for computing the bispectrakbinningCase:DEFAULTassumes for all k vectors a binwidth in k-space ofkbinwidth,GIVEN_BINNINGassumes fork1andk2a binwidth in k-space ofkbinwidthand fork3a width that corresponds tocosThetaBinwidth,DERIVED_BINNINGassumes fork1andk2a binwidth in k-space ofkbinwidthand fork3it derives the binwidth from the allowed ranges given by the uncertainties ofk1andk2cosThetaBinwidth: binwidth in cos(theta)
output_dir: directory where output should be writtenoutput_basename: output name of the runwrite_numpolygons:1if output files should contain number of polygons, otherwise they are not included in the output