A gas well liquid loading risk early warning method, device and equipment fusing a theoretical calculation model and a medium

By integrating theoretical calculation models and BO-LSTM-Attention prediction models, and combining critical liquid-carrying flow rate calculation, early warning of liquid accumulation risk in gas wells is achieved, solving the problem of lack of foresight in liquid accumulation warning in existing technologies, and improving the stability and efficiency of gas well production.

CN122242826APending Publication Date: 2026-06-19CHINA NAT PETROLEUM CORP +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA NAT PETROLEUM CORP
Filing Date
2024-12-18
Publication Date
2026-06-19

Smart Images

  • Figure CN122242826A_ABST
    Figure CN122242826A_ABST
Patent Text Reader

Abstract

This invention discloses a method, device, equipment, and medium for early warning of gas well liquid accumulation risk, integrating theoretical calculation models. It relates to the field of unconventional natural gas development technology. The steps are as follows: collecting historical production dynamic data, fluid property parameters, and well structure data of the gas well; preprocessing the historical production dynamic data; establishing a production dynamic time-series prediction model based on BO-LSTM-Attention to predict future gas production; establishing a critical liquid-carrying theoretical calculation model to calculate the critical liquid-carrying velocity and critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections of the gas well, and taking the maximum value of the critical liquid-carrying flow rate; comparing the maximum critical liquid-carrying flow rate with the predicted gas production value; if the predicted value is less than the maximum critical liquid-carrying flow rate, an early warning of liquid accumulation risk is issued. This invention can predict production in the short term and provide forward-looking warnings of potential future liquid accumulation risks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of unconventional natural gas development technology, and in particular to a method, device, equipment, and medium for early warning of gas well liquid accumulation risk that integrates theoretical calculation models. Background Technology

[0002] In the early stages of gas well production, various fluids (condensate, formation water, and residual fracturing fluid) flow in the wellbore as annular mist, while the gas flows at a relatively high velocity. As the well's development period gradually increases, the gas's liquid-carrying capacity gradually decreases. When the gas velocity falls below the critical liquid-carrying velocity, the gas's energy is insufficient to lift the liquid to the surface, and the droplets begin to fall back to the bottom of the well. The flow pattern in the wellbore gradually evolves from annular mist to turbulent flow, slug flow, and bubbly flow, leading to further accumulation of liquid at the bottom of the well, resulting in a sharp decrease in gas production or even production shutdown.

[0003] Production decline analysis and critical fluid-carrying flow rate calculation are the core of fluid accumulation early warning. Currently, fluid accumulation diagnosis methods are mainly divided into three categories: The first is production data analysis, which judges the fluid accumulation situation in the wellbore based on actual production data. This method is mainly based on experience, and the prediction results are highly subjective. The second is instrument testing, which uses relevant instruments to test the wellbore pressure profile or directly measure the fluid height, and then judges the fluid accumulation situation at the bottom of the well based on the wellbore pressure profile or fluid height. This method has high accuracy, but suffers from high cost and cannot perform continuous monitoring. The third is theoretical model calculation based on gas well fluid-carrying theory, which judges fluid accumulation by calculating the critical fluid-carrying flow rate of the gas well. Mainstream models are divided into droplet models and liquid film models depending on the research object. This method has the advantages of low cost and predictability, but it can only be used as a diagnostic method and cannot provide early warning before or in the early stages of fluid accumulation to assist in measures, resulting in delayed fluid accumulation improvement measures.

[0004] Chinese patent document CN117973263A, published on February 1, 2024, discloses a method, apparatus, and computer device for predicting the critical liquid-carrying flow rate of a gas well. The method includes: establishing an expression for the critical gas cut based on the liquid film reversal theory and the flow characteristics of the gas core and liquid film under circulation conditions; establishing an expression for the liquid film velocity at the gas-liquid interface based on the mass conservation equation; establishing an expression for the gas core velocity in the gas well based on the momentum conservation equation; obtaining an expression for the critical liquid-carrying flow rate based on the expressions for the critical gas cut, liquid film velocity, and gas core velocity; and predicting the critical liquid-carrying flow rate by collecting gas well information from multiple sensors and inputting this information into the expression for the critical liquid-carrying flow rate. This invention focuses on calculating the critical liquid-carrying flow rate, predicting it by establishing relevant expressions, and comparing it with actual gas production to assess the liquid accumulation status, but it does not explicitly mention an early warning function for future liquid accumulation risks.

[0005] Therefore, how to achieve intelligent identification and early warning when wellbore fluid accumulation occurs, and thus prevent the generation of fluid accumulation at the bottom of gas wells, is of great significance for stable gas well production and improving gas reservoir recovery rate. It is also an important measure to achieve the production planning goals of shale gas wells. Summary of the Invention

[0006] To address the lack of foresight in existing gas well liquid accumulation early warning methods, this invention constructs a gas well liquid accumulation risk early warning method, device, equipment, and medium that integrates theoretical calculation models. This enables early warning of whether liquid accumulation will occur in the near future, helping to stabilize and increase gas well production, providing guidance for timely intervention in drainage measures, and reducing costs and increasing efficiency.

[0007] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: a gas well liquid accumulation risk early warning method integrating theoretical calculation models, comprising the following steps:

[0008] S1: Collect historical production dynamics data, fluid properties parameters, and wellbore structure data of the target gas well;

[0009] S2: Preprocess historical production data;

[0010] S3: Based on the preprocessed historical production dynamics data, establish a production dynamics time series prediction model based on BO-LSTM-Attention to predict the gas production in a future set period and obtain the predicted value.

[0011] S4: Based on the fluid properties and well structure data of the target gas well, establish a critical fluid carrying capacity theoretical calculation model; calculate the critical fluid carrying velocity and critical fluid carrying capacity of the vertical, inclined and horizontal sections of the target gas well, and take the maximum value of the critical fluid carrying capacity of the vertical, inclined and horizontal sections.

[0012] S5: Compare the maximum critical liquid carrying flow rate with the predicted gas production rate. If the predicted value is less than the maximum critical liquid carrying flow rate, output the result and provide a warning of liquid accumulation risk.

[0013] Furthermore, in step S3, the production dynamic time-series prediction model based on BO-LSTM-Attention includes an input layer, a feature attention layer, an LSTM layer, and an output layer.

[0014] In the input layer, the historical production dynamics data of the target gas well and the corresponding production system data at that time are considered.

[0015] In the feature attention layer, the feature attention mechanism is used to determine the importance of different input features to the predicted gas production, thereby adaptively modifying the input feature weights of the production dynamic time series prediction model. The weighted and corrected input features at time t are then used to determine the weights of the input features. Replace the original input x t As an iterative modeling object for the LSTM layer;

[0016] The hidden layer update process in the LSTM layer is handled by h. t =f(h) t-1 ,x t ) becomes Add a Dropout layer at the very bottom;

[0017] In the output layer, the output of the LSTM layer is mapped to the output dimension through a fully connected layer to obtain the final gas production prediction value for the set period.

[0018] Furthermore, in the input layer, the input dimension is three-dimensional, including batch size, time window length, and number of features.

[0019] Furthermore, in the LSTM layer, there are two hidden layers, and the initial learning rate is set to 0.001; the optimizer is Adma, and the batch size is set to 32.

[0020] Furthermore, the hyperparameters of the production dynamic time series prediction model are globally optimized based on the Bayesian optimization algorithm; specifically,

[0021] The hyperparameters that need to be optimized include the number of neurons in the two LSTM hidden layers, the number of training epochs, and the size of the time window, and the corresponding parameter space is set accordingly;

[0022] The root mean square error of the model training set is defined as the optimization objective function, and the selected hyperparameters are substituted into the production dynamic time series prediction model for training.

[0023] The posterior probability distribution of the objective function is solved using the Gaussian regression function. Based on the posterior probability distribution, hyperparameter samples are sampled, and the optimal hyperparameters are selected and updated.

[0024] The posterior probability distribution and hyperparameters of the objective function are continuously updated until the maximum number of iterations set in the production dynamic time series prediction model is reached;

[0025] The globally optimal hyperparameters are used as the final hyperparameters of the production dynamic time series prediction model.

[0026] Furthermore, the maximum number of iterations is 20.

[0027] Furthermore, the hidden layers of the LSTM layer consist of cell state channels c t Forgotten Gatet Input gate i t and output gate o t It consists of four parts; specifically,

[0028] With the input x at the current time t t For example, h t-1 This represents the hidden layer state of the LSTM at the previous time step t-1, and the current hidden layer state h of the LSTM. t It can be represented as:

[0029] f t =sigmoid(W f [h t-1 ;x t ]+b f )

[0030] i t =sigmoid(W i [h t-1 ;x t ]+b i )

[0031] o t =sigmoid(W o [h t-1 ;x t ]+b o )

[0032] c t =f t *c t-1 +i t *tanh(W c [h t-1 ;x t ]+b c )

[0033] h t =o t *tanh(c t )

[0034] W f W i W o W c All are weighted terms, b f ,b i ,b o ,b c All are bias terms, and sigmoid and tanh are activation functions;

[0035] The entire process of calculating the hidden layer states can be summarized as follows:

[0036] h t =f(h)t-1 ,x t ).

[0037] Furthermore, at the feature attention layer, the feature attention mechanism is used to determine the importance of different input features to the predicted gas production. Specifically, this means...

[0038] Taking the current time t as an example, the feature vector at time t... As input to the feature attention mechanism, each input feature is processed through a multilayer perceptron. Perform feature importance scoring;

[0039] In the formula, V e W e All are multilayer perceptron weights, b e As a bias term, ReLU is used as an activation function to enhance the nonlinear expressive power of the model. Indicates the feature importance score;

[0040] The feature importance scores are normalized using the softmax function to obtain the attention weights for the n features.

[0041]

[0042] The weights obtained at time t are weighted together with the corresponding original features to obtain the weighted and corrected input feature vector.

[0043]

[0044] Will Use it as new input to update the LSTM hidden state:

[0045]

[0046] Furthermore, in step S4, the calculation process for the maximum critical fluid-carrying capacity of the vertical, inclined, and horizontal well sections is as follows:

[0047] Calculate the density ρ of natural gas under wellhead temperature and pressure conditions. g The calculation formula is as follows:

[0048]

[0049] Where γ g ρ is the relative density of natural gas, a dimensionless quantity; p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K;

[0050] The critical fluid-carrying velocity v1 for the vertical well section is calculated using the following formula:

[0051]

[0052] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 ;

[0053] The critical fluid-carrying velocity v2 of the deviated well section is calculated using the following formula:

[0054]

[0055] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 θ is the well inclination angle, in rad;

[0056] The critical fluid-carrying velocity v3 in the horizontal well section is calculated using the following formula:

[0057]

[0058] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 g is the acceleration due to gravity, m / s² 2 ;

[0059] The maximum critical fluid-carrying velocity in the three well sections is converted into the critical fluid-carrying flow rate q. c As the final diagnostic criterion for fluid accumulation, the calculation formula is as follows:

[0060]

[0061] Where q c The critical liquid carrying capacity is 104 m³ / h. 3 / d, where A is the cross-sectional area of ​​the oil pipe, in meters. 2 p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K; v g The maximum critical fluid-carrying velocity in the three well sections is given in m / s.

[0062] Furthermore, the collection of historical data on gas well production dynamics mentioned in step S1 includes: average daily oil pressure, average daily casing pressure, daily gas production, and daily water production.

[0063] Furthermore, the fluid properties parameters mentioned in step S1 include: wellhead pressure, wellhead temperature, liquid phase density, gas-liquid surface tension, natural gas relative density, and gas deviation coefficient.

[0064] Furthermore, the wellbore structure data mentioned in step S1 includes: gravitational acceleration, tubing inner diameter, and tubing cross-sectional area.

[0065] Furthermore, the preprocessing of historical gas well production data described in step S2 includes smoothing and denoising based on an SG filter and normalization operations, wherein the normalization formula is as follows:

[0066]

[0067] In the formula: x new This refers to normalized historical data on gas well production dynamics; x old The actual value of the historical dynamic data of gas well production; x min The minimum value of historical dynamic data for gas well production; x max This represents the maximum value of historical dynamic data for gas well production.

[0068] Furthermore, the period set in step S3 is 15 days.

[0069] A second aspect of the present invention provides a device for early warning of gas well fluid accumulation risk by integrating theoretical calculation models, comprising:

[0070] The first module collects historical data on gas well production dynamics, fluid properties parameters, and well structure data.

[0071] The second module preprocesses the historical production data, including smoothing, noise reduction, and normalization operations based on SG filters.

[0072] The third module establishes a production dynamic time series prediction model based on BO-LSTM-Attention to predict the future short-term gas production and obtain the predicted value.

[0073] The fourth module establishes a critical liquid-carrying theoretical calculation model to calculate the critical liquid-carrying velocity and critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections of the gas well, and takes the maximum critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections.

[0074] The fifth module compares the maximum critical liquid-carrying flow rate with the predicted gas production rate. If the predicted value is less than the maximum critical liquid-carrying flow rate, a liquid accumulation risk warning is issued.

[0075] A third aspect of the present invention provides a computer device including a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are interconnected, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the method as described in any of the preceding embodiments.

[0076] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any of the preceding claims.

[0077] In summary, the present invention has the following beneficial effects:

[0078] (1) Using intelligent algorithms based on attention mechanism long short-term memory neural networks to perform production decline analysis, the prediction accuracy is higher. It can capture the complex patterns and long-term dependencies in gas well production data, thereby making more accurate predictions of production change trends.

[0079] (2) Applying the theoretical calculation model to calculate the critical liquid carrying flow rate is simple, efficient and low cost. It can effectively diagnose the liquid accumulation at the current moment. By integrating the theoretical calculation model with the production capacity prediction model based on the attention mechanism long short-term memory neural network, a gas well liquid accumulation risk early warning method integrating the theoretical calculation model is constructed. It can not only predict the production in the short term, but also provide an effective early warning of the possible liquid accumulation risk.

[0080] (3) Applying the SG filtering method to reduce noise in production dynamic data removes outliers, ensuring data integrity and obtaining a smoother curve, which can improve the accuracy of subsequent production forecasts. Attached Figure Description

[0081] Figure 1 This is a flowchart for early warning of liquid accumulation risk in gas wells.

[0082] Figure 2 This is a comparison chart of daily gas production data before and after noise reduction using an SG filter.

[0083] Figure 3 This is a diagram of the LSTM network structure.

[0084] Figure 4 This is a network structure diagram of the attention mechanism.

[0085] Figure 5 The structure diagram of the LSTM shale gas production capacity prediction model that incorporates the feature attention mechanism.

[0086] Figure 6This is a flowchart of the Bayesian optimization algorithm used for optimization modeling. Detailed Implementation

[0087] The present invention will be further described in detail below with reference to the embodiments.

[0088] Example 1:

[0089] See attached document Figure 1 As shown, this invention provides a gas well liquid accumulation risk early warning method that integrates theoretical calculation models, including the following steps:

[0090] S1: Collect historical production dynamics data, fluid properties parameters, and wellbore structure data of the target gas well;

[0091] S2: Preprocess historical production data;

[0092] S3: Based on the preprocessed historical production dynamics data, a production dynamics time series prediction model based on BO-LSTM-Attention is established to predict the gas production in a future set period and obtain the predicted value. BO-LSTM-Attention is a production dynamics time series prediction model used in the gas well liquid accumulation risk early warning method. It integrates Bayesian optimization (BO), long short-term memory neural network (LSTM), and attention mechanism.

[0093] S4: Based on the fluid properties and well structure data of the target gas well, establish a critical fluid carrying capacity theoretical calculation model; calculate the critical fluid carrying velocity and critical fluid carrying capacity of the vertical, inclined and horizontal sections of the target gas well, and take the maximum value of the critical fluid carrying capacity of the vertical, inclined and horizontal sections.

[0094] S5: Compare the maximum critical liquid-carrying flow rate with the predicted gas production value. If the predicted value is less than the maximum critical liquid-carrying flow rate, output the result and provide a warning of liquid accumulation risk to guide the field to formulate corresponding drainage strategies in advance, reduce drainage costs, and help gas wells achieve stable and increased production.

[0095] The historical data on gas well production dynamics collected in S1 includes: average daily oil pressure, average daily casing pressure, daily gas production, and daily water production. Fluid properties include: wellhead pressure, wellhead temperature, liquid density, gas-liquid surface tension, natural gas relative density, and gas deviation coefficient. Wellbore structural data includes: tubing inner diameter and tubing cross-sectional area.

[0096] Example 2:

[0097] S1: Collect historical production dynamics data, fluid properties parameters, and wellbore structure data of the target gas well;

[0098] S2: Preprocess historical production data;

[0099] The preprocessing of historical gas well production data described in step S2 includes smoothing and denoising based on an SG filter and normalization operations. The normalization formula is as follows:

[0100]

[0101] In the formula: x new This refers to normalized historical data on gas well production dynamics; x old The actual value of the historical dynamic data of gas well production; x min The minimum value of historical dynamic data for gas well production; x max This represents the maximum value of historical dynamic data for gas well production.

[0102] S3: Based on the preprocessed historical production dynamics data, establish a production dynamics time series prediction model based on BO-LSTM-Attention to predict the gas production in a future set period and obtain the predicted value; the set period mentioned in step S3 is 15 days.

[0103] In step S3, the production dynamic time-series prediction model based on BO-LSTM-Attention is established, which includes an input layer, a feature attention layer, an LSTM layer, and an output layer.

[0104] In the input layer, the historical production dynamics data of the target gas well and the corresponding production system data at the time are considered; and the input dimension of the input layer is three-dimensional, including batch size, time window length and number of features.

[0105] In the feature attention layer, the feature attention mechanism is used to determine the importance of different input features to the predicted gas production, thereby adaptively modifying the input feature weights of the production dynamic time series prediction model. The weighted and corrected input features at time t are then used to determine the weights of the input features. Replace the original input x t As an iterative modeling object for the LSTM layer;

[0106] The hidden layer update process in the LSTM layer is handled by h. t =f(h) t-1 ,x t ) becomes Add a Dropout layer to the last layer; in the LSTM layer, set two hidden layers and set the initial learning rate to 0.001; select Adma as the optimizer and set the batch size to 32.

[0107] In the output layer, the output of the LSTM layer is mapped to the output dimension through a fully connected layer to obtain the final gas production prediction value for the set period.

[0108] The hyperparameters of a production dynamic time series prediction model are globally optimized based on the Bayesian optimization algorithm; specifically,

[0109] The hyperparameters that need to be optimized include the number of neurons in the two LSTM hidden layers, the number of training epochs, and the size of the time window, and the corresponding parameter space is set accordingly;

[0110] The root mean square error of the model training set is defined as the optimization objective function, and the selected hyperparameters are substituted into the production dynamic time series prediction model for training.

[0111] The posterior probability distribution of the objective function is solved using the Gaussian regression function. Based on the posterior probability distribution, hyperparameter samples are sampled, and the optimal hyperparameters are selected and updated.

[0112] The posterior probability distribution and hyperparameters of the objective function are continuously updated until the maximum number of iterations set in the production dynamic time series prediction model is reached;

[0113] The globally optimal hyperparameters are used as the final hyperparameters of the production dynamic time series prediction model.

[0114] Specifically, the maximum number of iterations is 20.

[0115] The hidden layers of the LSTM layer consist of cell state channels c t Forgotten Gate t Input gate i t and output gate o t It consists of four parts; specifically,

[0116] With the input x at the current time t t For example, h t-1 This represents the hidden layer state of the LSTM at the previous time step t-1, and the current hidden layer state h of the LSTM. t It can be represented as:

[0117] f t =sigmoid(W f [h t-1 ;x t ]+b f )

[0118] i t =sigmoid(W i [h t-1 ;x t ]+b i )

[0119] o t=sigmoid(W o [h t-1 ;x t ]+b o )

[0120] c t =f t *c t-1 +i t *tanh(W c [h t-1 ;x t ]+b c )

[0121] h t =o t *tanh(c t )

[0122] W f W i W o W c All are weighted terms, b f ,b i ,b o ,b c All are bias terms, and sigmoid and tanh are activation functions;

[0123] The entire process of calculating the hidden layer states can be summarized as follows:

[0124] h t =f(h) t-1 ,x t ).

[0125] In the feature attention layer, the feature attention mechanism is used to determine the importance of different input features to the predicted gas production. Specifically, this means...

[0126] Taking the current time t as an example, the feature vector at time t... As input to the feature attention mechanism, each input feature is processed through a multilayer perceptron. Perform feature importance scoring;

[0127] In the formula, V e W e All are multilayer perceptron weights, b e As a bias term, ReLU is used as an activation function to enhance the nonlinear expressive power of the model. Indicates the feature importance score;

[0128] The feature importance scores are normalized using the softmax function to obtain the attention weights for the n features.

[0129]

[0130] The weights obtained at time t are weighted together with the corresponding original features to obtain the weighted and corrected input feature vector.

[0131]

[0132] Will Use it as new input to update the LSTM hidden state:

[0133]

[0134] S4: Based on the fluid properties and well structure data of the target gas well, establish a critical fluid carrying capacity theoretical calculation model; calculate the critical fluid carrying velocity and critical fluid carrying capacity of the vertical, inclined and horizontal sections of the target gas well, and take the maximum value of the critical fluid carrying capacity of the vertical, inclined and horizontal sections.

[0135] In step S4, the calculation process for the maximum critical fluid-carrying capacity of the vertical, inclined, and horizontal well sections is as follows:

[0136] Calculate the density ρ of natural gas under wellhead temperature and pressure conditions. g The calculation formula is as follows:

[0137]

[0138] Where γ g ρ is the relative density of natural gas, a dimensionless quantity; p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K;

[0139] The critical fluid-carrying velocity v1 for the vertical well section is calculated using the following formula:

[0140]

[0141] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 ;

[0142] S4.3 Calculate the critical fluid-carrying velocity v2 of the deviated well section. The calculation formula is as follows:

[0143]

[0144] Where ρ l The density of the liquid phase is kg / m³. 3σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 θ is the well inclination angle, in rad;

[0145] The critical fluid-carrying velocity v3 in the horizontal well section is calculated using the following formula:

[0146]

[0147] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 g is the acceleration due to gravity, m / s² 2 ;

[0148] The maximum critical fluid-carrying velocity in the three well sections is converted into the critical fluid-carrying flow rate q. c As the final diagnostic criterion for fluid accumulation, the calculation formula is as follows:

[0149]

[0150] Where q c The critical liquid carrying capacity is 104 m³ / h. 3 / d, where A is the cross-sectional area of ​​the oil pipe, in meters. 2 p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K; v g The maximum critical fluid-carrying velocity in the three well sections is given in m / s.

[0151] S5: Compare the maximum critical liquid carrying flow rate with the predicted gas production rate. If the predicted value is less than the maximum critical liquid carrying flow rate, output the result and provide a warning of liquid accumulation risk.

[0152] Example 3:

[0153] like Figure 1As shown, the gas well liquid accumulation risk early warning method based on the fusion theoretical calculation model in Example 1 or Example 2 first collects the gas well's historical dynamic daily data, fluid property parameters, and wellbore structure data. Then, it smooths and denoises the data using an SG filter. This filtering process removes outliers, ensuring data integrity while obtaining a smoother curve. A production dynamic time-series prediction model based on BO-LSTM-Attention is established to predict the production output for the next 15 days. The critical liquid-carrying flow rate values ​​for the vertical, inclined, and horizontal sections are calculated using the theoretical calculation model. The maximum value is compared with the predicted production value. If the predicted production value is lower than the critical liquid-carrying flow rate value, a liquid accumulation risk early warning is issued, guiding the on-site team to formulate corresponding drainage strategies in advance, reducing drainage costs, and contributing to stable and increased gas well production.

[0154] Taking well X as an example, the fluid properties and wellbore structural parameters are shown in Table 1.

[0155] Table 1 shows the fluid properties and wellbore structure data of Well X in Example 1.

[0156]

[0157] The Savitzky-Golay filter is used to smooth and denoise the historical production dynamics data of Well X, while simultaneously normalizing the data. The specific operation and basic principles are as follows: The Savitzky-Golay filter (usually abbreviated as SG filter) was first proposed by Savitzky and Golay in 1964 and has since been widely used for data stream smoothing and denoising. It is a filtering method based on polynomial least squares fitting in the time domain. The most significant characteristic of this filter is that it can remove noise while ensuring that the shape and width of the signal remain unchanged.

[0158] The SG filter is used to smooth and denoise historical production data, filtering outliers while preserving the original trend of the data, thereby improving the accuracy of subsequent model predictions. Figure 2 The image shows a comparison between the filtered production data and the original data. As can be seen from the image, the filtered data is smoother than the original data, and outlier points have been removed.

[0159] Step S2 involves normalizing the historical data of gas well production dynamics. The normalization formula is as follows:

[0160]

[0161] In the formula: x new This refers to normalized historical data on gas well production dynamics; x old The actual value of the historical dynamic data of gas well production; x minThe minimum value of historical dynamic data for gas well production; x max This represents the maximum value of historical dynamic data for gas well production.

[0162] The benefits of normalization are as follows:

[0163] Transforming the input data into a range of 0 to 1 can make the numerical range of the data similar, thus avoiding slow convergence speed due to large differences in feature values ​​during iterative optimization.

[0164] By unifying the parameters into a dimensionless form, neural networks can better consider input parameters of different forms.

[0165] Normalized data is usually in the range of [0,1], which helps to reduce the complexity caused by excessively large or small values ​​during the calculation process and improves the efficiency of calculation.

[0166] Shale gas production capacity prediction is a typical time series prediction problem based on the dynamic history of gas well production. A production dynamic time series prediction model based on BO-LSTM-Attention was established to predict the short-term gas production of well X in the next 15 days. The prediction results are shown in Table 2. The average relative error (absolute value) of the 15-day prediction results is 0.07623, and the prediction accuracy is greater than 90%, which can provide strong support for subsequent liquid accumulation diagnosis.

[0167] Table 2. Production forecast results of the 15-day production test set using the capacity forecasting model.

[0168]

[0169] The specific process and principles are as follows:

[0170] Based on the unique network architecture of LSTM, it can be used to perform time series modeling on historical gas well data, capture and extract historical information, identify long-term dependencies in sequence data, and thus predict future gas well production.

[0171] Long Short-Term Memory (LSTM) neural networks are an improved variant of Recurrent Neural Networks (RNNs). By adding gated structural units, they address the gradient vanishing and exploding problems that RNNs are prone to. Compared to RNNs, the hidden layer structure of LSTMs is more complex, mainly consisting of cell state channels c t Forgotten Gate t Input gate i t and output gate o t It consists of four parts. The most crucial of these is the cellular state channel, which runs throughout the entire information transmission process. With the assistance of three gates, it selectively remembers or forgets information. The structural diagram is shown below. Figure 3 As shown.

[0172] LSTM network architecture:

[0173] Taking the current input as an example, the current hidden state h of the LSTM unit t :

[0174] f t =sigmoid(W f [h t-1 ;x t ]+b f )

[0175] i t =sigmoid(W i [h t-1 ;x t ]+b i )

[0176] o t =sigmoid(W o [h t-1 ;x t ]+b o )

[0177] c t =f t *c t-1 +i t *tanh(W c [h t-1 ;x t ]+b c )

[0178] h t =o t *tanh(c t )

[0179] Where, x t h represents the input data at time t. t-1 W represents the hidden layer state at time t-1. f W i W o W c All are weighted terms, b f ,b i ,b o ,b cAll terms are bias terms, and sigmoid and tanh are activation functions. Through this series of calculations, the LSTM unit can selectively update the cell state and hidden layer state based on the current input and the state of the previous time step, thereby effectively capturing and processing long-term dependencies in sequence data and playing an important role in tasks such as dynamic time-series prediction of gas well production. For example, when predicting future gas well production, LSTM can use information from historical production data to predict future production trends by continuously updating the hidden layer state.

[0180] The entire process of calculating the hidden layer state can be summarized as follows:

[0181] h t =f(h) t-1 ,x t ).

[0182] Based on the flexibility of soft attention mechanisms, a feature attention mechanism is introduced along the input feature dimension, with the structure as follows: Figure 4 As shown, the attention mechanism is inspired by attention in cognitive neuroscience. When processing complex information, the human brain will consciously or unconsciously focus on key information from a large amount of input information, while reducing or ignoring other secondary information. This ability is called attention.

[0183] Depending on the scope of the processed objects, attention mechanisms can be divided into soft attention mechanisms and hard attention mechanisms. Soft attention mechanisms consider all input feature vectors, assigning different weights to each input feature according to its importance. This mechanism is parameterized, smooth, and differentiable, and can be embedded into the model for training. Furthermore, the model's gradient can be backpropagated to other parts of the model through the attention module. In contrast, hard attention mechanisms focus only on a specific feature vector in the input. This selection is non-parametric and typically relies on an external decision process to specify the feature to focus on; therefore, it is less flexible than soft attention during model training.

[0184] Specifically, a feature attention mechanism based on soft attention is introduced into the prediction model;

