❇️ Creating generic engineering models file#4211
Open
chris-ashe wants to merge 8 commits intomainfrom
Open
Conversation
…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>
Co-authored-by: Copilot <copilot@github.com>
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <copilot@github.com>
…tests Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pynow containsdarcy_friction_haaland,gnielinski_heat_transfer_coefficient, andcalculate_reynolds_number, whileprocess/models/engineering/materials.pyprovideseurofer97_thermal_conductivity. The codebase now imports and uses these functions instead of legacy, model-specific methods.Updated
process/models/fw.pyandprocess/models/blankets/blanket_library.pyto 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.mdandmaterials.md, including equations, references, and validity ranges for each method.Updated the main engineering model documentation (
fw-blanket.mdandblanket_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.mdthat is now covered by the new generic methods documentation, and moved relevant references to the new materials documentation.Documentation navigation update:
Updated
mkdocs.ymlto 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: