MarsAtmosphereOld.frink

Download or view MarsAtmosphereOld.frink in plain text format


/** This is a simple model of Mars's atmosphere provided by NASA.

    This is obsolete and should be replaced by the much better
    MarsAtmosphere.frink 

    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.
*/

class MarsAtmosphereOld
{
   /** 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]
   }
}


Download or view MarsAtmosphereOld.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 20217 days, 23 hours, 44 minutes ago.