Home > Uncategorized > GlowScript Tutorial 5: Air Resistance

GlowScript Tutorial 5: Air Resistance

Now you are probably ready to do something with GlowScript that you couldn’t do with paper and pencil.  Let’s look at the motion of an object with a air resistance force.  Usually, we pick objects that have a negligible air resistance force to make things simpler.  The time for simple is past.

Ok, as an introduction to the air resistance force imagine that you are in a car with your hand out the window.  You can easily feel the air pushing on your hand as the car moves.  How hard does this air push?  Here are some things you should be able to notice.

  • The faster the car drives, the greater the air resistance force.
  • If you make your hand into a fist, you decrease the cross sectional area and also decrease the force.
  • The air resistance force pushes in the opposite direction as the motion of the car.

There are two other things about the air resistance force.  First, it depends on the density of air.  We typically use a value of about 1.2 kg/m^3 for the density of air (and it doesn’t change all that much).  Second, the air resistance force depends not only on the size of the object, but the shape.  If you put a cone on the front of a circle, it would have less air force than a flat circle.

With this in mind, we can write the following expression for the air resistance force.


Now, how do we add this force in GlowScript?  Let’s start with the previous example on projectile motion.  You need to add the following constants.


If you are looking at your projectile motion calculation, you might notice that I changed the mass of the ball from 100 grams to 10 grams.  If you have a large mass, the air resistance force doesn’t change the velocity very much.  Now you just need to add this force into your program.  Here is what your old Fnet calculation should look like.


You just need to add the air resistance force into that equation. Here are some hints:

  • Remember that mag() gives you the magnitude of a vector and norm() gives you a unit vector.
  • You might want to write the velocity as ball.p/ball.m – if you write this as a velocity vector you will also need to calculate the velocity each time you go through the loop.
  • The unit vector for momentum and velocity are in the same direction and have the same magnitude.

Add in the air resistance and see if you can get it to work.  How will you know if it works? If you use a ball mass of 10 grams, a radius of 2 cm and an initial velocity of 4 m/s at a 60 degree angle, the final x-position should be 0.33 meters (remember the ball started at x = -1).  If you put a statement after the loop, you can print the final position of the ball – like this:


Of course, that ball was not thrown very far.  What if you increase the launch speed?  But you still have a problem.  How big of a difference does air resistance make?  Here is one way to find out.

  • Add a second ball (you can call it ball2).
  • Give ball2 the same mass and initial momentum as the first ball.  You can give it a different color.
  • In your loop, calculate the force on ball2 as only the gravitational force.  Update ball2’s momentum and position.

Now you have a reference ball without air resistance.  You can test the limits of your ball with air resistance.  Consider the following questions (and test them).

  • What if you increase any of the following: density of air, drag coefficient, ball size?  What should happen to the motion of the ball with air resistance?  You can just print out the final position of the ball and compare it to the reference ball.
  • What if you decrease the mass of the ball?  What should happen?
  • What if you put the density of air at 0?  Would should you get?

GlowScript Tutorial 6: Functions

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: