♻️ Refactor CS coil stresses#4262
Conversation
11241c9 to
4c3139c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4262 +/- ##
==========================================
+ Coverage 48.79% 48.86% +0.07%
==========================================
Files 151 151
Lines 29339 29474 +135
==========================================
+ Hits 14315 14402 +87
- Misses 15024 15072 +48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
29f4622 to
035b649
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the Central Solenoid (CS) engineering model by introducing clearer CS geometry/turn-geometry data structures, expanding CS-related variables (geometry, stress, temperature), and updating outputs, plotting, and cost calculations to use the new fields.
Changes:
- Refactors CS geometry and EU-DEMO turn geometry routines to return dataclasses and propagates new CS geometry variables through the PF/CS model.
- Replaces legacy CS conductor+void area variable (
awpoh) witha_cs_cable_spaceacross models, costs, and tests; adds CS operating temperature input/variable. - Extends CS plotting and documentation to cover new geometry and stress quantities (including radial/hoop stress profiles and toroidal area).
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/models/test_pfcoil.py | Updates CS-related unit tests for new dataclass returns and updated CS stress/area APIs. |
| tests/unit/models/test_costs_1990.py | Updates cost-model tests to use a_cs_cable_space instead of awpoh. |
| process/models/pfcoil.py | Implements CS dataclasses, new CS stress/geometry fields, updated outputs, and adds CS stress plotting helpers. |
| process/models/costs/costs.py | Switches PF/CS cost calculations from awpoh to a_cs_cable_space. |
| process/data_structure/pfcoil_variables.py | Adds/renames CS data fields (geometry, areas, stress profiles, operating temperature). |
| process/data_structure/build_variables.py | Clarifies CS build-variable docstrings (radial thickness naming). |
| process/core/io/plot/summary.py | Updates summary plotting to include new CS stress subplots and CS toroidal area annotation. |
| process/core/input.py | Adds new input variable temp_cs_superconductor_operating. |
| documentation/source/eng-models/central-solenoid.md | Expands CS documentation with new geometry/stress sections and equations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from dataclasses import dataclass | ||
|
|
||
| import matplotlib.pyplot as plt | ||
| import numba | ||
| import numpy as np | ||
| from scipy import optimize | ||
| from scipy.linalg import svd | ||
| from scipy.special import ellipe, ellipk | ||
|
|
||
| from process.core import constants | ||
| from process.core import process_output as op | ||
| from process.core.exceptions import ProcessValueError | ||
| from process.core.io.mfile import MFile | ||
| from process.core.model import DataStructure, Model |
| def calculate_cs_radial_stress( | ||
| self, | ||
| r_stress_point: float | np.ndarray, | ||
| r_cs_inner: float, | ||
| r_cs_outer: float, | ||
| j_cs: float, | ||
| b_cs_inner: float, | ||
| f_poisson_cs_structure: float, | ||
| ) -> float: |
geograham
left a comment
There was a problem hiding this comment.
A few minor things and worth looking through the copilot suggestions.
e93534e to
058dab8
Compare
timothy-nunn
left a comment
There was a problem hiding this comment.
Please also rebase so the tests can run on the CI
c01e3dd to
91e6f7e
Compare
dfccbf0 to
2f2ce5a
Compare
…wall in FWBSData" This reverts commit 0586a8e.
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
… and stress terms
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
…defined constant from materials module
|
I've just applied a few suggestions to push this through slightly. hope thats ok |
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
clmould
left a comment
There was a problem hiding this comment.
I'm happy now, will approve when Georgie has approved
geograham
left a comment
There was a problem hiding this comment.
Happy for this to go in once it is passing (var name mfile errors in regression tests at the moment).
|
For the variables that are in this PR that are used in future PRs is not really ok. |
|
Regression changes justified, merging ! |
This pull request makes significant improvements to the documentation and data structures for the central solenoid (CS) in the engineering models, as well as updates the plotting and cost calculation code to support new geometry and stress parameters. The main focus is on clarifying and expanding the CS geometry and stress calculations, adding new physical variables, and ensuring these are reflected throughout the codebase and documentation.
Documentation and Model Improvements:
Plotting and Visualization Enhancements:
Cost Model Adjustments:
a_cs_cable_spacevariable instead of the oldawpoh, ensuring consistency with the revised data structure.Documentation and Model Updates
PFCoilDatafor inner/outer radius, upper/lower/middle z locations, toroidal area, steel area, cable space area, bore field, outer midplane field, and detailed stress profiles.BuildDatafor better consistency (e.g., specifying "radial" thickness).temp_cs_superconductor_operatingas a new input and data variable for CS operating temperature.Plotting and Visualization
CSCoilandCsFatiguemodels.Cost Model
a_cs_cable_spacevariable, replacing the deprecatedawpoh.Checklist
I confirm that I have completed the following checks: