Skip to content

Conversation

@chris-ashe
Copy link
Collaborator

@chris-ashe chris-ashe commented Sep 8, 2025

This pull request introduces fusion reaction rate profile tracking for multiple fusion channels and adds a new plotting function to visualize these profiles and their corresponding fusion power. The changes span data structure updates, calculation logic, and plotting enhancements, resulting in improved diagnostics and visualization of fusion rates and power across the plasma radius.

❇️ New variables

fusrat_plasma_dt_profile
fusrat_plasma_dd_helion_profile
fusrat_plasma_dhe3_profile
fusrat_plasma_dd_triton_profile

🎨 New output

image

Fusion Reaction Rate Profile Tracking and Visualization

Data Structure and Initialization:

  • Added new variables to physics_variables.py to store plasma fusion reaction rate profiles for D-T, D-D (triton and helion branches), and D-3He channels, along with their initialization in init_physics_variables() and default values.
    Fusion Rate Profile Calculation:
  • Each fusion reaction (D-T, D-D triton, D-D helion, D-3He) now computes and stores its radial fusion rate profile in the corresponding variable using the Bosch-Hale reactivity and plasma profiles.
    Plotting Enhancements:
  • Implemented plot_fusion_rate_profiles() in plot_proc.py to visualize fusion rate and fusion power profiles for all channels, with detailed annotations and legends for diagnostics.
  • Integrated the new plot into the main plotting routine and output PDF, including figure creation, subplot assignment, and proper closing of resources.

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 self-assigned this Sep 8, 2025
@chris-ashe chris-ashe added the Input/Output Files Issues related to the input and output data files label Sep 8, 2025
@chris-ashe chris-ashe force-pushed the fusion_reaction_profile_plot_proc branch from 396f3b1 to 1a3216a Compare September 8, 2025 12:35
@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 10.05291% with 170 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.77%. Comparing base (68d8058) to head (2a0fef5).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
process/io/plot_proc.py 1.96% 150 Missing ⚠️
process/physics.py 5.88% 16 Missing ⚠️
process/fusion_reactions.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3827      +/-   ##
==========================================
- Coverage   46.67%   44.77%   -1.91%     
==========================================
  Files         122      122              
  Lines       27804    30481    +2677     
==========================================
+ Hits        12977    13647     +670     
- Misses      14827    16834    +2007     

☔ View full report in Codecov by Sentry.
📢 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 fusion_reaction_profile_plot_proc branch from 77f6a09 to 1a3216a Compare September 8, 2025 13:35
@chris-ashe chris-ashe force-pushed the fusion_reaction_profile_plot_proc branch 2 times, most recently from 201e26b to b06daf7 Compare September 16, 2025 13:40
@chris-ashe chris-ashe marked this pull request as ready for review September 16, 2025 13:40
@chris-ashe chris-ashe force-pushed the fusion_reaction_profile_plot_proc branch from b06daf7 to 3d61ceb Compare September 16, 2025 13:45

plot_33 = fig17.add_subplot(111, aspect="equal")
plot_main_power_flow(plot_33, m_file_data, scan, fig17)
plot_33 = fig18.add_subplot(111, aspect="equal")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like all these hardcoded numbers that need moving around. Fine here, but can you make an issue to turn this into a list?

@jonmaddock
Copy link
Contributor

Seems like regression tests are failing due to request limits. Can you re-run or talk to Tim about how we can work around these?

Copy link
Collaborator

@j-a-foster j-a-foster left a comment

Choose a reason for hiding this comment

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

Happy with the changes.

@timothy-nunn timothy-nunn merged commit be122e7 into main Sep 23, 2025
21 of 27 checks passed
@timothy-nunn timothy-nunn deleted the fusion_reaction_profile_plot_proc branch September 23, 2025 13:03
ym1906 pushed a commit that referenced this pull request Oct 10, 2025
* ❇️ Add fusion reaction rate profile variable for D-T plasma, fusrat_plasma_dt_profile

* Add fusion rate profile plotting and data handling for D-T plasma

* ❇️ Add fusion reaction rate profile variable for D-T plasma, fusrat_plasma_dd_triton_profile

* ❇️ Add fusion reaction rate profile variable for D-D plasma, fusrat_plasma_dd_helion_profile

* Add D-D and D-T fusion rate profile calculations and plotting

* ❇️ Add D-3He fusion reaction rate profile variable and update initialization

* ❇️ Add D-3He fusion reaction rate profile calculations and plotting

* ❇️ Update plotting functions to include fusion rate profiles and adjust subplot configurations

* Enhance fusion rate profile plotting by adding detailed power and density information for D-T, D-D, D-3He, alpha, and neutron reactions

* Refactor constants usage in plotting and physics modules for consistency

* ♻️ Update fusion reaction calculations to use density profile

* Add total fusion rate profile calculation and plotting to fusion rate profiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Input/Output Files Issues related to the input and output data files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants