(v) parabolic
TRANSCRIPT
-
8/3/2019 (v) Parabolic
1/21
-
8/3/2019 (v) Parabolic
2/21
Even though it is second-order accurate in time and space,it is unconditionally unstable.
3. The DuFort-Frankel Explicit Method
It is a modification of the Richardson method where
n
iu
inthe right hand side of Eq. (3) is replaced by
2
11 + + nini uu .
Thus
( ) ( ) 21
11
1112
2
2 x
uuu
u
t
uuni
ni
nin
ini
ni
++
=
+
+
+
from which
( )
( )
( )
( ) ( )
( )[ ]nini
ni
ni
uux
t
u
x
tu
x
t
112
1
2
1
2
2
21
21
+
+
+
+
=
+
(4)
The method is ( ) ( )2
22,,
x
txtO and is unconditionally
stable.The values of iu at time levels n and 1n are required tostart the computation. Therefore, either two sets of datamust be specified, or, from a practical point of view, a one-step method can be used as a starter. Of course, for theone-step (in t ) starter solution, only one set of initialdata, say at 1n , is required to generate the solution at n .With the values of iu at 1n and n specified, the DuFort-Frankel method can be used. Two points about thisscheme must be kept in mind. First, the accuracy of thesolution provided by the DuFort-Frankel method is affectedby the accuracy of the starter solution. Second, since thesolution at the unknown station requires data from twoprevious station, computer storage requirements will
increase.
4. Forward in Time Central in Space (FTCS) Implicit Method
It is also known as the Lassonen method. The finitedifference equation is given as
Page 2 of 21
-
8/3/2019 (v) Parabolic
3/21
( ) ( )( ) ( )[ ]2
2
11
111
1
,,2
xtOx
uuu
t
uuni
ni
ni
ni
ni
+=
++++
+
which can be rearranged as
inii
nii
nii ducubua =++
++
++
11
111 (5)
where ( )( ) 2x
tai= , ( )( ) 2
2x
tbi= , ( )
( ) 2xtci
= , and nii ud = .This will
yield a tridiagonal system which can be solved by theThomas algorithm.
The modified equation for this scheme can be derived as
( ) ( )
( ) ( ) ( ) ( )+
+++
+=
xxxxxx
xxxxxxt
uxxtt
uxt
uu
360123
122
42223
22
There are no odd derivative terms in the truncation error sono dispersion error is introduced. The amplification factorcan be derived as
( )cos121
1
+=
rG
from which it can be deduced that this scheme isunconditionally stable.
5. Crank-Nicolson Method
If the diffusion term in Eq. (1) is replaced by the average ofthe central differences at time levels nand 1+n thediscretized equation would be of the form
( ) ( )
( )( ) ( )[ ]22
2
11
2
11
111
1
,,2
2
2
1
xtOx
uuu
x
uuu
t
uu
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
++
+
+=
+
++
++
+
(6)
Page 3 of 21
-
8/3/2019 (v) Parabolic
4/21
Note that the left side of the Eq. (6) is a central difference of
step( )2
t, i.e.,
( )
22
1
tuu
t
u nini=
+
which is ( )2tO . In terms of the grid points (see Figureabove) the left side can be interpreted as the central
difference representation oft
u
at point A, while the right
side is the average of the diffusion term at the same point.The method may be thought of as the addition of two step
computations as follows. Using the explicit method,
( ) ( )211
12
2
x
uuu
t
uuni
ni
ni
ni
ni
+=
++
while using the implicit method,
( ) ( )21
111
12
2
x
uuu
t
uuni
ni
ni
ni
ni
+=
++++
+
Eq. (6) can be rearranged as
inii
nii
nii ducubua =++
++
++
11
111
where( )
( ) 22 xt
ai= ,
( )( ) 2
1x
tbi
+= ,
( )( ) 22 x
tci
= , and
( )
( )( )ninininii uuu
x
tud 112 2
2+ +
+=
which will produce a tridiagonal system and can be solvedby the Thomas algorithm.
Page 4 of 21
-
8/3/2019 (v) Parabolic
5/21
The modified equation for this scheme can be derived as( )
( ) ( )+
+
+
=
xxxxxx
xxxxxxt
uxt
ux
uu
36012
12423
2
and the amplification factor is found to be
)cos1(1
)cos1(1
+
=
r
rG
which is always less than 1 and hence the scheme isunconditionally stable.
6. The Beta (General) Formulation
A general formula for the finite difference equation for theconduction equation can be written as
( ) ( )
( )( )
++
+
+=
+
++
++
+
2
11
2
11
111
1
21
2
x
uuu
x
uuu
t
uu
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
(6)
where 10 is multiplication factor. When 0= the FTCSexplicit scheme is obtained, when, the Crank-Nicolsonscheme is recovered, while FTCS implicit scheme is
obtained for 1= . When 2/1= the truncation error is( ) ( ) 22 , xtO , when r12/12/1 = , and when r12/12/1 = and
20/1=r the truncation error is ( ) ( )62 , xtO .
The modified equation for the general formulation can bederived to be
( )( )
( ) ( ) ( )
( )+
+
+
++
+
=
xxxxxx
xxxxxxt
ux
xtt
ux
tuu
360
2
1
6
1
3
1
122
1
4
22232
22
The scheme is unconditionally stable if 12
1 and for the
case2
10 , the scheme is stable if
42
10
r .
Page 5 of 21
-
8/3/2019 (v) Parabolic
6/21
Application for One-Dimensional Conduction(Diffusion) Equation
Consider a fluid bounded by two parallel plates extended toinfinity such that no end effects are encountered. The planerwalls and the fluid are initially at rest. Now the lower wall issuddenly accelerated in the x -direction as shown in the figure.A spatial coordinate system is selected such that the lower wallincludes the xz-plane to which the y -axis is perpendicular. Thespacing between the two plates is denoted by h .
The governing PDE for this problem is
2
2
y
u
t
u
=
where is the kinematic viscosity of the fluid. It is required tocompute the velocity profile ( )ytuu ,= . The initial and boundaryconditions are 0)0,0( Uu = , 0),0( =yu , 0)0,( Utu = , and 0),( =htu .
The analytical series solution for this problem can be expressed
as
=
= h
yne
nh
y
U
u tn
n
s i n12
1*
10
22
where 2* h
tt
= .
Page 6 of 21
-
8/3/2019 (v) Parabolic
7/21
The specific data are given as 000217.0= m2/s, 400 =U m/s, and04.0=h m. A solution for ( )ytu , is to be obtained up to 1.08 s.
The grid system you can use is shown in the sketch below. Use001.0=y m so that the maximum grid point number in the y -
direction, JM = 41.
Methods to be used1. FTCS explicit scheme (use 002.0=t and 00232.0 )2. DuFort-Frankel scheme (use 002.0=t and 003.0 )3. FTCS implicit scheme (use 002.0=t and 01.0 )4. Crank-Nicolson scheme (use 002.0=t and 01.0 )
For each method, compute the velocity profile at times 0.18 s,0.36 s, 0.54 s, 0.72 s, 0.9 s, and 1.08 s. Plot these profiles foreach method for 002.0=t and comment on the effect of theother t .
For the DuFort-Frankel method, the velocity profile at twoconsecutive time levels ( 0u and 1u ) are needed at the startup,
Page 7 of 21
-
8/3/2019 (v) Parabolic
8/21
but are not available. So you can calculate 1u using the FTCSexplicit scheme for the first time step only, and then use DuFort-Frankel scheme for the second and later time steps.
Also calculate the error between the exact solution and thesolution by each scheme at time 1.08 s with 002.0=t and plotthese errors as a function of y . The percent error can becomputed as
( ) ( )( )
100,08.1
,08.1,08.1)(
=
analytical
computedanalytical
yu
yuyuyerror
Page 8 of 21
-
8/3/2019 (v) Parabolic
9/21
Two-Dimensional Conduction (Diffusion) Equation
Consider the model equation
+
=
2
2
2
2
y
u
x
u
t
u (7)
where is the constant diffusivity. If the FTCS explicit schemeis used to discretized this equation, we get
( ) ( ) ( )
++
+=
+++
2
1,,1,
2
,1,,1,1
, 22
y
uuu
x
uuu
t
uunji
nji
nji
nji
nji
nji
nji
nji
which is ( ) ( ) ( )22 ,, yxtO . The method is stable if( )
( )
( )
( ) 2
122
+
y
t
x
t
Let
( )
( )2x
trx
=
and
( )
( )2y
try
=
, then the stability requirement can be
expressed as2
1+ yx rr . To make any comparison with the one-
dimensional case, let us make ( ) ( )yx = so that rrr yx == in which
case the stability requirement becomes4
1r , which is twice as
restrictive as the one-dimensional case. Such a severerestriction on the time step size makes explicit formulationinefficient.
Consider the FTCS implicit formulation for which the FDE is
( ) ( ) ( )
++
+=
++++
++
++
+
2
11,
1,
11,
2
1,1
1,
1,1,
1, 22
y
uuu
x
uuu
t
uunji
nji
nji
nji
nji
nji
nji
nji
from which
( ) njinjiy
njiy
njiyx
njix
njix uurururrurur ,
11,
11,
1,
1,1
1,1 221 =+++++
++
+
+++
+
This will yield a pentadiagonal system whose solution is againvery time consuming and hence this scheme is also not veyuseful. One way to overcome this is to use a splitting methodwhich is known as the Alternating Direction Implicit (ADI)method. The algorithm produces two sets of tridiagonal systemsto be solved in sequence. The FDEs can be written as
( ) ( ) ( )
++
+=
++
+
++
+
2
1,,1,
2
2
1
,12
1
,2
1
,1,2
1
, 22
2
y
uuu
x
uuu
t
uunji
nji
nji
n
ji
n
ji
n
jinji
n
ji and
Page 9 of 21
-
8/3/2019 (v) Parabolic
10/21
( ) ( ) ( )
++
+=
++++
+
+
++
++
2
11,
1,
11,
2
2
1
,12
1
,2
1
,12
1
,1
, 22
2
y
uuu
x
uuu
t
uunji
nji
nji
n
ji
n
ji
n
ji
n
jinji
These equations
can be rearranged as
( )
( ) njiynjiynjiy
n
jix
n
jix
n
jix
ur
urur
ur
urur
1,,1,
2
1
,12
1
,2
1
,1
21
2
21
2
+
+
+
++
++=
++(8)
and
( )
( ) 21
,12
1
,2
1
,1
11,
1,
11,
21
2
21
2+
+
++
++
++
++=
++
n
jix
n
jix
n
jix
nji
ynjiy
nji
y
ur
urur
ur
urur
(9)
The solution procedure starts with the solution of the tridiagonalsystem in Eq. (8) whose formulation is implicit in the x -directionand explicit in the y -direction; thus the solution at this stage isreferred to as the x sweep (see figure below).
Solving the system in Eq. (8) gives the necessary data for theright hand side of Eq. (9) which can solved next to get thesolution for the 1+n time level. This is referred to as the y sweep.
Page 10 of 21
-
8/3/2019 (v) Parabolic
11/21
-
8/3/2019 (v) Parabolic
12/21
( )
( ) njiyxyxyyxx
njiyxyxyyxx
urrrr
urrrr
,2222
1,
2222
4
1
2
11
4
1
2
11
+++=
++ +
This can be factored into
njiyyxx
njiyyxx
urr
urr
,22
1,
22
2
11
2
11
2
11
2
11
+
+=
+
(14)
Let us now consider the ADI scheme which can be written as
( ) ( ) ( )
+
=
++
2
,2
2
2
1
,2
,2
1
,
2
y
u
x
u
t
uu njiyn
jixnji
n
ji
and
( ) ( ) ( )
+
=
++++
2
1,
2
2
2
1
,22
1
,1
,
2
y
u
x
u
t
uu njiyn
jix
n
jinji
Rearranging we get,( )
( )
( )
( )
njiy
nji
n
jix
n
ji uy
tuu
x
tu ,
2
2,2
1
,2
22
1
,22
+=
++
and
( )
( )
( )
( )2
1
,2
22
1
,1
,2
2
1,
22
++++
+=
n
jix
n
jinjiy
nji u
x
tuu
y
tu
Or
njiyy
n
jixx urur ,22
1
,2
2
11
2
11
+=
+ (15)
and
2
1
,21
,2
2
11
2
11
++
+=
n
jixxnjiyy urur (16)
Eqs. (15) and (16) can be combined by eliminating 21
,
+n
jiu,
resulting in
Page 12 of 21
-
8/3/2019 (v) Parabolic
13/21
njiyyxx
njiyyxx
urr
urr
,22
1,
22
2
11
2
11
2
11
2
11
+
+=
+
(17)
which is same as Eq. (14). Thus, the ADI scheme is theapproximate factorization of the Crank-Nicolson scheme. TheADI scheme retains the accuracy of the Crank-Nicolson scheme
( ) ( ) ( )222 ,, yxtO since it is obtained by adding
( )njinjiyxyx uurr ,1,224
1+ which is smaller than the truncation error of
the Crank-Nicolson scheme. But instead of solving thepentadiagonal system for the Crank-Nicolson scheme, ADImethod solves tridiagonal system.
Page 13 of 21
-
8/3/2019 (v) Parabolic
14/21
Fractional Step Methods
This method splits the multi-dimensional equation into a seriesof one-dimensional equations and solves them sequentially. For
two-dimensional case, we have
( ) ( ) ( )
+
=
++
2
,2
2
2
1
,2
,2
1
,
2
1
2
x
u
x
u
t
uu njixn
jixnji
n
ji (18)
and
( ) ( ) ( )
+
=
++++
2
2
1
,2
2
1,
22
1
,1
,
2
1
2
y
u
y
u
t
uun
jiynjiy
n
jinji
(19)
Note that the Crank-Nicolson scheme is used sequentially ineach space direction. The scheme is unconditionally stable and
is ( ) ( ) ( )222 ,, yxtO .
Extension to Three-Dimensions
The PDE for three-dimension is
+
+
=
2
2
2
2
2
2
z
u
y
u
x
u
t
u (20)
The ADI method can be used in three-dimensional case by
considering time intervals ofn , ,3
1+n ,
3
2+n and 1+n . The
resulting equations are
( ) ( ) ( ) ( )
+
+
=
++
2
,,2
2
,,2
2
3
1
,,2
,,3
1
,,
3z
u
y
u
x
u
t
uu n kjizn
kjiy
n
kjixn
kji
n
kji (21)
Page 14 of 21
-
8/3/2019 (v) Parabolic
15/21
( ) ( ) ( ) ( )
+
+
=
+++++
2
3
1
,,2
2
3
2
,,2
2
3
1
,,23
1
,,3
2
,,
3z
u
y
u
x
u
t
uun
kjiz
n
kjiy
n
kjix
n
kji
n
kji (22)
( ) ( ) ( ) ( )
+
+
=
+
++++
2
1,,2
2
3
2
,,2
2
3
2
,,23
2
,,1,,
3z
u
y
u
x
utuu n kjiz
n
kjiy
n
kjix
n
kjin kji (23)
This method is ( ) ( ) ( ) ( )222 ,,, zyxtO and is only conditionally
stable if ( )2
3++ zyx rrr . For this reason this method is not very
attractive. A method that is unconditionally stable and issecond-order accurate uses t he Crank-Nicolson scheme forwhich the finite difference equations are
( )
( )
( ) ( )
++
+
=
2
,,2
2
,,2
2
,,2*
,,2
,,*
,, 2
1
z
u
y
u
x
uu
t
uu
nkjiz
nkjiy
nkjixkjix
nkjikji
(24)
( )
( )
( ) ( )
+
++
+
=
2
,,2
2
,,2**
,,2
2
,,2*
,,2
,,**,,
2
1
2
1
z
u
y
uu
x
uu
t
uu
nkjiz
nkjiykjiy
nkjixkjix
nkjikji
(25)
Page 15 of 21
-
8/3/2019 (v) Parabolic
16/21
( )
( )
( )
( )
++
++
+
=
+
+
2
,,21
,,2
2
,,2**
,,2
2
,,2*
,,2
,,1,,
2
1
2
1
2
1
z
uu
y
uu
x
uu
t
uu
nkjiz
nkjiz
nkjiykjiy
nkjixkjix
nkji
nkji
(26)
Page 16 of 21
-
8/3/2019 (v) Parabolic
17/21
Application of Two-Dimensional Conduction(Diffusion) Equation
It is required to determine the temperature distribution in a long
bar with a rectangular cross section. The governing PDE is
+
=
2
2
2
2
y
T
x
T
t
T
where is the constant thermal diffusivity, specified as 0.645ft2/hr, and T is the temperature.
Page 17 of 21
-
8/3/2019 (v) Parabolic
18/21
-
8/3/2019 (v) Parabolic
19/21
-
8/3/2019 (v) Parabolic
20/21
d(im-1)=d(im-1)-jr*delx*c(im-1)c(im-1)=0.end if
call tridiagonal (im,a,b,c,d,u)
C convert one-dimensional array u(i) to two-dimensionalC array t(i,j)
do i=2,im-1t(i,j)=u(i)end do
end doC end of x-sweep---------------------------------------------------------
C t(i,j) now stores the temperature at time level n+1/2.
C y-sweep----------------------------------------------------------------------
do i=2,im-1
do j=2,jm-1a(j)=-ry/2.b(j)=1+ryc(j)=-ry/2.d(j)=(rx/2.)*t(i-1,j)+(1.-rx)*t(i,j)+(rx/2.)*t(i+1,j)end do
C if the bottom boundary is Neumann type (jb), modifycoefficientsb(2)=b(2)+a(2)d(2)=d(2)+jb*dely*a(2)a(2)=0.
C if the top boundary is Neumann type (jt), modifycoefficientsb(jm-1)=b(jm-1)+c(jm-1)d(jm-1)=d(jm-1)-jt*dely*c(jm-1)c(jm-1)=0.end if
Page 20 of 21
-
8/3/2019 (v) Parabolic
21/21
call tridiagonal (jm,a,b,c,d,u)
C convert one-dimensional array u(j) to two-dimensionalC array tn(i,j)
do j=2,jm-1tn(i,j)=u(j)end do
end doC end of y-sweep--------------------------------------------------------
C tn(i,j) now stores the temperature at time level n+1 fromwhich the next time marching can be done.
end doC end of time loop-------------------------------------------------------
C calculate boundary temperatures for Neumann typeboundary conditions. Required for plotting but not forcomputing.
If the left boundary is Neumann type (jl)do j=1,jm; tn(1,j)=tn(2,j)-jl*delx; end doend ifIf the right boundary is Neumann type (jr)do j=1,jm; tn(im,j)=tn(im-1,j)+jr*delx; end doend ifIf the bottom boundary is Neumann type (jb)do i=1,im; tn(i,1)=tn(i,2)-jb*dely; end doend ifIf the top boundary is Neumann type (jt)do i=1,im; tn(i,jm)=tn(i,jm-1)+jt*dely; end doend if
C tn(i,j) now contains the solution at the desired time.