Water Vapor Programs

I have written several programs to help understand the problems computing relative humidity - zip. These programs implement 30 equations (algorithms) to compute saturated water vapor based only on the provided temperature.

Saturation_vapor_pressure.exe | Water_Vapor.exe | mcSaturationVaporPressure.pas | Numeric Fields | Versions


There are many equations to compute the saturation water vapor pressure depending on the temperature. Saturation_vapor_pressure.exe shows the results of 30 algorithms for easy comparison - just set the temperature. (All 3 temperature fields are linked - just pick one.)

Image of version

From Review of the vapour pressures of ice and supercooled water for atmospheric applications by D. M. Murphy and T. Koop, 29 Dec 2006

This program shows that many algorithms don't intersect with this.

The second calibration point is a problem - ref

Perhaps 2 of the formulations have been modified to take this into account

Otherwise, as far as I can tell, none of the other saturation vapor pressure algorithms have been modified to take this into account. (It's been 24 years and counting.) Maybe it does not really matter since most of the algorithms don't intersect either boiling point.

By the way, there is no requirement that a good algorithm has to intersect one, or both, calibration points (though it would be nice). "Improved Magnus` form approximation of saturation vapor pressure" argues that a formulation that produces the smallest maximum error may be "better" than the algorithm with the smallest overall error (determined by, for example, a least squares fit) if the tail values are off by a large amount.

Both programs normally limit the temperature precision to only 2 decimal places. To use additional precision, type the value into the Kelvin field. The only time I have needed this is when checking the *new* boiling point of water at 1 atm - the old standard was 100C and the new value is 99.974C .. because the standard temperature scale was redefined in 1990!

For temperatures below 145 K, the partial pressures are so low that they might as well be zero. Also, some of the algorithms produce errors with lower temperatures. As a result, the program just shows zeros for temperatures below 145 K.


When studying the IR absorption of the atmosphere, the number of molecules of water vapor in a column of air is required. Another program I wrote allows you to enter the water vapor mixing ratio which is used to compute the number of molecules in the column.

The problem was that I had no idea if the values made any sense. Therefore, I added a computation to find the relative humidity (%RH) associated with that mixing ratio. I was surprised to learn that the mixing ratio for 60%RH at the surface (15C) would be over 2,000%RH at -30C. I was also concerned that the "over water" equation would provide the wrong value at -30C. (Not much liquid at that temperature.) It was while investigating the "over ice" algorithm that I discovered that there were many models to compute the saturation vapor pressure.

In addition, I found the following very confusing - when discussing the RH over ice formulations

It still isn't clear what that means - I assume that when a radio sounde reports a dewpoint suppression, that means that the frost point has aready been converted to a dew point - but that is really just a guess.

Water_Vapor.exe was written to

It turned out that the difficult part was determining the saturation vapor pressure - the rest of the code is simple and very straight forward.

Assuming the RH is known

Assuming the mixing ratio is known The saturation mixing ratio (ppm) is simply the saturation partial pressure (based only on temperature) divided by the actual pressure and multiplied by one million. Well, those are the formulas I use, but they are not strictly "correct". The mixing ratio is usually specified for "dry air". As a result, some adjustment is necessary .. somewhere. The books I have are not very clear on this.

Image of version

The temperature inputs and the relative humidities are rounded to 2 decimal points. In the Cloud base and Dew Point Suppression panels, 8 significant figures are displayed. As a result, the numbers may not match exactly.

The program computes the dew point and the frost point - the temperatures where RH reaches 100%. Obviously, frost points above freezing are of no value. However, dew points below freezing are useful - they could indicate the possibility of a freezing rain event, a condition where super cooled liquid water freezes on impact - and occur on a regular basis.

The Cloud Base altitudes are just for fun. Since the temperature and RH are available, this just determines the height where RH reaches 100% .. assuming that the air temperature decreases at either 6.5 K/km (the Environmental Lapse Rate - ELR) or 9.8 K/km (the Dry Adiabatic Lapse Rate - DALR). Of course, the temperature seldom decreases at either rate near the surface. The 2 main exceptions are the DALR over land on a hot summer afternoon, and the ELR over the oceans on a clear day.

Rework this algorithm - the current algorithm assume that the partial pressure remains constant. It actually decreases with altitude. As air rises, the mixing ratio remains constant, and assuming a constant temperature, the relative humidity decreases. Since both the pressure and the temperature decrease, the cloud condensation level (CCL) [not the correct acronym] will be higher than computed using a constant pressure.

When the mouse is over a temperature, pressure, or altitude control (other than the temperature selector), appropriate conversions will be displayed in the status bar.

The fields with white backgrounds can be edited by the user. Those with grey backgrounds are readonly computed values - they can be copied to the clipboard .. but you can not enter new data.

On the form, 3 parameters are tightly linked

As you change one, the other two are computed. The radio buttons specify which should be held constant (computed first) as the temperature, pressure, and algorithm are changed.

Temperatures are limited to those below the critical temperature - 647.096 K - and above 140 K.


The equations used to compute the saturation vapor pressure are implemented in mcSaturationVaporPressure.pas (written in Pascal and included in the zip file). Placing these algorithms in a separate module simplifies reusing them in various programs and guarantees that the computations will be the same.

Numeric Fields

All the numeric data entry fields have associated spin buttons. In addition to typing in new values, you can use the buttons, drag the bar between the buttons, or use the mouse wheel. Use (press and hold) the Shift, Ctrl, and Alt keys to control the increment size.

Some of the fields have hard limits (degrees-K won't go below zero) and others will turn red outside the expected range (0 < %RH < 150).


All software changes!

Author: Robert Clemenzi
URL: http:// mc-computing.com / Science_Facts / Water_Vapor / Water_Vapor_Programs.html