Calculation of g-functions with equal inlet fluid temperatureΒΆ

This example demonstrates the use of the g-function module and the pipes module to calculate g-functions using a boundary condition of equal inlet fluid temperature into all boreholes, based on the method of Cimmino [1]. The total rate of heat extraction in the bore field is constant.

The following script generates the g-functions of a rectangular field of 6 x 4 boreholes. The g-function using a boundary condition of equal inlet fluid temperature is compared to the g-functions obtained using boundary conditions of uniform heat extraction rate and of uniform borehole wall temperature.

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

  1# -*- coding: utf-8 -*-
  2""" Example of calculation of g-functions using equal inlet temperatures.
  3
  4    The g-functions of a field of 6x4 boreholes are calculated for boundary
  5    conditions of (a) uniform heat extraction rate, equal for all boreholes,
  6    (b) uniform borehole wall temperature along the boreholes, equal for all
  7    boreholes, and (c) equal inlet fluid temperature into all boreholes.
  8
  9"""
 10import matplotlib.pyplot as plt
 11import numpy as np
 12
 13import pygfunction as gt
 14
 15
 16def main():
 17    # -------------------------------------------------------------------------
 18    # Simulation parameters
 19    # -------------------------------------------------------------------------
 20
 21    # Borehole dimensions
 22    D = 4.0             # Borehole buried depth (m)
 23    H = 150.0           # Borehole length (m)
 24    r_b = 0.075         # Borehole radius (m)
 25    B = 7.5             # Borehole spacing (m)
 26
 27    # Pipe dimensions
 28    r_out = 0.0211      # Pipe outer radius (m)
 29    r_in = 0.0147       # Pipe inner radius (m)
 30    D_s = 0.052         # Shank spacing (m)
 31    epsilon = 1.0e-6    # Pipe roughness (m)
 32
 33    # Pipe positions
 34    # Single U-tube [(x_in, y_in), (x_out, y_out)]
 35    pos_pipes = [(-D_s, 0.), (D_s, 0.)]
 36
 37    # Ground properties
 38    alpha = 1.0e-6      # Ground thermal diffusivity (m2/s)
 39    k_s = 2.0           # Ground thermal conductivity (W/m.K)
 40
 41    # Grout properties
 42    k_g = 1.0           # Grout thermal conductivity (W/m.K)
 43
 44    # Pipe properties
 45    k_p = 0.4           # Pipe thermal conductivity (W/m.K)
 46
 47    # Fluid properties
 48    m_flow_borehole = 0.25  # Total fluid mass flow rate per borehole (kg/s)
 49    # The fluid is propylene-glycol (20 %) at 20 degC
 50    fluid = gt.media.Fluid('MPG', 20.)
 51    cp_f = fluid.cp     # Fluid specific isobaric heat capacity (J/kg.K)
 52    rho_f = fluid.rho   # Fluid density (kg/m3)
 53    mu_f = fluid.mu     # Fluid dynamic viscosity (kg/m.s)
 54    k_f = fluid.k       # Fluid thermal conductivity (W/m.K)
 55
 56    # g-Function calculation options
 57    nSegments = 8
 58    options = {'nSegments': nSegments,
 59               'disp': True}
 60
 61    # Geometrically expanding time vector.
 62    dt = 100*3600.                  # Time step
 63    tmax = 3000. * 8760. * 3600.    # Maximum time
 64    Nt = 25                         # Number of time steps
 65    ts = H**2/(9.*alpha)            # Bore field characteristic time
 66    time = gt.utilities.time_geometric(dt, tmax, Nt)
 67
 68    # -------------------------------------------------------------------------
 69    # Borehole field
 70    # -------------------------------------------------------------------------
 71
 72    # Field of 6x4 (n=24) boreholes
 73    N_1 = 6
 74    N_2 = 4
 75    borefield = gt.borefield.Borefield.rectangle_field(
 76        N_1, N_2, B, B, H, D, r_b)
 77    nBoreholes = len(borefield)
 78
 79    # -------------------------------------------------------------------------
 80    # Initialize pipe model
 81    # -------------------------------------------------------------------------
 82
 83    # Pipe thermal resistance
 84    R_p = gt.pipes.conduction_thermal_resistance_circular_pipe(
 85        r_in, r_out, k_p)
 86    # Fluid to inner pipe wall thermal resistance (Single U-tube)
 87    m_flow_pipe = m_flow_borehole
 88    h_f = gt.pipes.convective_heat_transfer_coefficient_circular_pipe(
 89        m_flow_pipe, r_in, mu_f, rho_f, k_f, cp_f, epsilon)
 90    R_f = 1.0 / (h_f * 2 * np.pi * r_in)
 91
 92    # Single U-tube, same for all boreholes in the bore field
 93    UTubes = []
 94    for borehole in borefield:
 95        SingleUTube = gt.pipes.SingleUTube(
 96            pos_pipes, r_in, r_out, borehole, k_s, k_g, R_f + R_p)
 97        UTubes.append(SingleUTube)
 98    m_flow_network = m_flow_borehole * nBoreholes
 99    network = gt.networks.Network(borefield, UTubes)
100
101    # -------------------------------------------------------------------------
102    # Evaluate the g-functions for the borefield
103    # -------------------------------------------------------------------------
104
105    # Calculate the g-function for uniform heat extraction rate
106    gfunc_uniform_Q = gt.gfunction.gFunction(
107        borefield, alpha, time=time, boundary_condition='UHTR',
108        options=options)
109
110    # Calculate the g-function for uniform borehole wall temperature
111    gfunc_uniform_T = gt.gfunction.gFunction(
112        borefield, alpha, time=time, boundary_condition='UBWT',
113        options=options)
114
115    # Calculate the g-function for equal inlet fluid temperature
116    gfunc_equal_Tf_in = gt.gfunction.gFunction(
117        network, alpha, time=time, m_flow_network=m_flow_network, cp_f=cp_f,
118        boundary_condition='MIFT', options=options)
119
120    # -------------------------------------------------------------------------
121    # Plot g-functions
122    # -------------------------------------------------------------------------
123
124    ax = gfunc_uniform_Q.visualize_g_function().axes[0]
125    ax.plot(np.log(time / ts), gfunc_uniform_T.gFunc, 'k--')
126    ax.plot(np.log(time / ts), gfunc_equal_Tf_in.gFunc, 'r-.')
127    ax.legend(['Uniform heat extraction rate',
128               'Uniform borehole wall temperature',
129               'Equal inlet temperature'])
130    plt.tight_layout()
131
132    return
133
134
135# Main function
136if __name__ == '__main__':
137    main()

References