From 6fba5886b4adb9c22a81a5decfa85024e73d1982 Mon Sep 17 00:00:00 2001 From: Matthew Pharr Date: Fri, 23 Oct 2026 17:20:15 +0200 Subject: [PATCH 1/3] Repo - API! - Delete the no-op KineticForces and PerturbedEquilibrium keys and stop runs that set deprecated keys --- .pre-commit-config.yaml | 2 +- benchmarks/benchmark_against_fortran_run.jl | 2 - docs/development/hdf5-conventions.md | 6 +- docs/development/toml-conventions.md | 6 +- docs/src/kinetic_forces.md | 29 +------- .../DIIID-like_error_field_example/gpec.toml | 3 - .../gpec.toml | 2 - examples/DIIID-like_ideal_example/gpec.toml | 3 - .../gpec.toml | 2 - examples/Solovev_ideal_example/gpec.toml | 2 - examples/Solovev_ideal_example_3D/gpec.toml | 2 - .../Solovev_kinetic_NTV_example/gpec.toml | 2 - .../gpec.toml | 2 - .../gpec.toml | 2 - src/Equilibrium/EquilibriumTypes.jl | 8 +-- src/GeneralizedPerturbedEquilibrium.jl | 26 +++---- src/KineticForces/BounceAveraging.jl | 24 +++---- .../CalculatedKineticMatrices.jl | 8 +-- src/KineticForces/Compute.jl | 3 - src/KineticForces/EnergyIntegration.jl | 16 ++--- src/KineticForces/KineticForces.jl | 1 - src/KineticForces/KineticForcesStructs.jl | 45 +----------- src/KineticForces/Output.jl | 71 ------------------- src/KineticForces/PitchIntegration.jl | 21 +++--- src/KineticForces/Torque.jl | 15 ++-- .../PerturbedEquilibrium.jl | 10 +-- .../PerturbedEquilibriumStructs.jl | 21 +----- src/PerturbedEquilibrium/Response.jl | 2 +- src/PerturbedEquilibrium/ResponseMatrices.jl | 4 +- src/PerturbedEquilibrium/SingularCoupling.jl | 4 +- src/Rerun.jl | 6 +- test/runtests_equil.jl | 23 +++--- test/runtests_h5_schema.jl | 2 +- test/runtests_kinetic.jl | 16 ++--- test/runtests_kinetic_validity.jl | 4 +- test/runtests_rerun_from_h5.jl | 17 ++--- 36 files changed, 106 insertions(+), 306 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5efde01b0a..697ae70a2f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -77,5 +77,5 @@ repos: - id: toml-no-deprecated-keys name: 'TOML conventions: no deprecated config keys' language: pygrep - entry: '^(mer_flag|force_wv_symmetry|ode_flag|cyl_flag|mat_flag|reform_eq_with_psilim|use_riccati|use_parallel|parallel_threads|populate_dense_xi|gal_flag|nstep|diagnose_ca|diagnose|ksing|power_bp|power_b|power_r|power_rc|use_galgrid)\s*=' + entry: '^(mer_flag|force_wv_symmetry|ode_flag|cyl_flag|mat_flag|reform_eq_with_psilim|use_riccati|use_parallel|parallel_threads|populate_dense_xi|gal_flag|nstep|diagnose_ca|diagnose|ksing|power_bp|power_b|power_r|power_rc|use_galgrid|moment|eq_out|theta_out|xlmda_out|eqpsi_out|save_records|gpec_file|fnml_flag|ellip_flag|diag_flag|force_xialpha|fixed_boundary|output_eigenmodes|filter_modes|singular_point_method)\s*=' files: ^(examples/.*\.toml|test/test_data/.*\.toml)$ diff --git a/benchmarks/benchmark_against_fortran_run.jl b/benchmarks/benchmark_against_fortran_run.jl index 8419953015..a4de7bdcdb 100644 --- a/benchmarks/benchmark_against_fortran_run.jl +++ b/benchmarks/benchmark_against_fortran_run.jl @@ -439,7 +439,6 @@ function write_gpec_toml_coil( end println(io) println(io, "[PerturbedEquilibrium]") - println(io, "fixed_boundary = false") println(io, "compute_response = true") println(io, "compute_singular_coupling = true") println(io, "verbose = true") @@ -491,7 +490,6 @@ function write_gpec_toml_file( println(io, "forcing_data_format = \"ascii\"") println(io) println(io, "[PerturbedEquilibrium]") - println(io, "fixed_boundary = false") println(io, "compute_response = true") println(io, "compute_singular_coupling = true") println(io, "verbose = true") diff --git a/docs/development/hdf5-conventions.md b/docs/development/hdf5-conventions.md index 515186317d..01bfee8bb7 100644 --- a/docs/development/hdf5-conventions.md +++ b/docs/development/hdf5-conventions.md @@ -7,7 +7,7 @@ Conventions for the structure and naming of the `gpec.h5` output file. Every wri **The schema must be intuitive to a plasma physicist who is not a developer of this code.** The top level largely mirrors the TOML sections / major `src/` modules — which are themselves organized along physics lines — but **physics intuition wins whenever the two diverge**. Worked examples of that rule: - All per-rational-surface stability results consolidate under `SingularSurfaces/`, regardless of which algorithm produced them: the GGJ coefficients sit beside the Δ′/PEST-3 matching results, and the Riccati BVP and the Galerkin outer-region solve write the *same* `Delta_prime_matrix`/`Delta_prime_raw`/`Delta_coil`/`pest3_*` paths rather than each owning a producer-named subgroup. -- `EulerLagrangeMatrices` over a bare `Matrices` — group names must say what the data *is*, not which array it came from. Same reasoning renamed `records/` → `EnergyIntegrals/` and `matrices_/` → `KineticMatrices/`. +- `EulerLagrangeMatrices` over a bare `Matrices` — group names must say what the data *is*, not which array it came from. Same reasoning renamed `matrices_/` → `KineticMatrices/`. Physics-topic groups elevated to top level (rather than nested under their producer): `Info/`, `Input/`, `SingularSurfaces/`, `LocalStability/`, `SurfaceGeometries/`. @@ -44,7 +44,7 @@ Top level (11 groups): | `LocalStability/` | Mercier `D_I`, resistive interchange `D_R`, `ballooning_Delta_prime` on `psi`; the ballooning α boundary on `ballooning_psi` | | `SingularSurfaces/` | Per-rational-surface data: `rational_psi`/`rational_q`/`rational_m`/`rational_n`, GGJ coefficients, `Delta_prime_matrix`/`Delta_prime_raw`/`Delta_coil`/`pest3_A`/`pest3_B`/`pest3_Gamma` (Riccati or Galerkin alike), the inner-layer `Match/` results, `Kinetic/` | | `PerturbedEquilibrium/` | `ForcingModes/`, `Response/`, `ResponseMatrices/`, `SingularCoupling/`, `Energies/`, control-surface spectra | -| `KineticForces/` | `/` (torque/energy profiles, `EnergyIntegrals/`, `KineticMatrices/`); multi-ion runs add `PerSpecies///` with the same per-method layout, summing to the top-level total | +| `KineticForces/` | `/` (torque/energy profiles, `KineticMatrices/`); multi-ion runs add `PerSpecies///` with the same per-method layout, summing to the top-level total | | `ErrorFields/` | `CoilSensitivities/` (per-coil-set control-surface spectra and their rigid shift/tilt derivatives, `DominantMode/` full-window projection); `MonteCarlo/` (intrinsic and corrected `\|δ\|` histograms over the sampled tolerances, per batch and averaged); `Risk/` (threshold density, `P(lock\|δ)`, locking probabilities, `ToleranceScan/`); `NTV/` (correction-coil overlap and NTV torque couplings per kAt) | | `Tearing/` | `PerSurface/` (+ `DpMatrix/`), `Roots/`, `LayerWidths/`, `Diagnostics/{ValidRoots,Poles,FilteredRoots}`, `Scan/Surface_/` | | `SurfaceGeometries/` | `{Plasma,Wall}/{x,y,z}` point clouds | @@ -69,7 +69,7 @@ Mechanism: writers stay table-driven — each writer keeps a `path => (; long_na - Complex quantities are stored as the native HDF5.jl compound type (readable by h5py as a compound dtype) — **never split into `*_real`/`*_imag` dataset pairs**. Sole sanctioned exception: `Input/RawInputs/ForcingTerms/amplitude_{real,imag}`, which mirrors the external forcing ingest-file format and keeps pre-existing snapshots replayable. - `NaN` is the not-computed sentinel in numeric datasets (e.g. auto-derived settings, rootless growth-rate entries). - A **zero-extent array** is the not-computed sentinel for whole datasets that a given run never produces (e.g. `SingularSurfaces/ca_left`/`ca_right` on kinetic or galerkin-matched runs, the free-boundary energies when `vac_flag=false`, the on-demand derivative stores). Never write unpopulated (`undef`) memory. -- Ragged (variable-length) data uses the flat-plus-`offsets` companion pattern (`offsets[k+1] - offsets[k]` = length of row `k`) rather than HDF5 VLEN types, e.g. `KineticForces//EnergyIntegrals/` and `Tearing/Diagnostics/*`. +- Ragged (variable-length) data uses the flat-plus-`offsets` companion pattern (`offsets[k+1] - offsets[k]` = length of row `k`) rather than HDF5 VLEN types, e.g. `Tearing/Diagnostics/*`. ## Back-compatibility policy diff --git a/docs/development/toml-conventions.md b/docs/development/toml-conventions.md index 5ee2c3d5d8..97139921ae 100644 --- a/docs/development/toml-conventions.md +++ b/docs/development/toml-conventions.md @@ -47,9 +47,9 @@ fails when its pattern matches a violation) lint-check the covered TOMLs on comm - `toml-no-decorative-dividers` — no `# ----`-style divider lines (all covered files). - `toml-inline-annotations` — every `key = value` line carries a trailing `# description` (`examples/*` and `test/test_data/*` only, per the rule-2 exception above). -- `toml-no-deprecated-keys` — no deprecated config keys; its key list mirrors - `_DEPRECATED_FFS_KEYS`/`_DEPRECATED_EQUIL_KEYS` in `src/GeneralizedPerturbedEquilibrium.jl`, - so extend the hook's pattern whenever a key is deprecated there. +- `toml-no-deprecated-keys` — no deprecated config keys; its key list mirrors the + `_DEPRECATED_*_KEYS` lists in `src/GeneralizedPerturbedEquilibrium.jl`, which stop any run that + sets one, so extend the hook's pattern whenever a key is added there. Run them manually with: diff --git a/docs/src/kinetic_forces.md b/docs/src/kinetic_forces.md index ad866cf06b..3b2ecf7106 100644 --- a/docs/src/kinetic_forces.md +++ b/docs/src/kinetic_forces.md @@ -70,8 +70,7 @@ The summed total is written to `KineticForces//` exactly as in a single- run, and each species' own contribution to `KineticForces/PerSpecies/