Skip to content

🎨 Add blkt pipes output - #4369

Open
chris-ashe wants to merge 35 commits into
mainfrom
add_blkt_pipes_output
Open

🎨 Add blkt pipes output#4369
chris-ashe wants to merge 35 commits into
mainfrom
add_blkt_pipes_output

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces significant improvements to the documentation, data structure, and output related to blanket coolant channel pumping and pressure drop calculations. The main changes include moving detailed coolant pumping and pressure drop documentation to a more appropriate location, adding new variables for coolant flow and pressure drop tracking, enhancing plotting capabilities for coolant properties, and updating variable names for clarity.

Documentation Improvements:

  • Moved detailed explanations for coolant mechanical pumping power, pressure drop, and elbow coefficient calculations from blanket_overview.md into a new section in generic_methods/pumping.md, making the documentation more modular and easier to maintain. Also added a new section on calculating required mass flow rate and clarified when to use specific heat capacities at constant pressure or volume.

🔄 Renames

  • mfblktpi - > mflow_blkt_inboard_coolant_channel
  • mfblktpo -> mflow_blkt_outboard_coolant_channel
  • cp_fw -> heatcap_pres_fw_coolant_average
  • cv_fw -> heatcap_vol_fw_coolant_average
  • cp_bl -> heatcap_pres_blkt_coolant_average
  • cv_bl -> heatcap_vol_blkt_coolant_average

Data Structure and Variable Enhancements:

  • Added new variables to BlanketData for tracking Reynolds numbers, Darcy friction factors, bend loss coefficients, friction coefficients, pressure drops, and mass flow rates for both inboard and outboard blanket coolant channels. Updated variable names for mass flow rates for clarity and consistency.
  • Improved the docstring for roughness_fw_channel in FWBSData for clarity.

Plotting and Output Updates:

  • Added a new plotting function, plot_blanket_coolant_channel_structure_and_properties, to summary.py that provides a comprehensive summary of coolant channel structure and properties for both inboard and outboard blankets. Integrated this new plot into the summary plotting workflow.
  • Updated the output logic to write new inboard and outboard blanket pumping variables when appropriate, ensuring all new data is available for post-processing and analysis.

Naming and Standards:

  • Added new naming conventions for specific heat capacities in the standards documentation, specifying the use of heatcap_, heatcap_vol_, and heatcap_pres_ prefixes.

These changes collectively improve the clarity, maintainability, and usability of the codebase and its documentation for coolant channel analysis and reporting.


image

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.

@timothy-nunn

timothy-nunn commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Can you fix the conflicts before I do my first review.

Please also add which variables have been renamed in the PR body

@timothy-nunn timothy-nunn self-assigned this Jun 23, 2026
@chris-ashe
chris-ashe marked this pull request as draft June 23, 2026 13:51
@chris-ashe
chris-ashe force-pushed the add_blkt_pipes_output branch from a175010 to 3b043bb Compare June 23, 2026 15:42
@codecov-commenter

codecov-commenter commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.97361% with 174 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.86%. Comparing base (a9358cc) to head (1b52f74).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
process/models/blankets/blanket_library.py 6.45% 145 Missing ⚠️
process/core/io/plot/summary.py 16.66% 10 Missing ⚠️
process/models/blankets/hcpb.py 25.00% 9 Missing ⚠️
process/main.py 33.33% 4 Missing ⚠️
process/models/engineering/pumping.py 96.55% 3 Missing ⚠️
process/models/blankets/dcll.py 50.00% 1 Missing ⚠️
process/models/fw.py 80.00% 1 Missing ⚠️
process/models/power.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4369      +/-   ##
==========================================
+ Coverage   49.46%   49.86%   +0.40%     
==========================================
  Files         150      151       +1     
  Lines       30069    30047      -22     
==========================================
+ Hits        14874    14984     +110     
+ Misses      15195    15063     -132     

☔ 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.

@timothy-nunn timothy-nunn removed their assignment Jun 24, 2026
@chris-ashe
chris-ashe force-pushed the add_blkt_pipes_output branch 2 times, most recently from 611c3c1 to 188a388 Compare July 2, 2026 15:29
@chris-ashe
chris-ashe marked this pull request as ready for review July 15, 2026 08:41
@timothy-nunn timothy-nunn self-assigned this Jul 16, 2026

@timothy-nunn timothy-nunn left a comment

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.

