Skip to content

🐛 Fix core-edge rad split - #4665

Merged
timothy-nunn merged 29 commits into
mainfrom
fix_rad_core_edge_split
Oct 15, 2026
Merged

timothy-nunn merged 29 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.82883% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.25%. Comparing base (95c71b6) to head (6861474).

Files with missing lines Patch % Lines
process/models/physics/physics.py 0.00% 34 Missing ⚠️
process/models/physics/impurity_radiation.py 12.90% 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   50.31%   50.25%   -0.07%     
==========================================
  Files         181      181              
  Lines       30458    30504      +46     
==========================================
+ Hits        15326    15330       +4     
- Misses      15132    15174      +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
@chris-ashe
chris-ashe force-pushed the fix_rad_core_edge_split branch from 2a6566f to 5d665e0 Compare October 9, 2026 13:14
@chris-ashe
chris-ashe requested a review from kj5248 October 12, 2026 15:42
@timothy-nunn

Copy link
Copy Markdown
Collaborator

Sorry @grmtrkngtn can I just request a final review from you since the force push I cannot see what has been updated since you approved.

@kj5248 kj5248 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.

Couple of comments and questions. Mainly just do you not thing the variable names should be reduced_core to make more sense alongside the case REDUCED_CORE? I'll then review again and test it

Comment thread process/models/physics/confinement_time.py Outdated
Comment thread process/models/physics/confinement_time.py
Comment thread process/models/physics/confinement_time.py
Comment thread process/data_structure/physics_variables.py
Comment thread process/data_structure/physics_variables.py Outdated
Comment thread process/data_structure/physics_variables.py
Comment thread process/models/physics/impurity_radiation.py
Comment thread process/models/physics/impurity_radiation.py
Comment thread process/models/physics/impurity_radiation.py Outdated
@chris-ashe

Copy link
Copy Markdown
Member Author

@kj5248 For the name ordering of pden_plasma_core_rad_reduced_vol_avg_mw, the ordering follows that in the style guide where the definition of the system in question comes first before the quantity in question. So in this case we have specified a variable for the power density of something in the plasma_core. https://ukaea.github.io/PROCESS/development/standards/#variables

@chris-ashe
chris-ashe requested a review from kj5248 October 14, 2026 09:45

@kj5248 kj5248 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.

All seems good to me now

chris-ashe and others added 20 commits October 14, 2026 15:56
…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
…e related calculations across multiple modules for consistency
Co-authored-by: Jonathan Matthews <115085094+kj5248@users.noreply.github.com>
…return statement and removing unnecessary masking logic
… handling for temperature profiles in interpolation
@chris-ashe
chris-ashe force-pushed the fix_rad_core_edge_split branch from f8f73b3 to 4d9adc5 Compare October 14, 2026 15:00
@timothy-nunn
timothy-nunn merged commit 3cc7994 into main Oct 15, 2026
8 of 11 checks passed
@timothy-nunn
timothy-nunn deleted the fix_rad_core_edge_split branch October 15, 2026 09:01
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.

5 participants