Atomic-to-molecular hydrogen transition models for astrophysical simulations.
Project description
hih2
Atomic-to-molecular hydrogen transition models for astrophysical simulations.
To install:
cd ~
git clone https://github.com/avapolzin/hih2.git
cd hih2
pip install .
or
pip install hih2
Included models are:
- Krumholz, McKee, & Tumlinson (2009b) -- KMT09b
- Gnedin & Kravtsov (2011) -- GK11
- Krumholz (2013) -- K13
- Sternberg et al. (2014) -- S14
- Gnedin & Draine (2014) -- GD14
- Polzin et al. (2024a) -- P24
Volumetric models are in hih2.vol and projected models are in hih2.proj. All syntax is the same between those modules. It's very simple, so the docstrings are largely sufficient and limited documentation follows here:
All models take as arguments nh (hydrogen number density if hih2.vol -- cm-3 by default -- or hydrogen column density if hih2.proj -- cm-2 by default) and met (solar-scaled metallicity). gk11(), k13(), s14(), and p24() require uv (UV field strength). hih2.proj.gd14() and p24() also require an scale argument, which is the size of the grid cells (by default in pc). hih2.vol.gd14(), kmt09b, k13, and s14 also take a scale argument, which follows the convention of hih2.proj.
Both k13() and s14() functions also take a clumping factor argument, fc, and k13() additionally takes rho_sd (density of stars and dark matter, by default in M☉ pc-3), iterate (toggles whether values are computed iteratively), and niter (if iterate = True, sets number of interations).
All functions take dens_unit, which takes astropy.units objects to set the units in which nh is reported. k13() has an equivalent for rho_sd called sddens_unit. All of the functions that require scale take a scale_unit argument.
Each function returns the molecular hydrogen fraction (defined as H2/(HI + H2)) for the input gas density, metallicity, and UV field strength. The implicit assumption of these models is that all gas is neutral and that any ionized component is negligible.
Required arguments are summarized in the tables below.
Why is this a package? Good question. It's very easy to implement these HI-H2 models yourself either from the literature or from code examples (see compare_models.py for functions on their own), but some people may prefer a quick install/import. See the Appendix in Polzin et al. (2024a) for details of how the models included here are implemented.
Summary of required and optional parameters in models included in hih2.vol
| Model | nH | metallicity | UV field | scale | fc | ρSD |
|---|---|---|---|---|---|---|
kmt09b |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | |||
gk11 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | |||
k13 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | $\color{yellow}{\textit{Default = 1}}$ | $\color{yellow}{\textit{Default = 0.01}}$ |
s14 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | $\color{yellow}{\textit{Default = 1}}$ | |
gd14 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ||
p24 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ |
Summary of required and optional parameters in models included in hih2.proj
| Model | NH | metallicity | UV field | scale | fc | ρSD |
|---|---|---|---|---|---|---|
kmt09b |
${\color{red}Required}$ | ${\color{red}Required}$ | ||||
gk11 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | |||
k13 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | $\color{yellow}{\textit{Default = 1}}$ | $\color{yellow}{\textit{Default = 0.01}}$ | |
s14 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | $\color{yellow}{\textit{Default = 1}}$ | ||
gd14 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ||
p24 |
${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ | ${\color{red}Required}$ |
How can I access the models in a simple script? Just like hih2, compare_models.py includes functions for each of the models on a cell-by-cell basis and projected on different scales; models are stored for use in Python.
I will add C/C++ code in the near future. As always, the idea is for these functions to be easily callable. One can always refer to the original papers to examine the details of the different HI-H2 models.
Do you want to see a model added? Feel free to open a PR including a new model or open an issue requesting one. In each case, please include a link to the paper in which the model is published.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hih2-1.0.tar.gz.
File metadata
- Download URL: hih2-1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b99373dc5080f4adbfa5efbb0ca5cf70fad1c72c6a71b64e5e899c3165308ab1
|
|
| MD5 |
edb2344cd55c78677352b3578b7f9ee0
|
|
| BLAKE2b-256 |
74f4e4e33a6829fdb5d0369a9f0a7b8677cee51b1ac526252703f8cc36923648
|
File details
Details for the file hih2-1.0-py3-none-any.whl.
File metadata
- Download URL: hih2-1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69364c1aa77754ed1b14ec8220ad19b9c1f51b053b6672cd26c9efe8ba7a1508
|
|
| MD5 |
bf64ab90143162f208993c5fdc4c5daa
|
|
| BLAKE2b-256 |
2573fad5d4e55352f3fc48e88f9951fe0daf6e5f7de38384aaf4eda98cdae93d
|