Skip to content

Code to compute ionization field from density fields and source catalogue (CIFOG)

License

Notifications You must be signed in to change notification settings

annehutter/grid-model

Repository files navigation

Description

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).

When you should use this code

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)

Why should you use it

  1. 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.
  2. MPI Parallel The code can be run on multiple cores and distributed memory.
  3. 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).
  4. 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.

Installation

Pre-requisities

Serial run

  1. fftw3 library: fftw3 >= 3.3.3
  2. gsl library (math, integrate): gsl >= 1.16

Parallel run

  1. MPI library
  2. fftw3 & fftw3-mpi library: fftw3 >= 3.3.3
  3. gsl library (math, integrate): gsl >= 1.16
FFTW3

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.

GSL

Go to the GSL webpage to install gsl and follow the instructions there.

Download & Build

$ 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.

Execution

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

Generation of the parameter file

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.

Parameter file
Type
  • 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 to redshift_end, and numSnapshots 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 in redshiftFile; input files need to end on _00i and start from 0
    • EVOLVE_BY_SNAPSHOT: same as EVOLVE_ALL with input files also ending on _00i but can start from any i value specified in snapshot_start
FixedRedshift
  • redshift: redshift of the density field and source list or field
  • evolutionTime: evolution time in Myrs
EvolveRedshift
  • 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 field
  • redshift_end: redshift until which the ionization should be evolved
EvolveAll
  • 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
EvolveBySnapshot
  • 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
  • snapshot_start: snapshot number of density and source files from which the simulation should start
Cosmology
  • h: H = 100*h km/s/Mpc
  • omega_b: baryon density parameter
  • omega_m: matter density parameter
  • omega_l: lambda density parameter
  • sigma8: sigma8
  • Y: mass fraction of Helium in the primordial gas (assumed to consist of H and He)
Input
  • gridsize: size of the grid (should be a power of 2)
  • boxsize: comoving boxsize in Mpc/h
  • inputFilesAreInDoublePrecision: 0 for single, 1 for double precision of data files to be read in
  • inputFilesAreComoving: set to 1 if input files are comoving, otherwise 0
  • inputIgmDensityFile: 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 0
  • meanDensity: assumed mean density, density is evolved as dens(z) = meanDensity*(1+z)^3 (only effective when useDefaultMeanDensity=0)
  • useDefaultMeanDensity: set to 1 if default cosmological density value should be used (recommended), otherwise set to 0 if "meanDensity" is used
  • inputIgmClumpFile: name of clumping factor file, which is used to calculate the HI fraction at the listed outputs
  • inputSourcesFile: (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
BubbleModel
  • size_linear_scale: comoving size in h^{-1} Mpc until which tophat kernel should be increased linearly
  • first_increment_in_logscale: increment of the tophat kernel beyond linear increase
  • max_scale: maximum tophat kernel size in h^{-1} Mpc
  • useIonizedSphereModel: set to 1 if entire smoothing sphere should be marked as ionized, otherwise only central cell is flagged as ionized
PhotoionizationModel
  • 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 0

  • photHImodel: 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
  • 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)

PhotoionizationConst
  • photHI_bg: photoionization background value
PhotoionizationGiven
  • photHI_bg_file: name of file with a list of redshift, HI photoionization rates, HI photoheating rates, Q
PhotoionizationFlux
  • 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
PhotoionizationMfp
  • sourceSlopeIndex: spectral index of the spectrum of the ionizing sources, i.e. alpha for L_nu ~ nu^-alpha
RecombinationModel
  • calcRecombinations: set to 1 if number of recombinations should be calculated, otherwise 0

  • recombinationModel: 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
RecombinationDefault
RecombinationConst
  • dnrec_dt: constant recombination rate in #/Myr
RecombinationTable
  • 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 table
  • zmax: maximum redshift of recombination table
  • dz: increment in redshift in the recombination table
  • fmin: minimum factor (= recombination rate/photionization rate in 10^{-12}s) of recombination table
  • fmax maximum factor (= recombination rate/photionization rate in 10^{-12}s) of recombination table
  • df: increment in factor in the recombination table
  • dcellmin: minimum dcell^{-1/3} of recombination table
  • dcellmax: minimum dcell^{-1/3} of recombination table
  • ddcell: increment in dcell^{-1/3} in the recombination table
Helium
  • solveForHelium: set to 1 if HeII and HeIII fields should be computed, otherwise 0
  • inputSourcesHeIFile: (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
  • output_XHII_file: basename for output of XHII fields
  • write_photHI_file: set to 1 if photoionization file should be written
  • output_photHI_file: basename for output of HI photoionization fields
  • output_XHeII_file: output name for XHeII fields
  • output_XHeIII_file: output name for XHeIII fields
Restart
  • writeRestartFiles: set to 1 if restart fiels should be written, otherwise 0
  • restartFiles: basename for restart files
  • walltime: CPU walltime until the program is ceased and restart files are written

Options

Simulation types

  • 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 from 0.
  • 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 start i value needs to be specified.

Helium

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.

HI photoionization models

  • 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.

Recombination models

  • 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)

Analysis

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

Releases

No releases published

Packages

No packages published

Languages