0% found this document useful (0 votes)
16 views45 pages

4 FiniteDifferenceMethod1

The finite difference method in fluid dynamics - Part 1

Uploaded by

jabrayanserouj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views45 pages

4 FiniteDifferenceMethod1

The finite difference method in fluid dynamics - Part 1

Uploaded by

jabrayanserouj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Numerical Methods in Thermo-Fluid Dynamics I

Finite-Difference-Method 1

Dr.-Ing. Manuel Münsch


Friedrich-Alexander Universität Erlangen-Nürnberg
Lehrstuhl für Strömungsmechanik

Erlangen
Erlangen

Schedule
No. Week(s) Practical Lecture Exercise
Monday: 10:00-11:30 Monday: 14:15-15:45 Wednesday: 10:15-11:45
Room: online Room: online Room: online
1. 02.11.20-06.11.20 Matlab Tutorial I Introduction and Navier-Stokes Eq. No Exercise
2. 09.11.20-13.11.20 Matlab Tutorial II; Computer Exercise 1 Simplification of NSE up to Boundary Layer Eq. Hand out Exercise 1
3. 16.11.20-20.11.20 Work on Computer Ex. 1 Initial Value Problems: Time Stepping (ODEs) Work on Exercise 1
4. 23.11.20-27.11.20 Work on Computer Ex. 1 Finite Difference Method 1 Presentation Ex. 1 &
Hand out Ex. 2
5. 30.11.20-04.12.20 Work on Computer Ex. 1 Finite Difference Method 2 Work on Ex. 2
6. 07.12.20-11.12.20 Work on Computer Ex. 1 Consistency, Stability and Convergence Presentation Ex. 2 &
Hand out Ex. 3 + 4
7. 14.12.20-18.12.20 Submit & Present Computer Ex. 1 Finite Volume Method 1 Work on Ex. 3 + 4
Computer Ex. 2
8. 21.12.20-23.12.20 Work on Computer Ex. 2 Finite Volume Method 2 Work on Ex. 3 + 4
24.12.20-06.01.21 Holiday Holiday Holiday
07.01.21-08.01.21 Presentation Ex. 3 + 4 &
Hand out Ex. 5
9. 11.01.21-15.01.21 Submit & Present Computer Ex. 2 Numerical solution of the Navier-Stokes-Equations 1 Work on Ex. 5
Computer Ex. 3
10. 18.01.21-22.01.21 Work on Computer Ex. 3 Numerical solution of the Navier-Stokes-Equations 2 Work on Ex. 5
11. 25.01.21-29.01.21 Work on Computer Ex. 3 Numerical solution of the Navier-Stokes-Equations 3 Presentation Ex. 5 &
Hand out Ex. 6
12. 01.02.21-05.02.21 Work on Computer Ex. 3 Numerical solution of the Navier-Stokes-Equations 4 Work on Ex. 6
Hand out Ex.6
13. 08.02.21-12.02.21 Submit & Present Computer Ex. 3 Boundary Conditions Presentation Ex. 6

Dr.-Ing. Manuel Münsch | FAU | 2


Erlangen

Outline

• PART 1: Repetition
• Initial value problems: Time-Stepping

• PART 2: Finite-Difference-Method 1
• Introduction
• FDM via Taylor Series
• FDM via Polynomials

Dr.-Ing. Manuel Münsch | FAU | 3


PART 1: Repetition

Erlangen
Erlangen

Repetition
Time Marching
• Time Marching Approaches are very similar to general solution strategies
of initial values problems (like Blasius equation) which becomes more
obvious by a reformulation of the equation:

∂(ρφ) ∂(ρuj φ) ∂ ∂φ
=− + (Γ ) + Sφ = Res(φ(t ), t ) (1)
∂t ∂ xj ∂ xj ∂ xj
with residual Res(φ(t ), t ) containing all convective and diffusive fluxes

• for comparison: ordinary differential equation / initial value problem (IVP)

d φ(t )
= f (φ(t ), t ) with φ(t0) = φ0 (2)
dt

Dr.-Ing. Manuel Münsch | FAU | 5


Erlangen

Repetition
Time Marching
• Initial Value Problems (IVP):
• initial condition -> time step to approximate the state of the system after some
time evolution
• Accuracy: first, second and higher order methods
• Explicit Methods: comp. cheap, conditionally stable
• Implicit Methods: comp. expensive, unconditionally stable
• Single Step versus Multi Step Methods
• Stiff problems: implicit methods

Dr.-Ing. Manuel Münsch | FAU | 6


PART 2: Finite-Difference-Method 1

Erlangen
Erlangen

Motivation
Spreading of a contaminant

Dr.-Ing. Manuel Münsch | FAU | 8


Erlangen

Introduction

• a general analytical solution for the Navier-Stokes equation is not available


• the prediction of fluid flow is possible by making use of numerical solution
strategies
• this requires a discretization in time & time stepping algorithms (see last
lecture)
• and in addition a discretization in space via the common approaches:
• Finite-Differences
• Finite-Volumes
• Transport Equation:

∂(ρφ) ∂(ρuj φ) ∂ ∂φ
+ = (Γ ) + Sφ (3)
∂t ∂ xj ∂ xj ∂ xj

Dr.-Ing. Manuel Münsch | FAU | 9


Erlangen

Introduction
Finite-Difference-Method
• starting point is the differential notation of the conservation equations
(here casted into a general transport eq.)
∂(ρφ) ∂(ρuj φ) ∂ ∂φ
+ = (Γ ) + Sφ (4)
∂t ∂ xj ∂ xj ∂ xj
• this is a coupled, non-linear differential equation containing:
2 2
• partial derivatives of first ( ∂∂x ) and second order ( ∂∂x 2 ), ( ∂ x∂∂ x ) in space
i i i j

• partial derivatives of first order ( ∂∂t ) in time


• for the numerical prediction the area of integration, i.e., the domain of
interest is subdivided via a computational grid
• at each grid point the geometrical coordinates xi and the field variables like
(ui , ρ, p, T ) are defined

Dr.-Ing. Manuel Münsch | FAU | 10


Erlangen

Introduction
1-D Grid: 2-D Grid:

Nj

j+4

j+3 (i,j)

1 i+1 i+2 i+3 i+4 i+5 i+6 i+7 i+8 i+9 Ni j+2

j+1
Boundary Points Inner Points
1
1 i+1 i+2 i+3 i+4 i+5 i+6 i+7 i+8 i+9 Ni

Boundary Points Inner Points

• local structured grids for one and two dimensional flow problems
• grid is Cartesian and in general not equidistant (∆xi 6= const .)
• boundary conditions have to be defined at the boundary points / Boundary
Value Problem (BVP)
• solutions are predicted for inner points
Dr.-Ing. Manuel Münsch | FAU | 11
Erlangen

Introduction
Finite-Difference-Method
• in the FD approach the partial differential equation is replaced by finite
differences
• at each grid point the partial derivatives of first and second order are
replaced by appropriate difference approximations → to be discussed
today
• the previous steps are known as discretization: here, FD-discretization
• in combination with boundary and initial conditions a coupled, algebraic
equation system is obtained
Aφ = b (5)
• the equation can be solved via a digital computer
• the exact solution of the partial differential equation equals the solution of
the finite difference equation plus an Error
• the Error is a function of the number of grid points and the disrcetization
scheme
Dr.-Ing. Manuel Münsch | FAU | 12
Erlangen

Introduction
Finite-Difference-Method
• Target: approximate the exact solution of the partial differential equation as
good as possible
-> the numerical solution has to converge towards the exact solution with
decreasing step sizes ∆xi and ∆t: converged solution
• Requirements: the numerical scheme has to be consistent and stable
(See particular Lecture)

Dr.-Ing. Manuel Münsch | FAU | 13


Erlangen

