Found while reviewing #281, which corrects the normalization of the same integral.
The bug
In the GAR bounce-average loop of tpsi (pentrc/torque.F90, vpar<=0 handling inside the theta loop), the tail-fill branch pads column 2 with column 1's value:
else
bspl%fs(i-1:,1) = bspl%fs(i-2,1)
bspl%fs(i-1:,2) = bspl%fs(i-2,1) ! <-- should be bspl%fs(i-2,2)
jvtheta(i:) = jvtheta(i-1)
exit
endif
bspl%fs(:,1) is the bounce-time integrand (I1, gives omega_b) and bspl%fs(:,2) is the radial-derivative integrand (I2, gives omega_D). When a vpar zero-crossing is encountered past the well midpoint — the warning path near the trapped/passing boundary ("!! WARNING: vpar zero crossing at psi=...") — the remainder of the I2 integrand is filled with I1 values, corrupting the precession frequency for that pitch.
Scope
- Affects all methods routed through the GAR branch (
fgar/tgar/pgar and the *mm matrix methods).
- Only triggers on the
vpar<=0 edge path (i>=ntheta/2), so it perturbs omega_D for a subset of pitches near the trapped/passing boundary rather than biasing all results.
- The intent of the fill (hold the last valid integrand value) is clear from the matching column-1 line and from the analogous pre-bounce fill later in the loop, which uses the correct columns.
History
Present verbatim since the PENT->PENTRC rewrite import (da0e6067, June 2015). The predecessor PENT (pent/profile.f) zeroed the endpoint instead and did not have this fill path.
One-character fix incoming as a PR.
Found while reviewing #281, which corrects the normalization of the same integral.
The bug
In the GAR bounce-average loop of
tpsi(pentrc/torque.F90,vpar<=0handling inside the theta loop), the tail-fill branch pads column 2 with column 1's value:bspl%fs(:,1)is the bounce-time integrand (I1, givesomega_b) andbspl%fs(:,2)is the radial-derivative integrand (I2, givesomega_D). When avparzero-crossing is encountered past the well midpoint — the warning path near the trapped/passing boundary ("!! WARNING: vpar zero crossing at psi=...") — the remainder of theI2integrand is filled withI1values, corrupting the precession frequency for that pitch.Scope
fgar/tgar/pgarand the*mmmatrix methods).vpar<=0edge path (i>=ntheta/2), so it perturbsomega_Dfor a subset of pitches near the trapped/passing boundary rather than biasing all results.History
Present verbatim since the PENT->PENTRC rewrite import (
da0e6067, June 2015). The predecessor PENT (pent/profile.f) zeroed the endpoint instead and did not have this fill path.One-character fix incoming as a PR.