CS475 Parallel Programmg Deretato ad Itegrato Wm Bohm Colorado State Uversty Ecept as otherwse oted, the cotet o ths presetato s lcesed uder the Creatve Commos Attrbuto.5 lcese. Pheomea Physcs: heat, low, space, tme Mathematcs: cotuous uctos, partal deretal equatos Computer scece: Dscrete smulato o physcal pheomea through Fte Derece Methods
Deretals Physcal pheomea lke the low o heat are modeled wth deretals: d Δ = d lm Δ Δ o A deretal descrbes rate o chage, e.g. velocty s the rate o chage o posto, v = d/d, ad accelerato s the rate o chage o velocty, a = dv/d, whch s the secod dervatve the dervatve o the dervatve o posto Partal Deretal Equatos Partal deretal equatos are deretal equatos hgher dmesos epressed a coordate system, e.g D: ad y descrbe the chage o u the ad y drecto.
Laplace Laplace descrbed physcal pheomea ad 3D, e.g. heat D Vy ΔVy V Δy Δ Vy V ΔV I X drecto: cell receves heat VΔy, loses heat VΔV Δy, hece ΔV Δy heat removed Smlarly, Y drecto: ΔVy Δ heat removed trck ΔVΔy = ΔV Δ ΔVyΔ = ΔVy Δy ΔΔy V ΔΔy ΔΔy Vy y ΔΔy Combed loss : V Vy y ΔΔy 3
More trcks V Vy Heat coservato law: = 0 y V = k Feyma: heat lows at a rate proportoal to the temperature u gradet Vy = k y These two combed: u u y = 0 heat Heat at boudary kow What s the heat sde? Dscretze t w c e s? u c = u,y, u = u,yh, u s = u,y-h, u e = uh,y, u w = u-h,y 4
Taylor seres: ucto appromato We ca epress a ucto terms o ts dervatves, The more dervatves the closer at least that was the wsdom utl chaos got dscovered Potcare. h = k =! Taylor appromato u e = uh,y = u c h h u u w = u-h,y = u c - h h u u e u w = u c u h u h u e u w u s u = 4u c u h y 5
Taylor Heat coservato u Taylor: u e u w u s u = 4u c h Heat coservato: u u y = 0 u h y thereore: u c = u u s u e u w / 4 Thermal equlbrum: temperature at,y s average o surroudg temperatures Solvg the heat equato grd: we could have a drect soluto equatos wth ukows Too Comple! teratve soluto: relaato Keep dog at u every pot utl equlbrum reached / c = u us ue uw 4 Jacob verso: pg pog wth two arrays Nce parallelsm, slow covergece Gauss-Sedel: oe array, use latest verso More comple data depedece, aster covergece 6
CS vew Nearest eghbor computato, checkerboard or block row parttog Echage o data alog borders Trck: overlappg areas see e.g. Qu Ch. 3 Re-computato Reduced commucato requecy Potetally more complcated commucato patter Itegrato Deretato: dg rate o chage dy y =, = d y = z w, dy dz dw = d d d y = z. w, dy dz dw = w z d d d y = u / v, dy du dv = v u / v d d d Itegrato: dg surace uder 7
Itegrato b a d = F b F a where Fʹ = b a b d = a Numercal tegrato Appromate ad derve smple ormula or tegral Lear: two pots, quadratc: three, etc. Two approaches: ope vs, closed: ope: pots do t clude a ad b closed: pots clude a ad b deret math Appromate a umber o tervals Applyg ay orm o above appromato methods 8
9 Trapezodal rule I ~ b-a.ab/ Itervals: 0, = 0 h, = 0 h,. X, h = b-a/ I ~ h 0 / - / = a b 0 = Better appromatos Ether: more pots crease or hgher order polyomals E.g. Smpsos rule uses quadratc appromato over 3 pots I = Itervals: I= 4 3 0 h 4 3,3,5..,4,6.. 0 a b = =
Iteratve / adaptve approach Iterate wth smaller ad smaller segmets utl I ~ I h =b-a/ Error: use relatve error h etc. = h / etc. ε = r preset appro preset prevous appro appro.00% 0.5*0 % : umber o sgcat dgts Recursve approach: adaptve quadrature traplet,rght = { retur rght-let*letrght/;} tol = 0.5*ep0,-; arealet,rght,est ={ md=letrght/; } a=traplet,md; a=trapmd,rght; ewest = aa; absewest-est/ewest<tol retur ewest; else retur arealet,md,a areamd,rght,a 0