Numerical Solution of Diffusion Equation by Finite Difference Method
Numerical Solution of Diffusion Equation by Finite Difference Method
e-ISSN: 2278-5728, p-ISSN: 2319-765X. Volume 11, Issue 6 Ver. IV (Nov. - Dec. 2015), PP 19-25
www.iosrjournals.org
Abstract: In this work error estimation for numerical solution of Diffusion equation by finite difference method
is done. The Explicit centered difference scheme is described to find the numerical approximation of the
Diffusion equation. The numerical scheme is implemented in order to perform the numerical features of error
estimation. To get analytic solution, we present the variable separation method. We develop a computer
program to implement the finite difference method in scientific programming language. An example is used for
comparison; the numerical results are compared with analytical solutions.
Keywords: Analytic solution, Diffusion equation, Finite difference scheme, Initial value problem (IVP),
Relative error.
I.
Introduction
In Mathematics, the finite difference methods are numerical methods for approximating the
solutions to differential equations using finite difference equations to approximate derivatives. Our goal
is to approximate solutions to differential equations.i, e. to find a function (or some discrete
approximation to this functions) which satisfies a given relationship between several of its derivatives
on some given region of space /and or time, along with some boundary conditions along the edges of
this domain. A finite difference method proceeds by replacing the derivatives in the differential equation
by the finite difference approximations. This gives a large algebraic system of equations to be solved in
place of the differential equation, something that is easily solved on a computer.
In (A.N. Richmond, 2006), the authors develop the analytical solutions of nontrivial examples of a
wellknown class of initialboundary value problems which, by the choice of parameters, can be reduced to
regular or singular SturmLiouville problems. In (Sweilam et. al, 2012) the author presents the C-N-FDM to
solve the linear time fractional diffusion equation. They claimed that the C-N-FDM gives good results. The
authors studied the Spectral methods for solving the one dimensional parabolic heat equation (Juan- Gabriel et.
al 2006). In (Hikment Koyunbakan and Emrah Yilmaz, 2010), the Authors claimed that The ADM method is
more accurate. In (Subir et. al, 2011), the authors present the Adomian Decomposition method to solve the
nonlinear diffusion equation with fractional time derivatives. With the above discussion in view, our intention is
to investigate mathematical models, to establish the stability condition of the numerical scheme and to analyze
the error of the scheme.
In section 2, present a short discussion on the derivation of Diffusion equation as IBVP. In section 3,
the analytical solution of diffusion equation is illustrated by variable separation method. We describe an explicit
centered difference scheme for Diffusion equation as an IBVP with two sided boundary conditions in section 4.
In section 4, we also set up the stability condition of the numerical scheme. In section 5, we develop a computer
program in scientific programming language for the implementation of the numerical scheme and perform
numerical simulations in order to verify the behavior for various parameters. Finally the conclusions of the
paper are given in the last section.
II.
c
2c
D
t
x 2
DOI: 10.9790/5728-11641925
www.iosrjournals.org
19 | Page
c(t 0 , x) c0 ( x); a x b
c(t , a) ca (t ); t 0 t T
c(t , b) cb (t )
Consider the equation of mass conservation of the tracer. The continuity equation states that divergence of mass
flux equals change in mass in a control volume.
q
If we assume that
c
t
c
t
Dc
c
t
D 2c
c
t
The diffusion coefficient theoretically is a tensor. However, for most cases, we assume it is a scalar. The
diffusion equation written in the Cartesian coordinate system in a one dimensional.
D
III.
2c
c
2
x
t
c
2c
D 2
t
x
t0 t T
a xb
(1)
Then
c(0, t ) 0 , c( L, t ) 0 , 0 x L
2c
c
c
XT ,
X T and 2 X T .
t
x
x
T
X
DT
X
(2)
T
X
2 (say)
DT
X
DOI: 10.9790/5728-11641925
www.iosrjournals.org
20 | Page
(3)
c(0, t ) 0 , 0 Ae D t
2
Since
A 0 , since e D t 0 .
2
c( x, t ) Be D t sin x
2
(4)
c( L, t ) 0 , 0 Be D t sin L
2
Since
B0
If
the
solution
sin L 0 since B 0 , e D t
2
is
identically
zero,
n
, n 0,1,2,
0
L
so
we
must
have
c( x, t ) Bn e
n 2 2
L2
Dt
sin
n 1
n
x
L
(5)
c( x,0) Bn sin
n 1
n
x
L
2
n
Using Fourier series, Bn c( x,0) sin
xdx
L0
L
L
2
n
c( x, t ) ( c( x,0) sin
xdx )e
L
n 1 L 0
DOI: 10.9790/5728-11641925
n 2 2
L2
Dt
sin
n
x
L
www.iosrjournals.org
(6)
21 | Page
c
2c
D 2 , t0 t T , a x b
t
x
Initial condition c( x,0) c0 , and boundary condition c(0, t ) 0 , c( L, t ) 0
In order to develop the scheme, we discretize the x t plane by choosing a mesh width h x space and a
time step k t . The finite difference methods we will develop produce approximations ci R
n
solution
to the
xi ih
i 0,1,2,3.....
t n nk , n 0,1,2,3.....
Let the solution
Simple approximations to the first derivative in the time direction by forward difference can be obtained from
c Cin 1 Cin
o(t )
t
t
2c
Discretization of
is obtain from second order central difference in space.
x 2
2 c Cin1 2Cin Cin1
o(x 2 )
2
2
x
x
We obtain
Cin 1 Cin
C n 2Cin Cin1
D i 1
o(t x 2 )
2
t
x
The terms o(t x
the difference methods
n 1
=> ci
(7)
) denote the order of the method. Neglecting the error terms and simplifying. We obtain
Dt n
Dt
Dt
c (1 2 2 )cin 2 cin1
2 i 1
x
x
x
(8)
This is the required explicit centered difference scheme for the IBVP
(9)
This scheme uses a second order central difference in space and the first order forward Euler scheme in time.
Where
Dt
1
Note that if 0 , then the solution at the new time is a weighted average of the
2
2
x
solution at the old time .This implies a discrete maximum principle, and therefore numerical stability. It also
implies monotonocity: if
cin1 cin
1
x 2
, or equivalently that t
2
2D
This time step restriction typically requires an unacceptably large number of time steps, unless the diffusion
constant D is very small.
4.1 Stability of the explicit centered difference scheme (8) is given by the conditions 0
DOI: 10.9790/5728-11641925
www.iosrjournals.org
Dt 1
x 2 2
22 | Page
=> ci
Dt n
Dt
Dt
c (1 2 2 )cin 2 cin1
2 i 1
x
x
x
Where
(10)
Dt
x 2
1
, and then the solution at the new time is a weighted average of the
2
solution at the old time. This implies a discrete maximum principle. We can conclude that the explicit centered
difference scheme (10) is stable for
0 D
V.
t
1
2
2
x
In order to perform error estimation, we consider the exact solution of the model equation with initial condition
c( x,0) c0 ( x) x(1 x) and homogeneous boundary condition. We get
2
n
c( x, t ) ( c( x,0) sin
xdx )e
L
n 1 L 0
n 2 2
L2
Dt
sin
n
x
L
e
for all time where
Ce C N
Ce
ce
scheme.
5.1Results And Discussion:
We solve the diffusion equation by implementing the centered difference scheme, while varying the
different parameter values.
www.iosrjournals.org
23 | Page
Figure 2: Analytic solution and Numerical solution at different time Analytical solution of diffusion equation is
compared with the numerical solution at different time in figure-2. The curve noticeable by blue line shows
the numerical solution, the curve visible by red line represents numerical solution. The results are very close.
www.iosrjournals.org
24 | Page
VI. Conclusion:
The study has presented the numerical and analytical solution of Diffusion equation. The explicit
centered difference scheme is used in order to perform the numerical features of error estimation. We have seen
that the contaminant concentration with a higher diffusion rate decreases at a higher rate than that with a lower
diffusion rate. In order to execute the numerical method we have developed a computer program in the language
of scientific computing that is a very good agreement of the finite difference method for Diffusion equation.
Reference
[1].
A.N. Richmond (2006, July), Analytical solution of a class of diffusion problems, International journal of mathematical education
in Science and Technology, Vol.15, issue 5, p. 643-648.
[2].
N. H. Sweilam, M. M. Khader, A. M. S. Mahdy ( 2012, Jan.), Crack Nicolson finite difference method for solving time-fractional
diffusion equation, Journal of Fractional Calculus and Application, Vol. 2, No. 2, pp. 1-9.
[3].
[4].
[5].
[6].
Collatz, L. (1960), The Numerical Treatment of Differential Equation, 3rd ed., Springer- Verlag, Berlin.
Randall J. LeVeque (1992), Numerical methods for conservation laws, Second edition, Springer.
John A.Trangestein (2000), Numerical Solution of Partial Differential Equation, Durham.
L.S.Andallah (2008), Finite Difference Method-Explicit Upwind Difference Scheme, lecturer note, Department of Mathematics,
Jahangirnagar University.
Juan- Gabriel, Barbosa- Saldana, Jose- Alfredo Jimenez Bernal, Claudia (2006), Numerical Solution for the One Dimensional Heat
Equation by a Pseudo Spectral Discretization Technique, Cientifica Vol. 10, No. 1, pp. 3-8, ESIME-IPN, Impreso en Mexico.
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.
Hikment Koyunbakan and Emrah Yilmaz,Numerical Simulation of Diffusion Equation by Means of Hes Variational Iteration
Methods and Adominas Decomposition method , Cankaya University Journal of Science and Engineering, Vol. 7, No. 1, 25-38,
2010.
Subir Das, Praveen Kumer Kupta, Pradyumna Ghosh An Approximate analytic Solution of Non Linear Fractional Diffusion
Equation, International Journal of Nonlinear science, 2011, Vol.12, No.3, pp.339-346.
S.B.Yuste and L.Acedo An explicit finite difference method and a new VonNumann-type stability analysis for fractional diffusion
equations,
2005
society
for
industrial
and
applied
Mathematics,vol.42,
No.
5,
pp.1862-1874.
Gerald W. Rectenwald Finite difference approximations to the heat equation, March 9, 2011.
[7].
[8].
[9].
[10].
[11].
[12].
[13].
[14].
[15].
DOI: 10.9790/5728-11641925
www.iosrjournals.org
25 | Page