Skip to content

❇️ Creating generic engineering models file#4211

Open
chris-ashe wants to merge 8 commits intomainfrom
creating_generic_engineering_models_file
Open

❇️ Creating generic engineering models file#4211
chris-ashe wants to merge 8 commits intomainfrom
creating_generic_engineering_models_file

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe commented Apr 29, 2026

This pull request refactors and improves the engineering methods for coolant friction, heat transfer, and material thermal conductivity calculations. It modularizes these methods into dedicated files, updates documentation to match the new structure, and replaces legacy methods with more accurate and documented alternatives in the codebase.

Engineering methods modularization and code refactoring:

  • Introduced new engineering utility modules: process/models/engineering/pumping.py now contains darcy_friction_haaland, gnielinski_heat_transfer_coefficient, and calculate_reynolds_number, while process/models/engineering/materials.py provides eurofer97_thermal_conductivity. The codebase now imports and uses these functions instead of legacy, model-specific methods.

  • Updated process/models/fw.py and process/models/blankets/blanket_library.py to use the new generic methods for heat transfer, friction factor, and thermal conductivity, replacing previous method calls with the new utility functions. [

Documentation improvements and restructuring:

  • Added detailed documentation for the new generic engineering methods in documentation/source/eng-models/generic_methods/pumping.md and materials.md, including equations, references, and validity ranges for each method.

  • Updated the main engineering model documentation (fw-blanket.md and blanket_overview.md) to reference the new generic methods, replacing references to old, model-specific methods with links to the new documentation sections.

  • Removed the inlined method documentation from fw-blanket.md that is now covered by the new generic methods documentation, and moved relevant references to the new materials documentation.
    Documentation navigation update:

  • Updated mkdocs.yml to include the new "Generic Engineering Methods" section in the documentation navigation, with links to Pumping and Materials methods.

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 and others added 4 commits April 29, 2026 09:17
…ts for Eurofer97 material

Co-authored-by: Copilot <copilot@github.com>
…e it

Co-authored-by: Copilot <copilot@github.com>
… FirstWall model to use it

Co-authored-by: Copilot <copilot@github.com>
@chris-ashe chris-ashe added Engineering Relating to the engineering models Refactor labels Apr 29, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.12%. Comparing base (25b9f07) to head (bc0c38e).

Files with missing lines Patch % Lines
process/models/engineering/pumping.py 87.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4211      +/-   ##
==========================================
+ Coverage   52.10%   52.12%   +0.01%     
==========================================
  Files         148      150       +2     
  Lines       30389    30401      +12     
==========================================
+ Hits        15835    15847      +12     
  Misses      14554    14554              

☔ 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 and others added 2 commits April 29, 2026 10:10
Co-authored-by: Copilot <copilot@github.com>
…tests

Co-authored-by: Copilot <copilot@github.com>
@chris-ashe chris-ashe marked this pull request as ready for review April 29, 2026 09:26
@chris-ashe chris-ashe requested a review from a team as a code owner April 29, 2026 09:26
Copilot AI review requested due to automatic review settings April 29, 2026 09:26
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

This PR factors out common “generic engineering” calculations (pumping + materials property correlations) from specific models into reusable modules, and updates model code, docs, and unit tests accordingly.

Changes:

  • Extracts Haaland friction factor, Gnielinski heat transfer coefficient, Reynolds number, and Eurofer97 thermal conductivity into process.models.engineering.*.
  • Updates FW and blanket pumping code to call the new generic functions, and relocates unit tests into tests/unit/models/engineering/.
  • Adds new MkDocs pages and navigation entries for the generic engineering methods.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
process/models/fw.py Switches FW temperature calcs to use new generic materials/pumping functions.
process/models/blankets/blanket_library.py Uses new pumping helpers for Reynolds number + friction factor in pressure drop calculations.
process/models/engineering/pumping.py New generic pumping utilities (Haaland, Gnielinski, Reynolds).
process/models/engineering/materials.py New generic materials utility (Eurofer97 thermal conductivity).
process/models/engineering/__init__.py Introduces the engineering package.
tests/unit/models/test_fw.py Removes tests for logic moved into generic engineering modules.
tests/unit/models/engineering/test_pumping.py Adds unit tests for new pumping helper functions.
tests/unit/models/engineering/test_materials.py Adds unit test for Eurofer97 conductivity helper.
mkdocs.yml Adds nav entries for “Generic Engineering Methods”.
documentation/source/eng-models/generic_methods/pumping.md New documentation page for pumping helper methods.
documentation/source/eng-models/generic_methods/materials.md New documentation page for materials helper methods.
documentation/source/eng-models/fw-blanket.md Updates references to point to the new generic methods docs.
documentation/source/eng-models/blanket_overview.md Links Darcy friction reference to the new pumping methods page.

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


were $c_{\text{p}}$ is the coolant heat capacity and $k$ is the coolant thermal conductivity.

3. **Calculate the Darcy friction factor using the [`darcy_friction_haaland()`](../eng-models/generic_methods/pumping.md#pumping-coolant-friction--darcy_friction_haaland) method:**
Comment on lines +8 to +11
K_{\text{Eurofer97}} = 5.4308 + 0.13565T - 0.00023862T^2 + 1.3393 \times 10^{-7} T^3
$$

!!! warning Thermal conductivity validity bounds
Comment on lines +48 to +51
visc_coolant: float,
thermcond_coolant: float,
roughness_fw_channel: float,
) -> float:
Comment on lines +3016 to +3018
reynolds_number = calculate_reynolds_number(
den_coolant=den_coolant,
vel_coolant=vel_coolant,
Comment on lines +1 to +9
import logging

from process.data_structure import (
fwbs_variables,
)

logger = logging.getLogger(__name__)


Comment on lines +5 to +8
The pressure drop is based on the Darcy fraction factor, using the [Haaland equation](https://en.wikipedia.org/wiki/Darcy_friction_factor_formulae#Haaland_equation), an approximation to the implicit Colebrook–White equation.

$$
\frac{1}{\sqrt{f}} = -1.8 \log{\left[ \left(\frac{\epsilon / D}{3.7}\right)^{1.11} \frac{6.9}{\text{Re}} \right]}
…number to use flow velocity directly

Co-authored-by: Copilot <copilot@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engineering Relating to the engineering models Refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants