M. M. Rahaman
, IJRIT 296
IJRIT International Journal of Research in Information Technology, Volume 1, Issue 12, December, 2013, Pg. 296-305
International Journal of Research in Information Technology (IJRIT)
www.ijrit.com
ISSN 2001-5569Error Analysis for the Numerical Solution of Advection Equation by Finite Difference Method
1M. M. Rahaman, 2G. M. M. Bashir & 3M. N. Rahman
1Muhammad Masudur Rahaman, Assistant Professor, Dept. of Mathematics,
Patuakhali Science and Technology University, Bangladesh, Email:[email protected].
2Golam Md. Muradul Bashir, Assistant Professor, Dept. of Computer and Communication Engineering, Patuakhali Science and Technology University, Bangladesh. Email: [email protected]
3Md Naimur Rahman, Lecturer, Dept. of Electrical and Electronics Engineering, Patuakhali Science and Technology University, Bangladesh, Email:[email protected]
Abstract
In this study an error analysis for numerical solution of advection equation by finite difference methods is done. However, In order to incorporate initial data the model is treated as an initial value problem. To get analytic solution of the model, we apply the characteristics method. We derive a first order explicit finite difference scheme of the IVP. The numerical scheme is implemented in order to perform the numerical features of error estimation. Moreover, a comparison between explicit upwind difference scheme, explicit centered difference scheme and Lax-Friedrichs scheme is projected herein with a variety of numerical results and relative errors.
Keywords: Finite difference scheme, advection equation, Initial value problem (IVP), Analytic solution, Relative error.
1. Introduction
The aim of this paper is to study the numerical solution of the governing equation treated as Advection equation by the finite difference method. In section 2, we consider first order linear advection equation with initial value problem as the Governing equation based on [1], [2], [4]. In section 3, we represent analytical solution of Advection equation (linear PDE) by the method of characteristics based on [1], [6]. Based on the study of the general finite difference method for first order linear PDE [1], [3], [4], [7], [8], [12], we establish the stability condition of the numerical scheme in section 4. In section 5, to implement the numerical scheme we develop a computer program in scientific programming language. We also present relative errors of the numerical methods to determine the accuracy of numerical methods. Finally the conclusions of the paper are given in the last section.
M. M. Rahaman
, IJRIT 297 2. Governing equation
In this study we consider the Advection equation as an initial value problem
= 0
∂ + ∂
∂
∂
x u C t
C
(1)With initial condition
C ( 0 , x ) = C
0( x )
Where
u
is constant.3. Analytical solution of Governing equation by the method of characteristics
Method of characteristics is a very important tool for solving linear and non-linear hyperbolic PDE’s as well. In this section we present the method of characteristics for solving a PDE based on [1], [6]. We now consider the linear advection equation.
= 0
∂ + ∂
∂
∂
x u C t
C
(2)With initial condition
C ( 0 , x ) = C
0( x )
whereu
is constant.If we measure the rate of change of C from a moving position given by
x = x ( t )
is then by chain rule,dt dx x C t C dt
dC .
∂ + ∂
∂
= ∂
Let
u dt
dx =
(3)Then
+ = 0
∂
= ∂
dx u dC t C dt
dC
by (2)Confirming that C is constant along these characteristics. An observer moving with this special speed ‘
u
’ would measure no change in C. Now integrating (3) yields.
x = ut + x
0,x ( 0 ) = x
0 (4)This formula defines a family of lines in the
( t x , )
-plane, which are called characteristics. As mentioned above, characteristics have the property thatC ( t x , )
takes a constant value along each one of them.M. M. Rahaman
, IJRIT 298
Hence to find the value of the solutionC
at( t x , )
. We consider the characteristics through( t x , )
of equationx
0ut
x = +
which intersects the x-axis at( x
0, 0 )
. SinceC
is constant on this line, its value at( t x , )
is the same as at( x
0, 0 )
.From the initial condition, we have
C ( x , t ) = C ( x
0, 0 ) = C
0( x
0)
att = 0
C ( x , t ) = C ( x
0, 0 ) = C
0( x
0) = C
0( x − ut )
by (4)This is the solution of the governing equation
4. Numerical solution of the governing equation by the finite difference method
Finite difference techniques for solving the advection equation can be considered according to the number of spatial grid points involved, the number of time levels used, whether they are explicit or implicit in nature.
4.1 Explicit upwind difference scheme
We consider the Advection equation as initial value problem
= 0
∂ + ∂
∂
∂
x u c t
c
,x ∈ ( a , b )
(5)c ( x , 0 ) = c
0( x )
,c ( a , t ) = c
a( t )
Figure 1: Stencil of Explicit upwind difference scheme
Let the solution
c ( x
i, t
n)
be denoted byC
in and its approximate value byc
in.Simple approximations to the first derivative in the time direction can be obtained from
M. M. Rahaman
, IJRIT 299
( )
1
t t o
C C t
c
in in+ ∆
∆
≈ −
∂
∂
+(6)
Discretization of
x c
∂
∂
is obtain from backward difference in spatial derivative.1
o ( x ) x
C C x
c
in in+ ∆
∆
≈ −
∂
∂
−(7)
Substituting (6), (7) into (5), we obtain
1
( ) 0
1
=
∆ +
∆
∆ + + −
∆
−
−+
x t x o
C u C
t C
C
in in in in(8)
The terms
O ( ∆ t + ∆ x )
in (8) denote the order of the method. Neglecting the error terms in (8) and simplifying. We obtain the difference methods1
0
1
∆ = + −
∆
−
−+
x c u c t
c
c
in in in inin 1 in
( c
inc
in1) x
u t c
c
+−
−∆
− ∆
=
c
in+1= ( 1 − γ ) c
in+ γ c
in−1 (9) Substitutingc
mn= A ξ
ne
iβm∆x in (9) and simplifying, we get
ξ = ( 1 − γ ) + γ e
−iβ∆x
ξ
2= ( 1 − γ + γ cos β ∆ x )
2+ γ
2sin
2β ∆ x
= 1 − 4 γ ( 1 − γ ) sin
2θ
ξ
is called the amplification factor andβ
is a real spatial wave number, A is an arbitrary constant.Where
2
∆ x
= β
θ
, Maximizingsin
2θ
, we obtainξ
2= ( 1 − 2 γ )
2Hence
ξ ≤ 1
for0 < γ ≤ 1
, the scheme (9) is stable for0 < γ ≤ 1
.M. M. Rahaman
, IJRIT 300
Now if we choseγ ≤ 1
, then (9) implies that the new solution is an average of the previous values, the extreme value of the solution at the new time lie between the extreme values of the previous solution. This means that the euds is stable when the CFL condition is satisfied.4.2 Explicit centered difference scheme
Figure 2: Stencil of Explicit centered difference scheme
Forward difference in time derivative:
( )
1
t t o
C C t
c
in in+ ∆
∆
= −
∂
∂
+
Centered difference discretization in spatial derivative:
( ) 2
1 2
1
o x
x C C x
c
in in+ ∆
∆
= −
∂
∂
+ −
We obtain the explicit centered difference scheme for linear advection equation is
( )
2
1 11 n
i n i n
i n
i
c c
x u t c
c
+ +−
−∆
− ∆
=
(10)There also is difficulty in determining the solution at the right hand boundary.
Although the numerical domain of dependence for explicit centered difference contains the physical domain of
dependence for
≤ 1
∆
= ∆ x
t
γ u
. Substitutingc
mn= A ξ
ne
iβm∆x in (10) and simplifying, we get
ξ = [ 1 − γ / 2 ( e
iβ∆x− e
−iβ∆x)]
ξ
2= [ 1 + γ
2sin
2β ∆ x ]
= 1 + γ
2
ξ > 1
This scheme is unconditionally unstable
M. M. Rahaman
, IJRIT 301
4.3 Lax Friedrichs scheme/diffusion difference schemeReplacing
t c
∂
∂
by a forward in time approximation and
x c
∂
∂
by a spatial centered approximation, and then we have
0
2
1 1 1
∆ = + −
∆
−
+ −+
x c u c
t c
c
in in in in
( )
2
1 11 n
i n i n
i n
i
c c
x u t c
c
+ +−
−∆
− ∆
=
(11)Unfortunately, despite the quite natural derivation of this method, it suffers from severe stability problem and is useless in practice. Lax-Friedrichs Method is similar to the unstable method (11) but replaces
c
in by) 2 (
1
1 1
n i n
i
c
c
+−
− and is stable providedx t
∆
∆
is sufficiently small. We can write the method in the form
( )
) 2 2 (
1
1 1 1
1
1 n
i n i n
i n i n
i
c c
x u t c c
c
+ + − +−
−∆
− ∆ +
=
(12)Substituting
c
mn= A ξ
ne
iβm∆x in (12) and simplifying, we getξ = [ 1 / 2 ( e
iβ∆x+ e
−iβ∆x) − γ / 2 ( e
iβ∆x− e
−iβ∆x)]
i x
x t
x u ∆
∆
− ∆
∆
= β 2 sin β
cos 2
Lax method stable when
ξ
2≤ 1
cos sin
21
2 2 2
2
∆ ≤
∆ + ∆
∆
⇒ x
x t
x u β
β
u t x
x t u
≤ ∆
∆
⇒
∆ ≥
− ∆
⇒ 1 0
2 2 2
,
u > 0
Courant number
M. M. Rahaman
, IJRIT 302
The scheme is stable for0 < γ ≤ 1
5. Relative Error Estimation
In order to perform error estimation, we consider the exact solution (1) with initial condition
C
0( x ) = 0 . 2 + e
−xwe get
) ( 0
0
( ) 0 . 2
) ,
( t x C x e
x utC = = +
− −)
2
(. 0 )
(
x uta
e
at
C = +
− −)
2
(. 0 )
(
x utb
e
bt
C = +
− −We compute the error defined by
e N e
C C e C −
=
for all time where
C
e is the exact solution andC
N is the Numerical solution computed by the finite difference scheme.
Figure 3: Relative error of ECDS for Advection equation
M. M. Rahaman
, IJRIT 303
Figure 4: Relative error of EUDS for Advection equation
Figure 5: Relative error of Lux-Friedrichs scheme for Advection equation
Figure shows the relative error of three different schemes for advection equation. Figure-3 shows the relative error for ECDS, which remains below 0.000035. Figure -4 shows the relative error for EUDS which remains below
M. M. Rahaman
, IJRIT 304
0.00035. Figure-5 shows the relative error for Lux-friedriches scheme which remains below 0.0035. ECDS provides more accurate results than the EUDS and Lux-friedriches scheme with respect to discretization parameter ∆x.Figure 6: Relative error of ECDS for Advection equation
We have seen from Figure -3 and Figure -6 that the error of ECDS for Advection equation is decreasing with respect to the smaller descretization parameter ∆x. The error is below 0.00008 for ∆x=0.1 and the error is below 0.000035 for ∆x=0.01.
6. Conclusion
In this paper I have discussed the numerical solution of advection equation as an initial value problem. The finite difference method is a powerful tool in solution of Advection problem. We have compared among the three different scheme euds, ecds and lax-friedries for estimating the error in advection equation. The explicit centered difference scheme provides more accurate result than explicit upwind difference scheme and Lax-Friedries scheme. The comparison certifies that the explicit centered difference gives good results.
7. References
[1]. Randall J. LeVeque, Numerical methods for conservation laws, second edition, 1992, Springer.
[2]. Clive L.Dym, Principles of Mathematical Modeling, Academic Press, 2004.
[3]. Mitchell, A., Computational Methods in Partial Differential Equations, Wiley, New York, 1969.
[4]. John A.Trangestein, Numerical Solution of Partial Differential Equation, 2000, Durham.
[5]. L.S.Andallah, Finite Difference Method-Explicit Upwind Difference Scheme, lecturer note, Department of Mathematics, Jahangirnagar University, 2008.
M. M. Rahaman
, IJRIT 305
[6]. Richard Haberman, Mathematical models, Prentice-Hall, Inc., 1977.[7]. M.K.Jain, S.R.K.Iyengar,R.K.Jain,Computational Methods for Partial Differential Equations, Book published by New Age International (p) Ltd, Reprint: 2007.
[8]. M.Thongmoon and R.Mckibbin, A comparison of some numerical methods for the advection diffusion equation, Inf.Math.Sci.2006, Vol.10, pp. 49-52.
[9]. D.V. Widder, The heat equation. Academic Press, 1975.
[10]. Romao, Silva, Moura, “Error analysis in the numerical solution of 3D convection diffusion equation by finite difference methods, Thermal technology, 2009, Vol-08, p. 12-17.
[11]. S.S. Sastry, Finite difference approximations to one dimensional parabolic equations using a cubic spline technique, J.Comp.Appl.Math., 2, 1976.
[12]. G.D Smith, Numerical solutions of Partial Differential Equations: Finite Difference methods, third edition.