Skip to content

Test booz_xform chartmaps through the production coordinate roundtrip #493

Description

@krystophny

Goal

Extend the booz_xform -> Boozer chartmap -> SIMPLE test so the generated file is checked through the production libneo coordinate object, not only through raw Python interpolation, field values, and an ensemble orbit result.

This is the downstream regression for itpplasma/libneo#395.

Why this is needed

test/tests/test_booz_xform_chartmap.py already checks:

  • spectral convergence of Bmod;
  • agreement with SIMPLE's internal Boozer export;
  • file metadata and radial staggering;
  • an end-to-end confined-fraction comparison.

Those checks can all pass while chartmap_coordinate_system_t%from_cyl fails an exact point generated by the same coordinate object's forward map. The failure was reproduced on SIMPLE ba581b6fac127cc5e99415f6658952a5bfffa24c with libneo e451e0a42f5228d85b0479de40aa35db8b48239d, using a 256 x 384 x 320 endpoint-excluded Boozer chartmap. It occurs with one map object and is unchanged by load_boozer_from_chartmap, so the converter output needs an explicit runtime coordinate-contract test even after the libneo solver is fixed.

Implementation scope

Primary files:

  • test/tests/test_booz_xform_chartmap.py;
  • a small Fortran probe under test/tests/ linked to simple, or an existing roundtrip executable extended to load the converted file;
  • test/tests/CMakeLists.txt.

Use the public QA reactor-scale equilibrium already downloaded by test_booz_xform_chartmap.py. Generate the chartmap with tools/booz_xform_to_boozer_chartmap.py, construct both the production Boozer field and the libneo chartmap coordinate object, and evaluate deterministic points in one field period.

Required checks

  1. Raw file versus runtime forward map

    • Evaluate x, y, and z from the NetCDF grid with an independent interpolator.
    • Evaluate the same (rho, theta_B, zeta_B) through make_chartmap_coordinate_system.
    • Check positions in centimetres at grid nodes and off-grid points, including the angular seams.
  2. Runtime inverse contract

    • For each runtime forward position, call from_cart or from_cyl.
    • Require success, the original radial label, periodic-angle equivalence, and a scale-aware Cartesian residual.
    • Include toroidal inputs shifted by several field periods.
  3. Construction-order independence

    • Repeat representative forward and inverse points before and after load_boozer_from_chartmap.
    • Require identical coordinate results. This guards against a future shared-state regression without asserting that the current failure has that cause.
  4. Start-coordinate validation

    • Convert a small VMEC start set to chartmap coordinates.
    • Require unchanged speed and pitch, correct rho=sqrt(s), successful forward geometry, and a bounded physical-position residual.
    • Treat a nonzero inverse status or a radial-label mismatch as a failed conversion, not as a usable point.

Positive and negative cases

  • Positive: interior points from rho=0.1 through 0.95, including rho=0.5, roundtrip successfully.
  • Positive: both an endpoint-excluded converter file and SIMPLE's internal export satisfy the same runtime contract.
  • Negative: a fixture with a wrong radial convention, transposed geometry dimensions, or invalid periodic extent is rejected before tracing.
  • Negative: an outside-volume target returns an explicit failure and is never normalized into the interior ensemble.

Verification

fo test test_booz_xform_chartmap
fo test test_boozer_chartmap_roundtrip
fo

Non-goals and dependency

  • The inverse algorithm itself remains owned by Boozer chartmap cold inverse fails an exact forward-map roundtrip libneo#395.
  • Do not change the converter's field harmonics, SIMPLE's integrators, the radial pre-gate, or production loss handling in this issue.
  • Keep CI data public and small; a separate optional stress label may exercise the 256 x 384 x 320 grid when sufficient memory is available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions