*2.1. Governing Equations*

The operational system during drilling consists of five subsections: drilling hole (*h*), drill pipe (*p*), annulus (*a*), casing (*c*), and reservoir formation (*f*). To obtain the temperature profiles of the system, we deploy the governing equations of heat transfer balance in each section (Equation (1)). The imposed assumptions in this work are the following:


The governing equations of heat transfer in the five sections are represented as

$$A\_h h\_{h,p} \frac{\partial \left(\rho\_m c\_m T\_h\right)}{\partial t} = L\_{h,p} h\_{h,p} \left(T\_p - T\_h\right) + A\_h h\_{h,p} \frac{\partial}{\partial z} \left(\lambda\_m \frac{\partial T\_h}{\partial z}\right) + \frac{\partial \left(\rho\_m c\_m T\_h q\right)}{\partial z} - Q\_{h,r}$$

$$A\_p \frac{\partial \left(\rho\_p c\_p T\_p\right)}{\partial t} = L\_{h,p} h\_{h,p} \left(T\_h - T\_p\right) + L\_{p,a} h\_{p,a} \left(T\_a - T\_p\right) + A\_p \frac{\partial}{\partial z} \left(\lambda\_p \frac{\partial T\_p}{\partial z}\right),$$

$$A\_d \frac{\partial \left(\rho\_m c\_m T\_a\right)}{\partial t} = L\_{p,a} h\_{p,c} \left(T\_p - T\_a\right) + L\_{a,c} h\_{a,c} \left(T\_c - T\_a\right) + A\_a \frac{\partial}{\partial z} \left(\lambda\_m \frac{\partial T\_m}{\partial z}\right) \tag{1}$$

$$- \frac{\partial \left(\rho\_m c\_m T\_h q\right)}{\partial z} + Q\_{h,a},$$

$$A\_c \frac{\partial \left(\rho\_c c\_c T\_c\right)}{\partial t} = L\_{a,c} h\_{a,c} \left(T\_a - T\_c\right) + Q\_{f,c} + A\_c \frac{\partial}{\partial z} \left(\lambda\_c \frac{\partial T\_c}{\partial z}\right),$$

$$\rho\_f c\_f \frac{\partial T\_f}{\partial t} = \frac{1}{r} \frac{\partial}{\partial r} \left(\lambda\_f r \frac{\partial T\_f}{\partial r}\right) + \frac{\partial}{\partial z} \left(\lambda\_f \frac{\partial T\_f}{\partial z}\right).$$

As the pipe flow is turbulent, the convection heat coefficient *h* is evaluated by the Dittus–Boelter equation, as shown in Equation (2).

$$\begin{aligned} h &= Nu \lambda\_m / d\_x \\ Nu &= 0.023 Re^{0.8} Pr^{0.4} \end{aligned}$$

$$\begin{aligned} Re &= \rho\_m q d\_x / \mu A\_x \text{ (x = } h \text{,} a) \\ Pr &= \mu c\_m / \lambda\_{m \prime} \\ d\_{\text{li}} &= 2r\_{\text{li}} \\ d\_a &= 2 \left( r\_a - r\_p \right) \end{aligned} \tag{2}$$

where *Nu* is the Nusselt number, *Re* is the Reynolds number, *Pr* is the Prandtl number, *μ* is the viscosity, and *d* is the hydraulic diameter. *Qf* ,*<sup>c</sup>* is the heat flux from the reservoir formation to the casing:

$$Q\_{f,\varepsilon} = -L\_{\varepsilon,r} \frac{\partial}{\partial r} \left(\lambda\_f r \frac{\partial T\_r}{\partial r}\right)\Big|\_{r=r\_{\varepsilon}} = -L\_{\varepsilon,r} \lambda\_f \frac{\partial T\_r}{\partial r}\Big|\_{r=r\_{\varepsilon}}.\tag{3}$$

The radial heat transfer from the drilling hole to the annulus exists at the bottom-hole due to the mass transport. *Qh*,*<sup>a</sup>* is the heat flux from the drilling fluid to the annulus approximated as

$$Q\_{\rm li,a} \approx -\frac{\partial(\rho\_m c\_m T q)}{\partial r} \chi\_{z\_{\rm bbb'}} \tag{4}$$

where *χzbth* is the step function defined with the TDR and end locations of the bottom-hole *zbth*, *bot* and *zbth*, *top* as

$$\chi\_{z\_{\text{bot}}} = \begin{cases} 1; \ z\_{\text{tbth,bot}} \le z \le z\_{\text{tbth, top}}\\ 0; \text{ otherwise} \end{cases} \text{ s.} \tag{5}$$

To simplify the equations, the assumptions in the drill pipe and the casing sections are the following: the negligible vertical heat conduction and negligible heat accumulation by drilling rigs in relation to a large mass of soil. Those two assumptions lead to the same amount of heat flux inwards and outwards in those two sections. The simplified governing equation of the drill pipe is represented as

$$L\_{h,p} \hbar\_{h,p} \left( T\_h - T\_p \right) + L\_{p,a} \hbar\_{p,a} \left( T\_a - T\_p \right) = 0. \tag{6}$$

From this equation, we can derive the mathematical expression of *Tp* as a function of *Ta* and *Th*:

$$T\_p = \frac{L\_{\rm h,p} h\_{\rm h,p} T\_{\rm h} + L\_{p,a} h\_{p,a} T\_a}{L\_{\rm h,p} h\_{\rm h,p} + L\_{p,a} h\_{p,a}}.\tag{7}$$

In the same way, the mathematical expression of *Tc* as a function of *Ta* and *Tr* reads

$$T\_c = T\_a - \frac{Q\_{r,c}}{L\_{a,c}h\_{a,c}} = T\_a - \frac{L\_{c,r}\lambda\_f}{L\_{a,c}h\_{a,c}} \frac{\partial}{\partial r} \left( r \frac{\partial T\_r}{\partial r} \right) \Big|\_{r=r\_c} = T\_a - \frac{L\_{c,r}\lambda\_f}{L\_{a,c}h\_{a,c}} \beta. \tag{8}$$

Then, by inserting Equations (7) and (8) into Equation (1), the simplified system of the governing equations is given as

$$A\_{h}\frac{\partial(\rho\_{m}c\_{m}T\_{h})}{\partial t} = h\_{h,a}(T\_{a} - T\_{h}) + A\_{h}\frac{\partial}{\partial z}\left(\lambda\_{m}\frac{\partial T\_{h}}{\partial z}\right) + \frac{\partial(\rho\_{m}c\_{m}T\_{h}q)}{\partial z} - Q\_{h,a}$$

$$A\_{a}\frac{\partial(\rho\_{m}c\_{m}T\_{a})}{\partial t} = h\_{h,a}(T\_{h} - T\_{a}) - L\_{c,r}\lambda\_{f}\beta + A\_{a}\frac{\partial}{\partial z}\left(\lambda\_{m}\frac{\partial T\_{m}}{\partial z}\right) - \frac{\partial(\rho\_{m}c\_{m}T\_{h}q)}{\partial z} + Q\_{h,a} \quad \text{(9)}$$

$$\rho\_{f}c\_{f}\frac{\partial T\_{f}}{\partial t} = \frac{1}{r}\frac{\partial}{\partial r}\left(\lambda\_{f}r\frac{\partial T\_{f}}{\partial r}\right) + \frac{\partial}{\partial z}\left(\lambda\_{f}\frac{\partial T\_{f}}{\partial z}\right),$$

where *hh*,*<sup>a</sup>* is the heat transfer coefficient between the drilling hole and the annulus defined as the length-weighted harmonic average of two convection heat transfer coefficients:

$$h\_{\rm h,a} = \frac{L\_{\rm h,p} h\_{\rm h,p} L\_{\rm p,a} h\_{\rm p,a}}{L\_{\rm h,p} h\_{\rm h,p} + L\_{\rm p,a} h\_{\rm p,a}}.\tag{10}$$

The initial conditions for *Th*, *Ta*, and *Tr* are assumed with the geothermal gradient *gT* and the surface temperature *Tsur f* as

$$T\_{\mathbf{x}}(r, z, t=0) = T\_{\text{surf}} - \mathcal{g}\_T z(\mathbf{x} = h, \ a, f). \tag{11}$$

The boundary conditions are represented as

$$\begin{aligned} T\_h(r, z = 0, t > 0) &= T\_{inj}, \\ \frac{\partial T\_h}{\partial z}(r, z = z\_{bth, hot}, t) &= 0, \\ T\_a(r, z = 0, t) &= T\_{surf}, \\ \frac{\partial T\_a}{\partial z}(r, z = z\_{bth, hot}, t) &= 0, \\ T\_f(r, z = 0, t) &= T\_{surf}, \\ \frac{\partial T\_f}{\partial z}(r, z = z\_{bth, hot}, t) &= 0, \\ T\_f(r = r\_c, z, t) &= T\_f(r = r\_c, z, t = 0) = T\_{cr} \end{aligned} \tag{12}$$

where *re* is the reservoir boundary radius.
