Validation equivalent borehole thermal resistance

 1"""
 2This document contains the code to compare the equivalent borehole thermal resistance calculated with GHEtool
 3(based on pygfunction) with the results from Earth Energy Designer. The differences can be explained by using other
 4correlations and another assumption for the Nusselt number in the laminar regime.
 5"""
 6
 7import math
 8
 9import matplotlib.pyplot as plt
10import numpy as np
11import pandas as pd
12import pygfunction as gt
13
14from GHEtool import Borefield, FOLDER
15from GHEtool.VariableClasses import FluidData, GroundConstantTemperature, DoubleUTube
16
17
18def validate():
19    # initiate parameters
20    ground_data = GroundConstantTemperature(3, 10)  # ground data with an inaccurate guess of 100m for the depth of the borefield
21    borefield_gt = gt.boreholes.rectangle_field(10, 12, 6, 6, 100, 1, 0.075)
22    pipe_data = DoubleUTube(1, 0.015, 0.02, 0.4, 0.05, epsilon=1e-6)
23
24    # initiate borefield model
25    borefield = Borefield()
26    borefield.set_ground_parameters(ground_data)
27    borefield.set_pipe_parameters(pipe_data)
28    borefield.set_borefield(borefield_gt)
29    borefield.Rb = 0.12
30
31    # initialise variables
32    R_fp = []
33    R_p = []
34    Rb = []
35
36    # load data EED
37    data_EED = pd.read_csv(FOLDER.joinpath("Validation/resistances_EED.csv"), sep=";")
38
39    mfr_range = np.arange(0.05, 0.55, 0.05)
40
41    # calculate effective borehole thermal resistance (Rb*)
42    for mfr in mfr_range:
43        fluid_data = FluidData(mfr, 0.568, 998, 4180, 1e-3)
44        borefield.set_fluid_parameters(fluid_data)
45        Rb.append(borefield.Rb)
46        R_p.append(borefield.borehole.pipe_data.R_p)
47        R_fp.append(borefield.borehole.pipe_data.R_f)
48
49
50    # make figure
51    plt.figure()
52    plt.plot(R_fp, 'r+', label="GHEtool")
53    plt.plot(data_EED["R_fp"], 'bo', label="EED")
54    plt.xlabel("Mass flow rate per borehole l/s")
55    plt.ylabel("Fluid-pipe resistance resistance mK/W")
56    plt.title("Comparison R_fp from GHEtool with EED")
57    plt.legend()
58
59    plt.figure()
60    plt.plot(mfr_range, (R_fp - data_EED["R_fp"])/data_EED["R_fp"]*100, 'bo')
61    plt.xlabel("Mass flow rate per borehole l/s")
62    plt.ylabel("Difference in fluid-pipe resistance %")
63    plt.title("Comparison R_fp from GHEtool with EED (relative)")
64
65    plt.figure()
66    plt.plot(Rb, 'r+', label="GHEtool")
67    plt.plot(data_EED["Rb*"], 'bo', label="EED")
68    plt.xlabel("Mass flow rate per borehole l/s")
69    plt.ylabel("Effective borehole thermal resistance mK/W")
70    plt.title("Comparison Rb* from GHEtool with EED")
71    plt.legend()
72
73    plt.figure()
74    plt.plot(mfr_range, (Rb - data_EED["Rb*"])/data_EED["Rb*"]*100, 'bo')
75    plt.xlabel("Mass flow rate per borehole l/s")
76    plt.ylabel("Difference in effective borehole thermal resistance %")
77    plt.title("Comparison Rb* from GHEtool with EED (relative)")
78
79    plt.show()
80
81
82if __name__ == '__main__':   # pragma: no cover
83    validate()