Utilities - BUG - CubicFit end derivative loses an offset-sized rounding error on edge-packed grids

Aperta
#559 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
49/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
julia
Ambito
performance

Direzione di ricerca

Start with FastInterpolations.jl's src/core/polyfit_kernels.jl:55 and :612-622, then inspect GPEC.jl's edge-packed grid construction in DirectEquilibrium.jl:478-500. Reproduce the end-derivative error using an offset profile on an edge-packed grid and compare against the analytic derivative. If confirmed, the issue proposes fixing it upstream in FastInterpolations.jl and updating this repository's compatibility bound.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

GPEC.jl builds its equilibrium splines with cubic_interp, whose default boundary condition CubicFit() sets the end derivative from a 4-point polynomial fit. FastInterpolations.jl 0.4.20 evaluates this derivative as muladd(c1, f1, … c4*f4) (src/core/polyfit_kernels.jl:55, called from :612-622). The weights sum to zero, so a constant offset in f cancels only in exact arithmetic. In floating point the error is about eps*|f|/h and is not reduced, so it grows on grids whose end spacing h is small compared with the end value.

The Fortran code had exactly this defect in its extrap spline end derivative. It made DCON/GPEC results wrong for mpsi >= 320 with grid_type='ldp' and at large aspect ratio (GPEC#306, fixed in GPEC#308). The fix there forms the derivative from differences to the end value, sum c_i (f_i - f_1), which is algebraically identical and removes the offset before rounding. The edge-packed Julia grids (log_asymptotic, core_edge_packed, DirectEquilibrium.jl:478-500) create the small h where this matters.

Status: verified in the source; the effect on a GPEC.jl result is not yet measured. Proposed route: (1) reproduce with a profile f = C + g(psi) that has a large offset C, on an edge-packed grid, and compare the end derivative with g' analytically; (2) if confirmed, repair it upstream in FastInterpolations.jl and bump the compat bound here, as for the PeriodicBC fix (#531).

Chris&AI

Lingua principale
Julia
Stelle
11
Fork
7
Merge medio
4g 3h
PR unite (30g)
70

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenFUSIONToolkit/GPEC

Tutte le issue di OpenFUSIONToolkit/GPEC

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.