@@ -40,6 +40,8 @@ class Borefield(BaseClass):
4040 DEFAULT_LENGTH_PEAK : int = 6 # hours
4141 THRESHOLD_DEPTH_ERROR : int = 10000 # m
4242
43+ USE_SPEED_UP_IN_SIZING : bool = True
44+
4345 HOURLY_LOAD_ARRAY : np .ndarray = np .arange (0 , 8761 , UPM ).astype (np .uint32 )
4446
4547 def __init__ (
@@ -1338,6 +1340,10 @@ def size_L3(self, H_init: float = None, quadrant_sizing: int = 0) -> float:
13381340 if quadrant_sizing != 0 :
13391341 # size according to a specific quadrant
13401342 self .H , _ = self ._size_based_on_temperature_profile (quadrant_sizing )
1343+
1344+ # simulate with the correct temperatures
1345+ self .calculate_temperatures ()
1346+
13411347 return self .H
13421348 else :
13431349 try :
@@ -1352,6 +1358,10 @@ def size_L3(self, H_init: float = None, quadrant_sizing: int = 0) -> float:
13521358 if sized :
13531359 # already correct size
13541360 self .H = max_temp
1361+
1362+ # simulate with the correct temperatures
1363+ self .calculate_temperatures ()
1364+
13551365 if self .load .imbalance <= 0 :
13561366 self .limiting_quadrant = 1
13571367 else :
@@ -1360,6 +1370,10 @@ def size_L3(self, H_init: float = None, quadrant_sizing: int = 0) -> float:
13601370 min_temp , sized = self ._size_based_on_temperature_profile (20 )
13611371 if sized :
13621372 self .H = min_temp
1373+
1374+ # simulate with the correct temperatures
1375+ self .calculate_temperatures ()
1376+
13631377 if self .load .imbalance <= 0 :
13641378 self .limiting_quadrant = 4
13651379 else :
@@ -1407,6 +1421,10 @@ def size_L4(self, H_init: float = None, quadrant_sizing: int = 0) -> float:
14071421 if quadrant_sizing != 0 :
14081422 # size according to a specific quadrant
14091423 self .H , _ = self ._size_based_on_temperature_profile (quadrant_sizing , hourly = True )
1424+
1425+ # simulate with the correct temperatures
1426+ self .calculate_temperatures (hourly = True )
1427+
14101428 return self .H
14111429 else :
14121430 try :
@@ -1428,6 +1446,10 @@ def size_L4(self, H_init: float = None, quadrant_sizing: int = 0) -> float:
14281446 if sized :
14291447 # already correct size
14301448 self .H = max_temp
1449+
1450+ # simulate with the correct temperatures
1451+ self .calculate_temperatures (hourly = True )
1452+
14311453 if self .load .imbalance <= 0 :
14321454 self .limiting_quadrant = 1
14331455 else :
@@ -1441,6 +1463,10 @@ def size_L4(self, H_init: float = None, quadrant_sizing: int = 0) -> float:
14411463 else :
14421464 self .limiting_quadrant = 3
14431465 self .H = min_temp
1466+
1467+ # simulate with the correct temperatures
1468+ self .calculate_temperatures (hourly = True )
1469+
14441470 return min_temp
14451471 raise UnsolvableDueToTemperatureGradient
14461472
@@ -1450,7 +1476,7 @@ def calculate_next_depth_deep_sizing(self, current_length: float) -> float:
14501476 borefield is sized for the maximum fluid temperature when there is a non-constant ground temperature.
14511477 The method is based (as can be seen in its corresponding validation document) on the assumption that the
14521478 difference between the maximum temperature in peak injection and the average undisturbed ground temperature
1453- is irreversily proportional to the borehole length. In this way, given this difference in temperature and the current
1479+ is irreversibly proportional to the borehole length. In this way, given this difference in temperature and the current
14541480 borehole length, a new borehole length can be calculated.
14551481
14561482 Parameters
@@ -1517,10 +1543,11 @@ def _size_based_on_temperature_profile(self, quadrant: int, hourly: bool = False
15171543 while not self ._check_convergence (self .H , H_prev , i ):
15181544 if H_prev != 0 :
15191545 self .H = self .H * .5 + H_prev * 0.5
1546+ limit = self .Tf_min if quadrant in (3 , 4 , 20 ) else self .Tf_max
15201547 if hourly :
1521- self ._calculate_temperature_profile (self .H , hourly = True )
1548+ self ._calculate_temperature_profile (self .H , hourly = True , fluid_temperature = limit )
15221549 else :
1523- self ._calculate_temperature_profile (self .H , hourly = False )
1550+ self ._calculate_temperature_profile (self .H , hourly = False , fluid_temperature = limit )
15241551 H_prev = self .H
15251552 if not deep_sizing :
15261553 if quadrant == 1 :
@@ -1713,7 +1740,8 @@ def _delete_calculated_temperatures(self) -> None:
17131740 self .results = ResultsMonthly ()
17141741 self .load .reset_results (self .Tf_min , self .Tf_max )
17151742
1716- def _calculate_temperature_profile (self , H : float = None , hourly : bool = False ) -> None :
1743+ def _calculate_temperature_profile (self , H : float = None , hourly : bool = False ,
1744+ fluid_temperature : float = None ) -> None :
17171745 """
17181746 This function calculates the evolution in the fluid temperature and borehole wall temperature.
17191747
@@ -1723,6 +1751,8 @@ def _calculate_temperature_profile(self, H: float = None, hourly: bool = False)
17231751 Borehole length at which the temperatures should be evaluated [m]. If None, then the current length is taken.
17241752 hourly : bool
17251753 True if the temperature evolution should be calculated on an hourly basis.
1754+ fluid_temperature : float
1755+ During sizing, this differs from None so the specific temperature is taken.
17261756
17271757 Returns
17281758 -------
@@ -1740,12 +1770,13 @@ def calculate_temperatures(H, hourly=hourly, results_temperature=ResultsMonthly(
17401770 results = None
17411771
17421772 def get_rb (temperature ):
1773+ if fluid_temperature is not None and Borefield .USE_SPEED_UP_IN_SIZING :
1774+ return self .borehole .get_Rb (H , self .D , self .r_b , self .ground_data .k_s (depth , self .D ), depth ,
1775+ temperature = fluid_temperature )
17431776 if len (temperature ) == 0 :
1744- return self .borehole .get_Rb (H , self .D , self .r_b ,
1745- self .ground_data .k_s (depth , self .D ), depth ,
1777+ return self .borehole .get_Rb (H , self .D , self .r_b , self .ground_data .k_s (depth , self .D ), depth ,
17461778 temperature = self .Tf_min )
1747- return self .borehole .get_Rb (H , self .D , self .r_b ,
1748- self .ground_data .k_s (depth , self .D ), depth ,
1779+ return self .borehole .get_Rb (H , self .D , self .r_b , self .ground_data .k_s (depth , self .D ), depth ,
17491780 temperature = temperature )
17501781
17511782 if not hourly :
0 commit comments