[0185] Taking the current time as an example, the feature vector at time t... As input to the feature attention mechanism, each input feature is processed through a multilayer perceptron. Perform feature importance scoring:

[0186]

[0187] The attention scores are normalized using the softmax function to obtain the attention weights for the n features.

[0188]

[0189] The weights obtained at time t are weighted together with the corresponding original features to obtain the weighted and corrected input feature vector.

[0190]

[0191] Will Use it as new input to update the LSTM hidden state:

[0192]

[0193] Among them, V e W e All are multilayer perceptron weights, b e As a bias term, ReLU is used as an activation function to enhance the nonlinear expressive power of the model.

[0194] The purpose of introducing a feature attention mechanism is to adaptively and dynamically adjust the attention weights of input features before they are passed to the LSTM neural network, so that it can identify and emphasize features that are crucial to the prediction results, while reducing attention to features with less influence.

[0195] like Figure 5 The network structure diagram shown indicates that the LSTM shale gas production capacity prediction model with integrated feature attention mechanism mainly consists of four parts: input layer, feature attention layer, LSTM layer, and output layer.

[0196] 1) Input Layer: The input dimension of the production dynamics time series data and the corresponding production system data at each time point is three-dimensional, with the three dimensions being batch size, time window length, and number of features. At the model input end, considering both the production dynamics time series data and the corresponding production system data at each time point, the input dimension is also three-dimensional (batch size, time window length, number of features). Before inputting the data into the LSTM, an attention mechanism is introduced into the input feature dimension. This feature attention mechanism is used to determine the importance of different input features to the predicted output, thereby adaptively adjusting the input feature weights of the model. The weighted adjusted input features at time t are then... Replace the original input x t As the iterative modeling object of LSTM. The hidden unit update process of LSTM is performed by h. t =f(h) t-1 ,x t ) becomes The LSTM has two hidden layers, an initial learning rate of 0.001, an optimizer of ADMA, and a batch size of 32. A Dropout layer is added to the last layer to prevent overfitting and improve the model's generalization ability. Finally, the hidden layer output of the LSTM is mapped to the output dimension through a fully connected layer to obtain the final daily gas production prediction value.

[0197] 2) Feature Attention Layer: Before inputting data into the LSTM layer, an attention mechanism is introduced along the input feature dimension. This mechanism is used to determine the importance of different input features to the predicted output, adaptively adjusting the input feature weights of the model. The weighted input features at time t are then calculated. Replace the original input x t As an iterative modeling object for LSTM;

[0198] 3) LSTM layer: The hidden layer unit update process of LSTM is handled by h t =f(h) t-1 ,x t The calculation method has changed The LSTM has two hidden layers, an initial learning rate of 0.001, an optimizer of ADMA, a batch size of 32, and a Dropout layer added to the last layer.

[0199] 4) Output layer: The hidden layer output of LSTM is mapped to the output dimension through a fully connected layer to obtain the final daily gas production prediction value.

[0200] The hyperparameters of the FA-LSTM network structure are globally optimized based on the Bayesian optimization algorithm. The specific process is as follows:

[0201] 1) Determine the hyperparameters that need to be optimized, including the number of neurons in the two LSTM hidden layers, the number of training epochs, and the size of the time window, and set the corresponding parameter space;

[0202] 2) Define the root mean square error (RMSE) of the model training set as the optimization objective function, and input the selected hyperparameters into the FA-LSTM model for training;

[0203] 3) Use the Gaussian regression process to solve the posterior probability distribution of the objective function, sample the hyperparameters based on the posterior probability distribution, obtain multiple hyperparameter samples, select the optimal hyperparameters and update them;

[0204] 4) Continuously update the posterior probability distribution and hyperparameters of the objective function until the maximum number of iterations set in the production dynamic time series prediction model is reached;

[0205] 5) Use the globally optimal hyperparameters as the final hyperparameters of the production dynamic time series prediction model.

[0206] By following the above steps, the optimal hyperparameter combination of the FA-LSTM (Long Short-Term Memory Neural Network with Feature Attention Mechanism) neural network model is obtained, and predictions are made on test samples based on the optimal model, thereby further improving the model's prediction performance.

[0207] The flowchart of the Bayesian optimization algorithm is as follows: Figure 6 As shown, a set of hyperparameters is randomly selected as initial values. These hyperparameters include the number of neurons in the two LSTM hidden layers, the number of training epochs, and the size of the time window. A Gaussian Process (GP) is chosen as the probabilistic model to model the objective function (RMSE based on the training set in this model). The acquisition function is the Expected Improvement (EI). In this process, the value of the acquisition function is calculated based on the posterior distribution of the current probabilistic model (GP). By optimizing the acquisition function, the combination of hyperparameters that maximizes the acquisition function value is found. It is then checked whether a preset stopping condition is met, such as reaching the maximum number of iterations, for example, set to 20 iterations.

[0208] If the preset conditions are met, the iteration stops, the currently found optimal hyperparameter combination (x, y) is output, and it is used as the final hyperparameter of the model for subsequent prediction tasks.

[0209] If the preset conditions are not met, the currently found optimal hyperparameter combination (x, y) is added to the probabilistic model (GP); the posterior distribution of the probabilistic model (GP) is recalculated, and then the process returns to the step of calculating the acquisition function to continue iterating to find a better hyperparameter combination.

[0210] A critical fluid-carrying theoretical calculation model was established to calculate the critical fluid-carrying velocity and critical fluid-carrying flow rate for the vertical, inclined, and horizontal sections of well X. The maximum value was taken as the criterion for whether fluid accumulation occurred. The specific calculation process is as follows:

[0211] Calculate the density ρ of natural gas under wellhead temperature and pressure conditions. g The calculation formula is as follows:

[0212]

[0213] Where γ g ρ is the relative density of natural gas, a dimensionless quantity; p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K;

[0214] The critical fluid-carrying velocity v1 for the vertical well section is calculated using the following formula:

[0215]

[0216] Where ρ l The density of the liquid phase is kg / m³. 3 ; σ ρ is the surface tension of gas and liquid, N / m; g The density of natural gas is kg / m³. 3 ;

[0217] The critical fluid-carrying velocity v2 of the deviated well section is calculated using the following formula:

[0218]

[0219] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 θ is the well inclination angle, in rad;

[0220] The critical fluid-carrying velocity v3 in the horizontal well section is calculated using the following formula:

[0221]

[0222] Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 g is the acceleration due to gravity, m / s² 2 ;

[0223] The maximum critical fluid-carrying velocity in the three well sections is converted into the critical fluid-carrying flow rate q. c As the final diagnostic criterion for fluid accumulation, the calculation formula is as follows:

[0224]

[0225] Where q c The critical liquid carrying capacity is 104 m³ / h. 3 / d, where A is the cross-sectional area of ​​the oil pipe, in meters. 2 p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K; v g denoted as the critical liquid-carrying velocity, in m / s.

[0226] The final calculation results are shown in Table 3. Table 3 shows the critical fluid carrying flow rate values ​​calculated for the three well sections of Well X in Example 1. The maximum value of 1.6076 (104 m3) is taken as the fluid accumulation discrimination criterion.

[0227] Calculation results of critical fluid carrying capacity of three sections of well X

[0228]

[0229] The critical fluid-carrying flow rate calculated for well X was compared with the predicted production rate from the production capacity prediction model, and the maximum value of 1.6076 (10) was taken. 4 m 3 Using this as a criterion for liquid accumulation, it was found that from January 7th to January 8th, 2023, the gas production of Well X was lower than the critical liquid-carrying flow rate, indicating a risk of liquid accumulation. Drainage measures should be taken in advance to prevent the occurrence of liquid accumulation. By comparing with the records in the on-site working condition diagnostic log report, a successful early warning was issued regarding the potential risk of future liquid accumulation.

[0230] Example 4:

[0231] As another preferred embodiment of the present invention, this embodiment discloses a device for early warning of gas well liquid accumulation risk that integrates theoretical calculation models, comprising:

[0232] The first module collects historical data on gas well production dynamics, fluid properties parameters, and well structure data.

[0233] The second module preprocesses the historical production data, including smoothing, noise reduction, and normalization operations based on SG filters.

[0234] The third module establishes a production dynamic time series prediction model based on BO-LSTM-Attention to predict the future short-term gas production and obtain the predicted value.

[0235] The fourth module establishes a critical liquid-carrying theoretical calculation model to calculate the critical liquid-carrying velocity and critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections of the gas well, and takes the maximum critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections.

[0236] The fifth module compares the maximum critical liquid-carrying flow rate with the predicted gas production rate. If the predicted value is less than the maximum critical liquid-carrying flow rate, a liquid accumulation risk warning is issued.

[0237] Example 5:

[0238] This embodiment discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the gas well liquid accumulation risk early warning method based on the above-mentioned integrated theoretical calculation model.

[0239] In this embodiment, the processor can be a central processing unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.

[0240] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and units, such as the program units corresponding to the above-described method embodiments of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory, thereby implementing the methods described in the above-described method embodiments.

[0241] The memory may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0242] The one or more units are stored in the memory, and when executed by the processor, they perform the methods in Embodiment 1, Embodiment 2 or Embodiment 3 described above.

[0243] Example 6:

[0244] As another preferred embodiment of the present invention, this embodiment discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in Embodiment 1, Embodiment 2 or Embodiment 3 above.

[0245] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A gas well fluid accumulation risk early warning method integrating theoretical calculation models, characterized in that, Includes the following steps: S1: Collect historical production dynamics data, fluid properties parameters, and wellbore structure data of the target gas well; S2: Preprocess historical production dynamics data; S3: Based on the preprocessed historical production dynamics data, establish a production dynamics time series prediction model based on BO-LSTM-Attention to predict the gas production in a future set period and obtain the predicted value. S4: Based on the fluid properties and well structure data of the target gas well, establish a critical fluid carrying capacity theoretical calculation model; calculate the critical fluid carrying velocity and critical fluid carrying capacity of the vertical, inclined and horizontal sections of the target gas well, and take the maximum value of the critical fluid carrying capacity of the vertical, inclined and horizontal sections. S5: Compare the maximum critical liquid carrying flow rate with the predicted gas production rate. If the predicted value is less than the maximum critical liquid carrying flow rate, output the result and provide a warning of liquid accumulation risk.

2. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 1, characterized in that: In step S3, the production dynamic time-series prediction model based on BO-LSTM-Attention is established, which includes an input layer, a feature attention layer, an LSTM layer, and an output layer. In the input layer, the historical production dynamics data of the target gas well and the corresponding production system data at that time are considered. In the feature attention layer, the feature attention mechanism is used to determine the importance of different input features to the predicted gas production, thereby adaptively modifying the input feature weights of the production dynamic time series prediction model. The weighted and corrected input features at time t are then used to determine the weights of the input features. Replace the original input x t As an iterative modeling object for the LSTM layer; The hidden layer update process in the LSTM layer is handled by h. t =f(h) t-1 ,x t ) becomes Add a Dropout layer at the very bottom; In the output layer, the output of the LSTM layer is mapped to the output dimension through a fully connected layer to obtain the final gas production prediction value for the set period.

3. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 2, characterized in that: In the input layer, the input dimension is three-dimensional, including batch size, time window length, and number of features.

4. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 2, characterized in that: In the LSTM layer, there are two hidden layers, and the initial learning rate is set to 0.001; the optimizer is Adma, and the batch size is set to 32.

5. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 2, characterized in that: The hyperparameters of a production dynamic time series prediction model are globally optimized based on the Bayesian optimization algorithm; specifically, The hyperparameters that need to be optimized include the number of neurons in the two LSTM hidden layers, the number of training epochs, and the size of the time window, and the corresponding parameter space is set accordingly; The root mean square error of the model training set is defined as the optimization objective function, and the selected hyperparameters are substituted into the production dynamic time series prediction model for training. The posterior probability distribution of the objective function is solved using the Gaussian regression function. Based on the posterior probability distribution, hyperparameter samples are sampled, and the optimal hyperparameters are selected and updated. The posterior probability distribution and hyperparameters of the objective function are continuously updated until the maximum number of iterations set in the production dynamic time series prediction model is reached; The globally optimal hyperparameters are used as the final hyperparameters of the production dynamic time series prediction model.

6. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 5, characterized in that: The maximum number of iterations is 20.

7. A gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to any one of claims 2-6, characterized in that: The hidden layers of the LSTM layer consist of cell state channels c t Forgotten Gate t Input gate i t and output gate o t It consists of four parts; specifically, With the input x at the current time t t For example, h t-1 This represents the hidden layer state of the LSTM at the previous time step t-1, and the current hidden layer state h of the LSTM. t It can be represented as: f t =sigmoid(W f [h t-1 ;x t ]+b f ) i t =sigmoid(W i [h t-1 ;x t ]+b i ) o t =sigmoid(W o [h t-1 ;x t ]+b o ) c t =f t *c t-1 +i t *tanh(W c [h t-1 ;x t ]+b c ) h t = no t *fish(c t ) W f W i W o W c All are weighted terms, b f ,b i ,b o ,b c All are bias terms, and sigmoid and tanh are activation functions; The entire process of calculating the hidden layer states can be summarized as follows: h t =f(h t-1 ,x t )。 8. A gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to any one of claims 2-6. Its features are: In the feature attention layer, the feature attention mechanism is used to determine the importance of different input features to the predicted gas production. Specifically, this means... Taking the current time t as an example, the feature vector at time t... As input to the feature attention mechanism, each input feature is processed through a multilayer perceptron. Perform feature importance scoring; In the formula, V e W e All are multilayer perceptron weights, b e As a bias term, ReLU is used as an activation function to enhance the nonlinear expressive power of the model. Indicates the feature importance score; The feature importance scores are normalized using the softmax function to obtain the attention weights for the n features. The weights obtained at time t are weighted together with the corresponding original features to obtain the weighted and corrected input feature vector. Will Use it as new input to update the LSTM hidden state:

9. A gas well fluid accumulation risk early warning method based on a fusion theoretical calculation model according to any one of claims 1-6, characterized in that, In step S4, the calculation process for the maximum critical fluid-carrying capacity of the vertical, inclined, and horizontal well sections is as follows: Calculate the density ρ of natural gas under wellhead temperature and pressure conditions. g The calculation formula is as follows: Where γ g ρ is the relative density of natural gas, a dimensionless quantity; p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K; The critical fluid-carrying velocity v1 for the vertical well section is calculated using the following formula: Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 ; The critical fluid-carrying velocity v2 in the deviated well section is calculated using the following formula: Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 θ is the well inclination angle, in rad; The critical fluid-carrying velocity v3 in the horizontal well section is calculated using the following formula: Where ρ l The density of the liquid phase is kg / m³. 3 σ represents the surface tension of the gas-liquid mixture, in N / m; ρ g The density of natural gas is kg / m³. 3 g is the acceleration due to gravity, in m / s². 2 ; The maximum critical fluid-carrying velocity in the three well sections is converted into the critical fluid-carrying flow rate q. c As the final diagnostic criterion for fluid accumulation, the calculation formula is as follows: Where q c The critical liquid carrying capacity is 104 m³ / h. 3 / d, where A is the cross-sectional area of ​​the oil pipe, in meters. 2 p is the wellhead pressure, MPa; Z is the gas deviation coefficient, a dimensionless quantity; T is the wellhead temperature, K; v g The maximum critical fluid-carrying velocity in the three well sections is given in m / s.

10. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 1, characterized in that, The historical data on gas well production dynamics collected in step S1 includes: average daily oil pressure, average daily casing pressure, daily gas production, and daily water production.

11. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 10, characterized in that, The fluid properties parameters mentioned in step S1 include: wellhead pressure, wellhead temperature, liquid density, gas-liquid surface tension, natural gas relative density, and gas deviation coefficient.

12. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 11, characterized in that, The wellbore structure data mentioned in step S1 includes: gravitational acceleration, tubing inner diameter, and tubing cross-sectional area.

13. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 12, characterized in that, The preprocessing of historical gas well production data described in step S2 includes smoothing and denoising based on an SG filter and normalization operations. The normalization formula is as follows: In the formula: x new This refers to normalized historical data on gas well production dynamics; x old The actual value of the historical dynamic data of gas well production; x min The minimum value of historical dynamic data for gas well production; x max This represents the maximum value of historical dynamic data for gas well production.

14. The gas well liquid accumulation risk early warning method based on a fusion theoretical calculation model according to claim 1, characterized in that, The period set in step S3 is 15 days.

15. A device for early warning of gas well fluid accumulation risk integrating theoretical calculation models, characterized in that, include: The first module collects historical data on gas well production dynamics, fluid properties parameters, and well structure data. The second module preprocesses the historical production data, including smoothing, noise reduction, and normalization operations based on SG filters. The third module establishes a production dynamic time series prediction model based on BO-LSTM-Attention to predict the future short-term gas production and obtain the predicted value. The fourth module establishes a critical liquid-carrying theoretical calculation model to calculate the critical liquid-carrying velocity and critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections of the gas well, and takes the maximum critical liquid-carrying flow rate for the vertical, inclined, and horizontal sections. The fifth module compares the maximum critical liquid-carrying flow rate with the predicted gas production rate. If the predicted value is less than the maximum critical liquid-carrying flow rate, a liquid accumulation risk warning is issued.

16. A computer device, characterized in that, The system includes a processor, an input device, an output device, and a memory, which are interconnected. The memory is used to store a computer program, which includes program instructions. The processor is configured to invoke the program instructions to execute the method as described in any one of claims 1-14.

17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1-14.