#### Distinguished Author Series

#### JPT - Journal of Petroleum Technology, November 2000

## VIRTUAL INTELLIGENCE AND ITS APPLICATIONS IN PETROLEUM ENGINEERING

### 3. Fuzzy Logic

####
Shahab Mohaghegh

Intelligent Solutions, Inc.

West Virginia University

In two previous articles, a general overview of artificial neural networks and evolutionary computing and their applications in the oil and gas industry was presented. Fuzzy logic is the focus of this article. An overview of the subject is provided followed by its potential application in solving petroleum engineering related problems. As it was mentioned in the previous articles, the most successful applications of intelligent systems, especially when solving engineering problems, have been achieved by using different intelligent tools in concert and as a hybrid system. In this article, application of fuzzy logic for restimulation candidate selection in a tight gas formation in the Rocky Mountains will be reviewed. This particular application was chosen because it uses fuzzy logic in a hybrid manner integrated with neural networks and genetic algorithms.

### Background

The science of today is based on Aristotle's crisp logic formed more than two thousand years ago. The Aristotelian logic looks at the world in a bivalent manner, such as black and white, yes and no, and 0 and 1. Development of the set theory in the late 19^{th} century by German mathematician George Cantor that was based on the Aristotle's bivalent logic made this logic accessible to modern science. Then, the subsequent superimposition of probability theory made the bivalent logic reasonable and workable. Cantor's theory defines sets as a collection of definite, distinguishable objects. Figure 1 is a simple example of Cantor's set theory and its most common operations such as complement, intersection and union.

First work on vagueness dates back to the first decade of 1900, when American philosopher Charles Sanders Peirce noted that "vagueness is no more to be done away with in the world of logic than friction in mechanics^{1}." In the early 1920s, Polish mathematician and logician Jan Lukasiewicz came up with three-valued logic and talked about many-valued or multivalued logic^{2}. In 1937, quantum philosopher Max Black published a paper on vague sets^{3}. >These scientists built the foundation upon which fuzzy logic was later developed.

Lotfi A. Zadeh is known to be the father of fuzzy logic. In 1965, while he was the chair of the electrical engineering department at UC Berkeley, he published his landmark paper "Fuzzy Sets.^{4}" Zadeh developed many key concepts including the membership values and provided a comprehensive framework to apply the theory to many engineering and scientific problems. This framework included the classical operations for fuzzy sets, which comprises all the mathematical tools necessary to apply the fuzzy set theory to real world problems. Zadeh used the term "fuzzy" for the first time, and with that he provoked many oppositions. He became a tireless spokesperson for the field. He was often harshly criticized. For example, professor R. E. Kalman said in a 1972 conference in Bordeaux, "Fuzzification is a kind of scientific permissiveness; it tends to result in socially appealing slogans unaccompanied by the discipline of hard scientific work^{7}." (It should be noted that Kalman is a former student of Zadeh's and the inventor of famous Kalman filter, a major statistical tool in electrical engineering. Kalman filter is the technology behind the Patriot missiles used in the Gulf War to shoot down Iraqi SCUD missiles. There has been claims that it has been proven that use of fuzzy logic can increase the accuracy of the Patriot missiles considerably.^{5-6}) Despite all the adversities fuzzy logic continued to flourish and has become a major force behind many advances in intelligent systems.

The term "fuzzy" carries a negative connotation in the western culture. The term "fuzzy logic" seems to both misdirect the attention and to celebrate mental fog^{8}. On the other hand, eastern culture embraces the concept of coexistence of contradictions as it appears in the Yin-Yang symbol. While Aristotelian logic preaches A __or__ Not-A, Buddhism is all about A __and__ Not-A.

Many believe that the tolerance of eastern culture for such ideas was the main reason behind the success of fuzzy logic in Japan. While fuzzy logic was being attacked in the United States, Japanese industries were busy building a multi-billion dollar industry around it. Today, Japanese hold more than 2000 fuzzy related patents. They have used the fuzzy technology to build intelligent household appliances such as washing machines and vacuum cleaners (Matsushita and Hitachi), rice cookers (Matsushita and Sanyo), air conditioners (Mitsubishi), and microwave ovens (Sharp, Sanyo, and Toshiba), to name a few. Matsushita used fuzzy technology to develop its digital image
stabilizer for camcorders. Adaptive fuzzy systems (a hybrid with neural networks) can be found in many Japanese cars. Nissan has patented a fuzzy automatic transmission that is now very popular with many other cars such as Mitsubishi and Honda^{8}.

### Fuzzy Set Theory

The human thought, reasoning, and decision-making process is not crisp. We use vague and imprecise words to explain our thoughts or communicate with one another. There is a contradiction between the imprecise and vague process of human reasoning, thinking, and decision-making and the crisp, scientific reasoning of black and white computer algorithms and approaches. This contradiction has given rise to an impractical approach of using computers to assist humans in the decision-making process, which has been the main reason behind the lack of success for traditional artificial intelligence or conventional rule-based systems, also known as expert systems. Expert systems as a technology started in early 1950s and remained in the research laboratories and never broke through to consumer market.

In essence, fuzzy logic provides the means to compute with words. Using fuzzy logic, experts no longer are forced to summarize their knowledge to a language that machines or computers can understand. What traditional expert systems failed to achieve finally became reality (as mentioned above) with the use of fuzzy expert systems. Fuzzy logic comprises of fuzzy sets, which are a way of representing non-statistical uncertainty and approximate reasoning, which includes the operations used to make inferences^{7}.

Fuzzy set theory provides a means for representing uncertainty. Uncertainty is usually either due to the random nature of events or due to imprecision and ambiguity of information we have about the problem we are trying to solve. In a random process, the outcome of an event from among several possibilities is strictly the result of chance. When the uncertainty is a product of randomness of events, probability theory is the proper tool to use. Observations and measurements can be used to resolve statistical or random uncertainty. For example, once a coin is tossed, no more random or statistical uncertainty remains.

Most uncertainties, especially when dealing with complex systems, are the result of a lack of information. The kind of uncertainty that is the outcome of the complexity of a system is the type of uncertainty that rises from imprecision, from our inability to perform adequate measurements, from a lack of knowledge, or from vagueness (like the fuzziness inherent in natural language). Fuzzy set theory is a marvelous tool for modeling the kind of uncertainty associated with vagueness, with imprecision, and/or with a lack of information regarding a particular element of the problem at hand^{9}. Fuzzy logic achieves this important task through fuzzy sets. In crisp sets, an object either belongs to a set or it does not. In fuzzy sets, everything is a matter of degrees. Therefore, an object belongs to a set to a certain degree. For example, the price of oil today is $24.30 per barrel. Given the price of oil in the past few years, this price seems to be high. But what is a high price for oil? A few months ago, the price of oil was about $10.00 per barrel. Everybody agrees that $10.00 per barrel is low. Given how much it costs to produce a barrel of oil in the United States, one can say that the cut-off between low and high for oil price is $15.00 per barrel. If we use crisp sets, then $14.99 is low, and $15.01 is high. However, imagine if this was the criterion that was used by oil company executives to make a decision. The fact is, while $15.01 is a good price that many people will be happy with, $16.00 is better, and $20.00 is even better. Categorizing all these prices as high can be quite misleading. Fuzzy logic proposes the following fuzzy sets for the price of oil.

The most popular (although not yet standard) form of representing fuzzy set and membership information is as follows:

This representation provides the following information: the membership μ of Χ in fuzzy set Α is m. According to the above figure, when the price of oil is $20.00 per barrel, it has a membership of 0.15 in the fuzzy set "Good" and a membership of 0.85 in the fuzzy set "High". Using the above notation to represent the oil price membership values,

#### Approximate Reasoning

When decisions are made based on fuzzy linguistic variables (low, good, high) using fuzzy set operators (And, Or), the process is called the approximate reasoning. This process mimics the human expert's reasoning process much more realistically than the conventional expert systems. For example, if the objective is to build a fuzzy expert system to help us make a recommendation on enhanced recovery operations, then we can use the oil price and the company's proven reserves to make such a recommendation. Using the fuzzy sets in Figure 3 for the oil price and the fuzzy sets in Figure 4 for the company's total proven reserves, we try to build a fuzzy system that can help us in making a recommendation on engaging in enhanced recovery operations as shown in Figure 5.

The approximate reasoning is implemented through fuzzy rules. A fuzzy rule for the system being explained here can have the following form:

Rule #1: If the Price of Oil is High And the Total Proven Reserves of the company is Low then Engaging in Enhanced Recovery practices is Highly Recommended.

Since this fuzzy system is comprised of two variables and each of the variables consists of three fuzzy sets, the system will include nine fuzzy rules. These rules can be set up in a matrix as shown in Figure 6.

The abbreviations that appear in the matrix above correspond to the fuzzy sets defined in Figure 5. As one can conclude from the above example, the number of rules in a fuzzy system increases dramatically with addition of new variables. Adding one more variable consisting of three fuzzy sets to the above example, increases the number of rules from 9 to 27. This is known as the "curse of dimensionality."

#### Fuzzy Inference

A complete fuzzy system includes a fuzzy inference engine. The fuzzy inference helps us build fuzzy relations based on the fuzzy rules that have been defined. During a fuzzy inference process, several fuzzy rules will be fired in parallel. The parallel rule firing, unlike the sequential evaluation of the rules in the conventional expert system, is much closer to the human reasoning process. Unlike in the sequential process that some information contained in the variables may be overlooked due to the step-wise approach, the parallel firing of the rules allows consideration of all the information content simultaneously. There are many different fuzzy inference methods. We will look at a popular method called the Mamdani's inference method^{10}. This inference method is demonstrated graphically in Figure 7. In this figure, a case is considered when the price of oil is $20.00 per barrel and the company has approximately 9 MMBBLs of proven reserves. The oil price is represented by its membership in fuzzy sets "Good" and "High", while the total proven reserves is represented in fuzzy sets "Low" and "Moderate". As shown in Figure 7, this causes four rules to be fired simultaneously. According to Figure 6 these are rules #1, #2, #4, and #5. In each rule, the fuzzy set operation "And", the intersection between the two input (antecedents) variables, is evaluated as the minimum and consequently is mapped on the corresponding output (consequent). The result of the inference is the collection of the different fuzzy sets of the output variable as shown on the bottom of the figure.

A crisp value may be extracted from the result as mapped on the output fuzzy sets by defuzzifying the output. One of the most popular defuzzification procedures is to find the center of the mass of the shaded area in the output fuzzy sets.

### Application In Petroleum Industry

Fuzzy logic has been used in several petroleum engineering related applications. These applications include petrophysics^{11,12}, reservoir characterization^{13}, enhanced recovery^{14,15}, infill drilling^{16}, decision making analysis^{17}, and well stimulation^{18-20}. In this section we review an application that incorporates fuzzy logic in a hybrid manner in concert with neural networks and genetic algorithms.

In this example of use of the intelligent systems in petroleum engineering, neural networks, genetic algorithms, and fuzzy logic are used to select candidates for restimulation in the Frontier formation in the Green River Basin^{20}. As the first step of the methodology, neural networks are used to build a representative model of the well performance in the Frontier formation. Table 1 is a list of input parameters used in the neural network model building process.

Category | Input Parameter | Comments |

Location | X | X coordinates of the well (east-west) |

Y | Y coordinates of the well (north-south) | |

KB Elevation | Kelly Bushing Elevation | |

Reservoir | Permeability | From Type Curve matching analysis |

Drainage Area | From Type Curve matching analysis | |

Total Gas-Ft | Sum(Porosity * gas saturation * net pay) (all zones) | |

Completion | Total H Completed | Total completed thickness (all zones) |

Total No. of Holes | Total number of perforation holes | |

Completion Date | Date of well completion | |

Number of Zones | Total number of zones completed | |

Frac | Frac Number | A well may have up to 7 frac jobs |

Fluid type | Gelled oil, ungelled oil, linear gel, cross-linked gel | |

Fluid Volume | Total amount of fluid pumped in all fracs | |

Proppant Amount | Total amount of proppant pumped in all fracs |

Once the training, testing, and validation of the neural networks were completed, the training data set had a correlation coefficient of 0.96, and the Verification Data Set had a correlation coefficient of 0.72. As a by-product of the neural network analysis and by using a methodology called "backward elimination", an attempt was made to identify the most influential parameters in this data set. The results of neural network backward elimination analysis are demonstrated in Figure 8.

In this figure, all four categories of the input data are shown. The most influential category has the lowest R squared. This figure shows that reservoir quality is the most important category, followed by the completion and stimulation categories that seem to be equally important. The location-related input parameters seem to be the least important parameters when compared to others. Note that among all the parameters involved in this analysis only the last three stimulation related parameters (see Table 1) are considered as being controllable.

This brings us to the second step of the analysis that involves the genetic optimization of the stimulation parameters. In this step, the last three input parameters shown in Table 1 (namely fluid type, total fluid volume, and total proppant amount) are used in the optimization process. Using the neural network model developed in the first step of the analysis as the "fitness" function of the evolution process, the algorithm searches through all possible combinations of the aforementioned three stimulation parameters and tries to find the combination that results in the highest five-year cumulative production (5YCum). This process is repeated for every well individually. The difference between the optimized 5YCum and the actual 5YCum is considered to be the potentially missed production that may be recovered by restimulation. The outcome of this process is called the potential 5YCum and is used as one of the three inputs into step three which is the fuzzy decision support system using approximate reasoning.

Step three is a three-input, one-output, fuzzy system. The inputs include the above-mentioned potential 5YCum, a calculated parameter called Fracs per Zone (FPZ), and pressure. The engineers in the field brought this parameter to our attention. They mentioned that there are wells that have been completed in all zones (there can be as many as 7 zones present) but only one hydraulic fracture has been performed. In other words, the ratio of the number of treatments performed to the total number zones completed is an important factor. We also found that long-term pressure surveys had been performed in 1995 on many wells. The issue with the pressure surveys is that the shut-in time and the depth where the pressure readings were taken were not consistent throughout the field. This introduces serious imprecision in the pressure values as a comparative value from well to well. Therefore, all the three input parameters were subjected to fuzzy sets using low, moderate, and high fuzzy sets. The output of the fuzzy system is the degree of which a well is a candidate for restimulation. The output fuzzy sets include: 1) the well is a candidate, 2) the well may be a candidate, and 3) the well is not a candidate. The system includes 27 fuzzy rules that are qualified using a set of three truth functions. Figure 9 shows the 27 rules with truth qualification for the fuzzy systems. Figure 10 shows the truth qualification functions used for the approximate reasoning implementation in the fuzzy system. As demonstrated in this figure, each rule can be true, fairly true, or very true.

Using this three-step process, all the wells (belonging to a particular operator) in the Frontier formation was processed. A list of restimulation candidates was identified.

It should be noted that the intelligent systems approach for this application was modified as a result of its application to three different formations, two in the Rocky Mountains and one in East Texas. The fuzzy decision support system was the most recent addition to the process. The new and improved intelligent systems approach, that included the fuzzy logic component, picked well GRB 45-12 as candidate #20, while this well was missed as a candidate prior to the addition of fuzzy logic to this procedure. An engineer with several years of experience in this field also had suggested this well as a candidate. The fuzzy decision support system was able to capture the engineer's knowledge and use it in an automatic process for all the wells in the study. Figure 11 shows the result of restimulation on Well GRB 45-12.

### Closing Remarks

In this series of articles, a general background and some introductory information about virtual intelligence and three of its most popular tools (neural networks, genetic algorithms, and fuzzy logic) were presented. A partial list of use of these technologies in the oil and gas industry was also presented along with an application example for each of these techniques. It is hoped that this effort invokes some interest in this area by demonstrating the potential that these methodologies have in solving challenging and complex problems.

### References

- Freeman, E., ed., "The Relevance of Charles Peirce", La Sall, IL, Monist Library of Philosophy, 1983, pp.157-158.
- Lukasiewicz, J., "Elements of mathematical Logic", [Original Title: "Elementy logiki matematycznej".] The MacMillan Company, New York, NY, 1963.
- Black, M., "Vagueness: An Exercise in Logical Analysis", "Philosophy of Science", 4, 1937, pp. 427-455.
- Zadeh, L. A., "Fuzzy Sets", "Information and Control", Vol. 8, pp. 338-353, 1965.
- Kosko, B., "Fuzzy Thinking", Hyperion, New York, NY, 1991
- Kosko, B., Neural Networks and Fuzzy Systems, Prentice Hall, Englewood Cliffs, NJ, 1992.
- Eberhart, R., Simpson, P., Dobbins, R. "Computational Intelligence PC Tools", Academic Press, Orlando, FL, 1996.
- McNeill, D., Freiberger, P., "Fuzzy Logic", Simon & Schuster, New York, NY, 1993.
- Ross, T., "Fuzzy Logic With Engineering Applications", McGraw-Hill Inc., New York, NY, 1995.
- Jamshidi, M. et. al. (eds.) "Fuzzy Logic and Control: Software and Hardware Applications", Prentice Hall, Englewood Cliffs, NJ, 1993.
- Zhanggui, Lian, Di, Jiao, Jun, Fan, Jianchun, Guo, Kaihong, Zhang: "Integration of Fuzzy Methods into Geostatistics for Petrophysical Property Distribution", SPE 49964, SPE Asia Pacific Oil and Gas Conference and Exhibition held in Perth, Australia, 12-14 October 1998.
- Chen, H.C., Fang, J.H., Kortright, M.E., Chen, D.S., "Novel Approaches to the Determination of Archie Parameters II: Fuzzy Regression Analysis", SPE 26288, UNSOLICITED, 1993.
- Zhou, Cheng Dang, Wu, Xi-Ling, Cheng, Ju-An, "Determining Reservoir Properties in Reservoir Studies Using a Fuzzy Neural Network", SPE 26430, 68th Annual Technical Conference and Exhibition of the Society of Petroleum Engineers held in Houston, Texas, 3-6 October 1993.
- Chung, Ting-Horng, Carroll, Herbert B., Lindsey, Rhonda, "Application of Fuzzy Expert Systems for EOR Project Risk Analysis", SPE 30741, SPE Annual Technical Conference & Exhibition held in Dallas, TX, U.S.A., 22-25 October, 1995.
- Nikravesh, Masoud, Dobie, Chuck A., Patzek, Tad W., "Field-Wise Waterflood Management in Low Permeability, Fractured Oil Reservoirs: Neuro-Fuzzy Approach", SPE 37523, SPE International Thermal Operations & Heavy Oil Symposium held in Bakersfield, California, U.S.A., 10-12 February 1997.
- Wu, C.H., Lu, G.F., Yen, J., "Statistical and Fuzzy Infill Drilling Recovery Models for Carbonate Reservoirs", SPE 37728, Middle East Oil Conference and Exhibition held in Manama, Bahrain, 17-20 March 1997.
- Yong, Qidong, Hu, Yongquan, Xiao, Fangchun, "Fuzzy-Grey-Element Relational Decision-Making Analysis & Its Application", SPE 39579, SPE India Oil and Gas Conference and Exhibition held in New Delhi, India, 17-19 February 1998.
- Xiong, Hongjie, "An Investigation Into the Application of Fuzzy Logic to Well Stimulation Treatment Design", SPE 27672, SPE Permian Basin Oil and Gas Recovery Conference held in Midland, Texas, 16-18 March 1994.
- Rivera, Vincent P., "Fuzzy Logic Controls Pressure In Fracturing Fluid Characterization Facility", SPE 28239, SPE Petroleum Computer Conference held in Dallas, Texas, U.S.A., 31 July-3 August 1994 1994.
- Mohaghegh, S., Reeves, S., and Hill D., "Development of an Intelligent Systems Approach to Restimulation Candidate Selection", SPE 59767, SPE Gas Technology Symposium, Calgary, Alberta, April 2000.