Skip to content

ForceFreeStates — multi-n support in build_kinetic_metric_matrices #246

@logan-nc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    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