Вы находитесь на странице: 1из 39

Numerical Solutions for

PDEs

12/13/2017 by Adam Pamudji R 1


Elliptic PDEs
Poisson Eqns 2ux, y 2ux, y
f x, y
x 2
y 2

Laplace Eqns
2ux, y 2ux, y
0
x 2
y 2

Groundwater
Isotropic, homogenous
porous media

12/13/2017 by Adam Pamudji R 2


Partial Differential Equations
Elliptic
Laplaces Equation
Poisson Equation
Dirichlet & Neumann boundary conditions
Parabolic
Diffusion Equation
Hyperbolic
Wave Equation

12/13/2017 by Adam Pamudji R 3


Darcys and Mass Conservation Laws
Darcys Law for flows
in porous media v k d dl
vx k xx k xy k xz x
In 3D form
y
v k yx k yy k yz y
v
z k zx
k zy k zz z

Mass conservation law vx x



v 0; v v y ; y
v
z z
v x v y v z
x y z 0
12/13/2017 by Adam Pamudji R 4
Groundwater Flow Problem
K 0;
3D flows
x k xx k xy k xz

y ; K k yx k yy k yz
k zx k zz
z k zy

2D vertical flows x
K 0;
y

2D horizontal h 2h2 2h2


2n k xx k yy q Q
t x 2
y 2

12/13/2017 by Adam Pamudji R 5


Aquifer dynamics
h 2h2 2h2
2DH Model 2n k xx k yy q Q
t x 2
y 2

Q
pumping
recharge
Aquifer
dome

river

12/13/2017 by Adam Pamudji R 6


2DH Aquifer Dynamics

h 2h2 2h2
2n k xx k yy q Q
t x 2
y 2

q
Q

h Unconfined aquifer

12/13/2017 by Adam Pamudji R 7


2D Elliptic PDE

12/13/2017 by Adam Pamudji R 8


Finite Difference Method for 2D Elliptic PDEs

Finite Difference Scheme Central Difference


Scheme i-1 i i+1 i+2

j+1

j-1

xx ;i1, j xx ;i , j 2 i 1, j i , j xx ;i1, j xx ;i , j 2 i , j i 1, j
k k k k
k xx h
x x h h

12/13/2017 by Adam Pamudji R 9


Finite Difference Method for 2D Elliptic PDEs

i-1 i i+1 i+2

j+1

j-1

yy ;i , j1 yy ;i , j 2 i , j 1 i , j yy ;i , j1 xx ;i , j 2 i , j i , j 1
k k k k
k yy h
y y h h

12/13/2017 by Adam Pamudji R 10


Finite Difference Method for 2D Elliptic PDEs
Simple Problem (isotropic homogenous case)
i-1 i i+1 i+2

j+1

j-1

2 2 i 1, j 2i , j i 1, j i , j 1 2i , j i , j 1
2
x 2
y h 2
h2

12/13/2017 by Adam Pamudji R 11


Finite Difference Method for 2D Elliptic PDEs

Numerical scheme
i-1 i i+1 i+2

j+1

j-1

i 1, j i , j 1 4i , j i 1, j i , j 1
2
0
h

12/13/2017 by Adam Pamudji R 12


How to get the whole finite difference equations
assembled together for all unknowns ?

Internal nodes are govern by the schemes


Boundary nodes are govern by the boundary
conditions
Dirichlet type b.c. (the values are known)
Neumann type b.c. (the derivatives are known)
Direct Method
Relabeling the nodes (see p.613 to p.614
From i,j to l (2D array to 1D array)
i = 1,2, ,n-1; j = 1,2, ,m-1
l = i + (j-1)(n-1)

12/13/2017 by Adam Pamudji R 13


Relabelling: format (i,j) format (k)
6

4
Format
(i,j) 3 (4,4)

j=1
i=1 2 3 4 5 6 7 8 9

nomor titik dalam bentuk indeks 2 parameter

12/13/2017 by Adam Pamudji R 14


Relabelling: format (i,j) format (k)
6 12 18 54

5 11 17 53

4 10 16 52
Format
(k) 3 9 (22) 51
15

2 8 14 50

1 7 13 19 49

nomor titik dalam bentuk indeks 1 parameter

12/13/2017 by Adam Pamudji R 15


Relabelling: rumus (i,j) rumus (k)

23

16 22 28

f16 + f21 - 4f22 + f23 + f28


21
=0
h 2

fi+1, j + fi, j+1 - 4fi, j + fi-1, j + fi, j-1


=0
h 2

Persamaan dengan penomoran 1 parameter

12/13/2017 by Adam Pamudji R 16


Persamaan matriks Pentadiagonal
15 16 17 21 22 23 27 28 29


j15
j16

19 > 0 0 0 0 0 0 0 0 0 j17

20 > 0 0 0 1 0 0 0 0 0
21 > 1 0 0 -4 1 0 1 0 0 j 21
22 > 0 1 0 1 -4 1 0 1 0 j 22 = 0

23 > 0 0 1 0 1 -4 0 0 1 j 23
24 > 0 0 0 0 0 1 0 0 0
25 > 0 0 0 0 0 0 0 0
0 j 27

j 28
j 29

12/13/2017 by Adam Pamudji R 17


Perlakuan Kondisi Batas
6 12 18 24 34 40 46 52

5 11 17 23 33 39 45 51

4 10 16 22 32 38 44 50

3 9 15 21 28 31 37 43 49

2 8 14 20 27 30 36 42 48

1 7 13 19 26 29 35 41 47

12/13/2017 by Adam Pamudji R 18


Perlakuan Kondisi Batas

Kondisi batas tipe Dirichlet (tipe pertama), nilai fungsi


yang dicari sudah diketahui di titik-titik batas tertentu,
misalnya di titik no k, di batas,
fk = 10
Kondisi batas tipe Neumann (tipe kedua), nilai
turunan fungsi (gradien pada arah tertentu) yang
dicari sudah diketahui di titik-titik batas tertentu,
misalnya pada batas dinding, aliran arah tegak lurus
bidang dinding = 0,
.fk
=0
n
12/13/2017 by Adam Pamudji R 19
Kondisi Batas tipe Neumann
Secara umum, kondisi fk
= 0,
batas memberi n
n n
tambahan persamaan n = nx + ny = +
x y
baru dalam sistem
fk fk fk
persamaan yang ada = nx + ny = 0
(persamaan matriks) n x y

Pada umumnya persamaan tambahan


disubstitusikan ke dalam sistem persamaan
linier yang ada.

12/13/2017 by Adam Pamudji R 20


Penyelesaian kondisi batas tipe Dirichlet


a55 0 a57 a58 a59 f5 0 - a56 10 -
f6
0 1 0 0 0 10
a75 0 a77 a78 a79 f7 = 0 - a7610 -

a85 0 a87 a88 a89 f8 0 - a8610 -
a95 0 a97 a98 a99 f9 0 - a96 10 -

Titik no 6 adalah salah satu titik batas dengan nilai fungsi 10

12/13/2017 by Adam Pamudji R 21


Penyelesaian Kondisi Batas tipe Neumann
fk fk fk fi, j fi, j
= nx + ny = nx + ny = 0
n x y x y
fi+1, j - fi, j fi, j+1 - fi, j
nx + ny = 0, jika D = Dx = Dy,
Dx Dy nx = ny
nx nx ny ny
fi+1, j - + fi, j + fi, j+1 = 0
D D D D

3 9 15
nxf 7 - ( nx + ny ) f1 + nyf2 = 0, nx = ny =
1
2
2 2 8 14
1
2 ( -2f1 + f2 + f 7 ) = 0 - 2f1 + f2 + f7 = 0 1 7 13
2 (i,j)
12/13/2017 by Adam Pamudji R 22
Penyelesaian kondisi batas tipe Neumann
a11 a12 a13 a14 a17 f1
0+
a21 a22 a23 a24 a27 f2
0+
a31 a32 a33 a34 a37 f3 0+
a41 a42 a43 a44 a47 f4 = 0+


a71 a72 a73 a74 a77 f7 0+



f
1
f2
( -2 1 1 )


= ( 0)
f7



12/13/2017 by Adam Pamudji R 23
Penyelesaian kondisi batas tipe Neumann
a - 2 a +1 a13 a14 a17 +1 f1
11 12
0+0+
a21 a22 a23 a24 a27 f2
0+
a31 a32 a33 a34 a37 f3 0+
a41 a42 a43 a44 a47 f4 = 0+


a71 a72 a73 a74 a77 f7 0 +


12/13/2017 by Adam Pamudji R 24


Penyelesaian Kondisi Batas tipe Neumann

fi, j fi, j
nx + ny = 0, jika ny = 0,
x y n = nx =1
fi+1, j - fi, j
nx = 0, fi+1, j - fi, j = 0
Dx
3 9 15

f2 - f8 = 0 2 8 14

1 7 13
(i,j)

12/13/2017 by Adam Pamudji R 25


Penyelesaian kondisi batas tipe Neumann
a - 2 a +1 a a14 a18 f1
11 12 13
0+0+
a21 a22 +1 a23 a24 a28 -1 f2
0+0+
a31 a32 a33 a34 a38 f3 0+
a41 a42 a43 a44 a48 f4 = 0+


a81 a82 a83 a84 a88 f8 0 +


12/13/2017 by Adam Pamudji R 26


Another way is using the Iterative Method
Jacobi method
Gauss-Seidel method
The r.h.s is of the latest result

i 1, j i , j 1 4i , j i 1, j i , j 1
2
0
h
k
i, j
1 k 1
i 1, j k 1i , j 1 k 1i 1, j k 1i , j 1
4

12/13/2017 by Adam Pamudji R 27


Metode Iteratif (=Gauss-Seidel)
6

(i,j)
3

f = (f i+1, j + f i,k-1j+1 + f i-1, i, j-1 )


1 k-1
2 k
i, j
k-1
j + f k-1

4
j=1
i=1 2 3 4 5 6 7 8 9

Nilai di setiap titik diupdate dari nilai di titik-titik sekitarnya

12/13/2017 by Adam Pamudji R 28


Inserting the b.c. in the iterative method
Dirichlet:
by inserting the values or b.c. eqns in the
boundary schemes
Neumann:
by modifying the updating equation

12/13/2017 by Adam Pamudji R 29


Perlakuan Kondisi Batas Tipe Dirichlet
f = 10
6

(i,j)
4

3
f = (f i+1, j +10 + f i-1, i, j-1 )
1 k-1
k
i, j
k-1
j + f k-1

2
4

j=1
i=1 2 3 4 5 6 7 8 9

Nilai di setiap titik diupdate dari nilai di titik-titik sekitarnya

12/13/2017 by Adam Pamudji R 30


Perlakuan Kondisi Batas Tipe Neumann

f = (f i+1, j + f i,k-1j+1 + f i-1, i, j-1 )


1 k-1
k
i, j
k-1
j + f k-1

4 4
fk
(i,j) f
=0 3 = 0 f i+1,
k-1
j - f k-1
i-1, j = 0 f k-1
i-1, j = f k-1
i+1, j
n x
f i, j = ( 2f i+1, i, j-1 )
1
2 k k-1
j + f k-1
i, j+1 + f k-1

4
j=1
i=1 2 3 4 5 6 7 8 9

Nilai di titik paling kiri merupakan pencerminan dari nilai titik


paling kanan
12/13/2017 by Adam Pamudji R 31
Example
See the excel file

12/13/2017 by Adam Pamudji R 32


1D Parabolic PDE

12/13/2017 by Adam Pamudji R 33


Solution for 1D Parabolic PDE
1D Aquifer Dynamic

h 2 h 2
2n = kxx 2 + q - Q
t x
q
Q

h Unconfined aquifer

12/13/2017 by Adam Pamudji R 34


Skema Implisit: Crank-Nicholson
h 2 h 2
2n = kxx 2 + q - Q
t t x

n+1

n x
i-1 i i+1

12/13/2017 by Adam Pamudji R 35


t
Skema
Crank-Nicholson n+1
(Cr-N)
n x
i-1 i i+1

( hin+1 - hin ) ( h 2 - 2h 2 + h 2 ) ( h 2 - 2h 2 + h 2 )
n n+1

= (1- q ) k xx + qi - Qi + q k xx + qi - Qi
i-1 i i+1 i-1 i i+1
2n
Dt Dx 2
Dx 2

Cr - N q = 0.5

Dt ( hi-1 - 2hi + hi+1 )


( h 2 - 2h 2 + h 2 )
n n+1
2 2 2
Dt
+ qi - Qi + 0.5 k xx + qi - Qi
i-1 i i+1
hi - hi = 0.5
n+1 n
k xx
2n Dx 2
2n Dx 2

2
( )
n
2
Dt Dt h - 2h 2
+ h ( q - Q ) + ( q - Q )
xx ( i-1 i+1 )
n+1
hin+1 - 0.5 k h 2
- 2h 2
+ h 2
= h n
+ 0.5 k i-1 i i+1
+
n n+1


i i xx i i i i
2nDx 2 2n Dx 2
A

B

- ( Ahi-1
n+1
) hi-1n+1 + (1+ 2Ahin+1 ) hin+1 - ( Ahi+1n+1 ) hi+1n+1 = B
12/13/2017 by Adam Pamudji R 36
Penyelesaian Persamaan Non-linier
- ( Ahi-1
n+1
) i-1 (
h n+1
+ 1+ 2Ahi ) i
n+1
h n+1
- ( i+1 ) i+1 = Bi
Ah n+1
h n+1

ai bi gi
n+1
0

ai-1 bi-1 g i-1 hi-1 Bi-1
0 a i bi gi 0 0 hi B
= i
ai+1 bi+1 g i+1 hi+1 Bi+1


0

Nilai hn+1 di dalam kurung diperkirakan dulu dengan hn pada awal


hitungan, kemudian menggunakan hasil pada langkah iterasi sebelumnya

12/13/2017 by Adam Pamudji R 37


Strategi Hitungan
Kombinasi Direct Solver Matrix dan Iterasi
suku non-linier, atau,
Kombinasi Iterative Solver Matrix dan Iterasi
suku non-linier

12/13/2017 by Adam Pamudji R 38


Kombinasi Iterasi - Iterasi
- ( Ah ) h + (1+ 2Ah ) h - ( Ah ) h = B
n+1
i-1
n+1
i-1 i
n+1
i
n+1 n+1
i+1
n+1
i+1 i

ai bi gi



(
1 B - a h k- g h k
)
n+1,k+1


0 bi-1 i-1 ( i-1 i-2 ) ( i-1 i )
h
0 1 0 i-1
0

0 1 0 0 0 hi




=
1
bi( )
Bi - (a i hi-1 ) - (g i hi+1 )
k k


hi+1
0 1 0

0



b (
1 B - a h k- g h k
i+1 ( i+1 i ) ( i+1 i+2 ) )

i+1



h i
n+1,k+1
=
b
1
(i
B - (a h
i
n+1 k
i i-1 ) - (g h ) )
n+1 k
i i+1

12/13/2017 by Adam Pamudji R 39

Вам также может понравиться