HARTMAX
Differentiable liquid-metal MHD in JAX, for the ducts of fusion blankets.
HARTMAX solves liquid metal flowing through strong magnetic fields. It handles ducts and pipes with insulating or conducting walls, three-dimensional ducts leaving a magnet, heat transfer through steel walls, and quasi-two-dimensional vortex dynamics. Every result is differentiable end to end, so a design study can take gradients through the solve. It runs on a CPU or a GPU, and SOLVAX supplies the solvers and implicit derivatives.
Install and run
HARTMAX needs Python 3.11, 3.12 or 3.13. It was called LMhdX until 2.0: pip install hartmax replaces
pip install lmhdx, and the migration guide
lists what changed. The 1.x releases stay on PyPI as lmhdx.
pip install hartmax # JAX runs on the CPU; for a GPU follow the JAX installation guide
hartmax examples/hartmann_case.toml
The same case from Python:
import hartmax
solution = hartmax.solve(hartmax.duct(100.0, 48, wall_conductance=0.027))
print(float(solution.velocity[0].data.max()))
solve takes a Problem and a Solver, and a TOML file builds the same objects. The
first run walks through it and checks the
answer against the exact profile.
What it does
- Fully developed ducts and pipes, with thin or resolved conducting walls and wall stacks, and meshes chosen from
the layer thicknesses
a/Haanda/√Harather than from a cell count. - Steady states as roots. The steady solve is a differentiable root found by conjugate gradients or Newton-Krylov, not a march in time.
- Three-dimensional and open ducts, with an inlet and an outlet through a field that varies along them, with or
without inertia (
method="auto"picks Newton or marching the Runge-Kutta step). - Runs in time, by
Solver(method="euler" | "rk3", dt=, steps=). AnOutputwrites records, ParaView files and a summary, and a later run restarts from them bit for bit. - Heat transfer, with conduction through solid walls, Joule heat and Boussinesq buoyancy.
- Quasi-two-dimensional flow with Hartmann-layer friction, by a spectral time step.
Validation
HARTMAX is checked against exact solutions, independent spectral references, experiments and other codes, and its adjoints against finite differences. The validation record gives every result with its gate, what is still at the research stage, and the measured speed on a CPU and a GPU.
Examples
| Command | Physics |
|---|---|
hartmax examples/hartmann_case.toml |
Hartmann duct from a TOML file |
hartmax examples/heated_duct.toml |
heated duct with buoyancy |
python examples/hunt_example.py |
conducting walls, side-layer jets |
python examples/fringe_duct_example.py |
duct leaving a magnet, its drop and the drop's field derivative |
python examples/open_duct_inertia_example.py |
inertial share of the fringe drop |
python examples/q2d_turbulence_demo.py |
Q2D vorticity evolution and energy decay |
examples/catalog.toml lists each example's parameters and evidence status, and
python scripts/make_showcase_figures.py regenerates the figures.
Documentation
The documentation has getting started guides, step-by-step tutorials, the equations and numerical methods, the validation record and the API reference.
Citing
If you use HARTMAX in published work, cite the release you used and the benchmark sources your case relies on. CITATION.cff holds the details, GitHub's "Cite this repository" button exports them, and the references page has a BibTeX entry.
Contributing
Install for development with pip install -e ".[dev,docs]", then run the tests for your changes with
python scripts/run_full_test_suite.py --changed-from HEAD. CONTRIBUTING.md describes the
workflow, and the plan shows what is in progress. Questions and bug reports go to the
issue tracker. The code was LMX before 1.5 and LMhdX from 1.5
to 1.12; import lmhdx and import lmx are now import hartmax.
Metadata
Release files for hartmax 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hartmax-2.0.1.tar.gz | 244.9 kB | With provenance | Details for hartmax-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hartmax-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for hartmax-2.0.1-py3-none-any.whl |
Total release size: 503.6 kB
Release files / hartmax-2.0.1.tar.gz
| Download URL | hartmax-2.0.1.tar.gz |
|---|---|
| Size | 244.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b3d95f9ddf327952a97dc40379c4e42bf2228bad7cbab5b2350006a3bf776fa
|
|
BLAKE2b-256 checksum How to use checksums |
f5bec33de4e41826974d671f93302d283fe68a737935f7dabdea8b6a906956fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / hartmax-2.0.1-py3-none-any.whl
| Download URL | hartmax-2.0.1-py3-none-any.whl |
|---|---|
| Size | 258.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4019ff1f8a8ded34f4ecf88db2108f325c7c6c0ec4122456116665ad97a1b42b
|
|
BLAKE2b-256 checksum How to use checksums |
27d0478c66104e388f7cfd45942bf74f8ea5d0931e4702278671ecfbdb7621b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for hartmax 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for hartmax-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.