Chemical Kinetics code in Python, with option to use ODE solver compatible with PyTorch, namely torchode by Lienen & Gunnemann (2022).
Originally developed in the context of circumstellar outflows of AGB stars. Find more info here.
This is a 0D chemical kinetics code, written in Python3. It solves the set of ordinary differential equations (ODEs) that make up the chemical network.
The code is based on the legacy chemistry codes by the UMIST Database of Astrochemsitry:
- The dark cloud chemical model source code: rate13_dc_code.tgz
- The circumstellar envelope chemical model source code: rate13_cse_code.tgz, see also Rate22-CSE code.
The purpose is to use this code to generate data to build a chemistry emulator.
Written by S. Maes & F. De Ceuster. 2023.
Run one 0D model:
- Manually put input values in script
/scr/input.py
- Run script
/scr/main.py
cd src/
python main.py
-
06.09.'24
The version using torchode does not work. The version using a SciPy ODE solver works.
-
02.08.'23
Self shielding doesn't work --> causes and infinite loop somehow... In comment in file
/src/rates.py
.
- Write code using object oriented programming (currently not the case, sorry!).
- Fix self-shielding of CO and N2.
- Fix compatibility with torchode.
From table by Visser et al. (2009).
If we assume that the dust extinction in the AGB wind is similar to the dust extinction in the ISM (so dust has similar properties), we can use this to determine the column densities of H2, CO and N2, without the need of any distances.
Predehl & Smitt (2995) found that for the ISM the column density of H2 can be determined by
For CO and
Rewrite the shielding tables in a more convenient way compared to online:
- Tables are real tables now
- Axis in a separate file:
- Rows:
$N({\rm H_2})$ - Columns:
$N({\rm CO})$ or$N({\rm N_2})$
- Rows:
- File name:
-
${\rm CO}$ :$\texttt{COshield.H2velocity[km/s].H2temp[K].13C/12C-ratio.dat}$ -
${\rm N_2}$ :$\texttt{N2shield.H2velocity[km/s].1eH2temp[K].N(H)[cm**-2].dat}$
-
The ODE function in scripts /src/ode/*
literally copied from the fortran ODEs of Rate22-CSE code, using ODEs-to-python.ipynb
.
More info; see PhD thesis Silke Maes, Chap. 3
- Two body:
$$k=\alpha\left(\frac{T}{300}\right)^\beta\exp\left(-\frac{\gamma}{T}\right)$$ in${\rm cm^3 , s^{-1}}$ - Cosmic rays:
- (CP) Direct ionisation:
$$k=\alpha$$ in${\rm s^{-1}}$ - (CR) Induced photoreaction:
$$k = \alpha\left(\frac{T}{300}\right)^\beta\frac{\gamma}{1-w}$$ in${\rm s^{-1}}$
- (CP) Direct ionisation:
- Photodissociation (PH):
$$k = \alpha, \xi \exp (-\gamma A_V)$$ in${\rm s^{-1}}$ , where$\xi = {\rm RAD}$ in the Rate22-CSE code.