For large tokamak (eval and nof) I am getting 0's for most of the quantities in the summary PDF:

Image

They are being written as 0 to the MFile:

Pressure_drop_for_straight_sections_of_outboard_blanket_(Pa)_____________ (dpres_blkt_outboard_coolant_channel_straight_total)_ 0.00000000000000000e+00 OP 
Pressure_drop_for_90°_bends_of_outboard_blanket_(Pa)_____________________ (dpres_blkt_outboard_coolant_channel_90_bend)_ 0.00000000000000000e+00 OP 
Total_pressure_drop_for_90°_bends_of_outboard_blanket_(Pa)_______________ (dpres_blkt_outboard_coolant_channel_90_bends_total)_ 0.00000000000000000e+00 OP 
Pressure_drop_for_180°_bends_of_outboard_blanket_(Pa)____________________ (dpres_blkt_outboard_coolant_channel_180_bend)_ 0.00000000000000000e+00 OP 
Total_pressure_drop_for_180°_bends_of_outboard_blanket_(Pa)______________ (dpres_blkt_outboard_coolant_channel_180_bends_total)_ 0.00000000000000000e+00 OP 
Total_pressure_drop_for_all_bends_(Pa)___________________________________ (dpres_blkt_outboard_bends_total)_ 0.00000000000000000e+00 OP 
Reynolds_number_of_outboard_blanket_coolant______________________________ (reynolds_blkt_outboard_coolant)_ 0.00000000000000000e+00 OP 
Darcy_friction_factor_of_outboard_blanket_coolant________________________ (darcy_frict_blkt_outboard_coolant)_ 0.00000000000000000e+00 OP 
Pressure_drop_coefficient_for_straight_sections_of_outboard_blanket______ (f_straight_blkt_outboard_coolant)_ 0.00000000000000000e+00 OP 
Total_length_of_straight_sections_of_outboard_blanket_coolant_channels_(m)_ (len_blkt_outboard_coolant_channel_straight_total)_ 0.00000000000000000e+00 OP 
Pressure_drop_coefficient_for_90°_bends_in_outboard_blanket______________ (f_elbow_blkt_outboard_90_bend)_ 0.00000000000000000e+00 OP 
Pressure_drop_coefficient_for_180°_bends_in_outboard_blanket_____________ (f_elbow_blkt_outboard_180_bend)_ 0.00000000000000000e+00 OP 
Mass_flow_rate_of_outboard_blanket_coolant_(kg/s)________________________ (mflow_blkt_outboard_coolant)__ 0.00000000000000000e+00 OP 
Mass_flow_rate_of_outboard_blanket_coolant_in_single_channel_(kg/s)______ (mflow_blkt_outboard_coolant_channel)_ 0.00000000000000000e+00 OP 
Velocity_of_outboard_blanket_coolant_in_single_channel_(m/s)_____________ (vel_blkt_outboard_coolant)____ 0.00000000000000000e+00 OP 

@chris-ashe

chris-ashe commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Can you fix the conflicts before I do my first review.

Please also add which variables have been renamed in the PR body

You will need to specify i_p_coolant_pumping = 2 in the input file. It is currently at 3. In option 3 the pressure drop is input so the calculation for the pumping power is done instantly. For option 2 the pressure drop is calculated based on the piping geometry and fluid properties hence why its all zero currently as its not ran.

@timothy-nunn

Copy link
Copy Markdown
Collaborator

Can you fix the conflicts before I do my first review.
Please also add which variables have been renamed in the PR body

You will need to specify i_p_coolant_pumping = 2 in the input file. It is currently at 3. In option 3 the pressure drop is input so the calculation for the pumping power is done instantly. For option 2 the pressure drop is calculated based on the piping geometry and fluid properties hence why its all zero currently as its not ran.

We probably should not be writing values out to the MFile which are not being calculated because they may get misused by those without that specific knowledge (as I have just done :D). I also do not think we should be including them in the output PDF in this case either.

@chris-ashe
chris-ashe force-pushed the add_blkt_pipes_output branch from 693fcfd to 7e03a94 Compare August 3, 2026 09:44
@chris-ashe
chris-ashe requested a review from timothy-nunn August 3, 2026 09:59
@chris-ashe

Copy link
Copy Markdown
Collaborator Author

Can you fix the conflicts before I do my first review.
Please also add which variables have been renamed in the PR body

