differentiable (magneto)hydrodynamics for astrophysics in JAX
Project description
jf1uids - differentiable (magneto)hydrodynamics for astrophysics in JAX
[!WARNING]
This project is still an alpha version (but generally functional), updates might break examples. We are aiming for the first stable release in mid-december 2025. The documentation might not reflect the current state of the code.
[!WARNING]
Version 0.4.0 removed the helper_data argument from the time_integration function. This breaks existing code, just remove the argument to fix it.
Features
- 1D, 2D and 3D hydrodynamics and magnetohydrodynamics simulations
- a high-order finite difference constrained transport WENO MHD scheme following HOW-MHD by Seo & Ryu 2023 as well as the provably divergence free and provably positivity preserving finite volume approach of Pang and Wu (2024)
- for finite volume simulations the basic Lax-Friedrichs, HLL and HLLC Riemann solvers as well as the HLLC-LM (Fleischmann et al., 2020) and HYBRID-HLLC & AM-HLLC (Hu et al., 2025) (sequels to HLLC-LM) variants
- novel (possibly) conservative self gravity scheme, with improved stability at strong discontinuities (currently only available for the finite volume solver)
- spherically symmetric simulations such that mass and energy are conserved based on the scheme of Crittenden and Balachandar (2018)
- backwards and forwards differentiable with adaptive timestepping
- turbulent driving, simple stellar wind, simple radiative cooling modules
- easily extensible, all code is open source
Installation
jf1uids can be installed via pip
pip install jf1uids
Note that if JAX is not yet installed, only the CPU version of JAX will be installed
as a dependency. For a GPU-compatible installation of JAX, please refer to the
JAX installation guide.
Notebooks for Getting Started
- hydrodynamics
- magnetohydrodynamics
- self-gravity
- stellar wind
Showcase
| Magnetohydrodynamics simulation with driven turbulence at a resolution of 512³ cells in a fifth order CT MHD scheme run on 4 H200 GPUs. |
| Magnetohydrodynamics simulation with driven turbulence and stellar wind at a resolution of 512³ cells in a fifth order CT MHD scheme run on 4 H200 GPUs. |
| Orszag-Tang Vortex | 3D Collapse |
| Gradients Through Stellar Wind |
| Novel (Possibly) Conservative Self Gravity Scheme, Stable at Strong Discontinuities |
| Wind Parameter Optimization |
Citable References
We have currently only published on the previous 1d-only version of this code.
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 jf1uids-0.4.0.tar.gz.
File metadata
- Download URL: jf1uids-0.4.0.tar.gz
- Upload date:
- Size: 80.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.8.0-60-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79bccf15bbad216ad3c98eccf81b7f1b9ced099b68194bc28cf4dcaf8650aac6
|
|
| MD5 |
82faee5f7e2315c408accb569f934e69
|
|
| BLAKE2b-256 |
319eb9b57db61cac0f3743cea8dea4c4924cb3c2731a94172850903e08e5fb4a
|
File details
Details for the file jf1uids-0.4.0-py3-none-any.whl.
File metadata
- Download URL: jf1uids-0.4.0-py3-none-any.whl
- Upload date:
- Size: 113.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.8.0-60-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90041929bf7b07e1b770a9d9c8990445f6776918e62bb6e7891e74ddc4a7d7cb
|
|
| MD5 |
fe6d0389319424d4b94b957b1f7aca96
|
|
| BLAKE2b-256 |
2582a1b533b4b9d83cec6960ffce9be03edea2b6ebc71b07a8e5a9d21359319e
|