fix: improve finite difference method logic for cases where r_i is no… - #71
Merged
Merged
Conversation
…t centered between neighbours r_{i-1} and r_{i+1}.
Signed-off-by: BramVloedgraven <bram.vloedgraven@dep.nl>
Signed-off-by: BramVloedgraven <bram.vloedgraven@dep.nl>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR updates the finite-difference discretization to better handle non-centered radii grids, and refreshes the associated validation artifacts.
Changes:
- Rename internal interstitial radii storage to
_inter_radii_gridand update dependent call sites. - Rework surface-area grid construction and the second-derivative finite-difference factor to align with the new discretization.
- Update unit tests and refresh golden CSV temperature-solution outputs to match the new numerical results.
Reviewed changes
Copilot reviewed 133 out of 133 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cable/test_cable.py | Updates surface-area grid test to use the new instance-based construction and boundary definition. |
| cable_thermal_model/model/cables/cable.py | Renames interstitial radii field, changes surface-area grid construction, and updates the second-derivative common factor. |
| cable_thermal_model/model/cables/cable_air.py | Updates references to the renamed _inter_radii_grid field in boundary-condition assembly. |
| cable_thermal_model/model/cables/cable_trefoil_circuit_single_pipe.py | Updates _calculate_inter_rhos call to use _inter_radii_grid. |
| cable_thermal_model/validation/cable_analysis.py | Updates validation heat-flow computation to use _inter_radii_grid. |
| test_results/test_compute_temperature_solution/y_y_y_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_y_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_y_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_top.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_y_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_top.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_y_n_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_y_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_y_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_y_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_n_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_n_y_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_n_y_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_n_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_n_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/y_n_n_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_y_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_y_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_y_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_y_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_n_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_n_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_n_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_y_n_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_y_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_y_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_y_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_y_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_y_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_n_y_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_n_y_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_n_n_y_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_n_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_right.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_n_n_n_YMeKrvaslqwd12_20kV1x630Alrm+as50_c1_trefoil_left.csv | Update expected temperature solution snapshot after discretization change. |
| test_results/test_compute_temperature_solution/n_n_n_n_n_GPLK10_10kV3x185Al_c1_single.csv | Update expected temperature solution snapshot after discretization change. |
Comments suppressed due to low confidence (1)
tests/cable/test_cable.py:1
- The test currently calls the instance method via the class (
Cable._construct_surface_area_grid(DummyCable(...))). While this works, it’s non-idiomatic and makes it easier to miss issues if the method is overridden. Prefer calling it as an instance method on the dummy instance (e.g.,DummyCable(radii_grid)._construct_surface_area_grid()) to better reflect real usage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: BramVloedgraven <bram.vloedgraven@dep.nl>
Signed-off-by: BramVloedgraven <bram.vloedgraven@dep.nl>
Signed-off-by: BramVloedgraven <bram.vloedgraven@dep.nl>
TeyAll
approved these changes
Aug 3, 2026
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.
…t centered between neighbours r_{i-1} and r_{i+1}.