Add VMEC->Boozer converter (boozer_sub) to libneo, pinned against SIMPLE#310
Open
krystophny wants to merge 2 commits into
Open
Add VMEC->Boozer converter (boozer_sub) to libneo, pinned against SIMPLE#310krystophny wants to merge 2 commits into
krystophny wants to merge 2 commits into
Conversation
Bring the VMEC-to-Boozer spline converter into libneo as the canonical module boozer_sub. It depends only on modules libneo already provides (spline_vmec_sub including vmec_field/splint_vmec_data/metric_tensor_vmec, boozer_coordinates_mod, vector_potentail_mod, new_vmec_stuff_mod, interpolate, plag_coeff_sub, binsrc_sub, spl_three_to_five_sub, chamb_mod, diag_mod) and shares the identical numeric core with the SIMPLE converter, so it consolidates the duplicated converters that currently live in SIMPLE and rabe. Public API: get_boozer_coordinates(vmec_file, radial_spline_order, angular_spline_order, grid_refinment), splint_boozer_coord, and reset_boozer_batch_splines. Carries the contravariant sqrt(g^ss) metric as an evaluated quantity and the optional B_r reconstruction (use_B_r). Add test_boozer_converter_vs_simple pinning |B|, sqrt(g), bder, and the covariant/contravariant/curl components at five (s,theta,phi) points on the LandremanPaul2021 QA reference wout against the values SIMPLE produces (reltol 1e-6, abstol 1e-11).
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.
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
Bring the VMEC-to-Boozer spline converter into libneo as the canonical module
boozer_sub. The converter currently lives duplicated and diverged in SIMPLE (src/boozer_converter.F90) and rabe (src/vmec/boozer_converter.F90); their numeric cores are identical. This lands one libneo copy so both downstreams can drop their forks (cutover PRs follow).This is the first step of the hub-and-spoke converter consolidation (see #305): one in-memory Boozer representation that every format reads into and writes out of.
Scope
src/boozer_converter.F90(module boozer_sub), added to theneolibrary. It depends only on modules libneo already provides:spline_vmec_sub(incl.vmec_field,splint_vmec_data,metric_tensor_vmec),boozer_coordinates_mod,vector_potentail_mod,new_vmec_stuff_mod,interpolate,plag_coeff_sub,binsrc_sub,spl_three_to_five_sub,chamb_mod,diag_mod.get_boozer_coordinates(vmec_file, radial_spline_order, angular_spline_order, grid_refinment),splint_boozer_coord,reset_boozer_batch_splines. Carries the contravariantsqrt(g^ss)metric and the optionalB_rreconstruction (use_B_r).test_boozer_converter_vs_simplepinning the converter output against SIMPLE.SIMPLE-only supersets (the
vmec_to_boozer/boozer_to_vmecangle transforms, the OpenACCboozer_statedevice path, and the chartmap load/export spoke) are intentionally not in this PR; they land as additive follow-ups before the SIMPLE cutover. Behavior is unchanged for existing libneo code: nothing else in libneo callsboozer_subyet.Verification
Before: libneo had no VMEC->Boozer converter, so the pin could not be built.
After, the converter reproduces SIMPLE's published reference values at five
(s, theta, phi)points on the LandremanPaul2021 QA reference wout (|B|,sqrt(g),bder,hcovar,hctrvr,hcurl; reltol 1e-6, abstol 1e-11):