Skip to content

[spectre-07] Add native canonical field_can_spectre for symplectic integration #439

Description

@krystophny

Stage: SIMPLE / canonical symplectic path (milestone M2)
Source language: Fortran 2008
Manuals to read first: src/field/field_can_base.f90 (the field_can_t contract: A=(0,Ath,Aph), h=(0,hth,hph), Bmod, first/second derivatives); src/field/field_can_meiss.f90 (the construction this issue reuses per volume: angle transform lambda + gauge chi from radial ODE integration); src/field_can.f90 (field_can_from_id, init_field_can dispatch); derivation + computer-algebra verification in the companion repo (gitlab.tugraz.at/plasma/proj/spectre-orbits, ca/05_gc_canonical.wl, tex/).
Depends on: #438

Goal

Symplectic guiding-center integration (integmode >= 1) works inside SPECTRE volumes via a per-volume Meiss construction. CORRECTED PREMISE (computer-algebra verified in spectre-orbits ca/05_gc_canonical.wl): SPECTRE's A_s = 0 gauge supplies only half of the canonical requirement; the covariant h_s does NOT vanish in SPECTRE coordinates (metric off-diagonals), so the phase-space 1-form keeps a rho_par B_s ds term. The Meiss angle transformation zeta_c with d_s lambda = -B_s/B_zeta plus gauge chi with d_s chi = (d_s lambda) A_zeta restores A'_s = 0 AND B'_s = 0; both identities and the flux-2-form consistency are machine-verified. What SPECTRE still buys over the generic Meiss path: analytic integrands (no source-field splining, exact derivatives from the Chebyshev/Zernike basis), and per-volume construction domains in which the field is smooth (a global chart would integrate the construction ODE through interface current sheets). Field-line tracing (#437) genuinely needs no construction.

Files to edit

  • src/field/field_can_meiss.f90: add a spectre_field_t arm to ah_cov_on_slice / init_canonical_field_components (currently closed to vmec_field_t/splined_field_t), and support a per-volume construction domain (r in [lvol-1, lvol] in the stacked chart) with one construction state per volume instead of the single global grid.
  • src/field_can.f90: new id SPECTRE dispatching to the per-volume Meiss data of the active volume; integ_to_ref/ref_to_integ identity within a volume.
  • src/simple_main.f90: admit the new id in the integmode > 0 guard.
  • test/tests/test_spectre_sympl_volume.py + test/field_can/ unit test: NEW.
  • DOC/coordinates-and-fields.md: extend section 6 with the SPECTRE per-volume Meiss entry (mandatory).

Behavior to implement

  • Per-volume Meiss construction at init: for each volume, radial ODE sweep for lambda and chi on a (r, theta, zeta) grid with integrands evaluated analytically from libneo's spectre primitives; spline the resulting canonical components per volume (existing 5-component batch-spline machinery).
  • Volume boundary: integration stops with the same event semantics as [spectre-06] Load SPECTRE fields and trace RK45 guiding centers per volume #438; Newton iterates may transiently evaluate past the boundary (polynomial extension; never clamp).
  • Axis volume: sampler-side minimum offset rho_g >= 1e-3; document.
  • Optional follow-up (document, do not implement): a no_K-style variant that drops rho_par h_s in SPECTRE coordinates directly, the same O(Larmor-radius) approximation as SIMPLE's Boozer use_B_r = .false.; exact per-volume Meiss is the reference path.

Acceptance scenarios (BDD)

  • Given the per-volume construction on the fixture equilibrium, then the transformed covariant components satisfy |A'_s| and |B'_s| below spline-interpolation tolerance on a verification grid (direct check of the construction, mirrors ca/05).
  • Given passing and trapped orbits in a single volume with integmode in {1, 3, 4}, then relative energy error is bounded and non-drifting over 1e5 steps.
  • Given an axisymmetric SPECTRE test file, then p_phi is conserved to near machine precision within a volume.
  • Given identical initial conditions, then symplectic and RK45 trajectories agree within tolerance-consistent bounds over a short trace.

Success criteria

make && make test TEST=spectre_sympl_volume

Non-goals

Verification

make test TEST=spectre_sympl_volume

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