Finite-Difference-Method
Derivation of consistent differential formulations
• Starting Point: at the particular grid points (i , j ) the flow quantities are
available
• Task: approximate the partial derivative ∂ f /∂ x at the grid points via
difference approximations:
∂f ∆f
→ + T = Finite Difference + Truncation Error (6)
∂x ∆x

• the difference approximation is called consistent if:


 
∂f ∆f
lim T = lim − =0 (7)
∆x →0 ∆x →0 ∂ x ∆x
• the finite difference can be of different type, accuracy and characteristics
• the finite difference can be approximated via Taylor Series or Polynomials

Dr.-Ing. Manuel Münsch | FAU | 14


Finite-Difference-Approximations via Taylor Series

Erlangen
Erlangen

Finite-Difference-Method
Taylor Series
Consider a continuous, infinitely differentiable function f (x ) at point x. Then,
the value of the function f at position x + ∆x can be calculated from a Taylor
Series expanded about point x:
∂ f ∆x ∂ 2f (∆x )2 ∂ 3f (∆x )3 ∂ n f (∆x )n
f (x + ∆x ) = f (x ) + + 2 + 3 + ... + n (8)
∂ x 1! ∂ x 2! ∂ x 3! | ∂ x{z n! }
HOT

• or in index notation on a 1-D Grid with grid spacing h1 = xi −1 − xi and


h2 = xi +1 − xi
∂ f h2 ∂ 2f (h2)2 ∂ 3f (h2)3
fi +1 = fi + + 2 + 3 + HOT (9)
∂ x 1! ∂ x 2! ∂ x 3!
2 2
∂ f h1 ∂ f (h1) ∂ 3f (h1)3
fi −1 = fi − + 2 − 3 + HOT (10)
∂ x 1! ∂ x 2! ∂ x 3!
• with higher order terms represented by term HOT
Dr.-Ing. Manuel Münsch | FAU | 16
Erlangen

Finite-Difference-Method
Taylor Series Approximations
Illustration of function f and underlying base points:
f

fi
fi −1 fi +1

fi +2
fi −2
h1 h2

xi −2 xi −1 xi xi +1 xi +2 x

Dr.-Ing. Manuel Münsch | FAU | 17


Erlangen

Finite-Difference-Method
Taylor Series: Forward Difference Approximation of ∂ f /∂ x
• the derivation of the FDS approximation for ∂∂xf at point i starts from:
∂ f h2 ∂ 2f (h2)2 ∂ 3f (h2)3
fi +1 = fi + + + 3 + HOT (11)
∂ x 1! ∂ x 2 2! ∂ x 3!

• solve for ∂ f /∂ x:
∂f fi +1 − fi ∂ 2f h2 ∂ 3f (h2)2
= − 2 − 3 − HOT (12)
∂x h2 |∂ x 2! ∂ x {z 3! }
T

• with truncation error of first order accuracy:


T = O((h2)1) (13)

Dr.-Ing. Manuel Münsch | FAU | 18


Erlangen

Finite-Difference-Method
Taylor Series: Backward Difference Approximation of ∂ f /∂ x
• the derivation of the BDS approximation for ∂∂xf at point i starts from:
∂ f h1 ∂ 2f (h1)2 ∂ 3f (h1)3
fi −1 = fi − + − 3 + HOT (14)
∂ x 1! ∂ x 2 2! ∂ x 3!

• solve for ∂ f /∂ x:
∂f fi − fi −1 ∂ 2f h1 ∂ 3f (h1)2
= + 2 − 3 + HOT (15)
∂x h1 |∂ x 2! ∂ x{z 3! }
T

• with truncation error of first order accuracy:


T = O((h1)1) (16)

Dr.-Ing. Manuel Münsch | FAU | 19


Erlangen

Finite-Difference-Method
Taylor Series: CDS Approximations of ∂ f /∂ x (A)
• the derivation starts from substracting eq. (14) from eq. (11):
∂f ∂ 2f h12 − h22 ∂ 3f h13 + h23
fi +1 − fi −1 = (h1 + h2) + 2 + 3 + HOT (17)
∂x ∂x 2! ∂x 3!

• solve for ∂ f /∂ x:
∂f fi +1 − fi −1 ∂ 2f h1 − h2 ∂ 3f h13 + h23
= − 2 − 3 + HOT (18)
∂x h1 + h2 ∂x 2! ∂ x (h1 + h2)3!
| {z }
T

• with truncation error:


h13 + h23
T = O((h1 − h2), ) (19)
h1 + h2
→ first order for h1 6= h2
→ second order for h1 = h2
Dr.-Ing. Manuel Münsch | FAU | 20
Erlangen

Finite-Difference-Method
Taylor Series: CDS Approximations of ∂ f /∂ x (B)
• to improve accuracy for arbitrary grids where h1 6= h2 one can eliminate
2
the leading term of the truncation error: ∂∂xf2
• for this multiply eq. (11) with h12, multiply eq. (14) with h22 and substract the
resulting equations
• afterwards solve for ∂ f /∂ x:
∂f h12(fi +1 − fi ) + h22(fi − fi −1) ∂ 3f h1h2
= − 3 + ... (20)
∂x h1h2(h1 + h2) |∂ x 3{z! }
T

• with truncation error:


T = O(h1 · h2) (21)
→ formally of second order if / since h1 ≈ h2

Dr.-Ing. Manuel Münsch | FAU | 21


Erlangen

Finite-Difference-Method
Taylor Series: CDS Approximations of ∂ f /∂ x (B)
• for equidistant grids where h1 = h2 = h:
∂f fi +1 − fi −1 ∂ 3 f h2 ∂ 5 f h4
= − 3 − 5 (22)
∂x 2h |∂ x 3! {z ∂ x 5}!
T

• with truncation error:


T = O(h2) (23)
→ second order accuracy

Dr.-Ing. Manuel Münsch | FAU | 22


Erlangen

Finite-Difference-Method
Taylor Series: Approximations of ∂ f /∂ x
• FDS, BDS and especially CDS are the most used FD approximations

(Figure basing on the lecture script: Numerische Strömungsmechanik, M. Breuer, FAU/LSTM, 2006)

Dr.-Ing. Manuel Münsch | FAU | 23


Erlangen

Finite-Difference-Method
Taylor Series: One-sided Approximations of ∂ f /∂ x
• base points don’t have to be centered around point i
• this is usefull close to the boundary of a grid where only a limited number
of neighbouring points are available or no neighbouring points are
available
f
h3

h1 h2

xi xi +1 xi +2 x

Dr.-Ing. Manuel Münsch | FAU | 24


Erlangen

Finite-Difference-Method
Taylor Series: One-sided Approximations of ∂ f /∂ x
• here, an additional point i + 2 is considered:
∂ f h3 ∂ 2f h32 ∂ 3f h33
fi +2 = fi + + − + ... (24)
∂ x 1! ∂ x 2 2! ∂ x 3 3!

• consider eq. (11)·h32− (24)·h12 and solving for ∂ f /∂ x:

∂f h12(fi +2 − fi ) − h32(fi +1 − fi ) ∂ 3f h1h3


=− + 3 + ... (25)
∂x h1h3(h3 − h1) |∂ x 3{z
! }
T =O(h1 h3 )

Dr.-Ing. Manuel Münsch | FAU | 25


Erlangen

Finite-Difference-Method
Taylor Series: One-sided Approximations of ∂ f /∂ x
• for h1 = h2 = h3/2 = h:
∂f fi +2 + 3fi − 4fi +1 ∂ 3 f h2
=− + 3 + ... (26)
∂x 2h |∂ x 3{z! }
T =O(h2 )
• here, with truncation error:
T = O(h2) (27)
→ of second order accuracy

Dr.-Ing. Manuel Münsch | FAU | 26


Erlangen

