Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

Finite difference methods with introduction to Burgers Equation

No Downloads

Total views

50,023

On SlideShare

0

From Embeds

0

Number of Embeds

294

Shares

0

Downloads

1,830

Comments

27

Likes

33

No notes for slide

- 1. How to solve PDEs using MATHEMATIA and MATLAB G. Y. Park, S. H. Lee and J.K. Lee Department of Electronic and Electrical Engineering, POSTECH 2006. 5. 17 Plasma Application Modeling POSTECH
- 2. Contents <ul><li>Solving PDEs using MATHEMATICA </li></ul><ul><li>- FTCS method </li></ul><ul><li>- Lax method </li></ul><ul><li>- Crank Nicolson method </li></ul><ul><li>- Jacobi’s method </li></ul><ul><li>- Simultaneous-over-relaxation (SOR) method </li></ul><ul><li>Solving PDEs using MATLAB </li></ul><ul><li>- Examples of PDEs </li></ul>Plasma Application Modeling POSTECH
- 3. References <ul><li>Textbook </li></ul><ul><li>- ‘Numerical and Analytical Methods for Scientists and Engineers Using Mathematica’, Daniel Dubin, Wiley, 2003 </li></ul><ul><li>- ‘Applied numerical methods in C’, S. Nakamura </li></ul>Plasma Application Modeling POSTECH
- 4. PDE (Partial Differential Equation) <ul><li>PDEs are used as mathematical models for phenomena in </li></ul><ul><li>all branches of engineering and science. </li></ul>Plasma Application Modeling POSTECH - Three Types of PDEs: 1) Elliptic: Steady heat transfer, flow and diffusion 2) Parabolic: Transient heat transfer, flow and diffusion 3) Hyperbolic: Transient wave equation
- 5. FTCS method for the heat equation FTCS ( Forward Euler in Time and Central difference in Space ) Heat equation in a slab Plasma Application Modeling POSTECH
- 6. FTCS method for the heat equation Initial conditions Plot FTCS
- 7. Stability of FTCS and CTCS FTCS is first-order accuracy in time and second-order accuracy in space. So small time steps are required to achieve reasonable accuracy. CTCS method for heat equation (Both the time and space derivatives are center-differenced.) However, CTCS method is unstable for any time step size. ( unstable ) Plasma Application Modeling POSTECH Courant condition for FTCS
- 8. Lax method Simple modification to the CTCS method In the differenced time derivative, The resulting difference equation is ( Second-order accuracy in both time and space ) Plasma Application Modeling POSTECH Replacement by average value from surrounding grid points Courant condition for Lax method
- 9. Crank Nicolson Algorithm ( Implicit Method ) BTCS ( Backward time, centered space ) method for heat equation ( This is stable for any choice of time steps, however it is first-order accurate in time. ) Crank-Nicolson scheme for heat equation taking the average between time steps n-1 and n, ( This is stable for any choice of time steps and second-order accurate in time. ) Plasma Application Modeling POSTECH a set of coupled linear equations for
- 10. Crank Nicolson Algorithm Initial conditions Plot Crank-Nicolson scheme Exact solution
- 11. Crank Nicolson Algorithm Plasma Application Modeling POSTECH
- 12. Multiple Spatial Dimensions FTCS for 2D heat equation Courant condition for this scheme ( Other schemes such as CTCS and Lax can be easily extended to multiple dimensions. ) Plasma Application Modeling POSTECH
- 13. Wave equation with nonuniform wave speed 2D wave equation Initial condition : Boundary condition : Wave speed : CTCS method for the wave equation : Courant condition : Plasma Application Modeling POSTECH
- 14. Wave equation with nonuniform wave speed Since evaluation of the nth timestep refers back to the n-2nd step, for the first step, a trick is employed. Since initial velocity and value, Plasma Application Modeling POSTECH
- 15. Wave equation with nonuniform wave speed Plasma Application Modeling POSTECH
- 16. Wave equation with nonuniform wave speed Plasma Application Modeling POSTECH
- 17. 2D Poisson’s equation Poisson’s equation Direct Solution for Poisson’s equation Centered-difference the spatial derivatives
- 18. Jacobi’s method ( Relaxation method ) <ul><li>Direct solution can be difficult to program efficiently. </li></ul><ul><li>Relaxation methods are relatively simple to code, </li></ul><ul><li>however, they are not as fast as the direct methods. </li></ul><ul><li>Idea : </li></ul><ul><li>Poisson’s equation can be thought of as the equilibrium solution to the heat equation with source. </li></ul><ul><li>Starting with any initial condition, the heat equation solution will eventually relax to a solution of Poisson’s equation. </li></ul>FTCS (Maximum time step satisfying Courant condition)
- 19. Jacobi method
- 20. Simultaneous OverRelaxation (SOR) The convergence of the Jacobi method is quite slow. Furthermore, the larger the system, the slower the convergence. Simultaneous OverRelaxation (SOR) : the Jacobi method is modified in two ways, <ul><li>Improved values are used as soon as they become available. </li></ul><ul><li>Relaxation parameter ω tries to overshoot for going to the final result. </li></ul><ul><li>( 1< ω <2) </li></ul>Plasma Application Modeling POSTECH
- 21. Simultaneous OverRelaxation (SOR)
- 22. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: dftcs.m >> dftcs dftcs - Program to solve the diffusion equation using the Forward Time Centered Space scheme. Enter time step: 0.0001 Enter the number of grid points: 51 Solution is expected to be stable Plasma Application Modeling Group POSTECH
- 23. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: dftcs.m >> dftcs dftcs - Program to solve the diffusion equation using the Forward Time Centered Space scheme. Enter time step: 0.00015 Enter the number of grid points: 61 WARNING: Solution is expected to be unstable Plasma Application Modeling Group POSTECH
- 24. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: neutrn.m >> neutrn Program to solve the neutron diffusion equation using the FTCS. Enter time step: 0.0005 Enter the number of grid points: 61 Enter system length: 2 => System length is subcritical Solution is expected to be stable Enter number of time steps: 12000 Plasma Application Modeling Group POSTECH
- 25. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: neutrn.m >> neutrn Program to solve the neutron diffusion equation using the FTCS. Enter time step: 0.0005 Enter the number of grid points: 61 Enter system length: 4 => System length is supercritical Solution is expected to be stable Enter number of time steps: 12000 Plasma Application Modeling Group POSTECH
- 26. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: advect.m >> advect advect - Program to solve the advection equation using the various hyperbolic PDE schemes: FTCS, Lax, Lax-Wendorf Enter number of grid points: 50 Time for wave to move one grid spacing is 0.02 Enter time step: 0.002 Wave circles system in 500 steps Enter number of steps: 500 FTCS FTCS Plasma Application Modeling Group POSTECH
- 27. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: advect.m >> advect advect - Program to solve the advection equation using the various hyperbolic PDE schemes: FTCS, Lax, Lax-Wendorf Enter number of grid points: 50 Time for wave to move one grid spacing is 0.02 Enter time step: 0.02 Wave circles system in 50 steps Enter number of steps: 50 Lax Lax Plasma Application Modeling Group POSTECH
- 28. O.V. Manuilenko MATLAB The Language of Technical Computing MATLAB PDE Run: relax.m >> relax relax - Program to solve the Laplace equation using Jacobi, Gauss-Seidel and SOR methods on a square grid Enter number of grid points on a side: 50 Theoretical optimum omega = 1.88184 Enter desired omega: 1.8 Potential at y=L equals 1 Potential is zero on all other boundaries Desired fractional change = 0.0001 Plasma Application Modeling Group POSTECH

No public clipboards found for this slide

Login to see the comments