Skip to content

Add new quench protection constraint - #4518

Open
ajpearcey wants to merge 3 commits into
mainfrom
new-mag-constraints
Open

ajpearcey wants to merge 3 commits into
mainfrom
new-mag-constraints

Conversation

@ajpearcey

Copy link
Copy Markdown
Collaborator

Adds new quench protection metric.

@ajpearcey ajpearcey self-assigned this Aug 13, 2026
@ajpearcey
ajpearcey requested a review from a team as a code owner August 13, 2026 10:12
@ajpearcey ajpearcey added the TF Coil Toroidal field coil label Aug 13, 2026
@codecov-commenter

codecov-commenter commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.00%. Comparing base (5d2d7d5) to head (fb18553).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4518      +/-   ##
==========================================
+ Coverage   49.99%   50.00%   +0.01%     
==========================================
  Files         151      151              
  Lines       29916    29921       +5     
==========================================
+ Hits        14956    14962       +6     
+ Misses      14960    14959       -1     

☔ 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 self-requested a review August 13, 2026 13:23

@chris-ashe chris-ashe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few things about understanding of the constraint. Alot of the calcs need to be put into the specific TF configuration class

)


@ConstraintManager.register_constraint(93, "GJ/m3", ">=")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this not be <= as it places an upper limit on the stored energy to copper ratio?

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.

Sure, but it is expressed in this constraint as Vol_Cu >= stored energy. I think this is just down to how you want to write the constraint.

)


@ConstraintManager.register_constraint(93, "GJ/m3", ">=")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
@ConstraintManager.register_constraint(93, "GJ/m3", ">=")
@ConstraintManager.register_constraint(93, "GJ/", ">=")

e_tf_magnetic_stored_total_gj: Total stored energy in TF coils (GJ)
magnetic_stored_energy_copper_vol_ratio: TF coil stored energy to copper volume ratio
"""
vol_tf_copper = (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This value is going to be wildly different depending on what type of turn is used. f_a_tf_turn_cable_copper only represents the area fraction of copper in a superconducting strand in CICC configuration.

"""
vol_tf_copper = (
data.tfcoil.f_a_tf_turn_cable_copper
* data.superconducting_tfcoil.dr_tf_turn

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a_tf_turn could just be used here

Comment thread process/core/init.py
"The TF coil WP thickness (dr_tf_wp_with_insulation) must be at least",
dr_tf_wp_min=dr_tf_wp_min,
)
#if data.numerics.boundl[140] < dr_tf_wp_min:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Accidentally commented out?

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.

I did comment this out, but I have a suspicion this just wrong. The original code checks agains ixc = 139, which is dx_tf_hts_tape_copper this doesn't match the error message or make sense why it would be checked. Also why check the lower bound? Whereas ixc = 140 is dr_tf_wp_with_insulation.

I.e. p_l_h_threshold_mw / p_plasma_separatrix_mw >= f_l_mode_margin
"""

magnetic_stored_energy_copper_vol_ratio: float = 0.25

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am unsure about the definition of this and it doesn't follow the style guide. Does this mean 0.25 GJ of stored energy per 1 m^3 of copper in the TF coil is the upper limit?

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.

The otherway the ratio is the copper volume divided by stored energy.

Comment thread .gitignore

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 tend to try and avoid personalised edits to the .gitignore as this makes it long and confusing

"""

magnetic_stored_energy_copper_vol_ratio: float = 0.25
"""TF coil stored energy to copper volume ratio (`constraint equation 93`) """

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.

Can we comment the units here, even if it is dimensionless [-]

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.

will add [m3/GJ]

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.

4 participants