You are on page 1of 125

The Pennsylvania State University

The Graduate School


Department of Energy and Mineral Engineering

OPTIMIZATION OF NATURAL GAS FIELD DEVELOPMENT USING


ARTIFICIAL NEURAL NETWORKS

A Thesis in
Petroleum and Mineral Engineering
by
Adewale Olatunji

2010 Adewale Olatunji

Submitted in Partial Fulfillment


of the Requirements
for the Degree of
Master of Science
May 2010

ii
The thesis of Adewale Olatunji was reviewed and approved* by the following:

Luis F. Ayala
Assistant Professor of Petroleum and Natural Gas Engineering
Thesis Advisor

R. Larry Grayson
Professor of Energy and Mineral Engineering
George H., Jr., and Anne B. Deike Chair in Mining Engineering
Graduate Program Officer of Energy and Mineral Engineering

Mku T. Ityokumbul
Associate Professor of Mineral Processing and Geo-Environmental Engineering

Yaw D. Yeboah
Professor and Department Head of Energy and Mineral Engineering

*Signatures are on file in the Graduate School.

iii

Abstract
Field development of natural gas reservoirs is one of the main aspects of
exploration and production of natural gas for oil and gas operators. After a natural gas
field is deemed economically viable for development, and the reservoir properties have
been determined, a field development plan will normally be put together as a blueprint
for producing the field. However, since the main objective of natural gas field operators
is to maximize profits, it is imperative to understand how to optimize recovery from the
field. In this study, a model that uses reservoir engineering concepts to determine the
optimum hydrocarbon that can be produced per dollar spent has been developed. The
model adopts an optimization-based systems approach to field development, which
begins with predicting reservoir performance, and subsequently incorporating economic
parameters to determine the number of wells that will yield the maximum monetary value
of the field.
Artificial neural network (ANN) technology as a tool is increasingly becoming
popular for use in reservoir engineering applications such as reservoir characterization
and prediction of enhanced oil recovery performance due to its relatively fast,
computationally cost-effective, and reliable delivery compared to other tools such as
reservoir simulators. In this study, ANN technology is applied to the field development
optimization model in order to reliably predict the optimum number of wells for any gas
field development project within the specified reservoir and economic parameters. In this
regard, an ANN expert system has been developed and several data sets containing
relevant parameters have been used to train and test the developed ANN system. At the

iv
end of the study, the ANN system showed considerable effectiveness and robustness in
being able to predict the optimized development pattern of a natural gas field.

Table of Contents
List of Figures....vii
List of Tables......ix
Nomenclature.......x
Acknowledgements..xiii
Chapter 1 Introduction............................................................................................1
Chapter 2 Background............................................................................3
2.1 Gas Field Development from Initial Discovery to Abandonment.....3
2.2 Reservoir Performance Prediction.6
2.3 Optimization of the Field Development..21
2.4 Artificial Neural Networks..24
2.5 Artificial Neural Networks in Petroleum Engineering....34
Chapter 3 Problem Statement...39
Chapter 4 Natural Gas Field Development......................................41
4.1 Reservoir Performance Prediction...41
4.2 Economic Considerations....60
4.3 Optimization of Gas Field Development.....65
Chapter 5 Implementation of ANN Model.......70
5.1 Development of ANN Model..70
5.2 Generation of Data Sets. .....72
5.3 Results..............78
Chapter 6 Conclusion and Recommendations..85
Bibliography.....89

vi
Appendix A MATLAB Program Codes....94
A.1 Bisection..94
A.2 Bisection_Pz....95
A.3 CullSmith....96
A.4 NPV.....98
A.5 Optimization..100
A.6 Performance_Prediction....102
A.7 Viscosity....105
A.8 Zfactor...........106

Appendix B: ANN MATLAB Code........107

vii

List of Figures
Figure 2.1: Life cycle of a typical natural gas field4
Figure 2.2-1: Natural gas reservoir material balance plot........................12
Figure 2.2-2: IPR curves for decreasing values of reservoir pressure, Pr ....14
Figure 2.2-3: Typical TPR curves for two wellhead pressures based on the Cullender &
Smith Correlation...17
Figure 2.2-4: IPR curves showing reservoir depletion effects over time.....19
Figure 2.4-1: Basic components of a neuron .......27
Figure 2.4-2: Basic components of a perceptron......28
Figure 2.4-3: Basic model of ANN......29
Figure 2.4-4: Structure of a neuron, where inputs from one or more previous neurons are
individually weighted, then summed ....31
Figure 4.1-1a: Production rate, Qfield as a function of time..43
Figure 4.1-1b: Cumulative production, Gp as a function of time.44
Figure 4.1-1c: Pressure drawdown as a function of time.45
Figure 4.1-2: IPR curve at initial reservoir pressure, Pi for hypothetical gas field...49
Figure 4.1-3: TPR curve at minimum wellhead pressure, Pwh_min for hypothetical gas
field50
Figure 4.1-4: IPR curves at Pi = 3000 psia and Pr|tp = 1511 psia..53
Figure 4.1-5: Performance prediction for hypothetical gas field showing field production
rate, Qfield over time....58

viii
Figure 4.1-6: Performance prediction for hypothetical gas field showing cumulative gas
produced, Gp over time......59
Figure 4.1-7: Pressure drawdown of hypothetical gas field over time.60
Figure 4.2: Flow rate vs. time plots for hypothetical gas field based on different number
of wells...............................................................................................................................61
Figure 4.3: Optimization of the hypothetical gas field.68
Figure 5.2-1: Sensitivity Analysis for Nw_opt....77
Figure 5.2-2: Sensitivity Analysis for NPVmax.....77
Figure 5.3-1: Optimized network architecture......79
Figure 5.3-2: ANN results for Nw_opt....81
Figure 5.3-3: ANN results for NPVmax.....82
Figure 5.3-4: Relevance of input parameters....83

ix

List of Tables

Table 4.1-1: Reservoir, well and fluid properties for hypothetical gas field47
Table 4.1-2: Performance predictions for hypothetical natural gas field......57
Table 4.3: Economic parameters for hypothetical natural gas field.....64
Table 5.2-1: ANN input ranges.....74
Table 5.2-2: Possible input values for ANN implementation...75

Nomenclature

A = Area
Bgi = Initial gas formation volume factor
Cwell = Per-well Performance Coefficient
Cw = Cost of well
Cw_ft = Cost of well per foot
Gp_yr = Annual gas field production
Gp = Cumulative gas produced
Gp|tp = Cumulative gas produced at end of production plateau
h = Thickness of reservoir
ID = Inner diameter of well tubing
n = Pressure drawdown exponent
n* = neuron
Nw = Number of wells
Nw_opt = Optimum number of wells
Pi = Initial reservoir pressure
Ppc = Critical pressure of gas
Ppr = Reduced reservoir pressure
Pr = Reservoir pressure
Pr|tp = Reservoir pressure at end of production plateau
Pwh = Wellhead pressure

xi
Pwh|i = Initial wellhead pressure
Pwh_min = Minimum wellhead pressure
Pwf = Well flowing bottom-hole pressure
Pwf|tp = Well flowing bottom-hole pressure at end of production plateau
Qa = Abandonment field production rate
Qfield = Field production rate
Qfield_ave = Average field production rate
Qfieldpl = Field production during production plateau
Qwell = Well production (flow) rate
Qwellpl = Flowrate of each well during production plateau
r = Deferment rate
RFa = Recovery factor at field abandonment
RFpl = Recovery factor at end of production plateau
RV = Annual revenue from gas production
RV|PV = Present value of revenue from gas production
RV|t = Revenue from gas production in year t
Sgi = Initial gas saturation
Swi = Initial water saturation
t = Time
ta = Final year of production
tp = Time period till end of production plateau
Tr = Reservoir temperature

xii
Tpc = Critical temperature of gas
Tpr = Reduced temperature of gas
Twh = Wellhead temperature
Twf = Well flowing bottom-hole temperature
u = Cash generated per thousand cubic feet of gas sold
w = Weight associated with a neuron
x = Perceptron input
Z = Compressibility factor of gas
Zi = Compressibility factor of gas at Pi
Z|tp = Compressibility factor of gas at Pr|tp

Greek
= Porosity
g = Specific gravity of gas

Abbreviation
ANN = Artificial Neural Network
Bscf = Billion standard cubic feet
DF = Deferment factor
Mmscfd = Million standard cubic feet per day
NPV = Net Present Value
OGIP = Original gas in place

xiii

Acknowledgements

I would like to express my sincere gratitude and appreciation to Dr. Luis Ayala
for his continued guidance and supervision during the period of writing my thesis and my
graduate program in general. His patience, motivation and technical contributions helped
me tremendously through the process of writing this thesis.
I would also like to thank Dr. Larry Grayson and Dr. Thaddeus Ityokumbul for
accepting to be on my thesis committee.
My thanks also go to my fellow PME students whose friendship helped me
through the graduate program at Penn State and beyond.
Last but not least, I am forever indebted to my parents for their moral and
financial support throughout my graduate study and educational pursuits in general.

Chapter 1

Introduction

Natural gas is a vital component of the world's supply of energy. It has many
commercial, industrial and residential uses; and it is one of the cleanest, safest, and most
useful of all energy sources. Natural gas is normally found in reservoirs underneath the
earth, and is commonly associated with oil deposits.
The search for oil and gas involves the use of sophisticated technology that helps
to find the location of the hydrocarbon. If indeed it is confirmed that there is natural gas
in commercial quantity in the location, a well will be drilled, developed, and completed
so that the gas can be extracted and brought to the surface.

All of these involve

significant capital investments. As a result, the decision to drill or not to drill a well
depends on a variety of factors, the most important of which is the economic viability of
the reservoir. From the time a gas well is drilled, the resources available are actively
monitored and managed to maintain long-term production. Field development analysis of
natural gas reservoirs has recorded tremendous progress over the years, and this is mainly
as a result of advances in oil field technology. That notwithstanding, there are still
significant issues that need to be resolved in order to maximize production and optimize
developed reserves from natural gas fields.
For field development to be successful, the application of various reservoir
evaluation techniques is very important. Prior to drilling a gas well, the volume and

2
location of the gas needs to be established, after which the actual amount of gas in place
and how much gas the well will actually produce will be determined. To address these
fundamental questions, an integrated reservoir evaluation approach needs to be adopted.
One of the most important tasks of the petroleum engineer is predicting the
amount of oil and gas that will be recovered from a reservoir. Choosing the methodology
is critical for accurate forecasts which of course are vital for sound managerial planning.
Predicting reservoir performance using conventional deterministic models can be tasking,
especially for very complicated reservoir systems. In this study, a model that uses
Artificial Neural Network (ANN) to determine the optimum production of hydrocarbons
from natural gas reservoirs that can be produced per dollar spent would be developed.
The model will provide a basic and general tool for natural gas field development which
can be used as a framework for future implementation. The model that will be presented
will be one that employs realistic ranges of reservoir, fluid and well properties for natural
gas fields in North America. While this range will not cover all the possible combinations
of parameters in these fields, it will attempt to capture a wide enough sample collection
for both the lower and upper boundaries of possible scenarios such that it can be
applicable to a vast number of natural gas fields. The ranges of field parameters used in
this study and assumptions made will be shown in later chapters.

3
Chapter 2

Background

Predicting reservoir performance using conventional deterministic models can be


tasking, especially for very complex reservoir systems. The literature is replete with
studies that have been conducted on reservoir performance prediction and natural gas
field development. A review of the literature gives us an understanding of how findings
from these studies have impacted the industry. This literature review will essentially
focus on reservoir performance prediction as it pertains to natural gas field development
and how ANN can, and has been incorporated and used as a tool in petroleum
engineering projects.

2.1 Gas Field Development from Initial Discovery to Abandonment


When a field is first discovered where there is scope for gas exploration, the gasin-place is estimated, usually by applying volumetrics. For this, some knowledge of the
areal extent and the petrophysical and gas properties of the reservoir are required. As an
alternative, the material balance method or production decline can be applied where some
pressure-production history of that place is required to make an assessment of the gas-inplace (Ikoku, 1984).
The next step in the process is the assessment for reservoir performance for the
development plan by preparing a production schedule. Included in this schedule are the

4
contractual obligations such as the maximum field rate (Qfield) required, the duration of
the production, and the time to abandonment. The investment required to maintain the
desired rate of production must also be determined at this point. For this, the producer
must specify the number of wells he requires to be drilled, when they should be drilled,
and the desired deliverability per well and field.
Once the initial well is drilled, additional appraisal wells (if needed) are drilled
and tested to delineate the size and performance of the reservoir. This is the information
which is required for the producer to negotiate contracts with his/her buyers. Once the
contracts are signed, the producer gives the go-ahead for the field development and gas
production to commence and pipelines are made available to transport the gas to market.
Figure 2.1 shows a typical life cycle of a natural gas field from the time of its exploration
and field development to the end of its reservoir life.

Figure 2.1: Life cycle of a typical natural gas field (After Rojey et al., 1997)

5
As seen in Figure 2.1, the initial stage of gas field development is rapid and
production rate increases as new wells are drilled and surface facilities are installed to
meet the contracted field rate (Qfield). After the initial development phase, production
goes through a protracted period of consistency or production plateau. During this period
the reservoir capability is greater than the maximum, contractual rate, and therefore
maintenance of the rate is of primary importance. At some point in the life of the field,
the reservoir would have drawn a sizable amount of its storage that the volume of
production would have come down against its contractual obligation, at which point the
production rate starts to decline.
Alternatively, the production plateau may be prolonged or extended by making
further investment such as recompression or drilling additional wells to maintain the
contracted production rate. The choice to implement this additional investment in
extending the production plateau beyond the initial decline point is based primarily on
economics. When production can no longer be sustained at the contracted rate due to
additional investment costs exceeding production revenue, reservoir production begins to
decline until it reaches a point when it is no longer economic to continue production. This
point is usually considered the end of the life of the field and the field is typically
abandoned unless external factors such as new technology, secondary or tertiary recovery
methods, or expected hike in price of natural gas increase the potential of future
economic production. In running a reservoir, the risks involved, especially in terms of the
finance must be kept in mind, considering the fluctuations which take place due to the
decreases or increases in demand and price for gas (Ikoku, 1984).

6
2.2 Reservoir Performance Prediction
One of the primary considerations while putting together a gas field development
plan is reservoir performance prediction, which is widely viewed as the most important
aspect of reservoir development and operations. Unless there is sufficient indication to
show that a reservoir is going to last for a considerable duration of time and that it will
meet the basic requirements of a producers target, it may be uneconomical to invest in
the project. Ikoku (1984) propounded that, to predict the performance of a reservoir, one
has to develop a flow rate vs. time relationship from initial production to abandonment.
The study however also suggested that if only the reservoir performance is to be
considered, one should construct a pressure decline curve from arbitrarily selected
reservoir pressure over Z-factor (Pr/Z) values and from this curve, determine the
corresponding cumulative gas that can be produced.
Bloomfield and Mines (2002) stated that in order to predict reservoir
performance, one needs to develop numerous production profiles for different operating
scenarios using a numerical reservoir simulator. Reservoir simulator models permit the
inclusion of all relevant reservoir details which can be used to proffer more accurate
predictions associated with differing operating scenarios. Reservoir models or simulators
have been useful in the formulation of field development plans. Petroleum engineers may
use such models to determine the location of field development wells. Satter and Iqbal
(2008) point out that in recent times, reservoir simulators have been employed to aid in
the planning, execution and optimization of waterflood operations, a secondary gas
recovery technique.

7
Field experience has shown that, an aspect which is of prime importance in the
continuous optimization of production in a gas field is in the prediction of the relationship
between the flowrate and the pressure drop in a reservoir. This is where an inflow
performance relationship (IPR) is typically used. An IPR model allows one to better plan
various operating processes such as determining the optimum production scheme,
designing production equipment and artificial lift systems. Maravi (2003) stated that an
IPR model (inflow) combined with tubing performance analysis (outflow) using a nodal
analysis technique allows one to monitor well productivity and to choose a proper
remedial treatment option such as acidizing, fracturing, workovers, and so on, to restore
optimum well performance.
As was mentioned earlier, natural gas field development is a highly capital
intensive venture. Thus the economic analysis of the project viability is a very important
first-step that must be made before production operations can commence. van Dam
(1968) stated that there is a great difference between gas and oil production, not only
because of their different characteristics and structure, but also because of the cost
involved. van Dam (1968) also stated that, while production from an oil field can be
based mainly on the optimum capacity of the reservoir to produce, this is not the case for
natural gas fields. He went further to say that there is a very close interrelationship
between the production and marketing of natural gas because gas fields are directly
connected through pipelines to consumers. Therefore the capacity of the market to accept
the gas has to be considered when planning the development of a gas field. van Dam
(1968) further stated that another major difference is that in oil fields, the production of

8
oil starts at an early stage of field development and subsequently, the information
obtained at this stage is used to design the optimum development plan of the field. On the
other hand, gas production usually cannot commence until a gas sales contract has been
signed, hence the information required in developing an optimum field development plan
must be known before production can begin. This creates a wider degree of uncertainty
during gas field development since the information required usually cannot be accurately
obtained until the field has started to produce.
Since the objective for any natural gas field development is to maximize profit
from the production of gas, the knowledge of the optimum number of wells,

and

optimum deliverability per well and for the field is very important to the producer.
However, for any gas field development optimization technique to be efficient, a reliable
method of predicting reservoir performance over the life of the field is required. This
method can then be applied to a variety of scenarios based on the field properties to
determine the number of wells and deliverability per well that maximizes profit.
Predicting the amount of oil and gas that will be recovered from a reservoir
remains one of the most important tasks of the petroleum engineer. Emanuel et al (1989)
stated that the procedure for calculating reservoir performance is by:

Establishing the porosity/permeability characteristics of the reservoir from well


logs and pores, and determine its statistical structure using random fractals.

Using a random fractal-interpolation scheme based on the fractal characteristics


determined from the well logs to project well data to the inter-well region.

Establishing fluid-flow and displacement parameters from PVT, relative


permeability, and if possible, coreflood data.

Assembling geologic and fluid data into a highly detailed finite-difference crosssectional model representing reservoir flow between a typical injector/producer
pair.

Running the finite-difference model for projected flood conditions and developing
a dimensionless characteristic solution that relates phase fractional flow at the
producer to PV of injected fluid.

Developing a streamtube model of the reservoir to represent area conformance,


where the formation of the streamtube will incorporate variable mobility ratios,
permeability trends, and no-flow boundaries.

Coupling the streamtube model with the characteristic solution to estimate fieldwide project performance.

The determination of volume of gas reserves is another important aspect in


reservoir engineering (Mattar and McNeil, 1998). This information is crucial in the
development of a production strategy, design of facilities, contracts and valuation.
Depending on data availability and judgment on the reliability of the data, an estimator
will select from the several methods to make a proved reserves estimate. Methods based
on production performance data are commonly preferred over those inferred from
geological and engineering data for their accuracy. Two prominent ways to estimate the
gas reserves in reservoirs are:

10

The volumetric method, and

Material balance method

There are also other reservoir types and production mechanisms available, such as the
production decline method; but again, it is the reliability of the data which determines
which of these methods is more appropriate for a given reservoir. The volumetric and
material balance methods are usually employed in determining the original gas-in-place,
while the production decline method estimates recoverable gas.

Volumetric Method
The volumetric method computes the total volume or cumulative three
dimensional space a fluid occupies at any point in time based on the existing conditions.
The volumetric method can be very valuable in making a determination of the original
gas reserves in place (OGIP) and also, the remaining reserves during the life cycle of a
field. The volumetric computation of the OGIP is based on the initial pressure and
temperature of the reservoir and uses information from sources such as contour maps,
well logs and core analysis to determine the volume of the gas bearing portion of the
reservoir. The drawback to this method is that the factors inherent in its calculations may
sometimes be difficult to accurately determine. The volume of gas originally in place is
simply the product of area (A), thickness (h), porosity ( ) and initial gas saturation of the
formation (Sgi = 1 Swi), where Swi = initial water saturation. The value from this
computation represents the volume of gas at reservoir conditions, and has to be converted

11
to the volume at standard conditions using the initial gas formation volume factor, Bgi.
The OGIP can be calculated using the volumetric method shown in Equation 2.2-1.
OGIP =

43,560 Ah (1 S wi )
B gi

Equation 2.2-1

The initial gas formation volume factor, Bgi being a ratio of the volume of gas at
reservoir conditions to the volume of gas at standard conditions (14.7 psia and 60oF) can
be calculated as shown in Equation 2.2-2 below:
Bgi =

0.02827Tr Z i
Pi

Equation 2.2-2

where Tr is the reservoir temperature, Pi is the initial reservoir pressure, and Zi is the
compressibility factor at Pi.
In the readings of volumetrically determined reserves, it can be erratic because of
the method it employs in determining reservoir characteristics that are often unknown as
in the case of the areal extent of a pool (Mattar and McNeil, 1998).

However, material

balance method is considered more accurate.

Material Balance Method


The material balance method uses actual reservoir performance data to make an
assessment of the gas reserves in a reservoir. It is based on the concept of conservation of
mass by analysis of the quantity of what enters, builds up in, and leaves the reservoir.
Because of this, the material balance method is used more widely to estimate remaining
reserves. Once the estimate of the original gas-in-place, OGIP is determined, it can be
used reliably to forecast the recoverable gas reserves under various operating conditions.

12
The material balance equation presents an inversely linear relationship between
the amount of gas produced (Gp) and Pr/Z where Pr is the reservoir pressure and Z is
the compressibility factor at Pr. The material balance equation for a natural gas reservoir
is shown in Equation 2.2-3 and a corresponding plot in Figure 2.2-1. It should be noted
that the intercept of the material balance curve on the x-axis (Gp) in Figure 2.2-1 is OGIP.

P Gp
P
Pr

= i i
Z i Z i OGIP
Z

Figure 2.2-1: Natural gas reservoir material balance plot

Equation 2.2-3

13
Inflow Performance Relationship
In order to maximize the value of a gas field, it is necessary to understand the
performance of the system by integrating its components in an integrated well or field
production system model. The inflow performance relationship (IPR), which is the ability
of the reservoir to produce to the wellbore is usually the first component necessary to
build a system model, and the selection of the right curve is critical in predicting the
inflow performance under varying conditions of pressure drawdown, fluid and gas ratios,
reservoir depletion, vertical effective stress, relative permeability, and wellbore skin. This
relationship is usually affected by reservoir rock and fluid properties, including nearwellbore effects and heterogeneities in the well drainage area, average reservoir pressure
and field development activities (Lee and Wattenbarger, 1996). The IPR is basically a
relationship between the well flowrate (Qwell) and the well bottom-hole flowing pressure
(Pwf) and can be formulated as an equation:
Qwell = Cwell(Pr2 Pwf2)n

Equation 2.2-4

where Cwell is the per-well performance coefficient, and n the pressure drawdown
exponent.
The per-well performance coefficient, Cwell can be obtained from reservoir
deliverability tests and is a representation of the flow performance from the reservoir to
the wellbore. The IPR equation mentioned above can be described as a more general
form of the pseudo-steady state equation for radial flow of real gases in terms of showing
the relationship between flowrate and pressure drawdown squared. The pseudo-steady
state equation for radial flow of real gases incorporates more individual reservoir

14
parameters such as viscosity, z-factor, skin factor, etc in its computation but the IPR
equation incorporates the relationship into just Cwell and n. In this study, the IPR equation
will be used to express this relationship as opposed to the pseudo-steady state equation
because the former utilizes less individual parameters which will make the neural
network implementation more efficient and less cumbersome. Back pressure testing and
isochronal testing are two commonly used methods to estimate the inflow performance
parameters (Cwell, n) of a reservoir.
The IPR relationship is shown graphically in Figure 2.2-2 for decreasing values of
reservoir pressure. As can be seen from the graph, the IPR curve shifts downward and
becomes smaller for lower Pr, accounting for the effects of reservoir depletion.

Figure 2.2-2: IPR curves for decreasing values of reservoir pressure, Pr

15
Tubing Performance Relationship (TPR)
The tubing performance or outflow performance represents the vertical flow along
the tubing and shows the performance of the well in producing from bottom-hole to the
surface. It shows the relationship between the flowrate in tubing and the flowing bottomhole pressure, and is affected by pressure losses experienced due to restrictions in tubing
from chokes, valves and connections. Several methods have been proposed to calculate
the bottom-hole pressure of a flowing gas well as it is usually not practical to obtain this
pressure directly using a pressure gauge at the bottom of the well. The least accurate
method is the Average Temperature and Deviation Factor method. This method has a
considerable number of assumptions inherent in its computation such as that the
temperature and compressibility factor values are constant at an average value and so is
only used to get an approximation of the bottom-hole pressure. Poettmanns method also
uses a constant temperature but uses a compressibility factor value that varies with
pressure making it more accurate and realistic than the Average Temperature and
Deviation Method.
The Sukkar and Cornell method can be used to determine outflow performance
for reduced pressures between Ppr = 1 and Ppr = 12, and reduced temperatures between Tpr
= 1.5 and Tpr = 1.7. This method assumes a constant average temperature that can be
obtained using any of a number of proposed average value calculations. The Cullender
and Smith method uses the least number of assumptions and is widely considered as the
most accurate. Lee and Wattenbarger (1996) explain that the Cullender and Smith
method is more rigorous than the other methods and is applicable over a much wider

16
range of gas-well pressures and temperature since it makes no simplifying assumptions
for the variation of either temperature or Z-factor. However, this method assumes
steady-state flow, a single-phase gas stream and that the change in kinetic energy is
negligible (Ikoku, 1984). The Cullender and Smith method provides a functional
relationship between the well flowing bottom-hole pressure (Pwf) and the wellhead
pressure (Pwh) as shown in Equation 2.2-5.
Pwf = (Pwh, Qwell, Twf, Twh, depth, ID, g, Ppc, Tpc)

Equation 2.2-5

where Qwell is the well flowrate, Twf the well bottom-hole temperature, Twh the
wellhead temperature, depth the depth of the producing formation from surface, ID
the inner diameter of the tubing, g the specific gravity of the gas, Ppc the critical
pressure of the gas, and Tpc the critical temperature of the gas. Figure 2.2-3 shows the
typical behavior of the tubing performance equation based on the Cullender and Smith
correlation. This is shown for two different wellhead pressures, Pwh1 and Pwh2, Pwh1 being
the higher wellhead pressure of the two.

17

Figure 2.2-3: Typical TPR curves for two wellhead pressures based on the
Cullender & Smith Correlation

Typically, the minimum wellhead pressure for a gas well is specified by the
pressure of the pipeline through which it is transported because gas pipelines usually
require delivery of the gas at a specific minimum pressure. At the constant rate stage of
gas production when the reservoir is capable of producing at a rate higher than the
specified rate, the specified rate is maintained at each wellhead by adjusting a well
control device called the choke. Once the reservoir is no longer able to deliver gas at the
specified pipeline pressure, compressors can be installed and the wellhead pressure
lowered.

18
Well Deliverability
A combination of an inflow performance curve (IPR) and a tubing performance
curve (TPR), generally identifies the flowrate and corresponding flowing bottom-hole
pressure at a particular reservoir pressure and tubing parameters such as tubing size and
wellhead pressure. The deliverability or instantaneous flowrate of a flowing natural gas
well can then be said to be this combination of the reservoir performance (inflow) and the
tubing performance (outflow). This is so because the rate of flow to the surface can be
restricted by the ability of the reservoir to deliver the gas as well as the capacity of the
well tubing to allow flow to the surface. A graphical representation of the well
deliverability is shown in Figure 2.2-4. Typically, a well will flow or deliver gas at a rate
that is defined by the more restrictive of the inflow performance and tubing performance.
In Figure 2.2-4, this is shown by the points identified as Operating points where the
intersections of both the inflow performance curve and the tubing performance curve
correspond to the flowrate of the well for the respective reservoir pressure and wellhead
pressure. Based on this relationship between the inflow performance and tubing
performance, if the reservoir pressure, Pr is unknown and the flowrate, Qwell (operating
point) is known beforehand, the flowing bottom-hole pressure, Pwf can be obtained from
the tubing performance method (Cullender & Smith) described above. Then the
corresponding reservoir pressure at that flowrate can be computed from the IPR equation
shown in Equation 2.2-4.
A point worthy of note is that as the reservoir pressure of gas field declines due to
depletion, the IPR curve reduces and shifts downward, resulting in a decline in well

19
deliverability. The well deliverability can also change due to a shift in the TPR curve
resulting from a change in wellhead pressure. This behavior can also be observed in
Figure 2.2-4 where the intersections of both the multiple inflow performance curves and
the tubing (outflow) performance curves identify the production (flow) rates for declining
reservoir pressures at a given tubing size and two tubing head pressures.

Figure 2.2-4: IPR curves showing reservoir depletion effects over time

The importance of predicting the performance of a natural gas field in terms of its
production over time cannot be overemphasized. Just as it is essential for natural gas
producing companies to estimate the value of their proven reserves to determine its
worth, it is equally vital to reliably predict reservoir performance to be able to forecast

20
future production. This also helps the producing company to project cash flows and make
reliable economic decisions.
For a good prediction of reservoir performance to be made, one needs to have the
necessary and relevant information including reservoir properties, tubing properties and
fluid properties. Other parameters that need to be known beforehand include the
abandonment pressure or flowrate and the maximum flowrate allowed which may be
restricted by the surface network and/or stipulated by the contract terms. The maximum
flowrate should be one that effectively maximizes the profit for the developer while
satisfying the constraints imposed by the surface facilities and equipments such as
flowlines, compressors, pipelines, etc.
Typically, before production from a gas field can commence, there should be a
commercial market ready to accept the gas. This can be done in form of a gas sales
contract. Thus, the basic factors required to determine the optimum development plan of
the field will have to be known from the outset. This creates significant improbabilities
since these factors cannot be accurately ascertained before the field is actually developed
and the field is put on production. Such uncertainties produce a risk which is put into
consideration when an analysis of the plan is done. The use of artificial neural network is
increasingly becoming a means of mitigating some of the risks and uncertainties involved
in the analyses of field development projects.

21
2.3 Optimization of the Field Development
The objective of any gas field developer is to maximize profit. This can usually be
achieved by efficiently managing the development of the field such that its production is
optimized and costs are minimized. In order to optimize production, wells will have to be
drilled, however there comes a time where the production that will be obtained from
drilling an additional well does not justify such drilling in terms of the cost of drilling the
well. Gas field development costs can be capital expenses or operating expenses. The
majority of capital expenses are incurred at the beginning of the project and may include
the cost of wells, flowlines, surface equipment and pipelines. Operating expenses include
expenses incurred throughout the life of the field. These include preventive and
maintenance costs, monitoring costs and labor. This distinction is particularly important
during the optimization of any gas field development because of the time value of money.
Where possible, it may be more cost-efficient to defer expenses to the future as the
monetary value decreases. This is more easily done with operating expenses.
There are two main limitations in the eventual deliverability of a gas field. Firstly,
the gas delivery should be done in such amount that there is sufficient market for the gas
so it is fully utilized. This is because the gas is usually transferred directly to the market
by means of pipelines; hence the market must be ready to receive the gas as it is produced
from the field. This situation usually limits the amount of gas that can be produced from
the field. Secondly, the operating conditions on ground such as the ability to drill wells
and construct field and transport facilities may also be a limiting factor in the amount of
gas that can eventually be delivered to the market. This may impose a limitation on the

22
production rate at which the buildup stage of the field development can occur. Finally,
limitations may also exist due to purely economic and financial reasons. Irrespective of
the initial two limiting factors described above, it is very important to incorporate
economics in deciding the optimum rate at which to produce the field since the objective
of gas field development is to generate maximum profit. This economic optimum
production is what this study seeks to identify and this will be the basis of the artificial
neural network implementation.
To realize a strategy that optimizes delivery based on the economic constraint but
that ignores the market limitations, van Dam (1968) states that an economic scheme
needs to be implemented and this can be done by first employing a random production
model that can be built upon to yield a more efficient and optimized delivery strategy.
van Dam (1968) further states that that random model should be made up of three
different stages of production that include a buildup of production, a time of constant
production, and the final stage which is one of a steady reduction in production. The
production model and optimization process presented in this study will focus mainly with
the second and third stages of production.
The first stage of van Dams proposed model will be a period of drilling new
wells which will lead to an increase in production accordingly. The second stage involves
a stoppage of drilling activities so that the production is maintained at a constant rate.
This continues until the production starts to decline which leads to the third stage. A point
worthy of note is that the second stage may be extended by drilling additional wells to
maintain the total output of the reservoir without lowering the minimum tubing head

23
pressure (Pwh_min) of the well. At some point afterwards, when the drilling of additional
wells becomes uneconomical and impractical, the minimum tubing head pressure may
have to be reduced and eventually compressors installed (van Dam, 1968). In some
instances though, it may be more desirable or efficient to drill additional wells, after first
reducing the minimum tubing head pressure and installing compressors; and before the
third stage when the reduction in production starts to take effect (van Dam, 1968). This
part of the process involving the reduction of minimum tubing head pressure and
installation of compressors will not be covered in the study however.
The purpose for the optimization procedure that this study seeks to implement is
to identify the number of wells for the field that maximizes profitability. Initially, as more
wells are drilled, the field production or deliverability increases thereby increasing the
revenue and consequently, profit generated from gas production. This continues to a point
where the additional revenue generated from the incremental field production is less than
the cost associated with drilling a new well and hence, cannot justify doing so. At this
point, the net present value (NPV) of the field has been maximized. van Dam (1968)
corroborated this by stating that this optimum production rate of a gas field will be
reached if any further increase in the production rate by increasing the number of wells
will no longer contribute to an increase in present value profit.

24
2.4 Artificial Neural Networks
An artificial neural network (ANN) is a mathematical model or computational
model that tries to simulate the structure and/or functional aspects of biological neural
networks. It consists of an interconnected group of artificial neurons and it processes
information using a connectionist approach to computation. In most cases, an ANN is an
adaptive system that changes its structure based on external or internal information that
flows through the network during the learning phase. In more practical terms neural
networks are non-linear statistical data modeling tools. They can be used to model
complex relationships between inputs and outputs or to find patterns in data.
ANN can also be viewed as a machine that is designed to model the way in which
the brain performs a particular task or function of interest. There have been several
definitions of ANN (Haykin, 1994). However, a widely accepted term is that adopted by
Alexander and Morton (1990) who defines a neural network as a massively parallel
distributed processor that has a natural propensity for storing experiential knowledge and
making it available for use.
Neural networks, in general terms, are input-output mapping models that can be
used to attack complex or non-straightforward problems. Neural networks are particularly
useful in cases where mathematical or statistical methods, such as linear, nonlinear
regression, curve fitting, etc., cannot provide a satisfactory solution. Neural networks use
a model that imitates the human brain, both structurally and computationally. They
consist of interconnected neurons that might have several layers of input, and hidden
output working sequentially and in parallel. When an input pattern is introduced to the

25
neural network, the synaptic weights between the neurons are stimulated and these
signals propagate through layers and an output pattern is formed. Depending on how
close the formed output pattern is to the expected output pattern, the weights between the
layers and the neurons are modified in such a way that the next time the same input
pattern is introduced; the neural network will provide an output pattern that will be closer
to the expected response. In that sense, the neural network is a system that will learn from
examples or from its own mistakes, just like how a human is expected to behave.
There are several types of artificial neural networks. However, the most
commonly used ones are the feed-forward neural networks FNNs, (Scalabrin, Marchi,
Bettio, and Richon, 2006) which are designed with one input layer, one output layer and
hidden layers. The number of neurons in the input and output layers equals to the number
of inputs and outputs physical quantities, respectively. The principal disadvantage of
FNNs is the difficulty in determining the ideal number of neurons in the hidden layer(s).
Also few neurons produce a network with low precision and a higher number leads to
over-fitting and bad quality of interpolation and extrapolation. The use of techniques such
as Bayesian regularization, together with a Levenberg-Marquardt algorithm, can help
overcome this problem (Marquardt, 1963).

Features of Artificial Neural Network


Neural networks have the following important features (Marquardt, 1963):
1. They respond with high speed to input signals.
2. They have generalized mapping capabilities.

26
3. They filter noise from data.
4. They can perform classification as well as function modeling.
5. They can encode information by regression or iterative supervised learning.
In spite of these important features, they also have some drawbacks; some of which are:
1. They are data intensive.
2. Training is computationally intensive and may require significant elapsed time.
3. Predictions are unreliable if extrapolated beyond the boundaries of the training
data.
4. They have a tendency to over-train if the network topology is not optimized,
resulting in their mapping training data extremely well but becoming unreliable in
dealing with new data.

Structure of Artificial Neural Network


The basic building block of all biological brains is a nerve cell, or a neuron, with
each neuron acting as a simplified numerical processing unit. The brain is a formation of
billions of such biological processing units, all heavily interconnected and operating in
parallel. In the brain, each neuron takes several input values from other neurons, applies a
transfer function and sends its output on to the next layer of these neurons. These neurons
in turn send their output to the other layers of neurons in a cascading fashion. Similarly,
ANNs are usually formed from many hundreds or thousands of simple processing units,
connected in parallel and feeding forward in several layers. Using neural network
terminology, the strength of an interconnection is known as its weight (Mehta, Mehta,

27
Manjunath, and Ardil, 2006). Figure 2.4-1 shows the basic components of a neuron
including the nucleus, the synapse, the axon, the dendrites and the cell body.

Figure 2.4-1: Basic Components of a Neuron (From Mehta et al, 2006)

With the advent of cheaper computing systems, the interest in ANNs has
blossomed. The basic idea of the development of the neural network was to make
computers do things which a human being couldnt do easily. Therefore, ANN was
developed with the concept to simulate the human brain, and hence, its architecture can
be compared with that of the human brain.
The various sub structures of neural networks are presented hereunder:
Perceptron
The perceptron, is a basic neuron that was invented by Rosenblatt in 1962. It is a
single layer neuron that contains the adjustable weight and some threshold values. The
inputs are x0, x1, x2, x3,....xN and their corresponding weights are w0, w1, w2, w3,....wN as

28
shown in the Figure 2.4-2. The processor itself consists of weights, the summation
processor, and the adjustable threshold. This weight can be viewed of as the propensity
of the perceptron to fire, irrespective of its inputs (Mehta et al, 2006). This weight is
known as the bias terms (Simpson, 1992).

Figure 2.4-2: Basic Components of a Perceptron (From Mehta et al, 2006)

Neuron
A neuron (or cell or a unit) is an autonomous processing element. A neuron is
more like a computer. It receives information from other neurons, performs a relatively
simple processing of the combined information, and sends the results back to one or more
neurons. In most pictorial representations, neurons are generally shown in circles or

29
squares. Sometimes they are denoted by 1 2....N, where N is the total number of neurons
in the networks.
There has been a concerted effort made in the past century to create a model of a
neuron, with remarkable success. Neural connections are significantly fewer and similar
to the connections in the brains. The basic model of ANN is shown in Figure 2.4-3. It is a
combination of perceptrons which form the Artificial Neural Network.

Figure 2.4-3: Basic Model of ANN (From Mehta et al, 2006)

A layer is a collection of neurons that can be thought of as performing some


common functions. They are numbered by placing the numbers or letters beside each
neuron and it is believed that no two neurons are connected to another in the same layer.
All neuron nets have an input layer and an output to interface with the external

30
environment. Each input layer and each output layer has at least one neuron. Any neuron
that is not in an input layer or in an output layer is said to be in a hidden layer. Sometimes
the neurons in a hidden layer are called feature detectors because they respond to
particular features in the previous layer.

Synapses (arcs/links)
An arc or a synapse can be a one- or two-way communication link between two
cells as shown in Figure 2.4-1. A feed-forward network is one in which the information
flows from the input cells through hidden layers to the output neurons without any paths
whereby a neuron in a lower-numbered layer receives input from the neurons in a highnumbered layer. A recurrent network, by contrast, also permits communication in the
backward direction (Guo, Hill, and Wang, 2001).

Weights
A weight (generally denoted as wij) is a real number that indicates the influence
that a neuron n*i has on another neuron n*j. If positive weights indicate reinforcement,
and negative weights indicate inhibition, then a zero weight will indicate no direct
influence or connection exists. The weights are often combined into a matrix w. These
weights may be initialized and given as predefined values, or initialized as random
numbers, but they can also be altered by experience. It is in this way that the system
learns. Weights may be used to modify the input from any neuron. However, the neurons

31
in the input layer have no weights, and therefore, their external inputs are not modified
before the input layer.

Back Propagation
The field of neural networks can be said to be related to artificial intelligence,
machine learning, parallel processing, statistics, and other fields. They are best suited to
solving problems that are the most difficult to solve by traditional computational
methods. Figure 2.4-4 shows the structure of a neuron, where inputs from one or more
previous neurons are individually weighted, then summed.

Figure 2.4-4: Structure of a Neuron, where inputs from one or more previous
neurons are individually weighted, then summed (McCollum, 1998)

Since intelligence of the network exists in the values of the weights between
neurons, a method to adjust weights to solve a particular problem is thus required. It is in
such networks that the common learning algorithm called Back Propagation (BP)
becomes important. A BP network learns by example, therefore, it must be provided with

32
a set of input values and also fed known correct output values. These input-output
examples, models the network to act in a way in which it is expected to compute, and this
is where BP algorithm becomes important (McCollum, 1998).

Propagation Rule
A propagation rule is a network rule that applies to all the neurons and specifies
how outputs from cells are combined into an overall net input to neuron n*. The term
net, indicates this combination. The most common rule is the weighed sum rule
wherein, adding the products of the inputs and their corresponding weights forms the
sum:
net i = bi + wij * n*ij
where j takes on the appropriate indices corresponding to the numbers of the neurons
that sends information to the neurons ni. The term in j represents the inputs to neuron n*i,
from neuron n*j. If the weights are both positive and negative, then this sum can be
computed in two parts - Excitory and Inhibitory. The term bi represents a bias associated
with neuron n*i. Adding one or more special neuron(s) having a constant input of unity
often simulates these neuron biases (Mehta et al, 2006).

Training ANN as an Optimization Tool


Training a neural network is, in most cases, an exercise in numerical optimization
of a usually nonlinear function. Methods of nonlinear optimization have been studied and
there is huge literature on the subject in fields such as numerical analysis, operations

33
research, and statistical computing. There is no single best method for nonlinear
optimization. One needs to choose a method based on the characteristics of the problem
to be solved.
For functions with continuous second derivatives, three general types of
algorithms have been found to be effective for most practical purposes (Mohaghegh,
2000a):
1. For a small number of weights, stabilized Newton and Gauss-Newton algorithms,
including various Levenberg-Marquardt and trust-region algorithms are efficient.
2. For a moderate number of weights, various quasi-Newton algorithms are efficient.
3. For a large number of weights, various conjugate-gradient algorithms are
efficient.
All of the above methods find local optima (Mohaghegh, 2000b). For global
optimization, there are a variety of approaches. One can simply run any of the local
optimization methods from numerous random starting points, or one can try more
complicated methods designed for global optimization such as simulated annealing or
genetic algorithms.
A fully trained ANN is effectively a nonlinear map between specified variables
that is capable of filtering noise in the input data and has a predictive capacity; i.e., it is
capable of making predictions for situations not previously encountered. The procedures
for optimizing ANN use goodness-of-fit criteria based on minimum residual prediction
errors for test data (Mohaghegh, 2000b). It should be noted that one of the greatest

34
advantages of neural networks is that they do not break down once they face new
environments. They degrade gracefully (Mohaghegh, 2000a).
Perhaps the greatest advantage of ANNs is their ability to be used as an arbitrary
function approximation mechanism which 'learns' from observed data. However, using
them is not so straightforward and a relatively good understanding of the underlying
theory is essential. When correctly implemented, ANNs can be used naturally in large
dataset applications. Their simple implementation and the existence of mostly local
dependencies exhibited in the structure allows for fast, parallel execution. The utility of
artificial neural network models lies in the fact that they can be used to infer a function
from observations. This is particularly useful in applications where the complexity of the
data or task makes the design of such a function by hand impractical. Optimizing the
development of a natural gas field is one of such tasks and the fifth chapter of this work
will show how ANN can be used to carry out this task with a view to determining the
optimum production scenario. ANN will be used to plan and design an optimum
development scenario for natural gas fields that will not only provide an efficient
production pattern but will also satisfy economic considerations. The goal is to determine
the optimum number of wells for the gas field that will produce the maximum net present
value profit.
2.5 Artificial Neural Networks in Petroleum Engineering
The recent development and success of applying artificial neural networks (ANN)
to solve complex engineering problems has drawn attention to its potential applications in
the petroleum industry. The use of artificial intelligence in petroleum industry can be

35
traced back to the last two decades (Mohaghegh and Ameri, 1995). Recently, ANN has
been applied in multiphase flow and it achieved promising results compared to the
conventional methods (correlations and mechanistic models). With regard to this field, a
few researchers applied ANN techniques to resolve some problems associated with
multiphase problems including pressure drop (Ternyik, Bilgesu, and Mohaghegh, 1995);
flow patterns identification (Osman and Aggour, 2002), liquid hold up (Shippen, and
Scott, 2002), and gas and liquid superficial velocities (Alexander and Morton, 1990).
ANN has been used in a wide variety of problems including prediction of hydrate
formation (Elgibaly and Elkamel, 1998).
ANNs have been criticized at times because they appear to work like black boxes
(Coveney, Fletcher, and Hughes, 1996). However, the substantial quantity of knowledge
they encode is available for more detailed examination and can be used effectively in its
own right. The use of ANN has continued to make in-roads in the oil and gas industry. In
a recent study, Mohaghegh, Hutchins and Sisk (2008) used ANN to develop a model with
which the foundation was built for a tool to maximize oil field production in Prudhoe
Bay, by optimizing the gas discharge rates and pressures at the separation facilities. The
ability to optimize the facilities in response to ambient temperature swings, compressor
failures or planned maintenance was a major business driver for this project. A state-ofthe-art genetic algorithm based optimization tool was developed based on the neural
network models. The goal of the optimization tool was to determine the gas discharge
rates and pressures at each separation facility that will maximize field oil rate at a given
ambient temperature, using curves of oil versus gas at each facility (based on GOR sorts).

36
The curves were developed by iteration with an earlier developed model of the surface
piping network from wellhead to gathering center/flowstation for Prudhoe Bay (Litvak,
Hutchins, Skinner, Wood, Darlow, and Kuest, 2002). It was identified that in order to
achieve this objective, the first step was to build a representative model of the entire gas
transit pipeline system. The neural network model had two main characteristics:
i.

The model accurately represented the complex dynamic system

ii.

The model provided fast results (close to real-time) once the required information
was presented.
The trained model was extensively tested and verified using 30% of the data that

was not used during the training process. The results showed good accuracy in
reproducing the actual rates and pressures at the separation facilities and at the gas
compression plant. The correlation coefficient for rate and pressure were 0.997 and 0.998
respectively.
Studies have been conducted for determination of flow parameters for two-phase
flow through horizontal circular pipes using ANN. Ternyik et al. (1995) explored
application of neural networks in predicting the flow pattern and liquid holdup on the
basis of experimental data collected by Mukherjee (1979). Osman (2004) conducted a
study on identification of flow regimes and liquid holdup for horizontal two-phase flow
using ANN. He used the experimental data obtained by Minami and Brill (1987) and
Abdul-Majeed (1996). He applied a three-layer back-propagation technique and obtained
promising results. Finally, Shippen and Scott (2004) conducted a study on liquid holdup
prediction using artificial neural networks. They also used back-propagation technique

37
for training the network. Their network estimated the liquid holdup with a reasonable
accuracy.
In their work, Ayala and Ertekin (2005) analyzed gas cycling performance in gas
condensate reservoirs, using neuro-simulation. The research, which was aimed at
demonstrating the applicability of ANN to the study of pressure maintenance operations
in gas condensate reservoirs, developed a gas-cycling performance predictor for
production operations in gas/condensate reservoirs using a back-propagation algorithm.
Ayala and Ertekin (2005) advocated that the proposed tool can be used to establish
guidelines to optimize a gas cycling strategy at a much more reasonable computational
cost. Analysis of the performance of the model showed an excellent agreement with the
prediction of compositional simulators, based on results of all cross-plots and absolute
error analysis. Case studies from their work also indicate that neuro-simulation has the
potential to improve the capabilities of reservoir engineers to design optimum production
schemes to be used in the exploitation of gas/condensate fields.
Additional works implementing artificial neural networks for optimization
purposes at The Pennsylvania State University were performed by Al-Farhan and Ayala
(2006), and Mann and Ayala (2009). The former used ANN to predict the optimum
middle stage separation for a collection of hydrocarbon mixtures while the latter applied
ANN in optimizing the design of natural gas storage facilities.
A very obvious deduction that can be made from the literature is that any credible
optimization process may have to examine hundreds and sometimes thousands of
realizations in order to achieve the global optimum values it is searching for. Therefore,

38
both the accuracy and speed of providing the results are very important in the success of
any ANN development. Neural network models have the capability of providing almost
instantaneous results upon representation of the input data. Therefore, no matter how
complex the problem is, once, and if, an accurate model is built, calibrated and verified, it
can serve as the ideal objective function for any optimization routine (Mohaghegh et al.,
2008).

39
Chapter 3

Problem Statement

Global demand for natural gas is growing faster than it is for any other fossil fuel
and several factors will continue to affect long-term natural gas demand. According to
recent Energy Information Agency statistics (EIA, 2009), the world has approximately
6,254 trillion cubic feet (Tcf) of proven gas reserves. At 2009 production rates, this
represents approximately a 50-year supply. But while the volumes are huge, many new
reserves are situated further from major consumer markets. To ensure that supplies to
major markets go on uninterrupted requires new developments in production and
infrastructure. This therefore necessitates the requirement to come up with modern means
of ensuring that both new and existing natural gas field development and production can
be carried out in a technically sound and cost-effective way. These new methods must
have the capability to minimize risk, maximize reservoir deliverability, reduce cycle
time/costs and deliver technical innovations that extend field development and increase
the recovery from natural gas resources. The use of Artificial Neural Networks as a tool
in tackling some of these challenges is increasingly gaining plausibility in the oil and gas
industry.
In the light of the foregoing, the objective of this study is to demonstrate how
Artificial Neural Networks can be utilized to optimally design and develop a natural gas
field based on reliable predictions of natural gas reservoir performance. The ultimate

40
goal, therefore, is to provide an analytical method to help operators maximize the amount
of hydrocarbons they are able to produce for each dollar they spendwhile maximizing
total recovery and increasing overall production. The study incorporates the cost of wells,
deferment rate over time, price of gas and other reservoir and well properties.
When correctly implemented, ANNs can be used naturally in large dataset
applications. Their simple implementation and the existence of mostly local dependencies
exhibited in the structure allows for fast, parallel execution. The utility of artificial neural
network models lies in the fact that they can be used to infer a function from
observations. This is particularly useful in applications where the complexity of the data
or task makes the design of such a function by hand impractical. Optimizing the
development of a natural gas field is one of such tasks and this work will show how ANN
can be used to carry out this task with a view to determining the optimum production
scenario. ANN will be used to plan and design an optimum development scenario for
natural gas fields that will not only provide an efficient production pattern but will also
satisfy economic considerations. The goal is to determine the optimum number of wells
for the gas field that will produce the maximum net present value of cash flows.

41
Chapter 4

Natural Gas Field Development


4.1 Reservoir Performance Prediction
Reservoir Performance Prediction is a very vital component of any gas field
development plan. As stated earlier, just as it is essential for natural gas producing
companies to estimate the value of their proven reserves in order to determine worth, the
ability to reliably predict reservoir performance is necessary in order to make good
production forecasts. These forecasts can be done based on the expected production cycle
of the field.
As shown in Figure 2.1, the typical production cycle of a natural gas field
involves a period of buildup where production is continuously increased by drilling wells,
a period of constant rate or production plateau, and a period of production decline. The
decline in production continues to a point where it becomes uneconomic to continue
production. At this point, production ceases and this is referred to as the abandonment
condition. The time and incremental production involved in the buildup stage is driven
mainly by the developers financial and operational ability to drill wells and install other
equipments required for production and transportation of the gas; hence in this study,
reservoir performance prediction and optimization will be based on the constant-rate
(production plateau) and declining-rate stages of production.
This study presents an additional parameter, the plateau recovery factor, RFpl,
defined as the desired recovery factor of the field at the end of the production plateau.

42
This parameter has to be defined for the gas field in consideration and it represents the
cumulative gas produced at the end of the production plateau, Gp|tp as shown in Equation
4.1-1.
Gp|tp = RFpl * OGIP

Equation 4.1-1

The desirable RFpl is usually dictated by market considerations; once this is established,
the amount of gas to be produced by the end of the production plateau can be computed
and the field production rate of the plateau (Qfieldpl) subsequently determined. The rate for
each well during the plateau, Qwellpl can then be obtained by dividing Qfieldpl by the
number of wells (Nw) in the field. This study assumes that all wells in the field are
identical, produce at the same rate, and do not interfere with each other.
The performance prediction process is used to determine the relationship between
flowrate over time from the beginning of the production plateau until abandonment is
reached. In addition, it can show the relationship between cumulative gas production over
time; and also, the change in reservoir pressure and bottom hole flowing pressure over
time which may be helpful in further analysis of the field. Flow rate vs. time and
cumulative gas production vs. time curves can be generated from the performance
prediction. The recovery factor, being the amount of cumulative gas produced as a
fraction of the OGIP can also be predicted by the performance prediction process for any
time in the future productive life of the field. Figures 4.1-1a and 4.1-1b show the typical
behavior of field production rate, Qfield and cumulative gas production, Gp as functions of
time respectively.

43

Figure 4.1-1a: Production rate, Qfield as a function of time

Typically, at the start of the production plateau, the reservoir has the capability to
deliver the gas to each well at a rate higher than the well production rate Qwellpl that is
specified by the desired RFpl. The constant rate is maintained at the surface by the choke
which controls the wellhead pressure (Pwh) on each well. The field is produced at this
constant rate until such a time (tp) that the reservoir is depleted and the reservoir pressure
has declined to a point where it cannot sustain this rate. This point is identified as RFpl in
Figure 4.1-1a. After this point, if no compressors are installed or additional wells drilled,
the field production rate declines continuously until abandonment point is reached.

44

4.1-1b: Cumulative production, Gp as a function of time

Figure 4.1-1b shows the typical plot for the cumulative gas produced for a natural
gas field and corresponds to the production rate plot shown in Figure 4.1-1a. This plot
shows a linear relationship between Gp and time t, from the start to the end of the
production plateau at tp; this linearity occurs due to the rate of production being constant
during the plateau. As the flow rate decreases over time after the plateau, the increase in
Gp (Gp) reduces over time and this is reflected in the curved shape of the plot after tp.
The Gp vs. t plots allows for the recovery factor of the field to be calculated at any time
during production since this can be obtained by simply dividing the Gp at that time by the
OGIP of the field. Recovery factor computations provide gas field developers with a tool

45
for field analysis and also provide a means to compare performance of fields with
different OGIPs.

4.1-1c: Pressure drawdown as a function of time, t.

The typical natural gas field pressure-drawdown plot in Figure 4.1-1c shows the
relationship between the reservoir pressure, Pr and the wellhead pressure, Pwh as the
reservoir is depleted from the onset of the production plateau to field abandonment. As
mentioned earlier, during the plateau, production at each well is maintained at a constant
rate (Qwellpl) by controlling the wellhead pressure with a device called the choke. This
constant rate of production during the plateau occurs at a result of the constant pressure
drawdown between the reservoir pressure and the wellhead pressure. As reservoir

46
pressure, Pr decreases due to depletion, the wellhead pressure, Pwh at each well has to be
subsequently reduced to maintain the constant drawdown, and in turn the constant rate of
production. When the wellhead pressure Pwh has been reduced to its allowable minimum
at tp and cannot be lowered further, subsequent decreases in Pr cause a lesser drawdown
between Pr and Pwh, which result in a decline in well flowrate Qwell and subsequently field
rate Qfield. The allowable minimum wellhead pressure, Pwh_min is usually dictated by the
pressure in flowlines, other surface equipments and pipelines. The use of compressors
allows for the wellhead pressure to be lowered beyond this allowable minimum but this is
not covered in this study.
To demonstrate the procedure for calculating reservoir performance, a
hypothetical gas field will be used as a base case for illustration purposes and this will be
done for the constant rate and declining rate periods. Generally, one has to be able predict
performance based on field properties before an optimization strategy can be
implemented. The procedure and outcome of the performance prediction will be used to
obtain the necessary parameters that will be used in the optimization stage of this study.
The performance prediction procedure will be illustrated given the information
about the hypothetical natural gas field shown in Table 4.1-1 and a generalized form of
the procedure will be programmed into a MATLAB subroutine to automate the process
(see Appendix A.6). The subroutine will be able to predict the reservoir performance in
terms of the flowrate over time for any combination of reservoir, well and fluid
properties. For the purpose of this study, the amount of gas produced during the buildup
stage is not considered significant and will be ignored in the computations. However, if

47
this information is given, the proposed protocol can be easily modified to account for this
without any reduction in the generality or applicability of the procedure.

Table 4.1-1: Reservoir, well and fluid properties for hypothetical gas field
Number of wells (Nw)

Original Gas In Place (OGIP)

100 Bscf

Initial Reservoir Pressure (Pi)

3000 psia

Reservoir Temperature (Tr)

630oR (170oF)

Well performance coefficient (Cwell)

0.412 mscfd/psi2n

Back pressure exponent (n)

0.633

Minimum wellhead pressure (Pwh_min)

400 psia

Tubing inner diameter (ID)

2.5 inches

Well depth

5000 ft

End-of-plateau recovery factor (RFpl)

50%

Wellhead temperature (Twh)

530oR (70oF)

Gas Specific Gravity (g)

0.60

Abandonment field rate (Qa)

400 mscfd

The information given shows that two wells are desired to be produced in the field
for a constant rate until a total of 50% of the original gas in place has been recovered
(RFpl = 50%), at which point the production rate will start to decline. The objective is to

48
predict the performance of the reservoir until it reaches abandonment conditions
estimated to occur when the field production rate drops to 400 mscfd.
The properties required for the determination of the inflow performance such as
the well performance coefficient Cwell, and the back pressure exponent n, are given for the
hypothetical gas field. Hence, an inflow performance curve can be generated using the
inflow performance equation shown in Equation 2.2-4. Likewise, the fluid and well
tubing properties such as the specific gravity of gas, tubing inner diameter, well depth,
and wellhead temperature required for the determination of the tubing (outflow)
performance are also given. The tubing performance curve for the hypothetical gas field
has been generated using the Cullender and Smith method by implementing the
procedure in a MATLAB subroutine, CullSmith (Appendix A.3). The resulting IPR curve
at initial reservoir pressure (Pi = 3000 psia), and the TPR curve at minimum wellhead
pressure (Pwh_min = 400 psia) are displayed in Figure 4.1-2 and Figure 4.1-3 respectively.

49
Well flowing pressure, P wf vs. Well flow rate, Qwell

Well flowing bottom hole pressure, Pwf (psia)

3000

2500
IPR @ P i = 3000 psia
2000

1500

1000

500

4
6
8
Well flow rate, Qwell (mmscfd)

10

12

Figure 4.1-2: IPR curve at initial reservoir pressure, Pi for hypothetical gas field

50
Well flowing pressure, Pw f vs. Well flow rate, Qw ell

1100

Well flowing bottom hole pressure, P

wf

(psia)

1000

900
TPR @ P wh = 400 psia
800

700

600

500

400

Well flow rate, Qw ell (mmscfd)

10

12

Figure 4.1-3: TPR curve at minimum wellhead pressure, Pwh_min for hypothetical
gas field

For the performance prediction process, compressibility (Z) factor calculations are
needed. Several methods exist to determine the compressibility factor of fluids, but for
natural gases, the Standing-Katz Chart (1942) has a wide applicability. Several semiempirical methods have been proposed to correlate the Standing-Katz Chart into
computer programmable equations. These methods include Sarems method (1961), HallYarboroughs method (1974), Brill and Beggs method (1974), DranchukAbou
Kassems method (1975) and Gopals method (1977). Standing compared most of these

51
methods and showed that the DranchukAbouKassem method had shown the smallest
absolute error among them; hence this will be the method of choice in Z-factor
calculations for this study (Appendix A.8). The Z-factor calculation requires the value of
the pseudo-critical pressure, Ppr and the pseudo-critical temperature, Tpr of the fluid.
Equations for computing these parameters are given by Lee and Wattenbarger (1996) and
are shown below:
Ppr = 756.8 131*g 3.6*g2

Equation 4.1-2

Tpr = 169.2 + 349.5*g 74*g2

Equation 4.1-3

where g is the specific gravity of the gas.


There are several steps involved in the prediction of reservoir performance. These
are highlighted hereunder.
The first step is to determine pressure at the end of the production plateau, Pr|tp.
This is done using the material balance equation described in Chapter 2 which can be
rearranged to yield the following equation that defines Pr|tp:

Pr |tp

P
= i
Z |tp Z i

(1 RF pl )

Equation 4.1-4

where Z|tp is the compressibility factor of the gas at Pr|tp, and Zi is the compressibility
factor at Pi. The subroutine, Zfactor (Appendix A.8) has been implemented to compute
the compressibility factor at Pi for this hypothetical gas field as Zi = 0.8988. From
equation 4.1-4, the value of the left hand side of the equation, Pr|tp / Z|tp is equal to 1669
psia. Since Z|tp is itself dependent on Pr|tp and cannot be computed independently, the

52
determination of Pr|tp requires an iterative procedure. A MATLAB subroutine
Bisection_Pz, shown in Appendix A.2 that utilizes the bisection method as the iterative
procedure has been implemented to compute the value of Pr|tp. This value is determined
to be Pr|tp = 1511 psia.
Having computed the pressure at the end of the production plateau, the flow rate
of each well during the production plateau, Qwellpl will have to be determined. This flow
rate corresponds to the intersection point of the inflow performance curve at Pr|tp = 1511
psia and the outflow performance curve at Pwh_min = 400 psia, or the operating point of
both curves as described in Chapter 2. The bisection method has been programmed into a
MATLAB subroutine called Bisection (Appendix A.1), and has been implemented to
numerically solve for Qwellpl. This subroutine takes the relevant reservoir, tubing and fluid
properties as input parameters, solves for the flow rate (Qwellpl) and bottom-hole pressure
at time tp (Pwf|tp) and outputs the same. The solution gives values of rate Qwellpl = 3.99
mmscfd and bottom-hole pressure Pwf|tp = 550 psia. This bottom-hole pressure
corresponds to the minimum pressure that is required at the bottom of the well to
overcome flow inhibiting forces to produce the flowrate of Qwellpl = 3.99 mmscfd to a
wellhead that has a minimum pressure of Pwh_min = 400 psia.
The graphical representation of the inflow and tubing performance curves is
displayed in Figure 4.1-4 below, which shows the TPR curve at minimum wellhead
pressure Pwh = 400 psia, and IPR curves at initial reservoir pressure Pi = 3000 psia, and
end-of-plateau reservoir pressure Pr|tp = 1511 psia. The bottom-hole pressure at the end of
the production plateau, Pwf|tp as observed, is below the bottom-hole pressure at initial

53
reservoir pressure when there is maximum flowrate capability from the reservoir. The
reservoir has the capability to produce each well at a rate of Qwell = 9.78 mmscfd at its
initial pressure, Pi and this corresponds to a bottom-hole pressure of Pwf = 913 psia. The
difference in Pwf at Pi and at Pr|tp occurs as a result of the drop in reservoir pressure as the
reservoir is depleted from initial conditions to the end of production plateau.

Well flowing bottom-hole pressure, P wf vs. Well flow rate, Qwell

Well flowing bottom-hole pressure, Pwf (psia)

3000

2500

IPR @ P i = 3000 psia

2000
IPR @ P r|tp = 1511 psia
1500
TPR @ P wh = 400 psia

1000

500

6
8
4
Well flow rate, Qwell (mmscfd)

10

Figure 4.1-4: IPR curves at Pi = 3000 psia and Pr|tp = 1511 psia

12

54
The next step is to compute the duration of the constant rate production, tp. This is
basically the cumulative production to date divided by the field production rate and is
calculated using Equation 4.1-4.

tp =

G p |tp
Qwellpl * N w

Equation 4.1-4

Gp|tp is computed from equation 4.1-1 as Gp|tp = RFpl * OGIP = 50 Bscf.


