1 / 37

Computational Physics Differential Equations

Computational Physics Differential Equations. Dr. Guy Tel- Zur. Autumn Colors , by Bobby  Mikul , http://www.publicdomainpictures.net. Version 10-11-2010 18:30. Agenda. MHJ Chapter 13 & Koonin Chapter 2 How to solve ODE using Matlab Scilab. Topics. Defining the scope of the discussion

abiba
Download Presentation

Computational Physics Differential Equations

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. Computational PhysicsDifferential Equations Dr. Guy Tel-Zur Autumn Colors, by Bobby Mikul, http://www.publicdomainpictures.net Version 10-11-2010 18:30

  2. Agenda • MHJ Chapter 13 & Koonin Chapter 2 • How to solve ODE using Matlab • Scilab

  3. Topics • Defining the scope of the discussion • Simple methods • Multi-Step methods • Runge-Kutta • Case Studies - Pendulum

  4. The scope of the discussion For a higher order ODE  a set of coupled 1st order equations:

  5. Simple methods Euler method: Integration using higher order accuracy: Taylor series expansion:

  6. Local error! Better than Euler’s method but useful only when it is easy to differentiate f(x,y)

  7. Example Let’s solve:

  8. FORTRAN code

  9. Multi-Step methods -1 -1

  10. Adams-Bashforth 2 steps: 4 steps:

  11. (So far) Explicit methods Future = Function(Present && Past) Implicit methods Future = Function(Future && Present && Past)

  12. Let’s calculate dy/dx at a mid way between lattice points: Let’s replace: Rearrange: This is a recursion relation!

  13. A simplification occurs if f(x,y)=y*g(x), then the recursion equation becomes: An example, suppose g(x)=-x yn+1=(1-xnh/2)/(1+xn+1h/2)yn This can be easily calculated, for example: Calculate y(x=1) for h=0.5 X0=0, y(0)=1 X1=0.5, y(0.5)=? x2=1.0, y(1.0)=?

  14. The solution: Error=-0.01569

  15. Predictor-Corrector method

  16. Predictor-Corrector method

  17. Runge-Kutta

  18. Proceed to: Physics examples: Ideal harmonic oscillator – section 13.6.1

  19. Physics Project – The pendulum, 13.7 I use a modified the C++ code from: http://www.fys.uio.no/compphys/cp/programs/FYS3150/chapter13/cpp/program2.cpp fout.close fout.close() Demo on folder: C:\Users\telzur\Documents\BGU\Teaching\ComputationalPhysics\2011A\Lectures\05\CPP

  20. ODEs in Matlab function dydt = odefun(t,y) a=0.001; b=1.0; dydt -=b*t*sin(t)+a*t*t; Usage: [t1, y1]=ode23(@odefun,[0 100],0); Plot(t1,y1,’r’); hold on plot(t2,y2,’b’); hold off Demo folder: Users\telzur\Documents\BGU\Teaching\ComputationalPhysics\2011A\Lectures\05\Matlab

  21. Output

  22. http://www.scilab.org

  23. Parallel tools for Multi-Core and Distributed Parallel Computing

  24. In preparation Parallel execution A new function (parallel_run) allows parallel computations and leverages multicore architectures and their capacities.

  25. Xcos demo

More Related