Skip to content

ForceFreeStates — multi-n support in build_kinetic_metric_matrices #246

Closed

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
  2. logan-nc commented on Oct 27, 2026

    @logan-nc
    CollaboratorAuthor

    Checked against develop (db90e82) before deciding whether to open a PR tonight. build_kinetic_metric_matrices is still single-n: Fourfit.jl:134-135 sets n = nlow and the five matrices are mpert² per surface; the assert from #112 is gone, so a multi-n deck with kinetic_factor > 0 silently builds every kinetic matrix at nlow (callers: CalculatedKineticMatrices.jl:90, KineticForcesStructs.jl:388). Not opening the PR now: #569 rewrites CalculatedKineticMatrices (the compute_kinetic_matrices_at_psi! signature and the block-diagonal consumer this would have to change), and the acceptance criterion needs a new DIII-D multi-n kinetic harness case, which is hours of compute I am keeping off the shared machine this week. Plan: after #569 lands, first commit restores a loud error for nlow != nhigh on the kinetic path, second lifts it with the (mpert·npert)² layout and the harness case.

  3. self-assigned this
    on Oct 30, 2026
  4. added theissue type on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureNew capability

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions