Skip to content

🧲 Add toroidal beta and field profile output#3946

Merged
clmould merged 9 commits intomainfrom
add_toroidal_beta_and_field_profile_output
Oct 24, 2025
Merged

🧲 Add toroidal beta and field profile output#3946
clmould merged 9 commits intomainfrom
add_toroidal_beta_and_field_profile_output

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe commented Oct 21, 2025

This pull request adds new plasma physics profile variables and corresponding plotting capabilities, enhancing the ability to visualize and analyze spatial variations of key plasma parameters. The main changes include the introduction and calculation of toroidal magnetic field and thermal beta profiles across the plasma, updates to the data structure to support these profiles, and new plotting functions to visualize them. Additionally, existing pressure profile handling has been refactored for clarity and consistency.

❇️ New variables

  • b_plasma_toroidal_profile
  • beta_thermal_toroidal_profile

Physics variable enhancements:

  • In the physics calculation routine, the toroidal magnetic field profile is now computed across the plasma using a 1/R dependence, and the inboard/outboard values are explicitly calculated. The thermal beta profile is also computed using mirrored pressure profiles to match the doubled spatial resolution.

Plotting improvements:

  • Added two new plotting functions in plot_proc.py: plot_magnetic_fields_in_plasma (visualizes the toroidal magnetic field profile and key values across the plasma radius) and plot_beta_profiles (plots the thermal beta profile and its volume-averaged value).
  • Integrated these new plots into the main plotting workflow, allocating a new figure for them and ensuring they are included in the generated PDF and closed at the end.

Pressure profile refactor:

  • Renamed and updated the pressure profile variable from pres_plasma_total_profile to pres_plasma_thermal_total_profile throughout the codebase for clarity. All relevant plotting and initialization code has been updated to use the new variable.

Figure management updates:

  • Adjusted figure and subplot assignments in the main plotting routine to accommodate the new plots and maintain layout consistency.
image

These changes improve the code's ability to model, analyze, and visualize detailed spatial profiles of important plasma physics quantities, supporting deeper analysis and improved presentation of simulation results.

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 Oct 21, 2025
@chris-ashe chris-ashe added Physics Relating to the physics models Input/Output Files Issues related to the input and output data files labels Oct 21, 2025
@chris-ashe chris-ashe force-pushed the add_toroidal_beta_and_field_profile_output branch from b158790 to dd8493e Compare October 21, 2025 14:30
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 18.75000% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.01%. Comparing base (45ac7e9) to head (43cb57f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
process/io/plot_proc.py 3.07% 63 Missing ⚠️
process/physics.py 6.25% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3946      +/-   ##
==========================================
- Coverage   46.06%   46.01%   -0.05%     
==========================================
  Files         123      123              
  Lines       28465    28541      +76     
==========================================
+ Hits        13112    13134      +22     
- Misses      15353    15407      +54     

☔ 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.

…ot_proc.py; update physics.py to calculate and store toroidal beta profile
@chris-ashe chris-ashe force-pushed the add_toroidal_beta_and_field_profile_output branch from dd8493e to 2793925 Compare October 21, 2025 14:42
@chris-ashe chris-ashe marked this pull request as ready for review October 21, 2025 15:09
@chris-ashe chris-ashe force-pushed the add_toroidal_beta_and_field_profile_output branch from acd8d0d to 317566f Compare October 22, 2025 07:56
… in physics_variables.py, update related references in plot_proc.py and physics.py
@chris-ashe chris-ashe force-pushed the add_toroidal_beta_and_field_profile_output branch from 317566f to 43cb57f Compare October 22, 2025 09:27
Copy link
Copy Markdown
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 code and plot proc changes.

@clmould clmould merged commit 7621ab1 into main Oct 24, 2025
14 of 18 checks passed
@je-cook je-cook deleted the add_toroidal_beta_and_field_profile_output branch January 5, 2026 15:06
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 New Variables Physics Relating to the physics models Variable rename

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants