Introduction

Crude oil is a complex homogeneous mixture of various carbon number hydrocarbons, and it compounds of paraffins, aromatics, naphtehnes, asphaltenes and resins. The majority of crude oils and crude oil products contain considerable amounts of petroleum wax. The composition of the wax depends on the oil. A wax composition of mainly low molecular weight n-alkanes (C 20C 40), is termed paraffin or distillate wax.

Deposition of paraffin wax is a major issue in the oil industry. Wax precipitates from both crude oil and condensate when temperature falls below a certain value. As oil temperature decreases further, more wax will precipitate. If wax precipitates, it may deposit in pipes and equipments causing flow problems. Wax deposition is mainly a problem in pipelines, production equipment and in wells.

The main problems caused by wax deposition are increased pressure drop, production will eventually clog pipes. There are various methods to prevent and reduce problems caused by wax deposition in pipelines that the most important methods are pig racing, chemical injection, thermal insulation and temperature rise. With increasing production from oil wells, followed by quality changes due to increasing crude oil fractions, reducing pressure loss and flow rate, the residence time of oil in pipelines is increasing, resulting in better opportunities for sedimentation wax is in the pipeline. Due to the high content of wax deposition in the oil industry, numerous studies have been conducted in the past decade (Reistle 1928, 1932; Bilderback and McDougall 1963; Haq MA 1978; Smith and Ramsden 1978; Asperger et al. 1981). Many different authors have designed models for the flow of waxy crude oils and the associated deposition of solid wax within pipelines, including Farina and Fasano (1997) and Fusi and Farina (2004).

Many researchers have studied the thermodynamics of wax deposition in hopes of creating a model that accurately describes the process . (Lira-Galeana et al. 1996; Solaimany Nazar et al. 2005; Wuhua and Zongchang 2006; Edmonds et al. 2008; Ramirez-Jaramillo et al. 2001, 2004).

Hoffmann et al. (2011) performed wax deposition experiments to study the single-phase flow in pipelines. Aiyejina et al. (2011) have reviewed wax formation in oil pipelines. In their critical review, deposition mechanisms including wax deposition models were captured. Hoffmann et al. (2011) proposed an online wax thickness build-up monitoring technique in sub-sea oil pipeline based on heat pulse monitoring.

The newest wax deposition thickness (WTR) model is the model presented by Halstensen et al. (2013) to Estimation of wax deposition thickness in pipelines [the so called (“Halstensen-model”)].

However, these presented models are not accurate enough (good) to predict WTR in the oil industry. Most of these models assume that the wax-oil (gel) deposit has constant wax content and require a lot of input information to achieve the required information. Therefore, it is obvious that developments of new advanced prediction models are important for oil industry. These models should not have the limitations and complexities of the available models. In other words the new models should be more accurate, robust and less sensitive to noisy input data, adaptive to a new input–output and also should require the least amount of input information. Intelligent models offer all of the above desirable characteristics. Therefore, the main objective of this study was a novel approach using ANFIS for accurate improve predicting the WTR in single-phase turbulent flow.

Adaptive network–based fuzzy inference system

A fuzzy inference system, a system based on fuzzy if–then rules that applying these rules, the ability to find any type or model is a nonlinear mapping, so that these models can be input with corresponding outputs relevant. The process of formulating the mapping from a given input to an output using fuzzy logic, fuzzy inference system is called. There are three useful fuzzy inference systems: namely the linguistic (Mamdani-type) (Mamdani and Assilian 1975). The relational equation, and the Takagi–Sugeno–Kang (TSK) (Takagi and Sugeno 1985; Zadeh 1984). The main difference between these systems is the output, so that the Mamdani system, the output is a fuzzy set should be defuzzification but Sugeno system output is a linear or constant. On the other hand, neural network learning capability and can be using of train data, the network parameters are adjusted so that the desired input rate, the desired output is achieved. However, neural networks, the use of human knowledge, in contrast, fuzzy systems cannot be used to derive linguistic expressions. So, to create a better learning ability and achieve more accurate approximations, combining the learning capabilities of neural networks and fuzzy systems infer properties of the TSK fuzzy model, called Adaptive neural fuzzy inference system (ANFIS) was presented in 1999 (Jang 1993; Fuzzy logic toolbox 2007). In other words, a fuzzy neural system is a fuzzy system that to determine its parameters used from training samples processed by the learning algorithm that derive or inspired by neural network theory. In Fig. 1, for simplicity, a network with two inputs x, y and output f is considered. ANFIS contains five layers in its architecture, including the fuzzy layer, product layer, normalized layer, defuzzification layer, and total output layer. It should be noted that assuming just two membership functions for each of the input data x and y, the general form of a first-order TSK type of fuzzy if–then rule would be

Fig. 1
figure 1

a The reasoning scheme of ANFIS. b Schematic of ANFIS architecture (Feili Monfared et al. 2010)

$${\text{If }}x{\text{ is}}\;A_{i} \;{\text{and }}y{\text{ is}}\;B_{i} \;{\text{Then}}\;f_{i} = p_{i} x + q_{i} y + r_{i} ,\;1,2, \ldots ,n$$
(1)

Where n is the number of rules and p i , q i , and r i are the parameters that are determined during the training process. Through the learning process, at the first stage, the membership degree (μ) of each of the linguistic labels \(A_{i}\) and B i is calculated:

$$O_{i}^{1} = \mu_{Ai} (x),\;i{ = 1,2,} \ldots ,n$$
(2)
$$O_{i}^{1} = \mu_{Bi} (x),\;i{ = 1,2,} \ldots ,n$$
(3)

Then, at the second layer, which is the product layer, the previously calculated membership degrees of linguistic variables are multiplied:

$$O_{i}^{2} = W_{i} = \mu_{Ai} \left( x \right)\mu_{Bi} \left( y \right),\;i = 1,2, \ldots ,n$$
(4)

The third layer is the normalized layer, in which the ratio of each weight to the total weights is calculated:

$$O_{i}^{3} = \overline{w}_{i} = \frac{{w_{i} }}{{\sum\nolimits_{i = 1}^{n} {w_{i} } }}, \, i = 1, 2, \ldots ,n$$
(5)

The fourth layer is the defuzzification layer with adaptive nodes, which means that their outputs depend on the parameter(s) pertaining to these nodes and the learning rule specifies how these parameters should be changed to minimize a prescribed error measure (Jang 1993). The relationship for these nodes is as follows:

$$O_{i}^{4} = \overline{w}_{i} f_{i} = \overline{w}_{i} \left( {p_{i} x + q_{i} y + r_{i} } \right),\;i = 1, 2, \ldots ,n$$
(6)

Finally, in the fifth layer, the summation of all of the incoming signals is performed where the result would be the output of the system:

$$O_{i}^{5} = \sum\nolimits_{i = 1}^{n} {\overline{w}_{i} f_{i} ,\;\;i = 1, 2, \ldots ,n}$$
(7)

Neural-fuzzy modeling

In this work, ANFIS model was used to predict wax deposition thickness in single-phase turbulent flow rate. Data needed (Table 1) to design and train the presented model were extracted and collected from articles which investigate the phenomenon of wax deposition thickness deposition in laboratory-scale (Hernandez 2002; Lund 1998; Rosvold 2008; Venkatesan 2004). To develop model of ANFIS, 1500 data (Table 1) was used and with a random selection, 1000 of data was used as train set data and the 500 remaining data was used as test set data.

Table 1 Ranges of the input variables used in developing the ANFIS model

Choosing this configuration was done based on trial and error procedure to achieve best results.

To develop an intelligent system, the most important physical skill required is to make a decision what the principal inputs and output (s) of the system are. In order to this study, the input parameters were Reynolds number (Re), time (T), Dimensionless deposition temperature driving force (ΔT +) and Wax content (WC). A coefficient called the temperature driving force, ΔT+, was introduced by Gudmundsson (2010). The temperature driving force is calculated by ΔT+ = (T − T wall)/\(T_{\text{oil}}\) which \(T_{\text{c}}\) is the cloud point temperature (WAT), \(T_{{{\text{wall}} }}\) is the inner wall temperature and T oil is the oil temperature. The desirable output of the model was the wax deposition thickness (WTR). To achieve this goal, model ANFIS was designed. In ANFIS model, WTR was a function of Reynolds number (Re), time (T), Dimensionless deposition temperature driving force (ΔT +) and Wax content (WC), therefore, the model has 4 and 1 input and output, respectively:

$${\text{WTR }} = f_{\text{ANFIS }} \;({\text{Re}},\;{\text{Time}},\;\Delta {\text{T + ,}}\;{\text{WC}})$$
(8)

The fuzzy WTR modeling system used in this study is a multi-input single output (MISO) Takagi–Sugeno system. ANFIS model on the basis of the subtractive clustering algorithm was developed. Because of large number of input variables, scatter partitioning was used to avoid “curse of dimensionality” problem instead of grid partitioning.

Table 2 shows the details of optimal fuzzy model designed for ANFIS model. This arrangement resulted by trial and error procedure. The best parameters of obtained fuzzy clustering designed for ANFIS model is shown in Table 3. Hybrid optimization method was used to optimize generated fuzzy inference system (FIS).

Table 2 Characteristics of fuzzy model for model of ANFIS
Table 3 The best parameters set parameters for the ANFIS (Genfis2)

Results and discussion

The performance of ANFIS configuration was evaluated based on the mean square error (MSE), absolute relative deviation error (AAPE), average absolute deviation error (TAAD) and R is the correlation coefficient for normalized data.

this errors are defined as follows:

$${\text{TAAD}}\% = \frac{100}{N} \times \left| {\frac{{\mathop \sum \nolimits_{i = 1}^{N} \left( {y_{i}^{ \exp } - y_{i}^{\text{cal}} } \right)}}{{y_{i}^{ \exp } }}} \right|$$
(9)
$${\text{RMSE}}\% = \sqrt {\left(\mathop \sum \limits_{i = 1}^{N} y_{i}^{\text{cal}} - y_{i}^{ \exp } \right)^{2} (100/N)}$$
(10)
$${\text{AAPE}}\% = \frac{100}{N}\left| {\mathop \sum \limits_{i = 1}^{N} \left( {y_{i}^{ \exp } - y_{i}^{\text{cal}} } \right)} \right|$$
(11)

Where y exp i and y cal i are target and model output for the ith output, and N is the total number of events considered.

Table 4 shows the features and functions of designed model compared with the newest model (Halstensen model).

Table 4 Error analysis of different models

Figure 2 show the results of testing ANFIS model compared with experimental results in this study. In Fig. 3, actual results against output for ANFIS model is shown.

Fig. 2
figure 2

Wax thickness deposition rate as a function of time

Fig. 3
figure 3

Experimental data versus ANFIS model outputs

These figures are in a good agreement and show that the presented model results ANFIS, are in a good agreement with the actual results which shows the high accuracy of the model than newest model.

The related values of R and % RMSE for test set data of the ANFIS model were 0.9929 and 0.0277 %, respectively, that in compare with Halstensen model are very accurate. Based on obtained results, designed ANFIS model has good accurate and able to predict wax deposition thickness in single-phase turbulent flow rate, because of the integration of fuzzy logic systems with the capability of learning in artificial neural networks which leads to the adaptability of the model with this issue.

Conclusions

Wax deposition is a serious problem in the Petroleum Industry that results in the formation damage, flow restrictions and decreased production rate. In this work, utilization of the Adaptive Neural-Fuzzy Inference System technique for predicting wax thickness in single-phase turbulent flow rate has been investigated.

The following conclusions can be drawn from this research:

  1. 1.

    From the results of this study, it can be pointed out that the developed ANFIS model is able to predict the wax deposition thickness in single-phase turbulent flow rate and can be used in oil and gas industry.

  2. 2.

    Our comparison among experimental results and neural-fuzzy show that prediction of designed model is well matched with experimental data with mean square error, absolute relative deviation error and average absolute deviation error which are 0.00077034, 0.015720 and 0.097961, respectively.

  3. 3.

    The results shown that ANFIS model is more accurate than Halstensen model to predict wax deposition thickness in single-phase turbulent flow rate.

  4. 4.

    Using the designed model, and there is a direct relationship between inputs and output variables can be prediction of wax deposition thickness, when the operational conditions conform to the ranges of the input data was used to develop these model.

  5. 5.

    One of the main advantages of this model is simplicity in the calculation, lack of money and lots of time.

  6. 6.

    The most important application of this model is to optimize oil production calculation and operations.