## 1 Introduction  
As the chemical cementation of the carbonate formation is greater than the mechanical compaction, the genetic mechanism and prediction methods of the abnormal high pressure are different from those of the clastic formation, which makes it difficult to predict the formation pore pressure. When drilling in fractured carbonate gas reservoirs, especially with a narrow safety mud density window, drilling risks, such as a gas kick, are prone to occur, which seriously affects the drilling safety and prolongs the drilling cycle [1]. The formation of a gas kick, in addition to being caused by the negative pressure difference in the underbalanced case, may also be formed by the gravity displacement in the overbalanced case. Due to the different mechanisms of gas kicks, different measures need to be taken, otherwise the operational risk may be increased [2], it often leads to the occurrence of a secondary well kick or blowout, resulting in serious consequences, such as the well destruction, destruction of the oil and gas resources, and pollution of the natural environment. However, a gravity displacement gas kick and an underbalanced pressure gas kick have similar performance characteristics at the surface, both of which show an increase in the pit gain, due to the gas entry into the wellbore, making identification difficult. Researchers have been studying an underbalanced pressure gas kick for a long time and have continuously developed its mechanism and control theory, while the study of a gravity displacement gas kick has only been gradually carried out in recent years. Some studies performed a sensitivity analysis on the effect of the fracture size, the drilling fluid performance and other parameters on the gas-liquid gravity displacement, based on the gas-liquid gravity displacement observed in the visual experimental devices [3; 4; 5]. Some scholars have conducted experimental research on the gravity displacement laws between asphaltene heavy oil and drilling fluid, analyzed the effects of the fracture width, density and viscosity on the gravity displacement, and established a mathematical model [6; 7; 8; 9; 10]. The above studies analyzed the effects of the fracture size and the drilling fluid performance on the gravity displacement through experimental phenomena and measurement data, and proposed the corresponding preventive measures, but did not investigate how to identify gravity displacement after it occurred. By modeling the gas-liquid two-phase flow under a gas kick, the variation characteristics of a gravity displacement gas kick and an underbalanced pressure gas kick, in terms of the bottomhole pressure, free gas, and pit gain, are obtained [11; 12; 13]. Based on the application of back pressure at the wellhead, during the managed pressure drilling, researchers judged the gravity displacement gas kick and the underbalanced pressure gas kick, by the change in outlet flow rate. While their method is able to identify the type of gas kick, it takes a longer time and carries the risk of the continuous deterioration of the overflow. In [14], [PERSON] established a flow model of the wellbore-formation coupling, based on the mechanism of the gas kick occurrence, and obtained the gas kick characteristics of the different gas kick types. Meanwhile, they proposed a method to identify the type of gas kick, by observing the pit gain curve and the standpipe pressure curve, which rely on the theoretical and empirical knowledge of the field engineers and technicians. With the development of artificial intelligence (AI) technology, combining physical models with AI algorithms has become the trend in engineering technology today. For specific engineering problems, the mechanism model and AI model are coupled to drive the way, and the physical model, data and algorithms are used at the same time, which is the third generation of AI technology. Dynamic time warping (DTW) is a classical similarity analysis and pattern recognition algorithm that uses flexible pattern matching techniques.