The application claims priority to Chinese patent application No. 202110274038.8, filed on Mar. 15, 2021, the entire contents of which are incorporated herein by reference.
The present invention pertains to the technical field of gas reservoir development, in particular to a gas flow rate analysis and prediction method for wellhead choke of gas well based on Gaussian process regression.
With the increasing energy demand in China, shale gas, as an effective supplement to unconventional oil and gas resources, has been spotlighted and considered as a crucial element to guarantee the energy supply in China. In the shale gas production system, by reasonably changing the size of the wellhead choke of shale gas well to limit the gas flow through it, the wellhead choke plays an important role in avoidance of over-rapid production of gas wells, prevention against gas and water coning, sand flow rate control, potential pipe damage minimization. Therefore, the accurate prediction of choke gas flow rate can not only effectively safeguard gas well production, but also improve production efficiency.
During the production of shale gas wells, there is usually gas-liquid two-phase flow in the wellhead choke. If there is gas-liquid two-phase flow, the performance characteristics of the choke are complex, making it difficult to accurately predict the choke flow rate and select a reasonable wellhead choke size. Current methods for predicting choke flow rate are mainly empirical methods, such as Gilbert-type correlation (GC), artificial neural network (ANN) and support vector machine (SVM), and theoretical methods based on mass, momentum and energy balance equations. However, it is obvious that the theoretical model is complicated and inconvenient for field application. The empirical approach is to analyze field data, identify key factors affecting choke flow rate, then establish a model, and predict the choke flow rate. There is low accuracy in the results of choke flow rate prediction with traditional GC method, so that previous methods with higher prediction accuracy such as ANN and SVM have been proposed. At present, scholars are still continuing to explore new methods for better prediction effect.
In view of the above problems, the present invention aims to provide a gas flow rate analysis and prediction method for wellhead choke of gas well based on Gaussian process regression, which is featured by easier implementation and higher accuracy, and can make up for the shortcomings of choke flow rate prediction methods in prior art.
The technical solution of the present invention is described as follows:
A gas flow rate analysis and prediction method for wellhead choke of gas well based on Gaussian process regression, comprising the following steps:
Step 1: Acquire basic data of the wellhead choke on site and dividing them into training data samples and test data samples;
Preferably, the basic data of the wellhead choke on site includes gas flow rate at different moments, produced liquid-gas ratio, choke diameter, wellhead temperature, and wellhead oil pressure. The wellhead temperature can be obtained with a thermometer, and the wellhead oil pressure can be obtained with a pressure gauge.
Preferably, the gas flow rate refers to the volume flow rate of the gas flowing through the wellhead choke under standard conditions; the produced liquid-gas ratio refers to the ratio of the liquid flow rate to the volume flow rate of the gas flowing through the wellhead choke under standard conditions.
Preferably, the gas flow rate, produced liquid-gas ratio, choke diameter, wellhead temperature and wellhead oil pressure at each moment are divided into one group; the number of groups of the training data samples is greater than that of the test data samples.
Preferably, the ratio of the number of sample groups of training data to the number of sample groups of test data is 6-9:4-1.
Step 2: Select a kernel function and assume an iterative initial value of an undetermined parameter of the kernel function;
Preferably, the kernel function refers to any one of exponential kernel function, square exponential kernel function, quadratic rational kernel function, and Matérn kernel function;
The exponential kernel function is:
The square exponential kernel function is:
The quadratic rational kernel function is:
The Matérn kernel function is:
Where, σ denotes the vertical proportional parameter, dimensionless; exp(A) denotes the natural constant e to the power of A, with A denoting a constant or function; x and x′ denote two groups of data; l is the length proportional parameter, dimensionless; c denotes the intercept constant, dimensionless; ν denotes the smoothing factor, dimensionless; I′ denotes the gamma function; and Kν denotes the Bessel function.
It should be noted that the above four kernel functions are only commonly used, and other kernel functions in the prior art can also be used to establish Gaussian process regression model in the present invention.
Step 3: Calculate a covariance matrix and complete Gaussian process regression training with the training data sample based on a maximum likelihood estimation method to obtain the parameters of the kernel function and a Gaussian process regression model after the training is completed;
Preferably, Step 3 specifically includes the following sub-steps:
Step 301: Assume there is an implicit function ƒ(x) satisfying the functional relationship between the data x in the training data sample and the corresponding theoretical predicted gas volume y:
y=ƒ(x) (5)
Step 302: Calculate an initial covariance matrix with the training data sample based on the covariance matrix formula, the kernel function selected in Step 2 and the iterative initial value of the kernel function, where the covariance matrix formula is:
Where, K denotes the covariance matrix calculated based on the kernel function; k denotes the kernel function; xi(i=1,2 . . . . . . ,n) denotes the ith group of data in the training data sample and n denotes the number of data groups in the training data sample;
Step 303: Perform a Gaussian process prior on the implicit function ƒ(x), and construct a Gaussian distribution relationship of the implicit function ƒ(x) according to the zero mean and the covariance matrix:
ƒ(x)=GP(O,K) (7)
Where, GP(φ, θ) denotes the Gaussian distribution, where P and 0 denote the mean and variance of the distribution, respectively;
Step 304: Calculate and obtain the theoretically predicted value of the gas 20 flow rate according to the Gaussian distribution relationship, iteratively optimize the parameters of the kernel function based on the maximum likelihood estimation method to obtain the kernel function parameters satisfying the maximum likelihood estimation, and calculate the covariance matrix under this optimized parameter;
Step 305: Obtain the optimized Gaussian distribution relationship according to the optimized covariance matrix, complete the training process of the Gaussian process regression model, and obtain the Gaussian process regression model after the training is completed.
Step 4: Test the Gaussian process regression model with the test data sample to calculate a prediction deviation;
Preferably, Step 4 specifically includes the following sub-steps:
Step 401: Establish a joint Gaussian prior distribution including the training data sample and the test data sample based on the Gaussian process regression model after the training is completed:
Where, y* denotes the theoretically predicted gas flow rate corresponding to the test data sample, in 104 m3/d; K* and K** denote the covariance matrix; T denotes the matrix transpose;
The covariance matrices K* and K** are respectively calculated by the following formulas:
Where, xj*(j=1,2, . . . ,m) denotes the jth group data in the test data sample; m denotes the number of data groups in the test data sample; if the kernel function marked with superscript symbol *, the data is corresponding to the test data sample; if without the superscript symbol *, the data is corresponding to the training data sample;
Step 402: Work out the posterior probability y* according to Bayesian regression method:
y′|X,y,K′:GP(K′K−1y,K″−k′K−1(K′)T) (11)
Where, K−1 denotes the inversion of the covariance matrix K;
Step 403: Take the distribution mean of the posterior probability as the theoretically predicted gas flow rate corresponding to the test data sample, compare the theoretically predicted gas flow rate with the actual gas flow rate of the test data sample, and calculate a prediction deviation.
Preferably, the prediction deviation is any one of mean square deviation, root mean square deviation, mean absolute deviation, and absolute value of mean relative deviation;
The mean square deviation is calculated by the following formula:
The root mean square deviation is calculated by the following formula:
The mean absolute deviation is calculated by the following formula:
The absolute value of the mean relative deviation is calculated by the following formula:
Where, N denotes the number of test data points, dimensionless; yi,predicted denotes the theoretically predicted gas flow rate corresponding to the ith group of test data sample, in 104 m3/d; yi,actual denotes the actual gas flow rate corresponding to the ith group of test data sample, in 104 m3/d.
It should be noted that, in addition to the above four calculation methods for prediction deviation calculation, other calculation methods in the prior art can also be used to calculate the prediction deviation.
Step 5: Select different kernel functions, repeat Steps 2-4, compare prediction deviations of the different kernel functions, and preferably select the Gaussian process regression model with the minimum deviation;
Step 6: Analyze and predict the gas flow rate of the wellhead choke of the gas well to be tested according to the Gaussian process regression model with the minimum deviation.
The present invention has the following beneficial effects:
The present invention can achieve a higher accuracy in predicting the gas flow rate under the condition of gas-liquid two-phase flow in the wellhead choke than existing methods on the basis of ensuring easy field implementation, with broad application prospects in the analysis and prediction of gas well production and the study on gas-liquid two-phase flow of choke.
The present invention is further described with reference to the drawings and embodiments. It should be noted that the embodiments in this application and the technical features in the embodiments can be combined with each other without conflict. It is to be noted that, unless otherwise specified, all technical and scientific terms herein have the same meaning as commonly understood by those of ordinary skill in the art to which this application belongs. “Include” or “comprise” and other similar words used in the present disclosure mean that the components or objects before the word cover the components or objects listed after the word and its equivalents, but do not exclude other components or objects.
As shown in
Step 1: Acquire the basic data of the wellhead choke on site, obtain gas flow rate, produced liquid-gas ratio, choke diameter, wellhead temperature, and wellhead oil pressure at different moments, divide the gas flow rate, produced liquid-gas ratio, choke diameter, wellhead temperature and wellhead oil pressure at each moment are divided into one group, and then divide the total groups of data samples by training data sample and test data sample in a ratio of 9:1, with the results shown in Table 1:
Note: As there are many basic data of the wellhead choke on site, only some data are listed in Table 1, where “ . . . ” indicates that there are unlisted data.
Step 2: Select the square exponential kernel function to establish Gaussian process regression models, and assume that the iterative initial values of the undetermined parameters of the square exponential kernel function, as shown in Table 2:
Step 3: Calculate a covariance matrix and complete Gaussian process regression training with the training data sample based on a maximum likelihood estimation method to obtain the parameters of the kernel function and a Gaussian process regression model after the training is completed; this step includes the following sub-steps:
(1) Work out the initial covariance matrix by calculation with training data samples according to the covariance matrix formula shown in Formula (6), the kernel function selected in Step 2, and the iterative initial value of the kernel function;
(2) Perform a Gaussian process prior on the implicit function ƒ(x), and construct a Gaussian distribution relationship of the implicit function ƒ(x) shown in Formula (7) according to the zero mean and the covariance matrix;
(3) Work out the theoretically predicted value of flow rate according to the Gaussian distribution relationship, with the results shown in Table 3:
(4) Iteratively optimize the parameters of the square exponential kernel function based on the maximum likelihood estimation method to obtain the kernel function parameters that satisfy the maximum likelihood estimation, with the results shown in Table 4:
(5) Calculate the optimized covariance matrix, and obtain optimized Gaussian distribution relationship based on the optimized covariance matrix, and complete Gaussian process regression training to obtain a Gaussian process regression model after the training is completed;
Step 4: Test the Gaussian process regression model with the test data sample to calculate a prediction deviation, specifically including the following sub-steps:
(1) Establish a joint Gaussian prior distribution including the training data sample and the test data sample based on the Gaussian process regression model after the training is completed;
(2) Work out the posterior probability y* according to Bayesian regression method;
(3) Take the distribution mean of the posterior probability as the theoretically predicted gas flow rate corresponding to the test data sample, and the calculation results are shown in Table 5:
(4) Compare the theoretically predicted gas flow rate with the actual flow rate of the test data sample, and calculate the prediction deviation, with the results shown in Table 6:
Step 5: Select the exponential kernel function, Matérn kernel function and quadratic rational kernel function to establish Gaussian process regression models respectively, and repeat Steps 2-4 to obtain the prediction deviations of different kernel functions, with the results shown in Table 7:
Comparing the prediction deviations of the four different kernel functions in Table 6 and Table 7, and the GPR-Ex model with the smallest error in all models is selected as the final Gaussian process regression model;
Step 6: Analyze and predict the gas flow of the wellhead choke of the gas well to be tested according to the GPR-Ex with the minimum deviation.
Take some known gas wells as the gas wells to be tested, predict the gas flow rate of the wellhead choke with the Gaussian process regression model established by each kernel function, and draw a diagram for the relationship between the theoretically predicted gas flow rate and the actual gas flow rate, as shown in
In addition, the gas flow analysis and prediction method of the present invention was compared with the prior art, with the results shown in Table 8:
Compared with Tables 6-8, it can be found that the deviation of the Gaussian process regression model of the present invention is smaller than that of the commonly used model, resulting in higher accuracy.
The above are not intended to limit the present invention in any form. Although the present invention has been disclosed as above with embodiments, it is not intended to limit the present invention. Those skilled in the art, within the scope of the technical solution of the present invention, can use the disclosed technical content to make a few changes or modify the equivalent embodiment with equivalent changes. Within the scope of the technical solution of the present invention, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention are still regarded as a part of the technical solution of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
202110274038.8 | Mar 2021 | CN | national |