Repository navigation
PENTRC, GPEC - BUG FIX - Form the pmodb perpendicular displacement from xi^psi and xi^s and read its drive - #341
Conversation
0f9441c to
63e8e8a
Compare
|
@krystophny, thanks for this. The physics premise is right, but merging this as-is would be a regression, because of how GPEC builds the column it now trusts. What's right. δB_L = Q∥ + ξ·∇B = −B(∇·ξ⊥ + κ·ξ⊥) + ξ∥ b·∇B, and the ξ∥-free piece is the NTV drive. The default xclebsch path already uses it ( The problem.
To find which side is wrong, I rebuilt B∇·ξ⊥ independently from (ξ^ψ, ξ^s). That form has no ξ∥ and no 1/(m−nq), and is algebraically the same as PENTRC's
Effect of this PR on what PENTRC sees (ψ-integrated Σ_m|X_m|², relative to develop): divx ×3.1 and dB/B ×7.2 on solovev_ideal ( A path forward. The fix behind this PR's intent is on the GPEC side. Build ξ⊥ in ξ⊥^θ = (χ′²/(J²B²))[−(g12+q g13)ξ^ψ + (g23+q g33)ξ^s/χ′], ξ⊥^ζ = qξ⊥^θ − ξ^s/χ′
Do you have the interest and capacity to try the GPEC-side fix in time for 1.6.0? Or are you OK leaving Related, on #340 (merged, and correct): "default unchanged" holds for the code default, but 🤖 Generated with Claude Code |
logan-nc
left a comment
There was a problem hiding this comment.
See claude details. Source annotations here already specified this was done on purpose and for backwards consistency. If you want to try the suggested larger lift, then go for it and I'll review. Otherwise, I'm fine with how it is and we can just close this one
|
Thanks, agreed: trusting Chris&AI |
…i and xi^s gpout_pmodb built xi_perp as xi minus the Fourier-truncated 1/(m-nq) closure xi_par, which left large residues in Bdivxprp and Bkxprp at the resonant and window-edge harmonics. Build J*xi_perp^theta and J*xi_perp^zeta directly from xi^psi and xi^s with the eqfun(2:3) metric combinations, as in the smat..zmat kinetic matrices. Output format is unchanged.
63e8e8a to
cbf20c0
Compare
|
The GPEC-side fix is in (cbf20c0): Identity residual / Σ|lagb|² on solovev_ideal (reg_flag=t), develop → this PR:
solovev_kinetic and both reg_flag settings behave the same way. What remains is the expected gauge term: 0.04–0.12 at m=−4…−2 with reg_flag=f, and ≤1.5e-6 once that term is removed. PENTRC's integrated divx and dB/B now move by 1–4% relative to develop; the ideal reg_flag=f case is somewhat above the 1–2% you expected, and the PR body says so. Tables and the derivation are in the PR body and on the linked evidence branch. Chris&AI |
|
The requested GPEC-side fix is in (cbf20c0) and CI is green, so this is ready for re-review for 1.6.0. If there isn't time for a careful look before Friday's cutoff, I'm happy for it to move to 1.6.1 instead, since it is a bug fix and fits the patch line, and I'd rather not rush a results-changing change in. #339 and #344 stay out of 1.6.0 as planned. Chris&AI |
gpdiag_pmodb now builds J*xi_perp from xi^psi and xi^s like gpout_pmodb, for the divergence, curvature and llagb columns, so the diagnostic agrees with the main pmodb output. Its llagb vs -(Bdivx+Bkx) residual at resonant and window-edge m drops from O(1-100) to <1e-3 on the Solov'ev examples. Drops the now-unused xmt/xmz (gpout_pmodb) and xmz/xvt/xvz (gpdiag_pmodb) inverse transforms and relabels the PENTRC pmodb debug columns. gpec_pmodb, gpec_pmodb_fun, pmodbmn diagnostic and PENTRC outputs are bit-identical to cbf20c0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMDGyfQKRZQMdk3NJXsKQE
logan-nc
left a comment
There was a problem hiding this comment.
Approving. Thanks @krystophny, this is the right fix.
Checked independently (hand derivation, a separate sympy red-team, and our own feynman runs, Solov'ev ideal/kinetic × reg_flag t/f plus a10_kinetic):
- Math. The new Jξ⊥ equals the old ξ − ξ∥b exactly (ξ^θ cancels identically), and the curvature rewrite is algebraically identical. Every difference from develop is the removed ξ∥ leakage.
- Accuracy.
Bdivxprpmatches an independent reconstruction from (ξ^ψ, ξ^s) to 0.06–0.5% per m. Develop was off 3.6–6.7× at m = 2, 3 and −4. - PENTRC. The pmodb path now agrees with the default xclebsch path for every method in every case. For example, fgar went from 0.86% → 0.18% apart (ideal, reg=t) and from 1.17% → 0.26% (kinetic, reg=t); a10 rlar/clar/fcgl from 0.4–2.7% → ≤0.1%. Torque changes against develop match your −1…−5%.
- Scope. xclebsch, eulb, lagb and all non-pmodb outputs are bit-identical.
Pushed 4d7e278 on top (no change to any main output; gpec_pmodb, pmodbmn and the PENTRC results are bit-identical to cbf20c0):
gpdiag_pmodbnow uses the same direct ξ⊥ form. Its llagb vs −(Bdivx+Bkx) residual at resonant and edge m drops from O(1–100) to <1e-3.- Dropped the now-unused xmt/xmz/xvt/xvz inverse transforms.
- Relabeled the PENTRC pmodb debug columns.
For the release notes (I'll add these):
read_pmodbnow trusts the supplied divergence, so agpec_pmodbfile written by an older GPEC still carries the leaky column. Regenerate pmodb files with 1.6 before using them with PENTRC 1.6.- Pre-existing, not from this PR: with
reg_flag=fthe drive is unregularized and singular at rational surfaces. In the ideal example it is about 10⁶× the reg_flag=t drive at q=3, and results there depend on how the ψ grid samples the spike.
🤖 Generated with Claude Code
Two commits:
gpout_pmodbformed ξ⊥ = ξ − ξ∥ with the Fourier-truncated 1/(m−nq) closure ξ∥, which left large residues inBdivxprpandBkxprpat resonant and window-edge harmonics. Following the review, it now builds them directly from (ξ^ψ, ξ^s) with theeqfun(2:3)metric combinations:Jξ⊥^θ = χ′²[−f₂ξ^ψ + f₃ξ^s/χ′], Jξ⊥^ζ = q·Jξ⊥^θ − Jξ^s/χ′. The divergence and κ·ξ⊥ columns both use this, with no ξ∥ and no 1/(m−nq). This is algebraically the
smat…zmatform. The output format is unchanged.read_pmodbkeeps the supplied divergence and forms the drive as −(Bdivxprp+Bkxprp), instead of −(lagb+Bkxprp) in lagb's ξ^ζ=0 gauge.Per-m identity. R = Σ_ψ|Bdivxprp+lagb+Bkxprp|² / Σ_ψ|lagb|², develop → this PR:
The remaining residual is the gauge term (ξ^s/(χ′q) − ξ⊥^θ)·∂_θB carried by lagb. Subtracting it brings the ideal reg=f rows at m=−4…−2 to R ≤ 1.5e−6. One exception is ideal reg=t m=−1 (0.035 after the gauge term; 0.063 on develop). It comes from a discrete force-balance term in the interpolated B and metric jets, peaking near the axis at ψ≈0.037. It is not caused by this change. An independent B∇·ξ⊥ reconstruction from (ξ^ψ, ξ^s) with analytic θ-derivatives matches the new
Bdivxprpto ≤0.7% per m.PENTRC drive (actual reader, ∫dψ Σ_m|X_m|², this PR relative to develop):
Before this change, the same comparison gave ×3.1 and ×7.2 on solovev_ideal reg=t, and up to ×69 and ×228 with reg=f.
ψ=0.4 check (Solov'ev ideal, prepared harmonic inputs), Im(Tpsi_fcgl):
The
reg_flag=fdecks touched by #340 (input/gpec.in, a10_ideal, a10_kinetic, a5_tearing, solovev_kinetic) also get the new pmodb columns. Only the two Solov'ev examples were run.Verification. Rebased on develop e0f0eb6. Native GNU Make
dcon gpec pentrcbuilds pass with gfortran 16.2.1 and no new warnings. All eight DCON/GPEC/PENTRC example runs (two examples × two reg_flag settings × develop/PR) terminate normally. The eulb, lagb and xclebsch outputs are unchanged. No cluster or gfortran 12.2 build was run. No tests, CI targets or docs are added in this PR.Evidence branch has the derivation, the residual budget, full per-m tables and the analysis script. The earlier reader evidence is in gpec16_validation.md.
Chris&AI