From 5760aa8814324cde82f1ab0693f5079c04ac181d Mon Sep 17 00:00:00 2001 From: u0169319 Date: Mon, 9 Sep 2024 14:02:40 +0200 Subject: [PATCH] fix error in pipe cell thickness and pipe conductivity --- .../Auditorium/auditorium_old.py | 252 ++++++++++++++++++ .../VariableClasses/Dynamic_borhole_model.py | 6 +- 2 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 GHEtool/Validation/short_term_effects_validation/Three_buildings/Auditorium/auditorium_old.py diff --git a/GHEtool/Validation/short_term_effects_validation/Three_buildings/Auditorium/auditorium_old.py b/GHEtool/Validation/short_term_effects_validation/Three_buildings/Auditorium/auditorium_old.py new file mode 100644 index 00000000..2d941934 --- /dev/null +++ b/GHEtool/Validation/short_term_effects_validation/Three_buildings/Auditorium/auditorium_old.py @@ -0,0 +1,252 @@ +""" +The different L4-model inclusing the short-term effects is validated based on three different buildings: an auditorium, an office and a swimming +pool. The three buildings were simulated previously in IESVE and the resulting heating and cooling demand profiles +were exported (Peere et al., 2023). + +References: +----------- + - Meertens, L., Peere, W., and Helsen, L. (2024). Influence of short-term dynamic effects on geothermal borefield size. +In _Proceedings of International Ground Source Heat Pump Association Conference 2024_. Montreal (Canada), 28-30 May 2024. +https://doi.org/10.22488/okstate.24.000004 + - Peere, W., L. Hermans, W. Boydens, and L. Helsen. 2023. Evaluation of the oversizing and computational speed of different +open-source borefield sizing methods. BS2023 Conference, Shanghai, China, April +""" +import os +import time + +import numpy as np +import pandas as pd + +import matplotlib.pyplot as plt + +import sys +sys.path.append("C:\Workdir\Develop\ghetool") + +from GHEtool import * + + +def Auditorium(): + #To do: + #Sensitivity: rhoCp grout and pipe + + ### Case 1 - Constant ground temperature + + ## GHEtool L4 + + # Rb calculated by tool + # initiate ground, fluid and pipe data + ground_data = GroundFluxTemperature(k_s=3, T_g=10, volumetric_heat_capacity= 2.4 * 10**6, flux=0) + fluid_data = FluidData(0.2, 0.568, 998, 4180, 1e-3) + pipe_data = MultipleUTube(1, 0.015, 0.02, 0.4, 0.05, 1) + + # initiate borefield + borefield = Borefield() + + # set ground data in borefield + borefield.set_ground_parameters(ground_data) + borefield.set_fluid_parameters(fluid_data) + borefield.set_pipe_parameters(pipe_data) + borefield.create_rectangular_borefield(5, 4, 6, 6, 100, 4, 0.075) + #borefield.set_Rb(0.12) + + # set temperature bounds + borefield.set_max_avg_fluid_temperature(17) + borefield.set_min_avg_fluid_temperature(3) + + # load the hourly profile + load = HourlyGeothermalLoad(simulation_period=20) + load.load_hourly_profile(os.path.join(os.path.dirname(__file__), 'auditorium.csv'), header=True, separator=";", + decimal_seperator=".", col_heating=1, + col_cooling=0) + borefield.load = load + + SEER = 20 + SCOP = 4 + + # load hourly heating and cooling load and convert it to geothermal loads + primary_geothermal_load = HourlyGeothermalLoad(simulation_period=load.simulation_period) + primary_geothermal_load.set_hourly_cooling(load.hourly_cooling_load.copy() * (1 + 1 / SEER)) + primary_geothermal_load.set_hourly_heating(load.hourly_heating_load.copy() * (1 - 1 / SCOP)) + # set geothermal load + borefield.load = primary_geothermal_load + + options = {'nSegments': 12, + 'segment_ratios': None, + 'disp': False, + 'profiles': True, + 'method': 'equivalent' + } + + borefield.set_options_gfunction_calculation(options) + + # according to L4 + L4_cst_start = time.time() + depth_L4_cst = borefield.size(100, L4_sizing=True) + Rb_L4_cst = borefield.Rb + L4_cst_stop = time.time() + Tf_L4_cst = borefield.results.peak_cooling + Tb_L4_cst = borefield.results.Tb + + # initiate borefield + borefield = Borefield() + + ## GHEtool L4 - including short-term effects + + # set ground data in borefield + borefield.set_ground_parameters(ground_data) + borefield.set_fluid_parameters(fluid_data) + borefield.set_pipe_parameters(pipe_data) + borefield.create_rectangular_borefield(5, 4, 6, 6, 100, 4, 0.075) + #borefield.set_Rb(0.12) + # set temperature bounds + borefield.set_max_avg_fluid_temperature(17) + borefield.set_min_avg_fluid_temperature(3) + + # load the hourly profile + borefield.load = primary_geothermal_load + # Addidional input data needed for short-term model + rho_cp_grout = 3900000.0 + rho_cp_pipe = 1540000.0 + + # Sample dictionary with short-term effect parameters + short_term_effects_parameters = { + 'rho_cp_grout': rho_cp_grout, + 'rho_cp_pipe': rho_cp_pipe, + } + + options = {'nSegments': 12, + 'segment_ratios': None, + 'disp': False, + 'profiles': True, + 'method': 'equivalent', + 'cylindrical_correction': True, + 'short_term_effects': True, + 'ground_data': ground_data, + 'fluid_data': fluid_data, + 'pipe_data': pipe_data, + 'borefield': borefield, + 'short_term_effects_parameters': short_term_effects_parameters, + } + + borefield.set_options_gfunction_calculation(options) + + # according to L4 including short-term effects + L4_ste_cst_start = time.time() + depth_L4_ste_cst = borefield.size(100, L4_sizing=True) + Rb_L4_ste_cst = borefield.Rb + L4_ste_cst_stop = time.time() + Tf_L4_ste_cst = borefield.results.peak_cooling + Tb_L4_ste_cst = borefield.results.Tb + + ### Case 2 - Temperature gradient in ground + + ground_data = GroundTemperatureGradient(k_s=3, T_g=10, volumetric_heat_capacity= 2.4 * 10**6, gradient=2) + + # initiate borefield + borefield = Borefield() + + # set ground data in borefield + borefield.set_ground_parameters(ground_data) + borefield.set_fluid_parameters(fluid_data) + borefield.set_pipe_parameters(pipe_data) + borefield.create_rectangular_borefield(5, 4, 6, 6, 100, 4, 0.075) + #borefield.set_Rb(0.12) + + # set temperature bounds + borefield.set_max_avg_fluid_temperature(17) + borefield.set_min_avg_fluid_temperature(3) + + # set geothermal load + borefield.load = primary_geothermal_load + + options = {'nSegments': 12, + 'segment_ratios': None, + 'disp': False, + 'profiles': True, + 'method': 'equivalent' + } + + borefield.set_options_gfunction_calculation(options) + + # according to L4 + L4_gradient_start = time.time() + depth_L4_gradient = borefield.size(100, L4_sizing=True) + Rb_L4_gradient = borefield.Rb + L4_gradient_stop = time.time() + Tf_L4_gradient = borefield.results.peak_cooling + Tb_L4_gradient = borefield.results.Tb + + # initiate borefield + borefield = Borefield() + + ## GHEtool L4 - including short-term effects + + # set ground data in borefield + borefield.set_ground_parameters(ground_data) + borefield.set_fluid_parameters(fluid_data) + borefield.set_pipe_parameters(pipe_data) + borefield.create_rectangular_borefield(5, 4, 6, 6, 100, 4, 0.075) + #borefield.set_Rb(0.12) + # set temperature bounds + borefield.set_max_avg_fluid_temperature(17) + borefield.set_min_avg_fluid_temperature(3) + + # load the hourly profile + borefield.load = primary_geothermal_load + # Addidional input data needed for short-term model + rho_cp_grout = 3900000.0 + rho_cp_pipe = 1540000.0 + + # Sample dictionary with short-term effect parameters + short_term_effects_parameters = { + 'rho_cp_grout': rho_cp_grout, + 'rho_cp_pipe': rho_cp_pipe, + } + + options = {'nSegments': 12, + 'segment_ratios': None, + 'disp': False, + 'profiles': True, + 'method': 'equivalent', + 'cylindrical_correction': True, + 'short_term_effects': True, + 'ground_data': ground_data, + 'fluid_data': fluid_data, + 'pipe_data': pipe_data, + 'borefield': borefield, + 'short_term_effects_parameters': short_term_effects_parameters, + } + + borefield.set_options_gfunction_calculation(options) + + # according to L4 including short-term effects + L4_ste_gradient_start = time.time() + depth_L4_ste_gradient = borefield.size(100, L4_sizing=True) + Rb_L4_ste_gradient = borefield.Rb + L4_ste_gradient_stop = time.time() + Tf_L4_ste_gradient = borefield.results.peak_cooling + Tb_L4_ste_gradient = borefield.results.Tb + + + print('Case 1 - Constant ground temperature') + print( + f"The sizing according to L4 has a depth of {depth_L4_cst:.2f}m (using dynamic Rb* of {Rb_L4_cst:.3f})") + print( + f"The sizing according to L4 (including short-term effects) has a depth of {depth_L4_ste_cst:.2f}m (using dynamic Rb* of {Rb_L4_ste_cst:.3f})") + print( + f"Time needed for L4-sizing is {L4_cst_stop-L4_cst_start:.2f}s (using dynamic Rb*)") + print( + f"Time needed for L4-sizing including short-term effect is {L4_ste_cst_stop-L4_ste_cst_start:.2f}s (using dynamic Rb*)") + print('Case 2 - Temperature gradient in ground') + print( + f"The sizing according to L4 has a depth of {depth_L4_gradient:.2f}m (using dynamic Rb* of {Rb_L4_gradient:.3f})") + print( + f"The sizing according to L4 (including short-term effects) has a depth of {depth_L4_ste_gradient:.2f}m (using dynamic Rb* of {Rb_L4_ste_gradient:.3f})") + print( + f"Time needed for L4-sizing is {L4_gradient_stop-L4_gradient_start:.2f}s (using dynamic Rb*)") + print( + f"Time needed for L4-sizing including short-term effect is {L4_ste_gradient_stop-L4_ste_gradient_start:.2f}s (using dynamic Rb*)") + + +if __name__ == "__main__": # pragma: no cover + Auditorium() diff --git a/GHEtool/VariableClasses/Dynamic_borhole_model.py b/GHEtool/VariableClasses/Dynamic_borhole_model.py index 09a0836b..79a87d55 100644 --- a/GHEtool/VariableClasses/Dynamic_borhole_model.py +++ b/GHEtool/VariableClasses/Dynamic_borhole_model.py @@ -139,7 +139,7 @@ def __init__(self, time, gFunc, boreholes, alpha, ground_data, fluid_data, pipe_ self.thickness_conv = (self.r_in_tube - self.r_in_convection) / self.num_conv_cells self.thickness_fluid = (self.r_in_convection - self.r_fluid) / self.num_fluid_cells # Fixing error of thickness pipe cells, divide by number of pipe cells - #self.thickness_pipe = self.thickness_pipe / self.num_pipe_cells + self.thickness_pipe = self.thickness_pipe / self.num_pipe_cells ghe_logger.info(f"Single U-tube cells defined for numerical model") else: @@ -209,6 +209,8 @@ def fill_radial_cell(self, radial_cell, resist_p_eq, resist_f_eq, resist_tg_eq): outer_radius = center_radius + self.thickness_fluid / 2.0 + print('fluid cell', idx, self.r_fluid, inner_radius, outer_radius, outer_radius-inner_radius) + # The equivalent thermal mass of the fluid can be calculated from # equation (2) # pi (r_in_conv ** 2 - r_f **2) C_eq_f = 2pi r_p_in**2 * C_f @@ -269,7 +271,7 @@ def fill_radial_cell(self, radial_cell, resist_p_eq, resist_f_eq, resist_tg_eq): inner_radius = self.r_in_tube + j * self.thickness_pipe center_radius = inner_radius + self.thickness_pipe / 2.0 outer_radius = inner_radius + self.thickness_pipe - conductivity = log(self.r_borehole / self.r_in_tube) / (2.0 * pi * resist_p_eq) + conductivity = log(self.r_borehole / self.r_in_tube) / (2.0 * pi * resist_tg_eq) # rho_cp = self.single_u_tube.pipe.rhoCp rho_cp = self.rho_cp_pipe volume = pi * (outer_radius ** 2 - inner_radius ** 2)