Skip to content

STEP TF turn structure - #4643

Open
chris-ashe wants to merge 20 commits into
mainfrom
step_tf_turn_structure_refresh
Open

chris-ashe wants to merge 20 commits into
mainfrom
step_tf_turn_structure_refresh

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Description

This pull request adds support for a new "step-stacked tape" type to the superconducting toroidal field (TF) coil modeling, along with the necessary data fields and model registration. The changes ensure the new coil type is selectable, its parameters are tracked, and its model is properly invoked in the workflow.

Support for Step-Stacked Tape TF Coil:

  • Added STEPSuperconductingTFCoil to the imports and model registration in main.py, and included it in the list of models for execution.
  • Updated the model selection logic in caller.py to call the new step_sctfcoil model when the STEP_STACKED_TAPE turn type is selected.
  • Allowed the new turn type to be selected as input by adding value 3 to the i_tf_turn_type choices in input.py.
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.

@chris-ashe chris-ashe added the TF Coil Toroidal field coil label Oct 2, 2026
@chris-ashe chris-ashe changed the title Step tf turn structure STEP TF turn structure Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

⚠️ improve_quality_job warning!

Files changed by this PR have introduced 5 more linting errors when compared to main

Please fix these

To check what these are, run hatch run lint:fmt_extra on your branch and on main

@chris-ashe
chris-ashe requested a review from ajpearcey October 5, 2026 10:29
@chris-ashe
chris-ashe marked this pull request as ready for review October 5, 2026 10:29
@chris-ashe
chris-ashe requested a review from a team as a code owner October 5, 2026 10:29
@chris-ashe chris-ashe mentioned this pull request Oct 5, 2026
6 tasks
"""Cross-sectional area of the stabiliser in the TF turn [m²]"""

n_tf_turn_superconducting_strands: int = 0.0
"""Number of superconducting strands in the TF turn"""

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.

no units denoted by [-]

# Copper mass [kg]
self.data.tfcoil.m_tf_coil_copper = (
m_tf_coil_copper = (
self.data.tfcoil.len_tf_coil

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.

When itart == 1 include the centre column length cplen is not included in len_tf_coil. This is accounted for else where or is copper the missing?

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 is true of all the masses in section. I can see some if statements for itart == 1. Also is it useful to list, list the copper masses, without the centre rod included? Are the centre rod masses/area calculated as well, we these will be needed for costing or other engineering models.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looking at tf_coil_shape_inner() the len_tf_coil is calculated as itart dependant

@codecov-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.48703% with 92 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.82%. Comparing base (5d135ba) to head (d72c48c).

Files with missing lines Patch % Lines
process/models/tfcoil/superconducting.py 81.53% 53 Missing ⚠️
process/core/io/plot/summary/magnets/tf.py 6.89% 27 Missing ⚠️
process/core/io/plot/summary/api.py 0.00% 8 Missing ⚠️
process/core/caller.py 0.00% 2 Missing ⚠️
process/models/tfcoil/base.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4643      +/-   ##
==========================================
+ Coverage   51.17%   51.82%   +0.64%     
==========================================
  Files         181      181              
  Lines       30426    30747     +321     
==========================================
+ Hits        15571    15934     +363     
+ Misses      14855    14813      -42     

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

@chris-ashe
chris-ashe force-pushed the step_tf_turn_structure_refresh branch 2 times, most recently from e1b992b to 53b6618 Compare November 11, 2026 15:24
@timothy-nunn timothy-nunn self-assigned this Nov 12, 2026
whttflgs = m_tf_coils_total * (self.data.tfcoil.len_tf_coil / tfleng_sph)
else:
whtcp = 0.0
whttflgs = 0.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.

For the coil case you compute the mass with a else statement for the itart where as for the copper, superconductor and insulation you do not. Therefore you will double the mass contribution from the case in the centerpost with this final step.

Also for future work it would be good to also calculate the total copper mass counting for itart.

Also whtcp and whttflgs don't follow the variable style guide and are confusingly named.

whttflgs = m_tf_coils_total * (self.data.tfcoil.len_tf_coil / tfleng_sph)
else:
whtcp = 0.0
whttflgs = 0.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.

Same comment as for the STEP areas and masses function.

…ingTFCoil for accurate critical current calculations
…nboard_peak_ripple_symmetric in SuperconductingTFCoil
…add tf_cicc_areas_and_masses method for improved accuracy
…add tf_step_inboard_areas_and_fractions method for improved accuracy
…erconductingTFCoil to compute superconductor lengths
@chris-ashe
chris-ashe force-pushed the step_tf_turn_structure_refresh branch from 53b6618 to 705092c Compare November 23, 2026 10:16
@ajpearcey
ajpearcey force-pushed the step_tf_turn_structure_refresh branch 2 times, most recently from 430b511 to d72c48c Compare November 23, 2026 15:47
@timothy-nunn

Copy link
Copy Markdown
Collaborator

@chris-ashe @ajpearcey I am a little confused why adding in this turn structure has impacted all of the other regression tests? Are other bugs fixed along the way?

@chris-ashe

Copy link
Copy Markdown
Member Author

@chris-ashe @ajpearcey I am a little confused why adding in this turn structure has impacted all of the other regression tests? Are other bugs fixed along the way?

If you look at line 1490 of superconducting.py you will see that f_b_tf_inboard_peak_ripple_symmetric is now actually set to its default approximation wrather than 0

a[2] = -0.85031e0
a[3] = 0.89808e0
case _:
self.data.superconducting_tfcoil.f_b_tf_inboard_peak_ripple_symmetric = (

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 there not a better place to do this? The rest of the cases do not mutate the data structure.

Also how separate is this? Could it be another PR so that the tests on this branch pass?

Comment on lines +679 to +681
m_file.get("i_tf_turn_type", scan=scan)
== SuperconductingTFTurnType.STEP_STACKED_TAPE
or SuperconductingTFTurnType.CROSS_CONDUCTOR

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
m_file.get("i_tf_turn_type", scan=scan)
== SuperconductingTFTurnType.STEP_STACKED_TAPE
or SuperconductingTFTurnType.CROSS_CONDUCTOR
m_file.get("i_tf_turn_type", scan=scan)
in (SuperconductingTFTurnType.STEP_STACKED_TAPE, SuperconductingTFTurnType.CROSS_CONDUCTOR)

This is a bug at the moment where its doing if (i == j) or k

Comment on lines +3338 to +3339
tfleng_sph = self.data.tfcoil.cplen + self.data.tfcoil.len_tf_coil
whtcp = m_tf_coils_total * (self.data.tfcoil.cplen / tfleng_sph)

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
tfleng_sph = self.data.tfcoil.cplen + self.data.tfcoil.len_tf_coil
whtcp = m_tf_coils_total * (self.data.tfcoil.cplen / tfleng_sph)
tfleng_sph = cplen + self.data.tfcoil.len_tf_coil
whtcp = m_tf_coils_total * (cplen / tfleng_sph)

cplen is a local variable above and has not yet been assigned to the data structure

a_tf_turn=self.data.tfcoil.a_tf_turn,
t_tf_quench_dump=self.data.tfcoil.t_tf_superconductor_quench,
f_a_tf_turn_cable_copper=self.data.tfcoil.f_a_tf_turn_cable_copper,
f_a_tf_turn_cable_space_cooling=d_sc_tf.f_a_tf_turn_cable_space_cooling,

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.

f_a_tf_turn_cable_space_cooling is not set in the STEP case so uses default value

a_tf_turn_cable_space=self.data.tfcoil.a_tf_turn_cable_space_no_void,
a_tf_turn=self.data.tfcoil.a_tf_turn,
t_tf_quench_dump=self.data.tfcoil.t_tf_superconductor_quench,
f_a_tf_turn_cable_copper=self.data.tfcoil.f_a_tf_turn_cable_copper,

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.

f_a_tf_turn_cable_copper does not appear to be set in the STEP case so the default is used

)
d_sc_tf.a_tf_turn_stabiliser = integer_turn_geometry.a_tf_turn_stabiliser

d_sc_tf.dr_tf_hts_tape = (

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 can be input by the user so should we be overwriting it?

Comment on lines +4705 to +4709
self.data.superconducting_tfcoil.n_tf_turn_superconducting_strands = (
self.calculate_stacked_tape_strand_count(
dr_tape_stack=self.data.superconducting_tfcoil.dx_tf_turn_tape_stack,
dr_hts_tape=self.data.superconducting_tfcoil.dx_tf_hts_tape_total,
)

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.

Are these the correct variables to be using? E.g. why not use dr_tf_turn_tape_stack?

a_tf_turn_stabiliser: float = 0.0
"""Cross-sectional area of the stabiliser in the TF turn [m²]"""

n_tf_turn_superconducting_strands: int = 0.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.

Suggested change
n_tf_turn_superconducting_strands: int = 0.0
n_tf_turn_superconducting_strands: int = 0

Typed as int but assigned a float

# Area of inter-turn insulation: total [m²]
a_tf_coil_wp_turn_insulation = n_tf_coil_turns * a_tf_turn_insulation

a_tf_turn_steel = 0.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.

Why take this as an input if you are going to set it to 0?

Comment on lines +4851 to +4852
# Find the current density limited by the protection limit
# At present only valid for LTS windings (Nb3Sn properties assumed)

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
# Find the current density limited by the protection limit
# At present only valid for LTS windings (Nb3Sn properties assumed)
# Find the current density limited by the protection limit
# At present only valid for LTS windings (Nb3Sn properties assumed)

Comment on lines +5528 to +5538
Parameters
----------
n_tf_coils: int :
n_tf_coils: Number of TF coils.
n_tf_coil_turns: int :
n_tf_coil_turns: Total number of turns in the TF coil winding pack.
len_tf_coil:
len_tf_coil: Length of a single TF coil (in meters).
n_tf_turn_superconducting_strands: int :
n_tf_turn_superconducting_strands: Number of superconducting tapes/strands
per turn in the TF coil.

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
Parameters
----------
n_tf_coils: int :
n_tf_coils: Number of TF coils.
n_tf_coil_turns: int :
n_tf_coil_turns: Total number of turns in the TF coil winding pack.
len_tf_coil:
len_tf_coil: Length of a single TF coil (in meters).
n_tf_turn_superconducting_strands: int :
n_tf_turn_superconducting_strands: Number of superconducting tapes/strands
per turn in the TF coil.
Parameters
----------
n_tf_coils:
n_tf_coils: Number of TF coils.
n_tf_coil_turns:
n_tf_coil_turns: Total number of turns in the TF coil winding pack.
len_tf_coil:
len_tf_coil: Length of a single TF coil (in meters).
n_tf_turn_superconducting_strands:
n_tf_turn_superconducting_strands: Number of superconducting tapes/strands
per turn in the TF coil.

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

Labels

TF Coil Toroidal field coil

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants