Heat Transfer Module

pygfunction.heat_transfer.finite_line_source(time, alpha, borehole1, borehole2, reaSource=True, imgSource=True, approximation=False, M=11, N=10)

Evaluate the Finite Line Source (FLS) solution.

This function uses a numerical quadrature to evaluate the one-integral form of the FLS solution. For vertical boreholes, the FLS solution was proposed by Claesson and Javed [1] and extended to boreholes with different vertical positions by Cimmino and Bernier [2]. The FLS solution is given by:

\[ \begin{align}\begin{aligned}h_{1\rightarrow2}(t) &= \frac{1}{2H_2} \int_{\frac{1}{\sqrt{4\alpha t}}}^{\infty} e^{-d_{12}^2s^2}(I_{real}(s)+I_{imag}(s))ds\\d_{12} &= \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}\\I_{real}(s) &= erfint((D_2-D_1+H_2)s) - erfint((D_2-D_1)s)\\&+ erfint((D_2-D_1-H_1)s) - erfint((D_2-D_1+H_2-H_1)s)\\I_{imag}(s) &= erfint((D_2+D_1+H_2)s) - erfint((D_2+D_1)s)\\&+ erfint((D_2+D_1+H_1)s) - erfint((D_2+D_1+H_2+H_1)s)\\erfint(X) &= \int_{0}^{X} erf(x) dx\\ &= Xerf(X) - \frac{1}{\sqrt{\pi}}(1-e^{-X^2})\end{aligned}\end{align} \]

For inclined boreholes, the FLS solution was proposed by Lazzarotto [4] and Lazzarotto and Björk [5]. The FLS solution is given by:

\[ \begin{align}\begin{aligned}h_{1\rightarrow2}(t) &= \frac{H_1}{2H_2} \int_{\frac{1}{\sqrt{4\alpha t}}}^{\infty} \frac{1}{s} \int_{0}^{1} (I_{real}(u, s)+I_{imag}(u, s)) du ds\\I_{real}(u, s) &= e^{-((x_1 - x_2)^2 + (y_1 - y_2)^2 + (D_1 - D_2)^2) s^2}\\&\cdot (erf((u H_1 k_{0,real} + k_{2,real}) s) - erf((u H_1 k_{0,real} + k_{2,real} - H_2) s))\\&\cdot e^{(u^2 H_1^2 (k_{0,real}^2 - 1) + 2 u H_1 (k_{0,real} k_{2,real} - k_{1,real}) + k_{2,real}^2) s^2} du ds\\I_{imag}(u, s) &= -e^{-((x_1 - x_2)^2 + (y_1 - y_2)^2 + (D_1 + D_2)^2) s^2}\\&\cdot (erf((u H_1 k_{0,imag} + k_{2,imag}) s) - erf((u H_1 k_{0,imag} + k_{2,imag} - H_2) s))\\&\cdot e^{(u^2 H_1^2 (k_{0,imag}^2 - 1) + 2 u H_1 (k_{0,imag} k_{2,imag} - k_1) + k_{2,imag}^2) s^2} du ds\\k_{0,real} &= sin(\beta_1) sin(\beta_2) cos(\theta_1 - \theta_2) + cos(\beta_1) cos(\beta_2)\\k_{0,imag} &= sin(\beta_1) sin(\beta_2) cos(\theta_1 - \theta_2) - cos(\beta_1) cos(\beta_2)\\k_{1,real} &= sin(\beta_1) (cos(\theta_1) (x_1 - x_2) + sin(\theta_1) (y_1 - y_2)) + cos(\beta_1) (D_1 - D_2)\\k_{1,imag} &= sin(\beta_1) (cos(\theta_1) (x_1 - x_2) + sin(\theta_1) (y_1 - y_2)) + cos(\beta_1) (D_1 + D_2)\\k_{2,real} &= sin(\beta_2) (cos(\theta_2) (x_1 - x_2) + sin(\theta_2) (y_1 - y_2)) + cos(\beta_2) (D_1 - D_2)\\k_{2,imag} &= sin(\beta_2) (cos(\theta_2) (x_1 - x_2) + sin(\theta_2) (y_1 - y_2)) - cos(\beta_2) (D_1 + D_2)\end{aligned}\end{align} \]

where \(\beta_1\) and \(\beta_2\) are the tilt angle of the boreholes (relative to vertical), and \(\theta_1\) and \(\theta_2\) are the orientation of the boreholes (relative to the x-axis).

Note

The reciprocal thermal response factor \(h_{2\rightarrow1}(t)\) can be conveniently calculated by:

\[h_{2\rightarrow1}(t) = \frac{H_2}{H_1} h_{1\rightarrow2}(t)\]
Parameters:
timefloat or array, shape (K)

Value of time (in seconds) for which the FLS solution is evaluated.

alphafloat

Soil thermal diffusivity (in m2/s).

borehole1Borehole object or list of Borehole objects, length (N)

Borehole object of the borehole extracting heat.

borehole2Borehole object or list of Borehole objects, length (M)

Borehole object for which the FLS is evaluated.

reaSourcebool

True if the real part of the FLS solution is to be included. Default is True.

imgSourcebool, optional

True if the image part of the FLS solution is to be included. Default is True.

approximationbool, optional

Set to true to use the approximation of the FLS solution of Cimmino (2021) [3]. This approximation does not require the numerical evaluation of any integral. Default is False.

Mint, optional

Number of Gauss-Legendre sample points for the quadrature over \(u\). This is only used for inclined boreholes. Default is 11.

Nint, optional

Number of terms in the approximation of the FLS solution. This parameter is unused if approximation is set to False. Default is 10. Maximum is 25.

Returns:
hfloat or array, shape (M, N, K), (M, N) or (K)

Value of the FLS solution. The average (over the length) temperature drop on the wall of borehole2 due to heat extracted from borehole1 is:

\[\Delta T_{b,2} = T_g - \frac{Q_1}{2\pi k_s H_2} h\]

Notes

The function returns a float if time is a float and borehole1 and borehole2 are Borehole objects. If time is a float and any of borehole1 and borehole2 are lists, the function returns an array, shape (M, N), If time is an array and borehole1 and borehole2 are Borehole objects, the function returns an array, shape (K).If time is an array and any of borehole1 and borehole2 are are lists, the function returns an array, shape (M, N, K).

References

Examples

>>> b1 = gt.boreholes.Borehole(H=150., D=4., r_b=0.075, x=0., y=0.)
>>> b2 = gt.boreholes.Borehole(H=150., D=4., r_b=0.075, x=5., y=0.)
>>> h = gt.heat_transfer.finite_line_source(4*168*3600., 1.0e-6, b1, b2)
h = 0.0110473635393
>>> h = gt.heat_transfer.finite_line_source(
    4*168*3600., 1.0e-6, b1, b2, approximation=True, N=10)
h = 0.0110474667731
>>> b3 = gt.boreholes.Borehole(
    H=150., D=4., r_b=0.075, x=5., y=0., tilt=3.1415/15, orientation=0.)
>>> h = gt.heat_transfer.finite_line_source(
    4*168*3600., 1.0e-6, b1, b3, M=21)
h = 0.0002017450051
pygfunction.heat_transfer.finite_line_source_approximation(time, alpha, dis, H1, D1, H2, D2, reaSource=True, imgSource=True, N=10)

Evaluate the Finite Line Source (FLS) solution using the approximation of Cimmino (2021) [6].

Parameters:
timefloat or array, shape (K)

Value of time (in seconds) for which the FLS solution is evaluated.

alphafloat

Soil thermal diffusivity (in m2/s).

disfloat or array

Radial distances to evaluate the FLS solution.

H1float or array

Lengths of the emitting heat sources.

D1float or array

Buried depths of the emitting heat sources.

H2float or array

Lengths of the receiving heat sources.

D2float or array

Buried depths of the receiving heat sources.

reaSourcebool, optional

True if the real part of the FLS solution is to be included. Default is True.

imgSourcebool, optional

True if the image part of the FLS solution is to be included. Default is True.

Nint, optional

Number of terms in the approximation of the FLS solution. This parameter is unused if approximation is set to False. Default is 10. Maximum is 25.

Returns:
hfloat

Value of the FLS solution. The average (over the length) temperature drop on the wall of borehole2 due to heat extracted from borehole1 is:

\[\Delta T_{b,2} = T_g - \frac{Q_1}{2\pi k_s H_2} h\]

References

pygfunction.heat_transfer.finite_line_source_equivalent_boreholes_vectorized(time, alpha, dis, wDis, H1, D1, H2, D2, N2, reaSource=True, imgSource=True)

Evaluate the equivalent Finite Line Source (FLS) solution.

This function uses a numerical quadrature to evaluate the one-integral form of the FLS solution, as proposed by Prieto and Cimmino [7]. The equivalent FLS solution is given by:

\[ \begin{align}\begin{aligned}h_{1\rightarrow2}(t) &= \frac{1}{2 H_2 N_{b,2}} \int_{\frac{1}{\sqrt{4\alpha t}}}^{\infty} \sum_{G_1} \sum_{G_2} e^{-d_{12}^2s^2}(I_{real}(s)+I_{imag}(s))ds\\I_{real}(s) &= erfint((D_2-D_1+H_2)s) - erfint((D_2-D_1)s)\\&+ erfint((D_2-D_1-H_1)s) - erfint((D_2-D_1+H_2-H_1)s)\\I_{imag}(s) &= erfint((D_2+D_1+H_2)s) - erfint((D_2+D_1)s)\\&+ erfint((D_2+D_1+H_1)s) - erfint((D_2+D_1+H_2+H_1)s)\\erfint(X) &= \int_{0}^{X} erf(x) dx\\ &= Xerf(X) - \frac{1}{\sqrt{\pi}}(1-e^{-X^2})\end{aligned}\end{align} \]

Note

The reciprocal thermal response factor \(h_{2\rightarrow1}(t)\) can be conveniently calculated by:

\[h_{2\rightarrow1}(t) = \frac{H_2 N_{b,2}}{H_1 N_{b,1}} h_{1\rightarrow2}(t)\]
Parameters:
timefloat or array, shape (K)

Value of time (in seconds) for which the FLS solution is evaluated.

alphafloat

Soil thermal diffusivity (in m2/s).

disarray

Unique radial distances to evaluate the FLS solution.

wDisarray

Number of instances of each unique radial distances.

H1float or array

Lengths of the emitting heat sources.

D1float or array

Buried depths of the emitting heat sources.

H2float or array

Lengths of the receiving heat sources.

D2float or array

Buried depths of the receiving heat sources.

N2float or array,

Number of segments represented by the receiving heat sources.

reaSourcebool

True if the real part of the FLS solution is to be included. Default is True.

imgSourcebool

True if the image part of the FLS solution is to be included. Default is True.

Returns:
hfloat

Value of the FLS solution. The average (over the length) temperature drop on the wall of borehole2 due to heat extracted from borehole1 is:

\[\Delta T_{b,2} = T_g - \frac{Q_1}{2\pi k_s H_2} h\]

Notes

This is a vectorized version of the finite_line_source() function using scipy.integrate.quad_vec to speed up calculations. All arrays (dis, H1, D1, H2, D2) must follow numpy array broadcasting rules. If time is an array, the integrals for different time values are stacked on the last axis.

References

pygfunction.heat_transfer.finite_line_source_inclined_approximation(time, alpha, rb1, x1, y1, H1, D1, tilt1, orientation1, x2, y2, H2, D2, tilt2, orientation2, reaSource=True, imgSource=True, M=11, N=10)

Evaluate the inclined Finite Line Source (FLS) solution using the approximation method of Cimmino (2021) [8].

Parameters:
timefloat or array, shape (K)

Value of time (in seconds) for which the FLS solution is evaluated.

alphafloat

Soil thermal diffusivity (in m2/s).

rb1array

Radii of the emitting heat sources.

x1float or array

x-Positions of the emitting heat sources.

y1float or array

y-Positions of the emitting heat sources.

H1float or array

Lengths of the emitting heat sources.

D1float or array

Buried depths of the emitting heat sources.

tilt1float or array

Angles (in radians) from vertical of the emitting heat sources.

orientation1float or array

Directions (in radians) of the tilt the emitting heat sources.

x2array

x-Positions of the receiving heat sources.

y2array

y-Positions of the receiving heat sources.

H2float or array

Lengths of the receiving heat sources.

D2float or array

Buried depths of the receiving heat sources.

tilt2float or array

Angles (in radians) from vertical of the receiving heat sources.

orientation2float or array

Directions (in radians) of the tilt the receiving heat sources.

reaSourcebool, optional

True if the real part of the FLS solution is to be included. Default is True.

imgSourcebool, optional

True if the image part of the FLS solution is to be included. Default is true.

Mint, optional

Number of points for the Gauss-Legendre quadrature rule along the receiving heat sources. Default is 21.

Nint, optional

Number of terms in the approximation of the FLS solution. Default is 10. Maximum is 25.

Returns:
hfloat

Value of the FLS solution. The average (over the length) temperature drop on the wall of borehole2 due to heat extracted from borehole1 is:

\[\Delta T_{b,2} = T_g - \frac{Q_1}{2\pi k_s H_2} h\]

References

pygfunction.heat_transfer.finite_line_source_inclined_vectorized(time, alpha, rb1, x1, y1, H1, D1, tilt1, orientation1, x2, y2, H2, D2, tilt2, orientation2, reaSource=True, imgSource=True, M=11, approximation=False, N=10)

Evaluate the inclined Finite Line Source (FLS) solution.

This function uses a numerical quadrature to evaluate the inclined FLS solution, as proposed by Lazzarotto [9]. The inclined FLS solution is given by:

\[ \begin{align}\begin{aligned}h_{1\rightarrow2}(t) &= \frac{H_1}{2H_2} \int_{\frac{1}{\sqrt{4\alpha t}}}^{\infty} \frac{1}{s} \int_{0}^{1} (I_{real}(u, s)+I_{imag}(u, s)) du ds\\I_{real}(u, s) &= e^{-((x_1 - x_2)^2 + (y_1 - y_2)^2 + (D_1 - D_2)^2) s^2}\\&\cdot (erf((u H_1 k_{0,real} + k_{2,real}) s) - erf((u H_1 k_{0,real} + k_{2,real} - H_2) s))\\&\cdot e^{(u^2 H_1^2 (k_{0,real}^2 - 1) + 2 u H_1 (k_{0,real} k_{2,real} - k_{1,real}) + k_{2,real}^2) s^2} du ds\\I_{imag}(u, s) &= -e^{-((x_1 - x_2)^2 + (y_1 - y_2)^2 + (D_1 + D_2)^2) s^2}\\&\cdot (erf((u H_1 k_{0,imag} + k_{2,imag}) s) - erf((u H_1 k_{0,imag} + k_{2,imag} - H_2) s))\\&\cdot e^{(u^2 H_1^2 (k_{0,imag}^2 - 1) + 2 u H_1 (k_{0,imag} k_{2,imag} - k_1) + k_{2,imag}^2) s^2} du ds\\k_{0,real} &= sin(\beta_1) sin(\beta_2) cos(\theta_1 - \theta_2) + cos(\beta_1) cos(\beta_2)\\k_{0,imag} &= sin(\beta_1) sin(\beta_2) cos(\theta_1 - \theta_2) - cos(\beta_1) cos(\beta_2)\\k_{1,real} &= sin(\beta_1) (cos(\theta_1) (x_1 - x_2) + sin(\theta_1) (y_1 - y_2)) + cos(\beta_1) (D_1 - D_2)\\k_{1,imag} &= sin(\beta_1) (cos(\theta_1) (x_1 - x_2) + sin(\theta_1) (y_1 - y_2)) + cos(\beta_1) (D_1 + D_2)\\k_{2,real} &= sin(\beta_2) (cos(\theta_2) (x_1 - x_2) + sin(\theta_2) (y_1 - y_2)) + cos(\beta_2) (D_1 - D_2)\\k_{2,imag} &= sin(\beta_2) (cos(\theta_2) (x_1 - x_2) + sin(\theta_2) (y_1 - y_2)) - cos(\beta_2) (D_1 + D_2)\end{aligned}\end{align} \]

where \(\beta_1\) and \(\beta_2\) are the tilt angle of the boreholes (relative to vertical), and \(\theta_1\) and \(\theta_2\) are the orientation of the boreholes (relative to the x-axis).

Note

The reciprocal thermal response factor \(h_{2\rightarrow1}(t)\) can be conveniently calculated by:

\[h_{2\rightarrow1}(t) = \frac{H_2}{H_1} h_{1\rightarrow2}(t)\]
Parameters:
timefloat or array, shape (K)

Value of time (in seconds) for which the FLS solution is evaluated.

alphafloat

Soil thermal diffusivity (in m2/s).

rb1array

Radii of the emitting heat sources.

x1float or array

x-Positions of the emitting heat sources.

y1float or array

y-Positions of the emitting heat sources.

H1float or array

Lengths of the emitting heat sources.

D1float or array

Buried depths of the emitting heat sources.

tilt1float or array

Angles (in radians) from vertical of the emitting heat sources.

orientation1float or array

Directions (in radians) of the tilt the emitting heat sources.

x2array

