Add enumeration for first wall and blanket coolant loop types#4210
Add enumeration for first wall and blanket coolant loop types#4210
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a named enumeration for the “shared vs separate” first-wall / blanket primary coolant loop configuration and replaces several hard-coded 0/1 comparisons/assignments with the enum values inside the blanket thermal-hydraulic calculations.
Changes:
- Add
FWBlktCoolantLoopTypes(IntEnum)fori_fw_blkt_shared_coolant. - Replace several assignments and conditionals in
primary_coolant_properties()andthermo_hydraulic_model()to use the enum members instead of raw integers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| i_fw_blkt_shared_coolant = FWBlktCoolantLoopTypes( | ||
| fwbs_variables.i_fw_blkt_shared_coolant | ||
| ) |
There was a problem hiding this comment.
FWBlktCoolantLoopTypes(...) will raise ValueError if fwbs_variables.i_fw_blkt_shared_coolant is 2, but the input layer currently allows choices=[0, 1, 2] for this variable (process/core/input.py:1915-1917). This introduces a runtime crash vs the prior numeric comparison logic. Either (a) extend the enum to cover the 2 case (and document what it means), (b) tighten input validation to only allow 0/1, or (c) avoid casting here and compare the raw value to the enum members (since IntEnum already compares equal to int). Consider adding a unit test to cover the non-0/1 path so this can’t regress.
| i_fw_blkt_shared_coolant = FWBlktCoolantLoopTypes( | |
| fwbs_variables.i_fw_blkt_shared_coolant | |
| ) | |
| # Compare the raw value directly to the IntEnum member rather than | |
| # coercing it to FWBlktCoolantLoopTypes. The input layer currently | |
| # permits values beyond the defined enum members, and IntEnum values | |
| # compare equal to ints without raising ValueError for those cases. | |
| i_fw_blkt_shared_coolant = fwbs_variables.i_fw_blkt_shared_coolant |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4210 +/- ##
=======================================
Coverage 52.11% 52.12%
=======================================
Files 148 148
Lines 30406 30411 +5
=======================================
+ Hits 15847 15852 +5
Misses 14559 14559 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c58880c to
a2a20cf
Compare
Description
Checklist
I confirm that I have completed the following checks: