Skip to content

Finish GVEC straight-fieldline support end-to-end and add PEST #326

@krystophny

Description

@krystophny

Summary

The current GVEC export-based integration is in good shape for:

  • GVEC fetch/build
  • logical-coordinate export + refcoords path
  • Boozer export generation
  • direct Boozer field comparison
  • Boozer refcoords magfie comparison

What is still open is the remaining straight-fieldline end-to-end path and the still-missing PEST family.

Current Status

Passing locally:

ctest --test-dir /tmp/simple-gvec-reset-build/test --output-on-failure \
  -R '^(generate_gvec_boozer_export|test_gvec_boozer|test_gvec_boozer_refcoords_magfie)$'

Still failing locally:

ctest --test-dir /tmp/simple-gvec-reset-build/test --output-on-failure \
  -R '^(generate_gvec_export|test_simple_vmec_gvec)$'

Current failure:

ERROR STOP Maximum steps exceeded in ODE integration
...
#5  __alpha_lifetime_sub_MOD_integrate_mfl_can at src/sub_alpha_lifetime_can.f90:320
#6  __samplers_MOD_init_starting_surf at src/samplers.f90:41
#7  __simple_main_MOD_main at src/simple_main.f90:100

Problem Statement

The remaining GVEC gap is no longer the raw export reader or direct Boozer field evaluation. The unresolved part is the end-to-end straight-fieldline workflow used by SIMPLE during starting-surface construction and full particle runs.

That path still is not fully aligned with the new export-based GVEC interface:

  • the Boozer start-surface path still fails in test_simple_vmec_gvec
  • the generic starting-surface ODE path is still the place where the GVEC straight-fieldline integration breaks down
  • PEST is not implemented yet even though the requirement explicitly calls for logical or straight fieldline (Boozer or PEST)

Scope

  1. Finish GVEC Boozer support end-to-end so the full test_simple_vmec_gvec workflow passes.
  2. Add PEST export + read + test coverage on the same abstraction layer.
  3. Keep the current no-legacy design: only the NetCDF export interface, no raw GVEC .dat fallback, no VMEC shim path.

Concrete Tasks

  • Make the starting-surface construction work for GVEC straight-fieldline coordinates.
    • Either finish the special-case straight-fieldline sampling path cleanly, or make the generic path robust enough for exported GVEC Boozer data.
    • The result must remove the current integrate_mfl_can failure in the Boozer refcoords run.
  • Audit the scaled/native radial-coordinate contract for refcoords sampling and orbit setup.
    • The straight-fieldline GVEC path must use the same first-coordinate convention consistently in magfie_refcoords, samplers, and the export reader.
  • Ensure the straight-fieldline path consumes the exact exported field-line data where appropriate.
    • In particular, the end-to-end path must not silently fall back to reconstructed or spline-induced approximations when exact exported contravariant information is available.
  • Implement PEST export support in python/pysimple/gvec_export.py.
  • Extend the Fortran GVEC readers and reference-coordinate logic so PEST files are detected and loaded through the same modern interface.
  • Add tests that cover the currently missing behavior.

Required Tests

  • Keep these passing:
    • test_gvec
    • test_vmec_gvec
    • test_gvec_boozer
    • test_gvec_boozer_refcoords_magfie
    • test_refcoords_file_detection
  • Make this pass:
    • test_simple_vmec_gvec
  • Add new PEST coverage:
    • export generation
    • file detection / refcoords initialization
    • direct field comparison
    • at least one end-to-end SIMPLE run

Acceptance Criteria

  • SIMPLE can use GVEC logical coordinates end-to-end.
  • SIMPLE can use GVEC Boozer coordinates end-to-end, including the current test_simple_vmec_gvec case.
  • SIMPLE can read a GVEC PEST export through the same NetCDF interface.
  • Unit, integration, and system/E2E tests cover logical + Boozer + PEST without regressions in VMEC or chartmap paths.
  • No legacy GVEC interfaces are reintroduced.

Relevant Files

  • python/pysimple/gvec_export.py
  • src/gvec/gvec_export_data.f90
  • src/coordinates/gvec_reference_coordinates.f90
  • src/field/field_gvec.f90
  • src/magfie.f90
  • src/samplers.f90
  • src/simple_main.f90
  • test/tests/test_simple_vmec_gvec.f90
  • test/tests/test_gvec_boozer.f90
  • test/tests/test_gvec_boozer_refcoords_magfie.f90

Notes

This is the remaining follow-up after the current GVEC export refactor work on fix/gvec-fetch-and-tests / PR #325.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions