Skip to content

0.19 activation-to-transport handoff - #4

Merged
ahnaf-tahmid-chowdhury merged 7 commits into
mainfrom
feat/0.19-activation-transport
Nov 16, 2026
Merged

ahnaf-tahmid-chowdhury merged 7 commits into
mainfrom
feat/0.19-activation-transport

Conversation

@ahnaf-tahmid-chowdhury

@ahnaf-tahmid-chowdhury ahnaf-tahmid-chowdhury commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements the 0.19 activation-to-transport handoff on feat/0.19-activation-transport:

  • W1 physical flux normalization — shared Rust kernel + PyO3 facade + nucleide.openmc.normalize_flux. Distinguishes volume-integrated/averaged from per-source-particle/source-rate-scaled OpenMC tallies, rejects double scaling, preserves relative errors, and records units/source-rate/input state. CSV interchange moves to v2 with v1 backward reads as unknown.
  • W2 photon-source contract — crates/r2s/src/source.rs regular-mesh source with ascending eV edges, C-order voxels, integrated photons/s, density conversion once, joint voxel/group probabilities, per-voxel spectra, sparse-grid restoration, exact cooling selection, checked totals, and a bounded stable-code validation report.
  • W3 OpenMC adapter — nucleide.openmc.mesh_source with explicit C-order → Fortran-order mapping, per-element differential histogram densities, absolute photons/s strengths, zero-voxel handling, and self-contained settings.xml export.
  • W4/W5 reports, manifests, batches — offline-verifiable reproducibility manifests, exact cooling-time batch export, collision-free names, atomic writes, skip-zero policy, partial-failure reporting, and complete batch manifests.
  • W6 teaching/browser/performance — executable activation-to-transport tutorial, interactive transport-source WASM demo, desktop/narrow-layout/error Playwright coverage, and a 1k/10k/100k × 24-group criterion benchmark.
  • W7 secondary tritium validation — F6 trapped-plus-recombination FESTIM leg, skip-safe and implemented. An exploratory single-level FESTIM 2.1 run agreed closely, but the canonical five-level matrix was not run in the digest-pinned image. No F6 pass is claimed.

W0 portable wheels were already fixed on main in 0.18.1; no duplicate packaging work here.

Real vs. synthetic data

  • Unit fixtures and tutorial values are intentionally synthetic hand calculations (e.g. [4, 9] × 10 / 2 = [20, 45], [[100, 0], [0, 300]] joint probabilities).
  • The pinned OpenMC 0.16.0 probe runs real installed OpenMC in the validation container: source inspection, seeded source sampling (200k samples), a 2×3×2 ordering mesh, XML roundtrip, and a real vacuum fixed-source track-length tally at strengths 1 and 10 (means 10 and 100). It is not a transport/dose validation and uses no evaluated data.
  • openmc_transport_probe.py was run with a caller-mounted NNDC HDF5 library, including both photon (photon/H,O,Fe) and neutron (H1,O16,Fe56) data. OpenMC 0.16 transport in 10 cm water/iron spheres, 20k particles × 5 batches, source strengths 1 and 10. Photon tally ratio 9.999999999999988, per-source/rate-scaled relative difference 1.26e-15; neutron ratio 10.000000000000014, relative difference 1.33e-15; iron and water fluxes differed for both, proving the real cross sections were loaded. This is a normalization/data-loading check, not a dose or transport validation.
  • The F6 FESTIM 2.1 run used a probe-image derivative at 200 cells / 0.25 s; the canonical five-level matrix is still required before quoting F6 results. Generated validation results were left untouched.
  • No evaluated nuclear data are downloaded, vendored, or fabricated.

Validation

  • cargo fmt --check — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo test --workspace — passing
  • pytest tests/ — 746 passed, 3 skipped, 98% coverage
  • ruff format --check / ruff check — clean
  • mypy — clean
  • python3 scripts/gen-reference.py --check — fresh
  • Markdownlint on touched docs — clean
  • Website format:check / check / build / full Chromium E2E — 27 passed
  • validation/openmc_handoff_probe.py — 25/25 checks pass in the pinned OpenMC image
  • validation/openmc_transport_probe.py — PASS with caller-mounted NNDC HDF5 photon and neutron data (real OpenMC transport + package normalize_flux)
  • Default OpenMC cooling-batch export/readback verified in the validation container

Performance

Criterion baseline on the development host (i5-8400, 24 groups, 2.4M values at 100k voxels):

  • construct: ~42.9 ms
  • structured report: ~18–39 ms
  • density: ~29.2 ms
  • joint probabilities: ~24.7 ms

Work is linear in represented voxel/group entries. The contract and adapter are not zero-copy: source construction clones caller arrays and the OpenMC adapter creates one source object per voxel. OpenMC object/XML costs are tracked separately and no regression threshold is claimed yet.

Review notes / limitations

  • The OpenMC adapter requires regular-mesh cell volumes to match caller volumes; non-regular geometry is a clear error rather than a bounding-box approximation.
  • normalize_flux deliberately refuses to infer normalization; a caller must declare the state, and physical input is rejected to prevent double scaling.
  • F6 is not yet a published pass; the probe leaves committed results untouched when FESTIM is absent.
  • No release, tag, or merge is included.

@ahnaf-tahmid-chowdhury

Copy link
Copy Markdown
Contributor Author

Added a real-data validation path in validation/openmc_real_data_probe.py (commit 45779e4), plus a larger browser demo.

Real-data check — OpenMC 0.16.0 + caller-mounted NNDC HDF5 (H1, O16, Fe56), 10 cm water/iron spheres, centered 14 MeV point source, 20,000 particles × 5 batches, fixed seed:

  • source strengths 1 → 10 scale the tally by 10.000000000000021;
  • per-source raw × rate / volume = 0.03123484610103211 and rate-scaled raw / volume = 0.03123484610103218 (relative difference 2.2e-15);
  • iron sphere flux 0.04169079040544757 vs water 0.03123484610103218, confirming the real cross sections were loaded;
  • nucleide.openmc.normalize_flux agrees and returns 1/(cm2 s).

This is a normalization/data-loading check with real data, not a dose or transport benchmark. The probe never vendors or downloads the caller's data.

Demo — the interactive page now uses a 2×2×1 mesh with four 1 cm³ voxels and four photon groups (0–0.1, 0.1–0.5, 0.5–2, 2–10 MeV), shows per-voxel totals as bars, and fits the narrow docs column without clipping. Local full Chromium E2E: 27/27 pass.

@ahnaf-tahmid-chowdhury

Copy link
Copy Markdown
Contributor Author

Real-data validation extended to photon transport using the same NNDC library (photon/H,O,Fe): OpenMC 0.16, 2 MeV centered source in 10 cm water/iron spheres, 20k × 5 histories. Photon tally ratio 9.999999999999988; per-source vs rate-scaled flux relative difference 1.26e-15; water 0.02761116 vs iron 0.01991971 1/(cm²·s). Neutron leg: ratio 10.000000000000014, relative difference 1.33e-15. The package normalize_flux check passes with units 1/(cm2 s). This is normalization/data-loading evidence, not dose validation.

@ahnaf-tahmid-chowdhury

ahnaf-tahmid-chowdhury commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Renamed openmc_real_data_probe.py → openmc_transport_probe.py (fd37883). “Real” was redundant — all probes use the real installed tools; the distinguishing fact is that this one runs transport with caller-supplied data. Also removed the hardcoded user-specific default from validation/run_all.sh (now PYTHON env or python3), and the probe JSON now records data_dir: "<caller-supplied>" plus relative filenames and hashes instead of host absolute paths.

@ahnaf-tahmid-chowdhury
ahnaf-tahmid-chowdhury merged commit 42ce040 into main Nov 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant