Now that we have explored the simple pendulum, we take our studies one step further to see what happens when we add friction into the mix. We need to know the forces acting on our pendulum. To do this we again draw a free body diagram, seen below.
The only difference is the existence of the force due to drag, which always opposes the direction of motion. In other words, it always acts in the $\hat{\theta}$ direction. Generally, we might write this drag term as
$$
F_D = -bl\dot{\theta}
$$
where we have introduced the dot notation to refer to the derivative being taken with respect to time. Here we assume that drag is linearly proportional to our pendulum's speed. $l$ is still the length of the pendulum, and $b$ is just some constant that tells us how strong the drag force is -- it would depend on things such as the density of the air your pendulum is swinging through.
Setting up Newton's second law (using our dot notation, a double dot would represent the second derivative with respect to time) yields,
$$
ml\ddot\theta = -mg\sin\theta-bl\dot{\theta}
$$
We might rearrange this in a more conventional way, making the following subsitutions
$$
\beta = \frac{b}{2m} \hspace{2cm}\text{and}\hspace{2cm} \omega_0 = \sqrt{\frac{g}{l}}
$$
$$
\ddot{\theta} + 2\beta\dot{\theta} + \omega_0^2\sin\theta = 0
$$
Writing the equation in this way makes it easier to do further analysis, something we will skip for now. Instead we will again rewrite this equation, this time breaking it up into two coupled first order differential equations so that we might solve them numerically. We let
$$
\dot{\theta} = \omega
$$
such that
$$
\dot{\omega} = -2\beta\dot{\theta} - \omega_0^2\sin\theta
$$
Great, we have our equations of motion for the pendulum. Let us now invoke the Euler-Cromer method to solve this. Each system shown on this page will start at an intial angle of 120 degrees above the vertical, and zero initial angular speed.
I think coding is gross!
# Damped pendulum
# Import packages needed
import matplotlib.animation as animation
from numpy import sqrt, sin, cos, arange, pi, append, array
from pylab import plot, xlabel, ylabel, title, show, axhline, savefig, subplots_adjust,\
figure, xlim, rcParams, rc, rc_context, subplot, tight_layout, axvline, legend
# define parameters for our problem
m = 1 # mass of bob at end of pendulum
l = 2.25 # length of pendulum
g = 9.81 # acceleration due to gravity
b = 0.35 # friction coefficient
omega0 = sqrt(g/l) # resonant frequency
beta = b/(2*m)
t = 0.0 # time start
t_f = 25.0 # time end
dt = 0.005 # time step
# set up domain
t_points = arange(t,t_f+dt,dt)
# create sets with initial conditions
theta_initial_deg = 120
theta_initial = theta_initial_deg*pi/180
omega_initial_deg = 0.0
omega_initial = omega_initial_deg*pi/180
theta_points = [theta_initial]
omega_points = [omega_initial]
# invoke Euler-Cromer
for i in range(len(t_points)+1):
# find our angular velocity at the next step
omega_new = omega_points[i] + dt*(-2*beta*omega_points[i]\
-omega0**2 * sin(theta_points[i]))
# use our newly found angular velocity to find our angle
# at the next step
theta_new = theta_points[i] + dt*omega_new
# update our conditions
theta_points.append(theta_new)
omega_points.append(omega_new)
# convert values to degrees to plot
theta_points_deg = []
omega_points_deg = []
for i in range(len(t_points)+1):
theta_points_deg.append(theta_points[i]*180/pi)
omega_points_deg.append(omega_points[i]*180/pi)
# animate our results
# start with styling options
rcParams.update({'font.size': 18})
rc('axes', linewidth=2)
with rc_context({'axes.edgecolor':'white', 'xtick.color':'white', \
'ytick.color':'white', 'figure.facecolor':'darkslategrey',\
'axes.facecolor':'darkslategrey','axes.labelcolor':'white',\
'axes.titlecolor':'white'}):
# set up a figure that will be ultimately be 2x2
fig = figure(figsize=(10,9))
fig.subplots_adjust(hspace=0.3,wspace=0.5)
# create subplots for each animation
# first the pendulum itself
ax_pend = subplot(2,2,1, aspect='equal',adjustable='datalim')
# get rid of axis ticks
ax_pend.tick_params(axis='both', colors="darkslategrey")
# now our phase diagram
ax_phase = subplot(2,2,2)
axvline(color='k', lw=1)
axhline(color='k', lw=1)
title("Phase Diagram")
xlabel("Angle (deg)")
ylabel("Angular Speed (deg/s)")
# now our angle vs. time graph
# we want it to be on the bottom row, two "plots" long
ax_ang = subplot(2,2,(3,4))
axhline(color='k', lw=1)
title("Angle Vs. Time")
xlabel("Time (s)")
ylabel("Angle (deg)")
### finally we animate ###
# create a list to input images in for each time step
ims = []
index = 0
while index <= len(t_points)+1:
### pendulum ###
# the rigid rod of length l
ln, = ax_pend.plot([0,l*sin(theta_points[index])],\
[0,-l*cos(theta_points[index])], color='white',lw=3)
# our mass on the end
bob, = ax_pend.plot(l*sin(theta_points[index]),\
-l*cos(theta_points[index]),'o',\
markersize=22,color="darkturquoise",zorder=100)
### phase ###
phase_curve, = ax_phase.plot(theta_points_deg[:(index+1)],\
omega_points_deg[:(index+1)],\
color="coral",lw=2.5)
phase_dot, = ax_phase.plot(theta_points_deg[index:(index+1)],\
omega_points_deg[index:(index+1)],\
color="darkturquoise",marker="o",markersize=14)
### angle vs. time ###
ang, = ax_ang.plot(t_points[:(index+1)], theta_points_deg[:(index+1)],\
color="darkturquoise",lw=3)
# add pictures to ims list
ims.append([ln, bob, phase_curve, phase_dot, ang])
# only show every 8 frames
index += 8
# save animations
ani = animation.ArtistAnimation(fig, ims, interval=100)
writervideo = animation.FFMpegWriter(fps=60)
ani.save('../dampedPendulum/1_dampedPend.mp4', writer=writervideo)
Unsurprisingly, the damping term causes our pendulum's amplitude to decrease with each swing, until it eventually comes to a complete stop. Notice the spiral pattern of the phase diagram. This is what we call an underdamped system. Let us now increase the magnitude of our friction coefficient bit by bit, and investigate what happens.
The system above is what we call critically-damped. Meaning the friction is just the right value such that our pendulum drops straight down to its equilibrium position with no oscillation. This happens when $\beta=\omega_0$. What happens if we increase friction such that $\beta>\omega_0$?
I have made the friction term roughly 4 times larger than it was in the critically damped case. This makes it such that the pendulum very slowly drops to its equilibrium position. Such a system is said to be over-damped.
Perhaps damped pendulums are not the most riveting systems to study, but it important to talk about, since every real pendulum has damping. Next, we will explore the driven pendulum, which can make absolutely beautiful patterns with their angle vs. time graphs, and phase diagrams.