Вы находитесь на странице: 1из 12

CRANK NICOLSON METHOD

M.Sc. 4th Semester Project

Submitted by

ANUP SARKAR
Roll 001717, No. 0070
Reg. No. 2410472

Department of Mathematics
University of Gour Banga
Malda-732103
West Bengal

16 JULAY, 2018
Acknowledgement
Firstly I would like to express our immense gratitude towards our institution ”UNI-
VERSITY of GOUR BANGA”, which created a great platform to attain profound
technical skills in the field of M.Sc, thereby fulfilling our most cherished goal.

I would thank all the ’Mathematics Department’ of ”UNIVERSITY of GOUR


BANGA”, for guiding and helping me in successful completion of the project.

I sincerely express my gratitude to the Professor Dr. SANATAN DAS and Dr.
MANORANJAN MAITY for his inspiration and timely support in successful com-
pletion of my project work.

I am very much thankful to our Professor Dr. SIMANTA DE for extending his
guidance and cooperation in doing this project.

I am also thankful to our project coordinator Professor Dr. DEBRAJ CHANDRA


for extending his cooperation in completion of Project.

I convey my thanks to my beloved friends and my teachers who helped me directly or


indirectly in bringing this project successfully
Abstract
This paper presents Cranck Nicolsol method for solving for parabolic partial differential
equations. Cranc Nicolson method is a finite difference method used for solving heat
equation and similar partial differential equations. This method is of order to in space,
implicit in time, unconditionally stable and has higher order of accuracy.
Contents

1 Introduction 1

2 SOME IMPORTANT RESULT IN NUMERICAL ANALYSIS: 2


2.1 APPLICATION OF THIS RESULT: . . . . . . . . . . . . . . . . . 2
2.2 CRANK NICOLSON METHOD: . . . . . . . . . . . . . . . . . . . 3

3 SOME IMPORTANT THEOREMS: 4

4 PROBLEM 6
1 Introduction
In numerical analysis , the CRANK-NICILSON METHOD is a finite difference method
used for numerically solving the heat equuation and similar partial differential equa-
tions.It is a second order method in time.It is implicit in time and can be written as an
implicit Runge-Kutta method, and it is numerically stable.The method was developed
by John Crank and Phyllis Nicolson in the mid 20th century.For diffusion equation (and
many other equations), it can be shown the Crank-Nicolson method is unconditionally
stable. However, the approximate solution can still contain(decaying) spurious oscilla-
tions if the ratio of time step ∆t times the thermal diffusivity to the square of space
step,∆x2 is large(typically larger than 1/2 per Von Neumann stability analysis). For this
reason, Whenever large time steps or high spatial resolution is necessary, the less accurate
backward Euler method is often used, Which is both stable and immune to oscillations.

1
2 SOME IMPORTANT RESULT IN NUMERICAL
ANALYSIS:
(i)Finite difference method
From taylor’s expansion formula

h2 d2 y h3 d3 y
y(x + h) = y(x) + hy(x) + 2! dx2
+ 3! dx3
+ ... (1)

and

h2 d2 y h3 d3 y
y(x − h) = y(x) − hy(x) + 2! dx2
− 3! dx3
+ ... (2)

using equatoin (1) and (2)

∂u ui+1,j −ui,j
∂x
| xi = h

∂u ui+1,j −2ui,j +ui−1,j


∂x
| xi = 2h

∂u ui,j+1 −2ui,j +ui,j−1


∂y
| yj = 2k

where

ui,j=u(xi ,yj )
xi = x0 + ih
yj = y0 + jk

also we have

∂2u ui+1,j −2ui,j +ui−1,j


∂x2
| xi = h2

∂2u ui,j+1 −2ui,j +ui,j−1


∂y 2
| yj = k2

2.1 APPLICATION OF THIS RESULT:


Laplace equation:

∂2u ∂2u
The laplace equation equation ∂x2
+ ∂y 2
=0 can be written as.

2
ui+1,j −2ui,j +ui−1,j u −2u +ui,j−1
h2
+ i,j+1 ki,j
2 =0
i = 1, 2, 3, ...n − 1
j = 1, 2, 3...n − 1

ui+1,j − 2ui,j + ui−1,j = r2 (ui,j+1 − 2ui,j + ui,j−1 ) = 0


h2
where r2 = k2

Heat equation:

∂u 2
the heat equation ∂t
= c2 ∂∂xu2 can be written as,

ui,j+1 −2ui,j +ui,j−1 ui+1,j −2ui,j +ui−1,j


2k
= c2 h2

ui,j+1 − 2ui,j + ui,j−1 = r2 (ui,j+1 − 2ui,j + ui,j−1 )

2c2 k
where r2 = h2

2.2 CRANK NICOLSON METHOD:


We have

∂2u ui+1,j −2ui,j +ui−1,j


∂x2
| xi = h2

∂2u ui−1,j −2ui,j +ui+1,j ui−1,j+1 −2ui,j+1 +ui+1,j+1


∂x2
| xi = 12 [ h2
+ h2
]

therefore by the Heat equation we have

∂u ∂2u
∂t
= ∂x2
[put c = 1]

ui,j+1 −ui,j ui−1,j −2ui,j +ui+1,j ui−1,j+1 −2ui,j+1 +ui+1,j+1


=⇒ k
= 12 [ h2
+ h2
]

=⇒ ui,j+1 − ui,j = 2r [ui−1,j − 2ui,j + ui+1,j + ui−1,j+1 − 2ui,j+1 + ui+1,j+1 ]

=⇒ rui−1,j+1 − 2(1 + r)ui,j + rui+1,j+1 = −rui−1,j − 2(1 − r)ui,j − rui+1,j


i = 1, 2..., N − 1
J = 1, 2, ..., N − 1

this is valid for erery r.

3
3 SOME IMPORTANT THEOREMS:
STATEMENT:

For the implicit method there exist a constant C > 0, independent of h ∆t, such that
max|u(xi , tn ) − uh ,∆t (xi , tn )| <= max|u0 (xi ) − uh ,∆t (xi , 0)| + C(h2 + ∆t)M, (xi , tn ) ∈
Q, i ∈ [0, N ], where M = max|uxxxx (x, t)|, |utt (x, t)|, (x, t) ∈ Q

Proof:

Using the same argument as for the exiplicit method, it is easy to show that the
pointwise error eni = u(xi , tn ) − uni satisfies

en+1
i − λ(en+1i−1 − 2ei
n+1
+ en+1 n
i+1 ) = ei + ∆tTE (xi , tn+1 ),
where λ = a∆th−2
and
TE (xi , tn+1 ) is the truncation error:
2 1 2 δ4 u
TE (xi , tn+1 ) = − 21 ∆t δδt2u (xi , θn+1 ) + 12 h δx4 (ηi , tn+1 )

Now, let J be the index such that

|en+1 n+1
J | = max|ei |, i ∈ [1, n − 1]

This implies that


(1 + λ)|en+1 n+1 n+1 n
J | <= λ(|eJ−1 | + |eJ+1 |) + |eJ |) + ∆tτ,

where τ is the maximum (in absolute value) truncation error:

τ = | 12 ∆t + 1 2
12
h |M

since |eJn+1 | >= |en+1


J | for any J ,we can write

from which

En+1 = max|en+1
i = |en+1 n n
J | <= |eJ + ∆tτ <= max|ei + ∆tτ = En + ∆tτ, i ∈ [1, n − 1]

Therefore, we solve the recursion En+1 <= En + ∆tτ

4
There are a number of ways to derive the Crank-Nicolson scheme. Perhaps the best
way is to first ”solve” the PDF by integrating in time on both side of the equation:

R t+∆t
u(x, t + ∆t) − u(x, t) = a t
(auxx (x, s) + f (x, s))ds

and then use the trapezoid rule to evaluate the integral on the right side:

u(x, t + ∆t) − u(x, t) = 12 ∆ta(uxx (x, t) + uxx (x, t + ∆t)) + 12 ∆t(f (x, t) + f (x, t +
1 1
∆t)) − 12 ∆t3 uxxtt (x, θt ) − 12 ∆t3 ftt (x, ηt )

Then, replacing the spatial derivatives with difference quotient , we get the length
expression

u(x, t+∆t)−u(x, t) = 12 ∆ta[ u(x+h,t+∆t)−2u(x,t+∆t)+u(x−h,t+∆t)


h2
]+ 12 ∆ta[ u(x+h,t+∆t)−2u(x,t+∆t)+u(x−h,t+∆t)
h2
]+
1 1 2 4 4
2
∆t(f (x, t+∆t)+f (x, t))+ 24 h ∆ta( δδxu4 (η1 , t+∆t)+ δδxu4 (η0 , t))- 12
1 1
∆t3 uxxtt (x, θt )− 12 ∆t3 ftt (x, ηt ),

where ηt ∈ [t, t + h], θt ∈ [t, t + h], η1 ∈ [x − h, x + h], and η0 ∈ [x − h, x + h]. Finally,


we drop the remainders to define the numerical method:

un+1
j −µ(un+1 n+1
j+1 −2uj +un+1 n n n n 1
j−1 ) = uj +µ(uj+1 −2uj +uj−1 )+ 2 ∆t(f (xj , tn+1 ))+f (xj , tn )

where unj = uh , ∆t(ti , tn ) = u(xj , tn ) is the approximate solution and µ = 12 ∆th−2 .This
is again a system of N − 1 equations in N − 1 unknowns, but it is slightly more involved
than is the system for the implicit method. However, it is still unconditionally stable and
it retains second-order accuracy in both space and time, as we shall soon see.

we can write the system (9.19) in matrix-vector form as

(I + µK)un+1 n 1 n
h , ∆t = (I − µK)uh , ∆t + 2 ∆tF ,

where

F n = (f (x1 , t − n + 1) + f (x1 , tn ), ...., f (xN −1 , tn+1 ) + f (xN −1 , tn ))T

5
4 PROBLEM
Exampale:

2
Solve ∂u
∂t
= ∂∂xu2
u(0, t) = 0, u(1, t) = t, 0 <= x <= 1, 0 <= t <= 1

1
taking h = k = 4
using Crank-Nicolson Implicit method.

answer:

The Crank-Nicolson implicit formula is given by

−rui−1,j+1 + 2(1 + r)ui,j+1 − rui+1,j+1 = rui−1,j + 2(1 − r)ui,j + ui+1,j


we take h = k = 41 and hence r = hk2 = 4
Now putting r = 4 in the above equation

−4ui−1,j+1 + 10ui,j+1 − 4ui − 1, j = 4ui+1,j − 6ui,j + 4ui+1,j


Now putting j = 0 and i = 1, 2, 3 we gat

−4u0,1 + 10u1,1 − 4u2,1 = 4u0,0 − 6u1,0 + 4u2,0

−4u1,1 + 10u2,1 − 4u3,1 = 4u1,0 − 6u2,0 + 4u3,0

−4u2,1 + 10u3,1 − 4u4,1 = 4u2,0 − 6u3,0 4u4,0

Let u1,1 = a, u2,1 = b, u3,1 = c


Then 10a − 4b = 0
− 4a + 10b = 0
− 4b + 10c = 1(asu4,1 = 0.25)

 Now    
10 −4 0 a 0
 −4 10 −4   b  =  0 
    

0 −4 10 c 1

we solve a, b, c by using Cramer’s rule

6
 
10 −4 0
∆ =  −4 10 −4  = 680
 

0 −4 10
∆1∆ = 16
a = ∆∆1 = 680
16
= 0.35294

∆2 = 40

∆2
b= ∆
= 0.0588235

∆3 = 84

∆3
c= ∆
= 0.1235294

Now putting j = 1, andi = 1, 2, 3 we get

−4u0,2 + 10u1,2 − 4u2,2 = 4u0,1 − 6u1,1 + 4u2,1


− 4u1,2 + 10u2,2 − 4u3,2 = 4u1,1 − 6u2,1 + 4u3,1
− 4u2,2 + 10u3,2 − 4u4,2 = 4u2,1 − 6u3,1 4u4,1

let u1,2 = d, u2,2 = e, u3,2 = f


then 10d − 4e = −0.09411765
− 4d + 10e − 4f = 0.235294114
− 4e + 10f = 2.49411765
    
10 −4 0 d 0.09411765
Now  −4 10 −4   e  =  0.235294114 
    

0 −4 10 f 2.49411765
solving d, e, f by using Cramer’s rule

∆ = 680
∆1∆ = 57.2235296

∆1
d= ∆
= 0.084152249

∆2 = 127.0588234
e = ∆∆2 = 0.1868512
f = ∆∆3 = 0.324152249

7
Now we put j = 2, andi = 1, 2, 3 we get

−4u0,3 + 10u1,3 − 4u2,3 = 4u0,1 − 6u1,2 + 4u2,2


− 4u1,3 + 10u2,3 − 4u3,3 = 4u1,2 − 6u1,2 + 4u3,2
− 4u2,3 + 10u3,3 − 4u4,3 = 4u2,2 − 6u3,2 + 4u4,2

let u1,3 = g, u2,3 = h, u3,3 = k

10g − 4h = 0.242491346
− 4g + 10h − 4k = 0.512110732
− 4h + 10k = 3.802491346

Now u0,0 = 0 = u0,1 = u0,2 = u0,3 = u0,4

and u4,0 = 0, u4,1 = 0.25, u4,2 = 0.50, u4,3 = 0.75, u4,4 = 1

References
1. Dr. S.A. Mollah, Numerical Analysis and Computational Procedures.
2. Dr. N.Dutta, Dr.R.N.Jana,Introductory Numerical Analysis
3. Dr. Sanatan Das, An Integrated Approach To Numerical Analysis.
4. James F. Epperson, An Introduction To Numerical Methods and Analysis.
5. Sanyal, D.C. and Das, K.(2009), A Text Book of Numerical Analysis, U.N. Dhur
and Sons Private Ltd.,Kolkata.

Вам также может понравиться