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

オープン
#559 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
49/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
julia
領域
performance

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Julia
スター
11
フォーク
7
平均マージ
4日 3時間
マージ済み PR(30日)
70

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenFUSIONToolkit/GPEC のほかの issue

OpenFUSIONToolkit/GPEC の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。