Tuesday, June 25, 2013

Dragging out Drag

My sequence for drag for the AP class next year:

  • Coffee filter investigation primarily about the kinematics of the motion (not working with the forces, except as derived through the motion analysis)
    • They draw a predicted position graph, having seen the filter float downward
    • Measure with motion detector, check prediction
    • Predict velocity graph shape
    • Check with motion detector
    • Predict acceleration graph shape
    • Some questions about interpreting the initial and final slopes of the y and v graphs and the concavity of the y graph's relationship to the acceleration
    • Assuming a velocity of this form:, determine the meanings of the constants, a velocity function, the terminal velocity, an acceleration function, and - finally - an expression for the net force (in terms of the velocity)

  • A few weeks later, another coffee filter modeling investigation, centering on using linearization to determine the exponent in the drag force (is it linear or quadratic drag?)
    • They'll start from force considerations and determine a way to measure the terminal velocity of their filter
    • They'll linearize (either with guesses for the exponent or log/log) to determine the exponent
    • They'll use that relationship and the data to calculate the drag coefficient for the filters and compare to some know ones (ie: Wikipedia)
  • The next day, start with a terminal velocity exploration:
    • Everybody picks an object
    • Research and/or estimate necessary quantities
    • Determine the terminal velocity of the object
    • Sketch position, velocity, and acceleration graphs for your object and a neighbor's object, on the same axes. Make it clear what differences there are and why, and show where the terminal velocity shows up on both the position and velocity graphs
    • I'll use the drag graph check Python program below to run through a few of the combinations for them - clear up any remaining issues

  • End the day with drag integrals:
    • We'll go through separation of variables and see why we don't normally do the integral for quadratic drag. It's a good moment to expose them to the concept of integral tables, which they often seem never to have seen before.
    • I'll have them go through free fall and a car rolling to rest with linear drag, so that they have some practice with the calculus. The limits typically trip students up, and these integrals show up on the AP exam at least every other year, so they're good to practice, even if the drag never really is linear
  • Maybe at some later point, I'll have them do something with the dashpot setup that I have, but it's fairly close to the second filters lab...
The code:

from __future__ import division
from visual.graph import *
from visual import *

# define window size
scene.height=600
scene.width=600
# scale measurements to window, turns off auto-scaling
#scene.scale=(.05,.05,.05)

# define scalars
hinitial = 400

m1 = .145
r1 = .038
C1 = .3

m2 = .1
r2 = .18
C2 = .7

deltat = .01
t = 0
g = 9.8
rho = 1.225

# ground
ground = box(pos = (0,-10,0), axis = (2,0,0), length = 200, width = .1, height = 20, color=color.green)

# create balls, defining radius, color, position and velocity vectors, leaving trail behind - define initial velocity
ball1=sphere(radius=r1, mass=m1, color=color.red, pos=vector(0,hinitial,0), velocity=vector(0,0,0), make_trail=True, trail_type="points", interval=20)
ball2=sphere(radius=r2, mass=m2, color=color.blue, pos=vector(10,hinitial,0), velocity=vector(0,0,0), make_trail=True, trail_type="points", interval=20)

#define forces
weight1=vector(0,-m1*g,0)
weight2=vector(0,-m2*g,0)

# GRAPH STUFF
xGraph = gdisplay(background=color.white, foreground=color.black, y=0, x=600, width=600,height=200,
              title='Positions vs. time', xtitle='Time (s)', ytitle='y (m)')#,
#              ymax = 0.25, ymin=0, xmax=1)
y1 = gcurve(color=color.red)
y1.plot(pos=(t,ball1.pos.y))

y2 = gcurve(color=color.blue)
y2.plot(pos=(t,ball2.pos.y))
            
vGraph = gdisplay(background=color.white, foreground=color.black, y=200, x=600, width=600,height=200,
              title='Velocities vs. time', xtitle='Time (s)', ytitle='v_y (m/s)')#,
#              ymax = 0.25, ymin=0, xmax=1)
v1 = gcurve(color=color.red)
v1.plot(pos=(t,ball1.velocity.y))

v2 = gcurve(color=color.blue)
v2.plot(pos=(t,ball2.velocity.y))

aGraph = gdisplay(background=color.white, foreground=color.black, y=400, x=600, width=600,height=200,
              title='Accelerations vs. time', xtitle='Time (s)', ytitle='a_y (m/s^2)')#,
#              ymax = 0.25, ymin=0, xmax=1)
a1 = gcurve(color=color.red)
a1.plot(pos=(t,weight1.y/m1))

a2 = gcurve(color=color.blue)
a2.plot(pos=(t,weight2.y/m2))


while ball1.pos.y >= 0 and ball2.pos.y>=0:
    #100 calculations per second
    rate(100)

    # update drag force
    dragforce1 = - .5 * rho * pi * ball1.radius**2 * C1 * mag(ball1.velocity) * ball1.velocity
    dragforce2 = - .5 * rho * pi * ball2.radius**2 * C2 * mag(ball2.velocity) * ball2.velocity

    # update balls' positions and velocities (could use momentum instead of v, with minor changes)
    ball1.velocity = ball1.velocity + (dragforce1 + weight1) * deltat / m1
    ball1.pos = ball1.pos + ball1.velocity * deltat
    ball2.velocity = ball2.velocity + (dragforce2 + weight2) * deltat / m2
    ball2.pos = ball2.pos + ball2.velocity * deltat

    # plot points
    y1.plot(pos=(t,ball1.pos.y))
    y2.plot(pos=(t,ball2.pos.y))
            
    v1.plot(pos=(t,ball1.velocity.y))
    v2.plot(pos=(t,ball2.velocity.y))

    a1.plot(pos=(t,(weight1.y+dragforce1.y)/m1))
    a2.plot(pos=(t,(weight2.y+dragforce2.y)/m2))

    
    #update time
    t = t + deltat
    

No comments:

Post a Comment