Calculation of fluid temperature profiles in a borehole with independent U-tubesΒΆ
This example demonstrates the use of the pipes module to calculate the fluid temperature profiles in a borehole with independent U-tubes, based on the method of Cimmino 1. The borehole wall temperature is uniform in this example.
The following script evaluates the fluid temperatures in a borehole with 4 independent U-tubes with different inlet fluid temperatures and different inlet fluid mass flow rates. The resulting fluid temperature profiles are verified against the fluid temeprature profiles presented by Cimmino 1.
The script is located in: pygfunction/examples/multiple_independent_Utubes.py
1# -*- coding: utf-8 -*-
2""" Example of calculation of fluid temperature profiles in a borehole with
3 independent U-tubes.
4
5 The fluid temperature profiles in a borehole with 4 independent U-tubes are
6 calculated. The borehole has 4 U-tubes, each with different inlet fluid
7 temperatures and different inlet fluid mass flow rates. The borehole wall
8 temperature is uniform. Results are verified against the results of
9 Cimmino (2016).
10
11"""
12import matplotlib.lines as mlines
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 D = 2.5 # Borehole buried depth (m)
28 H = 100.0 # Borehole length (m)
29 r_b = 0.075 # Borehole radius (m)
30
31 # Pipe dimensions
32 r_out = 0.010 # Pipe outer radius (m)
33 r_in = 0.008 # Pipe inner radius (m)
34 D_s = 0.060 # Shank spacing (m)
35
36 # Pipe positions
37 nPipes = 4 # Number of U-tube pipes (-)
38 pos_pipes = _pipePositions(D_s, nPipes)
39
40 # Ground properties
41 k_s = 2.0 # Ground thermal conductivity (W/m.K)
42
43 # Grout properties
44 k_g = 1.0 # Grout thermal conductivity (W/m.K)
45
46 # Fluid properties
47 R_fp = 1e-30 # Fluid to outer pipe wall thermal resistance (m.K/W)
48 # Fluid specific isobaric heat capacity per U-tube (J/kg.K)
49 cp_f = 4000.*np.ones(nPipes)
50
51 # Borehole wall temperature (degC)
52 T_b = 2.0
53 # Total fluid mass flow rate per U-tube (kg/s)
54 m_flow_borehole = np.array([0.40, 0.35, 0.30, 0.25])
55 # Inlet fluid temperatures per U-tube (degC)
56 T_f_in = np.array([6.0, -6.0, 5.0, -5.0])
57
58 # Path to validation data
59 filePath = './data/Cimmi16_multiple_independent_Utubes.txt'
60
61 # -------------------------------------------------------------------------
62 # Initialize pipe model
63 # -------------------------------------------------------------------------
64
65 # Borehole object
66 borehole = gt.boreholes.Borehole(H, D, r_b, 0., 0.)
67 # Multiple independent U-tubes
68 MultipleUTube = gt.pipes.IndependentMultipleUTube(
69 pos_pipes, r_in, r_out, borehole, k_s, k_g, R_fp, nPipes, J=0)
70
71 # -------------------------------------------------------------------------
72 # Evaluate the outlet fluid temperatures and fluid temperature profiles
73 # -------------------------------------------------------------------------
74
75 # Calculate the outlet fluid temperatures
76 T_f_out = MultipleUTube.get_outlet_temperature(
77 T_f_in, T_b, m_flow_borehole, cp_f)
78
79 # Evaluate temperatures at nz evenly spaced depths along the borehole
80 nz = 20
81 z = np.linspace(0., H, num=nz)
82 T_f = MultipleUTube.get_temperature(z, T_f_in, T_b, m_flow_borehole, cp_f)
83
84 # -------------------------------------------------------------------------
85 # Plot fluid temperature profiles
86 # -------------------------------------------------------------------------
87
88 # Configure figure and axes
89 fig = gt.utilities._initialize_figure()
90
91 ax1 = fig.add_subplot(111)
92 # Axis labels
93 ax1.set_xlabel(r'Temperature [degC]')
94 ax1.set_ylabel(r'Depth from borehole head [m]')
95 gt.utilities._format_axes(ax1)
96
97 # Plot temperatures
98 ax1.plot(T_f, z, 'k.')
99 ax1.plot(np.array([T_b, T_b]), np.array([0., H]), 'k--')
100 # Labels
101 calculated = mlines.Line2D([], [],
102 color='black',
103 ls='None',
104 marker='.',
105 label='Fluid')
106 borehole_temp = mlines.Line2D([], [],
107 color='black',
108 ls='--',
109 marker='None',
110 label='Borehole wall')
111 plt.tight_layout()
112
113 # -------------------------------------------------------------------------
114 # Load data from Cimmino (2016)
115 # -------------------------------------------------------------------------
116 data = np.loadtxt(filePath, skiprows=1)
117 ax1.plot(data[:,2:], data[:,0], 'b-',)
118 reference = mlines.Line2D([], [],
119 color='blue',
120 ls='-',
121 lw=1.5,
122 marker='None',
123 label='Cimmino (2016)')
124 ax1.legend(handles=[borehole_temp, calculated, reference],
125 loc='upper left')
126
127 # Reverse y-axis
128 ax1.set_ylim(ax1.get_ylim()[::-1])
129 # Adjust to plot window
130
131 return
132
133
134def _pipePositions(Ds, nPipes):
135 """ Positions pipes in an axisymetric configuration.
136 """
137 dt = pi / float(nPipes)
138 pos = [(0., 0.) for i in range(2*nPipes)]
139 for i in range(nPipes):
140 pos[i] = (Ds*np.cos(2.0*i*dt+pi), Ds*np.sin(2.0*i*dt+pi))
141 pos[i+nPipes] = (Ds*np.cos(2.0*i*dt+pi+dt), Ds*np.sin(2.0*i*dt+pi+dt))
142 return pos
143
144
145# Main function
146if __name__ == '__main__':
147 main()
References