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 temperature 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 os
 13
 14import matplotlib.lines as mlines
 15import matplotlib.pyplot as plt
 16import numpy as np
 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    base_dir = os.path.dirname(os.path.abspath(__file__))
 60    file_path = os.path.join(base_dir, 'data', 'Cimmi16_multiple_independent_Utubes.txt')
 61
 62    # -------------------------------------------------------------------------
 63    # Initialize pipe model
 64    # -------------------------------------------------------------------------
 65
 66    # Borehole object
 67    borehole = gt.boreholes.Borehole(H, D, r_b, 0., 0.)
 68    # Multiple independent U-tubes
 69    MultipleUTube = gt.pipes.IndependentMultipleUTube(
 70            pos_pipes, r_in, r_out, borehole, k_s, k_g, R_fp, nPipes, J=0)
 71
 72    # -------------------------------------------------------------------------
 73    # Evaluate the outlet fluid temperatures and fluid temperature profiles
 74    # -------------------------------------------------------------------------
 75
 76    # Calculate the outlet fluid temperatures
 77    T_f_out = MultipleUTube.get_outlet_temperature(
 78        T_f_in, T_b, m_flow_borehole, cp_f)
 79
 80    # Evaluate temperatures at nz evenly spaced depths along the borehole
 81    nz = 20
 82    z = np.linspace(0., H, num=nz)
 83    T_f = MultipleUTube.get_temperature(z, T_f_in, T_b, m_flow_borehole, cp_f)
 84
 85    # -------------------------------------------------------------------------
 86    # Plot fluid temperature profiles
 87    # -------------------------------------------------------------------------
 88
 89    # Configure figure and axes
 90    fig = gt.utilities._initialize_figure()
 91
 92    ax1 = fig.add_subplot(111)
 93    # Axis labels
 94    ax1.set_xlabel(r'Temperature [degC]')
 95    ax1.set_ylabel(r'Depth from borehole head [m]')
 96    gt.utilities._format_axes(ax1)
 97
 98    # Plot temperatures
 99    ax1.plot(T_f, z, 'k.')
100    ax1.plot(np.array([T_b, T_b]), np.array([0., H]), 'k--')
101    # Labels
102    calculated = mlines.Line2D([], [],
103                               color='black',
104                               ls='None',
105                               marker='.',
106                               label='Fluid')
107    borehole_temp = mlines.Line2D([], [],
108                                  color='black',
109                                  ls='--',
110                                  marker='None',
111                                  label='Borehole wall')
112    plt.tight_layout()
113
114    # -------------------------------------------------------------------------
115    # Load data from Cimmino (2016)
116    # -------------------------------------------------------------------------
117    data = np.loadtxt(file_path, skiprows=1)
118    ax1.plot(data[:,2:], data[:,0], 'b-',)
119    reference = mlines.Line2D([], [],
120                              color='blue',
121                              ls='-',
122                              lw=1.5,
123                              marker='None',
124                              label='Cimmino (2016)')
125    ax1.legend(handles=[borehole_temp, calculated, reference],
126               loc='upper left')
127
128    # Reverse y-axis
129    ax1.set_ylim(ax1.get_ylim()[::-1])
130    # Adjust to plot window
131
132    return
133
134
135def _pipePositions(Ds, nPipes):
136    """ Positions pipes in an axisymetric configuration.
137    """
138    dt = np.pi / float(nPipes)
139    pos = [(0., 0.) for i in range(2*nPipes)]
140    for i in range(nPipes):
141        pos[i] = (Ds*np.cos(2.0*i*dt+np.pi), Ds*np.sin(2.0*i*dt+np.pi))
142        pos[i+nPipes] = (Ds*np.cos(2.0*i*dt+np.pi+dt), Ds*np.sin(2.0*i*dt+np.pi+dt))
143    return pos
144
145
146# Main function
147if __name__ == '__main__':
148    main()

References