Top Banner
www.compphys.cn South China University of Technology www.compphys.cn Oscillator motions Xiaobao Yang Department of Physics p://www.compphys.cn/~xbyang/lectures.ht
23

Www.compphys.cn South China University of Technology Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

Dec 14, 2015

Download

Documents

Zain Lovelace
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

South China University of Technology

www.compphys.cn

Oscillator motions

Xiaobao Yang

Department of Physics

http://www.compphys.cn/~xbyang/lectures.html

Page 2: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Simulation of Quasi-crystals

Page 3: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Annealing simulation

Phase Transitions

Page 4: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Page 5: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Charged particle in electromagnetic field

Page 6: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

One particle fx1(ii)=q1*E0+q1*B*vy1(ii); fy1(ii)=-q1*B*vx1(ii); vx1(ii+1)=vx1(ii)+fx1(ii)/m1*dt; vy1(ii+1)=vy1(ii)+fy1(ii)/m1*dt; x1(ii+1)=x1(ii)+vx1(ii)*dt; y1(ii+1)=y1(ii)+vy1(ii)*dt; fx1(ii+1)=q1*E0+q1*B*vy1(ii+1); fy1(ii+1)=-q1*B*vx1(ii+1); vx1(ii+1)=vx1(ii)+0.5*(fx1(ii)+fx1(ii+1))/m1*dt; vy1(ii+1)=vy1(ii)+0.5*(fy1(ii)+fy1(ii+1))/m1*dt; x1(ii+1)=x1(ii)+0.5*(vx1(ii)+vx1(ii+1))*dt; y1(ii+1)=y1(ii)+0.5*(vy1(ii)+vy1(ii+1))*dt;

Page 7: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Two particles fx1(ii)=q1*E0+q1*B*vy1(ii)-k*q1*q2*(x2(ii)-x1(ii))/norm([x2(ii)-x1(ii) y2(ii)-y1(ii)])^3; fy1(ii)=-q1*B*vx1(ii)-k*q1*q2*(y2(ii)-y1(ii))/norm([x2(ii)-x1(ii) y2(ii)-y1(ii)])^3; fx2(ii)=q2*E0+q2*B*vy2(ii)+k*q1*q2*(x2(ii)-x1(ii))/norm([x2(ii)-x1(ii) y2(ii)-y1(ii)])^3; fy2(ii)=-q2*B*vx2(ii)+k*q1*q2*(y2(ii)-y1(ii))/norm([x2(ii)-x1(ii) y2(ii)-y1(ii)])^3;

vx1(ii+1)=vx1(ii)+fx1(ii)/m1*dt; vy1(ii+1)=vy1(ii)+fy1(ii)/m1*dt; x1(ii+1)=x1(ii)+vx1(ii)*dt; y1(ii+1)=y1(ii)+vy1(ii)*dt; vx2(ii+1)=vx2(ii)+fx2(ii)/m1*dt; vy2(ii+1)=vy2(ii)+fy2(ii)/m1*dt; x2(ii+1)=x2(ii)+vx2(ii)*dt; y2(ii+1)=y2(ii)+vy2(ii)*dt;

Page 8: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

the motion of electrons in atoms

the behavior of currents and voltages in electronic circuits

planetary orbits

a pendulum

oscillatory and periodic phenomena

Page 9: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Simple Harmonic Motion

Euler method

1

1

1

( / )i i i

i i i

i i

g l t

t

t t t

2

2

d g

dt l

Page 10: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Problem with Euler Method

Energy not conserved with Euler method. Why?

Euler-Cromer method

1

1 1

1

( / )i i i

i i i

i i

g l t

t

t t t

illustration

Page 11: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Review of the numerical methods

dynamical variable vector

The accuracy of this algorithm is relatively low:

Euler method

Page 12: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

If we carry out the integration with g(y, t) given from this equation, we obtain a new algorithm

with preparation of

We can always include more points in the integral to obtain algorithms with apparently higher accuracy, but we will need the values of more points in order to start the algorithm. This becomes impractical if we need more than two points in order to start the algorithm.

Is there a more practical method?

Alternative way to improve the accuracy

Page 13: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

The Runge-Kutta method

A more practical method that requires only the first point in order to start or to improve the algorithm is the Runge–Kutta method.

Remember

( ') ( , )''

'''

t y

d y dg y t g g yy g gg

dt dt t y t

y

Martin Wilhelm Kutta

Carl Runge

Page 14: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

R-K method in Appendix A

Page 15: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Application

Illustration! Rk32.m

Page 16: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

We can also formally write the solution at t +τ as

where αi (with i = 1, 2, . . . ,m) and νi j (with i = 2, 3, . . . ,m and j < i ) are parameters to be determined.

What is the physical meaning of the expansion?

Page 17: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

2nd Order Runge-Kutta method

Set m=2

Now if we perform the Taylor expansion for c2 up to the term O(τ2), we have

Page 18: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

2nd Order Runge-Kutta method

Typically, there are m Eqs and m + m(m −1)/2 unknowns.

E.g., we may choose:1 2 21

1 1, , 1

2 2v

1 2 21

1 2 3, ,

3 3 4v

Note: These coefficients would result in a modified Euler method …

Page 19: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Review of R-K method

Page 20: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Application

1 i i

2 i 1 i

i 1 i 1 2

,

,

1

2

c g y t

c g y c t

y y c c

Page 21: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

4th Order Runge-Kutta method

The well-known fourth-order Runge–Kutta algorithm is given by

Page 22: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Making the pendulum more interesting

2

2

d g dq

dt l dt

2

2sin( )D D

d g dq F t

dt l dt

►Adding dissipation

►Adding a driving force

►Nonlinear pendulum2

2sin

d g

dt l

illustrations

Page 23: Www.compphys.cn South China University of Technology  Oscillator motions Xiaobao Yang Department of Physics xbyang/lectures.html.

www.compphys.cn

Homework

Exercise 3.1, 3.2, 3.6,

Sending your home work to [email protected] Results and source codes are required.

For lecture notes, refer to http://www.compphys.cn/~xbyang/

主题:学号 +姓名 +第?次作业