Substituting Gp|tp = 50 Bscf, Qwellpl = 3.99 mmscfd and Nw = 2 into Equation 4.1-4 gives a
time period of tp = 6267.2 days or tp = 17.2 years. This means that each of the wells will
produce the gas at a constant rate of 3.99 mmscfd for a period of 17.2 years, after which
the reservoir pressure will drop to a point where it is unable to sustain this rate.
Production rate will decline after this point. The computations for the declining rate
periods are presented next.
The procedure for the declining rate period is done in discrete intervals to make
the process more efficient and is initiated by applying values from the previous constant
rate analysis. The values to be applied are Pr|tp = 1511 psia, Gp|tp = 50 Bscf and Qfieldpl =
3.99 mmscfd/well * 2 wells = 7.98 mmscfd. There could be a variation in the approach to
the declining rate computations depending on whether the field abandonment condition is
defined by the field production rate or reservoir pressure. In this study, it is defined by the
field rate i.e. Qa = 400 mscfd.
Each interval is treated as a time step to determine the flowrate at the end of each
interval, its incremental gas produced and the time period of each interval. The lower the

55
value of Pr, the more the detail the prediction gives. In this case, an initial default value
of Pr = 100 psia has been selected. At the new decreased reservoir pressure Pr = 1411
psia, the compressibility factor Z at this new reservoir pressure is determined and the
quotient Pr/Z is computed. The Z-factor at Pr = 1411 psia is Z = 0.909, and its
corresponding Pr/Z value is Pr/Z = 1552 psia. The next step is to update the cumulative
gas produced (Gp) for the new reservoir pressure using the material balance method
shown in Equation 2.2-3. This gives a cumulative gas produced of Gp = 53.51 Bscf and
an incremental gas produced of Gp = 53.51 50 = 3.51 Bscf.
After computing the incremental gas produced during the interval, the intersection
point between the inflow performance at the updated reservoir pressure and the outflow
performance will have to be identified. This will be the gas rate at which both the inflow
and outflow produce at the same bottom-hole flowing pressure or the operating point as
described in Chapter Two. This gas rate corresponds to the well deliverability at the
given minimum wellhead pressure of Pwh_min = 400 psia. This can be done manually by
constructing both the inflow and outflow performance curves to find the intersection but
as stated earlier, a MATLAB subroutine, Bisection has been developed (Appendix A.1)
to automate this process to give the gas rate required. This gas rate is found to be Qwell =
3.63 mmscfd. Since there are 2 wells in the field, the field rate Qfield = 3.63 * 2 = 7.26
mmscfd. The average reservoir flowrate over the time period, Qfield_ave then has to be
calculated. This is calculated here using the geometric average of the flow rates and is
given as log Qfield_ave = (log Qfieldn-1 + log Qfieldn)/2, where n-1 is the previous time step
and n is the current time step. This gives a computation of log Qfield_ave = (log 7.98 + log

56
7.26)/2, and a value of Qfield_ave = 7.61 mmscfd. The time period for the interval (t) is
then calculated as the incremental gas produced (Gp) divided by the average flow rate
for the field (Qfield_ave) and is calculated as t = 3.51 Bscf / 7.61 mmscfd. This gives a
value for the time period t = 461.24 days or t = 1.26 years. This is the end of
computations for this time step.
The process is repeated for the next time step by reducing the reservoir pressure
by Pr = 100 and computing corresponding new values for the flow rates Qwell, Qfield and
Qfield_ave, incremental gas produced Gp, and time period, t. The value of the Qfield_ave at
the end of a time step is used as the initial value of Qfield for computations in the next time
step. As the computations for the declining reservoir pressures are done when
approaching the abandonment condition (Qa = 0.40 mmscfd), the Pr value may need to
be reduced. The iterations continue for subsequent time steps until abandonment
condition is reached. In this instance, the iteration is terminated when the computed field
production has declined to a value of 0.41 mmscfd, since further reducing the reservoir
pressure by 1 psia will yield a field rate lower than 0.40 mmscfd which was given as the
abandonment field rate for the problem. The results for the performance prediction of this
hypothetical field showing the outcome of the computations for declining-rate intervals
of Pr = 100 psia, Pr = 10 psia and Pr = 1 psia are presented in Table 4.1-2;
corresponding field production rate vs. time (Qfield vs. t), cumulative gas produced vs.
time (Gp vs. t), and pressure decline plots are shown in Figures 4.1-5, 4.1-6 and 4.1-7
respectively.

57
Table 4.1-2: Performance Predictions for hypothetical natural gas field
Reservoir Cum. Gas
Pressure, Production,
Pr (psia)
Gp (Bscf)
1511
50.00
1411
53.51
1311
57.00
1211
60.49
1111
63.95
1011
67.38
911
70.79
811
74.17
711
77.50
611
80.80
511
84.06
501
84.38
491
84.71
481
85.03
471
85.35
470
85.38
469
85.42
468
85.45
467
85.48
466
85.51
465
85.54
464
85.58
463
85.61

Incremental
Production,
Gp (Bscf)
50.00
3.51
3.50
3.48
3.46
3.44
3.41
3.37
3.34
3.30
3.26
0.32
0.32
0.32
0.32
0.03
0.03
0.03
0.03
0.03
0.03
0.03
0.03

Flowing
BHP, Pwf
(psia)
550
533
517
503
490
479
469
461
454
448
444
444
444
444
443
443
443
443
443
443
443
443
443

Field rate, Average


Time
Qfield
field rate Interval,
(mmscfd) (mmscfd) t (years)
7.98
7.98
17.2
7.26
7.61
1.26
6.55
7.06
1.36
5.85
6.43
1.48
5.16
5.76
1.65
4.47
5.07
1.86
4.38
2.13
3.79
3.10
3.69
2.51
2.41
2.98
3.07
1.70
2.25
4.01
0.91
1.43
6.25
0.81
1.08
0.82
0.88
1.01
0.72
0.62
0.74
1.20
0.51
0.61
1.45
0.49
0.55
0.16
0.51
0.17
0.48
0.47
0.49
0.18
0.46
0.47
0.19
0.45
0.46
0.19
0.45
0.20
0.43
0.42
0.43
0.20
0.41
0.42
0.21

Assumptions
It should be noted that some assumptions were made in the procedure for
predicting the performance of the gas field and these include:

Both wells have identical producing characteristics or properties.

The interference between wells is negligible to non-existent.

Well flowing bottom-hole temperature is equal to the reservoir temperature.

Constant skin factor applies during production.

58
Field rate, Qfield vs. Time, t

9
8

Field rate, Qfield (mmscfd)

7
6
5
4
3
2
1
0

10

15

30
25
20
Time, t (years)

35

40

45

50

Figure 4.1-5: Performance Prediction for hypothetical gas field showing field
production rate, Qfield over time

As expected, the performance of this field in terms of the field production rate
plot shows a behavior consistent with the typical production rate plot shown in Figure
4.1-1a. The knowledge of this behavior is very helpful to reservoir engineers in
understanding the impact that a change in reservoir, well, or fluid properties may have on
the future performance of a natural gas field. The cumulative gas produced plot and
pressure-drawdown plot shown next are also valuable in this regard.

59
Cumulative Gas produced, Gp vs. Time, t

90

Cumulative Gas produced, G


p (Bscf)

80
70
60
50
40
30
20
10
0

10

15

30
25
20
Time, t (years)

35

40

45

50

Figure 4.1-6: Performance Prediction for the hypothetical gas field


showing cumulative gas produced, Gp over time

It can be observed from Figure 4.1-6 that the final cumulative gas produced at
abandonment is approximately 85 Bscf. A more accurate value is given in Table 4.1-2 as
85.61 Bscf. Based on this information, the recovery factor at abandonment (RFa) for this
field can be calculated as RFa = 85.61 Bscf / 100 Bscf = 85.61%. This value represents
the percentage of recoverable gas from this field based on existing field properties and
abandonment condition.

60
Pressure Evolution over Time

3000
Pi

Reservoir
Pressure

Pressure (psia)

2500

2000
P wh|i

Wellhead
Pressure

1500

1000

500

10

15

25
30
20
Time, t (years)

35

40

45

50

Figure 4.1-7: Pressure drawdown of hypothetical gas field over time

4.2 Economic Considerations


The performance prediction plot shown in Figure 4.1-5 is for a given set of field
parameters, number of wells, and end-of-plateau recovery factor. A change in the number
of wells in the field however, will cause a corresponding shift in the plot in either an up,
down, right or left direction and this behavior is illustrated in Figure 4.2. This is because
a lower number of wells will deplete the reservoir slower resulting in a longer production
plateau and longer time to abandonment, while a higher number of wells will deplete the
reservoir faster and cause a shorter production plateau and less time to abandonment. The

61
impact of number of wells to be drilled on the field production life is very useful to a
natural gas developer because an economic balance needs to be made between the cost of
drilling wells and the revenue generated from drilling such wells. This information is
crucial in determining the optimum number of wells to drill in order to maximize profit.
Figure 4.2 shows how a change in the number of wells for the hypothetical gas field
given in Table 4.1 will cause a shift in its flow rate vs. time plot.

Flow rate, Qfield vs. Time, t

25

Nw = 6

Flow rate, Qfield (mmscfd)

20

15

Nw = 4

10
Nw = 2
5

10

15

20
30
25
Time, t (years)

35

40

45

50

Figure 4.2: Flow rate vs. time plots for hypothetical gas field based on
different number of wells.

62
Due to different production patterns occurring for drilling different number of
wells in the field, the economic value of future production for each of the three patterns
shown in Figure 4.2 will be different since each pattern has a different production plateau
and field life. The optimization process presented in this study will attempt to determine
the most profitable pattern of a gas field based on economic value. This economic value
of the field will be based primarily on the cost to drill each well and install associated
surface equipments, the revenue generated from selling the gas produced, and the time
value of money. This study assumes that the desired RFpl captures the ability of the
market to receive the gas and that all the gas produced from the field is able to be sold.
As stated in Chapter Two, expenses incurred in gas field development can be
capital or operating. For the purpose of this study, the costs incurred as a result of drilling
each well and costs incurred in installing surface equipments to support production from
that well will be considered capital expenses and be commingled as the Cost of well,
(Cw). On the other hand, other costs incurred during the productive life of the field such
as maintenance costs will be considered operating expenses and be included in the
computations for the annual revenue generated from gas sales.
The revenue from gas production for each year, RV is obtained as a product of the
total gas produced in the field for that year and the cash generated per unit of gas sold as
shown in Equation 4.2-1.
RV = Gp_yr * u

Equation 4.2-1

where Gp_yr is the annual field gas production (mmscf) and u the cash generated from
each cubic feet of gas sold ($/mscf).

63
The unit cash generated, u can be obtained using the following equations (van
Dam, 1968):
u = Sp Co R tx (Sp Co Cd R)

Equation 4.2-2

where:
Sp = Unit Selling price per mscf of gas ($/mscf)
Co = Unit operating costs per mscf of gas ($/mscf)
R = Unit Royalty per mscf of gas sold ($/mscf)
tx = Unit tax fraction
Cd = Unit cash allowance per mscf of gas sold ($/mscf)

Present Value Computations


In order to effectively make an economic analysis of any field development
pattern, the present value of revenue or cash flow from future production has to be
computed. The present value of future cash flows can be described as the discounted
value of those future cash flows to account for the time value of money. The concept of
present value allows for meaningful comparison of cash flows that occur at different
times in the future. The present value of revenues from total field production, (RV|PV) is
the sum of the discounted yearly revenues and is expressed in Equation 4.2-3.
RV|PV =

RV |t

t
t =1

t =t a

( 1 + r )

Equation 4.2-3

where RV|t represents the revenue from gas field production in year t, r represents
the deferment rate, t the year of production, and ta the final year of production.

64
van Dam (1968) states that the present value of a future cash flow can be
computed by multiplying it by a deferment factor and suggests that this deferment
factor can be obtained from tabulations at various interest rates. In this study however,
this deferment factor will be obtained from Equation 4.2-3. Hence, the deferment factor,
DF to be used on this study is defined in Equation 4.2-4:

DF = 1 / (1 + r)t

Equation 4.2-4

For a natural gas field model that assumes constant values for unit cash generated
and deferment rate over the life of the field, and ignores the compressor stage following
the constant rate period, the net present value (NPV) of gas field production can be
expressed as shown in Equation 4.2-5:

NPV = RV|PV (Nw * Cw)

Equation 4.2-5

where RV|PV is defined by Equation 4.2-3, and Cw represents the cost incurred from
drilling a well and constructing production facilities to transport the gas from well to
pipeline. A positive value for the NPV means a net present value profit, while a negative
value means a net present value loss. A gas field development project that has a positive
NPV can be termed to be economically feasible or profitable; however the objective of
any gas developer is to create maximum returns or profit from the gas field project. The
determination of this maximum NPV profit based on known field parameters is the main
focus of this study.

65
4.3 Optimization of Gas Field Development
As stated previously in Chapter 2, to generate revenue from a natural gas field,
wells will have to be drilled. It is expected that the revenue generated from sales of the
gas produced from the wells over the life of the field will offset the cost of the wells and
in turn yield profit. Since the objective of any gas field developer is to maximize profit,
just having a gas field development project that produces profit may not be an optimal
strategy since there may be an opportunity increase profit by drilling more wells.
Typically, at the initial stage of field development, as the number of wells (Nw) drilled is
increased, net present value of total field production (NPV) also increases. This continues
to a point where the cost of adding another well exceeds the incremental revenue that can
be generated from adding that well i.e. the addition of that well will yield a reduced net
present value for the field. It is therefore essential for the gas field developer that intends
to maximize returns from a natural gas field to know the number of wells that will yield
the maximum profit.
The objective of this optimization process is to determine the number of wells to
be drilled that would produce the maximum net present value under a combination of
given field and well properties i.e. the number of wells, Nw that satisfies the following
equation:
NPV
0
N w

Equation 4.3-1

where NPV is defined by Equation 4.2-5.


Since the optimization stage of the field development process is based mainly on
financial consideration, economic parameters such as cash generated from gas sold, cost

66
of drilling a well and installing facilities to transport the gas from that well to pipeline,
and the deferment rate over the life of the field will have to be known. In the real world,
these parameters are not always easy to accurately determine or predict, and additional
research is usually needed to determine adequately representative figures. However, in
order to focus on the optimization computations, this study assumes that the necessary
research has been done beforehand and presents assumed values of cash generated per
unit of gas sold (u), cost of well (Cw), and deferment rate (r) based on this premise.
For the optimization process, a procedure that predicts performance of the field
for a given number of wells (Nw) and desired RFpl is required. This procedure has been
shown in Chapter 4.1 and provides the field production rate (Qfield) and cumulative field
production (Gp) as a function of time. The field production per year can then determined
by numerical techniques such as interpolation. In this study, the MATLAB command,
interp1, has been employed to perform the interpolations and has been implemented in a
subroutine, NPV (Appendix A.4). With the cost of well, cash generated per unit of gas
sold, and the deferment rate given, and the gas production per year determined, Equation
4.2-5 is then applied to obtain the net present value of total gas field production. The
procedure for determining the net present value, involving the associated equations, has
also been programmed into the subroutine NPV to automate the process. This subroutine
takes the number of wells, field and economic parameters as its input and provides the
NPV as the output for the given number of wells (Nw).
The objective of the optimization process, as shown in Equation 4.3-1 is to
determine the number of wells to be drilled that will maximize profit; hence the number

67
of wells that satisfies this equation is not known beforehand. The optimization process is
initiated by calculating the NPV for the field production based on drilling one well (Nw =
1). This is then compared to the NPV for drilling two wells (Nw = 2); if this NPV is
greater than the former, the process is then re-initiated by using the new number of wells
(Nw = 2) and comparing its NPV with the one for the next higher number of wells (Nw =
3). This process is repeated until such a time that the next higher number of wells gives a
lower NPV than the previous number of wells and satisfies the following equation:
NPVNw+1 NPVNw 0

Equation 4.3-4

where Nw is the number of wells under consideration and Nw+1 is the next higher
number of wells. When this equation is satisfied, the net present value has been
maximized and the optimum number of wells, Nw_opt has been determined. The result of
the computations is shown graphically in Figure 4.3-1 for the hypothetical gas field
properties given in Table 4.1 and economic parameters given in Table 4.3.

Table 4.3: Economic parameters for hypothetical gas field


Cash generated per unit gas sold, u

$4/mscf

Cost of well, Cw

$5,000,000 / well

Deferment rate, r

10%

68
Net Present Value, NPV vs. Number of Wells, Nw

Net Present Value, NPV ($millions)

200

150

Nw_opt = 12

NPV = $193.61million

100
ORIGINAL CASE STUDY (Nw = 2)

50

10

15

30
25
20
Number of wells, Nw

35

40

45

50

Figure 4.3: Optimization of the hypothetical gas field

As can be observed from Figure 4.3, the optimization plot shows that initially, as
the number of wells increases, the NPV also increases until twelve wells (Nw = 12) have
been drilled at which point the NPV starts to decline toward a NPV of zero. Drilling
wells beyond a zero-profit point will yield a negative net present value i.e. net present
value loss. Also, it should be noted that the number of wells from the initial case study
(Nw = 2) of the hypothetical field gives a positive net present value of NPV = $96.51
million but does not optimize profit since there is an opportunity to generate a higher net
present value of NPV = $193.61 million by drilling twelve wells (Nw_opt = 12) instead.

69
The procedure for the determining the Nw_opt and maximum NPV will be generalized for
typical North America natural gas fields using a realistic range of field parameters
presented in the next Chapter and will be automated in the MATLAB program code
Optimization. The application of artificial neural networks will be helpful in this regard
and this will be the focus of the work done in Chapter 5.

70
Chapter 5

Implementation of ANN Model


This chapter presents the expert ANN model that has been developed for the
optimization of gas field development, its optimized network architecture, and the
corresponding predictions. The ANN model was trained and tested with data sets
generated using the MATLAB random number generator along with the optimization
model discussed in the preceding chapter. The performance of the ANN model was
evaluated by comparing the actual output data generated through implementation of the
performance prediction procedure and optimization model to the predicted values
generated through the testing of the model.

5.1 Development of ANN Model


The ability of the developed ANN model to reliably predict, for a given
combination of field properties and economic parameters, the optimum number of wells
to be drilled that would yield the maximum net present value for a natural gas field will
be explored. The network is able to make this prediction based on the following
information:

Original gas in place (OGIP)

Initial reservoir pressure (Pi)

Well performance coefficient (Cwell)

71

Back pressure exponent (n)

Minimum wellhead pressure (Pwh_min)

Tubing inner diameter (ID)

Well depth

Cost of drilling a well and associated facilities

Cash generated per unit gas sold (u)

Deferment rate (r)

Desired RFpl

As stated in the previous chapter, the cash generated per unit of gas sold and deferment
rate will be assumed constant for the life of each field considered.

Evaluation of ANN Performance


The basis for evaluating the performance strength of the ANN model was the
percent error, since it depicts the accuracy of predicted values given by the ANN model
compared to the actual values generated by implementing the optimization model using
MATLAB subroutines. The percent error is computed as shown in Equation 5.1-1.

% error =

va v p
va

* 100%

Equation 5.1-1

where va is the actual value generated by the optimization model and vp is the value
predicted by the ANN network.

72
5.2 Generation of Data Sets
To be able to effectively and satisfactorily train and test the proposed neural
network, a broad set of training and testing data was created. Each data set consisted of
values for field properties and economic parameters (input variables) to be presented to
the network and corresponding values for the optimum number of wells and maximum
net present value (output variables). The MATLAB random number generator was
employed to randomly select input variables from realistic ranges of each reservoir, well,
fluid property and economic parameter presented. Using these properties and parameters
as input variables in the MATLAB m-file Optimization (Appendix A.5), the
corresponding output variables (Nw_opt and NPVmax) for each data set were obtained.
The initial reservoir pressure, Pi is one of the reservoir properties required in the
determination of reservoir performance and subsequent optimization. Generally, there
exists a correlation between the initial reservoir pressure and the depth of the reservoir for
a specific natural gas field. Therefore in order to avoid the random selection of an
atypical value of initial reservoir pressure for a selected well depth, this author has
decided to present a range for initial pressure gradient (PGi) instead as a replacement for
the initial reservoir pressure. The initial reservoir pressure can then be computed as a
direct function of the well depth as shown in Equation 5.2-1:
Pi = PGi * depth

Equation 5.2-1

The MATLAB random number generator can therefore randomly select values for initial
pressure gradient and well depth, and the initial reservoir pressure will be computed
within the subroutine NPV (Appendix A.4) and used in the necessary computations.

73
Similarly, this concept has been implemented to make the values for reservoir
temperature, Tr and cost of well, Cw functions of the well depth. Therefore, a geothermal
gradient of 0.02 oR/ft and cost per foot of well (Cw_ft) are used instead, and then the
reservoir temperature and cost of well can be computed within the subroutine NPV as
shown in Equations 5.2-2 and 5.2-3 respectively.

Tr = (0.02 * depth) + Twh

Equation 5.2-2

Cw = Cw_ft * depth

Equation 5.2-3

It is pertinent to add that in the computations for this study, gas gravity is assumed
to be constant, though initially varied between 0.50 and 0.70. This was done because
subsequent computations showed that its actual value had negligible effect on the output
variables. Consequently, the gas gravity was held constant at the value of 0.60. Similarly,
wellhead temperature is also assumed constant, and held at Twh = 530oF as this property
also had negligible effect on the output variables.
Table 5.2-1 presents the selected ranges of the input parameters that determine the
input variables that could be selected. Several uniformly spaced values were subsequently
chosen from each range and fed to the MATLAB random number generator for random
selection of possible input variables.

74
Table 5.2-1: ANN Input Ranges
Parameters

Minimum Value

Maximum Value

OGIP (Bscf)

500

5000

PGi (psi/ft)

0.3

0.6

Cwell (mscfd/psi2n)

0.5

2.5

0.5

Pwh_min (psia)

200

500

Tubing ID (in)

Well depth (ft)

4000

8000

Cost of well ($/ft)

100

1000

Unit Cash generated ($/mcf)

Deferment rate (%)

15

RFpl (%)

30

70

Training Data Sets


Twelve hundred distinct sets of variables were created at random from the
possible input values listed in Table 5.2-2 for the purpose of training the neural network.
The corresponding output values were then obtained by feeding these input data sets into
the m-file Optimization. The MATLAB Optimization Toolbox was employed in this mfile since each data set required the maximization of an objective function i.e. the net
present value (NPV) of the field. The MATLAB subroutine, NPV.m was programmed to
automatically compute the NPV based on a given number of wells. This subroutine was

75
linked to the m-file Optimization which provided to it the necessary input data in order
for the reservoir performance to be determined and subsequent net present value
obtained. Each optimization procedure was accomplished within the m-file by applying
the MATLAB Optimization Toolbox minimization solver fminbnd to the negative values
of the objective function since the solution for the minimum negative NPV is equal to the
solution for the maximum NPV. The Optimization Toolbox solver was designed to
determine the optimum number of wells to an accuracy of 10-10.

Table 5.2-2: Possible input values for ANN implementation


Parameters
OGIP (Bscf)

Possible values
500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000

PGi (psi/ft)

0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60

C (mscfd/psi2n)

0.5, 1.0, 1.5, 2.0, 2.5

0.5, 0.6, 0.7, 0.8, 0.9, 1.0

Pwh_min (psia)

200, 300, 400, 500,

Tubing ID (inches)

2.0, 3.0, 4.0, 5.0, 6.0,

Well depth (ft)

4000, 5000, 6000, 7000, 8000

Cost of well ($/ft)

100, 200, 300, 400, 500, 600, 700, 800, 900, 1000

Unit Cash ($/mscf)

2, 3, 4, 5, 6, 7, 8

Deferment rate (%)

5, 7.5, 10, 12.5, 15

RFpl (%)

30, 40, 50, 60, 70

76
Testing Data Sets
To be able to test the functional efficacy of the proposed network, two hundred
testing sets were created from the values shown in Table 5.2-2 and were also doublechecked to ensure that they were not duplicates of any data set presented during the
training of the network.

Sensitivity Analysis
The sensitivity of both output parameters (Nw_opt and NPVmax) of the optimization
model to each of the input variables is helpful in understanding the robustness of the
model in terms of identifying which source of uncertainty within the inputs weighs more
on the outcome of the model.
Sensitivity analysis for the optimization model involves varying each input
parameter one at a time between its minimum and maximum value while keeping other
input parameters at their mid-range values, applying the optimization model, and then
comparing the corresponding output values to the output values of a baseline set of midrange input values. This has been done using a tornado chart for both the Nw_opt and
NPVmax and is shown in Figures 5.2-1 and 5.2-2. The tornado chart shows that the back
pressure exponent, n is the most sensitive of all input parameters for Nw_opt and OGIP is
the most sensitive for NPVmax for the range of input parameters considered. This can be
explained by the back pressure exponent, n having an exponential influence on the
performance of the reservoir, and the OGIP determining how much gas can be produced;
hence both parameters having highest sensitivities to Nw_opt and NPVmax respectively.

77
Nw_opt 0

200

400

135

800
634

OGIP 28

283

Tubing ID

114

Cw_ft

122

Cwell
Unit cash

600

342
262

140
107

223
Low

183

Well depth

130

205

RFpl

135

208

PGi

133

Deferment rate

123

Pwh_min

144

High

196
171
169

Figure 5.2-1: Sensitivity Analysis for Nw_opt

NPVmax 0
$ million

5000

10000

15000

20000

OGIP 1830
Unit cash
n

18304
16436

3778
10197

6652

PGi

8985

Tubing ID

8811

10583
10267

Pwh_min

9349

10740

Deferment rate

9537

10692

Cw_ft

9698

10591

Well depth

9453

10298

RFpl

9684

10149

Cwell

9683

10132

Figure 5.2-2: Sensitivity Analysis for NPVmax

Low
High

78
5.3 Results of ANN Model
The training of the network architecture of the ANN model was done using a
heuristic approach. The training was initiated for a simple network that has only one
hidden layer with the same number of neurons as the input layer i.e. eleven neurons. This
network was then continuously updated by increasing the number of hidden layers and
neurons in each hidden layer until the network was optimized for proper prediction of the
output variables. The number of neurons in the input and output layers were dictated by
the number of input and output variables, respectively, hence these were not changed.
A schematic for the final optimized network architecture arrived at in this study is
shown in Figure 5.3-1. The proposed network comprises of three hidden layers with fifty,
forty, and thirty-five neurons in the first, second, and third hidden layers respectively.
The transfer functions used were the log-sigmoid (logsig), log-sigmoid (logsig),
hyperbolic tangent sigmoid (tansig), and linear (purelin) functions for the first, second,
third hidden layer and output layers respectively. A cascade-forward backpropagation
mechanism was incorporated into the network using the newcf function, and the network
was trained using the trainscg function, which updates the weight and bias values based
on the scaled conjugate gradient method. The learning function learngdm and network
performance function mse were also incorporated into the network architecture; learngdm
being the gradient descent with momentum weight and bias learning function, while mse
measures the performance of the network using the mean of squared errors.

79

Figure 5.3-1: Optimized Network Architecture

The optimized network architecture described above was obtained by numerous


modifications of the backpropagation network type, number of hidden layers, number of
neurons in each layer, and the type and sequence of transfer functions. The network was
retrained after each modification until a network architecture that yielded acceptable
training and testing results was obtained. For this network, each network training exercise
was set to terminate when any of the following conditions were met:

The specified mean-squared-error performance goal of 10-10 was reached.

The specified minimum performance gradient of 10-6 was reached.

The specified number of maximum iterations (50,000 epochs) was reached.

80
The development and training of the neural network architecture was done using
the ANN toolbox developed by MATLAB (see Appendix B). The results of the network
training and testing are shown in Figures 5.3-2 and 5.3-3.
The relevance of each input parameter is one of the main factors that affect the
outcome of the network and was also considered. This was done to determine the
influence each input parameter has on the performance of the network and ensure that
only relevant parameters are presented to the network. In this study, the relevancy Si of
each input parameter i was computed using the method proposed by Belue and Bauer
(1995) as shown in Equation 5.3-1.
n

Si = sij ,

Equation 5.3-1

j =1

where sij represents the weight relevance of input i on neuron j of the first hidden layer
and n is the number of neurons. The relevancy of each input parameter in the proposed
expert system created is shown in Figure 5.3-4.

81
Training Nwopt %Error

10
5

-5

-5

-10

400

600

800

1000

-10

1200

Training Nwopt %Error Histogram

1500

40

500

20
-5

Predicted values

1000

500

1000
1500
Actual Values

2000

50

100

150

200

Testing Nwopt %Error Histogram

0
-10

10

Training Nwopt Crossplot

2000

60

1000

0
-10

Predicted Values

200

Testing Nwopt %Error

10

-5

10

Testing Nwopt Crossplot

2000

1000

500

1000
1500
Actual Values

2000

Figure 5.3-2: ANN Results for Nw_opt

Figure 5.3-2 shows the training and testing performances of the proposed network
in predicting the required optimum number of wells. The plots show a strong
performance of the network as depicted by training errors of approximately 0% and a
testing error range of between -2% and 2% for all datasets presented.

82
Training NPVmax %Error

10
5

-5

-5

-10

200

400

600

800

1000

1200

Training NPVmax %Error Histogram

1500

Testing NPVmax %Error

10

-10

50

100

200

150

Testing NPVmax %Error Histogram

100

1000
50
500
0
-10

-5

x 10

Training NPVmax Crossplot

0.5

1
1.5
2
Actual Values

2.5

10

Testing NPVmax Crossplot

1
0

-5

x 10

0
-10

10

Predicted Values

Predicted Values

3
2
1
0

0.5

x 10

1.5
2
Actual Values

2.5

3
4

x 10

Figure 5.3-3: ANN Results for NPVmax

Figure 5.3-3 shows the training and testing performances of the proposed network
in predicting the maximum net present value of the field for each data set presented to the
network. These plots also show a strong performance of the network as depicted by
training errors of approximately 0% and a testing error range of between -2% and 2%.
However the histogram for the testing errors shows the network does a better job of
predicting the maximum net present values than it does for the optimum number of wells.

83
Input Relevancies (%)
RFpl
Deferment Rate
Unit Cash Generated
Cost of Well
Well Depth
Tubing ID
Pwh_min
n
Cwell
PGi
OGIP
0

6
Relevancy (%)

10

12

Figure 5.3-4: Relevancies of input parameters

As is shown in Figure 5.3-4, the input parameter that has the highest relevancy is
the back pressure exponent, n at 11.65%, the next highest being the original gas in place
at 10.88%. The range of relevancies between 6.93% and 11.65% shows that all the input
parameters are relatively relevant to the network and have a significant influence on the
outcome of the network. The percent error plots from the results and the relevancies of
the input parameters therefore show that the input parameters presented and the ANN
model developed is robust enough in predicting the optimum number of wells and the

84
maximum net present value of a natural gas field development project within the range of
properties considered.

85
Chapter 6

Conclusion and Recommendations


In the course of this study, an expert tool that utilizes artificial neural network
technology has been created and implemented. This tool has been shown to be capable
and robust enough in predicting the optimum development pattern for a natural gas field.
It is able to accomplish this by determining the optimum number of wells that will
produce the maximum net present value of the field. The artificial neural network that
was utilized was trained and tested using input data randomly generated by MATLAB
random number generator. The determination of the output values for the network was
initiated by first using the performance prediction procedure shown in Chapter Four, and
subsequently applying the optimization technique, also shown in Chapter Four to the
input data sets.
The proposed network is composed of eleven input neurons and two output
neurons connected by three hidden layers with fifty, forty and thirty-five neurons each.
The log-sigmoid, log-sigmoid, hyperbolic tangent sigmoid and linear functions were used
as the transfer functions, and the scaled conjugate gradient training algorithm was utilized
as the back propagation technique. The eleven input parameters are composed of
reservoir characteristics, well properties, and economic factors. The neural network has
been implemented in the optimization of field development for reservoir and well
properties in the following ranges:

OGIP (Bscf) [500, 5000]

86

PGi (psi/ft) [0.3, 0.6]

Cwell (mscfd/psi2n) [0.5, 2.5]

n [0.5, 1.0]

Pwh_min (psia) [200, 500]

Tubing ID (inches) [2.0, 6.0]

Well depth (ft) [4000, 8000]

RFpl (%) [30, 70]


Economic factors that were also considered in the development of the model and

their ranges include:

Cost per foot of well depth associated with drilling a well and installing surface
facilities to transport the gas from that well, Cw_ft ($/ft) [100, 1000]

Unit cash generated from gas sales, u ($/mscf) [2, 8]

Deferment rate, r (%) [5, 15]


Based on input parameters that are within the ranges given above, the network

that has been developed is able to predict the number of wells to be drilled that
maximizes the net present value of the field, and the maximum net present value of the
field. The predictions are made within a three percent error for each of the output
parameters. The eleven inputs also showed relevancies indicating considerable influence
on the network in predicting the output values. It can therefore be concluded that the use
of artificial neural network technology provides a reliable and robust mechanism in the
optimization of natural gas field development. The optimization and ANN models

87
described provide a framework for developing additional tools for more complicated gas
field development studies. The developed ANN tool can also be used effectively for
decision making purposes for determining the most favorable reservoir and well tubing
properties.

Further Studies
Research into the application of artificial neural network technology in petroleum
and natural gas engineering remains an ongoing process. While this study has resulted in
some very promising results, it is recommended that further studies be carried out with a
view to increasing the accuracy and broadness of the model. Recommendations for
further studies include:
1. Performing a history matching procedure based on historical field production in
order to correlate with performance prediction results.
2. Including computations for optimal spacing of wells as part of the optimization
model.
3. Utilizing a more robust field development calculation that includes the installation
of compressors to extend the constant rate stage of gas production.
4. Incorporating field production constraints such as variable skin factors, well
interference, well deterioration and repair; and developmental opportunities such
as stimulation, secondary and tertiary recovery operations.

88
5. Extending the ranges of the input variables to cover a wider range of properties of
natural gas fields around the world.
It is the authors belief that a properly trained network that considers these
additional criteria would not only provide a much more powerful tool, it will also provide
a tool that is more widely applicable.

89
Bibliography

Abdul-Majeed, G. H.: Liquid holdup in horizontal two-phase gas-liquid flow. Journal of


Petroleum Technology, May: 607617, 1996
Alexander. I. and Morton, H.: "An Introduction to Neural Computing," London,
Chapman & Hall, (1990).
Al-Farhan, F. and Ayala, L.: Optimization of Surface Separation Conditions for Natural
Gases Using Artificial Intelligence, Journal of Petroleum Science and
Engineering, v.53, p. 135-147, August 2006.
Ayala, L.F. and Ertekin, T.: Analysis of Gas-Cycling Performance in Gas/Condensate
Reservoirs Using Neuro-Simulation, Paper SPE 95655, presented at the 2005
Annual Technical Conference and Exhibition, held in Dallas, Texas, 9-12
October.
Belue, L.M. and K.W. Bauer: Determining Input Features for Multilayer Preceptrons,
Neurocomputing, v.7, no.2, p. 111-121, 1995.
Bloomfield, K. K. and Mines, G. L.: Predicting Future Performance from Reservoir
Management Cycling, Geothermal Resources Council Transactions, Vol 26,
September 22-25, 2002
Coveney, P. V., Fletcher, P., and Hughes, T. L.: Using Artificial Neural Networks to
Predict the Quality and Performance of Oil-Field Cements, AI Magazine
Volume 17 Number 4 (1996)

90
Dranchuk, P.M, and Abou-Kassem, J.H., Calculation of Z-factors for Natural Gases
Using Equations of State, Canadian Journal of Petroleum Technology, 14, p.3436 (July 1975)
Elgibaly, A.A. and Elkamel, A.M. (1998) A new correlation for predicting hydrate
formation conditions for various gas mixtures and inhibitors. Fluid Phase
Equilib., 152, 23-42.
Energy Information Administration (EIA) Report: International Energy Outlook 2009.
Guo, Y., Hill, D. J., and Wang, Y.: Global transient stability and voltage regulation for
power systems, IEEE Transactions on Power Systems, Vol.16, No. 4, pp. 678688, Nov. 2001.
Haykin, S.: "Neural Network: A Comprehensive Foundation," Macmillan Publishing
Company, NJ, Lehigh Press, (1994).
Ikoku, C.U.: Natural Gas Production Engineering, John Wiley & Sons, New York, NY,
1984.
Ikoku, C.U.: Natural Gas Reservoir Engineering, Krieger Publishing Company, Malabar,
FL, 1992.
Lee, J. and Wattenbarger, R. A,: Gas Reservoir Engineering, 1st Ed., Society of
Petroleum Engineers, Richardson, TX, 1996.
Levenberg K.: A Method for the Solution of Certain Problems in Least Squares, Quart.
Appl. Math., 2, 164-168, 1944

91
Litvak, M.L., Hutchins, L.A., Skinner, R.C., Wood, R.C., Darlow, B.L. and Kuest, L.J.
(2002) Prudhoe Bay e-field production optimization system based on integrated
reservoir and facility simulation, Paper SPE 77643 Presented at the 2002
Annual Technical Conference and Exhibition, San Antonio Texas, October.
Mann III, Austin W.: Intelligent Design of Natural Gas Storage Facilities M.Sc. Thesis,
The Pennsylvania State University, University Park, 2007.
Mann, A. and Ayala H., L.F., Intelligent Design of Natural Gas Underground Storage
Facilities, Int. J. of Modeling and Simulation, v. 129, n. 2, p. 214-223, 2009.
Marquardt, D: An Algorithm for Least-Squares Estimation of Nonlinear Parameters
SIAM J. Appl. Math., 11, 431-441, 1963
McCollum, P.: An Introduction to Back-Propagation Neural Networks, Encoder The
Newsletter of the Seattle Robotic Society, January, 1998.
Mehta, Axay J., Mehta, Hema A., Manjunath, T.C., and Ardil, C.: A Multi-layer
Artificial Neural Network Architecture Design for Load Forecasting in Power
Systems, International Journal of Applied Mathematics and Computer Sciences
Volume 4 Number 4, 2006
Minami, K., and Brill, J. P.: Liquid holdup in wet-gas pipelines SPE Production and
Facilities February, 3644, 1987
Mohaghegh, S.D. (2000a) Virtual intelligence applications in petroleum engineering:
Part 1; artificial neural networks, Journal of Petroleum Technology, September,
pp.6473.

92
Mohaghegh, S.D. (2000b) Virtual intelligence applications in petroleum engineering:
Part 2; evolutionary computing, Journal of Petroleum Technology, October,
pp.4046.
Mohaghegh, S. and Ameri, S.: Artificial Neural Network as A Valuable Tool for
Petroleum Engineers, Paper SPE 29220, Prepared as an Unsolicited Paper for
Society of Petroleum Engineers (1995).
Mohaghegh, S.D., Hutchins, L.A. and Sisk, C. (2008) Building the foundation for
Prudhoe Bay oil production optimization using neural networks, Int. J. Oil, Gas
and Coal Technology, Vol. 1, Nos. 1/2, pp.6580.
Mukherjee, H.: An experimental study of inclined two-phase flow, Ph.D. Dissertation,
Tulsa, Oklahoma: University of Tulsa, 1979
Osman, E.A., Ayoub, M.A., and Aggour, M.A.: Artificial Neural Network Model for
Predicting Bottomhole Flowing Pressure in Vertical Multiphase Flow, paper
presented at the 14th SPE Middle East Oil & Gas Show and Conference held in
Bahrain International Exhibition Centre, Bahrain, 1215 March 2005.
Osman, E. S. A. (2004). Artificial neural network models for identifying flow regimes
and predicting liquid holdup in horizontal multiphase flow. SPE Production &
Facilities February, 3340.
Osman, S. A. and Aggour, M. A.: Artificial Neural Network Model for Accurate
Prediction of Pressure Drop in Horizontal-Multiphase Flow, Petroleum Science
and Technology (2002) 20 No.1 and 2, 1-15.
Rojey, A., Jaffret, C., Cornot-Gandolphe, S., Durand, B., Jullian, S., and Valais, M.:
Natural Gas. Production, Processing, Transport, Editions Technip, Paris, 1997.

93
Satter, A. and Iqbal, G.M.: Practical Enhanced Reservoir Engineering: Assisted with
Simulation Software, PennWell Books, 2008.
Scalabrin, G., Marchi, P., Bettio, L. and Richon, D.: Enhancement of the extended
corresponding states techniques for thermodynamic modeling. II, Mixtures
International Journal of Refrigeration, 29, 7, 1195-1207, 2006
Shippen, M. E. and Scott, L. S.: A Neural Network Model for Prediction of Liquid
Holdup in Two-Phase Horizontal Flow, Paper SPE 77499, Presented at the 2002
SPE Annual Technical Conference and Exhibition, San Antonio, Texas, 29
September 2 October.
Shippen, M. E., and Scott, S. L: A neural network model for prediction of liquid holdup
in two-phase horizontal flow, SPE Production & Facilities May, 6776, 2004
Simpson P.K.: Fuzzy min-max neural networks - Part I: Classification, IEEE Trans.
Neural Networks, Vol. 3, September 1992.
Ternyik, J., Bilgesu, H. I., and Mohaghegh, S.: Virtual measurements in pipes. Part 2:
Liquid holdup and flow pattern correlations, SPE Paper 30976, 1995 Eastern
Regional Meeting, Morgantown, West Virginia, September 1721, 1995.
van Dam, J.: Planning of Optimum Production from a Natural Gas Field, Journal of
the Institute of Petroleum, Vol. 54, No. 521, March 1968.

94
Appendix A

MATLAB Program Codes


A.1 Bisection Subroutine
%% Subroutine to compute the well flowrate and bottom-hole pressure
%% using the bisection method.
function [q Pwf] = Bisection(P,C,n,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc)
qmin = 0;
qmax = 1000;
while abs (qmax - qmin) > 10^-10
qmid= (qmax + qmin)/2;
Pwf1 = (P^2 - (qmid*1000/C)^(1/n))^(1/2);
Pwf2 = CullSmith(qmid,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc);
check = Pwf1 - Pwf2;
if
check < 0
qmax = qmid;
else
qmin = qmid;
end
end
q = qmin;
Pwf = Pwf1;

95
A.2 Bisection_Pz Subroutine
%% Subroutine to compute pressure P from P/Z using bisection method.
function P = Bisection_Pz(P_z, Pmax, Pmin, Ppc, Tpr)
while abs (Pmax - Pmin) > 10^-10

end

Pmid= (Pmax + Pmin)/2;


Ppr = Pmid/Ppc;
zmid= Zfactor(Ppr, Tpr);
check = P_z - Pmid/zmid;
if
check < 0
Pmax = Pmid;
else
Pmin = Pmid;
end

P = Pmin;

96
A.3 CullSmith Subroutine
%% Subroutine to compute well bottom-hole pressure using the Cullender
%% & Smith Method.
function Pwf = CullSmith(q,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc)
Twf = Tr; % Assumes bottom-hole well flowing temperature equals
% reservoir temperature
Tmp = (Twf + Twh)/2;
WhTpr = Twh/Tpc;
MpTpr = Tmp/Tpc;
BtTpr = Twf/Tpc;
WhPpr = Pwh/Ppc;
if ID < 4.277
F = 0.10797*q / ID^2.612;
else
F = 0.10337*q / ID^2.582;
end
F2 = F^2;
LHS = 37.5*spgr*(depth/2);
Tpr = WhTpr;
Ppr = WhPpr;
z_wh = Zfactor(Ppr, Tpr);
PTZ = Pwh /(Twh*z_wh);
Iwh = PTZ /(F2 + PTZ^2/1000);
%%% Step 1(Upper Half of Flow String) %%%
% First trial %
Pmp = LHS/(2*Iwh) + Pwh;
% Second trial %
Ppr = Pmp/Ppc;
Tpr = MpTpr;
z_mp = Zfactor(Ppr, Tpr);
PTZ = Pmp / (Tmp*z_mp);
Imp = PTZ / (F2 + PTZ^2/1000);
Pmp = LHS/(Imp + Iwh) + Pwh;
% Third trial %
Ppr = Pmp/Ppc;
Tpr = MpTpr;
z_mp = Zfactor(Ppr, Tpr);
PTZ = Pmp / (Tmp*z_mp);
Imp = PTZ / (F2 + PTZ^2/1000);
Pmp2 = LHS/(Imp + Iwh) + Pwh;
% If new Pmp is not within 1 psi of old Pmp, redo third trial %

97
if (Pmp2 - Pmp) > 1
while (Pmp2 - Pmp) > 1
Pmp = Pmp2;
Ppr = Pmp/Ppc;
Tpr = MpTpr;
z_mp = Zfactor(Ppr, Tpr);
PTZ = Pmp / (Tmp*z_mp);
Imp = PTZ / (F2 + PTZ^2/1000);
Pmp2 = LHS/(Imp + Iwh) + Pwh;
end
end
%%% Step 2(Lower Half of Flow String) %%%
% First trial %
Pwf = LHS/(2*Imp) + Pmp2;
% Second trial %
Ppr = Pwf/Ppc;
Tpr = BtTpr;
z_wf = Zfactor(Ppr, Tpr);
PTZ = Pwf / (Twf*z_wf);
Iwf = PTZ / (F2 + PTZ^2/1000);
Pwf = LHS/(Imp + Iwf) + Pmp;
% Third trial %
Ppr = Pwf/Ppc;
Tpr = BtTpr;
z_wf = Zfactor(Ppr, Tpr);
PTZ = Pwf / (Twf*z_wf);
Iwf = PTZ / (F2 + PTZ^2/1000);
Pwf2 = LHS/(Imp + Iwf) + Pmp;
% If new Pwf is not within 1 psi of old Pwf, redo third trial %
if (Pwf2 - Pwf) > 1
while (Pwf2 - Pwf) > 1
Pwf = Pwf2;
Ppr = Pwf/Ppc;
Tpr = BtTpr;
z_wf = Zfactor(Ppr, Tpr);
PTZ = Pwf / (Twf*z_wf);
Iwf = PTZ / (F2 + PTZ^2/1000);
Pwf2 = LHS/(Imp + Iwf) + Pmp;
end
end

98
A.4 NPV Subroutine
%% Subroutine to compute the net present value of field.
function npv = NPV(N, OGIP, PGi, C, n, Pwh, ID, depth, cost, price,
rate, RFpl)
Twh = 530;
% Wellhead temperature (R)
spgr = 0.60;
% Specific gravity (air = 1)
Pi = PGi * depth; % Initial pressure = pressure gradient * depth
cost = cost * depth; % Well Cost = cost per ft * depth
price = price * 10^-3; % Conversion $/mscf to $/scf
Tr = (0.02*depth) + Twh; % Reservoir Temperature = 0.02F/ft above Twh
Ppc = 756.8 - 131*spgr - 3.6*spgr^2; % Critical pressure (psia)
Tpc = 169.2 + 349.5*spgr - 74*spgr^2;
% Critical temperature (R)
Tpr = Tr/Tpc;
% Reduced temperature for z factor calculation
Ppr = Pi/Ppc;
% Reduced pressure for Z factor calculation
zi = Zfactor(Ppr, Tpr); % Calculate initial Z factor
count = 1;
Gppl = RFpl * OGIP; % Gas produced at end of plateau
P_z = (Pi/zi)*(1-RFpl); % P/z @ end of plateau
Ppl = Bisection_Pz(P_z, Pi, Pwh, Ppc, Tpr); % P @ end of plateau
[qpl Pwf] = Bisection(Ppl,C,n,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc);
if qpl == 0
npv = 0;
else
qa = qpl/10; % Abandonment field production rate = 1/10 of Qwellpl
tpl = Gppl*10^3/(qpl*N*365); % Time period (in yrs) during plateau
G_t(count,1) =
G_t(count,2) =
G_t(count+1,1)
G_t(count+1,2)

0;
0;
= Gppl;
= tpl;

count = 3;
%%----------------------------------------------------------------%
Declining rate period
%%----------------------------------------------------------------Pnew = Ppl;
% Start by applying P from constant rate analysis
Gptotal = Gppl; % Gp from end of plateau
q = qpl;
% Flowrate, q from plateau
qnew = qpl;
% Start procedure with arbitrary q higher than qa
deltaP = 10;
% Selected value for pressure decrease
t_st = tpl;
while qnew*N > qa % Run loop until abandonment field rate
Pnew = Pnew - deltaP;
Ppr = Pnew/Ppc;
z = Zfactor(Ppr, Tpr);

99
Gpnew = OGIP*(Pi/zi - Pnew/z)/(Pi/zi);
deltaGp = Gpnew - Gptotal;
% Find intersection between Inflow and Outflow %
[qnew Pwf] =
Bisection(Pnew,C,n,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc);
if qnew == 0
break
end

end

qave = 10^((log10(qnew)+log10(q))/2);
time = deltaGp*10^3/(qave*N*365);
q = qave;
Gptotal = Gpnew;
G_t(count,1)= Gpnew;
t_st = t_st + time;
G_t(count,2) = t_st;
count = count + 1;

