/** This is a simple model of Mars's atmosphere for modeling re-entry. See: https://www.grc.nasa.gov/WWW/K-12/airplane/atmosmrm.html These equations give nonsensical results (e.g. negative Kelvin temperatures) above 100 km. A better option might be to find the Mars-GRAM data files which require getting through broken NASA webpages. */ class MarsAtmosphere { /** Calculates temperature, pressure, and density of Mars's atmosphere at the given altitude. parameters: altitude returns: [temperature, pressure, density] */ class getTPD[altitude] := { if altitude < 7000 m t = C[-31 - 0.000998 (altitude/m)] else t = C[-23.4 - 0.00222 (altitude/m)] if t < 0 K t = 0 K p = .699 kPa exp[-0.00009 * (altitude/m)] if t > 0 K rho = (p / kPa) / (.1921 m^3/kg (t/K)) else rho = 0 kg/m^3 return [t, p, rho] } }