CFD Lec5
CFD Lec5
Dirichlet problem
( 2
− ∂∂xu2 = f in Ω = (0, 1)
u(0) = 0, u(1) = 0
Let u(xi ) be the exact solution at the mesh point xi . The local
truncation error of the CD approximation is O(∆x)2 , i.e.,
Au = f, Auex = f + (∆x)2 p
Ae = (∆x)2 p, ei = u(xi ) − ui
Error analysis
The global error is measured using a norm, e.g., the Euclidean norm
v
u n 2
uX
kvk = t vj , v ∈ Rn
j=1
kuex − uk ≤ CkAuex − f k
Error analysis
−1
1
A
= , λmin = min{|λ1 |, . . . , |λN −1 |}
λmin
4 2
π 4 π 2
λN −1 = sin ≈ = π2
(∆x)2 2N (∆x)2 2N
Dirichlet-Neumann problem
( ∂2u
− ∂x2 = f in Ω = (0, 1)
∂u
u(0) = 0, ∂x (1) =0
Au = f, A ∈ RN ×N , u, f ∈ RN
∂u (x − 1)2 ∂ 2 u
u(x) = u(1) + (x − 1) (1) + (1)
∂x 2 ∂x2
(x − 1)3 ∂ 3 u
+ (1) + . . .
6 ∂x3
The local truncation error is given by O(∆x)
u(xN −1 ) − u(xN ) 1
− 2
= fN + ∆xqN
(∆x) 2
Ae = (∆x)2 p + ∆xq
Ae(p) = (∆x)2 p
Ae(q) = ∆xq
e = e(p) + e(q)
Global error analysis
(q)
Substituting ei = i(∆x)3 qN into the linear system, we obtain
(q) (q) (q)
e − 2ei + ei+1
− i−1 = −(i − 1 − 2i + i + 1)(∆x)qN = 0
(∆x)2
(q) (q)
eN −1 − eN
− = −(N − 1 − N )(∆x)qN = ∆xqN
(∆x)2
(q)
Since xi = i∆x, we have ei = (∆x)2 xi qN . It follows that
u(0) = g1
uN −1 − (1 + α∆x)uN 1 g3
− 2
= fN +
(∆x) 2 ∆x
0.9
− ∂∂xu2 = −P e ∂u
∂x in (0, 1) 0.6
0.4
0.3
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0 ≤ u(x) ≤ 1 ∀x ∈ (0, 1)
du P e eP e
Pe 1 ⇒ (1) = P e ≈ Pe
dx e −1
u0 = 0, uN = 1
Convection-diffusion in 1D
1.2
Pe=100, exact
1
h=10−1, 1st−order
h=10−1, 2nd−order
0.8 h=10−2, 1st−order
h=10−2, 2nd−order
0.6
0.4
0.2
−0.2
−0.4
−0.6
−0.8
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Convection-diffusion in 1D
auN −2 + buN −1 c
uN = 1 ⇒ 2
=−
(∆x) (∆x)2
a b c
BD-CD −1 − P e∆x 2 + P e∆x −1
CD-CD −1 − P e∆x
2 2 −1 + P e∆x
2
Convection-diffusion in 1D
ui = α + βri , i = 0, 1, . . . , N
u0 = 0, uN = 1
Analysis of the discrete problem
where
a+b+c=0 ⇒ cr2 − (a + c)r + a = 0
ui = α + βri
a
In the case c < 0, we have c >0
a
c >1 ⇒ P < 0, Q < 0, 0 < ui < 1
a
c <1 ⇒ P > 0, Q > 0, 0 < ui < 1
a
In the case c > 0, we have c <0
a
a + c = −b < 0 ⇒ c < −a ⇒ c < −1
u0 = u1 = · · · = uN −1 = 0, uN = 1
c≤0 ⇔ P e∆x ≤ 2
∂u ∂ 2 u
Pe − =0
∂x ∂x2
but a second-order accurate approximation to
P e∆x ∂ 2 u
∂u
Pe − 1+ =0
∂x 2 ∂x2
i ≈ , i = 1, . . . , N − 1