Implicit Method
Implicit Method
What is an implicit scheme? Explicit vs. implicit scheme for Newtonian Cooling Crank-Nicholson Scheme (mixed explicit-implicit) Explicit vs. implicit for the diffusion equation Relaxation Methods
Implicit Methods
dT = f (T , t ) dt
Before we used a forward difference scheme, what happens if we use a backward difference scheme?
T j T j 1 dt
+ O(dt ) = f (T j , t j )
T j T j-1 + dtf (T j , t j )
Implicit Methods
T j T j 1 (1 + T j T0 (1 +
dt
) 1
dt
) j
Is this scheme convergent? Does it tend to the exact solution as dt->0? YES, it does (exercise) Is this scheme stable, i.e. does T decay monotonically? This requires
1 0< <1 dt 1+
Implicit Methods
1 0< <1 dt 1+
This scheme is always stable! This is called unconditional stability ... which doesnt mean its accurate! Lets see how it compares to the explicit method...
Implicit Methods
-0.5
-1
-1.5
4 Time (s )
Implicit Methods
4 Time (s )
Implicit Methods
dT = f (T , t ) dt
Let us interpolate the right-hand side to j+1/2 so that both sides are defined at the same location in time ...
T j +1 T j dt
f (T j +1 , t j +1 ) + f (T j , t j ) 2
Let us examine the accuracy of such a scheme using our usual tool, the Taylor series.
Implicit Methods
T j +1 T j t
2 2 3 dT t d T t d T 3 + O ( t ) + = + 2 3 6 dt j dt j 2 dt j
3 O ( t ) + j
since
dT = f (T , t ) dt
=>
d 2T df (T , t ) = 2 dt dt
Implicit Methods
1 (T j +1 + T j ) dt 2 dt dt T j +1 (1 + ) T j (1 ) 2 2
leading to the extrapolation scheme
T j +1 T j
Implicit Methods
dt 1 2 T j +1 T j dt 1 + 2
dt 1 2 1 < dt 1 + 2
<1
Implicit Methods
dt 1 2 1 < dt 1 + 2
<1
This scheme is always stable for positive dt and ! If dt>2 , the solution decreases monotonically!
Let us now look at the Matlab code and then compare it to the other approaches.
Implicit Methods
t0=1. tau=.7; dt=.1; dt=input(' Give dt : '); nt=round(10/dt); T=t0; Ta(1)=1; Ti(1)=1; Tm(1)=1; for i=1:nt, t(i)=i*dt; T(i+1)=T(i)-dt/tau*T(i); Ta(i+1)=exp(-dt*i/tau); Ti(i+1)=T(i)*(1+dt/tau)^(-1); Tm(i+1)=(1-dt/(2*tau))/(1+dt/(2*tau))*Tm(i); end
% % % %
Implicit Methods
dt=1.4; ta u=0.7 1 0.8 0.6 0.4 Te mpe ra ture 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 0 2 4 Time (s ) 6 8
10
Implicit Methods
dt=1; ta u=0.7 1
4 Time (s )
Implicit Methods
dt=0.5; ta u=0.7 1 0.9 0.8 0.7 Te mpe ra ture 0.6 0.5 0.4 0.3 0.2 0.1 0 0 2 4 Time (s ) 6 8
Implicit Methods
dt=0.1; tau=0.7
0.9
dt=0.1; ta u=0.7 0.2
0.8
Te mpe ra ture
0.7
Te mpe ra ture
0.15
0.6
0.1
0.5
0.4
0.05
1.2
1.4 Time (s )
1.6
1.8
0.3
0.2
0.1
4
Time(s)
10
C C =k 2 t x
2
diffusivity
The diffusion equation has many applications in geophysics, e.g. temperature diffusion in the Earth, mixing problems, etc. A centered time - centered space scheme leads to a unconditionally unstable scheme! Lets try a forward time-centered space scheme ...
Implicit Methods
where
dt s=k 2 dx
how stable is this scheme? We use the following Ansatz
T = eidt
X = e ikdx
Implicit Methods
T (1 + sX 1 2 s + sX 1 ) = 0
and
T 1 4s
so the stability criterion is
1 s dt dx 2 /( 2k ) 2
This stability scheme is impractical as the required time step must be very small to achieve stability.
Numerical Methods in Geophysics Implicit Methods
is equivalent to
n C1n +1 C 1 +1 n C n s = 1 2 1 C j j n C n +1 C J J
Implicit Methods
n +1
= c + Lc
n
where L is the tridiagonal scaled Laplacian operator, if the boundary values are zero (blank parts of matrix contain zeros)
Implicit Methods
dt C (t + dt ) + C (t ) C ( x, t + ) 2 2
and
n +1 + Cn C j j
dt
k n +1 n +1 n +1 n n n = C 2 C + C + C 2 C + C j +1 j j 1 j +1 j j 1 2 2dx
... so again we have defined both sides at the same location ... half a time step in the future ...
Implicit Methods
... again this is an implicit scheme, we rewrite this in matrix form ...