Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

chemistry

munan edited this page Nov 11, 2019 · 22 revisions

Currently, the chemistry module is on the developing branch "chemistry_scalar". In order to use it, checkout the branch:

$git checkout chemistry_scalar

Note that the chemistry module is not fully tested yet. Use it at your own risk, and report any problems to Munan Gong.

Formulation

Chemistry uses the basic functionality of the passive scalar module. The reaction rates act as a source term for the passive scalars. It can also interact with other parts of the code, e.g. heating and cooling rates in the energy equation, the equation of state, opacity in radiation transfer, etc.

code implementation

Because the chemical reaction rates for different species often differ by orders of magnitude, implicit solvers are suited better to solve the rate equations. We use the operator split method: at the last stage of the passive scalar flux integration task, before the conserved to primitive conversion, we advance the chemical abundances and the internal energy for "dt", the simulation cycle timestep, by solving a set of coupled ODEs implicitly:

In the code, the reaction rate K_i is referred to as the RHS (right-hand-side) and the de/dt (heating and cooling) is refered to as Edot. Because the chemical reaction rate Ki usually depends on the temperature T, the user often need to have some expression of T as a function of the internal energy e in their RHS. Currently, chemistry works with a simple isothermal or adiabatic equation of state with a fixed adiabatic index. General EOS dependence on chemistry has not been included yet.

Note that the passive scalar advection (and diffusion) is solved separately prior to the chemical rate equations. This operator split method is only first-order accurate. No conservation of elemental abundances (such as by rescaling the flux of different species) has been implemented yet.

Running the Code

Prerequisite: CVODE library

The chemistry module uses the CVODE library, which the user must install on their system: https://computing.llnl.gov/projects/sundials/cvode

regression tests

Currently, there are two chemistry regression tests: One of them tests the equilibrium solution of the chemical network in Gong, Ostriker and Wolfire (2017). The other compares the analytic solution to the numerical one in a simple H2 formation network (figure below).

~/athena/tst/regression$python run_test.py chemistry

In order to run the regression test successfully, one needs to configure the $CVODE_PATH environment variable. This can be done by adding the environmental variable in the '~/.bashrc' file

export CVODE_PATH=/usr/local/sundials (or other paths where CVODE is installed)

configuruation

input file

output

vtk, hdf5 (rH2), history(H2), restart is not functioning yet.

write your own chemistry network

Clone this wiki locally