More numerical elliptic PDEs March 30 2009 Outline Additional Topics in Numerical Solutions of Elliptic Equations Review last class Treatment of boundary conditions Second kind Neumann Third kind a u s bu c Larry Caretto Mechanical Engineering 501B Seminar in Engineering Analysis s is coordinate normal to boundary x or y Treatment using different gradient expressions Compact difference expressions for higher order accuracy March 30 2009 2 Review Finite Differences Review Small Grid N 6 M 5 i 0 Second order second derivatives u 2 x 2 ij ui 1 j ui 1 j 2uij x 2 u 2 O x 2 y 2 uij 1 uij 1 2uij ij y 2 i 1 i 2 u33 2u 2u Q ui 1 j ui 1 j 2uij uij 1 uij 1 2uij Q 0 2 2 k x 2 y 2 y k ij x ij Multiply by x 2 and define x y Q 2 1 2 uij x 2 0 k ij 3 i 4 i 5 u12 u01 u11 u10 u43 u53 j 3 Compu tational u42 u21 i 6 j 5 Boundary nodes j 4 u44 Poisson Laplace equation O x 2 y 2 ui 1 j ui 1 j 2 uij 1 uij 1 i 3 j 2 Molecule u51 u44 u33 43 u53 u44 0 j 4u 1 j 0 4 Review N 6 M 5 Matrix 1 4 1 u11 1 4 1 u 1 21 u31 1 4 1 1 1 4 1 1 u 41 u51 1 4 1 4 1 1 1 u12 u 1 1 4 1 1 22 1 1 4 1 1 u32 u 1 1 4 1 1 42 u52 1 1 4 1 1 4 1 1 u13 u23 1 1 4 1 1 1 1 4 1 1 u33 u43 1 1 4 1 1 44 33 1 1 4 1 u53 u 4 1 1 14 43 53 1 1 4 1 u24 u 44 1 1 4 1 34 1 1 4 1 u44 1 1 4 u54 Zero coefficients because of x boundary u u 4u u u 0 ME 501B Engineering Analysis 6 1 More numerical elliptic PDEs March 30 2009 Review Iterative Solutions Effect of Relaxation Factor on Execution Time 10 Jacobi iteration uses all old values b A u ij A u S n ij ij 1 W n ij i 1 j A u E n ij i 1 j A u Gauss Seidel uses most recent values u n 1 ij S n 1 ij ij 1 b A u ij W n 1 ij i 1 j A u Relaxation A u E n ij i 1 j A u N n ij ij 1 uij n 1 1 uij n AijS uij n 11 AijW ui n1 j1 AijE ui n1 j Square L H 1 64 by 64 Grid Zero boundary on left right and bottom Top boundary has u x H sin x L Other is different code with u x H 1 N n ij ij 1 AijN uij n 1 bij Execution Time seconds u n 1 ij 1 1 1 opt 2 0 1 0 01 1 4 7 cos 2 cos N M 1 2 1 5 16x16 grid 32x32 grid 64x64 grid 128x128 grid Other code 2 1 6 1 7 1 8 1 9 8 2 Relaxation Factor Review Errors uij n 1 uij n Computable Residual ij n 1 uij n 1 AijW ui n1 j1 AijE ui n1 j1 uij n 1 AijS uij n 11 AijN uij n 11 1 E 00 1 E 01 1 E 02 1 E 03 1 E 04 1 E 05 bij Errors Relative Change n 1 ij Effects of Iterations on Laplace Equation Errors 1 E 06 Difference 1 E 07 Residual Square L H 1 64 by 64 Grid Zero boundary on left right and bottom Top boundary has u x H sin x L 1 E 09 1 E 10 1 E 11 Iteration Error n 1 ij uij uij n 1 Exact Error ij n 1 u PDE xi y j uij n 1 1 E 12 1 E 13 1 E 14 1 E 15 0 9 Other Boundary Conditions 100 200 300 400 500 600 Iterations 700 10 Notation General condition a u s bu c Label the boundaries at x x0 and x xN as the W est and E ast boundaries a 0 b 1 for Dirichlet value given a 1 b 0 for Neumann gradient given Mixed has both a and b nonzero a b and c can be different at each yj Notation ajW bjW cjW ajE bjE and cjE Write general boundary condition using a finite difference expression for u s Boundaries at y y0 and y yM are the S outh and N orth boundaries Two approaches a b and c can be different at each xi Notation aiS biS ciS aiN biN and ciN Using second order forward or backward difference for boundary node Add fictitious node outside boundary and use central differences at boundary 11 ME 501B Engineering Analysis Iteration error Exact Error 1 E 08 12 2 More numerical elliptic PDEs March 30 2009 Central Difference Approach N orth Boundary Example Finite difference equation at y yM W P E N A uiM 1 AiM ui 1M AiM uiM AiM ui 1M AiM uiM 1 QiM General condition a u s bu c by central differences S iM Write general equation for boundary nodes that contains fictitious node outside region Write central difference equation for boundary condition Solve this equation for potential at fictitious node and use result to replace this value in general equation at boundary Include boundary nodes in iterations Fictitious uiM 1 from central difference boundary condition equation at y yM uiM 1 uiM 1 biN uiM ciN 2 y aiN uiM 1 uiM 1 2 y N ci biN uiM aiN 13 14 N orth Boundary Example II CD General Boundary Combine equations to eliminate uiM 1 S W P E AiM uiM 1 AiM ui 1M AiM uiM AiM ui 1M 2 y N N N AiM uiM 1 N ci bi uiM QiM a i N i a A S iM A N iM u Modified east boundary coefficients P P E ANj a Ej ANj ANj 2 xb Ej QNj a Ej QNj 2 xc Ej AW Nj a A ui 1M a A 2 yA b uiM iM 1 N E i iM N i W iM N i P iM N N iM i a A ui 1M a QiM 2 yA c N i N N iM i Modified coefficients at iterated boundaries new AS AP and Q AN 0 AW and AE multiplied by aN S S ANj a Ej ANj E E W AW Nj a j ANj ANj N N ANj a Ej ANj E ANj 0 Modified north boundary coefficients P P N S N S aiN AiM AiM aiN AiM AiM AiM 2 ybiN AiM QiM aiN QiM W W aiN AiM AiM N 2 yciN AiM …
View Full Document