Repository navigation
Equilibrium - FEATURE! - Store the analytic config on PlasmaEquilibrium and re-form every source from it - #548
Merged
Merged
Conversation
…ield, reform and the one-call constructors
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e driver and solve Scripted analytic runs with mpsi=0 now get the deck's refined two-pass grid instead of the single-pass grid, so their results move. Deck runs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts ingest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
matt-pharr
force-pushed
the
refactor/equilibrium-source
branch
from
October 20, 2026 15:27
363a1c8 to
7336dfc
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jhalpern30
approved these changes
Oct 26, 2026
jhalpern30
left a comment
Collaborator
There was a problem hiding this comment.
I like this one - I think it converts a Fortran-y approach to a very Julian one. Good use of multiple dispatch, moves a lot of equilibrium specific code into the equilibrium module, cleans up main a bit etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release note
mpsi=0now get the same refined two-pass ψ grid as the deck instead of the single-pass grid, so their results move.setup_equilibrium(config, source)is removed; callPlasmaEquilibrium(config, source), or the one-callPlasmaEquilibrium(file; eq_type),PlasmaEquilibrium(analytic_config)orPlasmaEquilibrium(dd). Theequil.toml/[EQUIL_CONTROL]loader (setup_equilibrium(path),EquilibriumConfig(path)) is removed; configure the equilibrium from the[Equilibrium]section ofgpec.toml. A script that builds an analytic equilibrium withmpsi=0and wants the old single-pass grid must now setmpsiexplicitly. A source that does not matcheq_type(an analytic config witheq_type="efit", or addwithouteq_type="imas") now raises an error instead of being silently ignored.A
PlasmaEquilibriumnow remembers the source it was formed from, so a script gets the same two-pass auto grid as a deck. Analytic and IMAS equilibria can be built in one call:PlasmaEquilibrium(SolovevConfig(...); mpsi=0)andPlasmaEquilibrium(dd; imas_cocos=11).Regression report
Notes for reviewers
PlasmaEquilibriumgains ananalyticfield, a defensive copy of the analytic config, because the configs are still mutable. The new abstract typeAnalyticEquilibriumConfigis the supertype ofSolovevConfig,LargeAspectRatioConfigandTJAnalyticConfig.ddis not stored.read_imasalready captures aDirectIngest, and rebuilding from it is the same arithmetic as re-reading thedd. A new test inruntests_imas.jlchecks that the two match exactly on the refined nodes.Equilibrium.reform(equil, psi_nodes)rebuilds from the stored config, else the ingest, else by re-reading the file. The driver still builds the node list (rational surfaces plus kinetic-resonance pins), so Equilibrium does not depend on ForceFreeStates.additional_inputis gone from the re-form path. The skip insolve(::EulerLagrangeProblem)is deleted, along with its warning, which wrongly said IMAS equilibria carry no ingest.setup_equilibrium'sisachain is replaced byrun_input(config, source)methods forNothing(file),AnalyticEquilibriumConfig,IMASdd.dd,DirectRunInputandInverseRunInput.PlasmaEquilibrium(config, source; override_psi_nodes)is now the single entry point;setup_equilibriumand theequil.tomlloader are deleted (no alias), with every caller intest/,examples/,benchmarks/,docs/and the harness's computed-separatrix template moved toPlasmaEquilibrium.CerfonConfigneeds<: AnalyticEquilibriumConfig. Its registry row then works with the new constructor andreformunchanged.run_inputmethods.Equilibrium.jlinto construction and post-processing files, with no logic changes.🤖 Generated with Claude Code