Skip to content

PENTRC: fix bspl column index in the vpar<=0 fill path - #288

Merged
logan-nc merged 1 commit into
developfrom
fix_pentrc_bspl_i2_fill
Aug 2, 2026
Merged

PENTRC: fix bspl column index in the vpar<=0 fill path#288
logan-nc merged 1 commit into
developfrom
fix_pentrc_bspl_i2_fill

Conversation

@logan-nc

@logan-nc logan-nc commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #286. Found while reviewing #281, which corrects the normalization of the same integral.

What this changes

One character in the GAR bounce-average vpar<=0 handling:

                                 bspl%fs(i-1:,1) = bspl%fs(i-2,1)
-                                bspl%fs(i-1:,2) = bspl%fs(i-2,1)
+                                bspl%fs(i-1:,2) = bspl%fs(i-2,2)
                                 jvtheta(i:) = jvtheta(i-1)

Why

bspl%fs(:,1) is the bounce-time integrand (I1 -> omega_b) and bspl%fs(:,2) is the radial-derivative integrand (I2 -> omega_D). When a vpar zero crossing is encountered past the well midpoint — the warning path near the trapped/passing boundary — the old code filled the remainder of the I2 integrand with I1 values. The intent (hold the last valid value per column) is clear from the matching column-1 line and from the analogous pre-bounce fill later in the loop, which uses matched columns.

Scope

Affects the GAR-family methods (fgar/tgar/pgar and the *mm matrix methods) only for pitches that hit the vpar<=0 warning path with i >= ntheta/2; results away from the trapped/passing boundary are unchanged. Present verbatim since the PENT->PENTRC rewrite import (da0e6067, June 2015); PENT itself did not have this fill path.

Compiles cleanly (gfortran). Independent of #281 (different lines; both apply cleanly in either order).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rewp8poxoQyorK48SwxEUv

The tail-fill branch of the GAR bounce average padded the omega_D
integrand (column 2) with omega_b integrand (column 1) values when a
vpar zero crossing was encountered past the well midpoint, corrupting
the precession frequency for pitches near the trapped/passing boundary.
Present verbatim since the PENT->PENTRC rewrite (da0e606, 2015).

Fixes #286

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rewp8poxoQyorK48SwxEUv
@logan-nc
logan-nc merged commit 36de863 into develop Aug 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PENTRC: bspl fill path pads the omega_D integrand with omega_b integrand values

1 participant