# Oracle notes — verified facts about the shipped na_grid2d.wasm

These are measured from the shipped binary + its fixtures. The recovered zig MUST honor them.

## Grid + cell ordering (CRITICAL)
- `nr() = 44` (radial), `nz() = 60` (axial). Grid = 2640 cells.
- **Field cell ordering is R-MAJOR: flat index `i = r*nz + z` = `r*60 + z`.**
  Verified: T varies smoothly along z within a fixed r row (mean |ΔT|≈53.7 r-major vs 472 z-major).
  The HTML render also reads `T[i*NZ + j]` (i=r row, j=z col). Use `r*60 + z` indexing or the diff fails.

## Exports / memory
- `Tptr() = 1048704`, `scPtr() = 1048592` (16-byte gap holds two f64 consts 0.5, -0.5 at data base 1048576).
- Two output fields, each 2640 × f64: T (temperature, K) at Tptr, "sc" (source/intensity, range [0, ~1e5]) at scPtr.
- Internal consistency is what matters: the verify harness reads whatever `Tptr()/scPtr()` return.

## solve2d arg contract (from na-converter-2d.html)
`solve2d(Pf, 1000, Ps, R1, R2, Lz, Tsi, eps, kscale)`
- Pf = fuel pressure (Pa, = 10^slider), the `1000` = fixed literal (a base/ref value — identify from WAT),
  Ps = secondary pressure (Pa), R1 = 5e-3 m (inner), R2 = outer radius (m), Lz = axial length (m),
  Tsi = 400 K (silicon sink temp), eps = envelope emissivity, kscale = conduction scale (= 10^slider).

## Behavioral oracle
`na_grid2d_fixtures.json` has 4 cases (default/hi-eps/lo-sec/hi-fuel) with full T + sc fields.
Expected T field stats (default case): Tmin≈1846, Tmax≈8539, Tmean≈5618, T[0]≈6121.7, T[last]≈1845.9.
Physical sanity that must survive: higher eps → cooler (more radiative loss); lower secondary P → hotter;
higher fuel → hotter; T falls along the tube exit.

## Verification bar
Recompiled wasm, same solve2d args → T field matches oracle to < 1e-4 relative. Ship only on match.
