Download this notebook

Chemical analysis examples

Steady-state model

[74]:
## FIXME: The notebook could use some more inline documentation and explanations
## FIXME: It also uses some random models, use the reference example model instead
/Users/work/miniforge3/envs/prodimo/lib/python3.13/site-packages/IPython/extensions/deduperreload/deduperreload.py:290: DeprecationWarning: ast.Ellipsis is deprecated and will be removed in Python 3.14; use ast.Constant instead
  elif not isinstance(ast_elt, (ast.Ellipsis, ast.Pass)):
[75]:
#%%bash
#mkdir chemanaexp
#cd chemanaexp
#wget https://raw.githubusercontent.com/saint-germain/prodimopy_test/master/notebooks/Reactions.out
#wget https://github.com/saint-germain/prodimopy_test/raw/master/notebooks/chemanalysis.out.zip
#wget https://github.com/saint-germain/prodimopy_test/raw/master/notebooks/test_TT_model.zip
#unzip chemanalysis.out.zip
#unzip test_TT_model.zip
[76]:
import prodimopy.read as pread
import prodimopy.plot as pplot
import prodimopy.plot_models as pplotm
pplot.load_style("nb")
INFO: Load prodimopynb mplstyle from package.
[77]:
model=pread.read_prodimo("chemanaexp")
pp=pplot.Plot(None)
READ: Reading File:  chemanaexp/ProDiMo.out  ...
READ: Reading File:  chemanaexp/Species.out  ...
READ: Reading File:  chemanaexp/FlineEstimates.out  ...
READ: Reading File:  chemanaexp/Elements.out  ...
READ: Reading File:  chemanaexp/dust_opac.out  ...
WARN: Could not open chemanaexp/dust_sigmaa.out!
READ: Reading File:  chemanaexp/StarSpectrum.out  ...
READ: Reading File:  chemanaexp/line_flux.out  ...
READ: Reading File:  chemanaexp/SED.out  ...
READ: Reading File:  chemanaexp/SEDana.out  ...
WARN: Could not open chemanaexp/image.out!
INFO: Reading time:  0.42 s

[78]:
# Analyse the chemistry of CO in the model, reads all the required data
# This will create a file chemistry_reactions_CO.txt in the model directory, can be switched off with to_txt=False
chemistry=model.analyse_chemistry('CO',to_txt=True)
#test=pread.analyse_chemistry('CO',model=model,to_txt=True,screenout=False) # same as above, but using the function directly
INFO: Using existing fits file for chemanalysis:  chemanalysis.fits
WARN: Try to read an older format ... let's hope it works!
INFO: Loaded  2842  Reactions from  chemanaexp/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: chemanaexp/chemistry_reactions_CO.txt
INFO: Found 209 formation and 43 destruction reactions for species CO.
INFO: Calc time:  0.13 s

[79]:
# plot the total formation rate of CO at everz grid point
fig=pp.plot_cont(model,chemistry.totfrate,'log CO formation rate')
PLOT: plot_cont ...
../_images/notebooks_ChemicalAnalysisExample_6_1.png

Main formation and destruction reactions

Here we show ways to visualize the main formation and destruction reactions for the chosen species.

[80]:
# Show the main formation and destruction rates (numbers) on the grid
# by setting level to e.g. 2 the 2nd most important reaction is shown
fig=pp.plot_reaccont(model,chemistry,rtype='d',zlim=[1.e-35,None],level=1,extend="min")
fig=pp.plot_reaccont(model,chemistry,rtype='f',zlim=[1.e-35,None],level=1,extend="min")
../_images/notebooks_ChemicalAnalysisExample_8_0.png
../_images/notebooks_ChemicalAnalysisExample_8_1.png
[81]:
# This plot shows the main formation and destruction reactions on the 2D grid color-coded
fig=pp.plot_reac_form_dest(chemistry)
INFO: Calculate volumes
WARN: plot_reac_form_dest: more than 10 reactions found, only the first 10 will be plotted, The rest will be in white.
../_images/notebooks_ChemicalAnalysisExample_9_1.png

Looking at a particular grid point in detail

Here we show all the relevant reactions for a particular grid point.

[82]:
# now show all the details for a particular grid point
# with lowRatesFrac one can set a threshold down to which the reation should be listed (e.g. don't show unimportant reactions)
chemistry.reac_rates_ix_iz(20,15,lowRatesFrac=1.e-5)
Analysing point x= 16.34573 au z=2.969142 au
      Detailed reaction rates for:         CO
------------------------------------------------------------------------------------------------------
                    grid point = 20       15
        r,z [au] (cylindrical) = 16.346  2.9691
               n<H>,nd [cm^-3] = 3.9e+09  6.9e-05
                Tgas,Tdust [K] = 4.6e+01  4.6e+01
                 AV_rad,AV_ver = 5.3e+01  3.4e-01
                  CO abundance = 1.380368e-04
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   2.49e-04
  207   2594 DT CO#          dust                       -> CO           dust                                     2.49e-04
   34    646 DR HCO+         e-                         -> CO           H                                        5.07e-08
  148   1842 NN CH2          O                          -> CO           H            H                           3.46e-08
  147   1841 NN CH2          O                          -> CO           H2                                       2.08e-08
  179   2057 NN O            CN                         -> CO           N                                        6.03e-09
  139   1814 NN C            O2                         -> CO           O                                        4.40e-09
  196   2177 PH CO2          PHOTON                     -> CO           O                                        3.02e-09
  183   2070 NN O            HCO                        -> CO           OH                                       2.80e-09
  185   2086 NN O            OCN                        -> CO           NO                                       2.70e-09
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   2.49e-04
   43   2593 IC CO           dust                       -> CO#          dust                                     2.49e-04
   35   2178 PH CO           PHOTON                     -> O            C                                        7.08e-08
   21   1213 IN H3+          CO                         -> HCO+         H2                                       3.63e-08
   13   1040 IN CO           HNSi+                      -> SiN          HCO+                                     9.88e-09
   23   1392 IN He+          CO                         -> O            C+           He                          9.26e-09
------------------------------------------------------------------------------------------------------

[83]:
# show some other point, but now using physical coordinates (x=10, z=1 au)
# the closest grid point for those coordinates will be shown
chemistry.reac_rates_ix_iz(locau=(10,1),lowRatesFrac=1.e-5)
Analysing point x= 8.917831 au z=1.017758 au
      Detailed reaction rates for:         CO
------------------------------------------------------------------------------------------------------
                    grid point = 19       11
        r,z [au] (cylindrical) = 8.918  1.0178
               n<H>,nd [cm^-3] = 6.8e+10  1.2e-03
                Tgas,Tdust [K] = 4.4e+01  4.4e+01
                 AV_rad,AV_ver = 2.5e+03  4.3e+00
                  CO abundance = 1.273261e-06
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   7.25e-04
  207   2594 DT CO#          dust                       -> CO           dust                                     7.24e-04
   34    646 DR HCO+         e-                         -> CO           H                                        5.41e-07
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   7.25e-04
   43   2593 IC CO           dust                       -> CO#          dust                                     7.24e-04
   21   1213 IN H3+          CO                         -> HCO+         H2                                       5.12e-07
   10    986 IN CH5+         CO                         -> HCO+         CH4                                      2.75e-08
   23   1392 IN He+          CO                         -> O            C+           He                          1.56e-08
   14   1041 IN CO           HN2+                       -> HCO+         N2                                       1.31e-08
------------------------------------------------------------------------------------------------------

Time-dependent model

Example for using the time-dependent output for the chamanlysis. This is still in an early stage but it is already possible to do some chemistry analyis with time-dependent ProDiMo models (using time_chem_disk). All the figures and analyisis methods for steady-state models can be used for time-dependent models as well. But one always has to specify the time step for which the analysis should be done.

However, the time-dependent models also allow to analyze the chemistry as funtion of time, at least for a particualr grid point. This is useful, because it is not necessarily the case that a dominant reaction in the steady-state was als dominant at all times.

[84]:
# read the time-dependent models
# YOU NEED TO UPDATE THIS PATH TO YOUR MODEL
mdir="../../../../MODELS/TEST_CHEMANA/modNewTD"

