Download or view parachuteHat.frink in plain text format
/** This is a 2-dimensional ballistics / aerospace simulation that accurately
models air resistance (using the U.S. Standard Atmosphere as implemented
in StandardAtmosphere.frink ) and the curvature of the earth (in 2
dimensions.) It is based on the more general-purpose ballistics2D.frink
It can be used to model anything from orbital decay to hypervelocity meteor
impacts to orbital decay due to atmosphere.
This calculates the effect that a parachute hat would have on slowing a fall.
The variant meteorCrater.frink
models a hypervelocity impactor for Meteor Crater, Arizona and shows
the huge amount of energy radiated by pushing through atmosphere.
*/
use StandardAtmosphere.frink
// h is height above ground (initial height)
h = 80 m
// m1 is the mass of the person plus parachute
m1 = 140 lb
// Cd is drag coefficient of parachute
Cd = 1
// Size of parachute
parachuteDiameter = 5 feet
parachuteRadius = parachuteDiameter/2
area = pi parachuteRadius^2
// Initial velocity in the x direction (horizontal)
vx = 0 m/s
// Initial velocity in the y direction (vertical, positive is up)
vy = 0 m/s
// We're on Earth
planetmass = earthmass
r = earthradius
// Thickness of his silly little shoes
shoeThickness = 6 inches
// x and y are a cartesian coordinate system with the center of the planet
// at x=0 m, y=0 m. The projectile typically begins its journey at x=0 and
// at a given height-above-ground.
x = 0 m
y = r + h
initialGeopotentialHeight = (r * h) / (r + h)
//println["Geopotential height = " + (geopotentialHeight -> "ft")]
initialGeopotentialEnergy = m1 gravity initialGeopotentialHeight
initialKineticEnergy = 1/2 m1 sqrt[vx^2 + vy^2]^2
timestep = .1 s
t = 0 s
// Energy lost to drag
Edrag = 0 J
do
{
// l is distance from center of earth
l2 = x^2 + y^2
l = sqrt[l2]
h = l - r
// Angle with respect to center of the earth
alpha = arctan[x,y]
// Force due to gravity
fg = - G m1 planetmass / l2
// Acceleration due to gravity
ag = fg / m1
agx = ag sin[alpha]
agy = ag cos[alpha]
// Calculate total velocity
v2 = vx^2 + vy^2
v = sqrt[v2]
// Angle of travel (0 is in x direction, 90 degrees in y direction)
theta = arctan[vy, vx]
[temp, pressure] = StandardAtmosphere.getTemperatureAndPressure[h]
density = StandardAtmosphere.getDensity[h, temp, pressure]
// Force of drag
fdrag = 1/2 density v2 Cd area
// Acceleration due to drag
adrag = -fdrag / m1
adragx = adrag cos[theta]
adragy = adrag sin[theta]
t = t + timestep
// Total acceleration
axtotal = agx + adragx
aytotal = agy + adragy
atotal = sqrt[axtotal^2 + aytotal^2]
// Change in velocity over timestep
dvx = axtotal timestep
dvy = aytotal timestep
vx = vx + dvx
vy = vy + dvy
// Change in position over timestep
dx = vx timestep
dy = vy timestep
x = x + dx
y = y + dy
// Energy lost to drag
// E = f * d = f * v * t
dragpow = fdrag v
Edrag = Edrag + fdrag v timestep
// Calculate equivalent height (diminished by weakening gravity with height)
geopotentialHeight = (r * h) / (r + h)
geopotentialEnergy = m1 gravity geopotentialHeight
kineticEnergy = 1/2 m1 (vx^2 + vy^2)
totalEnergy = geopotentialEnergy + kineticEnergy
println[format[t,"s",2] + "\t" + format[h,"m",2] + "\t" + format[adrag,"gee",3] + "\t" + format[v,"mph",3] + "\t" + format[Edrag, "J", 3] + "\t" + format[dragpow,"W", 3]]
} while h >= 0 ft
initialEnergy = initialGeopotentialEnergy + initialKineticEnergy
equivHeight = 1/2 v^2 / gravity
impactAccel = 1/2 v^2 / shoeThickness
println[]
println["Initial potential energy = $initialGeopotentialEnergy"]
println["Initial kinetic energy = $initialKineticEnergy"]
println["Final kinetic energy = " + (1/2 m1 v2)]
println["Initial energy = " + initialEnergy]
println["Energy lost to drag = $Edrag"]
println["Fraction of energy lost to drag = " + format[Edrag / initialEnergy, "percent", 4]]
println["Final velocity is equivalent to falling from " + formatFix[equivHeight, "m", 2]]
println["Final impact acceleration due to shoes: " + formatFix[impactAccel, "gee", 2]]
Download or view parachuteHat.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, eliasen@mindspring.com