1 / 33

Hyperbolic PDEs: Assignment #4 Numerical Methods for PDEs Spring 2007

Hyperbolic PDEs: Assignment #4 Numerical Methods for PDEs Spring 2007. Jim E. Jones. Finite difference method for wave equation. Wave equation. Choose step size h in space and k in time. k. t. x. h. Finite difference method for wave equation. Wave equation.

rue
Télécharger la présentation

Hyperbolic PDEs: Assignment #4 Numerical Methods for PDEs Spring 2007

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hyperbolic PDEs: Assignment #4 Numerical Methods for PDEs Spring 2007 Jim E. Jones

  2. Finite difference method for wave equation Wave equation Choose step size h in space and k in time k t x h

  3. Finite difference method for wave equation Wave equation Choose step size h in space and k in time

  4. Finite difference method for wave equation Wave equation Choose step size h in space and k in time Solve for ui,j+1

  5. Finite difference method for wave equation Stencil involves u values at 3 different time levels k t x h

  6. Finite difference method for wave equation Can’t use this for first time step. U at initial time given by initial condition. ui,0 = f(xi) k t x h

  7. Finite difference method for wave equation Use initial derivative to make first time step. U at initial time given by initial condition k t x h

  8. CFL (Courant, Friedrichs, Lewy) Condition A necessary condition for an explicit finite difference scheme for a hyperbolic PDE to be stable is that for each mesh point the domain of dependence of the PDE must lie within the discrete domain of dependence.

  9. CFL (Courant, Friedrichs, Lewy) Condition The constant c is the wave speed, CFL condition says that a wave cannot cross more than one grid cell in one time step.

  10. Optional Programming assignment #4 • Implement the finite difference method we talked about last time for the hyperbolic PDE: • Exact solution

  11. Optional Programming assignment #4 Investigate stability and accuracy issues • What relationship between h and k must hold for stability? Do your results agree with the CFL condition? • How does the error behave: • O(h+k)? • O(h2 + k)? • O(h2 + k2)? • ???

  12. First: when do we expect the method to be stable? • CFL condition says the method will be unstable whenever k > h. • Numerical Results: infinity norm of error at T=1

  13. First: when do we expect the method to be stable? • CFL condition says the method will be unstable whenever k > h. • Numerical Results: infinity norm of error at T=1 These results generally agree with the CFL condition: note the particularly bad results when h=1/40, k=1/20.

  14. Second: What accuracy do we expect? • Truncation error analysis • Truncation error is the degree to which the actual PDE solution fails to satisfy the difference equation • From Taylor’s theorem • Plugging this into the difference equation

  15. Truncation error analysis • Similar analysis for time term gives • Combining the space and time terms

  16. Truncation error analysis • Similar analysis for time term gives • Combining the space and time terms • Using the PDE utt – uxx = 0

  17. Truncation error analysis • Similar analysis for time term gives • Combining the space and time terms • Truncation error is O(h2 + k2)

  18. Results 1: Infinity norm of error at T=1

  19. Results 1: Infinity norm of error at T=1 These results don’t agree with the truncation error analysis: the errors are really small, around the size of machine precision

  20. Back to truncation error analysis • Combining the space and time terms • Truncation error is O(h2 + k2) • When k=h, we have

  21. PDE PDE Back to truncation error analysis • The PDE gives a relation between time and space derivatives: utt = uxx • Similarfor other even derivatives Interchange derivative order

  22. Back to truncation error analysis • When k=h, we have • Great numerical results are because all terms in () are zero!

  23. Results 2: Infinity norm of error at T=1

  24. Results 2: Infinity norm of error at T=1 These results don’t agree with the truncation error analysis: reducing h and k by a factor of 2 reduces the error by a factor of 8

  25. Curious Results • I’m somewhat at a loss here… maybe a bug? • Maybe there is something special about T=1? • Lets change the time interval to [0,0.5]

  26. Results 3: Infinity norm of error at T=.5

  27. Results 3: Infinity norm of error at T=.5 These results don’t agree with the truncation error analysis: reducing h and k by a factor of 2 reduces the error by a factor of 2

  28. More Curious Results • I’m at a loss here… • We know we make an O(k) error in the first time step • Perhaps this is causing the reduced accuracy

  29. Finite difference method for wave equation Use initial derivative to make first time step. U at initial time given by initial condition k t x h

  30. More Curious Results • I’m at a loss here… • We know we make an O(k) error in the first time step • Perhaps this is causing the reduced accuracy • Let’s cheat and put the exact PDE solution in for the first time step.

  31. Results 4: Infinity norm of error at T=.5

  32. Results 4: Infinity norm of error at T=.5 These results do agree with the truncation error analysis: reducing h and k by a factor of 2 reduces the error by a factor of 4

  33. OK – but how do we get around the cheat? • Ideas? • Give me a good one and I’ll implement it by Wednesday.

More Related