x-Positions of the receiving heat sources.

y2array

y-Positions of the receiving heat sources.

H2float or array

Lengths of the receiving heat sources.

D2float or array

Buried depths of the receiving heat sources.

tilt2float or array

Angles (in radians) from vertical of the receiving heat sources.

orientation2float or array

Directions (in radians) of the tilt the receiving heat sources.

reaSourcebool, optional

True if the real part of the FLS solution is to be included. Default is True.

imgSourcebool, optional

True if the image part of the FLS solution is to be included. Default is true.

Mint, optional

Number of points for the Gauss-Legendre quadrature rule along the receiving heat sources. Default is 21.

approximationbool, optional

Set to true to use the approximation of the FLS solution of Cimmino (2021) [12]. This approximation does not require the numerical evaluation of any integral. Default is False.

Nint, optional

Number of terms in the approximation of the FLS solution. This parameter is unused if approximation is set to False. Default is 10. Maximum is 25.

Returns:
fcallable

Integrand of the finite line source solution. Can be vector-valued.

Notes

This is a vectorized version of the finite_line_source() function using scipy.integrate.quad_vec to speed up calculations. All arrays (x1, y1, H1, D1, tilt1, orientation1, x2, y2, H2, D2, tilt2, orientation2) must follow numpy array broadcasting rules.

References

pygfunction.heat_transfer.finite_line_source_vectorized(time, alpha, dis, H1, D1, H2, D2, reaSource=True, imgSource=True, approximation=False, N=10)

Evaluate the Finite Line Source (FLS) solution.

This function uses a numerical quadrature to evaluate the one-integral form of the FLS solution, as proposed by Claesson and Javed [10] and extended to boreholes with different vertical positions by Cimmino and Bernier [11]. The FLS solution is given by:

\[ \begin{align}\begin{aligned}h_{1\rightarrow2}(t) &= \frac{1}{2H_2} \int_{\frac{1}{\sqrt{4\alpha t}}}^{\infty} e^{-d_{12}^2s^2}(I_{real}(s)+I_{imag}(s))ds\\I_{real}(s) &= erfint((D_2-D_1+H_2)s) - erfint((D_2-D_1)s)\\&+ erfint((D_2-D_1-H_1)s) - erfint((D_2-D_1+H_2-H_1)s)\\I_{imag}(s) &= erfint((D_2+D_1+H_2)s) - erfint((D_2+D_1)s)\\&+ erfint((D_2+D_1+H_1)s) - erfint((D_2+D_1+H_2+H_1)s)\\erfint(X) &= \int_{0}^{X} erf(x) dx\\ &= Xerf(X) - \frac{1}{\sqrt{\pi}}(1-e^{-X^2})\end{aligned}\end{align} \]

Note

The reciprocal thermal response factor \(h_{2\rightarrow1}(t)\) can be conveniently calculated by:

\[h_{2\rightarrow1}(t) = \frac{H_2}{H_1} h_{1\rightarrow2}(t)\]
Parameters:
timefloat or array, shape (K)

Value of time (in seconds) for which the FLS solution is evaluated.

alphafloat

Soil thermal diffusivity (in m2/s).

disfloat or array

Radial distances to evaluate the FLS solution.

H1float or array

Lengths of the emitting heat sources.

D1float or array

Buried depths of the emitting heat sources.

H2float or array

Lengths of the receiving heat sources.

D2float or array

Buried depths of the receiving heat sources.

reaSourcebool

True if the real part of the FLS solution is to be included. Default is True.

imgSourcebool

True if the image part of the FLS solution is to be included. Default is True.

approximationbool, optional

Set to true to use the approximation of the FLS solution of Cimmino (2021) [12]. This approximation does not require the numerical evaluation of any integral. Default is False.

Nint, optional

Number of terms in the approximation of the FLS solution. This parameter is unused if approximation is set to False. Default is 10. Maximum is 25.

Returns:
hfloat

Value of the FLS solution. The average (over the length) temperature drop on the wall of borehole2 due to heat extracted from borehole1 is:

\[\Delta T_{b,2} = T_g - \frac{Q_1}{2\pi k_s H_2} h\]

Notes

This is a vectorized version of the finite_line_source() function using scipy.integrate.quad_vec to speed up calculations. All arrays (dis, H1, D1, H2, D2) must follow numpy array broadcasting rules. If time is an array, the integrals for different time values are stacked on the last axis.

References