Skip to content

📐 Add blkt and divertor poloidal angles#4207

Open
chris-ashe wants to merge 17 commits intomainfrom
add_blkt_poloidal_angles
Open

📐 Add blkt and divertor poloidal angles#4207
chris-ashe wants to merge 17 commits intomainfrom
add_blkt_poloidal_angles

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe commented Apr 28, 2026

This pull request introduces new calculations and visualizations for the poloidal angles subtended by the outboard and inboard blankets, as well as the divertor, in the plasma cross-section plots. It adds new variables to store these angles and their fractions, integrates their calculation into the blanket and divertor models, and updates plotting and output routines to display these geometric relationships.

The main change is that f_ster_div_single is no longer an input and is calculated from the geometry. This is a necessary step in having seperate blankets and divertors as the specific flux to each component can now be calculated so they can have their own cooling requirements.

New blanket and divertor angle calculations and variables:

  • Added variables to blanket_library.py and divertor_variables.py to store outboard/inboard blanket poloidal angles, their fractions, and divertor poloidal angle.
  • Implemented calculation methods for outboard/inboard blanket poloidal angles and their fractions in BlanketLibrary, and for the divertor angle in the divertor model, referencing the blanket geometry.

Integration into model execution:

  • Updated hcpb.py and divertor.py to set the new angle variables during model runs, ensuring these values are available for output and further calculations.

Enhanced output and visualization:

  • Modified output routines to write the new angle variables and their fractions to output files for both blanket and divertor.
  • Significantly improved the plot_blkt_structure function to display the blanket and divertor angles visually, including annotated arcs, arrows, and info boxes for each angle on the cross-section plot.

Data initialization and test updates:

  • Updated initialization routines to handle new variables and set default values.
  • Minor test import update to reflect new class usage.

✍🏻 Plotting outputs

Large tokamak

image

ST

image

These changes improve the geometric fidelity of the model and enhance the clarity of output visualizations, making it easier to interpret the physical relationships between the plasma, blankets, and divertor.

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 and others added 13 commits April 28, 2026 09:42
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…ations

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…ed by plasma

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…ded by plasma

Co-authored-by: Copilot <copilot@github.com>
…plasma

Co-authored-by: Copilot <copilot@github.com>
…n structure plot

Co-authored-by: Copilot <copilot@github.com>
…for outboard, inboard, and divertor angles

Co-authored-by: Copilot <copilot@github.com>
…dal angle

Co-authored-by: Copilot <copilot@github.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 22.58065% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.99%. Comparing base (25b9f07) to head (d5eb5b7).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
process/core/io/plot/summary.py 0.00% 76 Missing ⚠️
process/models/blankets/blanket_library.py 52.94% 8 Missing ⚠️
process/models/blankets/dcll.py 20.00% 4 Missing ⚠️
process/models/blankets/hcpb.py 0.00% 4 Missing ⚠️
process/models/divertor.py 50.00% 3 Missing ⚠️
process/models/physics/physics.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4207      +/-   ##
==========================================
- Coverage   52.10%   51.99%   -0.12%     
==========================================
  Files         148      148              
  Lines       30389    30511     +122     
==========================================
+ Hits        15835    15863      +28     
- Misses      14554    14648      +94     

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

Co-authored-by: Copilot <copilot@github.com>
@chris-ashe chris-ashe marked this pull request as ready for review May 5, 2026 12:55
@chris-ashe chris-ashe requested a review from a team as a code owner May 5, 2026 12:55
Copilot AI review requested due to automatic review settings May 5, 2026 12:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new geometry-derived poloidal angle metrics for the inboard/outboard blankets and divertor, propagates them into model runs and outputs, and enhances the blanket cross-section plotting to visualize these angles and their fractions. It also removes f_ster_div_single as an input in favor of computing it from geometry.

Changes:

  • Introduces new data-structure variables for blanket/divertor poloidal angles and their fractions, and writes them to output.
  • Computes and sets blanket angle variables during blanket model runs; computes divertor angle and derives f_ster_div_single during divertor runs.
  • Updates summary plotting to annotate blanket/divertor poloidal angles on the cross-section plot; adds a unit test for the inboard blanket angle calculation.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/unit/models/blankets/test_blanket_library.py Adds a parametrized unit test for the inboard blanket poloidal angle calculation and updates imports.
process/models/physics/physics.py Outputs the new divertor poloidal angle variable.
process/models/divertor.py Computes divertor poloidal angle and derives f_ster_div_single from geometry.
process/models/blankets/hcpb.py Sets new blanket angle variables during HCPB runs.
process/models/blankets/dcll.py Sets new blanket angle variables during DCLL runs.
process/models/blankets/blanket_library.py Adds new blanket angle outputs and introduces outboard/inboard angle calculation helpers.
process/data_structure/divertor_variables.py Adds and initializes deg_div_poloidal_plasma.
process/data_structure/blanket_library.py Adds and initializes blanket angle variables and their fractions.
process/core/io/plot/summary.py Enhances plot_blkt_structure to visualize and label blanket/divertor angles and fractions.
process/core/io/obsolete_vars.py Marks f_ster_div_single as obsolete.
process/core/input.py Removes f_ster_div_single from the set of input variables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +44
dv.deg_div_poloidal_plasma = self.single_divertor_angle
fwbs.f_ster_div_single = dv.deg_div_poloidal_plasma / 360.0

Comment on lines +100 to +103
blanket poloidal angle, divided by 2 (for two divertors).
"""
return (180.0 - blanket_library.deg_blkt_inboard_poloidal_plasma) / 2.0

Comment on lines +57 to +60
self.blkt_outboard_poloidal_plasma_angle
)
blanket_vars.f_deg_blkt_outboard_poloidal_plasma = (
self.f_deg_blkt_outboard_poloidal_plasma
Comment on lines +101 to +104
self.blkt_outboard_poloidal_plasma_angle
)
blanket_vars.f_deg_blkt_outboard_poloidal_plasma = (
self.f_deg_blkt_outboard_poloidal_plasma
Comment on lines +3705 to +3713
@property
def blkt_outboard_poloidal_plasma_angle(self) -> float:
"""Calculate the poloidal angle subtended by the outboard blanket at the plasma mid-plane."""
return 180.0

@property
def f_deg_blkt_outboard_poloidal_plasma(self) -> float:
"""Calculate the poloidal angle subtended by the outboard blanket at the plasma mid-plane."""
return self.blkt_outboard_poloidal_plasma_angle / 360.0
"vcool": "vel_cp_coolant_midplane",
"rcool": "radius_cp_coolant_channel",
"fl_h_threshold": None,
"f_ster_div_single": None,
@chris-ashe chris-ashe requested a review from j-a-foster May 5, 2026 13:59
@timothy-nunn timothy-nunn self-assigned this May 5, 2026
Copy link
Copy Markdown
Collaborator

@timothy-nunn timothy-nunn 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 code. Will await a technical review from Jack. A couple of questions below.

Comment on lines +3705 to +3708
@property
def blkt_outboard_poloidal_plasma_angle(self) -> float:
"""Calculate the poloidal angle subtended by the outboard blanket at the plasma mid-plane."""
return 180.0
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.

Do we not calculate this (yet)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We assume 180 degrees at the moment due to the geometry. As this will be used for power deposition assuming an isotropic ring source what we should really do is approximate the shafranov shift and add that to rmajor. We can then use the magnetic axis as the source. This will cause the outboard angle to be greater than 180 degrees

Comment on lines +13783 to +13790
r_blkt_outboard_out = (
rmajor + rminor + dr_fw_outboard + dr_fw_plasma_gap_outboard + dr_blkt_outboard
)
r_blkt_inboard_in = (
rmajor - rminor - dr_fw_plasma_gap_inboard - dr_fw_inboard - dr_blkt_inboard
)
r_fw_outboard_in = r_blkt_outboard_out - dr_blkt_outboard - dr_fw_outboard
r_fw_inboard_out = r_blkt_inboard_in + dr_blkt_inboard + dr_fw_inboard
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.

Is it not possible to get these from the MFILE? If not, should these variables be added?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is similar to what Matti raised. We output the radial build but that is just the left edge. The confusing bit is that the left edge is one is the right edge of the other.I have kept the naming here explicit. What we really need is a full build output object that stores the left, middle and right of each component and can be easily called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants