A method for optimizing and predicting wellbore temperature by integrating numerical model and machine learning

By combining numerical models with machine learning, establishing a wellbore-formation transient heat transfer model, training a wellbore temperature prediction model and optimizing parameters, the problem that single parameter optimization in the existing technology is difficult to deal with the joint impact of multiple factors, and accurate prediction and effective cooling of wellbore temperature are achieved.

CN119150677BActive Publication Date: 2025-04-18SOUTHWEST PETROLEUM UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411188166.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2025-04-18
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

The existing numerical models are mainly used to optimize a single parameter to guide cooling, and it is difficult to effectively deal with the wellbore temperature problem under the joint influence of multiple factors.

Method used

Using a method of fusion of numerical models and machine learning, a wellbore temperature prediction model is trained by establishing a wellbore-formation transient heat transfer model, combining the actual measured data of multiple wells on site, and using random forest algorithms and genetic algorithms to optimize parameters to achieve multi-parameter optimization.

Benefits of technology

It improves the accuracy and generalization ability of wellbore temperature prediction, overcomes the shortcomings of traditional numerical solution methods that are complex, difficult and long time to calculate, and significantly improves the effect of wellbore cooling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119150677B_ABST
    Figure CN119150677B_ABST
Patent Text Reader

Abstract

A method for optimizing and predicting wellbore temperature by integrating numerical models with machine learning relates to the technical field of oil and gas development, and comprises the following steps: establishing a wellbore-formation transient heat transfer model, obtaining an initial data set composed of relevant parameters, normalizing the initial data set, training the wellbore temperature prediction model by using a random forest algorithm, then optimizing the hyperparameters of the random forest algorithm by using a genetic algorithm, performing global optimization by using an annealing algorithm, obtaining the optimized wellbore temperature, calculating the wellbore temperature by using the wellbore-formation transient heat transfer model, and comparing and verifying the optimized wellbore temperature with the calculated wellbore temperature. The method obtains the optimized wellbore temperature parameters by combining the random forest algorithm with a simulated annealing algorithm, and performs verification calculation on the parameters recommended by the algorithm by integrating the numerical model, so as to obtain the wellbore temperature with high accuracy, and use the temperature to guide the wellbore cooling, thereby effectively improving the wellbore cooling effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of oil and gas development, and in particular to a wellbore temperature optimization and prediction method integrating a numerical model with machine learning. Background Art

[0002] With the continuous deepening of oil and gas exploration and development, the number of deep wells and ultra-deep wells has increased significantly, which has also led to a sharp rise in the temperature inside the wellbore, posing a severe test on the working stability of downhole precision instruments, fluid performance stability and wellbore stability. In order to ensure the efficient and safe development of deep oil and gas resources, many oilfield companies have adopted cooling drilling fluid circulation cooling technology to effectively alleviate the high temperature problem in the wellbore circulation process.

[0003] Wellbore temperature is affected by many factors, and the wellbore temperature calculation model with higher accuracy is a numerical solution method. This method is based on the principle of energy conservation, establishes a temperature calculation model for each control area of ​​the wellbore-formation, and then applies the implicit finite difference method to solve it, and obtains the wellbore temperature distribution. Based on this method, the influence of various sensitive factors on wellbore temperature can be analyzed, including drilling fluid density, rheological parameters, specific heat capacity, thermal conductivity, construction displacement, drilling pressure, rotation speed, etc. At present, the single factor analysis method only obtains the degree of influence of each factor on the wellbore temperature, while the wellbore temperature is affected by multiple factors at the same time. When the values ​​of each parameter are optimal, the temperature model calculation result can be minimized. The application of this optimized parameter can eliminate the high temperature problem faced by undrilled wells or surrounding proposed new wells during the drilling process, and then the downhole temperature can be controlled to achieve the purpose of reducing the downhole temperature.

[0004] At the same time, machine learning algorithms can process large and complex data sets and automatically learn the inherent laws and patterns between data. The basic data set of drilled well data is used to train and optimize each data set, and then the optimal cooling construction parameters can be recommended. Based on the recommended parameters, it is applied to the mathematical model to quickly obtain the lowest temperature of the wellbore in the undrilled depth or the surrounding area with newly drilled wells, providing key methods and measures for the smooth implementation of wellbore cooling technical measures.

[0005] Therefore, it is necessary to develop a wellbore temperature optimization and prediction method that integrates numerical models and machine learning to achieve accurate prediction of wellbore temperature and effectively optimize cooling, thereby improving the safety and efficiency of mining operations. Summary of the invention

[0006] In view of this, in order to overcome the fact that existing numerical models are mostly used to optimize and guide cooling of a single parameter, the present invention proposes a wellbore temperature optimization and prediction method that integrates numerical models and machine learning. By processing the measured data of multiple wells on site, the wellbore temperature prediction model is trained. Based on this prediction model, an optimization algorithm is used to optimize multiple parameters, aiming to reduce the wellbore temperature. The parameters recommended by machine learning optimization are then verified in combination with the established numerical model to ensure the accuracy and reliability of the optimization results, providing a new method for wellbore cooling.

[0007] In order to solve at least one of the above technical problems, the technical solution provided by the present invention is:

[0008] The technical solution adopted by the present invention to solve the above problems is a method for optimizing and predicting wellbore temperature by integrating machine learning and numerical model, comprising the following steps:

[0009] Step S1: Based on the energy conservation principle, combined with the heat transfer mechanism of each wellbore-formation control area, considering the influence of fluid circulation friction heat generation and complex heat source terms on the wellbore temperature, a wellbore-formation transient heat transfer model is established;

[0010] Step S2: combining the measured data of the field well group to obtain an initial data set composed of relevant parameters;

[0011] Step S3: normalize the initial data set;

[0012] Step S4: using the random forest algorithm to train the wellbore temperature prediction model, and then using the genetic algorithm to optimize the hyperparameters of the random forest algorithm;

[0013] Step S5: globally optimizing the algorithm using an annealing algorithm to obtain an optimized wellbore temperature;

[0014] Step S6: Calculate the wellbore temperature using the wellbore-formation transient heat transfer model combined with the optimized related parameters;

[0015] Step S7: Compare and verify the wellbore temperature optimized in step S5 with the wellbore temperature calculated in step S6. If the verification is passed, the optimized wellbore temperature is retained to guide the wellbore temperature control. If the verification is not passed, the wellbore fluid circulation friction pressure drop in the wellbore-formation transient heat transfer model is adjusted and re-verified until the verification is passed;

[0016] In the wellbore-formation transient heat transfer model, the specific formula for drilling fluid displacement is as follows:

[0017]

[0018] Where:

[0019] D2 is the outer diameter of the annulus, D1 is the inner diameter of the annulus, mm; K is the consistency coefficient; m is the fluidity index; w is the width of the fluid domain, m; τ w is the wall shear stress, Pa, τ y is the yield stress, Pa;

[0020] The specific formula for heat generated by rotation speed and drilling pressure is shown below:

[0021]

[0022] Where: S d is the heat generated by the drill bit breaking the rock, J; ξ=2.5939, is the correction factor; f is the friction coefficient between the drill bit and the formation; W is the drilling pressure, N; R is the rotation speed, rpm; D is the outer diameter of the drill bit, m; d is the inner diameter of the drill bit, m;

[0023] The specific formula of the wellbore-formation temperature heat transfer model is shown as follows:

[0024]

[0025] Where T is temperature, °C; ρ is fluid density, kg / m 3 ; C is the specific heat capacity of the fluid, J / (kg·℃); k is the thermal conductivity of the fluid, W / (m·℃); t is the time, s; S is the complex heat source term; r and z represent the radial and axial directions respectively; v is the flow velocity, m / s.

[0026] For the annular heat transfer model, the linear equation after discretization using the fully implicit finite difference method is expressed as follows:

[0027]

[0028] In the formula, r po is the inner radius of the drill string, m; h po is the convective heat transfer coefficient of the drill string outer wall, W / (m 2 ·℃); ρ m is the drilling fluid density, kg / m 3 ; q is displacement, m 3 / s;C m is the specific heat capacity of drilling fluid; J / (kg·℃); h w is the well wall convection heat transfer coefficient, W / (m 2 ℃); r w is the wellbore radius, m; j is the well depth node number; n is the time node number; T n+1 p,j is the temperature of the drill string wall at depth j and time n+1, °C; T n+1 a,j is the annular temperature at depth j and time n+1, °C; Tn+1 w,j is the well wall temperature at depth j and time n+1, °C; T n a,j is the annular temperature at depth j and time n, °C; Δz j is the depth step; Δt is the time step; Q sa Heat generation for complex heat source terms, J.

[0029] The technical effects of the present invention are:

[0030] 1. The present invention has carried out model training through a large number of data sets, and the wellbore temperature prediction model established has high prediction accuracy and good generalization ability, which overcomes the shortcomings of traditional numerical solutions for wellbore temperature field calculations that are complex, difficult and time-consuming.

[0031] 2. Through the feature importance analysis in the random forest algorithm, the influence of each parameter on the wellbore temperature can be effectively analyzed. The simulated annealing algorithm is used to optimize the relevant parameters, and the numerical model is integrated to verify the parameters recommended by the algorithm. The wellbore temperature with high accuracy can be obtained, and the temperature is used to guide the wellbore cooling, which can effectively improve the wellbore cooling effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0033] Figure 1 It is a technical flow chart of the present invention;

[0034] Figure 2 This is a distribution diagram of the model prediction value and the true value in the present invention as the well depth changes;

[0035] Figure 3 This is a comparison chart between the model prediction value and the true value in the present invention;

[0036] Figure 4 This is a feature importance analysis diagram of the prediction model in the present invention;

[0037] Figure 5 This is a comparison diagram of the wellbore temperature after simulated annealing optimization and the measured temperature in the present invention;

[0038] Figure 6 This is a comparison chart of the wellbore temperature after simulated annealing optimization in the present invention and calculated using the optimized parameters of the numerical model. DETAILED DESCRIPTION

[0039] The present invention will be further described in detail below in conjunction with the embodiments and drawings.

[0040] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention.

[0041] Example:

[0042] A method for optimizing and predicting wellbore temperature by integrating machine learning and numerical modeling, comprising the following steps:

[0043] Step S1: Based on the energy conservation principle, combined with the heat transfer mechanism of each wellbore-formation control area, considering the influence of fluid circulation friction heat generation and complex heat source terms on the wellbore temperature, a wellbore-formation transient heat transfer model is established;

[0044] The wellbore-formation transient heat transfer model established uses the fully implicit finite difference method to discretize the model, which mainly includes the following contents:

[0045] The heat difference between the inflow and outflow of the heat transfer microelement plus the heat released by the internal heat source should be equal to the heat change of the microelement. The heat transfer control equation of each area is shown in formula (1).

[0046]

[0047] In formula (1): T is temperature, °C; ρ is fluid density, kg / m 3 ; C is the specific heat capacity of the fluid, J / (kg·℃); k is the thermal conductivity of the fluid, W / (m·℃); t is the time, s; S is the complex heat source term; r and z represent the radial and axial directions respectively; v is the flow velocity, m / s.

[0048] When the fluid in the tube flows downward, it is assumed that there is an axial velocity. The velocity gradient of the fluid in the radial direction and the heat conduction of the tube in the axial direction are ignored. The heat transfer model in the tube can be expressed as formula (2):

[0049]

[0050] The fluid in the drill string exchanges heat with the drill string wall through convection, and the boundary condition can be expressed as formula (3):

[0051]

[0052] In formula (2) and (3), T pi , T p Respectively represent the temperature of the fluid in the drill string and the drill string wall, °C; ρ m is the drilling fluid density, kg / m 3 ; C m is the specific heat capacity of drilling fluid; J / (kg·℃); k m is the thermal conductivity of drilling fluid, W / (m·℃); h pi Indicates the convection heat transfer coefficient of the drill string inner wall, W / (m 2 ℃); r pi is the inner radius of the drill string, m; v zp is the flow velocity of the fluid in the drill string, m / s; S pf is the heat generated by the friction resistance of fluid circulation in the tube, J.

[0053] The influencing factor affecting the temperature of the drill string wall is the heat exchanged by the heat convection between the inner and outer walls and the fluid. The heat transfer model of the drill string wall can be expressed as formula (4):

[0054]

[0055] The boundary conditions for the convective heat transfer between the inner and outer walls of the drill string and the fluid can be expressed by (5) and (6):

[0056]

[0057] In formulas (4) to (6), ρ p is the density of drill string, kg / m 3 ; C p is the specific heat capacity of the drill string; J / (kg·℃); k p is the thermal conductivity of the drill string, W / (m·℃); r po is the inner radius of the drill string, m; h po is the convective heat transfer coefficient of the drill string outer wall, W / (m 2 ·℃).

