Code to compute ionization field from density fields and source catalogues (or number of ionizing photon grids). A detailed description of the underlying model can be found in Hutter (2018).
If you want to compute when and how (HI, HeII, HeIII) reionization occurs, then you should use this code. You will need
- cosmological box with DM/gas overdensities or gas densities (grid)
- list of source positions & number of ionizing photons or a box with number of ionizing photons (grid)
- Modular The code is written modular fashion, i.e. different modules such as computing helium, accounting for recombinations or computing the residual HI fraction can be switched on or off or chosen.
- MPI Parallel The code can be run on multiple cores and distributed memory.
- Residual HI fractions, recombinations & Helium The code can compute residual HI fractions in ionized regions according to the chosen photoionization model. It accounts for HII recombinations, and has the option to compute the HeII and HeIII ionization fields (accounting also for HeII and HeIII recombinations).
- Library The code can be used as a library in a different code. For an example see the The Reionization using Semi-Analytical Galaxy Evolution model.
- fftw3 library:
fftw3 >= 3.3.3
- gsl library (math, integrate):
gsl >= 1.16
- MPI library
- fftw3 & fftw3-mpi library:
fftw3 >= 3.3.3
- gsl library (math, integrate):
gsl >= 1.16
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.
Go to the GSL webpage to install gsl and follow the instructions there.
$ git clone https://github.com/annehutter/grid-model.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
$ ./cifog iniFile128.ini
iniFile128.ini
contains all input parameters that are needed for any runs. For a different simulation the code does not need to be recompiled but only the parameter file iniFile.ini to be adapted.
A simulation can be resumed from its restart files by
$ ./cifog -c iniFile128.ini
The parameter file can be adapted manually. However, since options can become complex, it is recommended to use program loacted under /create_parameter_file
for the first runs, until options become more familiar.
$ cd /create_parameter_file $ make $ ./create_parameter_file
The program will guide you through the different options and generate the parameter file for you. It will also provide you with the information which other files are required.
simulationType
: possible options for simulation types are:- FIXED_REDSHIFT: ionization field after
evolutionTime
is computed from a single density field and source list or field - EVOLVE_REDSHIFT: a single density field at
redshift_start
is evolved toredshift_end
, andnumSnapshots
ionization fields are written linearly in redshift - EVOLVE_ALL: evolution of ionization field is computed from density and source files at multiple redshifts specified in
redshiftFile
; output redshifts of the ionization fields can also be specified inredshiftFile
; input files need to end on_00i
and start from0
- EVOLVE_BY_SNAPSHOT: same as EVOLVE_ALL with input files also ending on
_00i
but can start from anyi
value specified insnapshot_start
- FIXED_REDSHIFT: ionization field after
redshift
: redshift of the density field and source list or fieldevolutionTime
: evolution time in Myrs
numSnapshots
: number of outputs (Note: output is automatically created for all redshifts where input files change)redshift_start
: redshift of the density field and source list or fieldredshift_end
: redshift until which the ionization should be evolved
numSnapshots
: number of outputs (Note: output is automatically created for all redshifts where input files change)redshiftFile
: redshifts of in- and outputs: 1 for new input files & 0 for no new input file but output file
numSnapshots
: number of outputs (Note: output is automatically created for all redshifts where input files change)redshiftFile
: redshifts of in- and outputs: 1 for new input files & 0 for no new input file but output filesnapshot_start
: snapshot number of density and source files from which the simulation should start
h
: H = 100*h km/s/Mpcomega_b
: baryon density parameteromega_m
: matter density parameteromega_l
: lambda density parametersigma8
: sigma8Y
: mass fraction of Helium in the primordial gas (assumed to consist of H and He)
gridsize
: size of the grid (should be a power of 2)boxsize
: comoving boxsize in Mpc/hinputFilesAreInDoublePrecision
: 0 for single, 1 for double precision of data files to be read ininputFilesAreComoving
: set to 1 if input files are comoving, otherwise 0inputIgmDensityFile
: name of density file containing 3D density grid (if multiple then just the basename and neglecting extensions _00i)densityInOverdensity
: set to 1 if density is in terms of overdensity i.e. rho/mean(rho), otherwise 0meanDensity
: assumed mean density, density is evolved as dens(z) = meanDensity*(1+z)^3 (only effective whenuseDefaultMeanDensity=0
)useDefaultMeanDensity
: set to 1 if default cosmological density value should be used (recommended), otherwise set to 0 if "meanDensity" is usedinputIgmClumpFile
: name of clumping factor file, which is used to calculate the HI fraction at the listed outputsinputSourcesFile
: (if existing) file containing the sources (first line: #sources; every other line: x, y, z, Nion [s^-1], ID, fesc)inputNionFile
: (if existing) name of file containing 3D grid of Nion [s^-1]paddedBox
: set to the factor by how much your volume is increased by padding if a padded box is used, otherwise 0
size_linear_scale
: comoving size in h^{-1} Mpc until which tophat kernel should be increased linearlyfirst_increment_in_logscale
: increment of the tophat kernel beyond linear increasemax_scale
: maximum tophat kernel size in h^{-1} MpcuseIonizedSphereModel
: set to 1 if entire smoothing sphere should be marked as ionized, otherwise only central cell is flagged as ionized
useWebModel
: set to 1 if the residual HI fraction in ionized regions should be computed (this mode will require to choose a photHI model), otherwise 0photHImodel
: possible options for photoionization models are:- PHOTHI_CONST: photoionization rate is set to a constant value
photHI_bg
- PHOTHI_GIVEN: photoionization rate depends on distance from ionizing sources but is normalised such that the mean is given by the values specified in
photHI_bg_file
- PHOTHI_FLUX: photoionization depends on distance from ionizing sources
- PHOTHI_MFP: photoionization rate depends on mean free path
- PHOTHI_CONST: photoionization rate is set to a constant value
calcMeanFreePath
: set to 1 if mfp is calculated from the size of the ionized regions and/or as in Miralda-Escude et al. (2000), otherwise 0 (only applicable for constantPhotHI = 0)
photHI_bg
: photoionization background value
photHI_bg_file
: name of file with a list of redshift, HI photoionization rates, HI photoheating rates, Q
meanFreePathInIonizedMedium
: mfp in physical Mpc (only applicable for calcMeanFreePath = 0)sourceSlopeIndex
: spectral index of the spectrum of the ionizing sources, i.e. alpha for L_nu ~ nu^-alpha
sourceSlopeIndex
: spectral index of the spectrum of the ionizing sources, i.e. alpha for L_nu ~ nu^-alpha
calcRecombinations
: set to 1 if number of recombinations should be calculated, otherwise 0recombinationModel
: possible options for recombination models are:- RECOMB_DEFAULT: density dependent recombination rate is assumed
- RECOMB_CONST: a constant recombination rate
dnrec_dt
is assumed - RECOMB_TABLE: recombinations are computed according to the model in Miralda-Escude et al. (2000): CURRENTLY NO TABLES AVAILABLE
dnrec_dt
: constant recombination rate in #/Myr
recombinationTable
: (table of recombination values, only change if you know exactly what you are doing! Below are the parameters of the table)zmin
: minimum redshift of recombination tablezmax
: maximum redshift of recombination tabledz
: increment in redshift in the recombination tablefmin
: minimum factor (= recombination rate/photionization rate in 10^{-12}s
) of recombination tablefmax
maximum factor (= recombination rate/photionization rate in 10^{-12}s
) of recombination tabledf
: increment in factor in the recombination tabledcellmin
: minimum dcell^{-1/3} of recombination tabledcellmax
: minimum dcell^{-1/3} of recombination tableddcell
: increment in dcell^{-1/3} in the recombination table
solveForHelium
: set to 1 if HeII and HeIII fields should be computed, otherwise 0inputSourcesHeIFile
: (if existing) file containing the sources (x, y, z, Nion_HeI [s^-1], ID, fesc)inputNionHeIFile
: (if existing) name of file containing 3D grid of Nion_HeI [s^-1]inputSourcesHeIFile
: (if existing) file containing the sources (x, y, z, Nion_HeII [s^-1], ID, fesc)inputNionHeIFile
: (if existing) name of file containing 3D grid of Nion_HeII [s^-1]
output_XHII_file
: basename for output of XHII fieldswrite_photHI_file
: set to 1 if photoionization file should be writtenoutput_photHI_file
: basename for output of HI photoionization fieldsoutput_XHeII_file
: output name for XHeII fieldsoutput_XHeIII_file
: output name for XHeIII fields
writeRestartFiles
: set to 1 if restart fiels should be written, otherwise 0restartFiles
: basename for restart fileswalltime
: CPU walltime until the program is ceased and restart files are written
- FIXED_REDSHIT: The ionization field is computed from the number of ionizing photons and absorption events of a single snapshot at a given redshift. Free parameter is the evolution time which determines for how long the ionizing sources emit their ionizing photons.
- EVOLVE_REDSHIFT: A series of ionization fields is computed from a single snapshot at redshift z_begin, tracing the evolution of the ionized regions. Free parameters are the number of ionization fields to be stored and the redshift of the last output z_end.
- EVOLVE_ALL: The evolution of the ionization field is computed from multiple snapshots. Input and output redshifts are specified in the
redshiftFile
. Input files need to end on_00i
and start from0
. - EVOLVE_BY_SNAPSHOT: The evolution of the ionization field is computed from multiple snapshots. Input and output redshifts are specified in the
redshiftFile
. Input files need to end on_00i
and starti
value needs to be specified.
You can generate the corresponding input files of the ionizing photons of helium in sourceFile format by
$ cd create_helium_nion_inputfiles/ $ make $ ./create_helium_inputfiles
Before executing you may want to adjust the (in the directory) included iniFile, which lets you choose the in-and output names, the cosmology and the spectral shape of the sources.
- PHOTHI_CONST: This model assumes a spatially constant photoionization rate that is set by
photHI_bg
. - PHOTHI_GIVEN: This model assumes the photoionization rate to drop of as exp(-r/mfp)/r^2, whereas mfp is the average mean free path of or in the ionized regions. The resulting photoionization rate is normalised to a given mean photoionization rate value given in the
photHI_bg_file
. - PHOTHI_FLUX: This model assumes the photoionization rate to drop of as exp(-r/mfp)/r^2, whereas mfp is the average mean free path of or in the ionized regions. mfp can be chosen if the mean free path is not calculated from the ionization fields (
calcMeanFreePath = 0
). - PHOTHI_MFP: This model computes the photoionization rate according to the mean free path of each cell. The mean free path corresponds to the filtering scale at which the cell became ionized.
- RECOMB_DEFAULT: This model computes the recombination rate in each cell accounting for its density and ionization history.
- RECOMB_CONST: This model assumes a fixed recombination rate
dnrec_dt
and computes the recombination rate accounting purely the ionization history. - RECOMB_TABLE: This model computes the recombination rates according to the model described in Miralda-Escude et al. (2000)
A bunch of analysis plots can be generated by
$ ./analysis_tools/plot_results iniFile128.ini 1
This command should execute various python scripts in /analysis_tools
that generate plots of
- the ionization history (HI, HeI, HeIII)
- the evolution of the 21cm power spectrum
- the evolution of the power spectrum of ionized gas density
- the evolution of the power spectrum of the neutral gas density
- slices of the HI (HeI, HeIII) fraction