Skip to content

feat: add SIMPLE Boozer chartmap core path#329

Merged
krystophny merged 9 commits intomainfrom
feature/boozer-chartmap-core
Mar 28, 2026
Merged

feat: add SIMPLE Boozer chartmap core path#329
krystophny merged 9 commits intomainfrom
feature/boozer-chartmap-core

Conversation

@krystophny
Copy link
Copy Markdown
Member

Summary

Add the core SIMPLE-side Boozer chartmap file path so simple.x can consume file-backed Boozer fields and coordinates without VMEC at runtime.

This stack layer covers the core abstractions only:

  • extended Boozer chartmap file detection and field loading
  • Boozer/chartmap coordinate convention fixes
  • proper rho <-> s handling on the Boozer chartmap path
  • chartmap-mode startup fixes needed for non-VMEC operation

Why this split

This is the lowest SIMPLE layer in the stack. It does not bring in GVEC-specific generation or the heavier end-to-end benchmarks yet.

Stack

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

Review

Primary SIMPLE-maintainer review: @krystophny

@krystophny
Copy link
Copy Markdown
Member Author

Routing this one to @krystophny for SIMPLE core/runtime review. This is the non-GVEC base layer of the stack.

…nput

Add boozer_chartmap_field_t that reads an extended chartmap NetCDF file
serving as both reference coordinates (geometry) and Boozer field input
for the symplectic integrator, with no VMEC or GVEC library dependencies.

The extended chartmap adds A_phi(rho), B_theta(rho), B_phi(rho),
Bmod(rho,theta,phi), and torflux to the standard chartmap format.
Detection is via a boozer_field=1 global attribute.

For the symplectic path, load_boozer_from_chartmap populates the existing
module-level batch splines in boozer_converter.F90 from file data,
so splint_boozer_coord and eval_field_booz work unchanged.

WIP: test still failing on libneo chartmap validation.
- evaluate() now takes x(1)=rho (matching chartmap coordinate system)
  instead of x(1)=s, with internal rho-to-s conversion for A_phi spline
- Add direct-evaluation fast path in field_splined.f90 for
  boozer_chartmap_field_t, avoiding unnecessary Cartesian roundtrip
- Store num_field_periods as a scalar NetCDF variable (not attribute)
  to match libneo chartmap validator expectations
- Fix test to use rho coordinates
The Boozer integrator uses s as the radial coordinate, but chartmap
reference coordinates use rho = sqrt(s). The identity transform was
wrong — particles at rho=0.55 (s=0.3) were being integrated at s=0.55,
causing spurious losses.

Add integ_to_ref_boozer_chartmap (s -> rho) and
ref_to_integ_boozer_chartmap (rho -> s) transforms.

E2E test now shows exact match in total confined fraction between
VMEC-Boozer and chartmap-only paths.
The passing/trapped classification needs bmin and bmax from field line
tracing (init_starting_surf). In chartmap mode this was skipped, leaving
bmin=bmax=0 and producing garbage classification.

Fix: call init_magfie(BOOZER) first to set up magfie_boozer (which works
with the chartmap splines), then call init_starting_surf normally.

E2E test now shows exact match in total, passing, AND trapped fractions.
@krystophny krystophny force-pushed the feature/boozer-chartmap-core branch from 319f478 to bd69ace Compare March 28, 2026 11:22
@krystophny krystophny marked this pull request as ready for review March 28, 2026 13:17
@krystophny krystophny merged commit 0ab2553 into main Mar 28, 2026
7 checks passed
@krystophny krystophny deleted the feature/boozer-chartmap-core branch March 28, 2026 15:04
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