Skip to content

BUG FIX - Keep delivered direct-chart radii on their input flux surfaces - #355

Closed
krystophny wants to merge 1 commit into
PrincetonUniversity:developfrom
krystophny:fix/projected-radius-upstream-20261023
Closed

krystophny wants to merge 1 commit into
PrincetonUniversity:developfrom
krystophny:fix/projected-radius-upstream-20261023

Conversation

@krystophny

Copy link
Copy Markdown
Collaborator

Keep radii delivered to the direct flux-coordinate chart on the requested input flux surface. The common-angle sampling path introduced upstream bypassed the earlier corrected integration-output radius.

This layer preserves both projected integration-output radii and projected common-angle samples through existing direct_refine. It changes no LSODE state, tolerances or profile-integral policy. The native regression checks the delivered geometry against the public analytic equilibrium. Retains and completes accepted personal GPEC PR2.

Native qualification used the complete production union: focused checks passed in3361934 (2/2 in8.253s), followed by full native Make with the owning GNU debug flags. Continuation3361977 completed fresh ideal/kinetic and the remaining resistive/reconstruction stages under53 pinned runtime libraries. Reconstruction relative error0.006969 is below the unchanged0.02 tolerance and curl passed. Independent source/binary/compiler/runtime pre/post checks passed. The original3361934 wrapper status remains failed because RMATCH deliberately emits RPEC termination and closes globalsol.bin; this native product contract was verified rather than relabelled generic normal termination. Exact union tree equals qualified543b87f0; no private inputs or weakened gates.

The old integration-output radius fix alone fails the current common-angle delivered-chart oracle at2.469907589438378e−5 against the existing1e−5 tolerance. Projecting the actual delivered samples through the existing native refinement routine makes that same oracle pass. No solver tolerance is changed.

This draft targets the external Fortran GPEC upstream develop branch. Qualification receipts above refer to the complete maintained-fork union, which also includes independent message/output-state fixes, rather than claiming an independent full-stage run of this upstream-only branch. Public analytic input only; no private campaign fixture. Chris retains upstream review and promotion.

Chris&AI

@logan-nc

Copy link
Copy Markdown
Contributor

Thanks Chris. I went through this carefully, since direct_run sits under every EFIT-based run. The projection itself is sound — Newton-projecting each sampled radius onto ψ=ψ₀ removes the radial part of the LSODE drift, and because ∂(r²)/∂ψ across surfaces amplifies uncorrelated per-surface drift by ~1/Δψ, it should matter more at high mpsi. But I'm closing it rather than taking it into v1.6:

  1. It isn't a regression fix for upstream. The chart has always been built from the unrefined LSODE radius — before EQUIL - BUGFIX - Sample every direct-equilibrium surface at the common straight-fieldline angles #329 direct_run splined y_out(:,2) directly, back to the 2008 import. The "earlier corrected radius" exists only in your fork (Preserve projected radius in direct flux coordinates krystophny/GPEC#2). So this is an accuracy refinement, and per your note on GPEC - NEW FEATURE - Emit optional perturbed Boozer and Hamada field strength #344, improvements now go to the Julia code.
  2. The effect is O(etol). Your oracle fails at 2.5e-5 with etol=1e-5; at the shipped default etol=1e-7 the chart is already on the surface to ~1e-7, below the ψ(R,Z) spline floor of a typical g-file.
  3. Coverage. CI's Solovev examples do go through direct_run, so it's good to see the new direct_refine calls survive psihigh=0.99999 and the 2% recon check — but nothing measures how much real g-file outputs move. direct.f's sampling was rewritten a week ago (EQUIL - BUGFIX - Sample every direct-equilibrium surface at the common straight-fieldline angles #329); stacking a second numerics change on it on release day without an A/B of DCON δW and GPEC metrics on the EFIT examples isn't a trade I want to make.
  4. Minor: y_out(istep,2)=rfac is a dead store here (y_out(:,2) is no longer read after EQUIL - BUGFIX - Sample every direct-equilibrium surface at the common straight-fieldline angles #329), and the refinement target should be the psi0 that direct_fl_int actually converged to rather than psio*(1-sq%xs(ipsi)).

The Julia code already has this on its list — OpenFUSIONToolkit/GPEC#544 item 3 — and I've left a pointer there. If anyone wants to pursue it in Fortran after 1.6, the evidence needed is an A/B at default etol and at mpsi ≥ 256 on docs/examples/DIIID_ideal_example, a5_tearing_example and a10_ideal_example: δW/eigenvalues from dcon.out, rzphi, and the GPEC control-surface metrics.

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