Professional Documents
Culture Documents
CFD Lec4
CFD Lec4
CFD Lec4
Members of the same family do not cross each other and cross each
member of the other families just once
The position of each grid point (or mesh cell) is uniquely identified
by a set of d indices in Rd , e.g., (xi , yj ) ∈ R2 , (xi , yj , zk ) ∈ R3
Structured meshes
The matrices of linear algebraic systems are banded and fast solvers
(both direct and iterative) are readily available for such systems
Structured meshes
structured unstructured
complex geometries − +
local mesh refinement − +
automatic mesh generation − +
cost of mesh generation + −
programming effort + −
efficiency of data access + −
efficiency of algorithms + −
Finite approximations
Conservation law
∂u
+∇·f =q in Ω × (0, T )
∂t
Discrete unknowns
Approximation of derivatives
∂2u
∂u ui+1 − ui−1 ui+1 − 2ui + ui−1
≈ , ≈
∂x i 2∆x ∂x2 i (∆x)2
Finite differences
Vj
Vi
n xj
xi n
Vi
n
Vj
Finite volumes
Variational problem
Z Z
∂u
w − ∇w · f − wq dx + wf · nds = 0
Ω ∂t Γ
Aun+1 = b(un ), n = 0, 1, . . . , M − 1
Linear solvers
b−a
xi = a + i∆x, ∆x =
N
ui ≈ u(xi ), i = 0, 1, . . . , N
First derivative
u forward ba
kward
entral
x x exa t
xi 1 xi xi+1 x
Derivation from Taylor series
(x − xi )2 ∂ 2 u
∂u
u(x) = u(xi ) + (x − xi ) +
∂x i 2 ∂x2 i
(x − xi )3 ∂ 3 u (x − xi )n ∂ n u
+ + · · · + + ...
6 ∂x3 i n! ∂xn i
Forward difference
ui+1 − ui ∆x ∂ 2 u (∆x)2 ∂ 3 u
∂u
= − − + ...
∂x i ∆x 2 ∂x2 i 6 ∂x3 i
Backward difference
ui − ui−1 ∆x ∂ 2 u (∆x)2 ∂ 3 u
∂u
= + − + ...
∂x i ∆x 2 ∂x2 i 6 ∂x3 i
Central difference
ui+1 − ui−1 (∆x)2 ∂ 3 u
∂u
= − + ...
∂x i 2∆x 6 ∂x3 i
Truncation errors
= O(∆x)p
(∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
∂u
u(xi+1 ) = u(xi )+∆x + + +. . .
∂x
i 2 ∂x2 i 6 ∂x3 i
(∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
∂u
u(xi−1 ) = u(xi )−∆x + − +. . .
∂x i 2 ∂x2 i 6 ∂x3 i
? x0 x1 x2
∂u u1 − u0
First-order forward difference = + O(∆x)
∂x 0 ∆x
x2 ∂ 2 u x3 ∂ 3 u
∂u
u(x) = u(0) + x + + + ...
∂x 0 2 ∂x2 0 6 ∂x3 0
c(∆x)2 = u1 − u0 − b∆x
u0 = a
u1 = a + b∆x + c(∆x)2 b= −3u0 +4u1 −u2
2∆x
u2 = a + 2b∆x + 4c(∆x)2
Error analysis
α + β + γ = 0, β + 2γ = 1, β + 4γ = 0
∂u
−3ui +4ui+1 −ui+2
It follows that ∂x i = 2∆x + O(∆x)2
Error analysis
α + β + γ = 0, β + 2γ = 0, β + 4γ = 2
∂2u ui −2ui+1 +ui+2
It follows that ∂x2 = (∆x)2 + O(∆x)
i
Higher-order approximations
∂2u
−ui+2 + 16ui+1 − 30ui + 16ui−1 − ui−2
= + O(∆x)4
∂x2 i 12(∆x)2
Properties
Dirichlet problem
( 2
− ∂∂xu2 = f in Ω = (0, 1)
u(0) = 0, u(1) = 0
1
Discretization: xi = i∆x, where ∆x = N
ui ≈ u(xi ), fi = f (xi )
Poisson equation in 1D
− u0 −2u 1 +u2
i=1 (∆x)2 = f1
− u1 −2u 2 +u3
= f2
i=2
(∆x)2
u2 −2u3 +u4
i=3 − (∆x)2 = f3
...
uN −2 −2uN −1 +uN
i=N −1
(∆x)2 = fN −1
Poisson equation in 1D
ai xi−1 + bi xi + ci xi+1 = di , i = 1, . . . , n
a1 = 0, cn = 0