Skip to content

KineticForces - BUGFIX! - Start the torque quadrature where the perturbation data starts - #661

Open
logan-nc wants to merge 2 commits into
developfrom
bugfix/kf-torque-psilow
Open

logan-nc wants to merge 2 commits into
developfrom
bugfix/kf-torque-psilow

Conversation

@logan-nc

@logan-nc logan-nc commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: the post-PE torque of runs whose plasma response starts off axis (qlow above q₀) no longer includes the region below the response; other runs are unchanged (harness @ 6fd57dbcb; the later amend 3b8e873 changed only test/)
  • Migration: none

When qlow is above q₀, ForceFreeStates raises psilow and the plasma response starts off axis. The KineticForces torque quadrature still started at the equilibrium's psilow, so it integrated extrapolated perturbation data below the response. It now starts where that data starts, as it already stopped at psilim.

Regression report

All five kinetic cases are unchanged. None of them starts the response off axis. The new solve-API test runs the TJ NTV deck with qlow = 1.9 (q₀ = 1.6) and checks that the torque ψ grid starts at or above the response's first ψ.

Regression Report: solovev_kinetic_nuzero
================================================================================
Ref 1: develop  @ e08c719cb (2026-11-05)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
Ref 2: bugfix/kf-torque-psilow  @ 6fd57dbcb (2026-11-06)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
--------------------------------------------------------------------------------
Quantity                 develop        bugfix/kf-torque-psilow  Diff     Status
--------------------------------------------------------------------------------
vacuum energy Re(ev[1])  1.054354e+01   1.054354e+01             0.0e+00  OK    
q0                       1.900003e+00   1.900003e+00             0.0e+00  OK    
total energy Re(et[1])   2.316510e+00   2.316510e+00             0.0e+00  OK    
total energy Im(et[1])   -1.555306e+00  -1.555306e+00            0.0e+00  OK    
plasma energy Re(ep[1])  -8.227028e+00  -8.227028e+00            0.0e+00  OK    
ODE steps (saved)        616            616                      0.0e+00  OK    
# singular surfaces      2              2                        0.0e+00  OK    
singular psi locations   [2 elem]       [2 elem]                 0.0e+00  OK    
total energy (all)       [32 elem]      [32 elem]                0.0e+00  OK    
ODE steps (total)        615            615                      0.0e+00  OK    
mpert                    32             32                       0.0e+00  OK    
q95                      3.147422e+00   3.147422e+00             0.0e+00  OK    
Runtime (s)              345.0s         182.1s                            --    
singular q values        [2 elem]       [2 elem]                 0.0e+00  OK    
npert                    1              1                        0.0e+00  OK    
================================================================================
Summary: 14 unchanged


================================================================
Case: tj_kinetic_ntv — TJ-analytic equilibrium, n=1, no wall, ideal + PE + NTV torque quadrature
================================================================

Regression Report: tj_kinetic_ntv
=================================================================================================
Ref 1: develop  @ e08c719cb (2026-11-05)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
Ref 2: bugfix/kf-torque-psilow  @ 6fd57dbcb (2026-11-06)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
-------------------------------------------------------------------------------------------------
Quantity                                   develop       bugfix/kf-torque-psilow  Diff     Status
-------------------------------------------------------------------------------------------------
NTV torque fgar [Re, Im]                   [1 elem]      [1 elem]                 0.0e+00  OK    
NTV ψ quadrature evaluations               75            75                       0.0e+00  OK    
fluid CGL energy fcgl [J]                  5.446408e-04  5.446408e-04             0.0e+00  OK    
root-area-weighted total energy Re(et[1])  4.350277e-01  4.350277e-01             0.0e+00  OK    
# singular surfaces                        2             2                        0.0e+00  OK    
singular psi locations                     [2 elem]      [2 elem]                 0.0e+00  OK    
q0                                         1.599966e+00  1.599966e+00             0.0e+00  OK    
Runtime (s)                                295.0s        176.4s                            --    
=================================================================================================
Summary: 7 unchanged


================================================================
Case: tj_kinetic_ntv_rates — TJ-analytic equilibrium, n=1, no wall, NTV torque with supplied rates-v1 collision rates (reuses the TJ NTV deck via overrides)
================================================================

Regression Report: tj_kinetic_ntv_rates
================================================================================================
Ref 1: develop  @ e08c719cb (2026-11-05)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
Ref 2: bugfix/kf-torque-psilow  @ 6fd57dbcb (2026-11-06)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
------------------------------------------------------------------------------------------------
Quantity                                      develop   bugfix/kf-torque-psilow  Diff     Status
------------------------------------------------------------------------------------------------
NTV torque fgar with supplied rates [Re, Im]  [1 elem]  [1 elem]                 0.0e+00  OK    
NTV ψ quadrature evaluations                  75        75                       0.0e+00  OK    
Runtime (s)                                   318.5s    196.9s                            --    
================================================================================================
Summary: 2 unchanged


