Skip to content

Conversation

@chris-ashe
Copy link
Collaborator

@chris-ashe chris-ashe commented Dec 4, 2025

This pull request refactors the blanket and divertor modules to improve code modularity, reusability, and clarity. Key changes include separating inboard and outboard blanket geometry logic into dedicated classes, generalizing the calculation of pumping powers, and unifying the computation of divertor incident powers into reusable methods. These changes enable more maintainable and extensible blanket and divertor models across the codebase.

Blanket geometry and modularization:

  • Introduced InboardBlanket and OutboardBlanket classes in blanket_library.py, each encapsulating their respective geometry calculations and segment length methods, replacing direct calculations in the old BlanketLibrary class.
  • Updated DCLL and CCFE_HCPB blanket models to inherit from the new InboardBlanket and OutboardBlanket classes, and refactored their run methods to use the new geometry calculation methods for setting segment lengths.
  • Removed direct toroidal segment length calculations from set_blanket_module_geometry in favor of the new modular methods.

Pumping power calculation improvements:

  • Refactored set_pumping_powers_as_fractions to accept all required parameters as arguments and return a tuple of results, improving testability and reusability. Updated all blanket models to use the new function signature.

Divertor power calculation refactor:

  • Centralized the calculation of incident neutron and radiation power on the divertor into new methods (set_incident_neutron_power, set_incident_radiation_power) in Divertor, and updated the divertor and blanket models to use these methods instead of duplicating logic.
    Class structure and code organization:

  • Added empty LowerDivertor and UpperDivertor classes as placeholders for future specialization, inheriting from the refactored Divertor class.

These changes collectively enhance the maintainability, clarity, and extensibility of the blanket and divertor modelling code.## 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

codecov-commenter commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.88%. Comparing base (2f754a2) to head (426bc22).

Files with missing lines Patch % Lines
process/divertor.py 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3999      +/-   ##
==========================================
- Coverage   45.88%   45.88%   -0.01%     
==========================================
  Files         123      123              
  Lines       29087    29082       -5     
==========================================
- Hits        13346    13343       -3     
+ Misses      15741    15739       -2     

☔ 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_up_down_div_classes branch from f5bb41c to 737bd79 Compare December 4, 2025 15:31
@chris-ashe chris-ashe marked this pull request as ready for review December 5, 2025 10:06
@timothy-nunn
Copy link
Collaborator

Before I review can you merge #3997 and then rebase this PR onto main

@chris-ashe chris-ashe force-pushed the create_up_down_div_classes branch from 3f8fae5 to d010aed Compare December 17, 2025 09:24
Copy link
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

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

Happy with these changes. They are stepping stones towards having separate upper and lower divertor models which will be a great addition to PROCESS.

@timothy-nunn timothy-nunn merged commit 229164e into main Dec 18, 2025
18 checks passed
@timothy-nunn timothy-nunn deleted the create_up_down_div_classes branch December 18, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants