Add cs stress profiles#4160
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4160 +/- ##
==========================================
- Coverage 50.99% 50.93% -0.06%
==========================================
Files 151 151
Lines 29772 29778 +6
==========================================
- Hits 15181 15167 -14
- Misses 14591 14611 +20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
clmould
left a comment
There was a problem hiding this comment.
Could you rebase this please then I'll take a look
26e8acc to
f8b0363
Compare
There was a problem hiding this comment.
Pull request overview
Adds central solenoid midplane axial stress time-profile support, from calculation and mfile output through to plotting in the summary figures.
Changes:
- Adds a new PF coil data-structure variable for the six-point CS axial stress profile.
- Adds stress profile calculation/output logic in the PF/CS coil model.
- Adds a CS stress profile plot and updates the CS summary figure layout.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
process/models/pfcoil.py |
Adds CS stress profile calculation, output, plotting helper, and related imports. |
process/data_structure/pfcoil_variables.py |
Adds and initializes stress_z_cs_self_midplane_profile. |
process/core/io/plot/summary.py |
Adds the new stress plot to the main plotting routine and adjusts CS subplot text/layout. |
Comments suppressed due to low confidence (3)
process/models/pfcoil.py:3556
- This call runs before
PFCoil.pfcoilpopulatespfcoil_variables.c_pf_coil_turnfor the six pulse time points (that happens later inpfcoilaround the waveform generation loop). As a result, the new stress profile is computed from zero or stale per-turn currents rather than the actual time-profile currents, so the mfile values and plot will be wrong. Move this calculation to after the waveform currents are set, or compute it from data that is already initialized here.
self.calculate_cs_self_midplane_axial_stress_time_profile()
process/models/pfcoil.py:2549
- The profile values are stored in pascals (the new data-structure docstring and the existing peak stress output both use Pa), but the mfile description says MPa while writing the unscaled value. This will mislead mfile consumers and makes the plotted conversion ambiguous; either scale the value before writing or label it as Pa.
f"CS coil midplane axial stress at time point {time} (MPa)",
f"(stress_z_cs_self_midplane_profile[{time}])",
pfcoil_variables.stress_z_cs_self_midplane_profile[time],
process/models/pfcoil.py:3784
- The new time-profile calculation is not covered by unit tests, even though the underlying peak axial stress helper has tests in
tests/unit/models/test_pfcoil.py. A test should assert that the profile uses all six CS waveform currents (and would catch the current ordering issue where the profile is computed beforec_pf_coil_turnis populated).
def calculate_cs_self_midplane_axial_stress_time_profile(
self,
) -> None:
for time in range(6):
stress_value, _ = self.calculate_cs_self_peak_midplane_axial_stress(
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from scipy.special import ellipe, ellipk | ||
|
|
||
| import process.core.io.mfile as mf | ||
| import process.models.superconductors as superconductors |
| for time in range(6): | ||
| op.ovarre( | ||
| self.mfile, | ||
| f"CS coil midplane axial stress at time point {time} (MPa)", | ||
| f"(stress_z_cs_self_midplane_profile[{time}])", | ||
| pfcoil_variables.stress_z_cs_self_midplane_profile[time], |
| from process.models.physics.bootstrap_current import BootstrapCurrentFractionModel | ||
| from process.models.pfcoil import CSCoil |
This pull request adds the capability to calculate, store, and visualize the time evolution of the central solenoid (CS) midplane axial stress throughout the machine pulse. The changes include new data structures, calculation logic, output handling, and a plotting function, along with updates to the main plotting routine to display the new stress profile.
Central Solenoid Stress Time Profile Support:
stress_z_cs_self_midplane_profiletopfcoil_variables.pyto store the CS midplane axial stress at each time point, updated initialization, and included it in the module's variable list.CSCoil.calculate_cs_self_midplane_axial_stress_time_profile, and integrated it into the OH coil calculation workflow.Visualization Enhancements:
plot_stress_time_profiletoCSCoilfor plotting the CS midplane axial stress vs. time, including retrieval of relevant timing and stress data from the output file.plot_proc.pyto include the new CS stress time profile plot and reorganized subplot positions for clarity.Imports and Dependencies:
plot_proc.pyandpfcoil.py.Checklist
I confirm that I have completed the following checks: