Skip to content

Add CS Tresca and 2D contour plots#4325

Open
chris-ashe wants to merge 28 commits into
mainfrom
add_cs_tresca_plot
Open

Add CS Tresca and 2D contour plots#4325
chris-ashe wants to merge 28 commits into
mainfrom
add_cs_tresca_plot

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

This pull request makes significant improvements to the central solenoid (CS) stress modeling, variable naming consistency, and documentation. The main changes include refactoring variable names for clarity, adding new stress calculation methods (Tresca and von Mises), expanding the CS stress data model, and updating documentation to match the new, more general approach to CS stress calculations.

Central Solenoid Stress Modeling and Calculations:

  • Added new functions for calculating Tresca (maximum shear) and von Mises stresses to materials.py, enabling more comprehensive CS stress analysis.
  • Expanded the PFCoilData class to include vertical profiles of axial stress, radial stress (peak and inner), and von Mises stress for the central solenoid.
  • Updated the CS stress output to use new variable names and removed the i_cs_stress switch, reflecting a shift to always considering both hoop and axial stresses.

Variable Naming Consistency and Refactoring:

  • Renamed the variable alstroh to stress_cs_steel_max throughout the codebase, input files, and documentation for clarity and consistency.
  • Updated obsolete variable mapping to reflect the renaming and to ensure backward compatibility.

Documentation Updates:

  • Overhauled the central solenoid stress documentation to provide a more general axial stress formula, clarify the meaning of variables, and add a new section for peak axial stress.
  • Removed outdated explanations and references to the old i_cs_stress switch and clarified the use of Tresca and von Mises criteria.

These changes modernize the CS stress model, improve clarity for users and developers, and lay the groundwork for more advanced stress analysis and postprocessing.

image

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.

@codecov-commenter

codecov-commenter commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.08511% with 231 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.61%. Comparing base (64185b0) to head (97eee5a).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
process/core/io/plot/summary.py 3.41% 226 Missing ⚠️
process/models/pfcoil.py 83.87% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4325      +/-   ##
==========================================
- Coverage   48.82%   48.61%   -0.22%     
==========================================
  Files         151      151              
  Lines       29405    29642     +237     
==========================================
+ Hits        14358    14409      +51     
- Misses      15047    15233     +186     

☔ View full report in Codecov by Harness.
📢 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.

…Solenoid stress variables across multiple files
…Solenoid stress variables across multiple data files
…profile and enhancing radial stress profile visualization
@chris-ashe chris-ashe force-pushed the add_cs_tresca_plot branch from f85f77d to f4de71f Compare June 23, 2026 12:17
@chris-ashe chris-ashe marked this pull request as ready for review June 23, 2026 15:26
@chris-ashe chris-ashe requested a review from a team as a code owner June 23, 2026 15:26
@chris-ashe chris-ashe requested a review from timothy-nunn June 26, 2026 10:21
@timothy-nunn timothy-nunn self-assigned this Jun 30, 2026
@chris-ashe chris-ashe requested a review from j-a-foster June 30, 2026 09:17

@timothy-nunn timothy-nunn left a comment

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.

Will await Jack's review on model and docs changes and figure correctness before further review.

Comment thread process/core/io/obsolete_vars.py
Comment thread process/core/io/obsolete_vars.py
Comment thread process/models/pfcoil.py Outdated
Comment thread process/models/pfcoil.py
np.linspace(
-self.data.pf_coil.z_cs_upper,
self.data.pf_coil.z_cs_upper,
num=20,

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.

Again, is this 20 related to the profile length? If it is, and the profile length could change in future, its probably best to use the length of the profile array here

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.

There is no profile object at the moment it is just a initial generic number

Comment thread process/models/pfcoil.py Outdated
Comment thread process/core/io/plot/summary.py
"W_",
]
lzdata = [0.0 for x in range(len(label))]
_ = _skiprows

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.

This statement doesn't make any sense

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.

Can you check the sanity of this, I cant remember when it went in. _skiprows is currently passed in as an argument.

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.

Well the statement is not doing anything so there is nothing to check. Its assigning _skiprows to a variable called _... but neither of these variables are being used, and if they are the name needs to be updated.

@j-a-foster j-a-foster left a comment

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.

Happy with docs and model.

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

@timothy-nunn timothy-nunn left a comment

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.

I still think that the 20 should only be hardcoded in one location. So where it is used outside of pfcoil_variables.py just use stress_z_cs_self_profile.shape[0].

Comment thread process/core/io/plot/summary.py Outdated
Comment on lines +12809 to +12812
dt_grid, _, _ = interp1d_profile(fusrat_plasma_dt_profile, mfile, scan)

dd_triton_grid, _r_grid, _z_grid = interp1d_profile(
fusrat_plasma_dd_triton_profile, mfile, scan
)
dd_helion_grid, _r_grid, _z_grid = interp1d_profile(
fusrat_plasma_dd_helion_profile, mfile, scan
)
dd_triton_grid, _, _ = interp1d_profile(fusrat_plasma_dd_triton_profile, mfile, scan)
dd_helion_grid, _, _ = interp1d_profile(fusrat_plasma_dd_helion_profile, mfile, scan)

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.

Suggested change
dt_grid, _, _ = interp1d_profile(fusrat_plasma_dt_profile, mfile, scan)
dd_triton_grid, _r_grid, _z_grid = interp1d_profile(
fusrat_plasma_dd_triton_profile, mfile, scan
)
dd_helion_grid, _r_grid, _z_grid = interp1d_profile(
fusrat_plasma_dd_helion_profile, mfile, scan
)
dd_triton_grid, _, _ = interp1d_profile(fusrat_plasma_dd_triton_profile, mfile, scan)
dd_helion_grid, _, _ = interp1d_profile(fusrat_plasma_dd_helion_profile, mfile, scan)
dt_grid, _r_grid, _z_grid = interp1d_profile(fusrat_plasma_dt_profile, mfile, scan)
dd_triton_grid, _r_grid, _z_grid = interp1d_profile(fusrat_plasma_dd_triton_profile, mfile, scan)
dd_helion_grid, _r_grid, _z_grid = interp1d_profile(fusrat_plasma_dd_helion_profile, mfile, scan)

Again, might be quite useful

@timothy-nunn

Copy link
Copy Markdown
Collaborator

On Mac I am also getting some of the plots overlapping and cutting of the annotations. Could you try and enforce some gap between the figures to ensure all plots are usable

image

Comment thread process/models/pfcoil.py Outdated
chris-ashe and others added 2 commits July 9, 2026 09:04
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
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