Sunteți pe pagina 1din 100

Capitolul 5

Ecuaii de tip parabolic


S.l.dr.ing.mat. Alina Bogoi Metode cu Diferene Finite

CURS_6_MDF (2011-2012)

Folosirea ecuaiei de tip Parabolic


Metoda Explicit Metoda implicit Metoda Crank-Nicolson

CURS_6_MDF (2011-2012)

Ecuaia cldurii n 1D

CURS_6_MDF (2011-2012)

EDP Problema parabolic

u 2 u ( x, t ) = ( x, t ),0 < x < l , t > 0 2 t x Condiii la limit u(0, t ) = u(l , t ) = 0, t > 0 Condiii iniiale u ( x,0) = f ( x),0 x l
2

CURS_6_MDF (2011-2012)

Metoda analitic metoda separrii variabilelor


S se determine distribuia de temperaturi ntr-o bar de lungime finit, n care dou dimensiuni sunt mult mai mici dect a treia, plecnd de la ecuaia energiei i considernd c variaia presiunii i termenul de vscozitate pot fi neglijate n raport cu variaia temperaturii.

q=0

x=0

x=l

T=273K

CURS_6_MDF (2011-2012)

Ecuaia cldurii, n 1D. (metode numerice)


S se determine distribuia de temperaturi ntr-o bar de lungime finit, n care dou dimensiuni sunt mult mai mici dect a treia,

g1(t)

x=0

x=a

g2(t)

u 2u =c ; 0 < x < a, 0 t T 2 t x
Initial Cond. u ( x,0 ) = f ( x ) ,

0<x<a

CURS_6_MDF (2011-2012)

u(0,t) = g1 ( t ) Boundary Cond. , 0t T u( a, t ) = g2 ( t )

1. Metoda explicit (FTCS)


Diferene finite-metoda explicit

u(x,t)

tj+1 tj

t
(i,j+1) (i-1,j) (i,j) (i+1,j)

x
Diferena finit nainte Diferena finit centrat de
CURS_6_MDF (2011-2012)

xi-1

xi xi+1

ordinul II la timpul j

1 ut = ( ui, j +1 ui, j ) k c cuxx = 2 ( ui1, j 2 ui, j + ui +1, j ) h


FTCS method
7

1. Metoda explicit (FTCS)


Rearanjnd

ck ui, j +1 = ui, j + 2 ( ui1, j 2 ui, j + ui +1, j ) h

r=

ck c t = h2 x 2

ui , j +1 = rui 1, j + (1 2r )ui , j + rui +1, j


Stabilitatea:
CURS_6_MDF (2011-2012)

0 < r 0.5
8

1. Metoda explicit (FTCS)


T 2T = t x 2

FTCS (Forward Time, Centered Space)

T T = 2 2 t t x x 142 4 43 4 144444 4 2444444 3


2

T jn + 1 T jn

n n + T jn 2 T T j j 1 +1

PDE

FDE

n 2 4 t 2 T n x T + L 2 4 2 t j 12 x j 144444 4 244444 4 3
CURS_6_MDF (2011-2012)

T.E. O(t, x2)

1. Metoda explicit (FTCS)


FTCS scheme

T jn + 1 T jn t

n n T jn 2 T + T j j 1 +1

=0

Explicit, time marching

t n+ 1 n n n T T T T ( )( = + + t j j 1 j +1 ) j 2 x s= 2 x T n + 1 = sT n + (1 2 s )T n + sT n j 1 j j +1 j
CURS_6_MDF (2011-2012) 10

Numerical solutions

CURS_6_MDF (2011-2012)

11

1. Metoda explicit (FTCS)


10 9 8 7 6

u(0, t) = g1(t)

5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10

u(a, t) = g2(t)

Condiii iniale : u(x,0) = f(x)


CURS_6_MDF (2011-2012) 12

Metoda explicit -FTCS


Formula scris matriceal r r w j +1 = Bw j

B = tridiag (r , (1 2r ), r )
r 0 (1 2r ) r r (1 2r ) 0 r (1 2r ) B= 0 0 0 0 0 r r 0

ck r= 2 h
0 0 r (1 2r ) 0 r r (1 2r ) r 0 (1 2r ) 0 0

j k h
CURS_6_MDF (2011-2012)

|| B || = 2r + |1 2r |
Metoda este stabil dac

1 r 2

13

Metoda explicit -FTCS

CURS_6_MDF (2011-2012)

14

2.Metoda implicit Euler


Diferene finite-metoda implicit

T(x,t)

tj+1 tj

t (i-1,j+1) (i,j+1) (i+1,j+1)


(i,j)

x
Diferena finit nainte Diferena finit centrat de ordinul la timpul j+1 CURS_6_MDF II (2011-2012)

xi-1

xi xi+1

1 u t = (u i , j + 1 u i, j ) k c cu xx = 2 ( u i 1, j + 1 2u i , j + 1 + u i + 1, j + 1 ) h
15

2.Metoda implicit Euler


c 1 ( u i , j + 1 u i , j ) = 2 ( u i 1, j + 1 2u i , j + 1 + u i + 1, j + 1 ) k h

rui 1, j +1 + (1 + 2r )ui , j +1 rui +1, j +1 = ui , j


Matrice tridiagonal (Algoritmul Thomas)

1 + 2 r r

r 1 + 2r r

r 1 + 2r O

r O r

u1 , j + 1 u1 , j + ru0 , j + 1 u u 2,j 2 , j +1 u3 , j u3 , j +1 = M r 1 + 2r un 1 , j + run , j + 1 un 1 , j + 1


16

CURS_6_MDF (2011-2012)

2.Metoda implicit Euler


10 9 8 7 6

u(0, t) = g1(t)

5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10

u(a, t) = g2(t)

Condiii iniale : u(x,0) = f(x)


CURS_6_MDF (2011-2012)

Necondiionat Stabil

17

Metoda implicit
rui 1, j +1 + (1 + 2r )ui , j +1 rui +1, j +1 = ui , j
Formula scris matriceal

r r Aw j = w j 1

ck r= 2 h

A = tridiag (r , (1 + 2r ),r )
r 0 0 (1 + 2r ) r (1 2 r ) r 0 0 + 0 (1 + 2r ) r 0 0 r A= 0 r (1 + 2r ) r 0 0 + 0 0 r (1 2 r ) r 0 r 0 (1 + 2r )
18

j k i h

CURS_6_MDF (2011-2012)

Implicit Euler

CURS_6_MDF (2011-2012)

19

3. Metoda Crank-Nicolson

Metoda Crank-Nicolson aplicat ecuaiei cldurii Mediaz cele dou metode anterioare

1 n +1 n c c n n n n +1 n +1 n +1 (ui ui ) = ( u 2 u u ) ( u 2 u u + + + i 1 i i +1 i 1 i i +1 ) 2 2 k 2hx 2hx


Matrice tridiagonal
r n +1 r n +1 r n r n n +1 n ui 1 + (1 + r )ui ui +1 = ui 1 + (1 r )ui + ui +1 2 2 2 2

CURS_6_MDF (2011-2012)

Necondiional stabil

20

3. Metoda Crank-Nicolson Implicit Euler method : first-order in time Crank-Nicolson : second-order in space
10 9 8

u(0, t) = g1(t)

7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10

u(a, t) = g2(t)

Condiii iniale : u(x,0) = f(x)


CURS_6_MDF (2011-2012)

Necondiionat Stabil

21

Metoda Crank-Nicolson
ui , j ui , j 1 k

2 ui +1, j 2ui , j + ui 1, j
2 h2

ui +1, j 1 2ui , j 1 + ui 1, j 1 + =0 2 h

Formula scris matriceal

j k i
CURS_6_MDF (2011-2012)

r r ui 1,j +1 + (1 + r)ui,j +1 ui +1,j +1 = 2 2 r r ui 1,j + (1 r)ui,j + ui +1,j 2 2


22

Concluzie

Forward Euler (explicit) Backward Euler (implicit) Crank-Nicolson (implicit)

T jn +1 T jn t

= L xxT jn +1 + (1 ) L xx T jn = 0, Explicit total T j 1 2T j + T j +1 x 2

L xx T j =

= 1, Implicit total = , Crank-Nicolson


23

CURS_6_MDF (2011-2012)

Examplu:

Ecuaia Parabolic

ut = cu xx ; 0 x 1 u(x,0) = 20 + 40 x t 2t = = u(0, t) 20 e , u ( 1 , t ) 60 e c = 0.5, h = 0.25, k = 0.1

20e

-t

60e -2t

CURS_6_MDF (2011-2012)

20 + 40 x

24

Metoda implicit Euler

( r ) u i 1, j + 1 + (1 + 2r ) u i , j + 1 + ( r ) u i + 1, j + 1 = u i , j
ck (0.5)(0.10) r= 2 = = 0.8 2 (0.25) h

( 0.8) u i 1, j + 1 + (2.6) u i , j + 1 + ( 0.8) u i + 1, j + 1 = u i , j


1 + 2 r r 0
CURS_6_MDF (2011-2012)

r 1 + 2r r

0 u1, 1 u1,0 + ru0 , 1 r u 2 , 1 = u 2 ,0 u u + ru 1 + 2r 4 ,1 3 , 1 3 ,0


25

Rezolvarea sistemului

0 u1 ,1 30 + 0.8( 20 e 0.1 ) 2.6 0.8 0.8 2.6 0.8 u = 40 2 ,1 u 50 + 0.8( 60 e 0.2 ) 0 0 . 8 2 . 6 3 ,1 u1 ,1 28.95515793 u 2 ,1 = 38.50751457 u 46.19426454 3 ,1
1 28.96 38.51 46.19

20e -t
0
CURS_6_MDF (2011-2012)

60e -2t
0 1

20 + 40 x

26

Example: Metoda Crank-Nicolson


Ecuaia cldurii

ut = cu xx ; 0 x 1 u(x,0) = 20 + 40 x t 2t = = u(0, t) 20 e , u ( 1 , t ) 60 e

c = 0.5, h = 0.25, k = 0.1


1
-t

20e

60e -2t

CURS_6_MDF (2011-2012)

20 + 40 x

27

Example

Crank-Nicolson
ck (0.5)(0.10) = 0.8 r= 2 = 2 h (0.25) r r r r ui 1,j +1 + (1 + r)ui,j +1 ui +1,j +1 = ui 1,j + (1 r)ui,j + ui +1,j 2 2 2 2 0.4ui 1,j +1 + 1.8ui,j +1 0.4ui +1,j +1 = 0.4ui 1,j + 0.2ui,j + 0.4ui +1,j

Matrice tridiagonal (r = 0.8)


r r r 0 + + + u ( 1 r ) u u u 1 ,0 2 ,0 0 ,1 2 0 ,0 2 2 u 1 ,1 r r r u 2 ,1 = u1 ,0 + ( 1 r )u 2 ,0 + u 3 ,0 2 2 2 u r r 3 ,1 r 1 + r + + + u ( 1 r ) u u u 2 , 0 3 , 0 4 , 0 4 , 1 2 2 28 2

r + 1 r 2 r 1+ r 2 r 0 (2011-2012) 2 CURS_6_MDF

Rezolvarea sistemului tridiagonal

0 u1 ,1 0.4( 20 ) + 0.2( 30 ) + 0.4( 40 ) + 0.4 ( 20 e 0.1 ) 1.8 0.4 0.4 1.8 0.4 u = 0.4( 30 ) + 0.2( 40 ) + 0.4( 50 ) 2 ,1 u 0.4( 40 ) + 0.2( 50 ) + 0.4( 60 ) + 0.4 ( 60 e 0.2 ) 0 0 . 4 1 . 8 3 ,1 37.23869934 = 40 69.64953807 u1 ,1 29.42144598 u 2 ,1 = 39.29975855 u 47.42746748 3 ,1

29.42

39.30

47.43

20e -t
0
CURS_6_MDF (2011-2012)

60e -2t
0 1

20 + 40 x

29

Examplu

Explicit Euler

kt (0.5 )(0.05 ) = = 0 .4 = 2 2 (0.25 ) x


l l l ( ) Ti l + 1 = Ti + 1 2 T + T 1 i i+1 l l l . . = 0.4Ti + 0 2 T + 0 4 T 1 i i+1

t = 0.05
T01 1 T1 1 T2 1 T3 T41 = 20 e 0.05 = 19.02458849 = 0.4T00 + 0.2T10 + 0.4T20 = 0.4 ( 20 ) + 0.2( 30 ) + 0.4 ( 40 ) = 30 = 0.4T10 + 0.2T20 + 0.4T30 = 0.4 ( 30 ) + 0.2( 40 ) + 0.4 ( 50 ) = 40 = 0.4T20 + 0.2T30 + 0.4T40 = 0.4 ( 40 ) + 0.2( 50 ) + 0.4 (60 ) = 50 = 60 e 0.10 = 54.29024508
30

CURS_6_MDF (2011-2012)

: t = 0.10
T02 2 T1 2 T2 2 T3 2 T4 = 20 e 0.10 = 18.09674836 = 0.4T01 + 0.2T11 + 0.4T21 = 0.4 ( 19.02458849 ) + 0.2( 30 ) + 0.4 ( 40 ) = 29.6098354 = 0.4T11 + 0.2T21 + 0.4T31 = 0.4 ( 30 ) + 0.2( 40 ) + 0.4 ( 50 ) = 40 = 0.4T21 + 0.2T31 + 0.4T41 = 0.4 ( 40 ) + 0.2( 50 ) + 0.4 ( 54.2924508 ) = 47.71609803 = 60 e 0.20 = 49.12384518

29.61

40 40

47.72 50

20e -t

30

60e -2t

CURS_6_MDF (2011-2012)

20 + 40 x

31

Ecuaia parabolic - Sumar

f t = f xx
FTCS
f jn +1 f jn t = f jn+1 2 f jn + f jn1 h
2

h 2
12

(1 6r ) f

xxxx

Stabil pentru 1 r 2 Necondiionat stabil

BTCS

f jn +1 f jn t

1 1 f jn++ 2 f jn +1 + f jn+ 1 1

h 2
12

(1 + 6r ) f

xxxx

Crank-Nicolson

f jn +1 f jn t

[( f 2h +(f
2

n +1 j +1

1 ) 2 f jn +1 + f jn+ 1

h 2
12

n j +1

2 f jn + f jn1 )]

f xxxx +

3 t 2
12

f xxxxxx

Necondiionat stabil

Richardson

f jn +1 f jn 1 2t

f jn+1 2 f jn + f jn1 h
2

O(t 2 , h 2 )

Necondiionat instabil
32

CURS_6_MDF (2011-2012)

Ecuaia parabolic - Sumar

f t = f xx
DuFort-Frankel
f jn +1 f jn 1 2t = f jn+1 f jn +1 f jn 1 + f jn1 h
2

h 2
12

(1 12r ) f
2

xxxx

Necondiionat stabil, Condiionat consecvent Necondiionat stabil

3-Level Implicit
3 f jn +1 4 f jn + f jn 1 = 2t 1 1 n +1 f jn++ + f jn+ 1 2 fj 1

h 2
12

f xxxx

h2

CURS_6_MDF (2011-2012)

33

Ecuaia cldurii n 2D

CURS_6_MDF (2011-2012)

34

Ecuaia de difuzie

2D
2 2

T T T =x + y 2 2 t x y 3D 2 2 2 T T T T =x + y +z 2 2 2 t x y z
CURS_6_MDF (2011-2012) 35

