Skip to content

♻️ Move 'dcond' variable into SuperconductorModel - #4644

Open
chris-ashe wants to merge 1 commit into
mainfrom
move_dcond_into_enum
Open

chris-ashe wants to merge 1 commit into
mainfrom
move_dcond_into_enum

Conversation

@chris-ashe

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

Copy link
Copy Markdown
Member

This pull request refactors how superconductor material densities are handled throughout the codebase. Instead of using the dcond array for density values, the code now retrieves densities directly from the SuperconductorModel. This change improves maintainability and clarity by centralizing material properties. The update also removes the dcond field from data structures, input definitions, and tests, and updates expected test values to reflect the new density values.

The most important changes are:

Core logic and data structure updates

  • Replaced all usages of the dcond density array for superconductor materials with lookups from SuperconductorModel(...).material.density in all relevant models and calculations, including TF coil, PF coil, and cost models.
  • Removed the dcond field from the TFData data structure and from the input variable definitions.

Superconductor material definition

  • Updated the SuperconductorMaterial enum to include density as a property, and added a density dynamic attribute for direct access.

Test suite updates

  • Removed all references to dcond from test parameter definitions, monkeypatching, and test logic in test_costs_1990.py, test_pfcoil.py, and test_sctfcoil.py.

Test value updates

  • Updated expected values in tests to reflect the new density values from SuperconductorModel, ensuring consistency with the refactored logic.

These changes centralize material properties for superconductors, reduce redundancy, and make the codebase easier to maintain and extend.…eferences

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.

@chris-ashe
chris-ashe requested a review from a team as a code owner October 2, 2026 16:52
@chris-ashe chris-ashe changed the title Refactor: Move 'dcond' variable into SuperconductorModel ♻️ Move 'dcond' variable into SuperconductorModel Oct 2, 2026
@clmould clmould self-assigned this Oct 2, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.98%. Comparing base (c7056b0) to head (666086c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4644   +/-   ##
=======================================
  Coverage   49.97%   49.98%           
=======================================
  Files         151      151           
  Lines       30270    30274    +4     
=======================================
+ Hits        15128    15133    +5     
+ Misses      15142    15141    -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

Copy link
Copy Markdown
Member Author

Can I ask someone from @ukaea/process-model-review to check the new superconductor density values. I feel some of the values before were gravely wrong.

@chris-ashe
chris-ashe requested a review from a team October 2, 2026 17:05
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