================================================================
Case: tj_kinetic_multiion — TJ-analytic n=1, no wall, ideal + PE + multi-ion NTV (D + T + electron summed)
================================================================

Regression Report: tj_kinetic_multiion
===================================================================================
Ref 1: develop  @ e08c719cb (2026-11-05)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
Ref 2: bugfix/kf-torque-psilow  @ 6fd57dbcb (2026-11-06)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
-----------------------------------------------------------------------------------
Quantity                     develop       bugfix/kf-torque-psilow  Diff     Status
-----------------------------------------------------------------------------------
NTV total (D+T+imp+e) [N·m]  8.956286e-04  8.956286e-04             0.0e+00  OK    
NTV Deuterium [N·m]          4.759123e-04  4.759123e-04             0.0e+00  OK    
NTV Tritium [N·m]            4.133801e-04  4.133801e-04             0.0e+00  OK    
NTV electron [N·m]           6.336208e-06  6.336208e-06             0.0e+00  OK    
total energy Re(et[1])       4.350277e-01  4.350277e-01             0.0e+00  OK    
# singular surfaces          2             2                        0.0e+00  OK    
Runtime (s)                  322.5s        183.6s                            --    
===================================================================================
Summary: 6 unchanged


================================================================
Case: diiid_kinetic_multi_n — DIII-D-like equilibrium, n = 1, 2, KineticForces kinetic matrices, kinetic_factor=1.0, stability only, truncation at psihigh.
================================================================

Regression Report: diiid_kinetic_multi_n
=======================================================================================
Ref 1: develop  @ e08c719cb (2026-11-05)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
Ref 2: bugfix/kf-torque-psilow  @ 6fd57dbcb (2026-11-06)
       env: julia 1.11.7, x86_64-linux-gnu, manifest 385ab3bb (pinned), 16 threads/16 BLAS, jit build
---------------------------------------------------------------------------------------
Quantity                        develop        bugfix/kf-torque-psilow  Diff     Status
---------------------------------------------------------------------------------------
total energy Re(et[1])          5.184466e-01   5.184466e-01             0.0e+00  OK    
total energy Im(et[1])          -1.542568e-01  -1.542568e-01            0.0e+00  OK    
total energy (all)              [82 elem]      [82 elem]                0.0e+00  OK    
# kinetic singular surfaces     0              0                        0.0e+00  OK    
kinetic singular psi locations  [0 elem]       [0 elem]                 0.0e+00  OK    
ODE steps (saved)               836            836                      0.0e+00  OK    
mpert                           41             41                       0.0e+00  OK    
npert                           2              2                        0.0e+00  OK    
Runtime (s)                     702.7s         513.8s                            --    
=======================================================================================
Summary: 8 unchanged

Notes for reviewers

  • Found on an equilibrium with q₀ below the default qlow = 1.02: the response started off axis, but the torque was integrated from 1e-4, so it included extrapolated perturbation data below the response.
  • KineticForcesInternal gains psilow, set from the first ψ of the perturbed-equilibrium grid in set_perturbation_data!.
  • Not addressed here: methods that read the perturbation along an orbit (the orbit-averaged path on feature/ntv-orbit) can still sample just below psilow, as they can just above psilim.

Opened as a draft: it needs a named human reviewer before it can leave draft, and it must not be merged without a human reviewer's approval.


https://claude.ai/code/session_01BgNxCFidkS5NEJM3EvSoBs

…rbation data starts

With qlow above q0, ForceFreeStates raises psilow and the plasma response starts off axis, but the
post-PE torque quadrature still started at the equilibrium's psilow and integrated extrapolated
perturbation data below the response. It now starts at the first psi of that data, as it already
stopped at psilim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BgNxCFidkS5NEJM3EvSoBs
@logan-nc logan-nc self-assigned this Nov 7, 2026
@github-actions github-actions Bot added bugfix Something was wrong and now is not changed-results Results move or an interface breaks - read before upgrading labels Nov 7, 2026
@logan-nc
logan-nc requested a review from matt-pharr November 7, 2026 03:57
@logan-nc
logan-nc marked this pull request as ready for review November 7, 2026 13:15

This branch has not been deployed

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

Labels

bugfix Something was wrong and now is not changed-results Results move or an interface breaks - read before upgrading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants