numerical solutions of classical equations of motion
play

Numerical solutions of classical equations of motion Newton s laws - PowerPoint PPT Presentation

Numerical solutions of classical equations of motion Newton s laws govern the dynamics of Solar systems, galaxies,... Molecules in liquids, gases; often good approximation - quantum mechanics gives potentials - large (and even rather


  1. Numerical solutions of classical equations of motion Newton ’ s laws govern the dynamics of Ø Solar systems, galaxies,... Ø Molecules in liquids, gases; often good approximation - quantum mechanics gives potentials - large (and even rather small) molecules move almost classically if the density is not too high Ø “ Everything that moves ” Almost no “ real ” systems can be solved analytically Ø Numerical integration of equations of motion

  2. One-dimensional motion Ø A single “ point particle ” at x(t) Equation of motion Notation: velocity: acceleration: Forces from: potential, damping (friction), driving (can be mix) Rewrite second-order diff. eqv. as coupled first-order:

  3. Discretized time axis Start from given initial conditions: Simplest integration method: Euler forward algorithm Step error: Fortran 90 implementations: do i=1,nt do i=1,nt t=dt*(i-1) t0=dt*(i-1) a= acc(x,v,t) acc(x,v,t) x1=x0+dt*v0 x=x+dt*v v1=v0+dt* acc(x0,v0,t0) acc(x0,v0,t0) v=v+dt*a x0=x1; v0=v1 enddo enddo Ø Euler is not a very good algorithm in practice Ø Energy error unbounded (can diverge) Ø Algorithms with better precision almost as simple

  4. Illustration of Euler algorithm: Harmonic oscillator (F = -kx) Integrated equations of motion for k=m=1;

  5. Leapfrog algorithm (no damping) Taylor expand x(t) to second order in time step Contains velocity at “ half step ” : Substituting this gives Use similar form for v propagation: Leapfrog algorithm do i=1,nt t=dt*(i-1) a=acc(x,t) v=v+dt*a x=x+dt*v enddo Starting velocity from:

  6. What is the step error in the leapfrog algorithm? Ø Might expect: Ø Actually: Ø Can be easily seen in a different derivation The Verlet algorithm Start from two Taylor expansions: Adding these gives the so-called Verlet algorithm Velocity defined by: Same as leapfrog, since

  7. Properties of Verlet/leapfrog algorithm Ø Time reversal symmetry (check for round-off errors) Ø Errors bounded for periodic motion (time-reversal) Ø High accuracy with little computational effort Illustration: Harmonic oscillator (k=m=1), Code almost identical to Euler (swicth 2lines!) do i=1,nt t=dt*(i-1) a=acc(x,t) v=v+dt*a x=x+dt*v enddo Remember, initialize v at the half-step -dt/2!

  8. Two equivalent Verlet/leapfrog methods Verlet: Leapfrog:

  9. Error build-up in Verlet/leapfrog method Error in x after N steps, time Difference between numerical and exact solution: Inserting this in Verlet equation gives Discretized second derivative: The equation of motion for the error is thus:

  10. Assume smoothness on scale of time-step, use continuum derivative (imagine a high-order interpolating polynomial between points) Exact solution satisfies: We are thus left with: Integrate to obtain error after time T: Worst case: no error cancellations (same sign for all n):

  11. Verlet/leapfrog methods for damped systems We assumed velocity-independent forces in leapfrog method; With velocity dependent we need v n but have only v n+1/2 To study this problem, separate damping from rest of force Consider approximation: The error made in a is which gives x-error We can do a second step using This renders the error in x

  12. Summary; leapfrog algorithm with damping: v n used here in a n Requires more work than standard leapfrog:

  13. Runge-Kutta method Classic high-order scheme; error (4th order) Consider first single first-order equation: Warm-up: 2nd order Runge-Kutta Use mid-point rule: But we don ’ t know Approximate it using Euler formula; Sufficient accuracy for formula:

  14. 4th-order Runga-Kutta (the real thing) Uses Simpson ’ s formula: Need to find approximations for Somewhat obscure scheme accomplishes this (can be proven correct using Taylor expansion)

  15. Runge-Kutta for two coupled equations

  16. Equations of motion, Runge-Kutta algorithm Including damping is no problem here

  17. The RK method does not have time-reversal symmetry Ø Errors not bounded for periodic motion Ø Time-reversibility important in some applications harmonic oscillator (k=m=1) Advantages of RK relative to leapfrog: Ø Variable time-step can be used (uses only n-data for n+1) Ø Better error scaling (but more computations for each step)

  18. What algorithm to use? Recommendation In the case of energy-conserving systems (no damping or external driving forces) • Use the Verlet/leapfrog algorithm - good energy-conserving property (no divergence) In the case of non-energy-conserving systems (including damping and/or external driving forces) • Energy is not conserved, so no advantage for Verlet • Use the Runge-Kutta algorithm - smaller discretization error for given integration time T

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend