Professional Documents
Culture Documents
CFD I
Jitesh Gajjar
Maths Dept
Manchester University
• Errors in modelling
• Errors in modelling
• Errors in modelling
• Errors in modelling
φ = O(10−8 ), φ∗ = O(10−8 )
then something like
diff = MAX(ABS(phi-phistar))
tol= 1.e-6
IF(diff < tol) EXIT
in numerical codes will be wrong usage. The
condition is always satisfied even though relative error
is O(1).
h2
τ (xi ) = Uxx (xi ) − f (xi ) = 12 Uxxxx (xi ) + ...
f1 (x, y1 , y2 ) = y2 (x),
f2 (x, y1 , y2 ) = 1 + 2xy1 (x)y2 (x) − y12 (x),
and initial condition
(y1 (1), y2 (1))T = (1, 2)T .
a = x0 x1 xi xi+1 xN = b
τi+1 (h) = h
2 y 00 (ξi )
w0 = α k1 = hf (xi , wi ),
h
wi+1 = wi + [f (xi , wi ) + f (xi+1 , wi+1 )],
2
i = 1, 2, .., N − 1,
w0 = α,
k1 = hf (xi , wi ),
h 1
k2 = hf (xi + , wi + k1 )
2 2
h 1
k3 = hf (xi + , wi + k2 )
2 2
k4 = hf (xi+1 , wi + k3 )
1
wi+1 = wi + (k1 + 2k2 + 2k3 + k4 ),
6
for i = 0, 1, .., N − 1
0 φ(gn ) − φ(gn−1 )
φ (gn ) = .
gn − gn−1
This gives
φ(gn )(gn − gn−1 )
gn+1 = gn − ,
φ(gn ) − φ(gn−1 )
which is known as the secant method.
dg = −J−1 (g̃)φ(g̃),
∂φi
where J is the Jacobian ∂gk and φ is the vector of con-
ditions.
dy h2 d2 y h3 d3 y h4 d
y(xi−1 ) = y(xi ) − h (xi ) + 2
(xi ) − 3
(xi ) +
dx 2 dx 6 dx 24 d
and
δw0 = F0 , δwN = FN .
1 Wi
γi = 2 + , δ i = Fi , i = 1, 2, .., N − 1,
h 16h
and
β0 = 1, γ0 = 0, δ0 = F0 ,
αN = 0, βN = 1, δN = FN .
Why?
U = Uo eix.s ,
where s = (s1 , s2 , .., sm )T , then
" m #
X
i Ak sk U = 0.
k=1
∂φ wi+1,j − wi−1,j
= + O((∆x )2 ),
∂x ij 2∆x
∂φ wi,j+1 − wi,j−1
= + O((∆y )2 ).
∂y ij 2∆y
Computation Fluid Dynamics – p.95/189
Central Differences
The approximations listed above are centered at the
points (xi , yj ), and are called central-difference
approximations.
• × •
i − 1, j i, j i + 1, j
1
(∆x )4 12
− 23 0 2
3
1
− 12
2nd derivative
(∆x )2 1 -2 1
1 4
(∆x )4 − 12 3
− 52 4
3
1
− 12
(∆x )2 − 32 2 − 12
(∆x )3 − 11
6
3 − 32 1
3
(∆x )4 − 25
12
4 -3 4
3
− 14
2nd derivative
(∆x ) 1 -2 1
(∆x )2 2 -5 4 -1
• × •
i, j i + 1, j
and
wi,j = 0, if i = 1, N, 1 ≤ j ≤ M,
wi,j = 0, if j = 1, M, 1 ≤ i ≤ N.
with
1 1
b = −2( 2
+ 2
), c = 1.
(∆x ) +(∆y )
as
as
1 2 2
wi,j = w i+1,j + w i−1,j + β (w i,j+1 + w i,j−1 ) − (∆ x )
2(1 + β 2 )
with β = ∆x /∆y .
new
wi+1,j −2(1+β 2 )wi,j
new new
+wi−1,j = −β 2 (wi,j+1 +wi,j−1
old
))+(∆x )2 fi,j ,
2 3
0 a1,2 a1,3 . . . a1,n
6 7
6 0 0 a2,3 . . . a2,n 7
6 7
6 7
6 0 0 0 a3,4 . . a3,n 7
6 7
6 7
−U = 6 . 7.
6 7
6 7
6 . 7
6 7
6 0 an−1,n 7
4 5
0 0 0
(D − L)x(k+1) = Ux(k) + b,
or
x(k+1) = (D − L)−1 Ux(k) + (D − L)−1 b.
x(k+1) = Px(k) + Pb
where P is called the iteration matrix.
x(k+1) = Px(k) + Pb
where P is called the iteration matrix.
For the Jacobi scheme scheme we have
P = PJ = D−1 (L + U)
x(k+1) = Px(k) + Pb
where P is called the iteration matrix.
For the Jacobi scheme scheme we have
P = PJ = D−1 (L + U)
For the Gauss-Seidel scheme
P = PG = (D − L)−1 U.
e(k) = x − x(k)
then the error satisfies the equation
e(k) = x − x(k)
then the error satisfies the equation
Since
||Pk || = ||P||k
we see that we require
||P|| < 1.
where
α = κ∆t /∆2x
β = κ∆t /∆2y
The form of the discrete equations is very much like
the system of equations arising in elliptic pdes.
and
ukj+1 = u(xj + ∆x , tk ) =
„ « „ « „ « „ «
∂u ∆2x ∂ 2 u ∆3x ∂ 3 u ∆4x ∂ 4 u
ukj + ∆x + 2
+ 3
+ 4
+ O(∆
∂x j,k 2 ∂x j,k 6 ∂x j,k 24 ∂x j,k
(-3
and
ukj−1 = u(xj − ∆x , tk ) =
„ « „ « „ « „ «
∂u ∆2x ∂ 2 u ∆3x ∂ 3 u ∆4x ∂ 4 u
ukj − ∆x + 2
− 3
+ 4
+ O(∆
∂x j,k 2 ∂x j,k 6 ∂x j,k 24 ∂x j,k
with w0k , wN
k
given. We can write the above in matrix
form as
for an N × N matrix A.
∆t κ
where β = (∆x )2 .
2 3
(2 + 2β) −β
6 7
6 −β (2 + 2β) −β 7
6 7
6 7
6 0 −β (2 + 2β) −β 7
6 7
6 7 k+1
6 7w =
6 7
6 7
6 . 7
6 7
6 . 7
4 5
−β (2 + 2β)
2 3
(2 − 2β) β
6 7
6 β (2 − 2β) β 7
6 7
6 7
6 0 β (2 − 2β) β 7
6 7
6 7 k
6 7w ,
6 7
6 7
6 . 7
6 7
6 . 7
4 5
β (2 − 2β)
Computation Fluid Dynamics – p.169/189
Stability
This is of the form
Bwk+1 = Awk ,
where
B = 2IN −1 − βSN −1 ,
and
A = 2IN −1 + βSN −1
and IN is the N × N identity matrix.
ρ(B−1 A) < 1.
ρ(B−1 A) < 1.
B−1 A.
2 − 4β sin2 nπ
N
µn = n = 1, 2, .., N − 1.
2 + 4β sin2 nπ
N
where L = b − a.
where αn = nπ/L.
where ξ = eΩ∆t .
where ξ = eΩ∆t .
Here ξ is called the amplification factor.
where ξ = eΩ∆t .
Here ξ is called the amplification factor.
For stability we thus require |ξ| ≤ 1. If the exact
solution of the pde grows exponentially, then the
difference scheme will allow such solutions if
|ξ| ≤ 1 + M ∆t
Let
wjk = ξ k eiαn j∆x .
Then substituting into the above gives
Let
wjk = ξ k eiαn j∆x .
Then substituting into the above gives
k+1
1 k κξ −iαn ∆x
ξ (ξ − 1)eiαn j∆x = 2
(e − 2 + e iαn ∆x iαn j∆x
)e .
∆t ∆x
2 αn ∆ x
2
ξ − 1 = −4ξβ sin ( ),
2
where β = 2∆t κ/∆2x .