CoriolisKick.frink

View or download CoriolisKick.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 = 853 m/s
vup    = 21 mph

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

timestep = 0.0001 s

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

latitude = +40 degrees        // Boulder, Colorado

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

t = 0 s
while up > 0 mm
{
   t = t + timestep
   
   // Eastward component
   if useCoriolis
      aeast = 2 omega (vnorth sin[latitude] - vup cos[latitude])
   else
      aeast = 0 m/s^2
   
   veast = veast + aeast 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
   north = north + vnorth timestep

   
   // Upward component
   aup = -gravity                             // Constant gravity
   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,"mm",3]     + "\t" +
           "North: " + format[north,"yards",3] + "\t" +
           "Up: "    + format[up,"yards",3]]
}


View or download CoriolisKick.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 17591 days, 17 hours, 47 minutes ago.