test: validate SIMPLE Boozer chartmap roundtrip and VMEC benchmarks#332
Merged
krystophny merged 5 commits intomainfrom Mar 28, 2026
Merged
test: validate SIMPLE Boozer chartmap roundtrip and VMEC benchmarks#332krystophny merged 5 commits intomainfrom
krystophny merged 5 commits intomainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Review
Primary SIMPLE-maintainer review: @krystophny