This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Damped, driven oscillator • Start with the case where q=0, F D =0 • y(t)= Acos ω t + Bsin ω t • Initial conditions, A=y , B=v 0 / ω • Energy (kinetic + potential) should be conserved! Compare with analytical to verify code, also test energy conservation! Test with simple harmonic oscillator • Use Verlet algoritim y n+1 = 2y n y n1  ω 2 dt 2 y n c force/mass from spring force = om0**2*ynow c integrate to get y at next time step, use Verlet Test with simple harmonic oscillator • Use Verlet algoritim y n+1 = 2y n y n1  ω 2 dt 2 y n c force/mass from spring force = om0**2*ynow c integrate to get y at next time step, use Verlet ynext = 2.0d0*ynowylast+dt**2*force Initial conditions, analytic solution • Analytic result computed for comparison • Verlet algorithm needs position at two previous times • Translate into initial position and initial velocity y(t)= Acos ω t + Bsin ω t Initial conditions, A=y , B=v 0 / ω c velocity at current timestep vnow = (ynextylast)/(2.0d0*dt)vnow = (ynextylast)/(2....
View
Full
Document
This note was uploaded on 08/08/2011 for the course PHZ 5156 taught by Professor Johnson,m during the Fall '08 term at University of Central Florida.
 Fall '08
 Johnson,M

Click to edit the document details