Increasing asymptotic stability of Crank-Nicolson

advertisement
Increasing asymptotic stability of
Crank-Nicolson method
Alexei A. Medovikov
Vyacheslav I. Lebedev
Summary
• The Crank-Nicolson method has second order
accuracy, but for stiff ODEs, the numerical solution has
unexpected oscillatory behavior, which can be
explained in term of its stability function
• Variable time steps by Crank-Nicolson method allow
us to formulate optimization problem for roots of the
stability function
• The solution of this problem is the rational Zolotarev
function
• We present robust algorithm of step-size selection and
numerical results of the optimization procedure
The exact solution of the heat equation can be found by the
method of separation of variables

 k
c
e
 k X k(x)
u
u

t
x 2
0
u(x,0)  u (x)
u(x, t) 
u(0, t)  u(1, t)  0
ck  (u0, X k(x))L2
2
k 1
2 sin(kx)
X k(x) 
We expect to have similar properties from the numerical solution:
2
u(x, t) L2 

c e
k
k 1
2 kt
 e
 2 1t

c
k 1
2
k
 e
 2 1t
0
2
u (x) L
2
k  k2 2
Method of lines: Lebedev, V. I. The equations and convergence of a
differential-difference method (the method of lines). (Russian) Vestnik
Moskov. Univ. 10 (1955), no. 10, 47--57
 2u(t)
ui  1(t)  2ui(t)  ui 1(t)

2
x
x 2
dui
u
 2ui  ui 1
 i 1
,
2
dt
x
i  1,  , n
dy
 Ay
dt
To solve the ODE we use midpoint rule or trapezoidal rule:
y j1  y j
y j1  y j
 A
2

y
j


c
k
k 1
x
(Xk )i 
x
j
k
x
q Xk
qk
1  0.5kx

1  0.5kx
2 sin(kxi) (a, c) 
ckx  ( y 0, Xkx )
kx 
n
 a c x
i i
i 1
4
2
sin
(kxi / 2)
2
x
y
j 2

n
 ck2q k2j   2j y0
k 1
2
  max q k
1 k  n
q k  R1( k )
Rk(0)  1
k
R'k (0)   hj
j 1
R1( ) 
1  0.5
1  0.5
Rs( ) 
1  0.5hi

i  1 1  0.5hi
Stability function of the classical Crank-Nicolson method (a)
s
Rk( max)  ( 1)k
( y, X n)  ( 1)k( y0, X n)
Initial value of the heat equation (a). Exact solution of the heat equation (b).
The solution of the heat equation by Crank-Nicolson method with 3
constant steps  
the optimal method
x / 3 (c), and solution by
3
with the same sum of steps (d):

  x 
h
i
i 1
Fourier coefficients
cnx  (y, Xn)
Composition Methods
dy
 f( y, t) ODEs generate a map:
dt


y( )  ( y0)  t2  t1 ( y0)
  t1  t2  1  2
s
Yi  y0  h aijf(Yj, t  cj)
j 1
Runge-Kutta method generates a map:
y1(h)  h(y0)
s
y1  y0  h bif(Yi, t  ci)
i 1
Composition of maps generated by RK method is composition method:



( ,  ,  k )(y )  1   2     k ( y 0 )
 i 1
 i  1
hi  i
 
h
i


i
Properties of RK map depend on division
1,  , k
Stability function
Applying RK method to simple test problem lead to function-multiplier,
which is responsible for stability of the method
s
y'  y
Yi  y0  h aijYj
j 1
s
y1  y0  h biYi
(I  hA)Y  ey0
i 1
Y
hbTY y1  y0
T
 (Y1,  , Ys )
e
T
 (1,  ,1)
 I  hA 0  Y 
e 

    y0
T
1  y1 
 hb
1
det(I  hA  hebT )
y1 
y0
det(I  hA)
b
T
 ( b1,  , bs )
Stability function of composition methods:
yk  Rk(k)  R1(1)y0
Composition of mid-point rules define new method and appropriate
choice of steps allows us to improve properties of the stability function
v0  y0
v
j
h 
 v j1  v j
 v  hjf 
,  hk  j  1 
2
2 
k 1

 v m, t1  t0  ,
j1
y1
 
j
m
h
k
k 1
Rm() 
m
1  0.5j
 1  0.5 
j 1
j
1,  ,  m
How to optimize m and
 
 1    ()2 / 2 
max R( ),
in order to have
maximum average time-step:
 [ 1,max ]
 /m
R( 1)  ,
1  R( )  ,
0    1
Zolotarev rational function
hm  j  1 
2
 2j  1
 a( ) a( )
max
,
dn
K' 

2
m


max
max




,  
m
h
j
j 1
Theorem (Medovikov): Sum of steps of Zolotarev
function for the interval a, max  equals
 m(a) 
m
 hj  2m
j 1
k  a / max,
k2 m  k
2m
m
C
k' 
2
2r  1
r 1
m 
,
K'(k2 m )k2 m
,
K'(k)kmax
1  k
Cr
 rK'

 sn 
, k
 2m

2
( 1)p q 2 mp(k' )
1  4
   m(a)max
2 mp
K' k 
(k' ) 
P 1 1  q
m 
2n
( 1)p q 2 mp(k' )
1  4 


2 mp
K' k 
(k' ) 
P 1 1  q
2n  1
The Algorithm
 m(a)   max(tol)

(a)  
(a)  max Rm( )
 [a,max ]
Wachspress E.L. Extended application of alternating direction
implicit model problem theory. SIAM J. Appl. Math. 11 (1963)
(1  2 )(1    i )
hi   i / 2
,

(1   1   i 1   i )max
2
h 
,m  1
amax
 
m
h
i
 0
i 1
(a)  Rm( max)
i  1,  , m  1
Rk( max)  ( 1)k
( y, X n)  ( 1)k( y0, X n)
Initial value of the heat equation (a). Exact solution of the heat equation (b).
The solution of the heat equation by Crank-Nicolson method with 3
constant steps  
the optimal method
x / 3 (c), and solution by
3
with the same sum of steps (d):

  x 
h
i
i 1
Embedded methods
hp d p y
y  y0   
 C0  (h p 1 )
p
p! dh
p
1
p 1
1
y
h p 1 d p 1 y
 y0   
 C1  (h p  2 )
p 1
( p  1)! dh
h p 1 d p 1 y
y ( h )  y0   
 C2  ( h p  2 )
p 1
( p  1)! dh
p 1
errnew  y ( h)  y1p  C new  hnew
errnew  tol
Cnew  Cold
p 1
Cnew  err / hold
p 1
hold
err p 1  tol
hnew
1 / p 1
hnew
 tol 
 hold 

 err 
p
1
1 d p 1 y

 C0 h p 1  O(h p  2 )
p 1
( p  1)! dh
p
1
1 d p 1 y

 C0 h p 1  O(h p  2 )
p 1
( p  1)! dh
err  y (h)  y
p 1
1
err  y
y
Download