SPREADSHEET PROGRAMMING SIMPLIFIES DRILLING CALCULATIONS

Feb. 9, 1993
M.A. Mian Qatar General Petroleum Corp. Doha, Qatar Programming complex drilling equations for P use on common computer spreadsheets can help an engineer solve complex problems quickly and correctly. Many petroleum engineering calculations often involve trial-and-error solutions which are time consuming, tedious, and subject to error if performed manually.
M.A. MianQatar General Petroleum Corp. Doha, Qatar

Programming complex drilling equations for P use on common computer spreadsheets can help an engineer solve complex problems quickly and correctly.

Many petroleum engineering calculations often involve trial-and-error solutions which are time consuming, tedious, and subject to error if performed manually.

Although many off-the-shelf software packages are readily available and relatively inexpensive, an engineer may still have to create his own programs or modify these commercial programs for specific problems. Thus, engineers should not only be familiar with the common spreadsheet programs but also be able to program them for individual applications.

A petroleum engineer has to become computer proficient or face the possibility of losing his competitive edge. An engineer provided with good-quality software, high-performance hardware, and proper training will be more efficient and capable of better engineering.

However, no matter how well an engineer uses software and hardware packages, he or she must still interact with the system and interpret the computer-generated results. The engineer must decide whether the computer-generated calculations are good or bad (that is, garbage in, garbage out).

Thus, engineers should trust computers only to the extent that computers make calculations faster, easier, and comprehensive.

Many petroleum applications can be performed using personal computers, which are particularly ideal for smaller companies, petroleum consultants, financial institutions, and individual departments of larger companies.

Specific engineering software is readily available for almost every discipline of the petroleum industry, including basic reservoir simulation, material balance calculations, transient pressure analysis, log analysis, subsurface mapping and contouring, drilling engineering, petroleum economics, and production engineering.

SPREADSHEET PROGRAMS

Many of the commercially available spreadsheet software programs are user friendly and have substantially reduced the programming complexity compared to computer programming languages.

Several common spreadsheet packages, such as Lotus 1-2-3, Quatro Pro, and Excel, perform essentially the same functions, and many commercial programs are compatible with these spreadsheets, which are of course composed of cells identified by letters and numbers.

Many engineers frequently use the spreadsheet software because of the enhanced programming power and flexibility. Furthermore, much of the industry-specific software is programmed using spreadsheets. A great number of these are not of professional quality, although they may be adequate for a particular user or special function.

A good, comprehensive software package should include features such as a user friendly interface, a fully menu-driven integrated system, an efficient data base management setup, accurate and quick calculations, and a high-quality reporting format. Professional, presentation-quality printouts are important to eliminate the time of retyping the results generated by the package. A quality report also reflects the professional quality of the package. User-support and price are the other important features in an engineering applications package.

The easier a program is to use, the more productive is the engineer who uses it. The program should flow through a problem in a logical manner to make the engineer feel comfortable, know what to expect, and recognize what needs to be done. A good software package must link the engineer's thoughts and tasks.

A professionally organized manual with typical examples solved by the package and various equations used for calculations should accompany the package. A fully menu-driven system saves considerable amount of time and frustration for an engineer searching for individual programs.

The following two sets of drilling equations are easily programmed in spreadsheets. The first problem is the calculation of particle slip velocity, and the second is the calculation of total fluid friction pressure losses in a hole using the Bingham plastic model.

PARTICLE SLIP VELOCITY

The particle slip velocity was calculated with a spreadsheet program (Pe-pac2); the input data and the calculated results are shown in Table 1. The spreadsheet used Moore's and Chien's empirical correlations (Equations 1-8).

Note that Moore's correlation uses apparent viscosity (ma) to calculate particle Reynolds number (NRp), whereas Chien's correlation uses plastic viscosity (mp). The particle slip velocity calculation involves two iterations:

  • Calculate Vsl
  • Calculate NRP
  • Verify whether the proper Vsl equation is used
  • If not, recalculate Vsl.

    The programming steps for Moore's correlations in a Lotus 1-2-3 spreadsheet are shown in Box 1. Note that Cells N16 through N18 are a calculation loop. The [Recalculation] option of Lotus 1-23 should be set to [Automatic] and the [Iterations] option to three iterations (for example, /WGRA and /WGRI2~).

    The Chien's correlations can be programmed in the same way.

    FRICTION PRESSURE LOSSES

    The second drilling problem presented here involves the calculation of friction pressure losses through the mud circulation system. Although the calculations are straightforward, some of the equations require trial-and-error iterative procedures. Programming these iterative equations on a computer spreadsheet will expedite calculations, improve accuracy, and eliminate the need for using estimates from friction factor charts.

    The equations used to calculate friction pressure drop are for a Bingham plastic fluid (Equations 8-22). For flow through the annulus, if NRa

    In this set of equations, Equations 11, 15, and 19 require iterative procedures.

    Two methods are presented to help petroleum engineers program such equations: the Newton-Raphson iteration (the Newton method) and the method of successive substitutions. The Newton method (preferred) is more efficient. However, this method requires taking the first derivative of the original equation, which may pose a challenge to some petroleum engineers who have not practiced calculus for some time.

    NEWTON METHOD

    To use the Newton method, the algebraic equation must be written in the form f(x)=O. This relationship is then used:

    See chart

    The first derivative of f (x) evaluated at xi is f (xi). The iteration begins with a guess of the initial value of xi and the calculation of f(xi). If f(xi) is significantly different from zero, xi,, is calculated and the process repeated until the function converges to zero (or close enough to zero).

    Before the equation is programmed, Equations 11 and 15 have to be derived in the form of f(x) and f(x) as shown by Equations 11a-11c and 15a-15c, respectively.

    Equation 19 is derived similarly, except the constant 22,400 is replaced by 16,800.

    The Newton method, if the initial guess is not too far from the actual, will normally converge in less than 10 iterations.

    The initial guess for Equation 15 is calculated as f = 16/NR. For Equations 11 and 19, the initial guess is estimated at Eoc = 0.05. The Eoc calculated is then used to calculate the respective NR,.

    The programming of Equation 15 is shown in the upper section of Box 2. After these equations are entered, the engineer must copy Cell B4 to B12, Cell C3 to C12, and Cell D3 to D12. The friction factor f is read in Cell B12. In the same way, Equations 11a and 11b can be programmed. Results from a spreadsheet for calculating the friction pressure losses are shown in Table 2.

    SUCCESSIVE SUBSTITUTION

    The successive substitution method is easier to use than the Newton method because it does not require differentiation, but this method may require more than 10 iterations to solve some problems.

    The lower section of Box 2 shows the steps used to program Equation 15 by the successive substitution method. After these equations are entered, the engineer must copy Cell B4 to B15, Cell C3 to C15, and Cell D3 to D15. The friction factor f is then read in Cell B15.

    Equation 23 is used to calculate the friction factor for pressure losses using the power law model. Equations 23a and 23b are derived in terms of Newton's method.

    BIBLIOGRAPHY

    1. Bizanti, M.S., and Moonesan, A., "Pressure Loss Simulator Improves Nozzle Selection," Petroleum Engineer International, July 1990, pp. 30-35.

    2. Bizanti, M.S., and Robinson, S., "PC program speeds slip velocity calculations," OGJ, Nov. 7, 1988, pp. 44-46.

    3. Mian, M.A., Petroleum Engineering Handbook for the Practicing Engineer, Vol. 2, PennWell Books, Tulsa, Okla., 1992.

    4. Mian, M.A., "Program Quickly Solves Trial-and-Error Problems," World Oil, September 1990, pp. 67-75.