Skip to content

boozer_sub: VMEC<->Boozer angle transforms#311

Open
krystophny wants to merge 2 commits into
feat/boozer-converter-corefrom
feat/boozer-angle-transforms
Open

boozer_sub: VMEC<->Boozer angle transforms#311
krystophny wants to merge 2 commits into
feat/boozer-converter-corefrom
feat/boozer-angle-transforms

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

Second PR in the hub-and-spoke converter consolidation (stacked on #310). Ports SIMPLE's VMEC<->Boozer angle-transform machinery into libneo's boozer_sub, so the converter can map between VMEC and Boozer angles in both directions. The chartmap export spoke (next PR) needs boozer_to_vmec.

Scope (additive)

  • New module-level delt_delp_V_grid / delt_delp_B_grid arrays + delt_delp_V/B batch-spline descriptors and ready flags (libneo save style, not SIMPLE's GPU/allocatable path).
  • New routines delthe_delphi_BV, vmec_to_boozer, boozer_to_vmec (Newton, niter=100, epserr=1e-14), build_boozer_delt_delp_batch_splines (called from get_boozer_coordinates_impl, freed in reset_boozer_batch_splines).
  • compute_boozer_data fills the V grid unconditionally (needed by the forward/backward maps) and the Boozer-angle B grid only when use_del_tp_B (default .false.). Existing perqua rows, splint outputs and numeric behavior are unchanged.
  • New public exports: vmec_to_boozer, boozer_to_vmec, delthe_delphi_BV.
  • Uses the libneo global vmec_field; no SIMPLE field/vmec_field_eval/GPU boozer_state introduced.

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" --output-on-failure
1/2 Test #48: test_boozer_converter_vs_simple ...   Passed
2/2 Test #49: test_boozer_angle_roundtrip .......   Passed
100% tests passed, 0 tests failed out of 2
  • PIN-1 (test_boozer_converter_vs_simple) stays green: behavior is byte-unchanged.
  • New test_boozer_angle_roundtrip pins invertibility (a previously-untested gap): vmec_to_boozer then boozer_to_vmec recovers (theta, varphi) to < 1e-10 (modulo periodicity), and the reverse, at s in {0.2, 0.5, 0.8} for several angle pairs.

Port the angle-transform machinery from the SIMPLE converter into libneo's
boozer_sub: delthe_delphi_BV, vmec_to_boozer, and the Newton inverse
boozer_to_vmec. compute_boozer_data now fills delt_delp_V_grid (theta_B-theta_V
and phi_B-phi_V on the VMEC-angle grid) unconditionally and delt_delp_B_grid on
the Boozer-angle grid behind use_del_tp_B. build_boozer_delt_delp_batch_splines
constructs the descriptors. Existing splint outputs and perqua rows are
unchanged.

Add test_boozer_angle_roundtrip pinning round-trip invertibility of the
forward and inverse transforms.
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