def acceleration(mass, radius): '''This function calculates the surface acceleration of a planet. The mass is in units of solar masses, radius in terms of km, the acceleration is returned in units of cm/sec2. ''' return GRAV_CONSTANT * (mass * SOLAR_MASS_IN_GRAMS) / pow2( radius * CM_PER_KM)
def molecule_limit(mass, equat_radius, exospheric_temp): '''This function returns the smallest molecular weight retained by the body, is useful for determining the atmosphere composition. Mass is in units of solar masses, equatorial radius is in units of kilometers. ''' esc_velocity = escape_vel(mass, equat_radius) return ((3.0 * MOLAR_GAS_CONST * exospheric_temp) / (pow2((esc_velocity / GAS_RETENTION_THRESHOLD) / CM_PER_METER)))
def gas_life(molecular_weight, planet): ''' calculates the number of years it takes for 1/e of a gas to escape from a planet's atmosphere. Taken from Dole p. 34. He cites Jeans (1916) & Jones (1923)''' v = rms_vel(molecular_weight, planet.exospheric_temp) g = planet.surf_grav * EARTH_ACCELERATION r = (planet.radius * CM_PER_KM) try: t = (pow3(v) / (2.0 * pow2(g) * r)) * exp((3.0 * g * r) / pow2(v)) years = t / (SECONDS_PER_HOUR * 24.0 * DAYS_IN_A_YEAR) if years > 2.0E10: years = INCREDIBLY_LARGE_NUMBER except: years = INCREDIBLY_LARGE_NUMBER # long ve = planet.esc_velocity # long k = 2 # long t2 = ((k * pow3(v) * r) / pow4(ve)) * exp((3.0 * pow2(ve)) / (2.0 * pow2(v))) # long years2 = t2 / (SECONDS_PER_HOUR * 24.0 * DAYS_IN_A_YEAR) # if VERBOSE: # fprintf (stderr, "gas_life: %LGs, ratio: %Lf\n", # years, ve / v) return years