0012 — One implementation per concept¶
Status: proposed 2026-11-12, revised 2026-11-13. It applies ADR 0010 DH15, adds the
consolidation steps HC1–HC6 to plan.md Program H, and amends:
ADR 0009 D36: resolved walls keep one discretization, the extended grid; the per-axis wall nodes of the thin-wall factorization retire at a gate (DC4);
ADR 0008 D34 and ADR 0009 D38: their module, test and example counts are read as the values of
scripts/audit_architecture.pyunder DH15’s loan rule (DC6);plan.mdH.10.8: the removal table and the loan ledger (DC6); step H7.2’s remainder moves before the wall-stack steps (DC5).
Basis:
mainatc1a9e9b(2026-11-13): a read of all twenty-one modules ofsrc/lmhdx(15,891 lines), of the tests’ pins, and of the callers invalidation/,examples/,scripts/anddocs/.The audit of that commit, in which every line budget equals its target.
The H3 decision of 2026-10-26 (#302): the march and Newton are both kept, chosen by
Solver(method="auto").
ADR 0011 builds on the result.
DC1. The concept register. plan.md Section 5 holds one table: each
concept, the one place it is implemented, and any second implementation still
present with the step that removes it. A PR that adds a second implementation
of a listed concept adds its removal step to that table and to H.10.8 in the
same PR. The register at c1a9e9b:
Concept |
The one place |
Still duplicated in |
Removed by |
|---|---|---|---|
Problem and setup |
|
the case objects, schema 1 and 2 loaders and the argparse commands of |
H4.7 |
Wall type |
|
|
HC5 |
Resolved-wall discretization |
the extended grid ( |
the per-axis wall nodes ( |
HC6, at its gate (DC4) |
Thin wall (a different model) |
|
the oracle |
HC2 |
Variable-coefficient operator |
|
|
H7.2r, before H7.8 (DC5) |
Separable eigen solver, compile cache, constrained CG |
SOLVAX |
|
H4.6 |
Joule dissipation density |
|
|
HC4 |
Open pipe (evidence for validation row 6) |
|
|
HC3 |
Time loop |
|
|
H7.4 |
DC2. Evidence code lives outside the package. H.10.8 keeps per-benchmark
solver branches out of src/lmhdx. Two blocks are of that kind and move:
The open pipe solver:
axial.pyfrom its open-pipe section to the end, about 509 lines. It has its own polar discretization and eigen preconditioner, is called bytests/test_pipe.pyalone and is not exported. It goes tovalidation/open_pipe.pywithpipe.wall_pressure_gradient.The thin-wall flux oracle: 51 lines of
ops.pywith no caller in the package. It goes to the tests that use it.
The developed pipe of pipe.py and the pipe preset stay.
Reason: together with the hygiene step these remove about 600 lines without changing a number, which repays the oldest open loans of H.10.8.
DC3. One Joule density. core3d.joule_density is the cell density
sum over axes of the half-face average of J² / sigma, with sigma a number
or a cell array. The thermal step calls it. energy_budget takes its integral
from it at the next change of its numerics, since the summation order moves
its last digits. The solid-wall route forms its currents from the same
ops.face_current at its next change, for the same reason. A contact
resistance’s dissipation is added to the density of the face’s two cells by
the step that adds contact resistances (ADR 0011 DB5).
DC4. One wall type, one resolved-wall discretization. WallLayer gains
the fields of SolidWall, which is deleted (D36 foresaw this). The Wall
pytree carries every field of a layer: the numbers that are leaves as
children, the rest as structure.
The thin wall of Walker stays: it is a different model, and its direct solve and its derivative without iteration are worth keeping.
A wall resolved in cells has one discretization, the extended grid. It alone
carries heat, a third dimension and the wall stacks of ADR 0011. The per-axis
wall nodes also resolve corners (_corner_fix), and the two routes already
agree on currents and powers to 1e-9 with walls on both axes
(tests/test_core3d.py). The per-axis wall nodes retire (HC6) when three
gates hold:
Every test that pins the per-axis nodes passes on the extended grid at its present tolerance,
validation/mistrangelo.pyandvalidation/mistrangelo_duct.pyincluded.A wall layer’s conductivity and thickness stay leaves of
Problem, differentiated byjax.gradthroughlmhdx.solveon the extended grid. They must meet the tolerances of the tests that pin them on the per-axis nodes today. Thickness changes the extended grid, so this needs a derivative rule for that leaf, for example a custom JVP built on ADR 0011 DB3’s linearised solve. The public call must not change.A warm solve of a named walled case is at most three times slower, with the iteration counts recorded. HC6’s PR names the case, the timing protocol (median of N calls after the first) and the hardware.
Until then both exist, as D36 left them.
DC5. The variable-coefficient operator is SOLVAX’s; the interface physics is
LMhdX’s. poisson.VariableHelmholtz duplicates
solvax.separable.flux_form_operator and is removed by H7.2’s remainder
(H7.2r).
What stays in LMhdX.
_face_conductancesforms each face’s series resistance from the materials, the contact resistances and the film coefficients.What SOLVAX has. SOLVAX 0.36.2 has the mixed ends of an axis (uwplasma/SOLVAX#200) and the singular rule (no shift and no Dirichlet end).
What SOLVAX lacks. Its operator forms the face conductances from cell conductivities alone.
The order. A SOLVAX release adds an optional per-axis face resistance, added in the series sum
d_P/k_P + r_f + d_N/k_N. H7.2r then ports the thermal and charge solves to SOLVAX’s operator and unifies the lift and flux code of the two conduction paths. This comes before H7.8, H7.7a and H8.6a, so contact resistances, films and the definite steady solve are built once, on SOLVAX’s operator, rather than added to the class that H7.2r deletes.What else stays. The direct fast-diagonal solve stays as the exact case of the operator for one material.
DC6. Loans. The ledger of H.10.8 is restated with every open loan, its size and its repayment, as the log rows that drew them give them:
Loan |
Size |
Repayment |
|---|---|---|
H4.1 |
+1,065 |
H4.7 |
H2.2 and H3 |
169 outstanding at #302 |
the mirror-duct bridge went with SOLVAX 0.36.2 (#312); H4.6 repays the rest. Newton’s 64 lines stay by the owner’s decision |
H4.2 |
+290 |
H4.6, H4.7 |
H4.3 |
+462 |
H4.7 |
H4.4 |
+125 at #303 |
H4.7 |
HC1–HC3 (−605 lines) repay open loans oldest first. Each PR sets the audit targets it moves to the measured values; a fall is a repayment and a rise is a loan with its step. The module, test, example and validation counts quoted in D34 and D38 are the audit’s values of their day, not separate caps. H3.5 is done (#302): the Newton stack became a branch of the march’s function, and Newton stays (DC7).
DC7. Not consolidated, by decision.
The thin wall and the solid wall (DC4).
The Newton route of the steady open duct, kept beside the march by the owner (2026-10-26) and chosen by
axial.method_for.The inertialess core-flow model, a reduced model with its own unknowns.
The developed polar pipe, the only developed solver on a polar grid.
The limited face values of the scalar and of the momentum. They share the van Leer mean but differ in lever arm, clipping and boundary stencil, so merging them changes numbers. They are merged when transport is next changed, with its evidence.
The mean-removal sites and the polar factorization’s own helpers, for the same reason.
DC8. House style for new code.
A result is a
NamedTuple. A class that carries differentiable leaves is a dataclass registered withfields.pytree.ValueErrorfor an input that is wrong;NotImplementedErrornaming the plan step for behaviour that is planned;NumericalFailure(aRuntimeError) for a solve that did not converge.NumericalFailurelives incases.pytoday; H4.7 moves it tosolver.py, which raises it, before deletingcases.py. Messages are lowercase clauses without a final period.Concrete inputs are validated where a kernel problem is built, never in a class that is rebuilt from tracers.
A number that a step makes a leaf is not converted on the host.
A new field of a problem or a solver changes the restart identity (
output.digesthashes every field). A field whose default reproduces today’s run is left out of the digest at its default, so records written before it still load.Docstrings give the equation or quantity, units, assumptions, the differentiable arguments and the failure behaviour, in prose with roles. Comments give a numerical reason, not the history of a change.
Defects found by the read. Each is fixed in the step that next touches its
code and listed in plan.md Section 2:
SteadySolution.stepsalways holdsmax_steps;duct_problemraises for a Hartmann number between 0 and 1;the
griddocstring calls Neumann data the outward-normal derivative, wherepadtakes the derivative along the axis;face_currentsignores itsfactorizationargument on three of its five routes;a schema 3 run exits with status 0 when its solve did not converge;
upgradewritesmethod = "implicit"for a transient schema 2 file, whichsolverefuses.
Consequences:
The package falls from 15,891 to about 15,300 lines with HC1–HC4, and to about 15,150 with H7.2r.
It rises to about 16,200 with ADR 0011’s steps, and falls to about 12,000 once H4.6 and H4.7 are done.
HC6 is not counted until its gate holds.
validation/gains a tenth file.No number computed by the package changes before HC6.