Skip to content

EQUIL - IMPROVEMENT - Scope custom-Jacobian knobs to jac_custom_power_*#311

Merged
logan-nc merged 1 commit into
developfrom
feature/jac-custom-power-knobs
Jul 3, 2026
Merged

EQUIL - IMPROVEMENT - Scope custom-Jacobian knobs to jac_custom_power_*#311
logan-nc merged 1 commit into
developfrom
feature/jac-custom-power-knobs

Conversation

@logan-nc

@logan-nc logan-nc commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Closes #288.

Problem

In [Equilibrium], the Jacobian coordinate system is chosen with jac_type. For named systems (hamada, pest, boozer, equal_arc, park) the constructor forces a fixed set of exponents, yet the raw power_bp/power_b/power_r/power_rc were exposed as top-level keys that look universal but only mattered when jac_type = "other". Listing them (as 0) in every example implied false relevance, and setting one on a named-type run was silently ignored.

Changes

Custom-Jacobian knobs (src/Equilibrium/EquilibriumTypes.jl)

  • Rename jac_type = "other"jac_type = "custom" (clearer intent; no shim — no stable API pre-2.0.0).
  • Add user-facing jac_custom_power_bp/b/r/rc (default 0), read only at construction when jac_type = "custom", then copied into the internal power_*. The existing "recognize a named type from the exponents" normalization is retained (fast paths still taken).
  • Named types are unchanged: they force power_* and ignore the custom knobs.
  • Downstream is untouched — FieldLineDerivParams and every Jacobian formula (DirectEquilibrium.jl, DirectEquilibriumArcLength.jl, InverseEquilibrium.jl) keep reading the internal power_* fields as the single source of truth. The four now derived-only constructor slots are marked _.

Deprecate power_* as TOML input keys (reusing the centralized mechanism)

  • Generalize _drop_deprecated_ffs_keys!(table)_drop_deprecated_keys!(table, deprecated_keys, section) in src/GeneralizedPerturbedEquilibrium.jl.
  • Add _DEPRECATED_EQUIL_KEYS = ("power_bp", "power_b", "power_r", "power_rc"), applied on both the gpec.toml (build_inputs_from_toml) and h5-replay (src/Rerun.jl) input paths. A stale power_* key now warns loudly and is dropped instead of silently overriding the coordinate system.
  • Fix a latent bug: _DEPRECATED_FFS_KEYS = ("mer_flag") was a string (not a 1-tuple), so for k in … iterated its characters and the FFS deprecation never fired. Now ("mer_flag",).

Docs & examples

  • Update the EquilibriumConfig docstring (surfaced via @autodocs) and docs/src/conventions.md to document custom and the jac_custom_power_* fields with J = Bp^bp · B^b / (R^r · rfac^rc).
  • Standardize the jac_type option-list comment to (hamada, pest, boozer, equal_arc, park, custom) and remove the now-inactive power_* lines from the example/test gpec.toml files (safe — named types force the exponents regardless of file contents).

Verification

  • Unit checks: custom copies knobs → internal exponents and normalizes to the named fast path when they match; a non-standard set stays custom with manual exponents; named types force exponents and ignore custom knobs; the deprecation warns + drops and the config still builds from jac_type; all 19 example/test gpec.toml files parse.
  • Regression harness (diiid_n1, solovev_n1, solovev_multi_n, local vs develop): every quantity 0.0e+00 diff — the change is numerically inert.

🤖 Generated with Claude Code

Rename the custom Jacobian selector jac_type = "other" to "custom" and add
user-facing jac_custom_power_bp/b/r/rc inputs to EquilibriumConfig, read only
when jac_type = "custom". Named types (hamada/pest/boozer/equal_arc/park) keep
forcing the internal power_* exponents; downstream Jacobian formulas are
unchanged and still read the internal power_* fields as the single source of
truth. The four power_* constructor slots are now derived-only (marked `_`).

Deprecate power_bp/power_b/power_r/power_rc as [Equilibrium] TOML input keys by
reusing the centralized deprecation mechanism: generalize
_drop_deprecated_ffs_keys! to _drop_deprecated_keys!(table, keys, section) and
add _DEPRECATED_EQUIL_KEYS, applied on both the gpec.toml and h5-replay input
paths. A stale power_* key now warns loudly and is dropped instead of silently
overriding the coordinate system. Also fix the _DEPRECATED_FFS_KEYS one-tuple
bug (was a string, so the FFS deprecation never fired).

Update the EquilibriumConfig docstring and conventions.md, and clean the
now-inactive power_* lines out of the example/test gpec.toml files while
standardizing the jac_type option-list comment.

Regression: diiid_n1, solovev_n1, solovev_multi_n all 0.0e+00 diff vs develop.

Closes #288

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@logan-nc logan-nc self-assigned this Jul 3, 2026
@logan-nc logan-nc merged commit f87a739 into develop Jul 3, 2026
5 checks passed
@logan-nc logan-nc deleted the feature/jac-custom-power-knobs branch July 3, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename custom-Jacobian TOML knobs to jac_custom_power_*

1 participant