PyMHD 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pymhd/__init__.py +31 -0
- pymhd/derivatives/TENO.py +278 -0
- pymhd/derivatives/WENO.py +323 -0
- pymhd/derivatives/__init__.py +24 -0
- pymhd/derivatives/compact.py +365 -0
- pymhd/derivatives/derivative.py +926 -0
- pymhd/numdiss.py +598 -0
- pymhd/plot/__init__.py +48 -0
- pymhd/plot/nd.py +1519 -0
- pymhd/plot/slc.py +648 -0
- pymhd/plot/spc.py +249 -0
- pymhd/preprocess/Athena.py +847 -0
- pymhd/preprocess/__init__.py +69 -0
- pymhd/preprocess/helper/NOTICE +42 -0
- pymhd/preprocess/helper/bin_convert.py +2000 -0
- pymhd/preprocess/helper/make_athdf.py +45 -0
- pymhd/spectra.py +376 -0
- pymhd/turbulence.py +917 -0
- pymhd-0.1.0.dist-info/METADATA +100 -0
- pymhd-0.1.0.dist-info/RECORD +22 -0
- pymhd-0.1.0.dist-info/WHEEL +4 -0
- pymhd-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyMHD
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for post-processing MHD turbulence simulations
|
|
5
|
+
Project-URL: Homepage, https://github.com/PlasmaHua/PyMHD
|
|
6
|
+
Project-URL: Repository, https://github.com/PlasmaHua/PyMHD.git
|
|
7
|
+
Project-URL: Issues, https://github.com/PlasmaHua/PyMHD/issues
|
|
8
|
+
Author-email: "Yuyang Hua (华宇阳)" <yuyanghua@stu.pku.edu.cn>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: h5py>=3.10
|
|
15
|
+
Requires-Dist: jax>=0.4.26
|
|
16
|
+
Requires-Dist: kdepy>=1.1
|
|
17
|
+
Requires-Dist: matplotlib>=3.7
|
|
18
|
+
Requires-Dist: numpy>=1.26
|
|
19
|
+
Requires-Dist: yt>=4.2
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# PyMHD
|
|
23
|
+
|
|
24
|
+
[](https://doi.org/10.5281/zenodo.20749062)
|
|
25
|
+
[](https://github.com/PlasmaHua/PyMHD/blob/main/LICENSE)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
A Python package for post-processing magnetohydrodynamic (MHD) turbulence simulations.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- [x] High-fidelity ***a posteriori* estimation of numerical dissipation** in MHD turbulence simulations;
|
|
33
|
+
- [x] Computation and visualization of turbulent energy spectra;
|
|
34
|
+
- [x] Visualization of 2D slices of MHD variables;
|
|
35
|
+
- [x] Built-in support for simulations from the Athena family, including [Athena++](https://github.com/PrincetonUniversity/athena), [AthenaK](https://github.com/IAS-Astrophysics/athenak), and [AthenaPK](https://github.com/parthenon-hpc-lab/athenapk);
|
|
36
|
+
- [x] Support for **driven MHD turbulence** (e.g., Alfvénic turbulence and small-scale dynamos), driven hydrodynamic turbulence, and **MRI-driven turbulence** (from shearing-box simulations) with triply periodic boundary conditions;
|
|
37
|
+
- [ ] Support for adiabatic and isothermal equations of state (EoS); **TODO:** add support for incompressible EoS;
|
|
38
|
+
- [ ] **TODO:** Computation and visualization of correlation functions;
|
|
39
|
+
- [ ] **TODO:** Spectral energy transfer analysis following [Grete, Philipp, et al. Physics of Plasmas 24.9 (2017)](https://doi.org/10.1063/1.4990613).
|
|
40
|
+
- [ ] **TODO:** Support JAX acceleration on GPUs and multi-node CPUs (currently, certain algorithms support parallelism on single-node, multi-core CPUs).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
### Installation
|
|
46
|
+
|
|
47
|
+
Install **PyMHD** from [PyPI](https://pypi.org/) via:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install pymhd
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This will automatically install PyMHD and its required dependencies, including:
|
|
54
|
+
- [NumPy](https://github.com/numpy/numpy) for core computation;
|
|
55
|
+
- [JAX](https://github.com/jax-ml/jax) for parallel acceleration on single-node, multi-core CPUs; therefore, [the CPU version of JAX](https://docs.jax.dev/en/latest/installation.html#pip-installation-cpu) is required;
|
|
56
|
+
- [yt](https://github.com/yt-project/yt) and [h5py](https://github.com/h5py/h5py) for extracting data from HDF5 output files, specifically Athena++ `.athdf` files, AthenaK `.bin` files, and AthenaPK `.phdf` files;
|
|
57
|
+
- [Matplotlib](https://github.com/matplotlib/matplotlib) for plotting functionality in the `pymhd.plot` modules;
|
|
58
|
+
- [KDEpy](https://github.com/tommyod/KDEpy) for plotting smoothed histograms of numerical dissipation data in the `pymhd.plot.nd` module.
|
|
59
|
+
|
|
60
|
+
### Built-in Examples
|
|
61
|
+
|
|
62
|
+
For a quick start, clone the source repository, for example:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/PlasmaHua/PyMHD.git
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then navigate to the `./examples` subdirectory using `cd PyMHD/examples`, where two AthenaK simulation examples are provided.
|
|
69
|
+
|
|
70
|
+
Under construction.
|
|
71
|
+
|
|
72
|
+
### Analyze Your Own Athena Simulations
|
|
73
|
+
|
|
74
|
+
PyMHD natively supports simulations from Athena++, AthenaK, and AthenaPK. Use the `pymhd.output2turbulence` function to extract output data and input-file metadata, then construct a PyMHD `Turbulence` object for further analysis.
|
|
75
|
+
|
|
76
|
+
## API Documentation
|
|
77
|
+
|
|
78
|
+
Under construction.
|
|
79
|
+
|
|
80
|
+
## Citation
|
|
81
|
+
|
|
82
|
+
If PyMHD contributes to your work in any way, please consider citing the package via:
|
|
83
|
+
|
|
84
|
+
```bibtex
|
|
85
|
+
@misc{Hua2026,
|
|
86
|
+
doi = {10.5281/zenodo.20749062},
|
|
87
|
+
url = {https://zenodo.org/doi/10.5281/zenodo.20749062},
|
|
88
|
+
author = {Hua, Yuyang},
|
|
89
|
+
title = {PyMHD: Python package for post-processing MHD turbulence simulations},
|
|
90
|
+
publisher = {Zenodo},
|
|
91
|
+
year = {2026},
|
|
92
|
+
copyright = {MIT License}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
If you specifically use the framework for numerical dissipation estimation, please cite our method paper via:
|
|
97
|
+
|
|
98
|
+
```bibtex
|
|
99
|
+
|
|
100
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pymhd/__init__.py,sha256=OpJDchlMN8WR0qLv40h6UZ8tJbP8h6DwrSWsgHgC68E,817
|
|
2
|
+
pymhd/numdiss.py,sha256=6O2j_lb0V1bdClRNzaU_OGeMVX8PgexyoRGruBqIlaY,21197
|
|
3
|
+
pymhd/spectra.py,sha256=ZrrWMPsuKg1TiDRo4e_IpgZD1TQ-h-NABzklLvmP4Ts,12672
|
|
4
|
+
pymhd/turbulence.py,sha256=a1Ua1-JSw0YeZrWu3wNfvAPKK2hKpHFboSFZAXi2jS0,30684
|
|
5
|
+
pymhd/derivatives/TENO.py,sha256=vKu3ClHzfemVgojU2BGg429D09WmhsMVGEnDCTLtau0,9252
|
|
6
|
+
pymhd/derivatives/WENO.py,sha256=0Y76rfB4M5nNFZf82L88jcy41s6RvoTg7tooNIyF1DQ,11000
|
|
7
|
+
pymhd/derivatives/__init__.py,sha256=utUSSfp-P23mmOCgnf3j-qBhV-f-BbMwgXwbEMcpw5s,437
|
|
8
|
+
pymhd/derivatives/compact.py,sha256=13SuYceV-lJgXEJKve_-b6g1IUCknU8kpNqjzlqr6Yo,12310
|
|
9
|
+
pymhd/derivatives/derivative.py,sha256=F_u7D_LxPX8xphVRFdqFUk79rNp4D6AIfLlzz19MIzo,28060
|
|
10
|
+
pymhd/plot/__init__.py,sha256=h26dka3hy3A9a8hWvnlvCB1CjFKE5D0OEJNbzLTqMXo,1338
|
|
11
|
+
pymhd/plot/nd.py,sha256=nhP8pxNkLsS-h2lLgaeVj9KwA_cr_6p9lEZkjsXz2G8,59501
|
|
12
|
+
pymhd/plot/slc.py,sha256=1BBHvkpf40ffyYmbRn4rWJzKAEpbuNBcCwV4T3rF4q4,24761
|
|
13
|
+
pymhd/plot/spc.py,sha256=Ps-nE3GNdgXg1Mst5ATcqYZjABPZXe81no04xOGYuBs,9062
|
|
14
|
+
pymhd/preprocess/Athena.py,sha256=LFYGTwmRW1VOMvJQKz8wW7h1DB-RYHnUu27jp4RwYDY,30864
|
|
15
|
+
pymhd/preprocess/__init__.py,sha256=NpCBvvA64KI5xz4eDNf4-qnlHPEPLRzeJyZab3bmYsM,2435
|
|
16
|
+
pymhd/preprocess/helper/NOTICE,sha256=tE7vFqwS-DSvKTjT_ALrGvuBRyI3-r8B0yJTzlP29eE,1953
|
|
17
|
+
pymhd/preprocess/helper/bin_convert.py,sha256=DIQi28uyYbbbZcyzMMkBwyMIrXY1lfPWYHbyIiCzEzA,71336
|
|
18
|
+
pymhd/preprocess/helper/make_athdf.py,sha256=m-lyU02UWfyEUXVZPFbrKmL9mbsvLNtmBPdxOwRk_do,1430
|
|
19
|
+
pymhd-0.1.0.dist-info/METADATA,sha256=qMe9NXH1t-AXg62Xs2oau4nwRQLiHZjpODMmyX4Usq8,4371
|
|
20
|
+
pymhd-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
21
|
+
pymhd-0.1.0.dist-info/licenses/LICENSE,sha256=s5k1ebx6U1pb4SHgd9TDmBrFbOYncQG6veiwJzP7Ksg,1067
|
|
22
|
+
pymhd-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuyang HUA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|