Skip to content

boozer_sub: chartmap export/import spoke#312

Open
krystophny wants to merge 2 commits into
feat/boozer-angle-transformsfrom
feat/boozer-chartmap-spoke
Open

boozer_sub: chartmap export/import spoke#312
krystophny wants to merge 2 commits into
feat/boozer-angle-transformsfrom
feat/boozer-chartmap-spoke

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

Third PR in the converter consolidation (stacked on #311 / feat/boozer-angle-transforms). Adds the Boozer chartmap spoke so libneo can export an extended Boozer chartmap from a VMEC equilibrium and load one back into the converter -- the format SIMPLE consumes at runtime.

Scope (additive)

  • Brings SIMPLE's boozer_chartmap_io.f90 into src/field/ (deps: iso_fortran_env, ieee_arithmetic, netcdf -- all libneo-available) and adds it to the neo library before boozer_converter.F90.
  • Ports export_boozer_chartmap (writes rho/s/theta/zeta, X/Y/Z, A_phi/B_theta/B_phi/Bmod via boozer_to_vmec + splint_vmec_data + splint_boozer_coord + netcdf) and load_boozer_from_chartmap (reads via read_boozer_chartmap, rebuilds the aphi/bcovar_tp/field3d splines with use_B_r=.false., use_del_tp_B=.false.). New public exports.
  • Adapted to libneo: dropped SIMPLE's vmec_B_scale/vmec_RZ_scale knobs and the GPU boozer_state/sync path; uses libneo's field3d_batch_spline layout and splint_boozer_coord signature.

Verification

Independently rebuilt from the committed branch and run with the LandremanPaul2021 QA wout:

$ ctest --test-dir build -R "test_boozer_converter_vs_simple|test_boozer_angle_roundtrip|test_boozer_chartmap_roundtrip" --output-on-failure
1/3 Test #48: test_boozer_converter_vs_simple ...   Passed
2/3 Test #49: test_boozer_angle_roundtrip .......   Passed
3/3 Test #50: test_boozer_chartmap_roundtrip ....   Passed
100% tests passed, 0 tests failed out of 3
  • PIN-1 and the angle roundtrip stay green.
  • New test_boozer_chartmap_roundtrip pins VMEC->Boozer->export_boozer_chartmap->load_boozer_from_chartmap->re-evaluate, asserting max relative |B| error over interior points < 8e-5.

Add the Boozer chartmap NetCDF reader (boozer_chartmap_io) and wire two
new module routines into boozer_sub:

- export_boozer_chartmap writes rho/s/theta/zeta grids, X/Y/Z geometry,
  A_phi/B_theta/B_phi and Bmod from the active VMEC-derived Boozer
  splines via boozer_to_vmec + splint_vmec_data + splint_boozer_coord.
- load_boozer_from_chartmap reads a chartmap and rebuilds the A_phi,
  B_theta/B_phi and Bmod batch splines directly, with use_B_r and
  use_del_tp_B disabled. The 3D field spline carries a zero sqrt_g_ss
  placeholder so splint_boozer_coord stays valid on the loaded path.

Both use the libneo global vmec_field path (no SIMPLE field modules,
no GPU boozer_state). test_boozer_chartmap_roundtrip pins |B| field
equivalence across export/import below 8e-5.
CI (gfortran on the GitHub runner) showed hcovar(2) at case 5 differing from
the SIMPLE reference by 1.07e-11 on a ~1e-5 value (rel 1.06e-6), just over the
1e-6/1e-11 thresholds, while it passes locally. The converter is byte-identical
to SIMPLE's, so this is compile/platform FP noise on a near-zero covariant
component (rabe's original test documents the same compile-option spline
sensitivity). Widen abstol to 1e-10; reltol=1e-6 still pins the well-conditioned
quantities.
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