Conversation
Change `dd::IMAS.dd` → `dd::IMAS.DD` (or `IMAS.DD{T}` where T is needed
in the body) for:
- fusion_power
- fusion_energy
- fusion_neutron_power
Backward-compatible: IMAS.dd <: IMAS.DD so existing call sites are
unaffected. Allows satellite packages whose top-level container is a
sibling DD subtype (e.g. IFEdd.dd_ife) to call these functions when
their container embeds core_profiles.
…ty and improve documentation
There was a problem hiding this comment.
Pull request overview
This PR widens the dispatch signatures of selected fusion-power helper functions so they accept any IMAS.DD subtype (not just the concrete IMAS.dd container), enabling downstream packages with custom top-level DD containers to reuse these physics utilities without re-implementing them.
Changes:
- Widened
fusion_powerto acceptdd::IMAS.DD(and updated its docstring signature/description accordingly). - Widened
fusion_energyto acceptdd::IMAS.DD{T}. - Widened
fusion_neutron_powerto acceptdd::IMAS.DD(and expanded its docstring description).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Relax three fusion-power physics functions to accept any
IMAS.DDsubtype, so packages built on top of IMAS (e.g. IFE-related workflows or other FUSE-based applications that define their own DD subtype) can call them on their own top-level container without re-implementing the body.Changes (1 file, 6 lines)
In
src/physics/nuclear.jl,dd::IMAS.dd→dd::IMAS.DDfor:fusion_power(dd; …)fusion_energy(dd; …)fusion_neutron_power(dd)Each body only accesses
dd.core_profiles.profiles_1d[…], which is available on any DD subtype that embedscore_profiles.Compatibility
Pure widening.
IMAS.dd <: IMAS.DD, so every existing call site dispatches to the same method as before. No behavioral change, no performance change (Julia still specializes on the concrete type at compile time).Scope
Minimally invasive on purpose: only these three functions are touched, and only because their bodies are already trivially generic over the container. In principle most
dd::IMAS.ddannotations on functions that touch only shared IDS could receive the same treatment, but this PR keeps the change small and easy to verify — broader relaxation can follow in separate PRs as concrete need emerges.