[0058] During the upward flow of the annular fluid, convection heat exchange occurs with the outer wall of the drill string and the wall of the wellbore. Ignoring the radial velocity gradient of the fluid and the axial heat conduction of the drill string, the annular heat transfer model can be expressed as formula (7):

[0059]

[0060] Heat exchange occurs between the outer wall of the casing and the wall of the well in the form of thermal convection. The boundary conditions of the two walls can be expressed by (8) and (9):

[0061]

[0062] In formulas (7) to (9), T a , T w , T f are the temperatures of the annulus fluid, wellbore wall and formation, respectively, °C; v za is the annular fluid velocity, m / s; h w is the well wall convection heat transfer coefficient, W / (m 2 ℃); k f is the formation thermal conductivity, W / (m·℃); r w is the wellbore radius, m; S a The heat generated by the complex heat source term, J.

[0063] Complex heat source term S a It mainly includes heat generated by fluid circulation friction, drill string rotation, drill bit rock breaking, and nozzle pressure drop.

[0064] ① To calculate the heat generated by the friction resistance of the annular fluid circulation, first solve τ for a given drilling fluid displacement Q. w The equation is shown in formula (10):

[0065]

[0066] in:

[0067] Then, the generalized fluidity index N is calculated according to the above formula, and the calculation formula is shown in formula (11):

[0068]

[0069] in:

[0070] In formulas (10) and (11), D2 is the outer diameter of the annulus, D1 is the inner diameter of the annulus, mm; K is the consistency coefficient; m is the fluidity index; τ w is the wall shear stress, Pa; τ y is the yield stress, Pa; w is the width of fluid flow.

[0071] Then calculate the annular fluid Reynolds number, and judge the fluid state (laminar flow, turbulent flow, transitional flow) through its relationship with the critical Reynolds number. The calculation formula of the Reynolds number is shown in formula (12):

[0072]

[0073] In formula (12): V a is the fluid velocity in the annulus, m / s; u is the fluid viscosity, Pa·s.

[0074] The critical Reynolds number calculation formula is shown in equation (13) and equation (14):

[0075] Re1 = 2,100·[N 0.331 (1 + 1.402κ - 0.977κ 2 ) - 0.019εN -0.868 κ] (13)

[0076]

[0077] In equations (13)-(14): N is the generalized flow behavior index, κ is the ratio of the outer diameter to the inner diameter of the annulus, and ε is the eccentricity.

[0078] If Re < Re1, the fluid state is laminar; if Re > Re2, the fluid state is turbulent; if Re1 < Re < Re2, the fluid state is transitional.

[0079] When the fluid in the annulus is laminar, the calculation formulas for the friction factor when there is no eccentricity and when there is eccentricity in the annulus are shown in equations (15) and (16) respectively:

[0080]

[0081] When the fluid in the annulus is turbulent, the calculation formulas for the friction factor when there is no eccentricity and when there is eccentricity in the annulus are shown in equations (17) and (18) respectively:

[0082]

[0083]

[0084] When the fluid in the annulus is transitional, the calculation formula for the friction factor is shown in equation (19):

[0085]

[0086] The circulating frictional pressure drop can be expressed as shown in equation (20):

[0087]

[0088] The heat generated by the circulating friction can be expressed as shown in equation (21):

[0089]

[0090] ② The heat generated by the rock-breaking friction of the drill bit at the bottom of the well can be expressed by equation (22):

[0091]

[0092] In equation (22): S dis the heat generated by the drill bit breaking the rock, J; ξ=2.5939, is the correction factor; f is the friction coefficient between the drill bit and the formation; W is the drilling pressure, N; R is the rotation speed, rpm; D is the outer diameter of the drill bit, m; d is the inner diameter of the drill bit, m.

[0093] ③ The drill bit nozzle pressure drop refers to the value of the drilling fluid pressure drop after the fluid passes through the drill bit nozzle. When the fluid displacement and nozzle size are constant, the drill bit pressure loss expression can be deduced based on the energy balance equation in fluid mechanics as shown in formula (23):

[0094]

[0095] In formula (23): A0 2 is the nozzle equivalent diameter, m 2 ; Q is the drilling fluid displacement, m 3 / s; C is the nozzle flow coefficient, which is usually taken as 0.95.

[0096] The heat generated by the nozzle pressure drop can be expressed by equation (24):

[0097] S p =Δp b Q(24)

[0098] ④ The rotation of the drill string causes the fluid to generate spiral flow and work, generating heat. The Reynolds number Re and Taylor number Ta are often used to describe the effect of rotation on friction pressure drop. The rotation friction pressure drop can be expressed by the following formula (25), and the heat generated by drill string rotation is expressed by formula (26):

[0099]

[0100] in:

[0101] In formulas (25) and (26): y is the Herbaric fluid yield value, Pa; ε is the eccentricity; n is the fluidity index; Re is the Reynolds number; Ta is the Taylor number; k is the ratio of the wellbore radius; u is the viscosity of the fluid, Pa·s.

[0102] In summary, the complex heat source term S of the fluid in the annulus a It can be expressed as formula (27):

[0103] S a =S p +S d +S f +S rl (27)

[0104] The area around the wellbore wall is composed of rocks, cement rings, casing and static drilling fluid, and its heat flow is mainly in the form of heat conduction. Therefore, the formation temperature model near the wellbore wall can be expressed as formula (28):

[0105]

[0106] In formula (28): T i Indicates the temperature of each area near the wellbore wall, °C; r i represents the radial distance of each region, m; i represents the number of radial units, usually greater than 6; ρ f is the density of rock near the wellbore wall, kg / m 3 ; C f is the specific heat capacity of the rock near the wellbore wall, J / (kg·℃).

[0107] For the established mathematical model, the initial conditions for solving the model are given as follows:

[0108] ① Before drilling, the wellbore-formation has reached a thermodynamic equilibrium state. Therefore, the temperature of each control area of ​​the wellbore-formation (fluid in the drill string, drill string wall, annular fluid and formation near the well wall, etc.) is the original formation. Its mathematical model can be expressed as:

[0109] T k,j =T s +g f zcosθ(29)

[0110] In formula (29): T k,j represents the formation temperature in the drill string, drill string wall, annulus and near the wellbore wall, °C; θ is the well inclination angle, °; k is the number of grid cells in the wellbore-formation radial direction, 1≤k≤11; j represents the number of axial grid cells; T s is the surface temperature, °C; g f is the geothermal gradient, ℃ / 100m; Z is the well depth, m.

[0111] ② On the ground, the fluid temperature in the drill string is the fluid inlet temperature:

[0112] T p (z=0, t)=T in (30)

[0113] In formula (30): T in is the drilling fluid inlet temperature, °C.

[0114] The boundary conditions for solving the model are:

[0115] ① The temperatures of the fluid in the drill string, the drill string wall and the annular space are all equal at the bottom depth of the well, that is:

[0116] T p (z=H,t)=T pi(z=H,t)=T a (z=H,t)(31)

[0117] ② Far away from the well wall, the formation temperature is not disturbed, that is, the temperature far away from the well wall is the original temperature:

[0118]

[0119] ③ On the surface, there is no heat exchange between the wellbore-formation control areas and the atmosphere:

[0120]

[0121] In order to accurately solve the transient temperature change of the wellbore, the finite difference method is used to discretize the wellbore-formation heat transfer models in time and space; then, the temperature data of the same time and space nodes at these discrete points are integrated to construct a linear equation system. According to equations (7)-(9), the annular heat transfer model can be discretely expressed as:

[0122]

[0123] Then, formula (34) is discretized in space and time, and can be expressed as:

[0124]

[0125] By combining the same terms in formula (35), the model can be expressed as the following linear equation:

[0126]

[0127] In formulas (34)-(36), q is the displacement, m 3 / s; j is the well depth node number; n is the time node number; T n+1 p,j is the temperature of the drill string wall at depth j and time n+1, °C; T n+1 a,j is the annular temperature at depth j and time n+1, °C; T n+1 w,j is the well wall temperature at depth j and time n+1, °C; T n a,j is the annular temperature at depth j and time n, °C; Δz j is the depth step; Δt is the time step; Q sa Heat generation for complex heat source terms, J.

[0128] The above is the established numerical model of transient heat transfer between wellbore and formation. It can be seen that it comprehensively considers the heat transfer mechanism of each region and the influence of complex heat source terms on temperature, and has a high accuracy in predicting and calculating wellbore temperature.

[0129] Step S2: combining the measured data of the field well group to obtain an initial data set composed of relevant parameters;

[0130] By sorting out the field measured data of multiple wells, we selected well depth, drilling time, cycle time, inlet temperature, mechanical drilling speed, drilling pressure, rotation speed, displacement and wellbore temperature to form a data set for machine learning, among which the bottom hole temperature is the prediction label and the others are feature labels. Some data sets are shown in Table 1:

[0131] Table 1 Some datasets used for machine learning

[0132]

[0133]

[0134] Step S3: normalize the initial data set;

[0135] Since there are dimensional differences among the parameters in the data set, data normalization is used to transform the original data into the interval [0, 1] in proportion to ensure that the data has the same cardinality.

[0136] Some of the normalized data are shown in Table 2:

[0137] Table 2 Part of the data set after normalization

[0138]

[0139]

[0140] Step S4: using the random forest algorithm to train the wellbore temperature prediction model, and then using the genetic algorithm to optimize the hyperparameters of the random forest algorithm;

[0141] The random forest algorithm is an integrated learning method that mainly improves the performance and stability of the model by building multiple decision trees. The principle of random forest is as follows:

[0142] First, we use the Bagging method to randomly sample, that is, to perform random sampling with replacement in the training data set:

[0143] Bagging: For a data set containing N samples, random sampling with replacement generates K sub-sample sets, and each word sample set also contains N samples. For the kth sub-sample set, the definition is as shown in formula (37):

[0144] D k ={(x i ,y i)∣i ∈ random sampling with replacement from {1, 2,..., N}}(37)

[0145] Secondly, for each subsample, construct a decision tree. At each node of each decision tree, randomly select some features to determine the best split, thereby increasing the diversity of the model and reducing the risk of overfitting:

[0146] Node splitting: At each decision tree node, randomly select m features (m < M, where M is the total number of features), calculate the split points of each feature, and select the feature and its split point that can maximize the reduction of the Gini index for splitting. The Gini index is defined as shown in Equation (38):

[0147]

[0148] In Equation (38): p k is the proportion of samples of the k-th class in the dataset, and K is the total number of classes.

[0149] Finally, integrate the prediction results of all decision trees and take the average as the prediction result of the random forest, as shown in Equation (39):

[0150]

[0151] In Equation (39): is the final prediction result, is the prediction result of the b-th decision tree, and B is the total number of decision trees.

[0152] For the preprocessed dataset, divide the training samples and test samples in a ratio of 8:2.

[0153] Meanwhile, in order to further improve the accuracy of the random forest prediction model, use the genetic algorithm (GA) combined with the five-fold cross-validation method to optimize the hyperparameters of the random forest, namely n_estimators (the number of decision trees), max_depth (the maximum depth of the tree), min_samples_leaf (the minimum number of samples), and min_samples_split (the minimum number of samples for splitting). Set the population size of the genetic algorithm to 40, the mutation probability to 0.05, and the maximum number of iterations to 50. Iteratively generate and evaluate different combinations of hyperparameters to find the optimal parameter combination. After optimization, the best combination of hyperparameters is shown in Table 3 below:

[0154] Table 3 GA optimization results

[0155] Hyperparameters Setting Value n_estimators 150 max_depth 5 min_samples_leaf 2 min_samples_split 4

[0156] After optimization by the genetic algorithm, use the coefficient of determination (R for the random forest prediction model2 ) is evaluated, and the determination coefficient calculation formula is shown in formula (40):

[0157]

[0158] In formula (40), n is the number of test sets, x i is the predicted value, y i is the true value, and y is the average of the true values.

[0159] Coefficient of determination R 2 It is used to measure the correlation between the true value and the predicted value. Its value is between 0 and 1. The closer the value is to 1, the better the prediction performance of the model. The determination coefficient of the optimized wellbore temperature prediction model is about 0.978, which proves that this model has a high prediction accuracy. The comparison between the model prediction value and the true value wellbore temperature is as follows: Figure 2 and Figure 3 Based on this prediction model, the characteristic importance analysis of each characteristic parameter on the bottom hole temperature can reflect the contribution of each characteristic to the prediction performance of the entire model. The characteristic importance analysis results are shown in Figure 4 As shown, feature X j The feature importance calculation of the model is shown in formula (41):

[0160]

[0161] In formula (41), B is the total number of decision trees, ΔI(t,X j ) is feature X j The impurity caused by the t-th tree decreases.

[0162] Step S5: globally optimizing the algorithm using an annealing algorithm to obtain an optimized wellbore temperature;

[0163] After determining the characteristic parameters that need to be optimized, the simulated annealing algorithm is used for global optimization to find the best parameters to minimize the wellbore temperature. The simulated annealing algorithm is a general probabilistic algorithm based on the principle of solid annealing, which is mainly used to find the optimal solution of a proposition in a large search space.

[0164] Its core formula is mainly based on the Metropolis criterion: that is, it allows a certain amount of inferior solutions to be accepted instead of blindly rejecting them. That is, even if a local optimal solution is found, it will continue to iterate until the global optimal solution is found. Assume that the energy state of the solid at this time is E old , by slightly disturbing the internal structure of the solid to obtain a new state, whose energy is E new , the probability of accepting this perturbed state is shown in formula (42):

[0165]

[0166] In formula (42): T is the current temperature,

[0167] The attenuation function of the control temperature T is shown in formula (43):

[0168] T k+1 =αT k ,k=0,1,2...(43)

[0169] In formula (43), α is a constant close to 1, usually ranging from 0.5 to 0.99.

[0170] The basic process of simulated annealing is divided into the following four steps: ① Given an initial temperature T0 (i.e., the current optimal solution), and randomly generating an initial solution x0 (i.e., x old ), and calculate the current objective function E(x0); ② If the current temperature reaches the inner loop stop condition, execute the third step; otherwise, give a disturbance to the current solution and generate a new solution x1 (i.e. x new ), calculate ΔE=E(x1)-E(x0); if ΔE<0, accept the new solution; if ΔE≥0, use the Metropolis criterion to The probability of accepting a new solution is , and when the new solution is accepted, it is used as the current solution, otherwise repeat the second step. ③ k = k + 1, execute the temperature decay function, if the termination condition is met, execute the fourth step, otherwise execute the second step. ④ End the operation, T has reached the termination temperature, that is, the global optimal solution is found.

[0171] First, the original parameter values ​​of this set of data are used as the initial values ​​of the optimization parameters, and the values ​​are stored in a NumPy array initial_parameters. Next, the search space (i.e., parameter range) of the five optimization parameters is given. Here, the range of each parameter in the data set is used for assignment and stored in the parameter_bounds list. Then the dual_annealing method in the simulated annealing algorithm is called, and the above initial values ​​and search space are assigned to this function to minimize the objective function (wellbore temperature), and finally the optimal parameter value is returned. Finally, the optimal parameters are applied to a copy of the original data row (replacing the original parameters with the optimal parameters), the new data row is converted to DataFrame format, and normalized using the loaded normalization class. Finally, the loaded prediction model is used to predict the optimized new data row, and the optimized wellbore temperature is finally obtained. The optimized parameter combination and optimized temperature are saved as Excel files for further data analysis, and the measured temperature is compared with the optimized wellbore temperature. Figure 5 The recommended parameters of some well sections after optimization are shown in Table 4:

[0172] Table 4 Optimized parameters and results of some well sections

[0173]

[0174]

[0175] Step S6: Calculate the wellbore temperature using the wellbore-formation transient heat transfer model combined with the optimized related parameters;

[0176] Step S7: Compare and verify the wellbore temperature optimized in step S5 with the wellbore temperature calculated in step S6. If the verification is passed, the optimized wellbore temperature is retained to guide the wellbore temperature control. If the verification is not passed, the wellbore fluid circulation friction pressure drop in the wellbore-formation transient heat transfer model is adjusted and re-verified until the verification is passed.

[0177] The numerical model established in step S1 is combined with the recommended parameters after optimization using the simulated annealing algorithm shown in Table 4 above, and the wellbore temperature is calculated using the numerical model for this well section. The comparison between the temperature after the simulated annealing optimization and the wellbore temperature solved using the numerical model is shown in Figure 4. Figure 6 As shown, the comparative verification method is that the mean square error between the temperature curve calculated by the model and the temperature curve predicted by machine learning is less than or equal to 2%. It is believed that the model calculation results are highly accurate and can be applied to on-site cooling calculation and analysis. This further verifies that the parameters recommended after multi-parameter optimization using machine learning can be used to guide wellbore cooling.

[0178] In the description of the present invention, it should be pointed out that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inside" and "outside" etc. indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and should not be understood as a limitation on the present invention.

[0179] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the embodiments of the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for optimizing and predicting wellbore temperature by integrating numerical model and machine learning, characterized in that: The following steps are involved: Step S1: Based on the energy conservation principle, combined with the heat transfer mechanism of each wellbore-formation control area, considering the influence of fluid circulation friction heat generation and complex heat source terms on the wellbore temperature, a wellbore-formation transient heat transfer model is established; Step S2: combining the measured data of the field well group to obtain an initial data set composed of relevant parameters; Step S3: normalize the initial data set; Step S4: using the random forest algorithm to train the wellbore temperature prediction model, and then using the genetic algorithm to optimize the hyperparameters of the random forest algorithm; Step S5: globally optimizing the algorithm using an annealing algorithm to obtain an optimized wellbore temperature; Step S6: Calculate the wellbore temperature using the wellbore-formation transient heat transfer model combined with the optimized related parameters; Step S7: Compare and verify the wellbore temperature optimized in step S5 with the wellbore temperature calculated in step S6. If the verification is passed, the optimized wellbore temperature is retained to guide the wellbore temperature control. If the verification is not passed, the wellbore fluid circulation friction pressure drop in the wellbore-formation transient heat transfer model is adjusted and re-verified until the verification is passed; In the wellbore-formation transient heat transfer model, the specific formula for drilling fluid displacement is as follows: Where: D2 is the outer diameter of the annulus, mm; D1 is the inner diameter of the annulus, mm; K is the consistency coefficient; m is the fluidity index; w is the width of the fluid domain, m; τ w is the wall shear stress, Pa; τ y is the yield stress, Pa; The specific formula for heat generated by rotation speed and drilling pressure is shown below: Where: S d is the heat generated by the drill bit breaking the rock, J; ξ=2.5939, is the correction factor; f is the friction coefficient between the drill bit and the formation; W is the drilling pressure, N; R is the rotation speed, rpm; D is the outer diameter of the drill bit, m; d is the inner diameter of the drill bit, m; The specific formula of the wellbore-formation temperature heat transfer model is shown as follows: Where T is temperature, °C; ρ is fluid density, kg / m 3 ; C is the specific heat capacity of the fluid, J / (kg·℃); k is the thermal conductivity of the fluid, W / (m·℃); t is the time, s; S is the complex heat source term; r and z represent the radial and axial directions respectively; v is the flow velocity, m / s; For the annular heat transfer model, the linear equation after discretization using the fully implicit finite difference method is expressed as follows: In the formula, r po is the inner radius of the drill string, m; h po is the convective heat transfer coefficient of the drill string outer wall, W / (m 2 ·℃); ρ m is the drilling fluid density, kg / m 3 ; q is displacement, m 3 / s;C m is the specific heat capacity of drilling fluid, J / (kg·℃); h w is the well wall convection heat transfer coefficient, W / (m 2 ℃); r w is the wellbore radius, m; j is the well depth node number; n is the time node number; T n+1 p,j is the temperature of the drill string wall at depth j and time n+1, °C; T n+1 a,j is the annular temperature at depth j and time n+1, °C; T n+1 w,j is the well wall temperature at depth j and time n+1, °C; T n a,j is the annular temperature at depth j and time n, °C; Δz j is the depth step; Δt is the time step; Q sa Heat generation for complex heat source terms, J.

2. The method for optimizing and predicting wellbore temperature by integrating numerical model and machine learning according to claim 1, characterized in that: The relevant parameters constituting the initial data set include: well depth, drilling time, cycle time, inlet temperature, mechanical drilling speed, drilling pressure, rotation speed, displacement, and wellbore temperature.

3. The method for optimizing and predicting wellbore temperature by integrating numerical model and machine learning according to claim 2, characterized in that: The wellbore temperature is the prediction label of the random forest algorithm, and the remaining parameters are feature labels.

4. The method for optimizing and predicting wellbore temperature by integrating numerical model and machine learning according to claim 1, characterized in that: The comparison verification method described in step S7 is that the mean square error between the temperature calculated by the model and the temperature predicted by machine learning is less than or equal to 2%, and it is considered that the model calculation result has high accuracy and can be applied to on-site cooling calculation and analysis.

Citation Information

Patent Citations

  • Water injection profile inversion model construction method and water absorption capacity determination method and device

    CN115221777A

  • Shaft-reservoir coupling temperature field simulation and hydrate generation risk prediction method

    CN117113766A