StandardAtmosphereTest.frink

View or download StandardAtmosphereTest.frink in plain text format

// This contains some routines to test the StandardAtmosphere class, contained
// in the file StandardAtmosphere.frink .

use StandardAtmosphere.frink

defaultAlt = "0 feet"
alt = eval[input["Enter geometric altitude [$defaultAlt]: ", defaultAlt]]

[t,p] = StandardAtmosphere.getTemperatureAndPressure[alt]

println["Temperature is: " + format[t, "K", 3]]
println["Pressure is: " + (p -> "millibars")]

density = StandardAtmosphere.getDensity[alt, t, p]
println["Density is: $density"]

molarMass = StandardAtmosphere.getMolarMass[alt]
println["Molar mass is: $molarMass"]

moleVolume = StandardAtmosphere.getMoleVolume[alt, t, p]
println["Mole volume is: $moleVolume"]

numberDensity = StandardAtmosphere.getNumberDensity[alt, t, p]
println["Number density is: $numberDensity"]

meanSpeed = StandardAtmosphere.getMeanAirParticleSpeed[alt, t, p]
println["Mean air particle speed is: $meanSpeed"]

meanPath = StandardAtmosphere.getMeanFreePath[alt, t, p]
println["Mean free path is: $meanPath"]

meanCollisionFrequency = StandardAtmosphere.getMeanCollisionFrequency[alt, t, p]
println["Mean collision frequency is: $meanCollisionFrequency"]

speedOfSound = StandardAtmosphere.getSpeedOfSound[alt, t, p]
println["Speed of sound is: $speedOfSound"]

dynamicViscosity = StandardAtmosphere.getDynamicViscosity[alt, t, p]
println["Dynamic viscosity is: $dynamicViscosity"]

kinematicViscosity = StandardAtmosphere.getKinematicViscosity[alt, t, p]
println["Kinematic viscosity is: $kinematicViscosity"]

g = new graphics
pt = new polyline
pp = new polyline

for alt = 0.1 km to 86 km step 100 m
{
   [t,p] = StandardAtmosphere.getTemperatureAndPressure[alt]
   pt.addPoint[alt/km, -(200 ln[t/K] - 4000)]
//   pp.addPoint[alt/km, -(40 ln[p/(1 atm)])]
}

g.add[pt]
//g.add[pp]
g.show[]


View or download StandardAtmosphereTest.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 17592 days, 15 hours, 42 minutes ago.