Skip to content

Commit 2e1c79c

Browse files
authored
Merge pull request #391 from wouterpeere/issue390-no-convergence-in-iterative-sizing
First try
2 parents bc29da6 + a20b4bc commit 2e1c79c

File tree

15 files changed

+112
-80
lines changed

15 files changed

+112
-80
lines changed

Articles/IEA_HPT_magazine_2023/IEA_HPT_magazine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This document contains all the code to run create the figures of (Peere W., 2023).
2+
This document contains all the code to create the figures of (Peere W., 2023).
33
The code is created and should be work with GHEtool v2.2.0. Further compatibility is not guaranteed.
44
"""
55

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1919

2020
- Problem in ConicalPipe class when working with vfr (issue #378).
2121
- Problem with start month DHW and optimisation (issue #378).
22+
- Problem with convergence (issue #390).
2223

2324
## [2.3.4] - 2025-07-29
2425

GHEtool/Borefield.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,8 @@ def _size_based_on_temperature_profile(self, quadrant: int, hourly: bool = False
14751475
# (convergence if difference between borehole length in iterations is smaller than THRESHOLD_BOREHOLE_LENGTH)
14761476
i = 0
14771477
while not self._check_convergence(self.H, H_prev, i):
1478+
if H_prev != 0:
1479+
self.H = self.H * .5 + H_prev * 0.5
14781480
if hourly:
14791481
self._calculate_temperature_profile(self.H, hourly=True)
14801482
else:

GHEtool/Examples/turbocollector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def create_graphs():
5555
plt.plot(flow_rates, list_rb_double_smooth, label="Double smooth")
5656

5757
plt.title(f'Borehole thermal resistance for {fluid._name}')
58-
plt.ylabel('Effective borehole thermal resistance [W/(mK)]')
58+
plt.ylabel('Effective borehole thermal resistance [mK/W]')
5959
plt.xlabel('Flow rate [l/s]')
6060
plt.legend()
6161
plt.figure()

GHEtool/Validation/comparison_with_other_sizing_tools/test1a/test1a.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_1a_6h():
111111
assert np.isclose(depth_L4, 56.2659729399716)
112112
assert np.isclose(depth_L2s, 59.83238790604271)
113113
assert np.isclose(depth_L3s, 60.00736579796592)
114-
assert np.isclose(depth_L4s, 56.73136082379056)
114+
assert np.isclose(depth_L4s, 56.732044011668464)
115115
assert np.isclose(Rb_L2, 0.12801945735995454)
116116
assert np.isclose(Rb_L3, 0.1280244880933401)
117117
assert np.isclose(Rb_L4, 0.12793335445966403)
@@ -210,7 +210,7 @@ def test_1a_1h():
210210
assert np.isclose(depth_L3, 46.73933500137179)
211211
assert np.isclose(depth_L4, 56.2659729399716)
212212
assert np.isclose(depth_L2s, 46.986986159967906)
213-
assert np.isclose(depth_L3s, 47.28116830541002)
213+
assert np.isclose(depth_L3s, 47.28220733547535)
214214
assert np.isclose(depth_L4s, 56.73136082379056)
215215
assert np.isclose(Rb_L2, 0.12769092836836982)
216216
assert np.isclose(Rb_L3, 0.12769755355584275)

GHEtool/Validation/comparison_with_other_sizing_tools/test1b/test1b.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ def test_1b():
109109

110110
assert np.isclose(depth_L2, 75.67161488446233)
111111
assert np.isclose(depth_L3, 75.62427445122744)
112-
assert np.isclose(depth_L4, 71.49549300696316)
112+
assert np.isclose(depth_L4, 71.49641008062054)
113113
assert np.isclose(depth_L2s, 76.71715998100636)
114-
assert np.isclose(depth_L3s, 76.66992885379705)
115-
assert np.isclose(depth_L4s, 72.52247308266297)
114+
assert np.isclose(depth_L3s, 76.67104470064083)
115+
assert np.isclose(depth_L4s, 72.52389782010322)
116116
assert np.isclose(Rb_L2, 0.12648875915036317)
117117
assert np.isclose(Rb_L3, 0.12648767833749805)
118118
assert np.isclose(Rb_L4, 0.12639600391560102)

GHEtool/Validation/comparison_with_other_sizing_tools/test2/test2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def test_2_6h():
107107
f"The sizing according to L4 has a depth of {depth_L4:.2f}m (using dynamic Rb* of {Rb_L4:.3f}) and {depth_L4s:.2f}m (using constant Rb*)")
108108

109109
assert np.isclose(depth_L2, 76.84063723898525)
110-
assert np.isclose(depth_L3, 79.11228401910488)
111-
assert np.isclose(depth_L4, 84.77559168467357)
110+
assert np.isclose(depth_L3, 79.10831161518712)
111+
assert np.isclose(depth_L4, 84.77053904958063)
112112
assert np.isclose(depth_L2s, 77.43318625702659)
113-
assert np.isclose(depth_L3s, 79.59733272530252)
114-
assert np.isclose(depth_L4s, 84.97661469091508)
113+
assert np.isclose(depth_L3s, 79.6008906105556)
114+
assert np.isclose(depth_L4s, 84.97960330484824)
115115
assert np.isclose(Rb_L2, 0.11113022659380956)
116116
assert np.isclose(Rb_L3, 0.11146734480480838)
117117
assert np.isclose(Rb_L4, 0.11234852494964061)

GHEtool/Validation/comparison_with_other_sizing_tools/test4/test4.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ def test_4():
109109
f"The sizing according to L4 has a depth of {depth_L4:.2f}m (using dynamic Rb* of {Rb_L4:.3f}) and {depth_L4s:.2f}m (using constant Rb*)")
110110

111111
assert np.isclose(depth_L2, 124.02695636769329)
112-
assert np.isclose(depth_L3, 124.67134582762849)
113-
assert np.isclose(depth_L4, 122.461471483961)
112+
assert np.isclose(depth_L3, 124.67495153457973)
113+
assert np.isclose(depth_L4, 122.42819840295917)
114114
assert np.isclose(depth_L2s, 121.50772080500283)
115-
assert np.isclose(depth_L3s, 122.15337731354852)
116-
assert np.isclose(depth_L4s, 119.99581098989934)
115+
assert np.isclose(depth_L3s, 122.11873098056644)
116+
assert np.isclose(depth_L4s, 119.96843598952158)
117117
assert np.isclose(Rb_L2, 0.21023380751472076)
118118
assert np.isclose(Rb_L3, 0.21025731326271593)
119119
assert np.isclose(Rb_L4, 0.2101772055278848)

GHEtool/test/general_tests/test_GHEtool.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from GHEtool.VariableClasses import MonthlyGeothermalLoadAbsolute, HourlyGeothermalLoad, EERCombined, \
1919
HourlyBuildingLoad, EER, HourlyBuildingLoadMultiYear
2020
from GHEtool.Methods import *
21+
from GHEtool import *
2122

2223
data = GroundConstantTemperature(3, 10)
2324
data_ground_flux = GroundFluxTemperature(3, 10)
@@ -294,7 +295,7 @@ def test_sizing_with_use_constant_Rb():
294295
borefield.load = load
295296
assert not borefield.borehole.use_constant_Rb
296297
borefield.calculation_setup(L4_sizing=True)
297-
assert np.isclose(205.49615778557904, borefield.size())
298+
assert np.isclose(205.4926086157351, borefield.size())
298299
assert np.isclose(182.17320067531486, borefield.size(use_constant_Rb=True))
299300

300301

@@ -303,7 +304,7 @@ def test_size_with_different_peak_lengths(borefield):
303304

304305
borefield.load.peak_injection_duration = 8
305306
borefield.load.peak_extraction_duration = 6
306-
assert np.isclose(99.33058400216774, borefield.size(L3_sizing=True))
307+
assert np.isclose(99.36581644570013, borefield.size(L3_sizing=True))
307308

308309

309310
def test_convergence_eer_combined():
@@ -468,3 +469,31 @@ def test_optimise_methods_different_start_year_dhw():
468469

469470
load = HourlyBuildingLoadMultiYear(load.hourly_heating_load_simulation_period,
470471
load.hourly_cooling_load_simulation_period)
472+
473+
474+
def test_case_issue_390():
475+
ground_data = GroundFluxTemperature(1.57, 9.6, flux=0.07)
476+
fluid = TemperatureDependentFluidData('MPG', 25, False)
477+
flow = ConstantFlowRate(mfr=0.3)
478+
pipe = SingleUTube(1.5, 0.013, 0.016, 0.4, 0.035)
479+
480+
borehole = Borehole(fluid, pipe, flow)
481+
482+
peak_cooling = [0, 0, 0, 0, 6.225, 11.339999999999998, 15, 14.639999999999999, 8.235, 0, 0, 0]
483+
peak_heating = [31.3, 31.0183, 25.102600000000002, 17.7158, 8.2632, 0, 0, 0, 2.0658, 11.5184, 21.8474, 29.2342]
484+
baseload_cooling = [0, 0, 0, 0, 1232, 2255, 2970, 2904, 1639, 0, 0, 0]
485+
baseload_heating = [11017.6, 10892.4, 8826.6, 6260, 2817, 0, 0, 0, 751.1999999999999, 4069, 7699.8, 10266.4]
486+
487+
load = MonthlyBuildingLoadAbsolute(baseload_heating, baseload_cooling, peak_heating, peak_cooling, dhw=5000,
488+
efficiency_dhw=3, efficiency_cooling=20, simulation_period=25)
489+
490+
borefield = Borefield(ground_data=ground_data, load=load)
491+
492+
borefield.create_rectangular_borefield(4, 4, 6, 6, 100, 1, 0.07)
493+
494+
borefield.set_min_avg_fluid_temperature(0)
495+
borefield.set_max_avg_fluid_temperature(17)
496+
497+
borefield.borehole = borehole
498+
borefield.size_L3()
499+
assert borefield.H == 86.4119598683636

GHEtool/test/general_tests/test_GHEtool_two.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def test_size_with_multiple_ground_layers():
244244
borefield.load.peak_injection_duration = 8
245245
borefield.load.peak_extraction_duration = 6
246246
assert np.isclose(96.87238165292221, borefield.size(L2_sizing=True))
247-
assert np.isclose(97.60790804951675, borefield.size(L3_sizing=True))
247+
assert np.isclose(97.46310736940708, borefield.size(L3_sizing=True))
248248

249249
# now with multiple layers
250250
layer_1 = GroundLayer(k_s=1.7, thickness=4.9)

0 commit comments

Comments
 (0)