You are on page 1of 20

Lecture 3

AE 410 / CSE 461

Computational Aerodynamics
Instructor: Prof. Marco Panesi

1. 1
AE 410
Summary of the Previous Lecture

1. Numerical Differentiation using Finite Different method

1. Use of undetermined coefficients and Taylor expansion to build


approximation of any order to the derivative.

1. Concept of Truncation Error

1. 2
AE 410
Calculus Definition of a Derivative

In calculus you learned that:

This is exact if we take the limit

1. 3
AE 410
Finite Difference Approximation

Our goal is to approximate the derivative operators:

By some linear combination of

1. 4
AE 410
Finite Difference Approximation

Let us start with something simple:

We want to find which approximate:

Using Taylor expansion about ui to express ui-1 and ui+1:

In order for the equation above to be satisfied we must impose conditions


on the a, b, c coefficients.
1. 5
AE 410
Truncation Error

The method is second order accurate!

1. 6
AE 410
EXAMPLE – Sin (x)

sin(x) ( x)2 @ 3 u
6 @x3
0.1

@u ui+1 ui 1
ert


@x i 2 x
0.05

0
0 0.2 0.4 0.6 0.8 1
Δx
1. 7
AE 410
Reading Assignment

1. Chapter 2 of the textbook (we have skipped few things, but we will get
back to them later)

1. Chapter 3 of the textbook

1. In particular section 3.4

1. 8
AE 410
Generation of FD Schemes

The generation of Finite Difference schemes proceeds very similarly. A


typical scheme is considered based on particular needs:

1. Order of accuracy

2. Stencil constraints
Low Bandwidth (Centered)

i-1 i i+1
Higher Bandwidth (Centered)

i-2 i-1 i i+1 i+2


Biased Stencil
i i+1 i+2 i+3

1. 9
AE 410
Generation of FD Schemes

3. Additional properties:
2 2
( x) ( x)
• Low truncation coefficients: vs
120 6
• Specific Derivative

• ...

A clean way to “analytically” compute the stencil coefficients is via a


Taylor table.

1. 10
AE 410
Taylor Table
@u 1
Example: (a2 ui 2 + a1 ui 1 + bui ) = erT
@x i x
Each term expanded in Taylor Series and placed in a table simplifying the algebra:
@u 2
2 @ u
@3u
3
ui x ( x) ( x)
@x i @x2 i
@x3 i
@u
x
@x
0 1 0
i
1 1 2 3 1
a 2 ui 2 a2 a2 ( 2) a2 ( 2) a2 ( 2)
1! 2! 3!
a1 1 2 1
a 1 ui a1 ( 1) 3 1
1 a1 ( 1) a ( 1)
1! 2! 1 3!
bui b 0 0 0
x erT
1. 11
AE 410
Taylor Table

• Note: the multiplication by ∆x to again simplify the table.


• We set a number of column to zero to satisfy the unknown coefficients

a1
a2
b
Note we put the linear equations into a matrix form, let Matlab do the
work for you.

Which gives
1 3
a2 = a1 = 2 b=
2 2
1. 12
AE 410
Taylor Table

In this case the fourth column provides the leading truncation:

✓ ◆ ✓ ◆
@u 1 1 3 1 8a2 a1 3 @3u
ui 2 + 2ui 1 + ui = + ( x)
@x i x 2 2 x 6 6 @x3 i

2 3
( x) 3 @ u
erT = ( x)
3 @x3 i

Thus we have derived a second-order backward-difference approximation of a


first derivative:

@u 1 2
= (ui 2 + 4ui 1 + 3ui ) + O ( x)
@x i 2 x
1. 13
AE 410
Lagrange Interpolation

There is a connection between Finite Difference and Lagrangian


Interpolation.

For example:

Suppose Irepresent u(x) by a quadratic


polynomial
f (x) = ax2 + bx + c between points {xi 1 , xi , xi+1 } and
I require

f (xi 1) = u(xi 1)
f (xi ) = u(xi )
f (xi+1 ) = u(xi+1 )

1. 14
AE 410
Lagrange Interpolation

Then {a, b, c} must satisfy:


0 2 10 1 0 1
xi 1 xi 1 1 a ui 1
@ x2i xi 1A @ b A = @ ui A
x2i+1 xi+1 1 c ui+1

which has solution:

ui+1 2ui + ui 1
a=
2h2

Where h is the grid spacing (assumed uniform)

1. 15
AE 410
Lagrange Interpolation

ui+1 (h 2xi ) + ui (4hxi ) + ui 1( h 2xi )


b=
2h2

xi (h xi )ui+1 + 2(h2 x2i )ui + xi (h + xi )ui 1


c=
2h2
If we take the derivative we get:

df ui+1 ui 1
= 2a x + b =
dx i 2h
Which is second order in accuracy.

1. 16
AE 410
Lagrange Interpolation

The second derivative is:

d2 f ui+1 2ui + ui 1
= 2a =
dx2 i h2
Which is second order in accuracy.

We see that assuming:


X
u(x) = ak (x) uk
k=0

gives rise to specific finite difference schemes.

1. 17
AE 410
Pade’ Finite Difference Schemes

A generalization of the Lagrangian approach is brought about by using Hermitian interpolation.


To construct a polynomial in u(x) Hermite formulas use values of the functions and at its
derivative at a given point in space.

This give rise to implicit finite differences (or Pade’ Finite Differences). For example, assuming
quadratic interpolation for both u(x) and u’(x) yields

✓ ◆
@u @u @u 3 ( x)4 @5u
+4 + = (ui+1 ui 1 ) +
@x i 1 @x i @x i+1 x 120 @x5

1. 18
AE 410
Pade’ Finite Differences

i-1 i i+1

This scheme is 4th order accurate using only 3 points stencil.

1. The determination of the derivative of the point i requires the knowledge of the derivative at
the point i-1 and i+1. Hence, it is implicit!

1. 19
AE 410
What have we learned?

1. Construction of the Finite Difference Schemes using Taylor Tables.

2. Construction of Finite Difference Schemes using Lagrange polynomials

3. Construction of Finite Difference Scheme using Hermite polynomials

4. Difference between implicit and explicit Finite Difference schemes.

1. 20
AE 410

You might also like