Ecuaia de difuzie 2D
2T T 2T + y =x 2 t y 2 x T (0 , y , t ) = a ( y , t ), T (1, y , t ) = b( y , t ) BCs : T ( x ,0 , t ) = c( x , t ), T ( x ,1, t ) = d ( x , t ) ICs : T ( x , y ,0 ) = T0 ( x , y )

CURS_6_MDF (2011-2012)

36

Metode Explicite

2D FTCS
+1 T jn ,k

t
+1 n T jn ,k T j ,k

n x L xx T jn L T ,k y yy j , k = 0

Rearrange

x
x 2

(T

n j 1,k

2T

n j ,k

+T

n j + 1,k

y
y 2

n n (T jn , k 1 2T j , k + T j , k + 1 ) = 0

+1 n n n n n = + + + + T jn s T T s T T 1 2 s 2 s T ( ) ( ) ( ) ,k x j 1,k j + 1,k y j ,k 1 j ,k + 1 x y j ,k

sx = x

t t = s , y y x 2 y 2

Stabilitate

CURS_6_MDF (2011-2012)

1 sx + sy 2

37

Metode Explicite

3D FTCS
n n x L xx T jn , k , l y L yy T j , k , l z Lzz T j , k , l = 0

+1 T jn ,k ,l

t t

n +1 T jn ,k ,l T j ,k ,l

x
x 2

(T

n j 1,k ,l

2T

n j ,k ,l

+T

n j + 1,k ,l

y
y 2

n n (T jn 2 T + T ,k 1,l j ,k ,l j ,k + 1,l )

+1 T jn ,k ,l

z 2 n n n n n = s x (T jn 1 , k , l + T j + 1 , k , l ) + s y (T j , k 1 , l + T j , k + 1 , l ) + s z (T j , k , l 1 + T j , k , l + 1 ) + (1 2 s x 2 s y 2 s z )T jn ,k ,l

n n (T jn , k , l 1 2T j , k , l + T j , k , l + 1 ) = 0

Stabilitate
s x + s y + sz =

x t
x
2

y t
y
2

z t
z 2

1 2
38

CURS_6_MDF (2011-2012)

Metode Implicite
T 2T 2T 2T =x + y +z 2 2 2 t x y z
+1 T jn k , ,l +1 s x T jn 1,k ,l

t +1 n+ 1 n+ 1 n+ 1 n+ 1 + T jn s T + T s T + T + 1,k ,l y j ,k 1,l j ,k + 1,l z j ,k ,l 1 j ,k ,l + 1

+1 = ( x L xx + y L yy + z Lzz )T jn ,k ,l

+1 n + (1 + 2 s x + 2 s y + 2 s z )T jn = T j ,k ,l ,k ,l

Eroarea de Trunchiere O(t, x2, y2, z2) Necondiionat stabil Prohibitiv de scump CPU Remediu: metoda ADI sau metoda de semidiscretizare (splitting methods with CURS_6_MDF (2011-2012) 39 fractional time steps )

METODA Crank-Nicolson n 2-D


2-D Crank-Nicolson Datorit stabilitii limitate a metodei anterioare, se poate folosi o metod implicit.

1 n +1 n c c n n n n +1 n +1 n +1 (ui , j ui , j ) = ( u 2 u u ) ( u 2 u u + + + i 1, j i, j i +1, j i 1, j i, j i +1, j ) 2 2 k 2hx 2hx c c n n n n +1 n +1 n +1 u u u u u u + ( 2 + ) + ( 2 + i , j 1 i, j i , j +1 i , j 1 i, j i , j +1 ) 2 2 2 hy 2 hy


Fiecare ecuaie conine n general 5 necunoscute: sistem pentadiagonal. --->>> NU ESTE TRIDIAGONAL !!!

CURS_6_MDF (2011-2012)

40

Metoda ADI
ADI (Alternating-DirectionImplicit) 2D: pasul de timp se desparte n n+1/2 i n+1

T 2T 2T =x + y 2 t x y 2
1 n+ 2 implicit in x, explicit in y n 1 n + T j ,k T j ,k n 2 L T L T = + x xx j , k y yy j , k ( t / 2 ) 1 implicit in y, explicit in x n+ T n+ 1 T 2 1 n+ j ,k +1 j ,k = x L xx T j ,k 2 + y L yy T jn ,k ( t / 2 ) (2011-2012) CURS_6_MDF 41

3D: pasul de timp se desparte : n+1/3, n+2/3, and n+1

3D ADI Method

T 2T 2T 2T =x + y + + z 2 2 2 t x y z n+ 1 n 1 n + T T j ,k ,3 l j ,k ,l n n 3 = + + L T L T L T x xx j , k , l y yy j , k , l z zz j , k , l ( t / 3 ) implicit in x, explicit in y, z 1 n+ 2 n+ 1 2 1 3 n+ n+ n+ T j ,k ,3 l T j ,k ,l 3 3 = x L xx T j ,k ,3 + + L T L T l y yy j , k , l z zz j , k , l t 3 ( / ) implicit in y, explicit in x, z 2 n+ +1 2 2 3 T jn + + n n T j ,k ,l ,k ,l n+1 3 = x L xx T j ,k ,3 + + L T L T l y yy j , k , l z zz j , k , l t 3 ( / ) CURS_6_MDF (2011-2012) implicit in z, explicit in x, y

42

ADI Methods
Numerical Accuracy Numerical Stability
2D : O ( t 2 , x 2 , y 2 ) 2 2 2 ( , , , ) 3D : O t x y z

2D: Necondiionat stabil 3D: sx , s y , sz 1.5

CURS_6_MDF (2011-2012)

43

Metoda de Semi-Discretizare

Discretizarea n spaiu Reducerea la EDO in timp Se rezolv sistemul de EDO prin RungeKutta
Tt = T xx dT j or dt du j x s (u j 1 2 u j + u j +1 ) = 0 dt t r du v = Au = f dt
2

(T j 1 2T j + T j + 1 )

CURS_6_MDF (2011-2012)

44

Metoda Runge-Kutta
u n+ 1 = u n + t n ( f + 2 f * +2 f * * + f * **) ; 4 244444 3 6 14444
Panta ponderat
n+ 1 2

f n = L xx u n

n u* = u + 0.5 t f u * * = u n + 0.5 t u * ** = u n + t f u n + 1 = u n + t f ,
CURS_6_MDF (2011-2012)

, f * = f (t

, u*)
n+ 1 2

f *, f * * = f ( t

, u * *)

* *, f * ** = f ( t n + 1 , u * **) 1 n f = ( f + 2 f * +2 f * * + f * **) 6
45

Runge-Kutta -RK4
f* f *** f ** fn
f
f =

1 n ( f + 2 f * +2 f * * + f * **) 6

CURS_6_MDF (2011-2012)

tn

t n+1/2

t n+1
46

Capitolul 6
Ecuaii de tip eliptic
S.l.dr.ing.mat. Alina Bogoi Metode cu Diferene Finite

CURS_6_MDF (2011-2012)

47

CUPRINS

Metode iterative Metoda diferenelor finite:Ecuaia Eliptic


Ecuaia Laplace

Schema n 5 puncte Schema n 9 puncte

Algoritmi de rezolvare Metoda Jacobi Metoda Gauss-Seidel punctual Metoda Gauss-Seidel pe linie Metoda SOR Metoda Explicit Metoda implicit
48

Folosirea ecuaiei de tip Parabolic


CURS_6_MDF (2011-2012)

METODE ITERATIVE CLASICE

CURS_6_MDF (2011-2012)

49

Diferite metode recurente

Metoda Jacobi Metoda Gauss-Seidel Metoda S.O.R (Successive Over Relaxation)



SOR este o metod pentru accelerarea convergenei Iteraia Gauss-Seidel este un caz particular al metodei SOR

CURS_6_MDF (2011-2012)

50

Metoda Jacobi
a11 x1 + a12 x2 + L + a1n xn = b1 a21 x1 + a22 x2 + L + a2 n xn = b2 M an1 x1 + an 2 x2 + L + ann xn = bn
1 0 0 x = (b1 a12 x2 L a1n xn ) a11 1 1 0 0 x2 = (b2 a21 x10 a23 x3 L a 2 n xn ) a22 1 1 0 0 xn = (bn an1 x10 an 2 x2 L ann 1 xn 1 ) ann
1 1
CURS_6_MDF (2011-2012)

x10 0 x2 0 x = M 0 xn

1 k +1 xi = aii

i 1 k b a x i ij j j =1

aij x j = i +1
n k j

51

Metoda Gauss-Seidel (GS)


a11 x1 + a12 x2 + L + a1n xn = b1 Folosete ultimul a21 x1 + a22 x2 + L + a2 n xn = b2 iniializat M an1 x1 + an 2 x2 + L + ann xn = bn
1 0 0 x = (b1 a12 x2 L a1n xn ) a11 1 1 0 0 x1 = ( b a x a x L a x 2 2 21 1 23 3 2n n ) a22 1 1 1 1 xn = (bn an1 x1 a n 2 x1 L a x nn 1 n 1 ) 2 ann
1 1

x10 0 x2 0 x = M 0 xn

CURS_6_MDF (2011-2012)

1 k +1 xi = aii

i 1 k +1 bi aij x j j =1

aij x j = i +1
n k j
52

Comentarii

Metoda Gauss-Seidel ar trebui s convearg mai rapid dect iteraia Jacobi din moment ce folosete ultimele actualizri. Dar sunt unele cazuri in care iteraia Jacobi converge , iar Gauss-Seidel nu.( i invers). Pentru a accelera metoda lui Gauss-Seidel i mai departe , poate fi folosita metoda S.O.R(successive over relaxation)

CURS_6_MDF (2011-2012)

53

Metoda SOR (Successive Over Relaxation)


Metoda GS poate fi scris i n felul urmtor


1 k +1 k xi = xi + aii xik +1 = xik + ik
i 1 n k +1 k bi aij x j aij x j j =1 j =i

Corecie
i2 i1
Convergen rapid

xi3 xi2 x x
1 i


0 i

i2
1 i

nmulire cu

0 i

>1

i0

CURS_6_MDF (2011-2012)

54

Metoda SOR (Successive Over Relaxation)


xik +1 = xik + ik x x
k +1 i

1 = x + aii
k i k i

i 1 n k +1 k bi aij x j aij x j j =1 j =i i 1 k +1 bi aij x j j =1

k +1 i

1 = (1 ) x + aii

aij x j = i +1
n k j

x iS O R = (1 ) x io ld + x in ew

CURS_6_MDF (2011-2012)

=1 metoda GS 1<<2 converge mai rapid (suprarelaxare). 0<<1 converge mai lent (subrelaxare). Exist o valoare optim pentru Se gsete prin incercri (aproximativ 1.6).

55

Convergena metodelor iterative


Definiie: A este strict diagonal dominant pe linii dac

| aii |> | aij |


j i

| a
j i

ij

| aii |

<1

i = 1,2K, n
i0 j

i slab diagonal dominant dac

| aii | | aij |, i = 1, n i i0
j i

| a
j i0

| <1

| ai0i0 |

CURS_6_MDF (2011-2012)

56

Convergena metodelor iterative


Teorem: Daca A este strict sau slab diagonal dominant,


atunci amndou metodele Jacobi si Gauss-Seidel converg.

Teorem: Fie A o matrice simetric i pozitiv definit, atunci metoda Gauss-Seidel converge pentru orice soluie de start. (fr demonstraie!) Observaie: Exist sisteme liniare, pentru care metoda Jacobi converge, dar metoda GaussSeidel diverge, e.x.

CURS_6_MDF (2011-2012)

57

Convergena metodelor iterative


Alte rezultate pentru convergen.

Teorem: Dac A este simetric i pozitiv definit, atunci SOR converge pentru toate (0,2) (fr demonstraie!) Observaie:

Supra relaxare(converge mai rapid dect GS): 0 < <1 Sub relaxare: opt 1.6 Parametrul optim de relaxare:

1< < 2

CURS_6_MDF (2011-2012)

58

ECUAIA ELIPTIC

CURS_6_MDF (2011-2012)

59

Clasificarea EDP cu doua variabile


Forma general( 2 variabile)
u 2u 2u 2u u +E + Fu + G = 0 A 2 +B +C 2 + D x y xy x y

B 2 4 AC < 0 : eliptic 2 B 4 AC = 0 : parabolic 2 Clasificare B 4 AC > 0 : hiperbolic A=B=C=0 : EDP de gradul I de tip advectie G=0: EDP omogen
CURS_6_MDF (2011-2012) 60

EDP reprezentative

Ecuaii de tip Eliptic


Ecuaia Laplace/Poisson (ordinul al II-lea liniar)

Dac (x,y) R 2 u u u = 2 + 2 = f ( x, y ) x y
2 2 2

Ecuaia Helmholtz (ordinul al II-lea neliniar)

f = 0 : Laplace f 0: Poisson

Dac (x,y) R 2 2u 2u 2 + 2 + c u = 0 (Propagarea undelor acustice in timp) 2 x y


61

CURS_6_MDF (2011-2012)

Ecuaia Laplace (q=0)


u u 2u 2u 2u +E + Fu + G = 0 A 2 +B +C 2 + D x y x y y x
2 T ( x, y) 2 T ( x, y) + = q( x, y) 2 2 x y A = 1, B = 0, C = 1 B2 4 AC = 4 < 0 Ecuaie Eliptic

CURS_6_MDF (2011-2012)

62

Soluii Tehnice

Se propune un grid n regiunea de interes


y

Deoarece EDP este satisfcut n orice punct, va fi satisfcut i-n punctele gridului.

CURS_6_MDF (2011-2012)

63

Soluii Tehnice de rezolvare


Se propune o schem cu diferene finite de forma:

2 T ( x, y) Ti +1, j 2Ti , j + Ti 1, j = , 2 2 x ( x ) 2 T ( x, y) Ti , j +1 2Ti , j + Ti , j 1 = 2 2 y ( y ) T ( x, y) T ( x, y) 2 2 + = 0 0 (( x ) , ( y ) ) 2 2 x y Astfel se obine 'Schema n 5 puncte': Ti +1, j 2Ti , j + Ti 1, j Ti , j +1 2Ti , j + Ti , j 1 + =0 2 2 ( x ) ( y )
2 2
64

CURS_6_MDF (2011-2012)

Soluii Tehnice de rezolvare


2 T ( x, y) Ti 2, j + 16Ti 1, j 30Ti , j + 16Ti +1, j Ti + 2, j = , 2 2 x 12(x) 2 T ( x, y) Ti , j 2 + 16Ti , j 1 30Ti , j + 16Ti , j +1 Ti , j + 2 = 2 (y)2 y 2 T ( x, y) 2 T ( x, y) + =0 2 2 x y Astfel se obine 'Schema n 9 puncte': ui 2, j + 16ui 1, j 30ui , j + 16ui +1, j ui + 2, j 12(x) ui , j 2 + 16ui , j 1 30ui , j + 16ui , j +1 ui , j + 2
2
CURS_6_MDF (2011-2012)

O((x) 4 ,(y ) 4 )

+ =0
65

(y)

Soluii Tehnice de rezolvare


Ti +1, j 2Ti , j + Ti 1, j

( x )
Notm:

Ti , j +1 2Ti , j + Ti , j 1

( y )
2

=0

Ti +1, j 2Ti , j + Ti 1, j
= y
2

x + (Ti , j +1 2Ti , j + Ti , j 1 ) = 0 y
2 2

Ti +1, j + Ti 1, j + Ti , j +1 + Ti , j 1 2(1 + )Ti , j = 0


CURS_6_MDF (2011-2012) 66

Soluii Tehnice de rezolvare


Ti +1, j 2Ti , j + Ti 1, j

( x )
Notm:

Ti , j +1 2Ti , j + Ti , j 1

( y )
2

=0

Ti +1, j 2Ti , j + Ti 1, j
x = y
2

x + (Ti , j +1 2Ti , j + Ti , j 1 ) = 0 y
; = 2(1 + 2 )
2 2

Ti +1, j + Ti 1, j + Ti , j +1 + Ti , j 1 2(1 + )Ti , j = 0


CURS_6_MDF (2011-2012)

Ti +1, j + Ti 1, j + 2Ti , j +1 + 2Ti , j 1 + Ti , j = 0

67

Soluii Tehnice de rezolvare


Matrice de tip pentadiagonal

CURS_6_MDF (2011-2012)

68

Algoritmi de rezolvare
ui +1, j + ui 1, j + 2ui , j +1 + 2ui , j 1 2(1 + 2 )ui , j = 0

Metoda iterativ Jacobi

u

k +1 i, j

1 k k 2 k k u = + ui 1, j + (ui , j +1 + ui , j 1 ) 2 i +1, j 2(1 + )

Metoda se poate aplica i este convergent daca este satisfcut condiia de diagonal dominan:
69

CURS_6_MDF (2011-2012)

Algoritmi de rezolvare
Ti +1, j 2Ti , j + Ti 1, j

( x )

Ti , j +1 2Ti , j + Ti , j 1

( y )

=0

Dac x = y = h Ti +1, j 4Ti , j + Ti 1, j + Ti , j +1 + Ti , j 1 = 0


Metoda iterativ Jacobi

T
CURS_6_MDF (2011-2012)

k +1 i, j

1 k k k k = (Ti +1, j + Ti + T + T 1, j i , j +1 i , j 1 ) 4

70

Algoritmi de rezolvare
Ti , j +1 Ti 1, j Ti , j Ti , j 1
Ti +1, j 4Ti , j + Ti 1, j + Ti , j +1 + Ti , j 1 = 0
CURS_6_MDF (2011-2012) 71

Ti +1, j

Metoda iterativ Gauss-Seidel punctual


Ti +1, j 4Ti , j + Ti 1, j + Ti , j +1 + Ti , j 1 = 0 T
k +1 i, j

1 k k +1 k k +1 = Ti +1, j + Ti + T + T 1, j i , j +1 i , j 1 4

)
(i,j+1)
K K+1

s =

new i, j

T
new i, j

o ld i, j

100

K+1

(i,j)
K+1

(i-1,j) (i,j-1)

(i+1,j)

CURS_6_MDF (2011-2012)

72

Metoda SOR (Succesive Over Relaxation )


Ti +1, j 4Ti , j + Ti 1, j + Ti , j +1 + Ti , j 1 = 0 T
k +1 i, j

(T )
k +1 i, j

1 k k +1 k k +1 = Ti +1, j + Ti 1, j + Ti , j +1 + Ti , j 1 4

new

= T
T

k +1 i, j

+ (1 ) T
100

k i, j

s =
CURS_6_MDF (2011-2012)

T i ,n je w T i ,o jld
new i, j

73

Exemplu
S se determine temperatura staionar n toate punctele unei placi de metal nclzite. Muchiile plcii sunt inute constante la diferite temperaturi: 100,50, 0 i 75 grade. 100
75 50

Placa se mparte n 6X6.


CURS_6_MDF (2011-2012)

0
74

This case is known as the Dirichlet boundary conditions. u2

u1

u3

CURS_6_MDF (2011-2012)

u4

75

Exemplu
Condiii de tip Dirichlet. T1
T = 100

T2

T3

T4
T = 75 T= 50

CURS_6_MDF (2011-2012)

T=0

76

Ct este temperatura aici?

T = 100

T = 75

T= 50

T=0
CURS_6_MDF (2011-2012)

x
77

Cunoscute

Exemplu
T1, 4 = 100
T0,3 = 75 T1,3

Necunoscute

T2, 4 = 100
T2,3

T3, 4 = 100
T3,3

T4,3 = 50 T4, 2 = 50 T4,1 = 50

T0, 2 = 75
T0,1 = 75

T1, 2
T1,1

T2, 2
T2,1

T3, 2
T3,1

T1,0 = 0
CURS_6_MDF (2011-2012)

T2, 0 = 0

T3, 0 = 0
78

Cunoscute

Exemplu
T1, 4 = 100
T0,3 = 75 T1,3

Necunoscute

T2, 4 = 100
T2,3

T0, 2 = 75

T1, 2

T2, 2

T0,3 + T1, 4 + T1, 2 + T2,3 + 4T1,3 = 0 75 + 100 + T1, 2 + T2,3 + 4T1,3 = 0


CURS_6_MDF (2011-2012) 79

Cunoscute

Exemplu
T1, 4 = 100
T0,3 = 75 T1,3

Necunoscute

T2, 4 = 100
T2,3

T0, 2 = 75

T1, 2

T2, 2

T0,3 + T1, 4 + T1, 2 + T2,3 4T1,3 = 0 75 + 100 + T1,2 + T2,3 4T1,3 = 0


CURS_6_MDF (2011-2012) 80

Cunoscute

Exemplu
T1, 4 = 100
T1,3

Necunoscute

T2, 4 = 100
T2,3

T3, 4 = 100
T3,3

T1, 2

T2, 2

T3, 2

T1,3 + T2, 4 + T3,3 + T2, 2 4T2,3 = 0 T1,3 + 100 + T3,3 + T2,2 4T2,3 = 0
CURS_6_MDF (2011-2012) 81

Exemplu
T11 75 4 1 0 1 T21 0 1 4 1 0 1 T 50 0 1 4 0 0 1 31 T12 75 1 0 0 4 1 0 1 T = 0 1 0 1 4 1 0 1 22 1 0 1 4 0 0 1 T32 50 1 0 0 4 1 0 T13 175 1 0 1 4 1 T23 100 T 1 0 1 4 150 33
CURS_6_MDF (2011-2012) 82

Exemplu
Condiii de tip Neumann
y

(0,100)
h =0 x

h = 0.05x + 100

(200,100)
h =0 x

2h 2h =0 + 2 2 y x

(0,0)

h = 0 y

(200,0)

Punct din grid


CURS_6_MDF (2011-2012) 83

Exemplu
Condiii de tip Neumann
hi + 1, j hi 1, j h 2x x
h =0 x
1,2 1,1 2,1

h i+1,j = h i-1,j i h i,j+1 = h i,j-1

h =0 y
CURS_6_MDF (2011-2012) 84

Exemplu
Condiii de tip Neumann

hi+1, j + hi1, j + hi, j+1 + hi, j1 4hi, j = 0


h1,1 = (2h1,2 + 2 h2,1)/4

h =0 x

1,2 1,1

2,2

h1,2 = (h1,1 + h1,3+2h22)/4

2,1

CURS_6_MDF (2011-2012)

h =0 y

85

Exemplu ecuaia Poisson


u xx + u yy = f
h
1 (u ( x h, y ) + u ( x, y h) 4u ( x, y ) + u ( x + h, y ) + u ( x, y + h)) = f ( x, y ) h2

Equation for each grid point (x,y)

Au = f

CURS_6_MDF (2011-2012)

86

Exemplu
u xx + u yy = 1
pe

= [0,1] [0,1]
(1,1)

u=2

pe

(0,0)
CURS_6_MDF (2011-2012) 87

Exemplu

CURS_6_MDF (2011-2012)

88

Exemplu

CURS_6_MDF (2011-2012)

89

Exemplu

CURS_6_MDF (2011-2012)

90

Exemplu
7 4 1 8 5 2 9 Matrice de dimensiune 9x9 6 3

Au = b

CURS_6_MDF (2011-2012)

91

Sistem liniar
7 4 1 8 5 2 9 6 3
4 1 (.25) 2 2 1 2 (. 25 ) 0 1 0 0 0 0 0 u1 4 1 4 1 4 1 u 0 1 0 0 0 0 1 2 2 (. 25 ) 0 1 4 0 0 1 0 0 0 u3 2 1 u 1 0 0 4 1 0 1 0 0 2 4 (.25) 1 0 1 0 1 4 1 0 1 0 u5 = 1 2 (.25) 2 u 0 0 1 0 1 4 0 0 1 6 1 (.25) 2 0 u 0 0 1 0 0 4 1 0 4 7 1 0 0 0 1 0 1 4 1 u8 2 0 (. 25 ) 0 0 0 0 0 1 0 1 4 2 u9 1 (.25) 2 4 1 2 92 (. 25 )

CURS_6_MDF (2011-2012)

Parcugerea gridului

CURS_6_MDF (2011-2012)

93

Parcugerea gridului

CURS_6_MDF (2011-2012)

94

Parcugerea gridului

2 3

CURS_6_MDF (2011-2012)

95

Parcugerea gridului
do j=1,n-1 do i=1,n-1

8 1

2 3 4 5 6

CURS_6_MDF (2011-2012)

96

Cum ne oprim?
Se caut soluia u* so astfel nct

Au = b
Calitatea aproximrii este dat de reziduul:

r = b Au
Condiia de oprire mai poate fi exprimat prin

|| r || eps
unde
CURS_6_MDF (2011-2012)

|| r || = max(| ri |)
97

Problem seminar
x y u xx + u yy = + ,1 < x < 2,1 < y < 2 y x u ( x,1) = x ln x, u ( x,2) = 2 x ln(2 x),1 x 2 u (1, y ) = y ln y, u (2, y ) = 2 y ln(2 y ),1 y 2

CURS_6_MDF (2011-2012)

98

Problem seminar
PDE

x y u xx + u yy = + ,1 < x < 2,1 < y < 2 y x u ( x,1) = x ln x, u ( x,2) = 2 x ln(2 x),1 x 2 u (1, y ) = y ln y, u (2, y ) = 2 y ln(2 y ),1 y 2

Condiii la limit
CURS_6_MDF (2011-2012) 99

Problem seminar
x y u xx + u yy = + ,1 < x < 2,1 < y < 2 y x u ( x,1) = x ln x, u ( x,2) = 2 x ln(2 x),1 x 2 u(1, y) = y ln y, u (2, y) = 2 y ln(2 y),1 y 2
Soluia exact

uexact ( x, y ) = xy ln( xy )
CURS_6_MDF (2011-2012) 100