**1. Introduction**

Water-based drill-in fluid (WBDIF) is used to drill the reservoir section, which carries the hydrocarbon. WBDIF should be designed to be non-damaging by building an impermeable layer on the face of the formation during the drilling process while this layer should be removed easily before casing and cementing the hole. WBDIF should provide stable rheological properties (RHPs) in order to provide a stable and clean hole and to prevent cutting accumulation, both of which lead to the possibility of pipe sticking, [1–3]. The main function of WBDIF is to support formation pressure and prevent reservoir fluid from entering the wellbore while drilling [4]. In addition, the drill-in fluid should cool and lubricate the bit and the drill string [5,6].

Sodium chloride-water-based drill-in fluid (NaCl-WBDIF) is mainly used while drilling the reservoir section. NaCl salt is used as a weighting material to increase mud density, while the Na+ ions work as shale stabilizers [7]. NaCl polymer mud is characterized as an inhibited, non-dispersed drilling fluid in which the viscosity control and the filtration properties are enhanced by using some types of polymers such as xanthan gum and starch. This helps reduce the possibility of formation damage [8].

RHPs play a key role in the success of the drilling operation. RHPs such as plastic viscosity (PV), yield point (YP), apparent viscosity (AV), flow consistency index (K), and flow behavior index (n) should be determined in real-time to calculate rig hydraulics and determine the required pressure to optimize hole cleaning. Increasing the PV value gives an indication about the increase in solid content, and it can highly affect the rate of penetration [9–11]. Paiaman et al. [12] stated that a lower YP value is preferred in turbulent flow, while a high YP value is required for laminar flow. The ratio of YP/PV is very important for hole cleaning. The YP/PV ratio should be greater than 1.5 [13]. The consistency index of the drilling fluid (k) is the main controlling parameter of the carrying capacity index (CCI) [14].

The common procedure in rig-sites is that the drilling crew usually measures the mud density and Marsh funnel time [15] every 15–20 min, and these measurements are used as indicators for the changes in the fluid properties [16]. Other RHPs (PV, YP, n, and K) are usually measured twice a day, as it requires a long time to heat the fluid, record, analyze the data, and clean the equipment. This process is tedious and time-consuming.

The effect of solid content on drilling fluid RHPs is very obvious, as can be seen throughout the literature. The objective of this study was to develop novel empirical models that are capable of acquiring the RHPs of NaCl polymer mud using one of the powerful artificial intelligence techniques—the artificial neural network (ANN)—using 900 field measurements of mud density (MD), Marsh funnel time (FT), and solid percent (SP). The novelty of this research is getting a real-time prediction (every 10–15 min) of the mud RHPs. Additionally, in this paper, a self-adaptive evolution algorithm was used to optimize the input parameters at the same time, and this was linked with the ANN model. The developed method depends on taking the reading from the automated Marsh funnel system (which contains different sensors) and applying artificial neural network models to predict the rheological properties every 10–20 min, which enable the driller to understand the changes of the drilling fluid properties as well as changes in the rig hydraulics. This make decisions regarding the required action based on given information much faster.

#### *Artificial Neural Network*

The concept of artificial networks was introduced into engineering research in the 1940s [17,18]. At early stages, artificial intelligence (AI) was used to solve the complex equations and mimic the nervous system [19,20].

The ANN has been considered as an effective AI tool; therefore, it has been widely applied in several fields such as classification and optimization tasks [21,22]. The ANN model is a system of neurons and hidden layers [23]. Usually, the whole data are grouped into two sets—training and testing data sets. The training group is used to train the network and capture the relationship between the input and output parameters, while the testing data are used to measure the reliability of the developed ANN system. During the training stage, the testing data remain unseen by the model, which provides more confidence regarding model reliability [24–26].

Alajmi et al. [27] predicted choke performance using an ANN. Alarifi et al. [28] estimated the productivity index for oil horizontal wells using an ANN, a functional network and fuzzy logic. Chen et al. [29] applied a NN and fuzzy logic to evaluate the performance of an inflow control device (ICD) in a horizontal well. Their model investigated the influences of reservoir parameters (such as reservoir size, thickness, reservoir heterogeneity, and permeability ratio) on ICD completion performance. Van and Chon [30,31] evaluated the performance of carbon dioxide (CO2) flooding using

ANN techniques. They developed ANN models for determining oil production rate, CO2 production, and gas-oil ratio (GOR).

The self-adaptive differential evolution (SaDE) was introduced by Qin et al. [32] to overcome the common issues of the differential evaluation (DE) [33]. The advantage of the SaDE is the ability to self-adapt the controlling parameters and mutation strategies based on the learning experience in the previous algorithm generations to obtain better results. Moussa and Awotunde [34] developed a modified SaDE that can be used for the optimization in different engineering problems.

Al-Khdheeawi and Mahdi [35] applied an ANN to predict the apparent viscosity of water-based drilling fluid using the mud density and Marsh funnel time. They concluded that the developed ANN correlation could predict AV with an average absolute percentage error (AAPE) of 8.6% and a correlation coefficient of 98.8%. Gowida et al. [36] stated that the ANN can be used efficiently to predict the rheological properties of the calcium chloride (CaCl2) water-based drilling fluid based on mud density and Marsh funnel time.

Zhang et al. [37] developed a new technique for breast cancer detection using a combination of rectified linear unit and rank-based stochastic pooling. They concluded that the detection efficiency of the new technique overcomes the known six standard techniques known for breast cancer detection. For abnormal breasts in mammogram images, Wang et al. [38] developed a combined system of a feed-forward neural network with principal computer analysis, a Jaya algorithm, and a weighted-type fractional Fourier transform. They concluded that Jaya was a better algorithm for training the feed-forward neural network than the common know algorithms, and the developed technique was able to detect the abnormal breast with high accuracy (>92.27%).

The main goal of this study was to develop new sets of empirical correlations, optimized using modified self-adaptive differential evolution (MSaDE), to determine the RHPs of NaCl-WBDIF using a hybrid ANN model.

#### **2. Methodology**

ANN variables such as percent of training to testing, number of neurons, training and testing functions, and the number of layers should be optimized to develop a robust ANN model, and from this model, empirical correlation can be extracted. In this study, MSaDE was applied to optimize the variable parameters of the ANN for different RHPs. Nine-hundred field measurements were used to train, test, and validate the ANN models. The data were selected randomly to train the model, with 65% of the data being used for training (570 data points), 23% of the data being used for testing (180 data points), and 12% of the data being used (150 data points) for further validation. The ANN models were built using 88% of the available data, including training and testing and based on the optimized models, and the new empirical correlation was developed. The 12% remaining of data were used to validate the developed empirical correlations. The correlation coefficient ®, AAPE, and visualization check were used as criteria to evaluate the developed models and correlations.

The AAPE is a measure of the relative deviation of the predicted data from the real data and can be calculated using Equation (1):

$$\text{AAPE} = \frac{1}{\text{n}} \sum\_{i=1}^{\text{n}} |\mathbf{E}\_i| \tag{1}$$

where n is the number of data points and Ei is the relative deviation of a predicted value from a real value, Equation (2);

$$\mathbf{E}\_1 = \left(\frac{\mathbf{y}\_{\text{real}} - \mathbf{y}\_{\text{predick}}}{\mathbf{y}\_{\text{real}}}\right) \ast 100\tag{2}$$

For the network training and transferring functions, two pools of 12 different training functions and 7 transferring functions were established, respectively. Each individual training/transferring function was indexed and used as one of the input parameters to the MSaDE optimization algorithm along with the other parameters such as the number of neurons, the percent of training to testing, and the number of hidden layers. Twenty independent optimization runs were performed to optimize the above-mentioned parameters. The optimization run that resulted best fit (in terms of the highest R and the lowest AAPE was considered as the best run, and its results are shown and discussed in this paper.
