Application of Artiﬁcial Intelligence and Gamma Attenuation Techniques for Predicting Gas–Oil–Water Volume Fraction in Annular Regime of Three-Phase Flow Independent of Oil Pipeline’s Scale Layer

: To the best knowledge of the authors, in former studies in the ﬁeld of measuring volume fraction of gas, oil, and water components in a three-phase ﬂow using gamma radiation technique, the existence of a scale layer has not been considered. The formed scale layer usually has a higher density in comparison to the ﬂuid ﬂow inside the oil pipeline, which can lead to high photon attenuation and, consequently, reduce the measuring precision of three-phase ﬂow meter. The purpose of this study is to present an intelligent gamma radiation-based, nondestructive technique with the ability to measure volume fraction of gas, oil, and water components in the annular regime of a three-phase ﬂow independent of the scale layer. Since, in this problem, there are several unknown parameters, such as gas, oil, and water components with different amounts and densities and scale layers with different thicknesses, it is not possible to measure the volume fraction using a conventional gamma radiation system. In this study, a system including a 241 Am- 133 Ba dual energy source and two transmission detectors was used. The ﬁrst detector was located diametrically in front of the source. For the second detector, at ﬁrst, a sensitivity investigation was conducted in order to ﬁnd the optimum position. The four extracted signals in both detectors (counts under photo peaks of both detectors) were used as inputs of neural network, and volume fractions of gas and oil components were utilized as the outputs. Using the proposed intelligent technique, volume fraction of each component was predicted independent of the barium sulfate scale layer, with a maximum MAE error of 3.66%.


Introduction
Numerous applications for multiphase flow meters exist in the petrochemical and oil industries. For instance, there is a need to monitor multiphase flow continuously at some points. Some of these points include the gas-oil separator units and the wellhead collection lines. Monitoring at these points is of great value. The three-phase flow's volume fraction can be determined through several methodologies. One of the best methodologies is the gamma radiation-based technique, which is a nondestructive and reliable tool. Several studies have covered this area. One of the earliest studies was conducted in 1980, when Abouelwafa and Kendall introduced a method for metering three-phase flow. That is the dual-energy gamma-ray attenuation-based method [1]. In their study, Dong-hui et al. (2005) presented the dual-energy gamma-ray method. The method aimed to examine the volume fraction of various components on the multiphase pipe flow cross-section of gas-oil-water [2]. With the intent to measure the attenuation dose rate of the material, 2 of 14 there was a need to design a data acquisition system and nuclear instruments. After designing the data acquisition system and the nuclear instruments, static tests followed. Oil-water-gas media has three phases. These phases were investigated to test the hypothesis that they effectively simulate different distributions of media volumetric fraction. The three phases were investigated when the oil-water-gas media was used in experimental vessels. During this investigation, the measurements of attenuation intensities were taken. There was also a study of the volumetric fraction's equations and the linear attenuation coefficients' arithmetic. When the attenuation equations were investigated for unexpected measurement error, the involvement of modified arithmetic was disclosed. Besides, the experimental research revealed that the system's accuracy was acceptable. In their study, Salgado et al. (2009) measured a three-phase flow volume fraction using the gamma radiation technique [3]. They used two radioactive sources whose energies were different. They also used three Nal detectors. In their estimation of the gas-oil-water's volume fraction, the researchers were aided by the artificial neural network (ANN). They considered several flow regimes in this process. The researchers replicated this methodology in 2010 to recognize the homogenous, stratified, and annular flow regime. They then estimated the water-gas-oil multiphase systems' volume fraction [4]. Hoffmann et al. (2011) measured phase fractions using a traversable gamma radiation-based instrument [5]. There was a need to ensure that the noisy measurements yielded relevant data. Therefore, the researchers had to be careful in their data analysis. In this regard, the researchers used the two-phase and single-phase flow calibration data and tested the three-phase flow data analysis technique against this data. The researchers found that the traversable gamma instrument's average density data was significantly related to the calibrated, stationary, single-energy gamma instrument's density measurements. However, more information was obtained from the traversable densitometer than from the single energy instrument. The rationale behind this is that it was possible to measure all the three phases' transient phase fraction over the pipeline's cross-section. By using this information, the flow pattern could be determined. Further studies in field of multiphase flow meters can be found in references [6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23][24][25].
According to the literature review, in the systems that used gamma radiation technique to determine the oil, water, and gas volume fraction, the existence of the scale layer's has not been considered. The scale layer forms gradually as mineral salts are deposited on the oil pipeline's inner surface. An example of such a layer is shown in Figure 1. their study, Dong-hui et al. (2005) presented the dual-energy gamma-ray method. The method aimed to examine the volume fraction of various components on the multiphase pipe flow cross-section of gas-oil-water [2]. With the intent to measure the attenuation dose rate of the material, there was a need to design a data acquisition system and nuclear instruments. After designing the data acquisition system and the nuclear instruments, static tests followed. Oil-water-gas media has three phases. These phases were investigated to test the hypothesis that they effectively simulate different distributions of media volumetric fraction. The three phases were investigated when the oil-water-gas media was used in experimental vessels. During this investigation, the measurements of attenuation intensities were taken. There was also a study of the volumetric fraction's equations and the linear attenuation coefficients' arithmetic. When the attenuation equations were investigated for unexpected measurement error, the involvement of modified arithmetic was disclosed. Besides, the experimental research revealed that the system's accuracy was acceptable. In their study, Salgado et al. (2009) measured a threephase flow volume fraction using the gamma radiation technique [3]. They used two radioactive sources whose energies were different. They also used three Nal detectors. In their estimation of the gas-oil-water's volume fraction, the researchers were aided by the artificial neural network (ANN). They considered several flow regimes in this process. The researchers replicated this methodology in 2010 to recognize the homogenous, stratified, and annular flow regime. They then estimated the water-gas-oil multiphase systems' volume fraction [4]. Hoffmann et al. (2011) measured phase fractions using a traversable gamma radiation-based instrument [5]. There was a need to ensure that the noisy measurements yielded relevant data. Therefore, the researchers had to be careful in their data analysis. In this regard, the researchers used the two-phase and single-phase flow calibration data and tested the three-phase flow data analysis technique against this data. The researchers found that the traversable gamma instrument's average density data was significantly related to the calibrated, stationary, single-energy gamma instrument's density measurements. However, more information was obtained from the traversable densitometer than from the single energy instrument. The rationale behind this is that it was possible to measure all the three phases' transient phase fraction over the pipeline's cross-section. By using this information, the flow pattern could be determined. Further studies in field of multiphase flow meters can be found in references [6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23][24][25].
According to the literature review, in the systems that used gamma radiation technique to determine the oil, water, and gas volume fraction, the existence of the scale layer's has not been considered. The scale layer forms gradually as mineral salts are deposited on the oil pipeline's inner surface. An example of such a layer is shown in Figure  1.  When the scale layer is compared to the fluid flow inside the oil pipeline, its density tends to be higher. In this regard, the three-phase flow meter's measuring precision can be reduced over time due to high photon attenuation that can occur due to the scale layer having a higher density. This study aims at presenting an intelligent gamma radiationbased system that can measure the oil, gas, and water components' volume fraction in a three-phase flow's annular regime independent of the scale layer. The article is structured as follows: Section 2 discusses the details of the proposed detection system and the implementation of the neural network. Section 3 reports the results of the neural network and calculates the accuracy of the designed neural networks. The last section provides both the summary and the conclusion.

Radiation Based System
Monte Carlo N Particle code (MCNP) [27] was implemented in the present investigation in order to model the radiation-based system. As pointed out in the abstract section, the aim of this investigation is to propose an intelligent, gamma radiation-based system with the ability of measuring volume fraction of gas, oil, and water components in annular regime of a three-phase flow independent of the scale layer. Since, in this problem, there are several unknown parameters, it is not possible to measure the volume fraction using a conventional gamma radiation system that includes one radiation source and one detector. To obtain more information from the fluid inside the pipe, a system including a dual energy source consisted of 241 Am and 133 Ba radioisotopes that emit photons with energies of 59 and 356 keV, respectively, and two NaI detectors for recording the transmitted photons, were used.
A steel pipe with internal radius and thickness of 10 cm and 0.5 cm, respectively, was considered in this study. In order to model the scale layer, a cylindrical shell of barium sulfate (BaSO 4 ) with density of 4.5 g·cm −3 and different thicknesses in the range of 0-3 cm, with a step of 0.5 cm, was considered on the internal wall of the steel pipe.
Annular regime of a three-phase flow was modeled inside the pipe. Air, gas, oil, and water with densities of 0.00125, 0.826, and 1 g·cm −3 were utilized as gas, oil, and water phases, respectively. For each scale thickness, various volume fractions were simulated for each component (seven different scale thickness×36 different volume fractions = totally 252 simulations were done).
As aforementioned, in this investigation, two 2.54 cm × 2.54 cm NaI detectors were applied to record the transmitted photons. Tally F8 was utilized in order to record photon spectra in both detectors. The first detector was positioned diametrically in front of the radioactive source (see Figure 2). For the second detector, at first, a sensitivity investigation was done in order to find the optimum position. In this regard, the center of the second detector was positioned in different orientation in the range of 5 • -11 • , with a step of 1 • , and transmitted photons were recorded. Orientation of 5 • was the minimum possible position for the second detector, because, at less than this orientation, the first and second detectors would interfere with each other. The reason for choosing orientation of 11 • as the maximum position was that, at more than this orientation, there would be no more transmitted photons through the pipe that carries on useful information about the three-phase flow to reach the detector. At each position, sensitivity of the second detector relative to gas phase and oil phase volume fraction changes was investigated for both registered counts of gamma radiations emitted from 241 Am and 133 Ba radioisotopes. For instance, calculation of sensitivity of registered counts under 241 Am photo peak in the second detector relative to gas phase changes is indicated in Equation (1). It is worth mentioning that the sensitivity was calculated using the registered counts for gas phase fractions of 10% and 80%, which make the highest and lowest attenuation for photons.

Relative sensitivity
where, C gvf 80 and C gvf 10 refer to registered counts under 241 Am photo peak when the gas volume fraction is 80% and 10%, respectively. The results of sensitivity investigations are shown in Figure 3. For all four cases, by increasing orientation angle of the second detector, sensitivity starts to increase until it reaches a maximum value at the angle of 7 • and then it gradually decreases. Based on the acquired results, it could be deduced that 7 • is the optimal orientation angle for the second detector.
where, Cgvf80 and Cgvf10 refer to registered counts under 241 Am photo peak when the volume fraction is 80% and 10%, respectively. The results of sensitivity investigations shown in Figure 3. For all four cases, by increasing orientation angle of the seco detector, sensitivity starts to increase until it reaches a maximum value at the angle o and then it gradually decreases. Based on the acquired results, it could be deduced tha is the optimal orientation angle for the second detector.  It is worth mentioning that the simulated configuration in this work, especially performance of the detectors, has been validated in our previous study using so experiments [28]. The corresponding experimental setup can be seen in Figure 4 geometry identical to the experimental setup was simulated using MCNP code, and th the registered counts in both detectors were compared with the experimental on Calibrations of the gamma attenuation-based devices used for measuring the three-ph flow characteristics are usually done for three different extreme cases when the pip completely filled by gas, oil, and water. In the present study, a detection system the sa as the validated one in our previous work was modeled. However, in the present stu a gas-oil-water three-phase flow was modeled instead of a two-phase flow. where, Cgvf80 and Cgvf10 refer to registered counts under 241 Am photo peak when the g volume fraction is 80% and 10%, respectively. The results of sensitivity investigations a shown in Figure 3. For all four cases, by increasing orientation angle of the secon detector, sensitivity starts to increase until it reaches a maximum value at the angle of and then it gradually decreases. Based on the acquired results, it could be deduced that is the optimal orientation angle for the second detector.  It is worth mentioning that the simulated configuration in this work, especially th performance of the detectors, has been validated in our previous study using som experiments [28]. The corresponding experimental setup can be seen in Figure 4. geometry identical to the experimental setup was simulated using MCNP code, and the the registered counts in both detectors were compared with the experimental one Calibrations of the gamma attenuation-based devices used for measuring the three-pha flow characteristics are usually done for three different extreme cases when the pipe completely filled by gas, oil, and water. In the present study, a detection system the sam as the validated one in our previous work was modeled. However, in the present stud a gas-oil-water three-phase flow was modeled instead of a two-phase flow. It is worth mentioning that the simulated configuration in this work, especially the performance of the detectors, has been validated in our previous study using some experiments [28]. The corresponding experimental setup can be seen in Figure 4. A geometry identical to the experimental setup was simulated using MCNP code, and then the registered counts in both detectors were compared with the experimental ones. Calibrations of the gamma attenuation-based devices used for measuring the three-phase flow characteristics are usually done for three different extreme cases when the pipe is completely filled by gas, oil, and water. In the present study, a detection system the same as the validated one in our previous work was modeled. However, in the present study, a gas-oil-water three-phase flow was modeled instead of a two-phase flow.

Artificial Intelligence
In recent years, it has been proved that artificial intelligence can be implemented as a powerful tool for various engineering applications . There are several kinds of ANNs, in which multilayer perceptron (MLP) is the most well-known kind of them. This kind of ANN has a good ability for regression and classification. This network is constructed from at least three layers of neurons: The input layer, the hidden layer (or hidden layers), and the output layer. There are different techniques to calculate the biases and weights of this mathematical network, of which Levenberg Marquardt (LM) is most well-known algorithm in this regard. In the present investigation, two different MLP-LM networks with four inputs and one output were considered. Four features were extracted from the recorded spectra in the detectors and were considered as MLP-LM inputs. The procedure of obtaining gas, oil, and water volume fraction percentages independent of scale layer thickness is indicated in Figure 5. The trained networks can estimate the percentages of gas and oil volume fraction based on input signals independent of scale layer thickness, correctly.

Artificial Intelligence
In recent years, it has been proved that artificial intelligence can be implemented as a powerful tool for various engineering applications . There are several kinds of ANNs, in which multilayer perceptron (MLP) is the most well-known kind of them. This kind of ANN has a good ability for regression and classification. This network is constructed from at least three layers of neurons: The input layer, the hidden layer (or hidden layers), and the output layer. There are different techniques to calculate the biases and weights of this mathematical network, of which Levenberg Marquardt (LM) is most well-known algorithm in this regard. In the present investigation, two different MLP-LM networks with four inputs and one output were considered. Four features were extracted from the recorded spectra in the detectors and were considered as MLP-LM inputs. The procedure of obtaining gas, oil, and water volume fraction percentages independent of scale layer thickness is indicated in Figure 5. The trained networks can estimate the percentages of gas and oil volume fraction based on input signals independent of scale layer thickness, correctly.

Artificial Intelligence
In recent years, it has been proved that artificial intelligence can be implemented as a powerful tool for various engineering applications . There are several kinds of ANNs, in which multilayer perceptron (MLP) is the most well-known kind of them. This kind of ANN has a good ability for regression and classification. This network is constructed from at least three layers of neurons: The input layer, the hidden layer (or hidden layers), and the output layer. There are different techniques to calculate the biases and weights of this mathematical network, of which Levenberg Marquardt (LM) is most well-known algorithm in this regard. In the present investigation, two different MLP-LM networks with four inputs and one output were considered. Four features were extracted from the recorded spectra in the detectors and were considered as MLP-LM inputs. The procedure of obtaining gas, oil, and water volume fraction percentages independent of scale layer thickness is indicated in Figure 5. The trained networks can estimate the percentages of gas and oil volume fraction based on input signals independent of scale layer thickness, correctly.  A total of 252 different cases were simulated using MCNPX code; 177 cases were implemented for training the network, and 75 cases were used for testing the efficiency of presented MLP-LM. In order to obtain the optimum structure of proposed networks, different structures with various number of layers, neurons in each layer, epochs, and different activation functions were tested. For this purpose, different loops were defined, and, with trial and error, the optimum architecture was found. The mentioned algorithm is: (1) The data set, counters, and error are defined.
(2) The data set is normalized. The best structure of presented MLP-LM model for gas volume fraction measuring has one hidden layer consists of 9 neurons. The number of epochs was 685. The best structure of presented MLP-LM model for oil volume fraction measuring has one hidden layer consists of 10 neurons. The number of epochs was 750. Architectures of the ANN models were shown in Figure 6. A total of 252 different cases were simulated using MCNPX code; 177 cases were implemented for training the network, and 75 cases were used for testing the efficiency of presented MLP-LM. In order to obtain the optimum structure of proposed networks, different structures with various number of layers, neurons in each layer, epochs, and different activation functions were tested. For this purpose, different loops were defined, and, with trial and error, the optimum architecture was found. The mentioned algorithm is: (1) The data set, counters, and error are defined.
(2) The data set is normalized.  The output from mth neuron of the hidden layer is given by: The output of the neuron in the output layer is given by: (a) (b) Figure 6. Architectures of presented MLP-LM models (a) for gas volume fraction measuring (b) for oil volume fraction measuring.
The mathematical equations for the first MLP-LM model are as follows. The input to the neuron m in the hidden layer is given by: The output from mth neuron of the hidden layer is given by: The output of the neuron in the output layer is given by: where X is the input vector, b is the bias term, W is the weighting factor, and f is the activation function of the hidden layer.

Results and Discussions
After finding optimum positions for the detectors, orientation angle of 0 • for the first detector and 7 • for the second detector, counts under photo peaks of 241 Am and 133 Ba radioisotopes were recorded in both detectors for different scale layer thicknesses and volume fractions. Ternary contour plots of the recorded counts in both detectors for different volume fractions when the scale thickness is 0 and 3 cm, are shown in Figures 7-10. Comparing Figures 7 and 8 that correspond to the recorded counts in the first detector for 241 Am and 133 Ba radioisotopes, respectively, it can be said that dynamic range of registered counts relative to changes of gas volume fraction, or, better to say, sensitivity, for 133 Ba is more than 241 Am. A same response is also observed for the second detector. Comparing Figure 7a,b, it could be observed that, when scale layer is 0, sensitivity of detector relative to changes of gas, oil, and water components is much more than when the scale thickness is 3. In other words, by increasing thickness of scale layer, somehow information about the flow of inside the pipe starts fading. This manner can be also seen for both detectors and radioisotopes. Comparing Figures 7a and 9a, it can be observed that sensitivity of the second detector relative to changes of volume fractions is a little bit more than the first detector.
Regression diagrams of actual data and predicted data using presented MLP-LM models are shown in Figures 11 and 12. In Table 1, data number, scale layer thickness, actual outputs, and measured outputs for test data set are tabulated. The output of the neuron in the output layer is given by: where X is the input vector, b is the bias term, W is the weighting factor, and f is the activation function of the hidden layer.

Results and Discussions
After finding optimum positions for the detectors, orientation angle of 0 o for the first detector and 7° for the second detector, counts under photo peaks of 241 Am and 133 Ba radioisotopes were recorded in both detectors for different scale layer thicknesses and volume fractions. Ternary contour plots of the recorded counts in both detectors for different volume fractions when the scale thickness is 0 and 3 cm, are shown in Figures 7-10. Comparing Figures 7 and 8 that correspond to the recorded counts in the first detector for 241 Am and 133 Ba radioisotopes, respectively, it can be said that dynamic range of registered counts relative to changes of gas volume fraction, or, better to say, sensitivity, for 133 Ba is more than 241 Am. A same response is also observed for the second detector. Comparing Figure 7a,b, it could be observed that, when scale layer is 0, sensitivity of detector relative to changes of gas, oil, and water components is much more than when the scale thickness is 3. In other words, by increasing thickness of scale layer, somehow information about the flow of inside the pipe starts fading. This manner can be also seen for both detectors and radioisotopes. Comparing Figures 7a and 9a, it can be observed that sensitivity of the second detector relative to changes of volume fractions is a little bit more than the first detector.  Mean Absolute Error (MAE) and Root Mean Square Error (RMSE) of presented metering system were calculated using Equations (5) and (6).
Mathematics 2021, 9, 1460 8 of 14 where N, X i (Actual), and X i (Measured) are the data number, real values, and estimated values, respectively. Performance criteria of the developed models were tabulated in Table 2 using Equations (5) and (6).     It can be found from the obtained errors that the presented gauging system is reliable. This novel meter could be used in different industries for metering volume fraction of each phase independent of scale layer thickness. Radioisotope sources, detectors type, detectors position, extracted features from output signals, used data analysis algorithms and ANN architectures were selected appropriately in order to achieve the optimum performance for the proposed system. Regression diagrams of actual data and predicted data using presented MLP-LM models are shown in Figures 11 and 12. In Table 1, data number, scale layer thickness, actual outputs, and measured outputs for test data set are tabulated.  Regression diagrams of actual data and predicted data using presented MLP-LM models are shown in Figures 11 and 12. In Table 1, data number, scale layer thickness, actual outputs, and measured outputs for test data set are tabulated.

Conclusions
In the present investigation, a novel and optimized radiation-based gauge, including two detectors and a dual energy source, was presented to measure volume fraction of gas, oil, and water components in annular regime of a three-phase flow independent of the scale layer. Position of the second detector was optimized. The percentages of gas, oil, and water volume fractions were measured independent of the barium sulfate scale layer. In fact, the presented measuring system can be used in different pipes with different thicknesses of scale layer. All the required data for modeling the presented system was achieved using MCNPX code. In order to model the metering system using MATLAB software, two different ANNs with four inputs and one output were considered. Recorded counts under photo peaks of 241 Am and 133 Ba were applied to both ANN models, as 252 × 4 input matrix and gas and oil volume fraction percentages were considered as the first and second ANN model outputs, respectively. The architectures of both ANNs were optimized using a presented algorithm. The dataset was divided to train set and test set. The accuracy of models was confirmed by good agreement of actual data and measured data in both sets. Finally, the volume fraction percentages were predicted with the RMSE of less than 4.33 and independent of scale layer.