Professional Documents
Culture Documents
• It is still a second order accurate explicit method, and becomes conditionally stable.
• Since the solution needs values at n and n − 1 time levels, a one-step method is to be used
as a starter. In addition, the computer storage requirement is higher than FTCS FDE.
İ.H. TUNCER & Y. ÖZYÖRÜK 119 AEE305-Numerical Methods in Aerospace Engineering
• The BTCS FDE written at the grid points form a system of coupled linear equations.
They are to be solved using matrix algebra tools.
• Implicit methods are mostly unconditionally stable. Therefore a large step size in time is
permitted.
• However, the selection of a large timestep is limited due to accuracy consideration. A
large time step increases the truncation error.
Consider the grid points at n + 1 time level starting from i = 1 to imax and the FDE written at
each point:
1 T n+1 n+1
TBC
1
T n+1 T2n
1
−d 2d + 1 −d
2
−d 2d + 1 −d .. ..
.
.
.. .. ..
. . . =
−d 2d + 1 −d
n+1
−d 2d + 1 −d
Tn
Timax−1
imax−1
n+1
1 n+1
Timax TBCimax
or
2d + 1 −d
T2n+1
T2n + dTBC n+1
1
−d 2d + 1 −d T3n+1 T3 n
.. .. .. ..
..
. . . =
. .
−d 2d + 1 −d
n+1
n
Timax−2
Timax−2
−d 2d + 1 Timax−1
n+1 n
Timax−1 + dTBC n+1
imax
The coefficient matrix has 3 non-zero diagonals, and is called a tridiagonal matrix .
İ.H. TUNCER & Y. ÖZYÖRÜK 122 AEE305-Numerical Methods in Aerospace Engineering
Thomas Algorithm
The tridiagonal system of equations are solved efficiently using the Thomas algorithm:
S u b r o u t i n e THOMAS ( imax , il , iu , a , b , c , f )
! S o l u t i o n o f a t r i d i a g o n a l s y s t e m e q u a t i o n s o f t h e form
! a ( i ) ∗ x ( i −1) + b ( i ) ∗ x ( i ) + c ( i ) ∗ x ( i +1) = f ( i ) for k = il , iu .
! The s o l u t i o n x ( i ) i s r e t u r n e d i n f ( i )
! a ( i l −1) and c ( i u +1) v a l u e s a r e n o t u s e d .
! a , b , c , f a r e t h e a r r a y s p r o v i d e d by t h e c a l l e r program
! ......................................................
r e a l , d i m e n s i o n ( imax ) : : a , b , c , f , x
x ( il ) = c ( il ) / b ( il )
f ( il ) = f ( il ) / b ( il )
ilp1 = il + 1
do i = ilp1 , iu
z = 1 . / ( b ( i ) − a ( i ) ∗ x ( i −1) )
x(i) = c(i) ∗ z
f ( i ) = ( f ( i ) − a ( i ) ∗ f ( i −1) ) ∗ z
enddo
iupil = iu + il
do ii = ilp1 , iu
i = iupil − ii
f ( i ) = f ( i ) − x ( i ) ∗ f ( i+1)
enddo
return
End
İ.H. TUNCER & Y. ÖZYÖRÜK 123 AEE305-Numerical Methods in Aerospace Engineering
Solution of Parabolic PDEs - Crank-Nicolson Implicit Method
The other well-known implicit method is Crank-Nicolson method.
• If the FDE is written at the pseudo (n + 12 ) time step, the time derivative becomes a
central difference approximation and the second order space derivative is replaced by the
average of central differences at time levels n and n + 1:
n+1 n+1 n+1
Tin+1 − Tin Tin+1 − Tin 1 Ti+1 − 2Ti + Ti−1 n
T n − 2Tin + Ti−1
∆t
≡ = α [ 2
+ i+1 2
]+O(∆t 2 , ∆x 2 )
2( 2 ) ∆t 2 ∆x ∆x
or
b c
T2n+1
RHSn2 − aTBC n+1
n 1
a b c T3n+1 RHS3
.. .. .. ..
..
. . . =
. .
a b c n+1
RHSnimax−2
T
n+1
imax−2
a b Timax−1 RHSnimax−1 − cTBCn+1
imax
∂T ∂2T ∂2T
= α[ 2 + ]
∂t ∂x ∂y 2
n+1 n n n n n n n
Ti,j − Ti,j Ti+1,j − 2Ti,j + Ti−1,j Ti,j+1 − 2Ti,j + Ti,j−1
= α[ 2
+ 2
]
∆t ∆x ∆y
1
• Stability analysis indicates that the FDE is stable for α∆t α∆t
∆x 2 + ∆y 2 ≡ dx + dy ≤ 2 which is
twice as restrictive as the 1D case, and it makes this explicit formulation an inefficient
procedure.
İ.H. TUNCER & Y. ÖZYÖRÜK 127 AEE305-Numerical Methods in Aerospace Engineering
• For example, on a 6 × 5 grid (imax = 6, jmax = 5) with Dirichlet type BCs, the
following system of equations in a pentadiagonal matrix form is obtained:
n n+1 n+1
n+1 T2,2 − aT1,2 − dT2,1
b c e T2,2
n n+1
T3,2 − dT3,1
a b c e T3,2
n
T4,2 n+1
− dT4,1
a b c e T4,2
T n
− cT n+1
− n+1
dT5,1
a b e T5,2
5,2 6,2
d
n n+1
b c e T2,3
T2,3 − aT1,3
d a b c e T3,3
n
T3,3
=
d a b c e T4,3
n
T4,3
d a b e T5,3
T n
− n+1
cT6,3
5,3
d b c T2,4 n n+1
T2,4 − aT1,4 − eT2,5
n+1
d a b c
T3,4
T n
− eT n+1
d a b c
T4,4
3,4 3,5
T n − eT n+1
d a b T5,4
n 4,4 n+1 4,5 n+1
T5,4 − cT6,4 − eT5,5
and
n+1 n+ 21 n+ 1 n+ 12 n+ 1 n+1 n+1 n+1
Ti,j − Ti,j Ti+1,j2 − 2Ti,j + Ti−1,j2 Ti,j+1 − 2Ti,j + Ti,j−1
∆t
= α[ + ]
2
∆x 2 ∆y 2
• The first equation is implicit in the i-direction and explicit in the j-direction. It leads to a
tridiagonal system of equations.
• Solving the first system of equations for all the j-lines, which is called J-sweep , implicitly
provides the necessary data for the RHS of the second system of equations, which , in
turn, is solved for all the i-lines, which is called I-sweep .
• I-sweep:
n+1 n n n+1/2
dTi,j−1 + eTi,j + eTi,j+1 = RHSi,j
• To prevent the bias in the solution, the order of sweep is alternated from one time step to
the other:
do n = 1, nsteps
if( mod(n,2) == 1 )then
DO I-sweep
DO J-sweep
else
DO J-sweep
DO I-sweep
endif
İ.H. TUNCER & Y. ÖZYenddo
ÖRÜK 131 AEE305-Numerical Methods in Aerospace Engineering
• There are two methods of solution for the system of linear algebraic equations:
• Direct solution methods: Gauss elimination, Cramer’s rule, and such
• Iterative solution methods: An initial solution is guessed, the new values are approximately
computed. The precedure is repeated until a specified convergence criteria is reached.
• Iterative methods are either
• point iterative methods, where the formulation results in a single unknown, or
• line iterative methods, where the formulation involves more than one unknown.
k+1 1
ui,j = [u k k
+ ui+1,j + β 2 (ui,j−1
k k
+ ui,j+1 )]
2(1 + β 2 ) i−1,j
where k corresponds to the previously computed values or the initial guess at the start of
the iteration process.
• Unknowns are solved one by one at each grid point similar to explicit methods in time
marching solutions of parabolic problems.
• An important difference is that the time dependent solution of parabolic equation is a
valid solution at any intermediate time level. On the other hand, the intermediate solution
of an elliptic equation has no significance, it is only a path to the converged solution.
• However, the point Jacobi method does not use the newly computed values of the
unknowns as they become available. It is therefore rarely/never used.
• As opposed to Jacobi iteration method, in this method the values of the unknown
dependent variable at the current iteration level, k + 1, are used as soon as they become
available :
k+1 k+1 k+1
β 2 ui,j−1 + ui−1,j − 2(1 + β 2 )ui,j k
+ ui+1,j + β 2 ui,j+1
k
=0
k+1 1
ui,j = [u k+1 +ui+1,j
k k+1
+β 2 (ui,j−1 k
+ui,j+1 )]
2(1 + β 2 ) i−1,j
• For a convergent solution 0 < ω < 2. The optimum value of the relaxation parameter is
usually determined by numerical experimentation.
• If 0 < ω < 1, it is called under-relaxation. In the solution of certain non-linear PDEs it
slows the convergence to prevent divergence.
İ.H. TUNCER & Y. ÖZYÖRÜK 136 AEE305-Numerical Methods in Aerospace Engineering
or
k+1 k+1 k+1 k+1
ui−1,j − 2(1 + β 2 )ui,j + ui+1,j = −β 2 (ui,j+1
k
+ ui,j−1 )
• This equation is applied to all i’s at j = constant grid lines, and a system of linear
equations, which has a tridiagonal coefficient matrix, is obtained.
• This method converges faster than the Gauss-Seidel method, but requires more
computation per iteration, since a system of simultaneous equations is solved.
• Note that the influence of the BC at i = 1 and i = imax are reflected into the solution
immediately.
• For problems in which the solution variable changes more rapidly in one direction, it is
advantageous to use LGS in that direction.
and
k+2 k+2 k+2 k+2 k+1
β 2 ui,j−1 − 2(1 + β 2 )ui,j + β 2 ui,j+1 = −(ui−1,j + ui+1,j )
• The consistency analysis of FTBS FDE for the linear convection equation leads to
∆t ∆x
wt + Vwx = − wtt + V wxx + O(∆t 2 , ∆x 2 )
2 2
∂2w 2
• Note that ∂w
∂t ≡ −V ∂w
∂x and ∂t 2 ≡ V 2 ∂∂xw2 :
V ∆x
wt + Vwx = (1 − σ)wxx + O(∆t 2 , ∆x 2 )
2
diffusion coefficient or 1
FTBS
exact
1
FTBS
exact
artificial viscosity. 0.8 0.8
numerical dissipation w
0.4
w
0.4
disappears.
0.2 0.2
reduced. 1
nσ = 4, σ = 0.5
1
nσ = 8, σ = 0.5
FTBS FTBS
expensive solution.
İ.H. TUNCER & Y. ÖZYÖRÜK 142 AEE305-Numerical Methods in Aerospace Engineering
• The FDE is obtained by using the second-order accurate central differencing for the spatial
derivatives:
n n
wi+1 − wi−1 1 w n − 2win + wi−1
n
win+1 = win − V ∆t( ) + V 2 ∆t 2 ( i+1 ) + O(∆t 3 , ∆x 2 )
2∆x 2 ∆x 2
The second-order accurate Lax-Wendroff method is then given by
1 1
win+1 = win − σ(wi+1
n n
− wi−1 ) + σ 2 (wi+1
n
− 2win + wi−1
n
)
2 2
İ.H. TUNCER & Y. ÖZYÖRÜK 143 AEE305-Numerical Methods in Aerospace Engineering
0 0 0
0 0 0
• Third order error terms associated with second-order methods are known as dispersion
errors. They are indicated by wiggles (oscillations) in the solution
• The FTBS explicit FDE developed for the linear convection eqn. may be used for the
solution of the non-linear eqn. provided that the sign of u is taken into account at each
grid point or the proper forward and backward differencing algorithm is employed.
• LAX METHOD: Another explicit method is derived from the unstable FTCS FDE:
uin+1 − uin E n + Ei−1
n
+ i+1 = O(∆t, ∆x 2 )
∆t 2∆x
İ.H. TUNCER & Y. ÖZYÖRÜK 147 AEE305-Numerical Methods in Aerospace Engineering
Solution of Hyperbolic PDEs - Non-Linear Convection Equation
• For stability uin is replaced by its average
1 n ∆t
uin+1 = n
(ui+1 + ui−1 )− (E n − Ei−1
n
)
2 2∆x i+1
1 n n ∆t
= (u + ui−1 )− [(u n )2 − (ui−1
n
)2 ]
2 i+1 4∆x i+1
u
which is similarly stable for ∆t∆xmax
≤ 1.
• In IMPLICIT methods, the FDE needs to be linearized by first factoring the non-linear
term and lagging the non-linear part in time. BTCS leads to