Skip to main content

HARTMAX

PyPI version Python License CI Docs

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.

Hunt duct side-layer jets from Ha 20 to 1000

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/Ha and a/√Ha rather 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=). An Output writes 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

Hartmann layers, flow-rate error and mesh convergence

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
python examples/duct_design_law.py optimum aspect ratio of an insulated duct

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hartmax 2.0.0
File Size Uploaded Provenance Actions
hartmax-2.0.0.tar.gz 244.8 kB With provenance Details for hartmax-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hartmax 2.0.0
File Interpreter ABI Platform Actions
hartmax-2.0.0-py3-none-any.whl Python 3 none any Details for hartmax-2.0.0-py3-none-any.whl

Total release size: 503.4 kB

Release files / hartmax-2.0.0.tar.gz

Download URL hartmax-2.0.0.tar.gz
Size 244.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1c4e3d1ba8a95595f406e555051a60641d1190de9bf27a39e92d86c4559a00cc
BLAKE2b-256 checksum
How to use checksums
e4c553e010576d45854aac142faea7f76bb1f68b240c3b8e32862f04e32e9fe1
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 log

Release files / hartmax-2.0.0-py3-none-any.whl

Download URL hartmax-2.0.0-py3-none-any.whl
Size 258.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47b09ccb81251fd1070637601be9987573ed0095b530738c593a6b69ddee2907
BLAKE2b-256 checksum
How to use checksums
c6744d7636d6d3cfb5346e1d863e9e4c2714ad4ed5735001bc40afe5ab87c3b9
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 log

Security for hartmax 2.0.0

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.

Select from 2 files

Attestation for hartmax-2.0.0.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 log

A 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.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page