Skip to content

PENTRC - BUG FIX - Recover full CGL curvature from perpendicular field strength - #342

Merged
logan-nc merged 1 commit into
PrincetonUniversity:developfrom
krystophny:fix/pentrc-cgl-curvature-20261020
Oct 22, 2026
Merged

logan-nc merged 1 commit into
PrincetonUniversity:developfrom
krystophny:fix/pentrc-cgl-curvature-20261020

Conversation

@krystophny

@krystophny krystophny commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

pentrc/torque.F90:379 reconstructed curvature with an extra half although dbob=-(divx+kapx). Remove that half and evaluate the existing 5/3 and 1/3 coefficients in r8; retain the real-Fourier quadratic normalization.

This changes results.

Manufactured complex displacement on the existing Solov’ev ideal equilibrium, ψ=0.4: Im(Tpsi_fcgl) = 2.410379216933e5 → 2.731839412786e5; independent double-adiabatic pressure work gives 2.731839412786e5.

Out-of-tree pentrc_cgl_pressure.f90 passes the pressure-work oracle at 1e−10 relative tolerance and rejects develop. Native FortSym checks prove the complex pressure-work and curvature identities.

Rebased on develop 24bc45a; focused native GNU Make dcon gpec pentrc build passed locally (gfortran 16.2.1, four jobs). No cluster or gfortran 12.2 build was run.

Evidence branch preserves the removed regression and FortSym derivation; commands and results. No added tests, CI targets or docs in this PR.

Chris&AI

@krystophny
krystophny force-pushed the fix/pentrc-cgl-curvature-20261020 branch from 1964e6a to 2380bc6 Compare October 21, 2026 13:20
@krystophny krystophny added this to the v1.6.0 milestone Oct 21, 2026
@krystophny
krystophny marked this pull request as ready for review October 21, 2026 13:22
@krystophny
krystophny requested a review from logan-nc October 21, 2026 13:22
@krystophny krystophny mentioned this pull request Oct 21, 2026
27 tasks done
@logan-nc

Copy link
Copy Markdown
Contributor

Review findings: the fix is correct.

Code consistency. Both PENTRC readers impose dB/B = −(∇·ξ⊥ + κ·ξ⊥) with factor 1: inputs.f90:898 for the xclebsch path and inputs.f90:439 for the pmodb path. So kapx = -0.5*(dbob+divx) returned exactly half of the κ·ξ⊥ fed in.

Physics.

  • The CGL bracket (5/3)|D|² + (1/3)|D+3K|² = 2|D|² + 2Re(DK*) + 3|K|² follows from the double-adiabatic closure and from the fluid limit of |μδB_L + m v∥² κ·ξ⊥|² only if K = κ·ξ⊥ is unscaled.
  • The gar integrand at torque.F90:713 weights dbob by (1 − 1.5λB/B₀), which also assumes factor 1. With the ½ it would be (1 − 2λB/B₀).
  • The ½ dates to da0e606 (2015) and is never justified. The other two 0.5 factors multiply both terms, so they could not have compensated for it.

Runs (develop e80da1e vs 2380bc6, identical DCON/GPEC inputs, fcgl_flag=t):

case dW_total_fcgl change
a10_ideal 7.7236e-07 → 8.2900e-07 +7.3%
regression_solovev_ideal 0.10156 → 0.09911 −2.4%

T_total_fcgl is 0 in both. Only the *_fcgl outputs differ; every fgar/rlar/clar result is bit-identical. The fix is independent of #341.

Not blocking (pre-existing): divxfac is not applied in the fcgl branch, jbb at line 376 is unused, and line 870 is 148 characters.

🤖 Generated with Claude Code

@logan-nc
logan-nc merged commit e0f0eb6 into PrincetonUniversity:develop Oct 22, 2026
6 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.

2 participants