From a5272d5e04a3691f2547393c9c17f81309bfc616 Mon Sep 17 00:00:00 2001 From: logan-nc Date: Sat, 24 Oct 2026 10:09:39 -0400 Subject: [PATCH] GPEC - BUG FIX - Use each surface's own R for |grad psi| in xbnormal gpout_xbnormal formed |grad psi| from the shared r(:) without setting it, so each surface used whatever surface the previous caller left there: usually one surface behind, and on the first surface whatever gpout_singfld left. Set r(itheta) from the surface's own rs, as the gpeq_* routines do. xno, bno and bwp move by up to 0.4% near the edge and no longer depend on singfld_flag. Supersedes #353. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMDGyfQKRZQMdk3NJXsKQE --- gpec/gpout.f | 1 + 1 file changed, 1 insertion(+) diff --git a/gpec/gpout.f b/gpec/gpout.f index 7eb32a60..897b60bd 100644 --- a/gpec/gpout.f +++ b/gpec/gpout.f @@ -3488,6 +3488,7 @@ SUBROUTINE gpout_xbnormal(egnum,xspmn,spots,interpspot,nspot) eta=twopi*(theta(itheta)+rzphi%f(2)) rs(istep,itheta)=ro+rfac*COS(eta) zs(istep,itheta)=zo+rfac*SIN(eta) + r(itheta)=rs(istep,itheta) jac=rzphi%f(4) jacs(itheta)=jac w(1,1)=(1+rzphi%fy(2))*twopi**2*rfac*r(itheta)/jac