Repository navigation
Equilibrium - BUGFIX! - Build F and P of g-file and IMAS equilibria from the tabulated FF′ and p′ - #506
Equilibrium - BUGFIX! - Build F and P of g-file and IMAS equilibria from the tabulated FF′ and p′#506d-burg wants to merge 1 commit into
Conversation
…rom the tabulated FF′ and p′ The g-file and IMAS readers took F and P from the tabulated profiles and left their derivatives to the cubic spline. F varies by only a few percent across the plasma, so rounding in the table (single precision in TokaMaker and classic EFIT output) leaves F′ nearly right in value but wrong in slope at the node scale, and Δ′ responds to that slope. `profile_source = "derivatives"` (the new default) integrates the file's FF′ and p′ inward from the boundary values of F and P, always for both profiles together. `profile_source = "values"` keeps the previous behaviour, and the reader falls back to it with a warning when the derivative arrays are absent or unusable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This pull request is missing a reviewer. If you are not ready to name them, mark this pull request as a draft. |
1 similar comment
|
This pull request is missing a reviewer. If you are not ready to name them, mark this pull request as a draft. |
|
Parking this PR. OpenFUSIONToolkit/OpenFUSIONToolkit#358 fixes the noise at the writer, and with double-precision g-files develop gives clean Δ′ without this change. Integrating FF′ and p′ also moves surfaces near pedestal kinks by more than the noise it removes (cubic, trapezoid and Akima rules disagree there by several units). Results and the open points are in #504. The one CI failure is the Δ′(2/1) pin of the in-repo example, which this change moves by design; it is left as is while the PR is parked. |
Release note
efit,efit_arclength,efit_by_inversion) and IMAS result moves. On the DIII-D-like example: Δ′ diagonal up to 15 %, free-boundary energy 0.6 %, SLAYER γ 6 %, NTV torque 2.8 %. Solovev is unchanged. (harness @ b3f412f)profile_source = "values"in[Equilibrium]to reproduce earlier results exactly.F and P of a g-file or IMAS equilibrium are now the integrals of the file's FF′ and p′, anchored at the boundary values, instead of the tabulated F and P. Differentiating a tabulated F amplified its rounding error into the current gradient, which put noise of several units on Δ′ for 257-node files written in single precision. Closes #504.
What changed
read_efitandread_imasfill the F and P columns of the 1D table through one helper (integrate_profile_derivatives), always for both profiles together. Everything downstream is untouched and still differentiates one spline.[Equilibrium]keyprofile_source:"derivatives"(default) or"values"(previous behaviour, bit-identical to develop).1e-4of F or 5 % of the peak pressure. It falls back to"values"with a warning when the derivative arrays are absent, all zero, non-finite, or opposite in sign for only one of the two profiles.Regression report
regress --cases diiid_n1,diiid_n1_riccati,diiid_slayer_n1,diiid_error_field,diiid_multi_n,efit_fixedbdy_separatrix,gal_resistive_diiid,gal_resistive_pe,solovev_n1 --refs 0e68a0553,b3f412f35 --force(julia 1.11.9, x86_64, pinned manifest, 8 threads).Unit tests on the same commit: equilibrium 305/305, IMAS 32/32, rerun-from-h5 40/40.
Validation beyond the harness
profile_source = "values"gives develop's Δ′(2/1) to every digit on two files.ldp,mpsi = 256) it is 0.027 rms.TkMkr_D3Dlike_Hmode.geqdskwith F rebuilt from FF′, Julia and Fortran STRIDE give Δ′(2/1) of 7.27 and 7.28. Fortran GPEC has the same defect and will need the same fix.Notes for reviewers
diiid_n1PE toroidal torque changes sign (+0.0509 → −0.0506). The same flip is recorded under grid refinement in PE toroidal torque changes sign under grid refinement while its magnitude stays stable to ~1% #370; I have not investigated it here.diiid_error_fieldrotation-scan quantities move 50–66 %. The scan shifts themselves change, which suggests a discrete choice moved; not investigated.read_imastoo; the overlap is the block that builds the 1D table.profile_source = "values", so the previous numbers stay tracked. Not added here.🤖 Generated with Claude Code