sz = size(G_t);
lastyr = ceil(G_t(sz(1),2));

end

for i = 1:lastyr
if i == lastyr
y = interp1(G_t(:,2),G_t(:,1),[i-1],'linear');
Gpyr = G_t(sz(1)) - y;
dscntdRevnu(i) = price*Gpyr*10^9/(1+rate)^i;
else
y = interp1(G_t(:,2),G_t(:,1),[i-1,i],'linear');
Gpyr = y(2) - y(1);
dscntdRevnu(i) = price*Gpyr*10^9/(1+rate)^i;
end
end
npv = (sum(dscntdRevnu) - (N*cost))/10^6; % NPV in $millions

100
A.5 Optimization
clear;
clc;
%%%-----------------------------------------------------------------%%%
%
Well & Reservoir properties
%%%-----------------------------------------------------------------%%%
Data = xlsread('VariableSet.xls','Data');
wellCountNPV = zeros(1500,2);
for i = 1:1500
OGIP = Data(i,1);
PGi = Data(i,2);
C = Data(i,3);
n = Data(i,4);
Pwh = Data(i,5);
ID = Data(i,6);
depth = Data(i,7);
cost = Data(i,8);
price = Data(i,9);
rate = Data(i,10);
RFpl = Data(i,11);

%
%
%
%
%
%
%
%
%
%
%

OGIP in Bscf
Initial reservoir pressure gradient
Performance coefficient from well test data
Back pressure exponent from well test data
Wellhead pressure (psia)
Tubing ID (inches)
Well Depth (ft)
Cost of drilling a well ($/ft)
Cash generation per unit gas sold ($/mscf)
Deferment rate
Recovery Factor at end of plateau

j = 1;
if NPV(j, OGIP, PGi, C, n, Pwh, ID, depth, cost, price, rate, RFpl)
<= 0;
wellCountOpt = 0;
npvOpt = 0;
wellCountNPV(i,:) = [wellCountOpt,npvOpt];
else
delta = 10;
npvOld = NPV(j, OGIP, PGi, C, n, Pwh, ID, depth, cost, price,
rate, RFpl);
npvNew = NPV(j+delta, OGIP, PGi, C, n, Pwh, ID, depth, cost,
price, rate, RFpl);
diff = npvNew - npvOld;
if diff <= 0
wellCountMin = j;
wellCountMax = j + delta;
else
while diff > 0
j = j + delta;
npvOld = npvNew;
npvNew = NPV(j+delta, OGIP, PGi, C, n, Pwh, ID, depth,
cost, price, rate, RFpl);
diff = npvNew - npvOld;
end
wellCountMin = j - delta;
wellCountMax = j + delta;

101
end
wellCountOpt = fminbnd(@(N) -NPV(N, OGIP, PGi, C, n, Pwh, ID,
depth, cost, price, rate, RFpl),wellCountMin,wellCountMax);
npvOpt = NPV(wellCountOpt, OGIP, PGi, C, n, Pwh, ID, depth,
cost, price, rate, RFpl);
wellCountNPV(i,:) = [wellCountOpt,npvOpt];

end
end
xlswrite('VariableSetOpt', wellCountNPV);

102
A.6 Performance_Prediction
clear;
clc;
%%%-----------------------------------------------------------------%%%
%
Well & Reservoir properties
%%%-----------------------------------------------------------------%%%
N = 2;
% Number of Wells
OGIP = 100;
% Original Gas In Place (Bscf)
Pi = 3000;
% Initial reservoir pressure
Tr = 630;
% Reservoir temperature (R)
C = 0.412;
% Performance (flow) coefficient from well test data
n = 0.633;
% Back pressure exponent from well test data
Pwh = 400;
% Minimum wellhead pressure (psia)
ID = 2.5;
% Tubing ID (inches)
depth = 5000;
% Well Depth (ft)
RFpl = 0.5;
% Recovery factor at end of plateau
Twh = 530;
spgr = 0.60;
qa = 0.4;

% Wellhead temperature (R)


% Specific gravity (air = 1)
% Abandonment field rate = 400 mscfd

Ppc = 756.8 - 131*spgr - 3.6*spgr^2;


% Critical pressure (psia)
Tpc = 169.2 + 349.5*spgr - 74*spgr^2;
% Critical temperature (R)
Tpr = Tr/Tpc;
% Reduced temperature for z factor calculation
Ppr = Pi/Ppc;
% Reduced pressure for z factor calculation
zi = Zfactor(Ppr, Tpr); % Calculate initial z factor
count = 1;
Gppl = RFpl * OGIP; % Gas produced at end of plateau
P_z = (Pi/zi)*(1-RFpl); % P/z @ end of plateau
Ppl = Bisection_Pz(P_z, Pi, Pwh, Ppc, Tpr); % P @ end of plateau
[qpl Pwf] = Bisection(Ppl,C,n,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc);
tpl = Gppl*10^3/(qpl*N*365); % Time period (in yrs) during plateau
q_t(count,1)
q_t(count,2)
G_t(count,1)
G_t(count,2)

=
=
=
=

q_t(count+1,1)
q_t(count+1,2)
G_t(count+1,1)
G_t(count+1,2)
count = 3;

qpl*N;
0;
0;
0;
=
=
=
=

qpl*N;
tpl;
Gppl;
tpl;

103
%%--------------------------------------------------------------------%
Declining rate period
%%--------------------------------------------------------------------Pnew = Ppl;
% Start by applying Pr|tp from end of plateau
Gptotal = Gppl; % Gp|tp from end of plateau
q = qpl;
% Flowrate, Qwellpl from plateau
qnew = qpl;
% Start procedure with arbitrary Qwell that is above Qa
deltaP = 100;
% Assumed value for pressure decrease
deltaP2 = 10;
% Pressure decrease when close to abandonment
deltaP3 = 1;
% Pressure decrease when almost at abandonment
i = 0;
% To store array values
t_st = tpl;
while qnew*N > qa % Run loop until Qa is reached
i = i + 1;
if Pnew < 481
Pnew = Pnew - deltaP3;
elseif Pnew < 611
Pnew = Pnew - deltaP2;
else
Pnew = Pnew - deltaP;
end
Ppr = Pnew/Ppc;
z = Zfactor(Ppr, Tpr);
Gpnew = OGIP*(Pi/zi - Pnew/z)/(Pi/zi);
deltaGp = Gpnew - Gptotal;
Gpdiff = Gpnew;
% Find intersection between Inflow and Outflow %
[qnew Pwf] = Bisection(Pnew,C,n,Tr,Twh,Tpc,ID,depth,spgr,Pwh,Ppc);
if qnew == 0 || qnew*N < qa
break
end

end

qave = 10^((log10(qnew)+log10(q))/2);
time = deltaGp*10^3/(qave*N*365);
P_array(i) = Pnew;
% To store P values for each run
Pwf_array(i) = Pwf;
% To store Pwf values for each run
Gp_array(i) = Gpnew;
% To store Gp values for each run
delG_array(i) = deltaGp;% To store delta Gp values for each run
q_array(i) = qnew*N;
% To store Qfield values for each run
qave_array(i) = qave*N; % To store log avg. Q values for each run
t_array(i) = time;
% To store t values for each run
q = qave;
Gptotal = Gpnew;
q_t(count,1)= qnew*N;
G_t(count,1)= Gpdiff;
t_st = t_st + time;
q_t(count,2) = t_st;
G_t(count,2) = t_st;
count = count + 1;

104
%% Figure 1 Field rate vs. Time %%
figure(1)
plot(q_t(:,2),q_t(:,1),'-ob')
xlabel('Time, t (years)')
ylabel('Flow rate, Q_f_i_e_l_d (mmscfd)')
title('Flow rate, Q_f_i_e_l_d vs. Time, t')
%% Figure 2 - Cumulative gas produced vs. Time %%
figure(2)
plot(G_t(:,2),G_t(:,1),'-ob');
xlabel('Time, t (years)');
ylabel('Cumulative Gas produced, G_p (Bscf)');
title('Cumulative Gas produced, G_p vs. Time, t');
%% Save Performance Predictions in Table format and write to file %%
Predictions = [P_array; Pwf_array; Gp_array; delG_array; q_array;
qave_array; t_array];
xlswrite('Predictions',Predictions')

105
A.7 Viscosity Subroutine
%% Subroutine to compute gas viscosity using Lee-Gonzales-Eakin
%% Equation
function visc = Viscosity(P, T, z, spgr)
MW = 29*spgr;
R = 10.73;
rho = P*MW/(R*T*z);
Xv = 3.5 + 986/T + 0.01*MW;
Yv = 2.4 - 0.2*Xv;
Kv = (9.4 + 0.02*MW)*T^1.5 / (209 + 19*MW + T);
visc = 10^-4*Kv*exp(Xv*(rho/62.4)^Yv);

106
A.8 Zfactor Subroutine
%% Danchuk-Abou-Kassem Equation to solve for Z using Bisection Method
function Z = Zfactor(Ppr, Tpr)
A1 = 0.3265;
A2 = -1.0700;
A3 = -0.5339;
A4 = 0.01569;
A5 = -0.05165;
A6 = 0.5475;
A7 = -0.7361;
A8 = 0.1844;
A9 = 0.1056;
A10 = 0.6134;
A11 = 0.7210;
c1 = A1 + (A2/Tpr) + (A3/(Tpr^3)) + (A4/(Tpr^4)) + (A5/(Tpr^5));
c2 = A6 + (A7/Tpr) + (A8/(Tpr^2));
c3 = (A7/Tpr) + (A8/(Tpr^2));
Zmin = 0;
Zmax = 1;
while abs (Zmax - Zmin) > 10^-10
Zmid= (Zmax + Zmin)/2;
rhoR = 0.27*Ppr/(Zmid*Tpr); % Reduced density of gas %
Zcheck = -Zmid + 1 + (c1*rhoR) + (c2*rhoR^2) - (A9*c3*rhoR^5) +
((A10/Tpr^3)*(1+(A11*rhoR^2))*rhoR^2*exp(-A11*rhoR^2));
if
else
end

Zcheck < 0
Zmax = Zmid;
Zmin = Zmid;

end
Z = Zmin;

107
Appendix B

ANN MATLAB code


close all;
clear all;
clc;
format long;
P(:,:) = xlsread('ANNData.xls','TrainingInput');
P = P';
T = xlsread('ANNData.xls','TrainingOutput');
T = T';
p1 = xlsread('ANNData.xls','TestingInput');
p1 = p1';
t1 = xlsread('ANNData.xls','TestingOutput');
t1 = t1';
[m,n] = size (P);

%TrainingInput

[mo,no] = size (T);

%TrainingOutput

[m1,n1] = size (p1);

%TestingInput

[Pn,ps] = mapminmax(P,-1,1);
[Tn,ts] = mapminmax(T,-1,1);
pn=mapminmax('apply',p1,ps);
tn=mapminmax('apply',t1,ts);
trainP=Pn;
trainT=Tn;
testP=pn;
testT=tn;
%% Training the neural network for the field optimization values
net = newcf (minmax(Pn), [50 40 35 mo], {'logsig' 'logsig' 'tansig'
'purelin'}, 'trainscg','learngdm','mse');
net.trainParam.shows=5;
net.trainParam.goal=1e-10;
net.trainParam.min_grad=1e-6;
net.trainParam.epochs=5*1e4;
net.trainParam.mem_reduc=1;
net.trainParam.minstep=1e-10;

%%Epochs between displays


%%Performance goal
%%Minimum gradient
%%Number of iterations for training
%%Factor to use for memory/speed tradeoff
%%Minimum step size

108
net=init(net);
% Start training network
[net,tr]= train(net,trainP,trainT);
% Simulating the input using the matrix pn
AAA= sim (net,trainP);
% Denormalizing the input
AA = mapminmax('reverse', AAA,ts);
BBB= sim(net,testP);
BB = mapminmax('reverse',BBB,ts);
t=T;
%% Error calculation
errortrainingA=((AA(1,:)-(t(1,:)))./t(1,:)).*100;
Nw_opt
errortrainingB=((AA(2,:)-(t(2,:)))./t(2,:)).*100;
NPVmax
errortestingA=((BB(1,:)-(t1(1,:)))./t1(1,:)).*100;
Nw_opt
errortestingB=((BB(2,:)-(t1(2,:)))./t1(2,:)).*100;
NPVmax
X=(1:1:n);
XX=(1:1:n1);
binmax=10;
nbins=-binmax:binmax/10:binmax;
%% Plots of Training & Testing data errors
figure (1)
subplot (3,2,1, 'align');
plot (X,errortrainingA,'k+');
grid on
hold on
title('Training Nw_o_p_t %Error')
xlim ([0 n]);
ylim ([-binmax binmax]);
subplot (3,2,2, 'align');
plot (XX,errortestingA,'k+');
grid on
hold on
title('Testing Nw_o_p_t %Error')
xlim ([0 n1]);
ylim ([-binmax binmax]);
subplot(3,2,3)
hist(errortrainingA,nbins)

%Training error for


%Training error for
%Testing error for
%Testing error for

109
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training Nw_o_p_t %Error Histogram')
subplot(3,2,4)
hist(errortestingA,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing Nw_o_p_t %Error Histogram')
subplot(3,2,5)
plot(t(1,:),AA(1,:),'bo')
grid on
hold on
x = 0:1000:2000;
y = x;
plot(x,y,'-k')
xlim([0 2000]);
ylim([0 2000]);
xlabel('Actual Values')
ylabel('Predicted Values')
title('Training Nw_o_p_t Crossplot')
subplot(3,2,6)
plot(t1(1,:),BB(1,:),'bo')
grid on
hold on
x = 0:1000:2000;
y = x;
plot(x,y,'-k')
xlim([0 2000]);
ylim([0 2000]);
xlabel('Actual Values')
ylabel('Predicted values')
title('Testing Nw_o_p_t Crossplot')
%%
figure(2)
subplot (3,2,1, 'align');
plot (X,errortrainingB,'k+');
grid on
hold on
title('Training NPV_m_a_x %Error')
xlim ([0 n]);
ylim ([-binmax binmax]);
subplot (3,2,2, 'align');
plot (XX,errortestingB,'k+');
grid on
hold on
title('Testing NPV_m_a_x %Error')

110
xlim ([0 n1]);
ylim ([-binmax binmax]);
subplot(3,2,3)
hist(errortrainingB,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training NPV_m_a_x %Error Histogram')
subplot(3,2,4)
hist(errortestingB,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing NPV_m_a_x %Error Histogram')
subplot(3,2,5)
plot(t(2,:),AA(2,:),'bo')
grid on
hold on
x = 0:5000:30000;
y = x;
plot(x,y,'-k')
xlim([0 30000]);
ylim([0 30000]);
xlabel('Actual Values')
ylabel('Predicted Values')
title('Training NPV_m_a_x Crossplot')
subplot(3,2,6)
plot(t1(2,:),BB(2,:),'bo')
grid on
hold on
x = 0:8000:32000;
y = x;
plot(x,y,'-k')
xlim([0 32000]);
ylim([0 32000]);
xlabel('Actual Values')
ylabel('Predicted Values')
title('Testing NPV_m_a_x Crossplot')
%%

Get relevancies

%
num. of neurons in 1st (input) layer
ni = net.layers{1}.size;
%
num. of input elements
nj = net.inputs{1}.size;
%

input weights MATRIX for

111
%
%
%
%
s =

ith layer, jth input source


ANN.IW{i,j}
assign absolute values of input weights
for 1st (input) layer and 1st input source
abs(net.IW{1,1});

for j = 1:nj
CS(j) = 0;
for i = 1:ni
CS(j) = CS(j) + s(i,j);
end
end
sum = 0;
for k = 1:nj
sum = sum + CS(k);
end
percentCS = CS./sum * 100;
%%=====================================================================
%
FIGURE: Relevancies
%%=====================================================================
figure (3)
filename = ('Relevancies(percent)');
barh(percentCS,0.2,'k')
title('Input Relevancies (%)');
xlabel('Relevancy (%)');
set(gca,'YTickLabel',{...
'OGIP';...
'PGi';...
'Cwell';...
'n';...

112
'Pwh_min';...
'Tubing ID';...
'Well Depth';...
'Cost of Well';...
'Unit Cash Generated';...
'Deferment Rate';...
'RFpl';...
})

You might also like