models=list()
# Update according to your model, here we have a time-dependent model with 5 time steps
for tdidx in range(5):
  m=pread.read_prodimo(mdir,td_fileIdx=tdidx+1)
  m.name=f"{m.params["AGE_DISK"][tdidx]:.4g} yr"
  models.append(m)

# If the reading of the models was successful the rest of the jupyter notebook should just run ... (as long as you have H2O and H2O# in your chemical network)
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/ProDiMo_0001.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Species.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/FlineEstimates_0001.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Elements.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_opac.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_sigmaa.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/StarSpectrum.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/image.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Parameter.out  ...
INFO: Reading time:  0.61 s

READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/ProDiMo_0002.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Species.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/FlineEstimates_0002.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Elements.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_opac.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_sigmaa.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/StarSpectrum.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/image.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Parameter.out  ...
INFO: Reading time:  0.49 s

READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/ProDiMo_0003.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Species.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/FlineEstimates_0003.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Elements.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_opac.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_sigmaa.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/StarSpectrum.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/image.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Parameter.out  ...
INFO: Reading time:  0.52 s

READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/ProDiMo_0004.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Species.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/FlineEstimates_0004.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Elements.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_opac.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_sigmaa.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/StarSpectrum.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/image.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Parameter.out  ...
INFO: Reading time:  0.56 s

READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/ProDiMo_0005.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Species.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/FlineEstimates_0005.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Elements.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_opac.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/dust_sigmaa.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/StarSpectrum.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNewTD/image.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNewTD/Parameter.out  ...
INFO: Reading time:  0.52 s

[85]:
ppm=pplotm.PlotModels(None)
# the dashed lines in that figure are the ices
fig=ppm.plot_tcdspec(models,"H2O",facGrayBox=None,ice=True,ylim=[1.e11,1.e23],xlog=True)
PLOT: plot_tcdspec ...
INFO: Calculate vertical column densities
INFO: Calculate vertical column densities
INFO: Calculate vertical column densities
INFO: Calculate vertical column densities
INFO: Calculate vertical column densities
../_images/notebooks_ChemicalAnalysisExample_15_1.png
[86]:
# now read the chemanalysis output, for all the time-steps at once
chemanas=list()
for model in models:
  chemanas.append(model.analyse_chemistry('H2O',to_txt=True))

INFO: Using existing fits file for chemanalysis:  chemanalysis_0001.fits
INFO: Loaded  1377  Reactions from  ../../../../MODELS/TEST_CHEMANA/modNewTD/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_H2O_0001.txt
INFO: Found 45 formation and 57 destruction reactions for species H2O.
INFO: Calc time:  0.08 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0002.fits
INFO: Loaded  1377  Reactions from  ../../../../MODELS/TEST_CHEMANA/modNewTD/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_H2O_0002.txt
INFO: Found 45 formation and 57 destruction reactions for species H2O.
INFO: Calc time:  0.07 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0003.fits
INFO: Loaded  1377  Reactions from  ../../../../MODELS/TEST_CHEMANA/modNewTD/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_H2O_0003.txt
INFO: Found 45 formation and 57 destruction reactions for species H2O.
INFO: Calc time:  0.11 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0004.fits
INFO: Loaded  1377  Reactions from  ../../../../MODELS/TEST_CHEMANA/modNewTD/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_H2O_0004.txt
INFO: Found 45 formation and 57 destruction reactions for species H2O.
INFO: Calc time:  0.06 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0005.fits
INFO: Loaded  1377  Reactions from  ../../../../MODELS/TEST_CHEMANA/modNewTD/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_H2O_0005.txt
INFO: Found 45 formation and 57 destruction reactions for species H2O.
INFO: Calc time:  0.06 s

[87]:
# the typical chemanalysis plot for each time-step
import matplotlib.pyplot as plt

pp=pplot.Plot(None)
for model,chemana in zip(models,chemanas):
  fig,axes=plt.subplots(1,3,figsize=(11,3))
  fig1=pp.plot_cont(model,chemana.totfrate,'H2O formation rate',ax=axes[0])
  fig2=pp.plot_reaccont(model,chemana,rtype='f',vmin=-45,ax=axes[1])
  fig3=pp.plot_reaccont(model,chemana,rtype='d',vmin=-45,ax=axes[2])
  fig.suptitle(model.name)
  fig.tight_layout()
PLOT: plot_cont ...
PLOT: plot_cont ...
PLOT: plot_cont ...
PLOT: plot_cont ...
PLOT: plot_cont ...
../_images/notebooks_ChemicalAnalysisExample_17_1.png
../_images/notebooks_ChemicalAnalysisExample_17_2.png
../_images/notebooks_ChemicalAnalysisExample_17_3.png
../_images/notebooks_ChemicalAnalysisExample_17_4.png
../_images/notebooks_ChemicalAnalysisExample_17_5.png
[88]:
# analyse a grid point at each time step
for chemana in chemanas:
  print(" ")
  print("YEAR:",chemana.model.name)
  chemana.reac_rates_ix_iz(6,10)
  print(" ")

YEAR: 1 yr
Analysing point x= 0.3805846 au z=0.04772979 au
      Detailed reaction rates for:        H2O
------------------------------------------------------------------------------------------------------
                    grid point = 6       10
        r,z [au] (cylindrical) = 0.381  0.0477
               n<H>,nd [cm^-3] = 1.3e+12  2.8e-02
                Tgas,Tdust [K] = 2.1e+02  2.1e+02
                 AV_rad,AV_ver = 6.3e+01  6.4e-01
                 H2O abundance = 1.660914e-07
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   4.09e-01
   30    871 NN H2           OH                         -> H2O          H                                        3.20e-01
   42   1259 DT H2O#         dust                       -> H2O          dust                                     8.82e-02
   14    366 DR H3O+         e-                         -> H2O          H                                        5.61e-04
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   4.09e-01
   51    993 PH H2O          PHOTON                     -> OH           H                                        1.69e-01
   52   1080 P3 H2O          PHOTON                     -> O            H2                                       1.14e-01
   56   1258 IC H2O          dust                       -> H2O#         dust                                     8.82e-02
   33    563 IN H2O          Si+                        -> SiOH+        H                                        3.74e-02
------------------------------------------------------------------------------------------------------



YEAR: 1000 yr
Analysing point x= 0.3805846 au z=0.04772979 au
      Detailed reaction rates for:        H2O
------------------------------------------------------------------------------------------------------
                    grid point = 6       10
        r,z [au] (cylindrical) = 0.381  0.0477
               n<H>,nd [cm^-3] = 1.3e+12  2.8e-02
                Tgas,Tdust [K] = 2.1e+02  2.1e+02
                 AV_rad,AV_ver = 6.3e+01  6.4e-01
                 H2O abundance = 1.775422e-07
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   4.15e-01
   30    871 NN H2           OH                         -> H2O          H                                        3.20e-01
   42   1259 DT H2O#         dust                       -> H2O          dust                                     9.43e-02
   14    366 DR H3O+         e-                         -> H2O          H                                        5.65e-04
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   4.15e-01
   51    993 PH H2O          PHOTON                     -> OH           H                                        1.65e-01
   52   1080 P3 H2O          PHOTON                     -> O            H2                                       1.18e-01
   56   1258 IC H2O          dust                       -> H2O#         dust                                     9.43e-02
   33    563 IN H2O          Si+                        -> SiOH+        H                                        3.72e-02
   28    558 IN H2O          HCO+                       -> CO           H3O+                                     4.27e-04
------------------------------------------------------------------------------------------------------



YEAR: 1e+04 yr
Analysing point x= 0.3805846 au z=0.04772979 au
      Detailed reaction rates for:        H2O
------------------------------------------------------------------------------------------------------
                    grid point = 6       10
        r,z [au] (cylindrical) = 0.381  0.0477
               n<H>,nd [cm^-3] = 1.3e+12  2.8e-02
                Tgas,Tdust [K] = 2.1e+02  2.1e+02
                 AV_rad,AV_ver = 6.3e+01  6.4e-01
                 H2O abundance = 1.775422e-07
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   4.15e-01
   30    871 NN H2           OH                         -> H2O          H                                        3.20e-01
   42   1259 DT H2O#         dust                       -> H2O          dust                                     9.43e-02
   14    366 DR H3O+         e-                         -> H2O          H                                        5.65e-04
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   4.15e-01
   51    993 PH H2O          PHOTON                     -> OH           H                                        1.65e-01
   52   1080 P3 H2O          PHOTON                     -> O            H2                                       1.18e-01
   56   1258 IC H2O          dust                       -> H2O#         dust                                     9.43e-02
   33    563 IN H2O          Si+                        -> SiOH+        H                                        3.72e-02
   28    558 IN H2O          HCO+                       -> CO           H3O+                                     4.27e-04
------------------------------------------------------------------------------------------------------



YEAR: 1e+05 yr
Analysing point x= 0.3805846 au z=0.04772979 au
      Detailed reaction rates for:        H2O
------------------------------------------------------------------------------------------------------
                    grid point = 6       10
        r,z [au] (cylindrical) = 0.381  0.0477
               n<H>,nd [cm^-3] = 1.3e+12  2.8e-02
                Tgas,Tdust [K] = 2.1e+02  2.1e+02
                 AV_rad,AV_ver = 6.3e+01  6.4e-01
                 H2O abundance = 1.775422e-07
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   4.15e-01
   30    871 NN H2           OH                         -> H2O          H                                        3.20e-01
   42   1259 DT H2O#         dust                       -> H2O          dust                                     9.43e-02
   14    366 DR H3O+         e-                         -> H2O          H                                        5.65e-04
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   4.15e-01
   51    993 PH H2O          PHOTON                     -> OH           H                                        1.65e-01
   52   1080 P3 H2O          PHOTON                     -> O            H2                                       1.18e-01
   56   1258 IC H2O          dust                       -> H2O#         dust                                     9.43e-02
   33    563 IN H2O          Si+                        -> SiOH+        H                                        3.72e-02
   28    558 IN H2O          HCO+                       -> CO           H3O+                                     4.27e-04
------------------------------------------------------------------------------------------------------



YEAR: 1e+06 yr
Analysing point x= 0.3805846 au z=0.04772979 au
      Detailed reaction rates for:        H2O
------------------------------------------------------------------------------------------------------
                    grid point = 6       10
        r,z [au] (cylindrical) = 0.381  0.0477
               n<H>,nd [cm^-3] = 1.3e+12  2.8e-02
                Tgas,Tdust [K] = 2.1e+02  2.1e+02
                 AV_rad,AV_ver = 6.3e+01  6.4e-01
                 H2O abundance = 1.775422e-07
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   4.15e-01
   30    871 NN H2           OH                         -> H2O          H                                        3.20e-01
   42   1259 DT H2O#         dust                       -> H2O          dust                                     9.43e-02
   14    366 DR H3O+         e-                         -> H2O          H                                        5.65e-04
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   4.15e-01
   51    993 PH H2O          PHOTON                     -> OH           H                                        1.65e-01
   52   1080 P3 H2O          PHOTON                     -> O            H2                                       1.18e-01
   56   1258 IC H2O          dust                       -> H2O#         dust                                     9.43e-02
   33    563 IN H2O          Si+                        -> SiOH+        H                                        3.72e-02
   28    558 IN H2O          HCO+                       -> CO           H3O+                                     4.27e-04
------------------------------------------------------------------------------------------------------


[89]:
# now read the chemanalysis output for a different species
chemanasCO=list()
for tdidx,model in enumerate(models):
  chemanasCO.append(model.analyse_chemistry('CO'))

# Also load a steady-state model for comparison
modsst=pread.read_prodimo("../../../../MODELS/TEST_CHEMANA/modNew",name="Steady-State")
modsst_chemana=modsst.analyse_chemistry('CO')
modsst_chemana.reac_rates_ix_iz(15,15)
INFO: Using existing fits file for chemanalysis:  chemanalysis_0001.fits
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_CO_0001.txt
INFO: Found 100 formation and 36 destruction reactions for species CO.
INFO: Calc time:  0.08 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0002.fits
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_CO_0002.txt
INFO: Found 100 formation and 36 destruction reactions for species CO.
INFO: Calc time:  0.05 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0003.fits
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_CO_0003.txt
INFO: Found 100 formation and 36 destruction reactions for species CO.
INFO: Calc time:  0.05 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0004.fits
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_CO_0004.txt
INFO: Found 100 formation and 36 destruction reactions for species CO.
INFO: Calc time:  0.05 s

INFO: Using existing fits file for chemanalysis:  chemanalysis_0005.fits
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNewTD/chemistry_reactions_CO_0005.txt
INFO: Found 100 formation and 36 destruction reactions for species CO.
INFO: Calc time:  0.05 s

READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/ProDiMo.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/Species.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/FlineEstimates.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/Elements.out  ...
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/dust_opac.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNew/dust_sigmaa.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/StarSpectrum.out  ...
WARN: Could not open ../../../../MODELS/TEST_CHEMANA/modNew/image.out!
READ: Reading File:  ../../../../MODELS/TEST_CHEMANA/modNew/Parameter.out  ...
INFO: Reading time:  0.51 s

INFO: Using existing fits file for chemanalysis:  chemanalysis.fits
INFO: Loaded  1377  Reactions from  ../../../../MODELS/TEST_CHEMANA/modNew/Reactions.out
WARN: Could not load rate coefficients from rate_coeffs_1NZZ.log
INFO: Writing information to: ../../../../MODELS/TEST_CHEMANA/modNew/chemistry_reactions_CO.txt
INFO: Found 100 formation and 36 destruction reactions for species CO.
INFO: Calc time:  0.07 s

Analysing point x= 6.216286 au z=1.390791 au
      Detailed reaction rates for:         CO
------------------------------------------------------------------------------------------------------
                    grid point = 15       15
        r,z [au] (cylindrical) = 6.216  1.3908
               n<H>,nd [cm^-3] = 5.4e+08  2.1e-06
                Tgas,Tdust [K] = 1.9e+02  1.9e+02
                 AV_rad,AV_ver = 4.6e-03  6.8e-05
                  CO abundance = 2.656508e-07
------------------------------------------------------------------------------------------------------
 Total form. rate [cm^-3 s^-1] =   1.27e-04
   11    137 CE H            CO+                        -> CO           H+                                       7.71e-05
   21    373 DR HCO+         e-                         -> CO           H                                        3.67e-05
   64    814 NN C            OH                         -> CO           H                                        7.94e-06
   26    411 IN C+           O2                         -> CO           O+                                       3.56e-06
   77    855 NN CH           O                          -> CO           H                                        9.15e-07
   63    813 NN C            O2                         -> CO           O                                        3.43e-07
   62    812 NN C            NO                         -> CO           N                                        3.27e-07
   86    929 NN O            CN                         -> CO           N                                        2.59e-07
------------------------------------------------------------------------------------------------------
 Total dest. rate [cm^-3 s^-1] =   1.27e-04
   27    986 PH CO           PHOTON                     -> O            C                                        1.27e-04
   19    624 IN He+          CO                         -> O            C+           He                          2.54e-07
------------------------------------------------------------------------------------------------------

[90]:
# Now we plot for a certain grid point the main formation and destriction reactions as function of time.
# The arrow at the right-hand side of the figure shows the results from the steady-state model.
fig=pp.plot_reac_ixiz(15,15,"f",chemanasCO,chemana_steadystate=modsst_chemana)
fig=pp.plot_reac_ixiz(15,15,"d",chemanasCO,chemana_steadystate=modsst_chemana)

../_images/notebooks_ChemicalAnalysisExample_20_0.png
../_images/notebooks_ChemicalAnalysisExample_20_1.png
[91]:
# main form/dest reaction at the beginning and the end of the time-dependent evolution
fig=pp.plot_reac_form_dest(chemanasCO[0])
fig=pp.plot_reac_form_dest(chemanasCO[-1])
INFO: Calculate volumes
INFO: Calculate volumes
../_images/notebooks_ChemicalAnalysisExample_21_1.png
../_images/notebooks_ChemicalAnalysisExample_21_2.png