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.
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.