FreeMHD comparison¶
This page explains how HARTMAX runs beside FreeMHD, an independent liquid-metal MHD code built on OpenFOAM, on the ALEX B2 square duct in a fringing field. Each code passes or fails on its own checks. Their pressure difference is reported, not gated, because the two runs do not compute the same state.
To write and hash the inputs without Docker:
python -m validation.freemhd --preflight --output artifacts/freemhd-b2
FreeMHD is an external validator, not an HARTMAX runtime dependency. One module,
validation/freemhd.py, holds the whole comparison:
it writes the FreeMHD B2 input: the block mesh, the foam dictionaries, the field
B_y(x)/B0interpolated linearly between the anchors ofalex-b2-square.csv, and the pressure taps and boundary-flux probes;it checks the FreeMHD source snapshot against the commit and SHA-256 pins in
[free_mhd_discretization_reference]ofalex-b2-square.toml;it runs FreeMHD in Docker and reads the native log and probe tables;
it solves the same duct with the core-flow model,
validation.coreflow.CoreFlow, at aspect 1 with thin wallsc_t = c_s = 0.07and unit mean velocity;it writes
record.jsonwith both observables and the SHA-256 of every input and output.
What is compared¶
FreeMHD runs the frozen two-update transient smoke test from a uniform plug on
a 5 x 5 grid, and HARTMAX gives the steady inertialess core flow. So the
cross-code pressure difference is reported, not gated, and so is HARTMAX against
the ALEX pressure_observable column. Each code passes or fails on its own
gates:
FreeMHD must meet the
[harness_smoke_execution]limits on step count, time step, Courant number, mass, current and interface-current balance, and interface current activity, and its log must have no fatal markers;HARTMAX must give a finite solution, floor
beta = 1/Bonly where the tabulated field is below1/beta_max, and keep the axial flux constant along the duct to a relative spread of1e-4. The CSV field is zero forx/L >= 7.5.
The observable is the side-wall tap (y = 0, |z| = 1) minus the top tap
(y = a, z = 0), in units sigma U B0^2 L, minus its mean over the plateau
x/L <= -7.5 or x/L >= 5. The core pressure is constant along field lines,
so HARTMAX takes the side tap at the first z cell centre and the top tap at the
last one.
Running it¶
The reproducible build uses
freemhd_install commit
36f409d294ba3170d64d4073378d5ef68401072f, FreeMHD commit
14b54a3e8e1a05b6ee4c98331995abaaae96e7a5, and OpenFOAM v2206. The weekly
external-validation workflow rebuilds that image, runs the module and uploads
the evidence directory. Pull requests that touch the module, the core-flow
model or the B2 data run the same workflow.
python -m validation.freemhd \
--freemhd-image freemhd-install:latest \
--freemhd-install-dir freemhd_install \
--freemhd-source-repo FreeMHD \
--output artifacts/freemhd-b2
The exit code is 0 when both codes pass their own gates. Record the image ID next to the evidence:
docker image inspect freemhd-install:latest --format '{{.Id}}'
The gated comparison with the ALEX experiment belongs to the steady 3-D solver, not to this module.