How to generage a Chemistry Table for GEAR

To run the following example, you need first to download some tables.

  • copy the data tables

    wget https://obswww.unige.ch/~revaz/PyChemTables.tar.gz
    tar -xzf PyChemTables.tar.gz
    rm PyChemTables.tar.gz
    

Setup a parameter file

First, it is important to create a parameter file that describes some chemistry parameters, including the IMF as well as the path to yields tables. You can copy an example of such parameter file from here:

wget https://obswww.unige.ch/~revaz/chimieparam.py

The parameter file has a python syntax and is decomposed in the following blocks:

IMF section

The IMF is modeled as a list of affine functions of different slopes. It is described by the following parameters:

###########################
# IMF
###########################

Mmin = 0.05                                      # min mass of all stars considered in the code
Mmax = 50.                                       # max mass of all stars considered in the code

m_s = [0.08,     0.5,    1.0]                                      # masses ranges
a_s = [-1.35,   -1.35,  -1.35,  -1.35]                       # IMF slope in the previous mass ranges

SNII section

Parameters for the SNII model:

###########################
# SNII
###########################

SNII_Mmin       = 8.                                  # min mass of SNII stars
SNII_Mmax       = Mmax                                # max mass of SNII stars
                                                  # NOTE: ejecta and yields are zero outside this range


# masses for metal injection
Mmin1SNII = SNII_Mmin                             # minimum mass used for the yields interpolation
Mmax1SNII = Mmax*1.5                              # maximum mass used for the yields interpolation

# masses for helium core
Mmin2SNII = Mmin                                  # minimum mass used for the helium core interpolation
Mmax2SNII = Mmax*1.5                              # maximum mass used for the helium core interpolation


# number of bins
nSNII = 200                                       # number of bins used for the yields and helium core interpolation

# mass resolution
dMSNII = 0.001                                    # mass resolution used for the yields and helium core interpolation


SNIIYieldsFile      = ['tables/MetalSNII/yields_tsujimoto95bis-25042013.txt']   # Yields tables
SNIIHeliumCoreFile  = 'tables/HeliumCore.dat'                                   # Corresponding helium core files

SNIIEnergy section

Parameters:

SNIIEnergyFile  = 'tables/SNIIEnergyFile_Nomoto2012.dat'    # a file that gives the energy (in 1e51 ergs)
                                                            # as a function of the energy mass

SNIa section

Parameters for the SNIa model. Here, we use the Kobayashi model:

###########################
# SNIa
###########################

SNIa_Mpl        = 3.0                                 # minimal mass for SNIa
SNIa_Mpu        = 8.0                                 # maximal mass for SNIa

SNIa_a          = -0.35                                 # imf slope

SNIa_Mdl1       = 0.9                                 # minimal mass for MS stars
SNIa_Mdu1       = 1.5                                 # maximal mass for MS stars
SNIa_bb1        = 0.02                                # normalisation

SNIa_Mdl2       = 1.8                                 # minimal mass for RG stars
SNIa_Mdu2       = 2.6                                 # maximal mass for RG stars
SNIa_bb2        = 0.05                                # normalisation

MeanWDMass = 1.38                                 # mean whith dwarfs mass


SNIaFile       = 'tables/MetalSNIa/yields_SNIa_tsujimoto95bis.txt'          # Yields tables

DYIN section

In this section, we parametrize the ejectas from dying stars. Dying stars are all stars except stars that generate SNII or SNIa, which are described below.

Parameters for the DYIN stars:

###########################
# DYIN
###########################

DYIN_Mmin       = 1.3                                 # min mass of DYIN stars
DYIN_Mmax       = 3.0                                 # max mass of DYIN stars
                                                  # NOTE: ejecta and yields are zero outside this range


# masses for metal injection
Mmin1DYIN = DYIN_Mmin                             # minimum mass used for the yields interpolation
Mmax1DYIN = Mmax*1.5                              # maximum mass used for the yields interpolation

# masses for helium core
Mmin2DYIN = Mmin                                  # minimum mass used for the helium core interpolation
Mmax2DYIN = Mmax*1.5                              # maximum mass used for the helium core interpolation

# number of bins
nDYIN = 200                                       # number of bins used for the yields and helium core interpolation

# mass resolution
dMDYIN = 0.001                                    # mass resolution used for the yields and helium core interpolation

# Z (metallicity) interpolation
ZminDYIN = 1e-5                                   # minimum value
ZmaxDYIN = 1.                                     # maximum value
nZDYIN   = 110                                    # number of bins in Z

DYINYieldsFile     = ['tables/AGBs/OriginalData/karakas-0.0200.txt']            # Yields tables
DYINHeliumCoreFile = 'tables/AGBs/OriginalData/karakas-HeliumCore-0.0200.txt'   # Corresponding helium core files

ListOfDYINZs =  [0.0001,                          # list of metallicities
               0.0003,
               0.0010,
               0.0030,
               0.0060,
               0.0080,
               0.0100,
               0.0140,
               0.0200]

