Numerical Solution of Convection-Diffusion Equation Using Cubic B-Splines Collocation Methods With Neumann's Boundary Conditions
Numerical Solution of Convection-Diffusion Equation Using Cubic B-Splines Collocation Methods With Neumann's Boundary Conditions
Numerical Solution of Convection-Diffusion Equation Using Cubic B-Splines Collocation Methods With Neumann's Boundary Conditions
in/ijamc
ISSN: 0974 - 4665 (Print) 0974 - 4673 (Online) Volume 4(2) 2012 115127
ABSTRACT
In this paper, two numerical methods are proposed to approximate the solutions of the convection-diffusion partial dif-
ferential equations with Neumanns boundary conditions. The methods are based on collocation of cubic B-splines over
finite elements so that we have continuity of the dependent variable and its first two derivatives throughout the solution
range. In Method-I, we discretize the time derivative with Crank Nicolson scheme and handle spatial derivatives with cubic
B-splines. Stability of this method has been discussed and shown that it is unconditionally stable. In Method-II, we apply
cubic B-splines for spatial variable and derivatives which produce a system of first order ordinary differential equations.
We solve this system by using SSP-RK54 scheme. These methods needs less storage space that causes to less accumulation
of numerical errors. In numerical test problems, the performance of these methods is shown by computing L and L2
errors for different time levels. Illustrative five examples are included to demonstrate the validity and applicability of
these methods. Results shown by these methods are found to be in good agreement with the exact solutions. Easy and
economical implementation is the strength of these methods.
Keywords: Convection-diffusion partial differential equation; Neumanns boundary conditions; cubic B-splines
basis functions; SSP-RK54 scheme; Thomas algorithm
c 2012 Darbose. All rights reserved.
1. Introduction
In this paper, we consider the numerical solution of the following one dimensional convection-diffusion
equation
u u 2u
+ = 2, 0 x L, 0 t T (1.1)
t x x
with initial condition
115
116 Int. J. of Applied Mathematics and Computation, 4(2), 2012
where the parameter is the viscosity coefficient and is the phase speed and both are assumed to be
positive. ,g0 and g1 are known functions of sufficient smoothness.
The convection-diffusion problems arise in many important applications in science and engineering
such as fluid motion, heat transfer, astrophysics, oceanography, meteorology, semiconductors, hydraulics,
pollutant and sediment transport, and chemical engineering.
In literature, various numerical techniques such as finite differences, finite elements, spectral proce-
dures, and the method of lines have been developed and compared for solving the one dimensional
convection-diffusion equation with Dirichlets boundary conditions [16, 811, 1315]. Most of these tech-
niques are based on the two-level finite difference approximations. However, fewer difference schemes
have been developed to solve the convection-diffusion equation with Neumanns boundary conditions,
which are much more difficult to handle than Dirichlet conditions. In [7], Cao et. al developed a fourth-
order compact finite difference scheme for solving the convection-diffusion equations with Neumanns
boundary conditions.
In this paper, two numerical methods are developed to approximate the solutions of the convection-
diffusion partial differential equations with Neumanns boundary conditions using cubic B-splines colloca-
tion methods. It is well known that B-spline collocation methods produce better numerical approximation
in comparison to finite difference method. The finite difference solution is available only at predetermined
nodal points. The solution at any other point must be obtained by interpolation. On the other hand
from the cubic B-spline collocation method solutions can be given in terms of cubic B-splines defined
over the whole interval [0, L]. Thus, the solution is known at least in principle at every point in [0, L].
In this work, it is aimed to effectively employ the collocation methods for solving convection-diffusion
equation with Neumanns boundary conditions which are often encountered in engineering applications
[7, 16]. It should be noted that the zero or constant Neumanns conditions (zero or constant flux on
the boundary) are typical requirement to describe the actual processes in mathematical modeling. In
Method-I, for solving equations (1.1)- (1.3), we discretize the time derivative by using Crank Nicolson
scheme,then solve it by using collocation method which is based on cubic B-splines. We know that
B-splines have mainly two main features which are useful in numerical work. One feature is that the
continuity conditions are inherent. Hence, B-spline is the smoothest interpolating function compared
with other piecewise polynomial interpolating functions. Another feature of B-splines is that they have
small local support, i.e. each B-spline function is only non-zero over a few mesh subintervals, so that the
resulting matrix for the discretization equation is tightly banded which is very attractive for practical
engineering problems. Due to their smoothness and capability to handle local phenomena, B-splines offer
distinct advantages. In combination with collocation, this significantly simplifies the solution procedure
of differential equations. We prove the stability of Method-I by using von Neumann stability scheme
[12] and show that the Method-I, is unconditionally stable. In Method-II, we use cubic B-splines basis
functions for spatial variable and derivatives then the resulting system of differential equations are solved
by using SSP-RK54 scheme [11].
This paper is organized as follows. In Section 2, description of cubic B-splines collocation method
is explained. In Sections 3, procedure for implementation of Method-I is describe for equation (1.1)
and in Section 4, stability of this method is discussed by applying von-Neumann stability method.
In Section 5, procedure to obtain initial vector which is required to start Method-I is explained. In
Section 6, implementation of Method-II is discussed. We present five numerical examples to establish the
applicability and accuracy of the proposed methods computationally in Section 7. The final conclusion
is given in Section 8 that briefly summarizes the numerical outcomes.
In cubic B-splines collocation method the approximate solution can be written as a linear combination
of cubic B-splines basis functions for the approximation space under consideration.
Darbose
Int. J. of Applied Mathematics and Computation, 4(2), 2012 117
N
X +1
U N (x, t) = j (t)Bj (x) (2.1)
j=1
where j (t) are unknown time dependent quantities to be determined from the boundary conditions and
collocation from the differential equation. The cubic B-splines Bj (x) at the knots is given by
(x xj2 )3 , x [xj2 , xj1 )
3 3
(x xj2 ) 4(x xj1 ) , x [xj1 , xj )
1
Bj (x) = 3 (xj+2 x)3 4(xj+1 x)3 , x [xj , xj+1 ) (2.2)
h
(xj+2 x)3 ,
x [xj+1 , xj+2 )
0, otherwise
Uj = j1 + 4j + j+1
0
hUj = 3(j+1 j1 ) (2.3)
00
2
h Uj = 6(j1 2j + j+1 )
Using (2.1) and the boundary condition (1.3), we get the approximate solution at the boundary points
as
1
X 0
Ux (x0 , t) = j (t)Bj (x0 )
j=1
(2.4)
N +1
X 0
Ux (xN , t) = j (t)Bj (xN )
j=N 1
Darbose
118 Int. J. of Applied Mathematics and Computation, 4(2), 2012
h
1 1 = g0 (t)
3 (2.5)
h
N +1 N 1 = g1 (t)
3
3. Implementation of Method-I
First, discretizing the time derivative in the usual finite difference way and applying Crank-Nicolson
scheme to space derivative in (1.1), we get
t n+1 t t t
= un+1 + u un+1 = un unx + unxx (3.2)
2 x 2 xx 2 2
Now, using (2.1) in (3.2), we get
N +1 N +1 N +1
X t X n+1 0 t X n+1 00
jn+1 (t)Bj (x) + j (t)Bj (x) j (t)Bj (x)
j=1
2 j=1 2 j=1
(3.3)
N +1 N +1 N +1
X t X n 0 t X n 00
= jn (t)Bj (x) j (t)Bj (x) + j (t)Bj (x)
j=1
2 j=1 2 j=1
An+1 = Bn + b (3.4)
where
y x+z q p+r
x y x p q p
A= ,B =
x y x p q p
x+z y p+r q
n+1 n
b0 0 0
0 1n+1 1n
n+1 n
b = ,
=
, =
n+1 n
0 N 1
N 1
n+1 n
bN N N
Darbose
Int. J. of Applied Mathematics and Computation, 4(2), 2012 119
3 k k k 3 k k
x = 1 ( ) 3( 2 ), y = 4 + 6( 2 ), z = 1 + ( ) 3( 2 )
2 h h h 2 h h
3 k k k 3 k k
p = 1 + ( ) + 3( 2 ), q = 4 6( 2 ), r = 1 ( ) + 3( 2 )
2 h h h 2 h h
h h
b0 = [xg1 (tn+1 ) pg1 (tn )], bN = [zg2 (tn+1 ) + rg2 (tn )],
3 3
Here A and B are (N + 1) (N + 1) tri-diagonal matrices and b is an (N + 1) order column vector,
which depends on the boundary conditions. The time evolution of the approximate solution U N (x, t) is
determined by vector n . This is found by repeatedly solving the recurrence relationship once the initial
vector 0 has been computed from the initial conditions. The matrix A in (3.4) is tri-diagonal and so
the system (3.4)can be solved using Thomas algorithm.
We have investigated stability of the proposed method by applying von-Neumann stability method.
For testing stability, we consider the equation
n+1
xj1 + yjn+1 + zj+1
n+1 n
= pj1 + qjn + rj+1
n
(4.1)
jn = n exp(ijh) (4.2)
where i = (1), is the mode number and h is the element size. Now, by substituting
jn = n exp(ijh)
p exp(ih) + q + r exp(ih)
= (4.3)
x exp(ih) + y + z exp(ih)
Now, substituting the values of x, y, z, p, q and r from (3.4) in (4.3) and simplifying, we get
k k
[2(cos h + 2) 6(2
)(1 cos h)] i[3( ) sin h]
= h h (4.4)
k k
[2(cos h + 2) + 6( 2 )(1 cos h)] + i[3( ) sin h]
h h
X1 iY
= (4.5)
X2 + iY
where
Darbose
120 Int. J. of Applied Mathematics and Computation, 4(2), 2012
k
X1 = 2(cos h + 2) 6( )(1 cos h)
h2
k
X2 = 2(cos h + 2) + 6( 2 )(1 cos h)
h
k
Y = 3( ) sin h
h
k h
Now substitute = 2
, = ,Peclet number(Pe ) = and = cos h, in (4.4), we get
h
[2( + 2) 6(1 )] i[3Pe (1 2 )]
=
[2( + 2) + 6(1 )] + i[3Pe (1 2 )]
Since numerator in (4.6) is less than denominator, therefore || 1, hence the method is uncondition-
ally stable. It means that there is no restriction on the grid size, i.e. on h and t, but we should choose
them in such a way that the accuracy of the scheme is not degraded.
The initial vector 0 can be obtained from the initial condition and boundary values of the derivatives
of the initial condition as the following expressions:
0
Ux (xj , 0) = (xj ), j = 0,
U (xj , 0) = (xj ), j = 1, . . . , N 1,
0
Ux (xj , 0) = (xj ), j = N.
A0 = b (5.1)
h 0
42
0
0 (x 0 ) + (x )
0
3
1 4 1 10
(x 1 )
0
A= , = andb =
0
1 4 1 N 1 (xN 1 )
0 h 0
24 N
(xN ) (xN )
3
The solution of (5.1) can be found by Thomas algorithm.
Darbose
Int. J. of Applied Mathematics and Computation, 4(2), 2012 121
6. Implementation of Method-II
Our numerical treatment for solving equation (1.1) using the collocation method with cubic B-splines
is to find an approximate solution U N (x, t) to the exact solution u(x, t) is given in (2.1), where j (t)
are time dependent quantities to be determined from the boundary conditions and collocation from the
differential equation.
Using (2.1) in (1.1), we have
N +1 N +1 N +1
X X 0 X 00
j Bj (x) = j Bj (x) + j Bj (x) (6.1)
j=1 j=1 j=1
Using approximate function (2.1) and cubic B-splines functions (2.2), the approximate values of UtN (x)
N
and two derivatives of U (x) at the knots/nodes are determined in terms of the time parameters j as
follows:
(Ut )j = j1 + 4j + j+1
0
hUj = 3(j+1 j1 ) (6.2)
00
2
h Uj = 6(j1 2j + j+1 )
h
1 1
= g (t)
3 0 (6.3)
h
N +1 N 1 = g1 (t)
3
Using (2.4), (6.2) and (6.3) in (6.1) we get a system of ordinary differential equations of the form
A = B + b (6.4)
where
42 q p+r
1 4 1 p q p
A=
,B =
1 4 1 p q p
24 p+r q
b0 0 0
0 1 1
b = , =
, =
0 N 1 N 1
bN N N
Darbose
122 Int. J. of Applied Mathematics and Computation, 4(2), 2012
3 6 12 3 6
p= + 2,q = ,p = + 2,
h h h2 h h
h h
b0 = (pg0n + g0 n+1 ), bN = (rg1n g1 n+1 )
3 3
Here A and B are (N + 1) (N + 1) tri-diagonal matrices and b is an (N + 1) order column vector,
which depends on the boundary conditions.
Now, we solve the first order ordinary differential equation system (6.4) by using SSP-RK54 scheme
[11]. Here, the parameter has been determined at an initial time level, to follow the procedure as given
in Section 5.
In this section, we present the numerical results of present method on several problems. We tested
the accuracy and stability of this method for different values of h, t, and .
To gain insight into the performance of the presented methods, five numerical examples are given in
this section with L and L2 errors ,which are obtained by following formulae:
L = max |uexact
j Ujnum |
v !
u N
u X 2
L2 = h
t uexact num
Uj
j
0
u u 2u
+ = 2 , 0 x 1, 0 t T
t x x
with = 0.1, = 0.02 and the following initial condition (x) = exp (x), and boundary conditions are
u u
( )(0,t) = exp (t), ( )(1,t) = exp ( + t).
t t
The exact solution is given by u(x, t) = exp (x + t).
In our computation, we take = 0.1, = 0.02, = 1.17712434446770, = 0.09, h = 0.1, k = 0.01,
so that Cr = 0.01, s = 0.02, Pe = 0.5. The results are computed for different time levels. The L and
Darbose
Int. J. of Applied Mathematics and Computation, 4(2), 2012 123
L2 errors are reported in Table-2. The computed errors obtained from Method-I and Method-II are
approximately similar. Hence, both methods can apply for solving this problem for different time levels.
u u 2u
+ = 2 , 0 x 1, 0 t T
t x x
with = 3.5, = 0.022 and the following initial condition (x) = exp (x), and boundary conditions
u u
are ( )(0,t) = exp (t), ( )(1,t) = exp ( + t).
t t
The exact solution is given by u(x, t) = exp (x + t).
In our computation, we take = 3.5, = 0.022, = 0.02854797991928, = 0.0999, h = 0.1, k = 0.01,
so that Cr = 0.35, s = 0.022, Pe = 15.90909091. The results are computed for different time levels. The
L and L2 errors are reported in Table-3. In this problem, the results obtained from Method-I, are
more accurate in comparison to Method-II. We observe that both methods work well for higher value of
Pe = 15.90909091 for a long time T = 20.
Example 3 We consider the following equation [7]
u u 2u
+ = 2 , 0 x 1, 0 t T
t x x
with initial condition (x) = a exp (cx), and boundary conditions are
Darbose
124 Int. J. of Applied Mathematics and Computation, 4(2), 2012
u u + (2 + 4b)
( )(0,t) = ac exp (bt), ( )(1,t) = ac exp (bt c), where c = .
t t 2
The exact solution is given by u(x, t) = a exp(bt cx).
In our computation, we take = 1.0, = 0.001, a = 1.0, b = 0.1, h = 0.1, k = 0.001, so that Cr =
0.01, s = 0.0001, Pe = 100. The results are computed for different time levels. The L and L2 errors are
reported in Table-4. The results obtained from Method-I, are more accurate in comparison to Method-II.
In [7], Huai-Huo Cao et. al computed L2 error with h = 0.1 and k = 0.0001 was 3.34E 09 at T = 1.0.
Hence, Method-I, produce more accurate result than [7] with h = 0.1 and k = 0.001. In Fig-1, Numerical
solutions at t = 1.0 are also depicted graphically which is similar to [7]. Both presented methods work
well for higher value of Pe = 100 for a long time T = 20.
u u 2u
+ = 2 , 0 x 2, 0 t 2
t x x
with initial condition (x) = sin(x), and boundary conditions are
u u
( )(0,t) = exp (t) cos(t), ( )(2,t) = exp (t) cos(2 t).
t t
Darbose
Int. J. of Applied Mathematics and Computation, 4(2), 2012 125
In our computation, we take = 1.0, = 0.1, h = 0.1, k = 0.01, so that Cr = 0.1, s = 0.1, Pe = 1.
The results are computed for different time levels. The L and L2 errors are reported in Table-5.The
L and L2 errors obtained from Method-I, are less in comparison to Method-II. In this problem, both
methods work well for small value of Pe = 1 for a long time T = 20. In this problem, numerical results
shown in Huai-Huo Cao et. al [7] are more accurate with h = 0.1 and k = 0.0001.
u u 2u
+ = 2 , 0 x 1, 0 t T
t x x
x2
1
with = 1.0, = 1.0 and the following initial condition (x) = exp 50 , s = 1.0, and bound-
s s
u 100t u 100(1 t)
ary conditions are = u(0, t), = u(1, t).
t (0,t) s t (1,t) s
(x t)2
1
The exact solution is given by u(x, t) = exp 50 , s = (1 + 200t).
s s
In our computation, we take = 1.0, = 1.0, h = 0.1, k = 0.0001, so that Cr = 0.001, s = 0.01, Pe =
0.1. The results are computed for different time levels. The L and L2 errors are reported in Table-
6. The L and L2 errors obtained from Method-I and Method-II are approximately similar. In this
problem, both methods work well for smaller value of Pe = 0.1 at T = 1.
8. Conclusions
In this work, the convection-diffusion equations was dealt by using Method-I in which time derivative
is discretized by using Crank Nicolson scheme and apply cubic B-splines for spatial derivative. The
stability of this method is discussed by using von Neumann stability and shown that it is unconditionally
stable. This method works very well for different values of Peclet number, 0.1 Pe 100 and time
T 20. In Method- II, we apply cubic B-splines for spatial variable and its derivatives, then the
Darbose
126 Int. J. of Applied Mathematics and Computation, 4(2), 2012
resulting system of first order ordinary differential equations are solved by using SSP-RK54 scheme.
Method-II also worked successfully and gives reliable but less accurate solutions. The implementations
of algorithms for these methods are very easy and economical. The accuracy of the numerical solutions
indicates that the presented methods are well suited for convection-diffusion equations with Neumanns
boundary conditions.
Acknowledgements
One of the authors R.K. Jain thankfully acknowledges the sponsorship under QIP, provided by Technical
Education and Training Department, Bhopal (M.P.), India.
References
[1] A. Mohebbi and M. Dehghan, High-order compact solution of the one-dimensional heat and advection-
diffusion equations, Appl. Math. Model. 34(2010) 3071-3084.
[2] D.K. Salkuyeh, On the finite difference approximation to the convection-diffusion equation, Appl. Math.
Comput., 179(2006) 79-86.
[3] H. Karahan, , Unconditional stable explicit finite difference technique for the advection-diffusion equation
using spreadsheets, Adv. Eng. Software 38(2007) 80-86.
[4] H. Karahan, Implicit finite difference techniques for the advection-diffusion equation using spreadsheets,
Adv. Eng. Software 37(2006) 601-608.
[5] H.N.A. Ismail, E.M.E. Elbarbary, G.S.E. Salem, Restrictive Taylors approximation for solving convection-
diffusion equation, Appl. Math. Comput. 147(2004) 355-363.
[6] H.F. Ding and Y.X. Zhang, A new difference scheme with high accuracy and absolute stability for solving
convection-diffusion equations, J. Comput. Appl. Math. 230(2009) 600-606.
[7] Huai-Huo Cao, Li-Bin Liu, Yong Zhang and Sheng-mao Fu, A fourth-order method of the convection-diffusion
equations with Neumann boundary conditions, Appl. Math. Comput. 217(2011) 9133-9141.
[8] M.M. Chawla, M.A. Al-Zanaidi and D.J. Evans, Generalized trapezoidal formulas for convection-diffusion
equations, Int. J. Comput. Math. 72(1999) 141-154.
[9] M.M. Chawla, M.A. Al-Zanaidi and M.G. Al-Aslab, Extended one step time-integration schemes for
convection-diffusion equations, Comput. Math. Appl. 39(2000) 71-84.
[10] M. Dehghan, Weighted finite difference techniques for the one-dimensional advection-diffusion equation,
Appl. Math. Comput. 147(2004) 307-319.
[11] R.J. Spiteri and S.J. Ruuth, A new class of optimal high-order strong-stability-preserving time-stepping
schemes, SIAM J. Numer. Anal. 40 (2002) 469-491.
[12] R.C. Mittal and Geeta Arora, Numerical solution of the coupled viscous Burgers equation, Commun Non-
linear Sci Numer Simulat, 16(2011) 1304-1313.
[13] Rizwan-Uddin, A second-order space and time nodal method for the one-dimensional convection-diffusion
equation, Computers & Fluids 26(3) (1997) 233-247.
[14] S. Karaa and J. Zhang, High order ADI method for solving unsteady convection-diffusion problems, J.
Comput. Phys. 198(2004) 1-9.
Darbose
Int. J. of Applied Mathematics and Computation, 4(2), 2012 127
[15] X.F. Feng and Z.F. Tian, Alternating group explicit method with exponential-type for the diffusion-
convection equation, Int. J. Comput. Math. 83(2006) 765-775.
[16] Weizhong Dai, A new accurate finite difference scheme for Neumann (insulated) boundary condition of heat
condution, International Journal of Thermal Sciences 49(2010) 571-579.
Darbose