Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
142 views

Numerical Solution of Diffusion Equation by Finite Difference Method

IOSR Journal of Mathematics(IOSR-JM) is a double blind peer reviewed International Journal that provides rapid publication (within a month) of articles in all areas of mathemetics and its applications. The journal welcomes publications of high quality papers on theoretical developments and practical applications in mathematics. Original research papers, state-of-the-art reviews, and high quality technical notes are invited for publications.

Uploaded by

IOSRjournal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views

Numerical Solution of Diffusion Equation by Finite Difference Method

IOSR Journal of Mathematics(IOSR-JM) is a double blind peer reviewed International Journal that provides rapid publication (within a month) of articles in all areas of mathemetics and its applications. The journal welcomes publications of high quality papers on theoretical developments and practical applications in mathematics. Original research papers, state-of-the-art reviews, and high quality technical notes are invited for publications.

Uploaded by

IOSRjournal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

IOSR Journal of Mathematics (IOSR-JM)

e-ISSN: 2278-5728, p-ISSN: 2319-765X. Volume 11, Issue 6 Ver. IV (Nov. - Dec. 2015), PP 19-25
www.iosrjournals.org

Numerical Solution of Diffusion Equation by Finite Difference


Method
1

M. M. Rahaman, 2M.M.H. Sikdar,3M. B. Hossain, 4M.A. Rahaman, 5M.Jamal.


Hossain
1,3

Associate Professor, Department of Mathematics, Patuakhali Science and Technology University,


Bangladesh,
2
Associate Professor, Department of Statistics, Patuakhali Scienceand Technology University, Bangladesh
4
Assistant Professor, Department of Computer Science and information Technology, Patuakhali Science and
Technology University, Bangladesh
5
Associate Professor, Department of Computer Science and information Technology, Patuakhali Science and
Technology University, Bangladesh

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.

Governing Equation And Its Derivation:

In this study we consider the governing equation as IBVP

c
2c
D
t
x 2
DOI: 10.9790/5728-11641925

www.iosrjournals.org

19 | Page

Numerical Solution of Diffusion Equation by Finite Difference Method

c is the concentration at the point x at the time


time.
With appropriate initial and boundary condition

t , D is the diffusive constant in the x direction, t is the

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

is constant in time and space, the continuity equation can be written as

c
t

Using Ficks law for q , we have a general Diffusion equation

Dc

c
t

If D is constant, the diffusion equation is given by as

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

Analytical Solution Of The Governing Equation By The Method Of Variable Separation:

Consider c XT be the solution of the diffusion equation

c
2c
D 2
t
x

t0 t T

a xb

(1)

with the homogeneous boundary condition


Initial condition c( x,0) c0 , and boundary condition

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

Now from the given equation, we have

T
X

DT
X

(2)

Each side of (2) must be constant,

T
X

2 (say)
DT
X
DOI: 10.9790/5728-11641925

www.iosrjournals.org

20 | Page

Numerical Solution of Diffusion Equation by Finite Difference Method


Then T D T 0 and X X 0 whose solution are,
2

T C1e D t and X A1 cos x B1 sin x


2

Thus a solution of the partial differential equation is

c( x, t ) ( A1 cos x B1 sin x)C1e D t e D t ( A cos x B sin x)


2

(3)

Applying the boundary condition

c(0, t ) 0 , 0 Ae D t
2

Since

A 0 , since e D t 0 .
2

Thus from (3), we have

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

By the principle of superposition


The solution is

c( x, t ) Bn e

n 2 2
L2

Dt

sin

n 1

n
x
L

(5)

In order to satisfy the last condition,

c( x,0) Bn sin
n 1

n
x
L

2
n
Using Fourier series, Bn c( x,0) sin
xdx
L0
L
L

The solution of the governing equation can be written as follows

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

Numerical Solution of Diffusion Equation by Finite Difference Method

IV. Formulation Of The Diffusion Equation


We would like to consider the diffusion equation as an initial and homogeneous boundary value
problem

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

c( xi , t n ) at the discrete points by

xi ih

i 0,1,2,3.....

t n nk , n 0,1,2,3.....
Let the solution

c( xi , t n ) be denoted by C in and its approximate value by cin .

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

cin1 cin1 (1 2 )cin cin1

(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

for all i , then

cin11 cin1 (cin cin1 ) (1 2 )(cin1 cin ) (cin2 cin1 ) 0


However, we must choose the time step to be small: we must have

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

Numerical Solution of Diffusion Equation by Finite Difference Method


Proof: The explicit centered difference scheme (8) takes the form
n 1

=> ci

Dt n
Dt
Dt
c (1 2 2 )cin 2 cin1
2 i 1
x
x
x

cin1 cin1 (1 2 )cin cin1

Where

(10)

Dt
x 2

The equation (10) implies that if 0

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

Error Estimation Of The Scheme:

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

We compute the error defined by

e
for all time where

Ce C N
Ce

ce

is the exact solution and

c N is the Numerical solution computed by the finite difference

scheme.
5.1Results And Discussion:
We solve the diffusion equation by implementing the centered difference scheme, while varying the
different parameter values.

Figure 1: The behavior of numerical solution at D 0.001m 2 / s , 0.005m 2 / s .


DOI: 10.9790/5728-11641925

www.iosrjournals.org

23 | Page

Numerical Solution of Diffusion Equation by Finite Difference Method


Concentration distribution for each diffusion rate at time t=24 min. In figure-1, the profile for varying
contaminant diffusion rate, we saw that the contaminant concentration with a higher diffusion rate decreases at a
higher rate than that with a lower diffusion rate. The curve marked by star shows the concentration profile for
diffusion rate D 0.001m 2 / s and the curve visible by dot line represents the concentration profile for
diffusion rate D 0.005m 2 / s

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.

Figure 3: The Numerical solution and Analytical solution in mesh.

Figure 4: The error in the numerical result is shown for x=0.1


DOI: 10.9790/5728-11641925

www.iosrjournals.org

24 | Page

Numerical Solution of Diffusion Equation by Finite Difference Method

Figure 5: The error in the numerical result is shown for x=0.01


Figure-4 and figure-5 shows the error in the numerical solution from each of the methods when
compared with the analytical solution, for the atwo cases N=10, N=100, corresponding to x=0.1, 0.01
respectively. Comparisons are made for the solution at different time for smaller x the errors reduce in size.
The errors for the central difference scheme decrease as the grid size decrease.

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].

D.V. Widder, The heat equation. Academic Press, 1975.


N.Azizi, R. Pourgholi and M. Ebrahimi, Application of finite difference method to estimation of diffusion coefficient in a one
dimensional nonlinear inverse diffusion problem.
Rama Cont and Ekaterina Voltchkova A finite difference scheme for option princing in jump diffusion and exponential levy
models, ECCOMAS 2004.
S.S.Sastry, Introductory Methods of Numerical Analysis, Fourth edition, 2007. T.Papakostas, A.G.Bratsos, I.Th.Famelis, A.I.Dlis
and D.G.Natsis, An implicit numerical scheme for the atmospheric pollution.

DOI: 10.9790/5728-11641925

www.iosrjournals.org

25 | Page

You might also like