ListOfDYINYieldsFiles = [                         # Yields tables
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0001.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0003.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0010.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0030.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0060.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0080.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0100.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0140.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-Yields-0.0200.txt"]

ListOfDYINHeliumCoreFiles = [                     # Helium core tables
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0001.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0003.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0010.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0030.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0060.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0080.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0100.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0140.txt",
  "PyChemTables/tables/AGBs/Cristallo/cristallo-HeliumCore-0.0200.txt"]

Solar abundances section

File or list of files containing the solar abundances of different elements:

###########################
# Solar abundances
###########################

SolarAbundancesFile = "tables/SolarAbundances/Grevesse98.txt"       # solar abundances for all elements

Elements section

It is possible to specify a list of elements to follow, using elts. In case elts is defined, nelts is set to len(elts). If elts is set to None, only elements found into the tables are considered. Their number must be equal to nelts:

###########################
# Elements to follow
###########################

elts = ["Fe","Mg","O","Metals"]                                     # elements to consider in the code

Generate the output

The chemical table is generated using the following command:

pychem_generate_hdf5_parameters -p chimieparam.py -o chemistry.h5

Get info from an output file

There is two ways to explore output files: As output files are in hdf5 format, the h5dump transform the binary file in ascii charater:

h5dump chemistry.h5

You can also call the script pychem_read to retreive the same information in a user-friendly format:

pychem_read chemistry.h5

and you should get something like:

Header content:

         version = v0.0
         author  = revaz
         date    = Mon Jun  3 13:57:50 2013


Data attribute content:

         nelts               = 9
         elts                = Fe Mg O Si Ca Ba N Ne Metals
         SolarMassAbundances = 0.00176604 0.000924316 0.0108169 0.000996529 9.1818e-05 1.85267e-08 0.00116503 0.00242653 0.02
         MeanWDMass          = 1.38

         SNIIYieldsFile      = ['tables/MetalSNII/yields_tsujimoto95bis-25042013.txt', 'tables/MetalSNII/cescutti2006bis.txt']
         SNIIHeliumCoreFile  = tables/HeliumCore.dat

         DYINYieldsFile      = ['tables/AGBs/OriginalData/karakas-0.0200.txt']
         DYINHeliumCoreFile  = tables/AGBs/OriginalData/karakas-HeliumCore-0.0200.txt

         SNIaFile            = tables/MetalSNIa/yields_SNIa_tsujimoto95bis.txt
         SolarAbundancesFile = tables/SolarAbundances/Grevesse98.txt

Output from LiveTimes:

         coeff_z     =
                 [ -40.1107 5.5099 0.7824]
                 [ 141.9296 -15.8895 -3.2558]
                 [ -261.3655 17.0735 9.8661]

Output from IMF:

         n      = 3
         Mmin   = 0.05
         Mmax   = 50
         as     = 0.7 -0.8 -1.7 -1.3
         ms     = 0.08 0.5 1

Output from SNIa:

         Mpl    = 3
         Mpu    = 8
         a      = -0.35
         Mdl1   = 0.9
         Mdu1   = 1.5
         bb1    = 0.02
         Mdl2   = 1.8
         Mdu2   = 2.6
         bb2    = 0.05

         Metals:

                 Ej     = 0
                 Ejnp   = 0
                 Fe     = 0.743463
                 Mg     = 0.0085723
                 O      = 0.143
                 Si     = 0.152601
                 Ca     = 0.0123442
                 Ba     = 0
                 N      = 1.16132e-06
                 Ne     = 0.00451846
                 Metals = 1.37

Output from SNII:

         Mmin   = 8
         Mmax   = 50
         npts   = 200
         nelts  = 22
         elts   = Ej Ejnp Fe Mg O Si Ca Ba N Ne Metals IEj IEjnp IFe IMg IO ISi ICa IBa IN INe IMetals

         Metals:

                Ej:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = Ej

                         [0] 0.0484373
                         [1] 0.0493562
                         [2] 0.0503087
                         ...
                         [197] 0.9557
                         [198] 0.957242
                         [199] 0.958839

                Ejnp:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = Ejnp

                         [0] 0.0484373
                         [1] 0.0493562
                         [2] 0.0503087
                         ...
                         [197] 0.565376
                         [198] 0.561333
                         [199] 0.557143

                Fe:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Fe

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.0014878
                         [198] 0.00146762
                         [199] 0.00144723

                Mg:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Mg

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.0156387
                         [198] 0.0157259
                         [199] 0.015814

                O:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = O

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.28294
                         [198] 0.284594
                         [199] 0.286264

                Si:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Si

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.0135831
                         [198] 0.0135958
                         [199] 0.0136085

                Ca:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Ca

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.000410666
                         [198] 0.000403546
                         [199] 0.000396352

                Ba:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Ba

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                N:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = N

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 7.81297e-05
                         [198] 8.04171e-05
                         [199] 8.27283e-05

                Ne:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Ne

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.0260997
                         [198] 0.0263446
                         [199] 0.0265921

                Metals:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = Metals

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.353817
                         [198] 0.355825
                         [199] 0.357853

                IEj:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = IEj

                         [0] 8.20681e-05
                         [1] 0.000237071
                         [2] 0.000404755
                         ...
                         [197] 0.432685
                         [198] 0.43435
                         [199] 0.435999

                IEjnp:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = IEjnp

                         [0] 8.20681e-05
                         [1] 0.000237071
                         [2] 0.000404755
                         ...
                         [197] 0.407578
                         [198] 0.408559
                         [199] 0.409522

                IFe:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = IFe

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.000401616
                         [198] 0.000402349
                         [199] 0.00040307

                IMg:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = IMg

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.000830851
                         [198] 0.00083863
                         [199] 0.000846428

                IO:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = IO

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.0126222
                         [198] 0.012763
                         [199] 0.0129041

                ISi:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = ISi

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.000759394
                         [198] 0.000766134
                         [199] 0.00077286

                ICa:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = ICa

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 3.54898e-05
                         [198] 3.56918e-05
                         [199] 3.58895e-05

                IBa:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = IBa

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 3.99734e-09
                         [198] 3.99734e-09
                         [199] 3.99734e-09

                IN:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = IN

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 9.32484e-06
                         [198] 9.36416e-06
                         [199] 9.4045e-06

                INe:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = INe

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.00153821
                         [198] 0.00155121
                         [199] 0.0015643

                IMetals:

                         nbins = 200
                         min   = 8
                         step  = 0.00448638
                         label = IMetals

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0.017195
                         [198] 0.017371
                         [199] 0.0175475

Output from DYIN:

         Mmin   = 1
         Mmax   = 6.5
         npts   = 200
         nelts  = 22
         elts   = Ej Ejnp Fe Mg O Si Ca Ba N Ne Metals IEj IEjnp IFe IMg IO ISi ICa IBa IN INe IMetals

         Metals:

                Ej:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = Ej

                         [0] 0.0377599
                         [1] 0.0385247
                         [2] 0.0393172
                         ...
                         [197] 1
                         [198] 1
                         [199] 1

                Ejnp:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = Ejnp

                         [0] 0.03771
                         [1] 0.0384746
                         [2] 0.0392672
                         ...
                         [197] 1
                         [198] 1
                         [199] 1

                Fe:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Fe

                         [0] 1.08832e-09
                         [1] 6.7362e-09
                         [2] 1.25027e-08
                         ...
                         [197] 3.43576e-05
                         [198] 3.52153e-05
                         [199] 3.60911e-05

                Mg:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Mg

                         [0] 6.67526e-10
                         [1] 3.58973e-09
                         [2] 6.57329e-09
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                O:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = O

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                Si:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Si

                         [0] 0
                         [1] 2.28417e-09
                         [2] 5.62383e-09
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                Ca:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Ca

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                Ba:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Ba

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                N:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = N

                         [0] 0.000179128
                         [1] 0.000197846
                         [2] 0.000216956
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                Ne:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Ne

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                Metals:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = Metals

                         [0] 0.00825266
                         [1] 0.00841436
                         [2] 0.00857945
                         ...
                         [197] 0.777598
                         [198] 0.794452
                         [199] 0.81166

                IEj:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = IEj

                         [0] 6.39996e-05
                         [1] 0.000184997
                         [2] 0.000316052
                         ...
                         [197] 0.403811
                         [198] 0.405552
                         [199] 0.407274

                IEjnp:

                         nbins = 200
                         min   = 0.05
                         step  = 0.0155624
                         label = IEjnp

                         [0] 6.39155e-05
                         [1] 0.000184756
                         [2] 0.000315645
                         ...
                         [197] 0.403764
                         [198] 0.405505
                         [199] 0.407227

                IFe:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = IFe

                         [0] 2.01922e-13
                         [1] 1.44529e-11
                         [2] 4.801e-11
                         ...
                         [197] 1.27994e-06
                         [198] 1.31481e-06
                         [199] 1.35032e-06

                IMg:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = IMg

                         [0] 1.21722e-13
                         [1] 7.85216e-12
                         [2] 2.55692e-11
                         ...
                         [197] 4.44685e-06
                         [198] 4.44685e-06
                         [199] 4.44685e-06

                IO:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = IO

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                ISi:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = ISi

                         [0] 0
                         [1] 3.09283e-12
                         [2] 1.70333e-11
                         ...
                         [197] 4.89162e-07
                         [198] 4.89162e-07
                         [199] 4.89162e-07

                ICa:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = ICa

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                IBa:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = IBa

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 0
                         [198] 0
                         [199] 0

                IN:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = IN

                         [0] 2.9655e-08
                         [1] 6.76944e-07
                         [2] 1.38449e-06
                         ...
                         [197] 0.000508581
                         [198] 0.000508581
                         [199] 0.000508581

                INe:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = INe

                         [0] 0
                         [1] 0
                         [2] 0
                         ...
                         [197] 4.03249e-05
                         [198] 4.03249e-05
                         [199] 4.03249e-05

                IMetals:

                         nbins = 200
                         min   = 1
                         step  = 0.00902452
                         label = IMetals

                         [0] 1.36346e-06
                         [1] 2.98785e-05
                         [2] 5.8772e-05
                         ...
                         [197] 0.0444258
                         [198] 0.0452137
                         [199] 0.0460137