In this section, the application of the finite difference method for solution of partial differential type models is illustrated by several examples.

## The Method of Finite Differences

The method of finite differences is one of many methods available for numerical solution of partial differential equations. Because of its simplicity and convenience, the method of finite differences is the most frequently used numerical method for solution of differential equations. This method provides algebraic approximations to derivatives so that differential equations can be transformed into a set of algebraic equations, which can be solved by appropriate numerical procedures. Although the finite difference approximations can be derived by various methods, a simple method based on the power series approach is presented here to avoid complicated mathematical derivation. Interested readers may resort to many excellent textbooks and literature available on the finite difference method. The information provided in this chapter is sufficient for many applications and for the purpose of this book. Most transport phenomenological models involve first and second order derivatives. Therefore, the following derivation is limited to the development of the first and second order derivative formulae. However, the higher order derivative formulae can be readily derived by the same approach presented in this chapter.

## First Order Derivatives

In general, a function can be approximated by a power series as:

in which a0,a1,a2,... are some fitting coefficients. To determine the fitting coefficients, consider any set of three discrete function values fi_1, fi, and fi+l located at the sample points xi_1, xi, and xi+l, respectively,

More points could be considered for better accuracy. Higher order finite difference formulae can be derived easily using the quadrature method as described by Civan (1994). With three points, we can write the following three quadratic approximations at i -1, i, i +1:

If the middle point is considered as a reference point, then the locations of the three points are given by:

Thus, substituting Eq. 16-23 into Eqs. 16-20 through 22, and then solving the resultant three algebraic equations simultaneously yields the following expressions for the fitting coefficients of the quadratic expression:

On the other hand, the derivative of Eq. 16-19 for quadratic approximation is given by:

Thus, the following forward difference formula is obtained by substituting Eqs. 16-25 and 26 into Eq. 16-27 for a1,a2 at x = xi_1 =-Δx:

The central difference formula is obtained as, by substituting Eqs. 16- 25 and 26 for a1,a2 into Eq. 16-27 at x = x1; =0:

The backward difference formula is obtained as, by substituting Eqs. 16-25 and 26 for a1,a2 into Eq. 16-27 at x = xi+1 = Δx:

## Second Order Derivatives

A similar procedure can be applied to derive the second (and higher) order derivative approximations. Thus, consider a power series expansion as:

Expressions similar to Eqs. 16-24 through 26 are obtained for the fitting coefficients, given by:

The derivative of the quadratic equation is obtained from Eq. 16-31 as:

Thus, the forward difference formula is obtained as, by substituting Eqs. 16-33 and 34 for b1,b2 at x = xi_1 =-Δx into Eq. 16-35:

The central difference formula is obtained as, by substituting Eqs. 16-33 and 34 for b1,b2 at x = xi=0 into Eq. 16-35:

The backward difference formula is obtained as, by substituting Eqs. 16-33 and 34 for b1,b2 into Eq. 16-35 for x = xi+1 =Δx:

However, only the central second order derivative formula is used in our models. Thus, substituting the first order forward and backward difference formulae given by Eqs. 16-28 and 30 into Eq. 16-37, the central second order difference formula is obtained as:

## References

Amaefule, J. O., Kersey, D. G., Norman, D. L., & Shannon, P. M., "Advances in Formation Damage Assessment and Control Strategies," CIM Paper No. 88-39-65, Proceedings of the 39th Annual Technical Meeting of Petroleum Society of CIM and Canadian Gas Processors Association, June 12-16, 1988, Calgary, Alberta, 16 p.

Baghdikian, S. Y., Sharma, M. M., & Handy, L. L., Flow of Clay Suspensions Through Porous Media, SPE Reservoir Engineering, Vol. 4., No. 2. , May 1989, pp. 213-220.

Burnett, D. S., Finite Element Analysis, Addison-Wesley Publishing Company, Massachusetts, 1987, 844 p.

Cernansky, A., & Siroky, R., "Hlbkova Filtracia Polydisperznych Castic z Kvapalin na Vrstvach z Vlakien," Chemicky Prumysl, Vol. 32 (57), No. 8, 1982, pp. 397-405.

Cernansky, A., & Siroky, R., "Deep-bed Filtration on Filament Layers on Particle Polydispersed in Liquids," Int. Chem. Eng., Vol. 25, No. 2, 1985, pp. 364-375.

Chang, F. F., & Civan, F., Predictability of Formation Damage by Modeling Chemical and Mechanical Processes, SPE 23793 paper, Proceedings of the SPE International Symposium on Formation Damage Control, February 26-27, 1992, Lafayette, Louisiana, pp. 293-312.

Civan, F., A Generalized Model for Formation Damage by Rock-Fluid Interactions and Particulate Processes, SPE 21183, Proceedings of SPE 1990 Latin American Petroleum Engineering Conference, Rio de Janeiro, Brazil, October 14-19, 1990, 11 p.

Civan, F. "Evaluation and Comparison of the Formation Damage Models," SPE 23787 paper, Proceedings of the SPE International Symposium on Formation Damage Control, February 26-27, 1992, Lafayette, Louisiana, pp. 219-236.

Civan, F, "Numerical Simulation by the Quadrature and Cubature Methods," SPE 28703 paper, Proceedings of the SPE International Petroleum Conference and Exhibition of Mexico, October 10-13, 1994, Veracruz, Mexico, pp. 353-363.

Civan, F.,"Solving Multivariable Mathematical Models by the Quadrature and Cubature Methods," Journal of Numerical Methods for Partial Differential Equations, Vol. 10, 1994, pp. 545-567.

Civan, F. /'Rapid and Accurate Solution of Reactor Models by the Quadrature Method," Computers & Chemical Engineering, Vol. 18. No. 10, 1994, pp. 1005-1009.

Civan, F., Predictability of Formation Damage: An Assessment Study and Generalized Models, Final Report, U.S. DOE Contract No. DE-AC22- 90-BC14658, April 1994.

Civan, F. /'Practical Implementation of the Finite Analytic Method," Applied Mathematical Modeling, Vol. 19, No. 5, 1995, pp. 298-306.

Civan, F., "A Multi-Purpose Formation Damage Model," SPE 31101 paper, Proceedings of the SPE Formation Damage Symposium, February 14-15, 1996, Lafayette, Louisiana, pp. 311-326.

Civan, F. "A Time-Space Solution Approach for Simulation of Flow in Subsurface Reservoirs," Turkish Oil and Gas Journal, Vol. 2, No. 2, June 1996, pp. 13-19.

Civan, F., "Incompressive Cake Filtration: Mechanism, Parameters, and Modeling," AIChE J., Vol. 44, No. 11, November 1998, pp. 2379- 2387.

Civan, F., "Practical Model for Compressive Cake Filtration Including Fine Particle Invasion," AIChE J., Vol. 44, No. 11, November 1998, pp. 2388-2398.

Civan, F., "Quadrature Solution for Waterflooding of Naturally Fractured Reservoirs," SPE Reservoir Evaluation & Engineering J., April 1998, pp. 141-147.

Civan, F., "Phenomenological Filtration Model for Highly Compressible Filter Cakes Involving Non-Darcy Flow," SPE 52147 paper, Proceedings of the 1999 SPE Mid-Continent Operations Symposium, March 28-31, 1999, Oklahoma City, Oklahoma, pp. 195-201.

Civan, F., "Predictive Model for Filter Cake Buildup and Filtrate Invasion with Non-Darcy Effects," SPE 52149 paper, Proceedings of the 1999 SPE Mid-Continent Operations Symposium, March 28-31, 1999, Oklahoma City, Oklahoma, pp. 203-210.

Civan, F., & Engler, T., "Drilling Mud Filtrate Invasion—Improved Model and Solution," J. of Petroleum Science and Engineering, Vol. 11, 1994, pp. 183-193.

Civan, F., Knapp, R. M., & Ohen, H. A., Alteration of Permeability Due to Fine Particle Processes, J. Petroleum Science and Engineering, Vol. 3, Nos. 1/2, Oct. 1989, pp. 65-79.

Escobar, F. H., Jongkittinarukorn, K., & Civan, F, "Cubature Solution of the Poisson Equation," Communications in Numerical Methods in Engineering, Vol. 13, 1997, pp. 453-465.

Fehlberg, E., "Low-Order Classical Runge-Kutta Formulas with Stepsize Control and their Application to Some Heat Transfer Problems," NASA TR R-315, Huntsville, Alabama, July 1969.

Gruesbeck, C., & Collins, R. E., Entrainment and Deposition of Fine Particles in Porous Media, SPEJ, December 1982, pp. 847-856.

IMSL—FORTRAN Subroutines for Mathematical Applications IMSL Inc., Houston, Texas, Version 1.0, April 1987.

Malik, M., & Civan, F., "A Comparative Study of Differential Quadrature and Cubature Methods Vis-A-Vis Some Conventional Techniques in Context of Convection-Diffusion-Reaction Problems," Chemical Engineering Science, Vol. 50, No. 3, 1995, pp. 531-547.

Ohen, H. A., & Civan, R, Simulation of Formation Damage in Petroleum Reservoirs, SPE 19420 paper, Proceedings of the SPE 1990 Symposium on Formation Damage Control, February 22-23, 1990, Lafayette, Louisiana.

Ring, J. N., Wattenbarger, R. A., Keating, J. F., & Peddibhotla, S., "Simulation of Paraffin Deposition in Reservoirs," SPE Production & Facilities, February 1994, pp. 36-42.

Thomas, G. W., Principles of Hydrocarbon Reservoir Simulation, International Human Resources Development Corporation, Publishers, Boston, 1982, 207 p.

Wojtanowicz, A. K., Krilov, Z., & Langlinais, J. P., "Experimental Determination of Formation Damage Pore Blocking Mechanisms," Trans. oftheASME, Journal of Energy Resources Technology, Vol. 110, 1988, pp. 34-42.

Wojtanowicz, A. K., Krilov, Z., & Langlinais, J.P., "Study on the Effect of Pore Blocking Mechanisms on Formation Damage," SPE 16233 paper, Presented at the Society of Petroleum Engineers Symposium, Oklahoma City, Oklahoma, March 8-10, 1987, pp. 449-463.