Evaluation of thermal resistances using the multipole methodΒΆ

This example demonstrates the use of the pipes.thermal_resistances() function to evaluate internal thermal resistances in a borehole. The example also covers the use of the pipes.multipole() function to evaluate the 2D temperature field in and around a borehole.

The thermal resistances of a borehole with two pipes are evaluated using the multipole method of Claesson and Hellstrom 1. Based on the calculated thermal resistances, the heat flows from the pipes required to obtain pipe temperatures of 1 degC are evaluated. The temperatures in and around the borehole with 2 pipes are then calculated. Results are verified against the results of Claesson and Hellstrom 1.

The script is located in: pygfunction/examples/multipole_temperature.py

  1# -*- coding: utf-8 -*-
  2""" Example of calculation of grout and ground temperatures using the multipole
  3    method.
  4
  5    The thermal resistances of a borehole with two pipes are evaluated using
  6    the multipole method of Claesson and Hellstrom (2011). Based on the
  7    calculated thermal resistances, the heat flows from the pipes required to
  8    obtain pipe temperatures of 1 degC are evaluated. The temperatures in and
  9    around the borehole with 2 pipes are then calculated. Results are verified
 10    against the results of Claesson and Hellstrom (2011).
 11
 12"""
 13import matplotlib.pyplot as plt
 14import numpy as np
 15from matplotlib.ticker import AutoMinorLocator
 16from scipy import pi
 17
 18import pygfunction as gt
 19
 20
 21def main():
 22    # -------------------------------------------------------------------------
 23    # Simulation parameters
 24    # -------------------------------------------------------------------------
 25
 26    # Borehole dimensions
 27    r_b = 0.070         # Borehole radius (m)
 28
 29    # Pipe dimensions
 30    n_p = 2             # Number of pipes
 31    # Pipe outer radius (m)
 32    rp_out = 0.02*np.ones(n_p)
 33
 34    # Pipe positions
 35    # Single U-tube [(x_1, y_1), (x_2, y_2)]
 36    pos_pipes = [(0.03, 0.00), (-0.03, 0.02)]
 37
 38    # Ground properties
 39    k_s = 2.5           # Ground thermal conductivity (W/m.K)
 40
 41    # Grout properties
 42    k_g = 1.5           # Grout thermal conductivity (W/m.K)
 43
 44    # Fluid properties
 45    # Fluid to outer pipe wall thermal resistance (m.K/W)
 46    R_fp = 1.2/(2*pi*k_g)*np.ones(n_p)
 47
 48    # Borehole wall temperature (degC)
 49    T_b = 0.0
 50
 51    # Fluid temperatures (degC)
 52    T_f = np.array([1., 1.])
 53
 54    # Path to validation data
 55    filePath = './data/ClaHel11_multipole_temperature.txt'
 56
 57    # Thermal resistances for J=3
 58    R_Claesson = 0.01*np.array([25.592, 1.561, 25.311])
 59
 60    # Number of multipoles per pipe
 61    J = 3
 62
 63    # -------------------------------------------------------------------------
 64    # Evaluate the internal thermal resistances
 65    # -------------------------------------------------------------------------
 66
 67    # Thermal resistances
 68    (R, Rd) = gt.pipes.thermal_resistances(pos_pipes, rp_out, r_b, k_s, k_g,
 69                                           R_fp, J=3)
 70    print(50*'-')
 71    print('Thermal resistance:\t\t100*R11\t100*R12\t100*R22')
 72    print(f'Claesson and Hellstrom:\t{100*R_Claesson[0]:.3f}'
 73          f'\t{100*R_Claesson[1]:.3f}\t{100*R_Claesson[2]:.3f}')
 74    print(f'Present:\t\t\t\t{100*R[0,0]:.3f}\t{100*R[0,1]:.3f}'
 75          f'\t{100*R[1,1]:.3f}')
 76    print(50*'-')
 77
 78    # Heat flows
 79    Q = np.linalg.solve(R, T_f - T_b)
 80
 81    # -------------------------------------------------------------------------
 82    # Temperatures along y=0.
 83    # -------------------------------------------------------------------------
 84
 85    # Grid points to evaluate temperatures
 86    x = np.linspace(-0.1, 0.1, num=200)
 87    y = np.zeros_like(x)
 88
 89    # Evaluate temperatures using multipole method
 90    (T_f, T, it, eps_max) = gt.pipes.multipole(pos_pipes, rp_out, r_b, k_s,
 91                                               k_g, R_fp, T_b, Q, J,
 92                                               x_T=x, y_T=y)
 93
 94    # Load validation data
 95    data = np.loadtxt(filePath, skiprows=1)
 96
 97    # Configure figure and axes
 98    fig = gt.utilities._initialize_figure()
 99
100    ax1 = fig.add_subplot(111)
101    # Axis labels
102    ax1.set_xlabel(r'x (m)')
103    ax1.set_ylabel(r'$T(x,0)$')
104    # Axis limits
105    ax1.set_xlim([-0.1, 0.1])
106    ax1.set_ylim([-0.2, 1.2])
107    # Show grid
108    ax1.grid()
109    gt.utilities._format_axes(ax1)
110
111    ax1.plot(x, T, label='pygfunction')
112    ax1.plot(data[:,0], data[:,1], 'ko',
113             label='Claesson and Hellstrom (2011)')
114    ax1.legend(loc='upper left')
115
116    # Adjust to plot window
117    plt.tight_layout()
118
119    # -------------------------------------------------------------------------
120    # Temperatures in -0.1 < x < 0.1, -0.1 < y < 0.1
121    # -------------------------------------------------------------------------
122
123    # Grid points to evaluate temperatures
124    N_xy = 200
125    x = np.linspace(-0.1, 0.1, num=N_xy)
126    y = np.linspace(-0.1, 0.1, num=N_xy)
127    X, Y = np.meshgrid(x, y)
128
129    # Evaluate temperatures using multipole method
130    (T_f, T, it, eps_max) = gt.pipes.multipole(pos_pipes, rp_out, r_b, k_s,
131                                               k_g, R_fp, T_b, Q, J,
132                                               x_T=X.flatten(),
133                                               y_T=Y.flatten())
134
135    # Configure figure and axes
136    fig = gt.utilities._initialize_figure()
137
138    ax1 = fig.add_subplot(111)
139    # Axis labels
140    ax1.set_xlabel('x (m)')
141    ax1.set_ylabel('y (m)')
142    # Axis limits
143    plt.axis([-0.1, 0.1, -0.1, 0.1])
144    plt.gca().set_aspect('equal', adjustable='box')
145    gt.utilities._format_axes(ax1)
146
147    # Borehole wall outline
148    borewall = plt.Circle((0., 0.), radius=r_b,
149                          fill=False, linestyle='--', linewidth=2.)
150    ax1.add_patch(borewall)
151    # Pipe outlines
152    for pos, r_out_n in zip(pos_pipes, rp_out):
153        pipe = plt.Circle(pos, radius=r_out_n,
154                          fill=False, linestyle='-', linewidth=4.)
155        ax1.add_patch(pipe)
156    # Temperature contours
157    CS = ax1.contour(X, Y, T.reshape((N_xy, N_xy)),
158                     np.linspace(-0.2, 1.0, num=7))
159    plt.clabel(CS, inline=1, fontsize=10)
160
161    # Adjust to plot window
162    plt.tight_layout()
163
164    return
165
166
167# Main function
168if __name__ == '__main__':
169    main()

References

1(1,2)

Claesson, J., & Hellstrom, G. (2011). Multipole method to calculate borehole thermal resistances in a borehole heat exchanger. HVAC&R Research, 17(6), 895-911.