## 3 Results and Discussions  
### Results  
The casing programs of well L in Tazhong, Xinjiang are shown in Table 3, the drilling fluid performance parameters are given in Table 4. The overflow occurred when drilling to about 6140 m, when the outlet flow rate was 13.5 L/s and the standpipe pressure was 18.7 MPa. Figure 9 shows the outlet flow data, measured in real time during the overflow, and the time series to be judged, composed of the measurements is \(C=\{c_{1},c_{2},\cdots,c_{k},\cdots,c_{l}\}\). Figure 8: Flow of the gas kick type identification, based on DTW. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Section** & **Depth (m)** & **Bit Size (mm)** & **Casing Size (mm)** \\ \hline The 1 st section & 1500 & 406.4 & 273.05 \\ The 2 nd section & 4953 & 241.3 & 200.3 \\ The 3 rd section (open hole) & 6139.86 & 168.3 & \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Casing programs of well L.  
The parameters of well L were used for the formation-wellbore coupled two-phase flow simulations, to derive the outlet flow data during the underbalanced pressure gas kick and the gravity displacement gas kick, as shown in Figure 10. The data obtained from the simulation are composed into a time series as the judgment reference, where the reference time series of the underbalanced pressure gas kick is \(A=\{a_{1},a_{2},\cdots,a_{i},\cdots a_{m}\}\) and the reference time series of the gravity displacement gas kick is \(B=\left\{b_{1},b_{2},\cdots,b_{j},\cdots b_{n}\right\}\). Figure 11 illustrates the time series of the judgment reference time series \(A\) and \(B\) and time series \(C\), to be judged. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Mud Weight (g/cm\({}^{3}\))** & \(\phi\)**300** & \(\phi\)**600** & **Viscosity (mPa-s)** \\ \hline \(1.1\) & 24 & 38 & 11 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Drilling fluid performance for well L.  
Figure 10: The simulated outlet flow time series for well L.  
Figure 9: Outlet flow rate measured in real time during the overflow for well L.  
The DTW algorithm is used to calculate the DTW distance between time series \(C\) and time series \(A\) and \(B\) at different times, respectively. (1) The calculation period is 0 to 600 s  
Table 5 displays the DTW distances between any two of the above three time series before 600s. As can be seen from Table 5, the DTW distance \(L_{A\text{-}C}\) between time series \(A\) and \(C\) is 7.3, and the DTW distance \(L_{B\text{-}C}\) between time series \(B\) and \(C\) is 7.53. Although the similarity between sequence \(C\) and sequence \(A\) is greater than that between sequence \(B\) and sequence \(C\), the gap between them is small. In order to ensure accuracy, subsequent data changes need to be calculated. (2) The calculation period is 0 to 1000 s  
Table 6 displays the DTW distances between any two of the above three time series. As can be seen from Table 5, the DTW distance \(L_{A\text{-}C}\) between time series \(A\) and \(C\) is 7.68, and the DTW distance \(L_{B\text{-}C}\) between time series \(B\) and \(C\) is 11.62. The similarity between sequence \(C\) and sequence \(A\) is greater than that between sequence \(B\) and sequence \(C\). It can be preliminarily judged that the kick type is an underbalanced pressure gas kick. If the well is not shut in at this time, the corresponding dynamic time warping distance can be calculated later to improve the judgment accuracy. Figure 11: Identification of the gas kick type for well L. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Time Series** & **The Measured \(C\)** & **The Simulated \(A\)** & **The Simulated \(B\)** \\ \hline The measured \(C\) & 0 & 7.3 & 7.53 \\ \hline The simulated \(A\) & 7.3 & 0 & 10.32 \\ \hline The simulated \(B\) & 7.53 & 10.32 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Dynamic time warping distance calculation results (calculation period [0, 600]). The calculation period is 0 to 1300 s  
Table 7 displays the DTW distances between any two of the above three time series.