CoriolisBall.frink

View or download CoriolisBall.frink in plain text format


/** This program calculates the effect of the Coriolis force on a kicked
    football.  (Or any other projectile).  It models the effects of the
    Coriolis force in 3 dimensions.

    For the equations and coordinate system used, see:
    https://en.wikipedia.org/wiki/Coriolis_effect#Rotating_sphere
*/


// Initial velocity components
veast  = 0 m/s
vnorth = 6.0015 m/s  // Less than this, ball stops short
vup    = 0 mph

// Initial positions    
east  = 0 yards
north = 0 yards
up    = 0 inches   // Initial height above ground.

timestep = 0.01 s

omega = 1 revolution/day      // Rotation rate of the earth

latitude = 33.63326 degrees // Atlanta airport

useCoriolis = true            // Change this to see with/without Coriolis effect.

t = 0 s
while north < 726 m and vnorth > 0.001 m/s
{
   t = t + timestep
   
   // Eastward component
   if useCoriolis
      aeast = 2 omega (vnorth sin[latitude] - vup cos[latitude])
   else
      aeast = 0 m/s^2

   speed = sqrt[vnorth^2 + veast^2]

   // Friction always works *opposite* of direction of rolling, so we
   // calculate friction components for each velocity component.
   vangle = arctan[veast, vnorth]  // Angle east of north
//   println["Angle is " + (angle->"degrees")]
   aFriction = -0.0248 m/s^2
   aFrictionEast = aFriction sin[vangle]
   aFrictionNorth = aFriction cos[vangle]

   veast = veast + aeast timestep + aFrictionEast timestep
   east = east + veast timestep
   
   // Northward component
   if useCoriolis
      anorth = 2 omega (-veast sin[latitude])
   else
      anorth = 0 m/s^2


   vnorth = vnorth + anorth timestep + aFrictionNorth timestep
   north = north + vnorth timestep

   speed = sqrt[vnorth^2 + veast^2]
   
   // Upward component
   // Rolling, so no upward acceleration
   aup = 0 m/s^2

   //if useCoriolis
   //    aup = aup + 2 omega (veast cos[latitude])  // Add coriolis effect upwards
   
   vup = vup + aup timestep    // deltaV = a t
   up  = up + vup timestep     // deltaDistance = v t

   println["t: "     + format[t, "s", 3]       + "\t" +
           "East: "  + format[east,"m",3]     + "\t" +
           "North: " + format[north,"m",3] + "\t" +
           "Speed: "    + format[speed,"m/s",3]]
}

if north < 726 m
   println["*** Ball stopped short. ***"]


View or download CoriolisBall.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17841 days, 20 hours, 55 minutes ago.