Skip to content

VMEC toroidal-flux sign is hardcoded for left-handed (signgs=-1) equilibria across the ingestion path; positive-Jacobian VMEC is silently mis-signed #308

Description

@krystophny

Problem

The VMEC ingestion path assumes a left-handed equilibrium (signgs = -1) and hardcodes torflux = -phi_vmec[-1]/(2*pi) without ever reading signgs from the wout/boozmn file. For a positive-Jacobian / right-handed equilibrium (signgs = +1), the stored toroidal flux has the opposite sign, so the hardcoded negation yields a toroidal flux of the wrong sign, which mirror-flips iota and A_phi relative to the written geometry. No test covers a signgs = +1 equilibrium.

This is a codebase-wide convention rather than a defect specific to one file: the booz_xform chartmap converter faithfully mirrors libneo's own native VMEC reader, which makes the same assumption.

Where

  • libneo:src/vmecinm_m.f90 lines 75-86 (phi = -phi/(2*pi), comment ties this to left-handed VMEC / signgs = -1).
  • libneo:src/spline_vmec_data.f90 (compute_boozer_data, sA_phi construction).
  • SIMPLE:tools/booz_xform_to_boozer_chartmap.py lines 211-218 (torflux_si = -float(d["phi"][-1])/TWOPI, comment asserts phi_b[-1] > 0 without checking signgs).
  • libneo:doc/ExtraDocuments/Conventions.md (toroidal-flux sign convention).

Evidence

  • vmecinm_m.f90 applies phi = -phi/(2*pi); the preceding comment explicitly ties the negation to left-handed VMEC with signgs = -1.
  • The booz_xform converter applies the same negation (-phi_b[-1]/(2*pi)) with a comment asserting phi_b[-1] > 0, again without inspecting signgs.
  • signgs is not read from any wout/boozmn file anywhere in the ingestion path; it appears only in explanatory comments. A signgs = +1 wout fed through the native path would be mis-signed identically to the converter.
  • VMEC has supported positive-Jacobian equilibria (wout writes signgs) since v6.20, so signgs = +1 inputs are possible in practice.

Why it matters

When format conversion is consolidated into a single libneo Boozer representation, the in-memory model should be unambiguous about the toroidal-flux sign convention. A positive-Jacobian VMEC equilibrium currently passes through silently with a flipped flux sign, producing a self-consistent but mirror-reflected field. Surfacing this as a documented, checked limitation (read and validate signgs, or reject unsupported sign conventions at the boundary) avoids silent mis-signing in the consolidated path.

Do not fix yet - tracking only

This is a latent, codebase-wide limitation recorded for triage during converter consolidation, not a converter-specific regression. Do not implement a fix in response to this issue; it is a tracking record only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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