Architecture

HARTMAX is organized by physical ownership:

Problem + Solver ──> solve ──> the kernels below ──> Solution ──> Output (records, ParaView, summary, log)
ChannelProblem ──> staggered core (grid, ops, poisson) ──> steady / axial / core3d steps
PipeProblem ──> the developed pipe on its polar grid
Q2DProblem ──> vorticity dynamics ──> SOLVAX periodic Poisson
ThermalProblem ──> the core's stages + conduction ──> advance_thermal, developed_heat

hartmax.problem, hartmax.solver, hartmax.fields, hartmax.config and hartmax.output are the 2.0 interface (ADR 0010): Problem states the physics with its differentiable numbers as leaves, Solver the method, solve dispatches to a kernel, Output says where a run goes, and a TOML table is a constructor call. An unsteady run is a loop of compiled chunks; each accepted chunk writes a record of the state, exactly, with a digest of the problem and solver, and a ParaView file, and the summary and log are folded chunk by chunk, so a run in chunks or restarted from a record is the run in one, bit for bit. Imports are one-way: the kernels do not import the interface, and plotting dependencies load only when an output function requests them.

hartmax.grid, hartmax.ops and hartmax.poisson are the staggered grid, its operators and the direct and preconditioned solves. hartmax.core3d and hartmax.steady are the 3-D kernel, with the projection and RK3 steps; hartmax.axial adds an inlet and an outlet, with the steady root by the RK3 march or by Newton, hartmax.pipe the developed pipe. hartmax.q2d is the quasi-two-dimensional model. hartmax._programs compiles one program per problem shape. hartmax.units holds the material and wall-stack relations, and hartmax.cli the hartmax command. The inertialess core-flow model is evidence code in validation/coreflow.py.

hartmax.thermal (ADRs 0008, 0009 and 0011) composes two private stages of hartmax.core3d, one electric solve for the Lorentz force and the Joule heat, then the momentum stage with an optional buoyancy force, and adds conduction: the direct fast-diagonal inverse for one material, or with solid walls the preconditioned conjugate gradients of poisson.variable_helmholtz on the extended grid of core3d.conjugate_grid, which also carries the potential. hartmax.core3d does not import it.

Each concept has one implementation; plan.md Section 5 lists the concepts, their one place and the duplicates still present with the step that removes each (ADR 0012).

Package sources live under src/hartmax, so an editable installation and a wheel resolve the same module tree. The wheel includes hartmax/py.typed; every root API callable has an explicit signature, and distribution audits require the typing marker and reject files outside the package and metadata roots.

Reusable algebra belongs in SOLVAX when it is independent of HARTMAX geometry, units, boundaries, and terminology and has its own correctness, gradient, convergence, documentation, and performance tests. HARTMAX retains coefficient assembly, the interface physics of material faces, gauges that express physical constraints, coupling, and physical acceptance residuals.

FreeMHD execution and per-benchmark solvers are repository tooling under validation/ and are excluded from the runtime wheel. Only benchmark specifications and compact reference arrays ship as package data.

Structural budgets are enforced by scripts/audit_architecture.py: tracked size, source/module count, test/script/example count, root API size, import latency, and distribution contents. A budget rises only as a loan with a named repayment step (plan.md H.10.8).