📐 Add blkt and divertor poloidal angles#4207
Conversation
Co-authored-by: Copilot <copilot@github.com>
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>
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 Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <copilot@github.com>
… mark it as deprecated Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
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_singleduring 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.
| dv.deg_div_poloidal_plasma = self.single_divertor_angle | ||
| fwbs.f_ster_div_single = dv.deg_div_poloidal_plasma / 360.0 | ||
|
|
| blanket poloidal angle, divided by 2 (for two divertors). | ||
| """ | ||
| return (180.0 - blanket_library.deg_blkt_inboard_poloidal_plasma) / 2.0 | ||
|
|
| self.blkt_outboard_poloidal_plasma_angle | ||
| ) | ||
| blanket_vars.f_deg_blkt_outboard_poloidal_plasma = ( | ||
| self.f_deg_blkt_outboard_poloidal_plasma |
| self.blkt_outboard_poloidal_plasma_angle | ||
| ) | ||
| blanket_vars.f_deg_blkt_outboard_poloidal_plasma = ( | ||
| self.f_deg_blkt_outboard_poloidal_plasma |
| @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, |
timothy-nunn
left a comment
There was a problem hiding this comment.
Happy with the code. Will await a technical review from Jack. A couple of questions below.
| @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 |
There was a problem hiding this comment.
Do we not calculate this (yet)?
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
Is it not possible to get these from the MFILE? If not, should these variables be added?
There was a problem hiding this comment.
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
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_singleis 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:
blanket_library.pyanddivertor_variables.pyto store outboard/inboard blanket poloidal angles, their fractions, and divertor poloidal angle.BlanketLibrary, and for the divertor angle in the divertor model, referencing the blanket geometry.Integration into model execution:
hcpb.pyanddivertor.pyto set the new angle variables during model runs, ensuring these values are available for output and further calculations.Enhanced output and visualization:
plot_blkt_structurefunction 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:
✍🏻 Plotting outputs
Large tokamak
ST
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: