 Applied Mathematics, 2011, 2, 883-889 doi:10.4236/am.2011.27118 Published Online July 2011 (http://www.SciRP.org/journal/am) Copyright © 2011 SciRes. AM A Note on Crank-Nicolson Scheme for Burgers’ Equation Kanti Pandey, Lajja Verma Department of Mathematics and Astronomy, University of Lucknow, Lucknow, India E-mail: pandey_kanti@yahoo.co.in, lajjamaths@yahoo.co.in Received April 5, 2011; revised May 23, 2011; accepted May 26, 2011 Abstract In this work we generate the numerical solutions of the Burgers’ equation by applying the Crank-Nicolson method directly to the Burgers’ equation, i.e., we do not use Hopf-Cole transformation to reduce Burgers’ equation into the linear heat equation. Absolute error of the present method is compared to the absolute error of the two existing methods for two test problems. The method is also analyzed for a third test problem, nu-merical solutions as well as exact solutions for different values of viscosity are calculated and we find that the numerical solutions are very close to exact solution. Keywords: Hopf-Cole Transformation, Burgers’ Equation, Crank-Nicolson Scheme, Nonlinear Partial Differential Equations1. Introduction Burgers’ equation is one of the most important nonlinear partial differential equations governed by the following equation  2=,22,, ,0,10,.dtxxwwwww xtxtT (1) This equation is nonlinear and can be considered as nonlinear analog of the Navier-Stokes equations. It has a convection term, a diffusion term and a time-dependent term. It also has a large variety of applications in modeling of water in unsaturated oil, dynamics of soil in water, statics of flow problems, mixing and turbulent diffusion, cosmology and seismology [1-3]. With viscous term the Burgers’ Equation (1) is parabolic while without viscous term it is hyperbolic. In the later case it possesses discontinuous solutions due to the nonlinear term and even if smooth initial condition is considered the solution may be discontinuous after finite time. It also governs the phenomenon of shock waves . In the present work we consider the Burgers’ Equation (1) with the initial condition  ,0=, 01,wxf xx (2) and the boundary conditions  120,=, 0,0,=, 0,wt gttTwt gttT (4) where >0d is a coefficient of viscous diffusion and f, 1g and 2g are the sufficiently smooth given func- tions. Several researchers have successfully used Burgers’ equation to develop new algorithms and to test various existing algorithms. In most of the cases researchers used Hopf-Cole [5,6] transformation to linearize the Burgers’ equations into parabolic partial differential equation. Some of the researchers also tried to tackle the nonlinear Burgers’ equation directly (without Hopf-Cole). Kadal- bajoo et al.  applied Crank-Nicolson finite difference method to the linearized Burgers’ equation by Hopf-Cole transformation which is unconditionally stable and is second order convergent in both space and time with no restriction on mesh size. Gorguis  applied the Adomian decomposition method on the Burgers’ equation directly and compared the numerical result with the analytical result. In another result due to Kutluay et al.  a direct approach via least square quadratic B-spline finite element method is discussed. Recently Pandey et al.  discussed Douglas finite difference scheme on linearized Burgers’ equation which is fourth order convergent in space and second order convergent in time. In this paper we first apply Crank-Nicolson finite difference scheme directly on the nonlinear Equation (1) and derive a nonlinear finite difference scheme, and then use it to derive a system of linear equations which we K. PANDEY ET AL. 884 solve by using Mathematica (version 7.0). For two test problems we compare the absolute error of the numerical solutions to the absolute error of the numerical results established by Kadalbajoo et al.  and Pandey et al. . For the third test problem we compare our numerical results with the analytical solution. The exact solution for the third problem is calculated on Mathematica (version 7.0). In this paper we show that it is more appropriate to consider the Burgers’ equation directly than reducing it into linear parabolic problem and then discretize it. Therefore this paper is an improvement over the results in  and . This paper is divided in 4 sections. In Section 2 we give expression for exact solution by Hopf-Cole transfor- mation which is used to calculate the exact solutions. In the same section we collocate and discretize to get a nonlinear finite difference equation and then through a simple approximation we deduce linear finite difference equation. In Section 3 we give three examples and in Section 4 we demonstrate properties of the computed numerical solutions in the form of Tables 1-11 and Figures 1-4. 2. Description of the Method 2.1. Exact Solution Hopf and Cole [5,6] suggested that (1) can be reduced to linear heat equation by the non-linear transformation. Let =logd, (5) and =.xw (6) Putting in (1) we get 21=22dtx .xx (7) Next applying the transformation (5) we get =2dt.xx (8) The fourier series solution to the linearized heat equa- tion is 220=1π,= expcosπ2dnnntxtA Anx (9) with fourier coefficients at as =0t 10010=d,=2cosπd,nAExxAExnx x (11) where 0=,ww 001=exp dxdEx w. Using the Hopf-Cole transformation we have the exact solution  =10=1sin π,=πcos πnnndnnnAHtn nxwxtAAHtn x (12) where 22π=exp2dnntHt. 2.2. Discretization First of all we divide the solution space into a uniform mesh. For this we divide the interval 0, 1 into equal subintervals and divide the interval N0, T into M equal subintervals. Let =1hN be the mesh width in space and =ixih for . Let =1 1iN=kTM be the mesh width in time and for =jtjk=0 1jM. Now Collocating the Burgers’ Equation (1) we get  22,,,21=22=11, =0 1.ijij ijdwwwtx xiNjM , (13) where ,=,ijijwwxt. The Crank-Nicolson method [11,12] gives the following system of nonlinear equations, 2,1 ,,1 ,,1 ,22122=.22ij ijijijx xij ijdxwwkww hwwkh  (14) where x and x are central difference operator and averaging operator respectively. To linearize we put ,1 ,ij ij,jv=wwi into (14) where ,,1=ij ijijvw w, and neglecting 2,ijOv we get 1, 1,,1, 1,1, 1,,1, 1,11422 214221=24124ddij ijijdij ijdij ijdijdij ijrswvrrsw vrrwwrwrswwv    (15) where =skh and 2=rkh. 3. Numerical Results and Discussions 0 and In this section we demonstrate the accuracy of the Copyright © 2011 SciRes. AM K. PANDEY ET AL.885 present method by solving three test problems and compare the results with the two existing results. The computations are performed using Mathematica 7.0 and Origin 7.5. 3.1. Problem 1 Consider Equation (1) with boundary conditions and initial condition as  0,=1,=0, >0,wtwtt (16) ,0 =sinπ,wx x (17) where 2d is the coefficient of kinematic viscosity. We substitute ,= dxwxt (18) in Equation (1) and get =, 0<<1, >2dtxxxt0 with initial condition  1,0=exp1cos π, 0<<1.πdxxx (19) and boundary condition  0,=1,=0, >0.xxttt The exact solution of the Burgers’ Equation (1) is (12) with given Fourier coefficients: 100101=exp1cosπd,π1=2exp1cos πcosπd.πdndAxxAxnxx 3.2. Problem 2 As a second example consider (1) with the boundary conditions (16) and initial condition  ,0=41 , 0<<1.wxxxx (20) The exact solution (12) can be obtained in the similar fashion as in Problem 3.1 with the Fourier coefficients as follows : 21002102=exp32 d,32=2 exp3 2cosπd.3dndxAxxxAxnxx 3.3. Problem 3 Consider Equation (1) with boundary conditions (16) and initial condition 2πsinπ,0=, 0<<1.2cosπxwx xx (21) The exact solution can be calculated by using the formula (12) where 2/1002/102cosπ=d, 22cosπ=2cos πd.2ddnxAxxAnxx (22) 4. Conclusions We present Crank-Nicolson finite difference scheme for Burgers’ equation without Hopf-Cole transformation. We claim that it is better to solve the nonlinear Burgers’ equation directly, i.e., without reducing it to linear heat equation by Hopf-Cole transformation. Our claim is very well supported by the Tables 1 -10 and Graphs 1-3. From Table 11 and Graph 4 it is also proved that numerical results are in good agreement with the analytical solution. The exact solution for the Problem 3.3 is calculated by using Mathematica 7.0. Figure 4 also depicts the physical behavior of the solutions and thus behavior of any physical system governed by Burgers’ equation can be studied by this method. 4.1. Tables Computed results are displayed in Tables 1 to 11 at different nodal points for different values of viscosity. In Tables 1 to 6 we compare the absolute error with the absolute error of [7,10] for the Problem 3.1. From Table 7 to Table 10 absolute error is compared to the absolute Table 1. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.1 at T = 0.01, for vd = 20 and K = 0.0001 for N = 40. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.1 5.78801E–05 6E–05 0.00016 0.2 0.000109996 0.00011 0.00031 0.3 0.000151182 0.00016 0.00044 0.4 0.000177403 0.00019 0.00051 0.5 0.000186149 0.0002 0.00054 0.6 0.000176667 0.00019 0.00051 0.7 0.000149991 0.00016 0.00044 0.8 0.000108805 0.00011 0.00031 0.9 5.71442E–05 6E–05 0.00016 Copyright © 2011 SciRes. AM K. PANDEY ET AL. 886 Table 2. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.1 at T = 0.01, for vd = 20 and K = 0.0001 for N = 80. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.1 1.37807E–05 1E–05 7E–05 0.2 2.61869E–05 3E–05 0.00014 0.3 3.59876E–05 5E–05 0.00021 0.4 4.22225E–05 5E–05 0.00024 0.5 4.42961E–05 6E–05 0.00025 0.6 4.20319E–05 5E–05 0.00024 0.7 3.56792E–05 5E–05 0.00021 0.8 2.58784E–05 3E–05 0.00014 0.9 0.00001359 1E–05 8E-05 Table 3. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.1 at T = 0.1, for vd = 2 and K = 0.001 for N = 40. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al. 0.1 6.10384E–05 6E–05 0.00016 0.2 0.0001156 0.00011 0.0003 0.3 0.000157849 0.00016 0.00042 0.4 0.00018329 0.00018 0.0005 0.5 0.000189452 0.0002 0.00054 0.6 0.000176365 0.00019 0.00052 0.7 0.000146518 0.00017 0.00045 0.8 0.000104112 0.00048 0.00033 0.9 5.38605E–05 0.00026 0.00018 Table 4. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.1 at T = 0.1, for vd = 2 and K = 0.001 for N = 80. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.1 1.45914E–05 2E–05 7E–05 0.2 2.76247E–05 3E–05 0.00014 0.3 3.76962E–05 4E–05 0.0002 0.4 4.37257E–05 4E–05 0.00023 0.5 4.51272E–05 5E–05 0.00025 0.6 4.19278E–05 5E–05 0.00024 0.7 3.47543E–05 5E–05 0.00021 0.8 0.000024642 3E–05 0.00016 0.9 1.27275E–05 2E–05 8E–05 Table 5. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.1 for vd = 20, K = 0.01, N = 80 at different times. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.4 5.9E–05 8.00E–05 0.00023 0.6 4.4E–05 5.00E–05 0.00016 1 4E–05 2.00E–05 8E–05 3 1.48E–05 0 1E–05 0.4 0.000118 8.00E–05 0.00029 0.6 9.5E–05 7.00E–05 0.00024 1 7.1E–05 4.00E–05 0.00015 3 2.39E–05 1.00E–05 2E–05 0.4 3.7E–05 4.00E–05 0.00021 0.6 7.5E–05 6.00E–05 0.00021 1 7.2E–05 3.00E–05 0.00015 3 0.0010165 0.00101 0.0002 Table 6. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.1 for vd = 0.02, K = 0.01, N = 80 at different times. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.4 7.2E–05 0.00038 0.00076 0.6 5E–05 6E–05 0.00012 1 2.7E–05 2E–05 0.00013 3 8E–06 0 6E–05 0.4 0.000167 0.00726 0.01517 0.6 0.000106 0.00269 0.00736 1 5.2E–05 0.00058 0.00229 3 7E–06 0 4E-05 0.4 0.000384 0.02654 0.04398 0.6 0.000234 0.01 0.02528 1 9.6E–05 0.00228 0.0093 3 3.3E–05 0 0.00047 Table 7. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.2 at T = 0.1, for vd = 2 and K = 0.001 for N = 40. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al. 0.1 6.34389E–05 6E–05 0.00012 0.2 0.000119993 0.00011 0.00023 0.3 0.000163549 0.00016 0.00032 0.4 0.00018952 0.00019 0.00037 0.5 0.000195514 0.0002 0.00039 0.6 0.000181726 0.0002 0.00038 0.7 0.000150809 0.00017 0.00033 0.8 0.000107093 0.00012 0.00024 0.9 5.53858E–05 7E–05 0.00013 Copyright © 2011 SciRes. AM K. PANDEY ET AL.887 Table 8. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.2 at T = 0.1, for vd = 2 and K = 0.001 for N = 80. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al. 0.1 0.000015144 1E–05 3E–05 0.2 2.86478E–05 3E–05 6E–05 0.3 3.90448E–05 5E–05 9E–05 0.4 4.52233E–05 5E–05 9E–05 0.5 0.000046599 5E–05 1E–04 0.6 4.32271E–05 5E–05 1E–04 0.7 3.57791E–05 5E–05 9E–05 0.8 2.53375E–05 3E–05 6E–05 0.9 1.30758E–05 2E–05 3E–05 Table 9. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.2 for vd = 0.2, K = 0.01, N = 80 at different times. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.4 6.3E–05 9E–05 0.00017 0.6 4.6E–05 5E–05 0.00011 1 3.5E–05 2E–05 6E–05 3 1.16E–05 0 1E–05 0.4 0.000118 8E–05 0.00013 0.6 0.000101 7E–05 0.00012 1 8.1E–05 3E–05 8E–05 3 2.46E–05 1E–05 1E–05 0.4 3.6E–05 4E–05 8E–05 0.6 7.1E–05 7E–05 3E–05 1 6.8E–05 4E–05 6E–05 3 1.45E–05 0 1E–05 Table 10. Comparison of the absolute error with the absolute error of [7,10] for Problem 3.2 for vd = 0.02, K = 0.01, N = 80 at different times. x/Error Without Hopf-Cole Kadalbajoo et al. Pandey et al.0.4 0.00012 0.00047 0.00113 0.6 8.6E–05 8E–05 0.00024 1 4.9E–05 2E–05 0.00011 3 1.21E–05 0 6E–05 0.4 0.000167 0.00818 0.0172 0.6 0.000128 0.00293 0.00839 1 7.7E–05 0.00059 0.00258 3 1.6E–05 0 5E–05 0.4 0.000286 0.0289 0.04617 0.6 0.000212 0.011 0.02718 1 0.000109 0.00238 0.0101 3 4.4E–05 4E–05 0.0005 Table 11. Comparison of the numerical solution with the exact solution for Problem 3.3 at different space points at T = 0.01, for vd = 20 and K = 0.0001 for different values of N. x=10N=20N=40N =80N Exact 0.10.368710.377309 0.370262 0.370173 0.3701410.2 0.705991 0.720825 0.708758 0.708574 0.708510.3 0.9818120.998880.985219 0.984931 0.9848340.41.16936 1.18429 1.17275 1.17236 1.172240.51.24751 1.25697 1.25035 1.24988 1.249730.61.20385 1.20667 1.20583 1.20532 1.205170.71.03763 1.0351 1.03875 1.03827 1.038130.8 0.761828 0.757042 0.762304 0.761929 0.7618180.9 0.403226 0.399692 0.403361 0.403154 0.403094 (a) (b) Figure 1. Absolute errors of Problem 3.1 at different times for vd = 20 and K = 0.0001, (a) N = 40, (b), N = 80. Copyright © 2011 SciRes. AM K. PANDEY ET AL. Copyright © 2011 SciRes. AM 888 (a) (b) Figure 2. Absolute errors of Problem 3.1 at different times for vd = 2 and K = 0.001, (a) N = 40, (b) N = 80. (a) (b) Figure 3. Absolute errors of Problem 3.2 at different times for vd = 2 and K = 0.001, (a) N = 40, (b) N = 80. (a) (b) Figure 4. Numerical solutions of Problem 3.3 at different times for vd = 2 and K = 0.001, (a) N = 40, (b) N = 80. K. PANDEY ET AL. Copyright © 2011 SciRes. AM 889 error of [7,10] for the Problem 3.2. In Table 11 for Problem 3.3 we compare the numerical solution to the exact solution and it is observed that computed result shows greater agreement with the exact solution as the mesh size is refined. 4.2. Figures In Figures 1 and 2 we compare the absolute error with the absolute error of  for Problem 3.1 and in Figure 3 we compare the absolute error with the absolute error of  for Problem 3.2. Finally in Figure 4 we compare the exact solution with the numerical solution for Problem 3.3. 5. References  N. Su, J. P. C. Watt, K. W. Vincent, M. E. Close and R. Mao, “Analysis of Turbulent Flow Patterns of Soil Water under Field Conditions Using Burgers’ Equation and Po-rous Suction-Cup Samplers,” Australian Journal of Soil Research, Vol. 42, No. 1, 2004, pp. 9-16. doi:10.1071/SR02142  N. J. Zabusky and M. D. Kruskal, “Interaction of Solitons in a Collisionless Plasma and the Recurrence of Initial States,” Physical Revi ew, Vol. 15, No. 6, 1965, pp. 240-243. doi:10.1088/0305-4470/33/18/308  P. F. Zhao and M. Z. Qin, “Multisymplectic Geometry and Multisymplectic Preissmann Scheme for the Kdv Equation,” Journal of Physics A, Vol. 33, No. 18, 2000, pp. 3613-3626.  H. Brezis and F. Browder, “Partial Differential Equations in the 20th Century,” Advances in Mathematics, Vol. 135, No. 1, 1998, pp. 76-144. doi:10.1006/aima.1997.1713  J. D. Cole, “On a Quasilinear Parabolic Equation Occur-ring in Aerodynamics,” Quarterly of Applied Mathemat-ics, Vol. 9, 1951, pp. 225-236.  E. Hopf, “The Partial Differential Eqaution ut + uux= vuxx,” Communication s on Pure and Applied Mathematics, Vol. 3, 1950, pp. 201-230. doi:10.1002/cpa.3160030302  M. K. Kadalbajoo and A. Awasthi, “A Numerical Method Based on Crank-Nicolson Scheme for Burgers’ Equa-tion,” Applied Mathematics and Computation, Vol. 182, No. 2, 2006, pp. 1430-1442. doi:10.1016/j.amc.2006.05.030  A. Gorguis, “A Comparison between Cole-Hopf Trans-formation and Decomposition Method for Solving Bur-gers’ Equations,” Applied Mathematics and Computation, Vol. 173, No. 1, 2006, pp. 126-136. doi:10.1016/j.amc.2005.02.045  S. Kutluay, A. Esen and I. Dag, “Numerical Solutions of the Burgers’ Equation by the Least—Squares Quadratic B-Spline Finite Element Method,” Journal of Computa-tional and Applied Mathematics, Vol. 167, No. 1, 2004, pp. 21-33. doi:10.1016/j.cam.2003.09.043  K. Pandey, L. Verma and A. K. Verma, “On a Finite Difference Scheme for Burgers’ Equation,” Applied Mathematics and Computation, Vol. 215, No. 6, 2009, pp. 2206-2214. doi:10.1016/j.amc.2009.08.018  M. K. Jain, “Numerical Solution of Differential Equa-tions,” New Age International (P) Limited, New Delhi, 1984.  G. D. Smith, “Numerical Solution of Partial Differential Equations,” Oxford University Press, Oxford, 1978.