1D PDE
-
Upload
iswargeofisika -
Category
Documents
-
view
217 -
download
0
Transcript of 1D PDE
-
8/12/2019 1D PDE
1/9
-
8/12/2019 1D PDE
2/9
+hese equations can someho be arranged into a sstem of simultaneous equations ith respect to the (!y
- \)!X- ) variables uu,uU2, 777, WI.2.!I, u82,i, 7 7 7 ,u82,!x-i, 7 7 7 ,U!,-9,9,U!,-9,2, 7 7 7 ,U!,-9,!X-9,
but it seems to be mess to or ith and e ma be reall inJ trouble as!xand!ybecome large.
simpler a is to use the iterative methods introduced in 7ection *.4. +o do so, e first need to shape the
equations and the boundar conditions into the folloing formui,0 * ry(ui,0 1 l # ui,0-l) # rx(ui 1 l,0 # ui-l,0) # rxy(&i,0ui,0 fi0) (&..4a)ELLIPTIC PDE 403
u"fi = bxQ(yi), ui!x= bxf(yi), uQ6= by/(x0), u!y6= byf(x0) (&..4b)here
v* Ax2 @*v*
*(@*# *)ry
*(@*# *)
rx,
*(@*# *)
r:, (&..(x(]),y(i))u#))) ' tol, breaB en*%solvepoisson in $/f = inline(6#6$6x6$6y6) g = inline(606,6x6,6y6)x# = 0 xf = 3 Mx = 10 y# = 0 yf = 3 My = 10
bx# = inline(6exp(y) - cos(y)6,6y6) %($/$1a)bxf = inline(6exp(y)5cos(3) - exp(3)5cos(y)6,6y6) %($/$1b)
by# = inline(6cos(x) - exp(x)6,6x6) %($/$2a)
byf = inline(6exp(3)5cos(x) - exp(x)5cos(3)6,6x6) %($/$2b)D = [x# xf y# yf] Maxlter = ?00 tol = /e-3[C,x,y] = poisson(f,g,bx#,bxf,by#,byf,D,Mx,My,tol,Maxlter)elf, .es"(x,y,C), axis([0 3 0 3 -/00 /00])
404PARTIAL DIFFERENTIAL EQUATIONS
E@ample &.. aplace/s Equation"7tead!7tate +emperature Distribution. 1onsider aplace/s equation
; d2u(x,y) d2u(x,y) L u(x, y) *"*!!!!!!h
' for ' C @ C :, /
-
8/12/2019 1D PDE
3/9
A*IYo!; r7 HH; M+H >?r\ HH; rx >r@ >?r H; rL >r
-*~ +**AT~~T!2NJ;,y-1ui+1,jUi - 1,i
FFF0DFFFFFFFFFFFFFFFFFFFFFFFF
>iHHH45%,#i
fO!@!fr
4-*-4!
Ne!+$""-type b!"#$ry c"#iti" %#eri'$ti'e &i(e#) "i#$%& 9.1 The ,ri# &r elliptic e!$ti". /ith DirichletNe!+$""-type b!"#$ry c"#iti"1
$f)
0
ELLIPTIC PDE 40'
u(x, y) 00
0-0!''
0 0 "i#$%& 9.2 Te+per$t!re #i.trib!ti" 'er $ pl$te-E($+ple 11
Qeplacing the first derivative on the left!side boundar (x = x/)b its three!point central difference
appro@imation (4..=)*@
bxy"), Ui,-i B %, " 2bx(yi)Ax for i = , *,...,!y
(&..=)
-
8/12/2019 1D PDE
4/9
and then substituting this constraint into Eq. (&..4a) at the boundar points, e have
Uifi = r>(uiA# ,) # rx(ui1UQ# ,!Fi,o) # rxy&ifiuifi- fifi)= ry(Ui,l # 2%,l " * (yi)Ax) # ( # o # W%!l,o) #
rxy(&i,Qui,Q * fifi)
= 2ryuiA# rx(ui1fi# ,Fi,o) # rxy(&ifiuifi- fifi- 2bX(yi) . Ax)
foii = l,2,888,!y-l (&..&)If the boundar condition on the loer side boundar (y = y/) is also of 9eumann tpe, then e need to
rite similar equations for0 = , *,...,!x- UQ6= r(uQ61i # '5!i) # *r@u# rxy(&/6u/0 - f/6- 2b.yo(x0).Ay)
(&..') and additionall for the left!loer corner point (xQ, y/),
uQQ= *(r',i #r@2i,o) # r@feo,o2o,o "%o,o "*('()/o)%@ # *,o(@')%))
(&..)
34322405 PARTIAL DIFFERENTIAL EQUATIONS
9.2 PLIC PDEn e@ample of a parabolic PDE is a one!dimensional heat equation describing the temperature distribution
u(x,") (x is position, f is time) as
d2
u(x,") du(x,")A!!!!!!!!" $!!!!!!!!!! for ' Cx < Xf, ' C " < ' (&.*.)In order for this equation to be solvable, the boundar conditions (', f) $ bo(") 6 u(xf, ") = bxf(") as ell as
the initial condition u(x, ') $ io(x) should be provided
9.2.1 T& Ex/ii "%w% E$&% 5&+o appl the finite difference method, e divide the spatial domain R',xf into! sections, each of length
@ $xf.!, and divide the time domain R', +S intoN segments, each of durationA" = '.N, and then replace
the second partial6 &
! sections, each of length @ $xf.!, and divide the time domain R', ' intoA" derivative on the left!hand side and the first partial derivative on the right!hand
side of the above equation (&.*.) b the central difference appro@imation (4.>.) and the forard
difference appro@imation (4..:), respectivel, so that e have
uE,, - 2uE# uE, uE1l- uE A_Li---------,------i-i =_,----------,_ (922)Ax2 A"
+his can be cast into the folloing algorithm, called the e@plicit forard Euler method, hich is to besolved iterativel
uE1l= r(uE1l# f!i) # ( ! *r)f ith r $A!!!!!! (&.*.>)for i = , *,...,! *
+o find the stabilit condition of this algorithm, e substitute a trial solution
uE= XEe6ll'< (F is an nonAero integer) (&.*.:)into Eq. (&.*.>) to get
E = r(e0,r.p1 e-6?.p) 1 ( ! *r) $ ! *r(l ! 1T7(++%P)) (&.*.4)7ince e must have . C for nondivergence, the stabilit condition turns outto be
A" r $A"! C ! (&.*. !%(:0) 8 itO%() < ?!"#$ry C"#iti"> !%0:t) 8 b(O%t):!%(&:t) .!bi"ter'$l. $l", ( $(i. .!bi"ter'$l. $l", t $(i. ( 8 90>@;B#( t 8 90>N;B#t !%i:)!%9 @ ;:") r 8 - 2Brb(&%t)< @ 8 &< N 8 ( 8 (&@#t 8 TN&r i 8 >@ :
-
8/12/2019 1D PDE
5/9
&r " 8 >N :r 8 $B#t#(#(:&r 8 >N&r i 8 2>@ !%i:) 8e"# e"#itO%(%i)) e"#9b(O%t%")) b(&%t%")); e"#rB%!%i :) !%i-:)) rB!%i:)
-
8/12/2019 1D PDE
6/9
*@
bUE)
(&.*.')
and mi@ it up ith one more equation associated ith the unnon variable uEQto get
*ru # ( # 2r)iC * ru = n
( # *r)'
" *rG $ '
* 2rbQ
(E)AxWe augment Eq. (&.*.&) ith this to ritel #*r
!*r ' ' ' '
"r l # *r " r ' ' '
' "r #*r " r ' '
' ' "r #*r ' '
' ' ' l # *r "
r' ' '! " r
#*r
(&.*.)
(&.*.*)
2rb(E)AxU!-\ # r22
(&.*.>)
Equations such as Eq. (&.*.&) or (&.*.>) are reall nice in the sense that the
can be solved ver efficientl b e@ploiting their tridiagonal structures and are
guaranteed to be stable oing to their diagonal dominanc. +he unconditionalstabilit of Eq. (&.*.&) can be shon b substituting Eq. (&.*.:) into Eq. (&.*.=)
-re-!F # ( # *r) ! re0>r.p= l.E, E =
\! <
l#*r(l !1T7(++%P))
(&.*.:)
+he folloing routine HheatFimp()H implements this algorithm to solve the
PDE (&.*.) ith the ordinar (Dirichlet tpe of) boundar condition via Eq. (&.*.&).function [u,x,t] = "eati.p(a,xf,,it#,bx#,bxf,M,J)%solve a uxx = ut for 0 '= x '= xf, 0 '= t '= % Initial +on*ition u(x,0) = it0(x)< ?!"#$ry C"#iti"> !%0:t) 8 b(0%t): !%(&:t) 8 b(&%t)% M = of subintervals along x axis% J = of subintervals along t axis*x = xf4M x = [0M]65*x*t = 4J t = [0J]5*tfor i = /M ! /, u(i,/) = it0(x(i)) en*for n = /J ! /, u([/ M ! /],n) = [bx0(t(n)) bxf(t(n))] en*
r = a5*t4*x4*x r1 = / ! 2*r;
&r i 8 >@ - (i,i) $ I2\ UEq.(&.*.&)
i& i J : A%i - :i) 8 -r A%i:i - ) 8 -r e"# e"# &r 8 2>N b 8 9rB!%:) Ker.%@ - 3:) rB!%@ :); !%2>@: - ) @:) 8 tri#%A:b) e"#
u
u
u
u
PARA?OLIC PDE 40
1213 The Cr$"-Nichl." @eth#-ere, let us go bac to see Eq. (&.*.;) and tr to improve the implicit bacard Euler method. +he
difference appro@imation on the left!hand side is taen at time point E, hile the difference appro@imation
on the right!hand side is taen at the midpoint beteen time E and E - , if e regard it as the central
-
8/12/2019 1D PDE
7/9
difference appro@imation ith time stepA".28 Doesn/t this seem to be inconsistent? -o about taing the
difference appro@imation of both sides at the same time point"sa, the midpoint beteen E # and E* for
balance? In order to do so, e tae the average of the central difference appro@imations of the left!hand
side at the to points E # and E, ielding
A*B..fc#i
li 1 l
2uE1l# uE1\
Ax2
+J%#i
! 2uE1 u!l
fc#i
Ax2
A"(&.*.4)
hich leads to the so!called 1ran!9icholson method"ruE1\ # *( # r)uE1l* ruE1 * ruE1l# *( " r)uE# ruEGl (&.*.
-
8/12/2019 1D PDE
8/9
u
+his algorithm is cast into the folloing 2+8 routine HheatF19()H.
40 PARTIAL DIFFERENTIAL EQUATIONS&!"cti" 9!:(:t; 8 he$t=CN%$:(&:T:itO:b(O:b(&:@:N)'U) more computations, despite that r $ '.4*'= doesn/t strictl satisf the stabilit
-
8/12/2019 1D PDE
9/9
condition.
+his implies that the condition (r C %*) for stabilit of the e@plicit forard Euler method is not a necessar
one, but onl a sufficient one. 8esides, if it converges, its accurac ma be better than that of the implicit
bacard Euler method, but generall no better than that of the 1ran!9icholson method.