Finite-Difference-Method
Taylor Series: Approximations of ∂ f /∂ x
Of course, higher order approximations basing on additional grid points are
also possible.
In general:
• First Order:
∂f fi +1 − fi
= + T1 (28)
∂x ∆x
• Second Order:
∂f fi +1 − fi −1
= + T2 (29)
∂x 2∆x
• Third Order:
∂f −fi +2 + 6fi +1 − 3fi − 2fi −1
= + T3 (30)
∂x 6∆x
• Fourth Order:
∂f −fi +2 + 8fi +1 − 8fi −1 + fi −2
= + T4 (31)
∂x 12∆x
Dr.-Ing. Manuel Münsch | FAU | 27
Erlangen

Finite-Difference-Method
Taylor Series: Truncation Error
Here Tm is the truncation error:
∂ 2f ∆x ∂ 3f ∆x 2
T1 =− 2 − 3 + HOT1 = O(∆x 1) (32)
∂ x 2! ∂ x 3!
3 2
∂ f ∆x ∂ 5f ∆x 4
T2 =− 3 − 5 + HOT2 = O(∆x 2) (33)
∂ x 3! ∂ x 5!
∂ 4f ∆x 3 ∂ 5f ∆x 4
T3 = 4 + 5 + HOT3 = O(∆x 3) (34)
∂ x 4! ∂ x 5!
5 4
∂ f ∆x ∂ 7f ∆x 6
T4 = 5 + 7 + HOT4 = O(∆x 4) (35)
∂ x 5! ∂ x 7!

-> the exponent of the leading term is specifying the truncation error of the
scheme:
Tr = O(∆x r ) with order of accuracy: r (36)
-> thus, the power of decay of the discretization error when ∆x − > 0

Dr.-Ing. Manuel Münsch | FAU | 28


Erlangen

Finite-Difference-Method
Taylor Series: Truncation Error
When the grid is refined by ∆x /n the truncation error is:
 r
∆x 1
Tr ( )= Tr (∆x ) (37)
n n

• first order scheme and n = 2:


∆x 1
Tr ( ) = Tr (∆x ) (38)
2 2
• second order scheme and n = 2:
∆x 1
Tr ( ) = Tr (∆x ) (39)
2 4
• third order scheme and n = 2:
∆x 1
Tr ( ) = Tr (∆x ) (40)
2 8
• fourth order scheme and n = 2:
∆x 1
Tr ( ) = Tr (∆x ) (41)
Dr.-Ing. Manuel Münsch | FAU | 2 16 29
Erlangen

Finite-Difference-Method
Taylor Series: Approximation of ∂ 2f /∂ x 2
∂ 2f
• according to the previous derivations also approximations for ∂x 2 can be
derived

• 2 possible procedures:
∂f
A here, eq. (11) and eq. (14) have to be combined such that the leading term ∂x is
skipped
2
B express ∂∂xf2 as ∂∂x ∂∂xf

Dr.-Ing. Manuel Münsch | FAU | 30


Erlangen

Finite-Difference-Method
Taylor Series: Approximation of ∂ 2f /∂ x 2
∂f
A combine eq. (11) and eq. (14) such that the leading term ∂x is skipped

• here, eq. (11) ·h1+ eq. (14) ·h2:


∂ 2f 2 (h1(fi +1 − fi ) − h2(fi − fi −1)) ∂ 3f h1 − h2
= + 3 + HOT (42)
∂x 2 h1h2(h1 + h2) ∂
| x 3!{z }
T =O((h1 −h2 )

• for h1 = h2 = h:
∂ 2f fi +1 − 2fi + fi −1 ∂ 4 f h2
2
= 2
− 4 + HOT (43)
∂x h |∂ x 12{z }
T =O(h2 )
• here, with truncation error:
T = O(h2) (44)
→ of second order accuracy
Dr.-Ing. Manuel Münsch | FAU | 31
Erlangen

Finite-Difference-Method
Taylor Series: Approximation of ∂ 2f /∂ x 2
∂ 2f ∂ ∂f
B express ∂x 2 as ∂x ∂x

• with CDS:
∂f
− ∂∂xf |i −1/2
∂ 2f ∂ x |i +1/2
= (45)
xi +1/2 − xi −1/2
∂x 2
• here, ghost points are used at the positions i ± 1/2

• in detail:
∂f fi +1 − fi 1
|i +1/2 = with xi +1/2 = (xi + xi +1) (46)
∂x xi +1 − xi 2
∂f fi − fi −1 1
|i −1/2 = with xi −1/2 = (xi + xi −1) (47)
∂x xi − xi −1 2

Dr.-Ing. Manuel Münsch | FAU | 32


Erlangen

Finite-Difference-Method
Taylor Series: Approximation of ∂ 2f /∂ x 2
• inserting the upper relations into eq. (45):

∂ 2f 2 [(xi − xi −1)(fi +1 − fi ) − (xi +1 − xi )(fi − fi −1)]


= (48)
∂x 2 (xi − xi −1)(xi +1 − xi )(xi +1 − xi −1)

→ same result as for approx. A with h1 = xi − xi −1 and h2 = xi +1 − xi

Dr.-Ing. Manuel Münsch | FAU | 33


Finite-Difference-Approximations via Polynomials

Erlangen
Erlangen

Finite-Difference-Method
Polynomial Approach
Express the function f (x ) in the vicinity of xi as polynomial of n-th order,
where n stands for the order of accuracy, and fit the polynomial through n+1
points.
Example:

f (x ) = a0 + a1(x − xi ) + a2(x − xi )2 with n = 2 (49)

• here: a0, a1 and a2 are unknown


• these parameters have to be estimated by 3 equations basing on the grid
points xi , xi +1, xi −1
∂f ∂ 2f
• once f (x ) is estimated also the derivatives ∂x or ∂x 2 can be derived

Dr.-Ing. Manuel Münsch | FAU | 35


Erlangen

Finite-Difference-Method
Polynomial Approach
Example:
f (x ) = a0 + a1(x − xi ) + a2(x − xi )2 with n = 2 (50)

• here: a0, a1 and a2 are unknown


• these parameters have to be estimated by 3 equations basing on the grid
points xi , xi +1, xi −1
• Point i:
fi = a0 + a1(xi − xi ) + a2(xi − xi )2 = a0 (51)
• Point i+1:
fi +1 = a0 + a1(xi +1 − xi ) + a2(xi +1 − xi )2 (52)
• Point i-1:
fi −1 = a0 + a1(xi −1 − xi ) + a2(xi −1 − xi )2 (53)

Dr.-Ing. Manuel Münsch | FAU | 36


Erlangen

Finite-Difference-Method
Polynomial Approach
• solving for a0, a1 and a2 is leading to
a0 = fi (54)
fi +1(xi − xi −1)2 − fi (xi +1 − xi −1)[(xi − xi −1) − (xi +1 − xi )]
a1 =
(xi +1 − xi −1)(xi +1 − xi )(xi − xi −1)
fi −1(xi +1 − xi )2
− (55)
(xi +1 − xi −1)(xi +1 − xi )(xi − xi −1)
fi +1(xi − xi −1) − fi (xi +1 − xi −1) + fi −1(xi +1 − xi )
a2 = (56)
(xi +1 − xi −1)(xi +1 − xi )(xi − xi −1)
• for an equidistant grid with (xi − xi −1) = (xi +1 − xi ) = ∆x
a0 = fi (57)
fi +1 − fi −1
a1 = (58)
2∆x
fi +1 − 2fi + fi −1
a2 = (59)
Dr.-Ing. Manuel Münsch | FAU | 2∆x 2 37
Erlangen

Finite-Difference-Method
Polynomial Approach
• Polynome:
f (x ) = a0 + a1(x − xi ) + a2(x − xi )2 (60)
• first derivative
∂f
= ao + 2a2(x − xi ) (61)
∂x
• second derivative
∂ 2f
2
= 2a2 (62)
∂x
• Thus:
∂f fi +1 − fi −1
= a1 = (63)
∂x 2∆x
2
∂ f fi +1 − 2fi + fi −1
= 2a2 = (64)
∂x 2 ∆x 2
-> corresponds to CDS approximations

Dr.-Ing. Manuel Münsch | FAU | 38


Erlangen

Finite-Difference-Method
Polynomial Approach
Illustration of the Polynomial Approach for ∂ f /∂ x:

(Figure basing on the lecture script: Numerische Strömungsmechanik, M. Breuer, FAU/LSTM, 2006)

Dr.-Ing. Manuel Münsch | FAU | 39


Erlangen

Finite-Difference-Method
Polynomial Approach
• for higher order approximations polynomials of higher order have to be
chosen
-> more grid points to estimate coefficients
-> truncation error smaller
• for higher order approaches there is a risk of oscillations in the solution
-> thus, not frequently used (See Lecture on Stability)

Dr.-Ing. Manuel Münsch | FAU | 40


Erlangen

FDM-Schemes (1)
1st-Order FDS: ∂ u /∂ x 1st-Order BDS: ∂ u /∂ x

∆x ∆x
(i,j) (i+1,j) (i-1,j) (i,j)

ui +1,j − ui ,j ui ,j − ui −1,j
   
∂u ∂u
= (65) = (66)
∂x i ,j ∆x ∂x i ,j ∆x

Dr.-Ing. Manuel Münsch | FAU | 41


Erlangen

FDM-Schemes (2)
2nd-Order CDS: ∂ u /∂ x 2nd-Order CDS: ∂ 2u /∂ x 2

2∆x ∆x ∆x
(i-1,j) (i+1,j) (i-1,j) (i,j) (i+1,j)

ui +1,j − ui −1,j
 
∂u ∂ 2u ui +1,j − 2ui ,j + ui −1,j
 
= (67) =
∂x i ,j 2∆x ∂x 2 i ,j (∆x )2
(68)

Dr.-Ing. Manuel Münsch | FAU | 42


Erlangen

FDM-Schemes (3)
2nd-Order CDS: ∂ u /∂ y 2nd-Order CDS: ∂ 2u /∂ y 2

(i,j+1) (i,j+1)

∆y
(i,j)

2∆y
∆y

(i,j-1) (i,j-1)

ui ,j +1 − ui ,j −1
 
∂u 2
ui ,j +1 − 2ui ,j + ui ,j −1
 
∂ u
= (69) =
∂y i ,j 2∆y ∂y 2 i ,j (∆y )2
(70)

Dr.-Ing. Manuel Münsch | FAU | 43


Erlangen

FDM-Schemes (3)
2nd-Order CDS: ∂ 2u /∂ x ∂ y

(i-1,j+1) (i+1,j+1)
∂ 2u
 
(∂ u /∂ y )i +1,j − (∂ u /∂ y )i −1,j
= (71)
∂x ∂y 2∆x
∆y   i ,j
∂u ui +1,j +1 − ui +1,j −1
= (72)
∂y 2∆y
 i +1,j
∂u ui −1,j +1 − ui −1,j −1
= (73)
∂ y i −1,j 2∆y
(i-1,j-1) ∆x (i+1,j-1)

With Eqs. (71)-(73):


2
ui +1,j +1 + ui −1,j −1 − ui −1,j +1 − ui +1,j −1
 
∂ u
= (74)
∂x ∂y i ,j 4∆x ∆y

Dr.-Ing. Manuel Münsch | FAU | 44


Erlangen

Finite-Difference-Method
Conclusion
• the FDM allows to approximate the solution of Boundary Value Problems BVP
• typically 2nd order methods are used, but higher order methods can be constructed
• Solution procedure:
• choose a grid (potentially non-equidistant)
• apply FD-approximation to the unknown variable
• obtain a linear system of equations for the value of the unknown variable at each
grid point
• check accuracy by solving with finer grid size
• ... to be discussed in the next lecture

Dr.-Ing. Manuel Münsch | FAU | 45

You might also like