Professional Documents
Culture Documents
Email address:
*
Corresponding author
Received: December 28, 2017; Accepted: January 16, 2018; Published: February 12, 2018
Abstract: In this paper we used the method of lines (MOL) as a solution procedure for solving partial differential equation
(PDE). The range of applications of the MOL has increased dramatically in the last few years; nevertheless, there is no
introductory to initiate a beginner to the method. This Paper illustrates the application of the MOL using Crank-Nicholson
method (CNM) for numerical solution of PDE together with initial condition and Dirichlet’s Boundary Condition. The
implementation of this solutions is done using Microsoft office excel worksheet or spreadsheet, Matlab programming
language. Finally, here we analysis the particular solution and numerical solution of Laplace equation obtained by MOL along
with CNM.
By taking # larger and larger in (2) he obtained the heat Note that the equation (7) represents a system of ODEs.
equation This transformation of a PDE equation (5) to a system of
$% $ %
&
ODEs equation (7) is so that the solution of a system of
$ $
ODEs approximates the solution of the original PDE. Since
equation (5) is first order, it requires one IC and one BC.
using the inverse of the MOL. But the MOL as a numerical These will be as follows, which are collected from [21]:
method was first applied by Rothe in 1930 [12]. He used the u x, t = 0 = f x (8)
u x = 0, t = g x
method on the parabolic equation
u'' = R x, t u) + S x, t, u
(9)
(3)
u = R x, t + S x, t , u , t = nh. (4)
0123 01 u ( xi , t = 0) = f ( xi ) 1 ≤ i ≤ M (10)
4
The equation (4) is the integration of the ODEs along lines Also, application of BC (9) gives for grid point i=1
u x ,t = g t ,t ≥ 0
parallel to the x-axis, and this is called a transversal scheme.
(11)
That is, longitudinal schemes lead to initial value problems,
while transversal schemes lead to boundary value problems. The solution of this ODE system is as follows which are
In this paper we established a solution procedure of PDE by collected from [16]:
u t , u t , u t , … , uB t , uB t
the help of MOL along with CNM and finally studied the
particular and numerical solution of Laplace equation by that (12)
solution procedure obtained by MOL along with CNM.
That is, an approximation to u (x, t) at the grid points i =1,
2,…, M
2. Conversion of PDE to the System of Before we go on to consider the numerical integration of
ODE the approximating ODEs, in this case equation (7), we briefly
consider further the FD approximation of equation (12),
The basic idea of the MOL is to replace the spatial which can be written as
u' ≈ + 0 ∆x
(boundary value) derivatives in the PDE with algebraic 09 09:3
∆'
approximations. Once this is done, the spatial derivatives are (13)
First we need to replace the spatial derivative u x with an This is known as Laplace's equation. It is also called a
algebraic approximation. In this case we will use a finite harmonic function. Equation (14) is Eclliptic second order
difference (FD) such as linear PDE. The initial condition is
u' ≈
09 09:3 x x, o = f x a < x < b (15)
∆'
(6)
And the Dirichlet Boundary conditions are
u a, t = c , u b, t = c , 0 ≤ t ≤ d
Then the MOL approximation of equation (5) is
= −v ,1 ≤ i ≤ M
<09 09 09:3
(16)
<) ∆'
(7)
Equation (14), (15) and (16) are called initial boundary
American Journal of Applied Mathematics 2018; 6(1): 1-7 3
YΡ\YZ M \ 0
J RS TY X \
plane region defined K L , M : 0 - - 0.5 and 0 - M - RX S WS
P. 5 we will also impose the Dirichlet boundary condition
(20)
c j
c ⋱ ⋱ ⋱ j
YΡ\ c 0 … 1 2 1 j
c 0 … 0 1 eh j
c j
b i
Since all the elements of matrix [P] are zeros except the
0 and &.
tridiagonal terms; the elements of the first and the last row of
l ] by letting
equations from the coupled equations (20). To achieve this,
we define the transformed potential [Z
Y Z\ l\
YΤ\YZ (21)
H ∆
I
And
J
YΤ\YΤ\] YΤ\] YΤ\ YΙ\
(18)
(24)
Where,
U y U x ,y ,i 1,2, … . . , N
4 Mohammad Roknujjaman and Mohammad Asaduzzaman: On the Solution Procedure of Partial Differential Equation
(PDE) with the Method of Lines (MOL) Using Crank-Nicholson Method (CNM)
2 _ ~ − 0.5 • _ − 0.5 •
| sin , YT•J \ 2 sin
# + 0.5 # + 0.5 2# + 1
Dirichlet Neumann
2 _ − 0.5 ~ − 1 •
| cos ,
# + 0.5 # + 0.5 _−1 •
2 sin
1 2#
Neumann Neumann
~ > 1, YTJJ \| , ~ = 1
#
Note: where i, j = 1, 2, N and subscripts D and N are for Dirichlet and Neumann conditions respectively. This is an ordinary differential equation with solution.
l[ = ‚[ cosh ƒ[ M + „[ sinh ƒ[ M
Z (27)
where, ƒ[ = o[ /H.
λ = 2 sin
Œ
•
(28)
and
T Ž = • sin
ŽŒ
• •
(29)
50
au'' + bu' + cu − u) = 0
45
(30)
40
subject to the initial condition u (x, 0) = f (x) and other
35
possible boundary conditions. Explaining the negative ut
30 term in (30), focusing on an arbitrary internal grid point in
one could approximate the partial derivatives at that point by
25
y
the following:
20
15 u = u i ,n
∂ u ui , n + 1 − ui , n
10
5 =
∂t k
(31)
∂ u u i + 1, n − u i − 1, n
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x =
∂x 2h
Figure 2. Graphical Representation of the particular solutions of Laplace 2-
D Equation by the MOL for Example 4.1.
∂2u u i + 1, n − 2 u i , n + u i − 1, n
=
∂x 2 h2
5. Crank-Nicholson Algorithm [17-18]
This note provides a brief introduction to finite difference The differences in the x, direction have been centered on
methods for solving partial differential equations. We focus the point in to give ‘second order’ accuracy to the
on the case of a PDE in one state variable plus time. Suppose approximation. These expressions could then be substituted
one wishes to find the function u (x, t) satisfying the PDE into the PDE Solving the resulting equation for ui,n+1 gives
the explicit solution
k k 2k k k
ui , n +1 = ( 2 a + b ) ui +1, n + (1 + kc − 2 a ) ui , n + ( 2 a − b ) ui −1, n (32)
h 2h h h 2h
are averages of what we had in (31) for times n and n+1 u ( x ,0.5 ) = 200 x and u ( 0.5, y ) = 200 y
ui , n + ui , n +1
u = using CNM and MOL.
2 Solution of Example 2.
∂u ui , n +1 − ui , n Given that,
=
∂t k
(33) ∂2u ∂2u
∂u ui +1, n − ui −1, n + ui +1, n +1 − ui −1, n +1 + =0 (34)
= ∂x2 ∂y2
∂x 4h
∂2u( i , j ) 1
+ [ ui +1, j − 2ui , j + ui −1, j + ui +1, j +1 − 2ui , j +1 + ui −1, j +1 ] = 0
∂y2 2 h2
∂2u(i , j ) 1
= [ −ui +1, j + 2ui , j − ui −1, j − ui +1, j +1 + 2ui , j +1 − ui −1, j +1 ] (35)
∂y2 2 h2
Now using the Figure 3 which domain is divided into The boundary condition implies that,
squares of 0.125 unit size as illustrated below,
u1,0 = u 2,0 = u 3,0 = u 0,1 = u 0,2 = u 0,3 = 0
∂ 2u 1
= [ui , j +1 − 2ui , j + ui , j −1 + ui +1, j +1 − 2ui +1, j + ui +1, j −1 ]
∂y 2 2h 2
∂ 2u 1
Similarly, =
[ui +1, j − 2ui , j + ui −1, j + ui +1, j +1 − 2ui , j +1 + ui −1, j +1 ]
∂x 2
2h 2
Then the CNM for the Laplace equation is as follows
1
[ ui +1, j − 2 ui , j + ui −1, j + ui +1, j +1 − 2 ui , j +1 + ui −1, j +1 + ui , j +1 − 2 ui , j
2h 2
+ ui , j −1 + ui +1, j +1 − 2 ui +1, j + ui +1, j −1 ] = 0
Again for i, j=1, 2, 3… and use Matlab code for solving the numerical solution of Laplace equation using CNM.
Figure 4. Graphical Representation of the numerical solution of Laplace Equation by the MOL for Example 2.
American Journal of Applied Mathematics 2018; 6(1): 1-7 7
7. Results and Discussion problem solving”, J. Aerosol Sci. 30 (Suppl. I), S247–S248
(1999).
Here we give a simple introduction on MOL and on CNM
[6] A. Erdem and S. Pamuk, “The method of lines for the
with illustrative examples. The graph of Example 1 presented numerical solution of a mathematical model for capillary
in Figure 2 represents the particular solution of Laplace formation: the role of tumor angiogenic factor in the extra-
equation and the graph of Example 2 presented in Figure 4 cellular matrix”, Appl. Math. Comput. 186, 891–897 (2007).
represents the numerical solution of Laplace equation.
[7] G. Hall and J. M. Watt, “Modern Numerical Methods for
Ordinary Differential Equations, Clarendon”, Oxford (1976).
8. Conclusion [8] S. Hamdi, W. H. Enright, Y. Ouellet and W. E. Schiesser,
The MOL is generally recognized as a comprehensive and “Method of lines solutions of the extended Boussinesq
equations”, J. Comput. Appl. Math. 183, 327–342 (2005).
powerful approach to approximate the numerical solution of
PDEs. Here we used this method in two separate steps. First [9] H. Han and Z. Huang, “The direct method of lines for the
we discretized the PDE using crank-Nicholson method to numerical solution of interface problem”, Comput. Methods
obtain a system of ordinary differential equations (ODEs). Appl. Mech. Eng. 171, 61–75 (1999).
Then we solved the system of ODEs using ODE solvers. The [10] T. Koto, “Method of lines approximations of delay differential
success of this method is explained by the availability of equations”, Comput. Math. Appl. 48, 45–59 (2004).
high-quality numerical algorithms for the solution of stiff
[11] S. Pamuk and A. Erdem, “The method of lines for the
systems of ODEs. Here we investigated MOL approach for numerical solution of a mathematical model for capillary
solving the two dimensional Elliptic equation with boundary formation: the role of endothelial cells in the capillary”, Appl.
condition. The computational results confirmed the Math. Comput. 186, 831–835 (2007).
efficiency, reliability and accuracy of this procedure and this
[12] W. E. Schiesser, “The Numerical Method of Lines”, Academic
superior performance is achieved with very little increased Press, San Diego.
computational effort. Thus, we conclude that the use of CNM
in the MOL solution for the Laplace equation and for other [13] D. J. Jones et al, “On the numerical solution of elliptic partial
partial differential equations is very effective and appropriate differential equations by the method of lines”, J. Comput.
Phys., 9, 496–527 (1972).
procedure.
[14] J. G. Ma and Z. Chen, “Application of the method of lines to
the Laplace equation”, Micro. Opt. Tech. L ett., 14 (6), 330–
Conflict of Interests 333 (1997).
The authors declare that they have no any conflict of [15] A. A. Sharaf and H. O. Bakodah,“A Good Spatial
interests. Discretization in the Method of Lines”, Applied Mathematics
and Computation” (2005).