Skip to content

🐛 Fix core-edge rad split - #4665

Open
chris-ashe wants to merge 25 commits into
mainfrom
fix_rad_core_edge_split
Open

chris-ashe wants to merge 25 commits into
mainfrom
fix_rad_core_edge_split

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

This pull request standardizes and clarifies the naming and handling of plasma radiation variables throughout the codebase, with a focus on distinguishing "reduced core" and "edge" radiation power and their volume-averaged forms. It updates variable names, docstrings, and logic to consistently use the new terminology, and refactors related model logic and outputs to match. These changes improve code clarity and maintainability, especially regarding how radiation losses are modeled and reported.

Spin out of and will close #4536

🐛 Bugs FIxes

  • The main fix of this PR is the allocation of the radiation amounts to the core and edge region. Before any of the lost rad power in the reduced core was sent to the edge with is unphysical this is now corrected.

Variable Renaming and Standardization

Anoyingly the value for the reduced core impurity radiation was being passed around as p_plasma_inner_rad_mw, I have renamed this to ``p_plasma_core_rad_reduced_mwin-situ and then created a newp_plasma_core_rad_mw` which represents the full power.

  • p_plasma_inner_rad_mw -> p_plasma_core_rad_reduced_mw
  • pden_plasma_core_rad_mw -> pden_plasma_core_rad_reduced_vol_avg_mw
  • p_plasma_outer_rad_mw -> p_plasma_edge_rad_mw
  • pden_plasma_outer_rad_mw -> pden_plasma_edge_rad_vol_avg_mw
  • pden_plasma_rad_mw -> pden_plasma_rad_vol_avg_mw
  • pden_plasma_sync_mw -> pden_plasma_sync_vol_avg_mw
  • Renamed p_plasma_inner_rad_mw to p_plasma_core_rad_reduced_mw and p_plasma_outer_rad_mw to p_plasma_edge_rad_mw throughout the codebase for clarity.
  • Updated volume-averaged variables: replaced pden_plasma_core_rad_mw with pden_plasma_core_rad_reduced_vol_avg_mw, and pden_plasma_rad_mw with pden_plasma_rad_vol_avg_mw.
  • Updated docstrings and comments to match new variable names and clarify their meanings.

Model and Logic Updates

  • Changed logic in confinement_time.py and constraints.py to use the new reduced core and volume-averaged variables, ensuring calculations and outputs reflect the updated model.
  • Updated the ConfinementRadiationLossModel enum and related logic to rename CORE_ONLY to REDUCED_CORE_ONLY, reflecting the new terminology.

Data Structure and IO Changes

  • Updated the PhysicsData class to add new variables for reduced core and edge radiation (both total and volume-averaged), and deprecated or clarified old ones.
  • Updated input/output and plotting code to use the new variable names, ensuring consistency in reports and visualizations.

Imports and Minor Refactoring

  • Removed an unused import (scipy.integrate) and added a new import for calculate_vol_avg_of_profile in impurity_radiation.py.

These changes collectively improve the clarity, maintainability, and correctness of how plasma radiation power is represented and used throughout the codebase.

✍🏻 Output updates

New

image

Old

image

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@chris-ashe chris-ashe added Radiation Plasma radiated power Bug Something isnt working labels Oct 8, 2026
@chris-ashe chris-ashe changed the title Use calculate volume average of profile function Fix core-edge rad split Oct 8, 2026
@chris-ashe chris-ashe changed the title Fix core-edge rad split 🐛 Fix core-edge rad split Oct 8, 2026
@codecov-commenter

codecov-commenter commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 28.18182% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.91%. Comparing base (f1810e8) to head (5d665e0).

Files with missing lines Patch % Lines
process/models/physics/physics.py 0.00% 34 Missing ⚠️
process/models/physics/impurity_radiation.py 10.00% 27 Missing ⚠️
process/models/stellarator/stellarator.py 0.00% 8 Missing ⚠️
process/models/physics/confinement_time.py 37.50% 5 Missing ⚠️
process/models/physics/radiation_power.py 55.55% 4 Missing ⚠️
process/core/solver/constraints.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4665      +/-   ##
==========================================
- Coverage   49.96%   49.91%   -0.06%     
==========================================
  Files         151      151              
  Lines       30127    30178      +51     
==========================================
+ Hits        15054    15063       +9     
- Misses      15073    15115      +42     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chris-ashe
chris-ashe force-pushed the fix_rad_core_edge_split branch from 394df47 to ba19cc7 Compare October 8, 2026 10:19
@chris-ashe
chris-ashe requested a review from grmtrkngtn October 8, 2026 13:47
@chris-ashe
chris-ashe marked this pull request as ready for review October 8, 2026 13:47
@chris-ashe
chris-ashe requested a review from a team as a code owner October 8, 2026 13:47

@grmtrkngtn grmtrkngtn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modelling changes here have been well discussed on #4536, and are fairly straightforward corrections to mistakes in the code. The implementation here looks good with updated variable names particularly useful to avoid future confusion!

@timothy-nunn timothy-nunn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few code quality comments. Happy with code changes if Graeme agrees with the model changes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need these two mappings too

p_plasma_inner_rad_mw -> p_plasma_core_rad_reduced_mw
p_plasma_outer_rad_mw -> p_plasma_edge_rad_mw

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im just wondering if the original entries of these in obsolete vars is wrong as neither of these are input variables

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it will be incorrect then if they cannot be input anymore then they should map to None

Comment thread process/models/physics/impurity_radiation.py Outdated
@timothy-nunn timothy-nunn self-assigned this Oct 9, 2026
…on_loss_profiles and update its functionality to compute plasma volume averaged power density for impurity profiles
…edge_profiles and update its functionality to compute impurity radiation for core and edge profiles
…_radiation_loss_profiles for clarity and efficiency
…sistency and update related calculations across models
…` for consistency and update related calculations in radiation power modules
…ncy across models and update related calculations
…sModel` and update related calculations in the confinement time model for consistency
@chris-ashe
chris-ashe force-pushed the fix_rad_core_edge_split branch from 2a6566f to 5d665e0 Compare October 9, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isnt working Radiation Plasma radiated power

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants