Skip to content

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

Closed
krystophny wants to merge 5 commits intofeature/boozer-chartmap-corefrom
feature/boozer-chartmap-qa
Closed

test: validate SIMPLE Boozer chartmap roundtrip and VMEC benchmarks#330
krystophny wants to merge 5 commits intofeature/boozer-chartmap-corefrom
feature/boozer-chartmap-qa

Conversation

@krystophny
Copy link
Copy Markdown
Member

@krystophny krystophny commented Mar 28, 2026

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

Stack

  • base: feature/boozer-chartmap-core
  • head: feature/boozer-chartmap-qa

Review

Primary SIMPLE-maintainer review: @krystophny

@krystophny
Copy link
Copy Markdown
Member Author

Routing this one to @krystophny for SIMPLE validation review. This layer is still VMEC-only and keeps the GVEC-specific work out of the way.

@krystophny krystophny force-pushed the feature/boozer-chartmap-qa branch from 3796c9d to 22f7dcb Compare March 28, 2026 11:22
@krystophny krystophny force-pushed the feature/boozer-chartmap-core branch from 319f478 to bd69ace Compare March 28, 2026 11:22
@krystophny krystophny force-pushed the feature/boozer-chartmap-qa branch from 22f7dcb to 6ab1d6b Compare March 28, 2026 13:13
@krystophny krystophny marked this pull request as ready for review March 28, 2026 13:17
@krystophny krystophny force-pushed the feature/boozer-chartmap-qa branch from 6ab1d6b to 47b52cc Compare March 28, 2026 13:22
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 force-pushed the feature/boozer-chartmap-qa branch from 47b52cc to 081965f Compare March 28, 2026 13:34
@krystophny krystophny deleted the branch feature/boozer-chartmap-core March 28, 2026 15:04
@krystophny krystophny closed this Mar 28, 2026
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