Skip to content

🧲 Refactor croco 3#4246

Open
chris-ashe wants to merge 46 commits into
mainfrom
refactor_croco_3
Open

🧲 Refactor croco 3#4246
chris-ashe wants to merge 46 commits into
mainfrom
refactor_croco_3

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe commented May 13, 2026

This pull request implements a systematic renaming of several REBCO tape and CroCo cable variable names throughout the codebase to clarify their association with the toroidal field (TF) coil and improve code consistency. It also updates documentation and formulas to match these new conventions, and corrects a geometric formula for the CroCo cable. Additionally, units in docstrings are standardized for clarity.

Variable Renaming for Consistency and Clarity

  • The following variables are renamed everywhere (inputs, data structures, iteration variables, obsolete mapping, plotting, and scan logic) to clarify that they refer to the TF coil:
    • dx_hts_tape_rebcodx_tf_hts_tape_rebco
    • dx_hts_tape_copperdx_tf_hts_tape_copper
    • dx_hts_tape_hastelloydx_tf_hts_tape_hastelloy
    • dx_croco_strand_copperdx_tf_croco_strand_copper
    • dx_hts_tape_totaldx_tf_hts_tape_total
    • dr_hts_tapedr_tf_hts_tape
    • coppera_m2_maxtf_coppera_m2_max
    • oacdcpj_tf_coil_full_area

Documentation and Formula Corrections

  • The formula for the CroCo cable internal diameter is corrected to subtract twice the copper thickness, not just once, matching the physical reality.
  • A new section is added to the TF coil documentation describing cable space dimension calculations and updating the structure of the superconductor properties documentation.

Units and Docstring Standardization

  • Units in docstrings for TF coil variables are updated from [m2] to [m²] for clarity and consistency.

Minor Technical Adjustments

  • The plotting_scripts/2nd_gen_rebco_critical_surface.py script is updated to handle additional return values from the jcrit_rebco function, ensuring compatibility with its latest signature.

These changes collectively improve code clarity, maintainability, and documentation accuracy, especially for users and developers working with TF coil and CroCo cable modeling.## Description

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
Copy link
Copy Markdown

codecov-commenter commented May 13, 2026

Codecov Report

❌ Patch coverage is 30.41237% with 270 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.11%. Comparing base (1dc7a12) to head (9ec6f93).

Files with missing lines Patch % Lines
process/core/io/plot/summary.py 4.46% 107 Missing ⚠️
process/models/tfcoil/resistive.py 2.32% 84 Missing ⚠️
process/models/tfcoil/base.py 3.89% 74 Missing ⚠️
process/core/scan.py 50.00% 1 Missing ⚠️
process/models/pfcoil.py 0.00% 1 Missing ⚠️
process/models/stellarator/coils/calculate.py 0.00% 1 Missing ⚠️
process/models/stellarator/coils/coils.py 0.00% 1 Missing ⚠️
process/models/stellarator/coils/quench.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4246      +/-   ##
==========================================
- Coverage   50.27%   50.11%   -0.16%     
==========================================
  Files         151      151              
  Lines       29386    29705     +319     
==========================================
+ Hits        14773    14886     +113     
- Misses      14613    14819     +206     

☔ 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 added 24 commits May 18, 2026 16:03
…Coil to use averaged turn geometry calculations
…ry object and update related variables in CROCOSuperconductingTFCoil
…geometry for improved cable geometry calculations
- Updated variable names related to HTS tape and CroCo strand in the input variables, iteration variables, and data structures to use the "tf_" prefix for clarity and consistency.
- Adjusted references in the solver, models, and plotting functions to align with the new naming convention.
- Ensured backward compatibility by updating obsolete variable mappings.
- Modified documentation to reflect changes in variable names and their descriptions.
…erties handling in CICCSuperconductingTFCoil
chris-ashe added 21 commits May 18, 2026 16:03
…s and update related calculations in superconductor models
… temperature margin calculation in CICCSuperconductingTFCoil
…l output method for superconducting TF coils
…ding detailed parameter reporting and improving clarity in output structure.
…ove output clarity for quench information in SuperconductingTFCoil.
…g TF coils, enhancing clarity and consistency in dimension reporting.
- Added section headers and separators in output for better readability.
- Consolidated and organized output methods for cable in conduit geometry information.
- Improved clarity of output parameters, including units and descriptions.
- Removed redundant output lines and ensured consistent formatting across all output sections.
- Added detailed reporting for critical current densities and temperature margins.
…clarity and consistency in reporting parameters and geometry.
…onductingTFCoil output methods for improved geometry reporting
@chris-ashe chris-ashe marked this pull request as ready for review May 18, 2026 15:04
@chris-ashe chris-ashe requested a review from a team as a code owner May 18, 2026 15:04
Copilot AI review requested due to automatic review settings May 18, 2026 15:04
@chris-ashe
Copy link
Copy Markdown
Collaborator Author

Bulk of main changes are done. Will get this reviewed and merged in now as it will start to conflict with data class conversion and papercut PR's. Will create breakout issues to iron out the remaining issues

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the superconducting TF coil (CroCo/CICC) output and data flow in process/models/tfcoil/superconducting.py: replaces the multi-tuple return of tf_cable_in_conduit_superconductor_properties with a new TFSuperconductorLimits dataclass, expands SuperconductingTFTurnType with a full_name attribute, splits/extends the output routines, moves e_tf_magnetic_stored_total to tfcoil_variables, and switches CroCo cable geometry consumers to the CroCoCableGeometry dataclass. Tests are updated to consume the new dataclasses and to rename the oacdcp label to j_tf_coil_full_area; the obsolete i_tf_sc_mat parameter is dropped from the averaged turn geometry test cases.

Changes:

  • Introduce TFSuperconductorLimits dataclass and refactor superconductor property return values; add full_name to SuperconductingTFTurnType; restructure output routines (output_general_superconducting_tf_info, etc.).
  • Update CroCo geometry callers/tests to use the CroCoCableGeometry dataclass and the new 4-value return signature of jcrit_rebco.
  • Adjust imports (add divertor_variables, numerics, pfcoil_variables, N_CROCO_STRANDS_TURN, CroCoCableGeometry, calculate_croco_cable_geometry; drop global_variables) and refresh test expectations/labels.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 3 comments.

File Description
process/models/tfcoil/superconducting.py Major refactor: new dataclass, enum extension, output routine reorganisation, and updated imports/return-value plumbing.
tests/unit/models/test_superconductors.py Update tests to consume CroCoCableGeometry dataclass and new 4-tuple return from jcrit_rebco.
tests/unit/models/tfcoil/test_sctfcoil.py Adapt supercon test to TFSuperconductorLimits; remove obsolete i_tf_sc_mat from averaged-turn test params.
tests/unit/models/tfcoil/test_tfcoil.py Rename oacdcp comment label to j_tf_coil_full_area in expectation tuples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -13,14 +13,22 @@
from process.core import process_output as po
from process.core.exceptions import ProcessValueError
from process.data_structure import (
global_variables,
divertor_variables,
Comment on lines +110 to +119
@dataclass
class TFSuperconductorLimits:
j_tf_wp_critical: float
j_superconductor_critical: float
f_c_tf_turn_operating_critical: float
j_superconductor: float
j_tf_coil_turn: float
bc20m: float
tc0m: float
c_turn_cables_critical: float

"""
po.oheadr(self.outfile, "General Superconducting TF Coil Parameters ")
# Turn/WP gemoetry
@chris-ashe chris-ashe requested a review from j-a-foster May 18, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants