You are on page 1of 31

AML 811 Lecture 9

Approximate Factorization Hyperbolic Equations: Leapfrog, FTBS

Recap : Implicit iterative method Line Gauss-Seidel


Line Gauss-Seidel

Values at each line are updated simultaneously based on latest available values

Recap : Line Gauss-Seidel example

Update direction

0 0 0 0 1 1 4 1 0 0 System of tridiagonal 0 1 4 1 0 equations 0 1 4 1 0 0 0 0 1 4 0 0 0 0 0

u2 0 u1,3 u u u 0 2 , 3 2 , 4 2 , 2 0 u 3, 3 u 3 , 4 u 3 , 2 = 0 u4,3 u4, 4 u4, 2 1 u5,3 u5, 4 u5, 2 u u 1 6 , 3 4

Recap : Line Gauss-Seidel Method Algorithm


1. 2. 3.

4. 5.

Initialize guess Choose a direction for sweeping (rows or columns) Sweep through lines updating all points in each line simultaneously to the k+1th level using the GaussSeidel update. This involves solving a system of tridiagonal equations After one sweep through the domain check error. If error too high, repeat steps 3 and 4
Any efficient way of solving tridiagonal systems?

Recap : Solving Tridiagonal systems : Thomas algorithm


ai xi 1 + bi xi + ci xi +1 = d i
Forward Sweep. Making the matrix upper-diagonal

Back-substitution to obtain x

Recap : Line SOR

1 uik, + j

Line SOR

1 = (1 )uik, j + uik, + j

Line Gauss Seidel

Values at each line are updated simultaneously based on latest available values

Recap : Crank-Nicholson as a multi-step method


Step 1: Explicit Update Step 2: Implicit Update

Total effect of explicit and implicit steps : Crank Nicholson

Recap : 2D parabolic equations


Example

Use 1D parabolic equation methods as stepping stone for 2D methods Explicit FTCS Implicit FTCS (same as BTCS) Crank-Nicholson As usual, we need to analyze consistency and stability for these It turns out that all these schemes are consistent. Stability?

Recap : Summary of Von-Neumann Analysis in 2D

Step 1 : Fourier Decomposition: Assume that solution is composed of a sum of waves of the form
Soln at grid point i,j at time step n

Step 2: Obtain evolution equation for the amplitude Substitute Fourier decomposition in the original Finite Difference equation and write it in the form

U n +1 = GU n
Gain or amplification factor

Recap : Summary of Von-Neumann 2D Analysis

Step 3 : Find region of stability Find the conditions on x, y, t under which the amplitude of the wave will be stable, i.e. not grow. This will happen if

Explicit FTCS for the diffusion equation


G = 1 4d x sin 2

4d y sin 2

2
Why not use FTCS implicit instead?

Stable only if
t t 1 dx + d y = 2 + 2 x y 2

Recap : Implicit formulation for 2D parabolic equation

Banded, pentadiagonal system of equations to be solved at each time step

Recap : Implicit formulation for 2D parabolic equation

Banded, pentadiagonal system of equations to be solved at each time step

Recap : Implicit formulation for 2D parabolic equation for a 5x5 system

Banded, pentadiagonal system of equations to be solved at each time step Very expensive. Is there a cheaper, equally stable alternative?

Recap : Alternate Direction Implicit (ADI) Scheme


x sweep

y sweep

Update in two steps Each step involves implicit space derivatives in only one direction This results in only a tridiagonal system of equations being solved in each step Unconditionally stable. Second order in space and time What is ADIs relationship to the 2D Crank-Nicholson scheme? Are they identical?

Summary of Lecture 8

Line Methods : Sweep through rows or columns updating all values in a line simultaneously : Line Gauss Seidel, LSOR Crank-Nicholson as a multi-step method involving separate explicit and an implicit steps. Von-Neumann stability analysis with 2 spatial dimensions Implicit schemes for 2D parabolic equations too expensive, explicit schemes too restrictive on time step Option : Alternate direction implicit scheme Update in two steps with each step having an implicit update in one spatial direction Unconditionally stable, second order accurate in time and space Whats its relation to Crank-Nicholson?

Recall : Alternate Direction Implicit (ADI) Scheme


x sweep

y sweep

Update in two steps Each step involves implicit space derivatives in only one direction This results in only a tridiagonal system of equations being solved in each step Unconditionally stable. Second order in space and time What is ADIs relationship to the 2D Crank-Nicholson scheme? Are they identical?

ADI and Crank-Nicholson methods in 2D


Crank-Nicholson

ADI
x sweep

y sweep

CN involves inverting a pentadiagonal matrix : P ADI involves inverting two tridiagonal matrices : T1 and T2 Whats the relation between P, T1 and T2?

ADI and Crank Nicholson: Approximate Factorization Methods


Crank Nicholson

ADI
Difference between the two

Since ADI treats each direction successively at a time lag compared to the other direction it is still an approximation of the Crank-Nicholson scheme However, since the difference between the two methods is less than the truncation error, it is a valid approximation and retains consistency and the overall order of convergence Methods such as ADI which approximate a more computationally intensive matrix inversion by a less intensive one (typically involving tridiagonal systems) are known as Approximate Factorization Methods.

Another approximate factorization : Fractional Step Method


Step 1 : x update

Step 2 : y update

Treat each direction separately by Crank Nicholson. Unlike ADI, which approximates the full 2D equation in each step, the fractional step method approximates only one 1D component in each step. This method is also unconditionally stable and second order accurate in time and space Approximate factorization methods can be used for elliptic equations also

Hyperbolic Equations
Recall

Have as many real characteristics as order of PDE Information travels at a finite speed. The effects of an action somewhere will be felt elsewhere after a time lag. Convection predominates in such problems Marching Problems: Initial solution or condition needs to be marched in time to get solution at a later time Domain of dependence : The region in space and time on which the solution at a point depends on Range of influence: The region in space and time which the value at a point will influence The compressible, inviscid fluid dynamic equations are hyperbolic

Recall : A preliminary scheme to solve the wave equation

Let us try and numerically solve the wave equation with some given initial condition
u u +a =0 t x

Use a forward difference scheme in time and central difference scheme in space (FTCS scheme)
u
n +1 i

t n =u a ui +1 uin1 + O(t , [x]2 ) x


n i

Stencil

Numerically solving the wave equation.

Let the initial condition be u(x,0) = u0(x)

Exact Solution

Wave moving towards right at speed c

Recall : FTCS for wave equation.

Using FTCS results in the following behavior irrespective of time step and grid size

FTCS is unconditionally unstable. What about FTFS,CTCS, BTCS, FTBS?

Leapfrog (CTCS) method


Stability condition

t 1 x

Some problems with Leapfrog Need to give some initial condition for n =1 apart from the usual condition for n = 0 Odd and even time steps are decoupled. i.e. The solution at the even time steps never depends on the solution at odd time steps. Often, two independent solutions develop over time (Exercise)

FTBS for the wave equation


uin uin1 uin +1 uin = a x t
t 1 x
Courant condition

Stable for c = a

First order in space and time Also known as the first order upwind method

FTBS for wave equation with CFL = 1

Gives the exact solution! Why?

FTBS for wave equation with CFL = 0.5

Why is the solution somewhat diffusive?

FTBS for wave equation with CFL = 0.9

Why is the solution somewhat diffusive but less diffusive than CFL = 0.5? Is FTBS consistent?

Artificial viscosity

FTBS can be rewritten as


uin+1 uin1 uin+1 2uin + uin1 uin +1 uin = +a x 2 x t

Here the coefficient artificial viscosity goes down as the grid size becomes smaller and hence the scheme is consistent However, the solution behaves as if it is the solution to a convection-diffusion equation

Summary

ADI is an approximate factorization of the Crank-Nicholson method Fractional Step Methods are another way of reducing computational costs for parabolic equations Hyperbolic equations

Stability analysis of Leapfrog method Leapfrog can lead to odd-even decoupling FTBS is a stable method for hyperbolic equations but it is first order accurate and can be diffusive

You might also like