Skip to content

ForceFreeStates — multi-n support in build_kinetic_metric_matrices #246

Description

@logan-nc

ForceFreeStates.build_kinetic_metric_matrices (src/ForceFreeStates/Fourfit.jl:151-315) hardcodes n = intr.nlow at the inner-product loop (line 285) and allocates only mpert² storage. Fortran pentrc/dcon_interface.f:863-1020 (idcon_action_matrices) is intrinsically single-n (the toroidal mode is a module-scope nn, no outer-n loop, matrices sized mpert²).

PR #112 adds @assert intr.nlow == intr.nhigh to make this loud. Lifting the restriction would be a Julia-only extension beyond Fortran and would require:

  • Allocating (mpert·npert)² storage for each of smats/tmats/xmats/ymats/zmats.
  • Wrapping the inner-product loop in for n in intr.nlow:intr.nhigh.
  • Updating CalculatedKineticMatrices.compute_calculated_kinetic_matrices to consume the block-diagonal layout (it currently rebuilds the block diagonal manually).

Acceptance

  • npert > 1 runs no longer assert.
  • DIIID multi-n regression case added under regression-harness/cases/ showing finite et[1] for at least n=1,2,3.
  • Reference: Logan PhD thesis (2015), Appendix C, Eqs. C.1-C.11.

Activity

  1. added this to the GPEC v2.0.0 milestone on Jun 17, 2026
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

    featureNew capability

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions