An insight into the estimation of drilling fluid density at HPHT condition using PSO-, ICA-, and GA-LSSVM strategies

The present study evaluates the drilling fluid density of oil fields at enhanced temperatures and pressures. The main objective of this work is to introduce a set of modeling and experimental techniques for forecasting the drilling fluid density via various intelligent models. Three models were assessed, including PSO-LSSVM, ICA-LSSVM, and GA-LSSVM. The PSO-LSSVM technique outperformed the other models in light of the smallest deviation factor, reflecting the responses of the largest accuracy. The experimental and modeled regression diagrams of the coefficient of determination (R2) were plotted. In the GA-LSSVM approach, R2 was calculated to be 0.998, 0.996 and 0.996 for the training, testing and validation datasets, respectively. R2 was obtained to be 0.999, 0.999 and 0.998 for the training, testing and validation datasets, respectively, in the ICA-LSSVM approach. Finally, it was found to be 0.999, 0.999 and 0.999 for the training, testing and validation datasets in the PSO-LSSVM method, respectively. In addition, a sensitivity analysis was performed to explore the impacts of several variables. It was observed that the initial density had the largest impact on the drilling fluid density, yielding a 0.98 relevancy factor.

A drilling fluid is a complicated liquid containing heterogeneous compounds of a base fluid and chemical additives. The structure of a drilling fluid should remain unchanged within the favorable temperature and pressure ranges. The drilling fluid density is an important and fundamental property in the pressure calculations of wellbores and the successful completion of drilling operations 1 . Also, downhole pressure and temperature variations significantly influence the effective density of the drilling fluid 2 . This indicates its essentiality in drilling. Decreased exploitable reserves through shallow horizons have enhanced exploration activities of larger depths 3 . In a high-pressure high-temperature (HPHT) well, the proceeding of drilling by the rise of the total vertical depth (TVD) demonstrates large alternations in the density 2,4,5 . Such alternations essentially arise from the increased bottom-hole temperature and increased mud column height in an HPHT well.
The pressure and temperature have contradictory impacts on the equivalent circulating density (ECD). In contrast, a rise in increased temperature-induced thermal expansion with the wellbore decreased ECD. These two effects are most commonly believed to balance each other 6 . However, this is not always the case, specifically concerning an HPHT well.
One can obtain the precise density alternations of drilling fluids at HPHT wells merely through real measurements 1 . To measure the density, it is required to employ precise density devices. Furthermore, the measurement procedure is difficult, costly, and time-consuming. In addition, it is not possible to derive experimental bottom-hole pressure and temperature data. Thus, it is important to develop a robust, rapid, and precise method to integrate such measurements. Intelligent approaches, e.g., the radial basis function (RBF) [7][8][9] , multilayer perceptron (MLP) [10][11][12][13][14] , LSSVM [15][16][17][18][19] , GA [20][21][22] , ICA [23][24][25] , and PSO 26,27 have been of great interest to researchers to solve complicated classification and regression models in recent years. In addition, they have been employed for various petroleum and natural gas engineering purposes, e.g., the estimation of pressure-volume-temperature (PVT) characteristics, the prediction of gas characteristics, and estimation of permeability and porosity [28][29][30][31][32][33] . www.nature.com/scientificreports/ The present study collected over 880 datasets, involving different mud types, temperature, pressure, and initial density (density at standard temperature and pressure), from earlier studies [34][35][36] . To build an efficient model, it was required to classify the data into three categories, including the training, testing and validation datasets. 75% of the real data points formed the model in the training phase, 10% of them was kept for validation phase and the remaining 15% were exploited as the testing data to perform the performance assessment of the models including PSO-LSSVM, ICA-LSSVM, and GA-LSSVM to make estimates of unobserved data. Statistic and graphical representation techniques were adopted to examine the accuracy of the model.

Literature review
One can classify drilling fluid density prediction models into linear empirical analytical, correlation ones and intelligent approaches 37 . Many studies proposed such models to make an estimate of HPHT drilling fluid density 2,5,38 .
The impacts of the pressure and temperature in ECD estimations are of great importance 6 . Peters et al. 38 were able to implement the compositional model of Hoberock et al. 39 for the exploration of volumetric alternations in drilling fluids containing mineral oil/diesel as base fluids. They examined the liquid component densities of the drilling fluid at 0-15,000 psi and 78-350°F. The integration of their findings and those reported by Hoberock et al. enabled accurate predictions of drilling fluid density at HPHT condition. They derived an error of below 1% in the experimental temperature and pressure ranges. Sorelle et al. 40 developed a less successful model on the ground of the correlations of water and hydrocarbon densities at various pressures and temperatures. Kutasov 41 developed an analogous correlation for the prediction of density behavior of water at various temperatures and pressures, leading to accurate HPHT water densities with a significantly lower error. Isambourg et al. 5 proposed a polynomial model of nine variables for the behavior definition of liquid drilling fluid components. The composition-grounded model, which resembled that of Hoberock et al. 39 , was found to be valid at 14.5-20,000 psi and 60-400°F. Their model assumed merely the liquid phase to be responsible for volumetric drilling fluid alternations. To employ their model, it is required to obtain the accurate reference mud density at surface conditions.
Despite their successful density modeling of drilling fluids, linear empirical correlation and analytical techniques failed to consider the impacts of the drilling fluid type on HPHT density evaluations 1 . This limits their competence in drilling fluids with particular surface densities. One can consider intelligent techniques to be a beneficial alternative to incorporate the impacts of the drilling fluid type on HPHT density evaluations. Several drilling fluid behavior models have been proposed based on artificial neural networks (ANNs) in recent years. Osman and Aggour 34 introduced an ANN model for the prediction of the mud density based on the mud type, temperature, and pressure. The density data of drilling fluids with oil/water base fluids at 0-1400 psi and up to 400°F were exploited to train and test the ANN phases. There was a good agreement between the prediction of ANN density and experimental density measurements. Although the ANN approach was successful, such methods have a few drawbacks, including overfitting, the difficult achievement of stable solutions, a large training data requirement, and low generalizability to unobserved data 1 . Support vector machine (SVM) and LSSVM techniques may serve to solve such problems in light of their ability to solve small-sized nonlinear prediction problems and high performance for off-training set measurements [42][43][44][45][46][47] .

Theory
LSSVM. The LSSVM approach was introduced by Suykens and Vandewalle as a SVM variant. It is typically employed for pattern reorganization, regression, and clustering purposes 8,48,49 . The general form of LSSVM may be formulated as: in which f relates the output (i.e., the density of mud) and input (i.e., different mud types, temperature, pressure, and initial density data). Also, ω is the weighting vector, ∅ is the mapping function, and b is the bias term. To estimate ω and b, an objective function was proposed as: in which e i is the error of variable x i , and γ is the margin parameter. One can write the regression form of LSSVM as: The present study employed the radial basis function (RBF) kernel as: in which σ 2 is another tuning parameter representing the squared bandwidth found by an evolutionary algorithm, e.g., genetic algorithm. www.nature.com/scientificreports/ The optimization objective function is the mean square error (MSE) of LSSVM predictions 19,50 . It can be found as in which MD pred . is the predicted mud density, MD exp . is the experimental mud density, and N is the data point count. Furthermore, one can formulate the problem as: Imperialist competitive algorithms. Imperialist competitive algorithms (ICAs) are a socio-political class of strategies that have recently been adopted as an optimization approach. As with conventional optimization methods, an imperialist competitive algorithm begins with an initial population of two types of members: (1) colonies and (2) imperialists. Such members together form empires, and their competition enables optimization. A strong empire consistently attempts to control the colonies of weaker empires. Eventually, the competition results in a country with a single empire and several colonies of similar costs and positions 51 .
Initially, each of the imperialists owns a colony and attempts to extend their initial empire. Then, the colonies attempt to become the intended imperialistic country during evolution. Such a transformation is a policy model known as assimilation. This used to be practiced by several imperialist powers 52 . Imperialist states adopted such policies to build colonies in the favor of themselves concerning several socio-political axes, e.g., language, culture, and religion. An imperialist competitive optimization algorithm models this procedure by making the entire colonies move toward the imperialist in several optimization directions. The imperialist eventually assimilates the entire colonies. Let d be the imperialist-colony distance, and x be the travel of a colony in the direction of the imperialist 53 ; Thus, in which x denotes a random uniformly-distrusted number, while β represents a number larger than 1. In fact, β makes colonies approach the imperialist from the two sides. One can evaluate the overall power of the empire through the power of the imperialist state and assimilated colonies. It is obtained by summing the power of the imperialist state and a mean power portion of the corresponding colonies. The competition dissolves some empires as they are not able to win and enhance their power. As a result, greater empires continue to obtain more power every day. This leads to a state with merely one empire in the world, with the other countries being controlled by the empire state. In such a condition, the entire colonies are of the same power and position 54 . Figure 1 provides a simplified representation of an ICA. In addition to simply explaining the ICA approach, it may be proper to employ a straightforward pseudo-code to describe the ICA procedure as 55,56 : 1. Apply random points to the function to initialize the empires; 2. Move the colonies toward the corresponding imperialist (i.e., assimilation); 3. Apply random position alternations in several colonies (i.e., revolution); 4. Replace the imperialist position with a colony of a lower cost, if any; 5. Unify analogous empires; 6. Find the total cost of the empire; 7. Incorporate weaker colonies of weaker empires into a more powerful empire (i.e., imperialist competition) to exclude the empires of no power; and 8. Finish the procedure if the discontinuation criterion is met; otherwise, go to step 2.  Particle swarm optimization (PSO). Particle swarm optimization (PSO) is a stochastic optimization method grounded on various population patterns among natural species, e.g., insects, fishes, and birds [61][62][63] . PSO solves optimization problems by promoting initial populations 64 . Also, solutions are referred to as particles in PSO 65 . A set of particles make a swarm. The term swarm represents the population, while particles stand for individuals. Although it resembles GA in some characteristics, PSO makes use of no evolution operators such as crossover and mutation 66 . The topological particle neighborhood causes the particles to travel within the problem domain. The neighborhoods include the queen, physical neighborhood, and social neighborhood. PSO defines a velocity vector and a position vector for each of the particles 67 . The velocity of a particle is updated as: where P best,id is the best previous position of particle i, g best,id is the best global position of particle i, w denotes the inertia weight, C is the learning rate, and r is a randomly-selected number. This equation involves three components, including social, cognitive, and inertia. Also, wv id stands for the inertia component that is the retention of the past movements and moves particle in its direction at iteration t. C 1 is the cognitive term and transfers the (9) v id (1 + t) = wv id (t) + C 1 r 1 P best,id (t) − X iid (t) + C 2 r 2 g best,id (t) − X id (t) d = 1, 2, . . . D

Methodology
Pre-analysis phase. The present work employed three analytical and modeling processes for the estimation of drilling fluid density at enhanced temperatures and pressures. The experimental findings in the first stage were utilized for model training. Four different types of liquids including water-based, oil-based, colloidal gas aphron (CGA), and synthetic fluids have been selected for the comprehensive modeling. Indices 1, 2, 3 and 4 have been used to show these drilling fluids in the model, respectively. Table 1 expresses the variation of the selected affecting parameters. Nearly 15% of the real data were exploited for model testing. Normalization was applied to the data as: in which x denotes the value of parameter n. The absolute D k is below unity. The remaining quantities are introduced to models, building models for forecasting and validation of the density of the drilling fluid (i.e., the output). In order to model the desired process, we used MATLAB toolbox LSSVM code and coupled it with optimization codes to determine optimized weight and bias values.
x − x min x max − x min − 1  www.nature.com/scientificreports/ Outlier detection. The data points employed in modeling were found to be capable of posing a strong impact on the accuracy of final model estimates. Hence, the incorrect experimental data were identified by using the outlier analysis. An outlier (or anomaly) is an essential aspect of optimization problems. In such a case, it is required to employ statistical techniques or machine learning approaches. It is suggested that outliers should be removed in a distinct stage before proceeding with the analysis . To detect outliers, the present study adopted a leverage value process. The Hat matrix was calculated as: in which X is an N × P matrix (where N stands for the total number of data points, while P represents the number of inputs), T is the transposed operator, and -1 represents the inverse operator. A warning leverage value was defined as: The feasible region was considered to be a rectangle restricted within 0 ≤ H ≤ H* and −3 ≤ Standard Residual ≤ +3 . More details about this analysis are given elsewhere 69,70 .

Model development and verification methodology. As with any model, model validation was
applied in the final stage to evaluate model accuracy through a comparison of the results to the experimental data points. Validation is crucial and must undergo a revision in cases with changing variable ranges or experimental enhancements. For the development of the corresponding models, this study applied the PSO-LSSVM, ICA-LSSVM, and GA-LSSVM methods, evaluating model accuracy by statistical techniques. The accuracy quantification of the models was performed by Eqs. (14)(15)(16)(17)(18).
in which X represents a property, N is the total number of data points, "actual" stands for experimental quantities, and "predicted" refers to the modeled quantities. Table 2 reports detailed results of the models. The tuning parameters γ and σ 2 were employed in the LSSVM method and the optimal values of them are provided.

Results and discussion
Model validation results. The present work employed statistical and graphical techniques for the performance evaluation of the models concerning the prediction of drilling fluid density at HPHT condition. The results of modeled drilling fluid density are demonstrated in Fig. 4. The predictions are plotted versus the data www.nature.com/scientificreports/ index to represent the training, testing and validation outcomes. As can be inferred from Fig. 4, the ICA-LSSVM and PSO-LSSVM approaches yielded more satisfactory predictions as they were more accurate. The coefficient of determination (R 2 ) demonstrates the closeness of predictions to experimental data. It ranges from 0.0 to 1.0. A coefficient of determination close to 1 stands for higher prediction accuracy. This coefficient was found to be nearly 1 for the proposed frameworks, suggesting that they had a high prediction capability for the drilling fluid density. Figure 5 illustrates the regression results of experimental and numerical coefficient of determination. As can be seen, R 2 was found to be 0.998, 0.996 and 0.996 for the training, testing and validation datasets, respectively, in the GA-LSSVM method. R 2 was obtained to be 0.999, 0.999 and 0.998 for the training, testing and validation datasets, respectively, in the ICA-LSSVM approach. Finally, it was found to be 0.999, 0.999 and 0.999 for the training, testing and validation datasets in the PSO-LSSVM method, respectively. www.nature.com/scientificreports/ A majority of not only the training but also testing data points were found to be distributed around the Y = X line, implying high accuracy of the model predictions. This is also true for the validation phase. Apart from Figs. 4 and 5 is supportive of the accurate predictions of the ICA-LSSVM and PSO-LSSVM techniques. Table 3 provides a detailed description of the evaluation results. According to the results, PSO-LSSVM exhibited excellent accuracy as it yielded the lowest STD, RMSE, and MRE values and the largest coefficients of determination. Figure 6 depicts the relative deviation percentages of the proposed models. The PSO-LSSVM and ICA-LSSVM www.nature.com/scientificreports/ models were observed to have higher accuracy as compared to the GA-LSSVM model. Also, their relative deviation did not exceed 6 percent. The relative deviation range of the GA-LSSVM model was found to be from − 8 to + 10 percent. The approach of adopted outlier detection was used to detect the suspicious data sets of the models, as shown in Fig. 7. According to the standard residual results versus the Hat results, this study detected 15, 27, and 27 outliers for the GA-LSSVM, ICA-LSSVM, and PSO-LSSVM models, respectively. Sensitivity analysis. A sensitivity analysis was performed to the impacts of the inputs on the output (i.e., the drilling fluid density). Then, a relevancy factor was used to calculate the quantitative impacts of the parameters as: in which n is the total number of data points, X k,i denotes input i of parameter k, Y i is output i, X k is the average input k, and Y is the average output. The relevancy factor ranges from − 1 to + 1; a larger relevancy factor stands for a larger impact on the corresponding parameter. A positive effect indicates that arise in a particular input would raise the target parameter, while a negative impact represents a decline in the target due to an enhanced parameter. Among the input parameters, it is found that the temperature and initial density directly affected the results. At the same time, an inverse relationship was identified between the pressure and drilling fluid density; suggesting that a rise in the pressure decreases the drilling fluid density. The results of sensitivity analysis are plotted in Fig. 8. As can be seen, the pressure was found to have the strongest negative impacts, with a relevancy factor of − 0.03.
By comparing the R 2 values related to models developed in this study with five models found in the literature, it was concluded that the PSO-LSSVM and ICA-LSSVM models proposed in this work have the highest ability to predict the density of drilling fluid under HPHT condition. This comparison is shown in Fig. 9.

Conclusion
The present work employed soft computing methods, including PSO-LSSVM, ICA-LSSVM, and GA-LSSVM, to model the oil field drilling fluid density at enhanced temperatures and pressures. The findings are summarized below: • The PSO-LSSVM model yielded the most satisfactory results as it had the smallest deviation factor and highest accuracy with R 2 and RMSE equal to 0.999 and 0.0138, respectively. • According to our analysis, ICA-LSSVM and PSO-LSSVM exhibited higher accuracy than GA-LSSVM. Also, they did not exceed 6% in their relative deviations and GA-LSSVM was found to have a relative deviation of − 8 to 10%. • The sensitivity analysis results demonstrated that the temperature and initial density were directly related to the drilling fluid density, while the pressure was inversely related to it.
This work could be helpful in obtaining a deeper insight into predicting the mud density and its drilling application, particularly in high performance-required applications. www.nature.com/scientificreports/ www.nature.com/scientificreports/