Skip to content

NTV torque psi-quadrature over-refines at rational surfaces, dominating runtime #303

Closed

Description

@d-burg

In KineticForces, the outer psi-integration of the NTV torque integrand tpsi(psi)
uses adaptive quadrature. The integrand has near-singular resonant peaks at each
rational surface, and the adaptive quadrature over-refines there with no maxevals
cap, dominating runtime (about 30 min for a single n=1 case vs about 2 min for the
rest of the pipeline). Instrumentation showed ~1375+ tpsi evaluations clustered at
the rational surfaces (q = 2,3,4,5,6).

Proper fix: panel the psi-integral at the rational surfaces (handle the integrable
resonant peaks per-interval) rather than brute-force adaptive refinement; optionally
add a maxevals cap.

Interim mitigation already applied to the DIII-D-like example: relaxed
atol_psi / rtol_psi to 1e-2 (about 4x faster) and removed leftover per-evaluation
debug prints in Torque.jl.

Activity

  1. added
    featureNew capability
    perfSame answers, less time or memory
    on Jun 24, 2026
  2. logan-nc commented on Jun 24, 2026

    @logan-nc
    Collaborator

    what's the final torque?? reasonable result should be order 1 Nm. So 1e-2 atol is tight but reasonable. I don't remember the old DIII-D example taking 30 min

  3. jhalpern30 commented on Sep 29, 2026

    @jhalpern30
    Collaborator

    Closing. Fixed in #312 (commit 11bda95), which contained #313 in it which closed this issue.

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

Metadata

Metadata

Labels

featureNew capabilityperfSame answers, less time or memory

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions