Skip to content

test: validate SIMPLE Boozer chartmap roundtrip and VMEC benchmarks#332

Merged
krystophny merged 5 commits intomainfrom
feature/boozer-chartmap-qa
Mar 28, 2026
Merged

test: validate SIMPLE Boozer chartmap roundtrip and VMEC benchmarks#332
krystophny merged 5 commits intomainfrom
feature/boozer-chartmap-qa

Conversation

@krystophny
Copy link
Copy Markdown
Member

Summary

Add strict VMEC-origin validation for the SIMPLE Boozer chartmap path.

This PR is intentionally limited to VMEC-side export/import and SIMPLE runtime checks. It does not introduce the GVEC converter or figure-8 workflow; that now lives entirely in PR 331.

This layer adds:

  • roundtrip field/orbit validation for direct VMEC Boozer vs file-backed Boozer chartmap
  • export tool coverage for deterministic start files
  • end-to-end confined/lost-fraction comparisons on the VMEC common cases

Review

Primary SIMPLE-maintainer review: @krystophny

Add export_boozer_chartmap() that writes computed Boozer data (Bmod,
B_theta, B_phi, A_phi, torflux, X/Y/Z geometry) to an extended
chartmap NetCDF file after get_boozer_coordinates().

Add roundtrip test that validates the full pipeline:
  VMEC -> Boozer -> export chartmap -> reimport -> compare
Field roundtrip error: ~8e-5 (re-splining)
Orbit roundtrip error: ~2e-9 (machine precision)

Includes Python plotting script for visual evidence artifacts
saved to /tmp/ (gitignored).
Bmod: 1e-3 -> 1e-4 (actual: ~8e-5)
Orbit: 1e-3 -> 1e-6 (actual: ~2e-9)
Two fully isolated simple.x runs with identical particles:
1. VMEC-Boozer: standard path reading wout.nc
2. Chartmap-only: reads boozer_chartmap.nc, no VMEC at all

Test pipeline:
- Run simple.x with VMEC+Boozer (generates start.dat in VMEC coords)
- Export Boozer chartmap and convert start.dat to Boozer coords
- Run simple.x with chartmap only (startmode=2, loads converted start.dat)
- Compare confined_fraction.dat

Changes:
- export_boozer_chartmap: endpoint-excluded grids, pseudo-Cartesian
  geometry with atan2(y,x)=phi_B for chartmap validator compatibility
- simple_main: skip VMEC magfie init in chartmap mode, require startmode=2
- New export_boozer_chartmap_tool.x for coordinate conversion
- Python test orchestrator with comparison plots
The Boozer field data (Bmod) now uses separate endpoint-included
dimensions (theta_field, zeta_field) matching the original VMEC Boozer
grid exactly. The chartmap geometry (x, y, z) keeps endpoint-excluded
grids for libneo validator compatibility.

This gives exact spline reproduction: Bmod roundtrip error ~8e-5,
orbit error ~1e-9. E2E test at 100ms passes for both QA and NCSX
equilibria with at most 1 particle difference out of 32.
Both equilibria show exact match (zero difference) in total,
passing, and trapped confined fractions at 10ms.
NCSX has significant losses (~55% confined) providing a
stringent validation.
@krystophny krystophny enabled auto-merge (squash) March 28, 2026 15:09
@krystophny krystophny merged commit 81c4d5c into main Mar 28, 2026
7 checks passed
@krystophny krystophny deleted the feature/boozer-chartmap-qa branch March 28, 2026 16:03
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