You will need to specify i_p_coolant_pumping = 2 in the input file. It is currently at 3. In option 3 the pressure drop is input so the calculation for the pumping power is done instantly. For option 2 the pressure drop is calculated based on the piping geometry and fluid properties hence why its all zero currently as its not ran.

We probably should not be writing values out to the MFile which are not being calculated because they may get misused by those without that specific knowledge (as I have just done :D). I also do not think we should be including them in the output PDF in this case either.

Have changed it so that the coolant pumping vars are only output if PumpingPowerModelTypes.CALCULATE_PRESSURE_DROP

Comment thread process/core/io/plot/summary.py
@chris-ashe
chris-ashe requested a review from timothy-nunn August 5, 2026 09:12
Comment thread process/models/fw.py
Comment on lines +27 to +30
N_FW_PIPE_90_DEG_BENDS = 2
"Number of 90 degree bends in first wall coolant channels."
N_FW_PIPE_180_DEG_BENDS = 0
"Number of 180 degree bends in first wall coolant channels."

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.

Would it make sense to allow these as inputs?

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.

This would need to be a separate PR as the FW is assumed to just be a vertical pipe with a 90 degree inlet and outlet. We would need to change the geometry functions if we wanted to include more bends that arent at the ends

Comment thread process/models/blankets/dcll.py Outdated
Comment thread process/core/output.py Outdated
Comment on lines +168 to +193

## Required mass flow rate | `calculate_required_mass_flow_rate()`

The required mass flow rate of a coolant is given simply by the fundamental heat transfer equation:

$$
\dot{m} = \frac{P}{c_{\text{p}}(T)\times \Delta T}
$$

where $\dot{m}$ is the required mass flow rate in, $P$ is the heating power to be removed, $c_{\text{p}}$ is the coolant specific heat capacity for constant pressure and $\Delta T$ is the temperature change in the coolant.

!!! note "Variation specific heat capacity"

The heat capacity itself is a function of temperature. Therefore it is common to use the heat capacity value at the simple average between the initial and final temperature.
This however assumes a linear relationship. Ideally the equation should be solves as:

$$
\dot{m} = \frac{P}{\int_{T_{\text{in}}}^{T_{\text{in}}}c_{\text{p}}(T) dT}
$$


!!! info "Choice of specific heat capacity"

For pumping, the specific heat capacity for constant pressure $(c_{\text{p}})$ is used as cooling loops are open-flow systems where the fluid moves continuously through pipes, heat exchangers, and pumps. As the coolant heats up, it expands freely along the loop. Because it is free to expand, the local pressure remains relatively constant while the volume changes.

You would only use the specific heat capacity for constant volume $(c_{\text{v}})$ if the coolant was completely sealed inside a rigid, unyielding container with zero flow, where heating it would cause the pressure to spike but the volume to stay exactly the same. No newline at end of file

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 think this bit of doc is new, so probably worth an @ukaea/process-model-review looking at it

Comment thread process/models/blankets/blanket_library.py Outdated
Comment thread process/models/blankets/blanket_library.py Outdated
Comment thread process/models/engineering/pumping.py Outdated
Comment thread process/models/blankets/blanket_library.py Outdated
Comment thread process/models/engineering/pumping.py Outdated
@timothy-nunn

Copy link
Copy Markdown
Collaborator

@chris-ashe maybe you can assist me in setting up a DCLL input file too just so we can check nothing changes before and after

@je-cook
je-cook force-pushed the add_blkt_pipes_output branch from 90684e7 to 6da8415 Compare August 21, 2026 13:42
@je-cook
je-cook requested a review from a team August 21, 2026 13:46
@timothy-nunn

Copy link
Copy Markdown
Collaborator

Getting the following error when trying to run the DCLL model:

File "/Users/tnunn/Codes/PROCESS/process/models/blankets/dcll.py", line 129, in run
    dia_blkt_channel = self.pipe_hydraulic_diameter(
AttributeError: 'DCLL' object has no attribute 'pipe_hydraulic_diameter'

@chris-ashe
chris-ashe force-pushed the add_blkt_pipes_output branch from 4d9bcef to db47075 Compare August 25, 2026 12:45

@timothy-nunn timothy-nunn left a comment

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.

Couple of style requests and comments from previous reviews not addressed.

Need to prompt @ukaea/process-model-review to provide a review too.

Comment thread process/core/io/plot/summary.py Outdated
Comment on lines +16533 to +16538
f"Pressure drop for straight sections: {m_file.get('dpres_blkt_inboard_coolant_channel_straight_total', scan=scan):.2e} Pa\n"
f"Pressure drop for 90° bends: {m_file.get('dpres_blkt_inboard_coolant_channel_90_bend', scan=scan):.2e} Pa\n"
f"Total pressure drop for 90° bends: {m_file.get('dpres_blkt_inboard_coolant_channel_90_bends_total', scan=scan):.2e} Pa\n"
f"Pressure drop for 180° bends: {m_file.get('dpres_blkt_inboard_coolant_channel_180_bend', scan=scan):.2e} Pa\n"
f"Total pressure drop for 180° bends: {m_file.get('dpres_blkt_inboard_coolant_channel_180_bends_total', scan=scan):.2e} Pa\n"
f"Total pressure drop for all bends: {m_file.get('dpres_blkt_inboard_bends_total', scan=scan):.2e} Pa\n\n"

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'm not sure we want to use scientific notation here as it makes the slide look a little bit busy. The numbers are not too big (magnitudes 0 to 2) so we should just output them with say 3 sig figs.

Comment thread process/core/io/plot/summary.py Outdated
Comment on lines +16491 to +16496
f"Pressure drop for straight sections: {m_file.get('dpres_blkt_outboard_coolant_channel_straight_total', scan=scan):.2e} Pa\n"
f"Pressure drop for 90° bends: {m_file.get('dpres_blkt_outboard_coolant_channel_90_bend', scan=scan):.2e} Pa\n"
f"Total pressure drop for 90° bends: {m_file.get('dpres_blkt_outboard_coolant_channel_90_bends_total', scan=scan):.2e} Pa\n"
f"Pressure drop for 180° bends: {m_file.get('dpres_blkt_outboard_coolant_channel_180_bend', scan=scan):.2e} Pa\n"
f"Total pressure drop for 180° bends: {m_file.get('dpres_blkt_outboard_coolant_channel_180_bends_total', scan=scan):.2e} Pa\n"
f"Total pressure drop for all bends: {m_file.get('dpres_blkt_outboard_bends_total', scan=scan):.2e} Pa\n\n"

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.

Same up here

Comment thread process/models/engineering/pumping.py
Comment thread process/models/fw.py
chris-ashe and others added 2 commits September 2, 2026 09:16
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
…erties and remove unnecessary @staticmethod decorator from calculate_required_mass_flow_rate
@chris-ashe
chris-ashe requested review from a team and timothy-nunn September 2, 2026 08:21

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.

if you have completely moved the documentation, this file should be deleted, No?

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.

This just removes the generic pumping equations and puts them into the pumping file. The blanket overview page will still be needed

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.

ok, then could you please write here something like "To be written" or similar? File with just a heading and section heading but no text looks odd

Comment on lines +17 to +19
$$
fp = \frac{T_{\text{pump,out}}\left(\frac{P_{\text{pump,out}}}{P_{\text{pump,in}}}\right)^{-\frac{\gamma -1}{\gamma}}}{\eta \left(T_{\text{pump,in}}-T_{\text{pump,out}}\right)}
$$

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.

What is fp called?

Comment thread documentation/source/eng-models/generic_methods/pumping.md
Comment thread documentation/source/eng-models/generic_methods/pumping.md
This however assumes a linear relationship. Ideally the equation should be solves as:

$$
\dot{m} = \frac{P}{\int_{T_{\text{in}}}^{T_{\text{in}}}c_{\text{p}}(T) dT}

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.

typo: Upper limit should be T_out

@chris-ashe
chris-ashe requested a review from a team September 2, 2026 14:48

!!! info "Choice of specific heat capacity"

For pumping, the specific heat capacity for constant pressure $(c_{\text{p}})$ is used as cooling loops are open-flow systems where the fluid moves continuously through pipes, heat exchangers, and pumps. As the coolant heats up, it expands freely along the loop. Because it is free to expand, the local pressure remains relatively constant while the volume changes.

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.

Being free to expand does not necessarily, or intuitively, mean that the local pressure remains constant. The pressure behaviour, in fact, depends collectively on the specific system configuration, such as the pressure-control scheme, expansion tank or reservoir, rather than simply on whether the coolant is free to expand.

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.

5 participants