Calculation of g-functions with uniform borehole heat extraction ratesΒΆ

This example demonstrates the use of the g-function module to calculate g-functions using a boundary condition of uniform and equal heat extraction rate for all boreholes, constant in time.

The following script generates the g-functions of rectangular fields of 3 x 2, 6 x 4 and 10 x 10 boreholes. g-Functions are verified against the g-functions presented by Cimmino and Bernier 1.

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

  1# -*- coding: utf-8 -*-
  2""" Example of calculation of g-functions using uniform heat extraction rates.
  3
  4    The g-functions of fields of 3x2, 6x4 and 10x10 boreholes are calculated
  5    for boundary condition of uniform heat extraction rate along the boreholes,
  6    equal for all boreholes.
  7
  8"""
  9import matplotlib.lines as mlines
 10import matplotlib.pyplot as plt
 11import numpy as np
 12from matplotlib.ticker import AutoMinorLocator
 13
 14import pygfunction as gt
 15
 16
 17def main():
 18    # -------------------------------------------------------------------------
 19    # Simulation parameters
 20    # -------------------------------------------------------------------------
 21
 22    # Borehole dimensions
 23    D = 4.0             # Borehole buried depth (m)
 24    H = 150.0           # Borehole length (m)
 25    r_b = 0.075         # Borehole radius (m)
 26    B = 7.5             # Borehole spacing (m)
 27
 28    # Thermal properties
 29    alpha = 1.0e-6      # Ground thermal diffusivity (m2/s)
 30
 31    # Path to validation data
 32    filePath = './data/CiBe14_uniform_heat_extraction_rate.txt'
 33
 34    # g-Function calculation options
 35    # The second field is evaluated with more segments to draw the
 36    # temperature profiles. A uniform discretization is used to compare results
 37    # with Cimmino and Bernier (2014).
 38    options = [{'nSegments': 1,
 39                'segment_ratios': None,
 40                'disp': True,
 41                'profiles': True},
 42               {'nSegments': 12,
 43                'segment_ratios': None,
 44                'disp': True,
 45                'profiles': True},
 46               {'nSegments': 1,
 47                'segment_ratios': None,
 48                'disp': True,
 49                'profiles': True}]
 50
 51    # The 'similarities' method is used to consider unequal numbers of segments
 52    # per borehole and to plot heat extraction rate profiles along
 53    # individual boreholes
 54    method = 'similarities'
 55
 56    # Geometrically expanding time vector.
 57    dt = 100*3600.                  # Time step
 58    tmax = 3000. * 8760. * 3600.    # Maximum time
 59    Nt = 25                         # Number of time steps
 60    ts = H**2/(9.*alpha)            # Bore field characteristic time
 61    time = gt.utilities.time_geometric(dt, tmax, Nt)
 62
 63    # -------------------------------------------------------------------------
 64    # Borehole fields
 65    # -------------------------------------------------------------------------
 66
 67    # Field of 3x2 (n=6) boreholes
 68    N_1 = 3
 69    N_2 = 2
 70    boreField1 = gt.boreholes.rectangle_field(N_1, N_2, B, B, H, D, r_b)
 71
 72    # Field of 6x4 (n=24) boreholes
 73    N_1 = 6
 74    N_2 = 4
 75    boreField2 = gt.boreholes.rectangle_field(N_1, N_2, B, B, H, D, r_b)
 76
 77    # Field of 10x10 (n=100) boreholes
 78    N_1 = 10
 79    N_2 = 10
 80    boreField3 = gt.boreholes.rectangle_field(N_1, N_2, B, B, H, D, r_b)
 81
 82    # -------------------------------------------------------------------------
 83    # Load data from Cimmino and Bernier (2014)
 84    # -------------------------------------------------------------------------
 85    data = np.loadtxt(filePath, skiprows=55)
 86
 87    # -------------------------------------------------------------------------
 88    # Evaluate g-functions for all fields
 89    # -------------------------------------------------------------------------
 90    for i, field in enumerate([boreField1, boreField2, boreField3]):
 91        gfunc = gt.gfunction.gFunction(
 92            field, alpha, time=time, boundary_condition='UHTR',
 93            options=options[i], method=method)
 94        # Draw g-function
 95        ax = gfunc.visualize_g_function().axes[0]
 96        # Draw reference g-function
 97        ax.plot(data[:,0], data[:,i+1], 'bx')
 98        ax.legend(['pygfunction', 'Cimmino and Bernier (2014)'])
 99        ax.set_title('Field of {} boreholes'.format(len(field)))
100        plt.tight_layout()
101
102        # For the second borefield, draw the evolution of heat extraction rates
103        if i == 1:
104            gfunc.visualize_temperatures(iBoreholes=[18, 12, 14])
105            gfunc.visualize_temperature_profiles(iBoreholes=[14])
106
107    return
108
109
110# Main function
111if __name__ == '__main__':
112    main()

References

1

Cimmino, M., & Bernier, M. (2014). A semi-analytical method to generate g-functions for geothermal bore fields. International Journal of Heat and Mass Transfer, 70, 641-650.