/* This file is a library containing functions for calculating properties of water vapor in air (e.g. absolute humidity, relative humidity, partial vapor pressure of water.) There are a lot of equations that could be used. See the survey: http://faculty.eas.ualberta.ca/jdwilson/EAS372_13/Vomel_CIRES_satvpformulae.html Most of the equations in this library are taken from the reversible equations cited in: Buck, A. L. (1981), "New equations for computing vapor pressure and enhancement factor", J. Appl. Meteorol. 20: 1527–1532 http://ams.allenpress.com/perlserv/?request=get-pdf&doi=10.1175%2F1520-0450%281981%29020%3C1527%3ANEFCVP%3E2.0.CO%3B2 This is further corrected in Buck (1996), Buck Research CR-1A User's Manual, Appendix 1. http://www.hygrometers.com/wp-content/uploads/CR-1A-users-manual-2009-12.pdf The equations in this library are for water vapor pressure over water (there are similar equations for over ice) and represent the corrected Buck equations (1996). A sample usage of this library might be to find how much water you need to vaporize to bring your house to 100% relative humidity. (Assuming that the contents of your house don't re-absorb any water.) This requires you to know your true atmospheric pressure (not re-corrected for altitude. Usually on weather sites, your atmospheric pressure is re-corrected as if it were at sea level, even if you live at a high altitude. If you live at 5500 feet, and your weather site tells you that your pressure is 1000 millibars, it's definitely re-corrected. You can obtain a good estimate of true atmospheric pressure for any altitude by running StandardAtmosphereTest.frink and giving it your altitude.) For example, true atmospheric pressure at my location (elevation 5500 feet above sea level) is around 0.816 atmosphere, which is used below. density = absoluteHumidity[F[68], 0.816 atm, 100 percent] housevolume = 53 feet 28 feet 20 feet density housevolume / water -> gallons which yields 3.85 gallons or, to obtain the mass of water to be vaporized: density housevolume which yields 14.8 kg Again, all the stuff in your house is going to re-absorb water, so the true amount of water that you'll have to evaporate will be more than this. Also, in wintertime, if you have a window open, the air coming in will be almost completely dry (especially if the outside air is near freezing or below) and will force you to vaporize much more water to maintain humidity (if you can keep up at all.) */ /* Returns *saturation* vapor pressure of water at the specified temperature. This is the maximum vapor pressure of water at the specified temperature over water. */ saturationVaporPressure[temp is temperature] := { t = C[temp] return 6.1121 hPa exp[(18.678 - t/234.5) t / (257.14 + t)] } // Calculate the vapor pressure given temperature, pressure, // and relative humidity (a number between 0 and 1, or, say, "30 percent") vaporPressure[temp is temperature, p is pressure, relativeHumidity is dimensionless] := { return relativeHumidity * buckF1[temp, p] } // Returns absolute humidity as a mass density (e.g. g/m^3) // T is the temperature, // relativeHumidity is a number between 0 and 1, or "30 percent" absoluteHumidity[temp is temperature, p is pressure, relativeHumidity is dimensionless] := { e = vaporPressure[temp, p, relativeHumidity] / millibars return 216.7 g/m^3 * e / (temp/K) } /* Returns absolute humidity as a mass density (e.g. g/m^3) for water vapor over water. (As opposed to over ice, which has different equations.) T is the temperature, vaporPressure is the partial pressure of water vapor It's much more likely that you'll use the function above, though, which calculates the partial vapor pressure of water for you, which is nonlinear and hard to measure directly. */ absoluteHumidity[temp is temperature, vaporPressure is pressure] := { return 216.7 g/m^3 (vaporPressure/millibar)/(temp/K) } //////////////////////////////////////////////////////////////////// // // You probably don't want to call functions below here directly, // but use the friendlier functions above. // //////////////////////////////////////////////////////////////////// /* Calculates equation F1 from Buck (1996) for partial vapor pressure over water (there are other equations for water over ice.) Results are the partial vapor pressure of water. temp is the temperature. p is the total atmospheric pressure. */ buckF1[temp is temperature, p is pressure] := { T = C[temp] return EFw[temp, p] * 6.1121 * exp[(18.678 - T/234.5) * T/(T+257.14)] millibars } /* Calculates the "enhancement factor" due to water vapor not behaving like an ideal gas in air. See Buck (1996). This is for water vapor over water. There is a different equation for water vapor over ice. Result is a dimensionless number. */ EFw[temp is temperature, p is pressure] := { P = p / millibars T = C[temp] return (1 + 10^-4 (7.2 + P (0.0320 + 5.9e-6 T^2))) }