Skip to content

Create specific turn tf classes#4152

Open
chris-ashe wants to merge 8 commits intomainfrom
create_specific_turn_tf_classes
Open

Create specific turn tf classes#4152
chris-ashe wants to merge 8 commits intomainfrom
create_specific_turn_tf_classes

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe commented Mar 30, 2026

This pull request introduces support for multiple toroidal field (TF) coil superconductor turn geometry types by refactoring the codebase to use specific model classes for each geometry and updating the data structure and input handling accordingly. The changes also add new input variables, update the main process flow, and extend the test suite to cover the new model classes.

The most important changes are:

Core Model and Process Flow Updates:

  • Refactored the TF coil superconductor model logic in caller.py and output.py to select and run/output the appropriate model (CICCSuperconductingTFCoil or CROCOSuperconductingTFCoil) based on the new i_tf_turn_type variable, instead of always using the generic SuperconductingTFCoil model.
  • Updated main.py to instantiate and store the new turn-type-specific model classes (CICCSuperconductingTFCoil, CROCOSuperconductingTFCoil) in the Models class.

Input and Data Structure Enhancements:

  • Added the i_tf_turn_type variable to superconducting_tf_coil_variables.py and registered it as an input variable, allowing users to select the TF coil turn geometry type. Set a default value in the initialization function.
  • Updated the base TF coil output to include the new turn type variable in the output file.

Testing Improvements:

  • Added fixtures for the new model classes in the test suite and updated relevant tests to use the new CICCSuperconductingTFCoil class instead of the generic SuperconductingTFCoil, ensuring coverage of the refactored logic.

Imports and Code Organization:

  • Updated imports in several files to reference the new model classes and the SuperconductingTFTurnType enum where appropriate.

These changes collectively improve the flexibility and maintainability of the TF coil modeling code by supporting multiple turn geometries and ensuring the correct model is used throughout the process.

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 TF Coil Toroidal field coil Refactor labels Mar 30, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 47.05882% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.96%. Comparing base (5960a7f) to head (b023ab3).

Files with missing lines Patch % Lines
process/core/caller.py 20.00% 4 Missing ⚠️
process/core/output.py 20.00% 4 Missing ⚠️
process/models/tfcoil/base.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4152      +/-   ##
==========================================
- Coverage   48.02%   47.96%   -0.07%     
==========================================
  Files         143      143              
  Lines       30088    30185      +97     
==========================================
+ Hits        14451    14477      +26     
- Misses      15637    15708      +71     

☔ View full report in Codecov by Sentry.
📢 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 create_specific_turn_tf_classes branch from 3473018 to b023ab3 Compare March 31, 2026 09:20
@chris-ashe chris-ashe marked this pull request as ready for review March 31, 2026 09:20
@chris-ashe chris-ashe requested a review from a team as a code owner March 31, 2026 09:20
@je-cook je-cook self-assigned this Mar 31, 2026
Copy link
Copy Markdown
Collaborator

@je-cook je-cook left a comment

Choose a reason for hiding this comment

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

I'm not a huge fan of the large number of float returns in this. It would be preferable to return a dataclass so the variable names are propagated and hard coded so most variable name order issues are avoided eg superconducting_tf_case_geometry and others. Obviously this would need to be then fed through. Rough metric >= 5 float outputs probably should be dataclass.

output: bool

"""
self.iprint = 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.

I dont think iprint does anything anymore

Comment on lines +2762 to +2763
def __init__(self):
super().__init__()
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 does nothing

Suggested change
def __init__(self):
super().__init__()

)
== SuperconductingTFTurnType.CABLE_IN_CONDUIT
):
self.models.cicc_sctfcoil.run()
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 dont know whether this should be organised differently in future eg self.models.sctfcoil.cicc.run().

this if check would then be moved into some sctfcoil object. Right know I'm not going to hold this up but before we add a future cable design we have to reoganise this. I'm not yet sure what that will look like.

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

Labels

Refactor TF Coil Toroidal field coil

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants