partial differential equation (pde) · fda - method 1 discretize the domain into a grid of evenly...
TRANSCRIPT
PARTIAL DIFFERENTIAL PARTIAL DIFFERENTIAL EQUATION (PDE)MTK II – JURUSAN TEKNIK KIMIA FT UGM
How to solve PDE..??
Several methods can be used:Several methods can be used:a. FDA : Explicit (Forward)b. FDA : Implicit (Backward)p ( )c. FDA : Crank-Nicolson (CN)d. Lines Method
Finite Difference Approximation (FDA)pp ( )
Terdapat tiga jenis finite difference approximation:Terdapat tiga jenis finite difference approximation:
xyy
dxdy ii
Δ−
≈ +1Forward : Turunan kedua:
dd ⎞⎛⎞⎛xdx Δ
xyy
dxdy ii
Δ−
≈ −1Backward : 12
2
xdxdy
dxdy
dxdy
dxd
dxyd ii
Δ
⎟⎠⎞
⎜⎝⎛−⎟
⎠⎞
⎜⎝⎛
≈⎟⎠⎞
⎜⎝⎛= +
xdx Δ
xyy
dxdy ii
Δ−
≈ −+
211Central : 11
xyy
xyy
xdxdxdx
iiii
Δ−
−Δ−
≈
Δ⎠⎝
−+
xdx Δ.2
( )211 .2 yyy
xiii
Δ+−
≈
Δ≈
+−
( )2xΔ
FDA - METHOD
1 Discretize the domain into a grid of evenly spaces points 1. Discretize the domain into a grid of evenly spaces points (nodes)
2. Express the derivatives in terms of Finite Difference 2 2Approximations of O(h2) and O(Δt) [or order O(Δt2)]
2 Fi i 2 T∂2
2T
x∂∂
Finite Differences
2
2T
y∂∂
Tt
∂∂
3. Choose h = Δx = Δy, and Δt and use the I.C.'s and B.C.'s to solve the problem by systematically moving ahead in time.
Discretize the solution domain in space d i i h h Δ d k Δ
9
10
and time with h = Δx and k = Δt
t7
8
9t
4
5
6
1
2
3
Time0
1
0 1 2 3 4 5 6 7 8 9 10
(j index)
space xspace (i index)
x
FDA : Crank‐Nicolson (CN)
Provides 2nd‐order accuracy in both space and time.Average the 2nd‐derivative in space for tj+1 and tj.
tm+1 RightLeft
xi-1 xi xi+1
tmBndry50°C
Bndry100°C
tm+1/2
Initial temperature0 °C
)(1du)(1
,1, jiji uukdt
−= +Avarage FDA time level j+1 and j
⎤⎡2
FDA space
6⎥⎦⎤
⎢⎣⎡ +−++−= ++++−+− )2()2(
21
1,11,1,12,1,,122
2
jijijijijiji uuuhcuuu
hc
dxud
Example: Heat EquationExample: Heat Equationp qp q
Heat transfer in a one-dimensional rod
x = 0x = a
g (t) g (t)
uu 2∂∂
g1(t) g2(t)
ax0f(x)u(x 0)
Tt0 a,x0 ;x uc
tu
2
<<
≤≤<<∂∂
=∂∂
Tt0,)t(gt)u(0,
ax0 f(x),u(x,0)
1 ≤≤⎨⎧ =
<<=
Tt0 , )t(g)t,a(u
2
≤≤⎩⎨ =
Discretize the solution domain in space d i i h h Δ d k Δ
9
10
and time with h = Δx and k = Δt
t7
8
9t
4
5
6
1
2
3
Time
0
1
0 1 2 3 4 5 6 7 8 9 10
(j index)
space xspace (i index)
x
FDA : Crank-Nicolson (CN)
Crank-Nicolson method for heat equation
( )
⎩⎨⎧
======
jkt ,m/Tt kihx ,n/ax h
letj
i
ΔΔ
⎩
)uu2u(h2c)uu(
k1
j,1ij,ij,1i2j,i1j,i +−+ +−=−
)uu2u(h2c
)(h2
)(k
1j,1i1j,i1j,1i2
j,1ij,ij,1i2j,i1j,i
++++−
++
+−+
22 xtc
hckr
ΔΔ
==h2
Rearrange
j,1ij,ij,1i1j,1i1j,i1j,1i u2ru)r1(u
2ru
2ru)r1(u
2r
+−++++− +−+=−++−
Example: CrankExample: Crank‐‐Nicolson MethodNicolson Method• Heat Equation (Parabolic PDE)
1x0 ;2
2
≤≤=d
udcddu
4002u(x,0)
;2
⎨⎧ += x
dxdt
• c = 0 5 h = 0 25 k = 0 1
60),1( ,20t)u(0, 2⎩⎨
== −− tt etue
c 0.5, h 0.25, k 0.1
60e -2t20e -t1
60e 20e -t
1 2 3 4020 + 40 x
0
ExampleExample• Crank‐Nicolson method
22 8.0)250(
)10.0)(5.0(hckr ===
j1,iji,j1,i1j1,i1ji,1j1,i u2rr)u(1u
2ru
2rr)u(1u
2r
)25.0(h
+−++++− +−+=−++−
• Tridiagonal matrix (r = 0.8), dimulai dari j=0 dan i=1
j1,iji,j1,i1j1,i1ji,1j1,i 0.4u0.2u0.4u0.4u1.8u0.4u2222
+−++++− ++=−+−
Tridiagonal matrix (r 0.8), dimulai dari j 0 dan i 1
⎪⎫
⎪⎧ ++−+
⎫⎧⎥⎤
⎢⎡ −+ 10020100 ururu)r1(ur0rr1
⎪⎪
⎪⎪⎪
⎬
⎪⎪
⎪⎪⎪
⎨ +−+
+++
=⎪⎭
⎪⎬
⎫
⎪⎩
⎪⎨
⎧
⎥⎥⎥⎥⎥
⎢⎢⎢⎢⎢
−+−
+
0,30,20,1
1,00,20,10,0
1,2
1,1
u2ru)r1(u
2r
u2
u2
u)r1(u2
uuu
2rr1
2r
02
r1
⎪⎪⎪
⎭⎪⎪⎪
⎩++−+
⎪⎭
⎪⎩⎥⎥⎦⎢
⎢⎣
+− 1,40,40,30,21,3 u
2ru
2ru)r1(u
2ru
r12r0
• Solve the tridiagonal matrix
⎪
⎪⎬
⎫
⎪
⎪⎨
⎧
+++++
=⎪
⎪⎬
⎫
⎪
⎪⎨
⎧
⎥⎥⎥⎤
⎢⎢⎢⎡
−−− −
)50(4.0)40(2.0)30(4.0)e20(4.0)40(4.0)30(2.0)20(4.0
uu
4.08.14.004.08.1 1.0
1,2
1,1
⎪⎬
⎫⎪⎨
⎧=⎪⎬
⎫⎪⎨
⎧⇒⎪
⎬
⎫⎪⎨
⎧=
⎪⎭
⎪⎩ +++⎪
⎭⎪⎩⎥⎦⎢⎣ − −
299758553942144598.29
uu
4023869934.37
)e60(4.0)60(4.0)50(2.0)40(4.0u8.14.00
1,1
2.01,3
⎪⎭
⎬⎪⎩
⎨=⎪⎭
⎬⎪⎩
⎨⇒⎪⎭
⎬⎪⎩
⎨=42746748.4729975855.39
uu
64953807.6940
1,3
1,2
1 29.42 39.30 47.43
60e -2t20e -t
1 2 3 4020 + 40 x
0
Method of Lines
Converting Partial Differential Eqs into set of Converting Partial Differential Eqs into set of Ordinary Differential Eqs Discretizing only the spatial derivatives using FDA Discretizing only the spatial derivatives using FDA and leaving the time derivatives unchanged.
2dd2
2
=i
dxud
dtdu α
( )112 2 −+ +−Δ
= iiii uuu
xdtdu α
The complete set of differential equations for 0 <= i <=N ld bwould be:
( )1010 2 +−= uuudu α
(BC 1)Direction of Integration
( )
( )01221
1012
2
2 −
+−Δ
=
+Δ
=
uuuxdt
du
uuuxdtα
(BC 1)
t=21
t= j
( )2
....
+
Δ
idu
xdt
αt=0t=1
ii-2 i-1 i+1 i+2ddd d d( )112
.....
2 −+ +−Δ
= iiii uuu
xdt dtdu i
dtdu i 1−
dtdu i 2−
dtdu i 1+
dtdu i 2+
( )112 2 −+ +−Δ
= NNNN uuu
xdtdu α
(BC 2)
Simultaneous ODE
Example: Method of Lines• Heat Equation (Parabolic PDE)
1x0 ;2
2
≤≤=d
udcddu
4002u(x,0)
;2
⎨⎧ += x
dxdt
• c = 0 5 h=Δx = 0 25 k = Δt = 0 1
60),1( ,20t)u(0, 2⎩⎨
== −− tt etue
c 0.5, h Δx 0.25, k Δt 0.1
60e -2t20e -t1
60e 20e -t
1 2 3 4020 + 40 x
0
ExampleExample
( )10120 2 TTT
ddT
+−= −α
⎪⎨⎧ == − 02458849.1920 05.0
10 eT( )
( )01221
1012
2 TTTxdt
dTxdt
+−Δ
=
Δ −
α ⎪⎩
⎪⎨
== − 29024508.5460 10.01,4
1,0
eT
( )12322 2 TTT
xdtdT
xdt
+−Δ
=
Δα
Dicari T1,1; T2,1; T3,1 dengan
( )
( )
23423 2
dT
TTTxdt
dT+−
Δ=
α
α menyelesaikan persamaan disampingsecara simultan.
( )34524 2 TTT
xdtdT
+−Δ
=α
Menuju ke “t “berikutnya….j y
Stability Analysis
Explicit Euler method for heat equation
y y
⎩⎨⎧
======
jkt ,m/Tt kihx ,n/ax h
letj
i
ΔΔ
)2()(1,1,,12,1,2
2
jijijijiji uuuhcuu
kdxudc
dtdu
+−+ +−=−⇒=
Rearrange
j1ijij1iji1ji )uu2u(ckuu +−+=
j,1ij,ij,1i
j,1ij,ij,1i2j,i1j,i
ruu)r21(ru
)uu2u(h
uu
+−
+−+
+−+=
++
22 xtc
hckr
ΔΔ
==
5.0r0 ≤<Stability:
j,1ij,ij,1i1j,i ruu)r21(ruu +−+ +−+=
60e -2t20e -t1
• Stable010980010010 ++⇒
1 2 3 4020 + 40 x
0
j,1ij,ij,1i1j,i
j,1ij,ij,1i1j,i
40204040
u 1.0u 8.0u 1.0u 1.0r
u01.0u98.0u01.0u 01.0r
+−+
+−+
++⇒
++=⇒=
++=⇒=
U bl ( i ffi i )j,1ij,1i1j,i
j,1ij,ij,1i1j,i
u 5.0u 5.0u 5.0r
u4.0u2.0u4.0u 4.0r
+−+
+−+
+=⇒=
++=⇒=
• Unstable (negative coefficients)
⎪⎨
⎧ +−=⇒= +−+ j,1ij,ij,1i1j,i
10191010u u u u 1r
⎪⎩
⎪⎨
+−=⇒=+−=⇒=
+−+
+−+
j,1ij,ij,1i1j,i
j,1ij,ij,1i1j,i
u100u 199u100u 100ru10u19u10u 10r
Heat Heat EquationEquation: Time: Time--dependent BCsdependent BCs
r = 0.4
Explicit Euler Method: StabilityExplicit Euler Method: Stability
r = 1
Unstable !!