3469 - Practical Numerical Simulations Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 School of Mathematics Trinity College Dublin Michaelmas Term 2015 Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 1/7 Numerical solutions to hamiltonian dynamics Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 2/7 Solving Hamiltonian dynamics Many standard integrators (Euler, Runge-Kutta) are unstable when used to evolve equations of motion: ẋ = p, ṗ = f (x, t) Example: Euler applied to simple harmonic oscillator; xk+1 1 h xk = pk+1 −h 1 pk This means k xk 1 h x0 = pk −h 1 p0 and an analytic form for xk can be constructed. Matrix eigenvalues are λ± = 1 ± ih, so |λ| > 1 when h > 0. The amplitude of oscillations grows exponentially, in µt 2 proportion to e with µ = ln 1 + h Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 3/7 Symplectic integrators and leap-frog A class of integrators for hamiltonian evolution can be constructed with better properties - the symplectic integrators Simplest (reversible) example - leap-frog The leap-frog integrator 1 2 3 xk+1/2 = xk + h2 pk pk+1 = pk + hf (xk+1/2 , t + h/2) xk+1 = xk+1/2 + h2 pk+1 This scheme is reversible: {xk , pk } → {xk+1 , pk+1 } means {xk+1 , −pk+1 } → {xk , −pk } Because of reversibility, leap-frog is a second-order scheme Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 4/7 Leap-frog (2) From the recursion, x is updated twice consecutively, so xk+3/2 = xk+1/2 + hpk+1 Now see where the method gets its name: x0 p0 x 1/2 x 5/2 x 3/2 p1 p2 x3 p3 The leap-frog integrator Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 5/7 Leap-frog (3) Leap-frog step for the SHO is a linear operator on {x, p}: xk+1 1 0 xk 1 h2 1 h2 = pk+1 −h 1 pk 0 1 0 1 2 3 1 − h2 h − h4 xk = h2 pk −h 1− 2 Again, x k ∀k constructed from x k = M k x 0 Eigenvalues of M are √ h2 ih 4 − h2 λ± = 1 − ± 2 2 Now for h ≤ 2, have |λ| = 1. For h > 2 at least one eigenvalue has modulus greater than unity Integrator is stable (solution stays bounded) for h < 2 for SHO Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 6/7 Leap-frog (4) 2 Euler, h=0.1 Leap-frog, h=0.1 x(t) 1 0 -1 -2 0 2 4 6 8 10 12 14 16 18 20 t Mike Peardon — mjp@maths.tcd.ie http://www.maths.tcd.ie/~mjp/3469 3469 (TCD) Michaelmas Term 2015 7/7