Equilibrium parameters: compute the stubbed flux bookkeeping fields, and collapse the duplicate psi-on-axis variables

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

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

@jhalpern30 がすでに取り組んでいます。

2026年8月15日 から。

評価

この issue はまだ評価されていません。

説明

feature

Fallout from the gpec.h5 schema overhaul (#226, PR #364). While giving the Equilibrium/ scalars literature names I audited every field of Equilibrium.EquilibriumParameters against its assignment site, and two related problems turned up. Neither is a regression — both predate the schema work — but the rename made them visible, so they are worth fixing deliberately rather than carrying forward.

1. Several flux-bookkeeping fields are hardcoded constants, not computed

src/Equilibrium/Equilibrium.jl:370-381 is the sole assignment site for the whole flux-bookkeeping family, and most of it is literals:

pe.params.psi0                 = psio
pe.params.psi_axis             = pe.psio
pe.params.psi_boundary         = 1.0
pe.params.psi_boundary_norm    = 1.0
pe.params.psi_axis_norm        = 0.0
pe.params.psi_norm             = 0.0
pe.params.psi_axis_offset      = 0.0
pe.params.psi_boundary_offset  = 0.0
pe.params.psi_axis_sign        = 1
pe.params.psi_boundary_sign    = -1
pe.params.psi_boundary_zero    = false

Everything from psi_boundary down is a constant independent of the equilibrium being loaded. In normalized-flux terms psi_axis_norm = 0 and psi_boundary_norm = 1 are true by definition of psi_N, so those two are honest tautologies — but psi_boundary = 1.0 is written with units Wb/rad in the schema and is not the boundary poloidal flux of any real equilibrium, and the offsets/signs/psi_boundary_zero look like they were meant to record what the ingest actually did (Fortran GPEC derived the equivalent quantities from the g-file simag/sibry pair and the COCOS handling). The likely story is that the Julia port stubbed them and nothing downstream noticed.

Separately, four fields of the struct are never assigned anywhere in src/ — ro, zo, psio, b_norm. The HDF5 writer works around the first three by pulling them off PlasmaEquilibrium directly (equil.ro, equil.zo, equil.psio) and b_norm is silently skipped because it stays nothing.

Ask: compute these from the ingest rather than hardcoding them — real psi_axis/psi_boundary in Wb/rad, real offsets/signs reflecting the COCOS/normalization actually applied, a decision on b_norm (compute it or delete the field), and either populate params.ro/zo/psio or delete them in favour of the PlasmaEquilibrium fields so there is one source of truth.

2. Three variables are the same number for psi on axis

psi0, psi_axis, and psio all end up holding the total poloidal flux difference. psi_axis in particular is misnamed: it is assigned pe.psio, i.e. the total flux, not the flux at the axis. psi_axis_norm is likewise an exact duplicate of psi_norm (both 0.0).

For the schema overhaul I took the conservative route: Equilibrium/psi_total is written once (from equil.psio) and the duplicates psi0, psi_axis, psi_axis_norm are dropped from the HDF5 output via EQUIL_H5_SKIP in src/HDF5Schema.jl. That fixes the file, not the struct.

Ask: collapse the redundancy in EquilibriumParameters itself — either delete the duplicate fields, or, if each was intended to mean something distinct (axis flux vs. total flux vs. normalization constant), define those meanings and make the assignments match the names. Whatever survives should have a docstring entry stating which of the three it is; today a reader of the struct cannot tell them apart.

Notes

  • Fixing (1) will move numbers only if a downstream consumer reads the stubbed values; a regression-harness run (regress --cases diiid_n1,solovev_n1 --refs develop,local) should confirm the blast radius before merging.
  • Any change to which fields exist must be mirrored in EQUIL_H5_NAMES / EQUIL_H5_SKIP (src/HDF5Schema.jl) and the naming rules in docs/development/hdf5-conventions.md.
主要言語
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 を短くまとめたダイジェスト。