### Water Vapor Calculators

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

Background | mcSaturationVaporPressure.js | Saturation_vapor_pressure.html percent_difference | Water_Vapor.html | Numeric Fields

### Background

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 (15°C) would be over 2,000%RH at -30°C. I was also concerned that the "over water" equation would provide the wrong value at -30°C. (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

 The [RH over ice] equations discussed here are mostly of interest for frost-point measurements using chilled mirror hygrometers, since these instruments directly measure the temperature at which a frost layer and the overlying vapor are in equilibrium. In meteorological practice, relative humidity is given over liquid water ... and care needs to be taken to consider this difference. [ref]
At the time, it wasn't clear what that meant - I assumed that when a radio sounde reports a dew point suppression, that means that the frost point has already been converted to a dew point - but that was really just a guess. According to the Alduchov_Eskridge 1996 Introduction, with respect to the United States data
 ```Prior to 1948, saturation vapor pressure was calculated with respect to ice. Since 1948, saturation vapor pressure has been calculated with respect to water. In 1969 and 1981 new humidity algorithms were introduced. ```
In other words - this is a mess. And they say nothing about the rest of the world. In order to compare old data with new data, you need to know how the data was collected and how the measured values were converted to the reported values. Since the accuracy of the algorithms has changed over time, and since the definition of temperature has also changed, it is important to have sufficient metadata .. otherwise there is basically no way to get a good comparison of old and new data.

These programs were written to

• Test the various relationships
• Show the difference between RH over water and over ice
• Develop components and code that could be used in other programs
It turned out that the difficult part was determining the saturation vapor pressure - the rest of the code is simple and very straight forward.

In the following programs (calculators) the temperature values are limited to display 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 100°C and the new value is 99.974°C .. because the standard temperature scale was redefined in 1990!

### mcSaturationVaporPressure.js

The equations used to compute the saturation vapor pressures are implemented in mcSaturationVaporPressure.js.
Placing these algorithms in a separate module simplifies reusing them in various programs and guarantees that the computations will be the same.

For temperatures below 145 K (-128°C), 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 returns a partial pressure of zero for temperatures below 145 K.

### Saturation_vapor_pressure.html

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

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

 The vapour pressure of both ice and liquid water at the triple point is Pt = 611.657 ± 0.01 Pa at temperature Tt = 273.16 K (Guildner et al. 1976, Vapor pressure of water at its triple point. J. Res. Natl. Bur. Stand., 80A, 505-521)
This program shows that many algorithms don't intersect with this.

The second calibration point is a problem - ref

• Before 1990 (IPTS-68), water at 1 atm (1013.25 mbar) boiled at 100°C (373.15 K) (by definition)
• After 1990 (ITS-90), the second calibration point for the temperature scale was changed to absolute zero (0.0 K) and the new boiling point of water at 1 atm was measured to be 99.974°C (373.124 K)

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

• IAPWS - Their page is my reference for this change
• HylandWexler - This model was produced several years before the change occurred - 1983 vs 1990
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.

Various hints and notes are displayed in the status bar when the mouse is placed over certain fields.

• Pressures are in mbar - mbar, torr (mmHg), and psi are displayed
• The algorithm names - most show the date the algorithm was first published, some have additional data

### Saturation_vapor_pressure_percent_difference.html

Saturation_vapor_pressure_percent_difference.html extends the capability of Saturation_vapor_pressure.html by
• Adding 2 columns to display the difference and the percent difference with respect to a target formulation.
• Coloring those values that are outside a user defined range (default = 0.5%) to light red
• Coloring the target formulation light yellow
• Allowing the user to enter coefficients for a Magnus equation
To use the extra columns, first click on one of the Over Water values - it will be used as the "compare" value .. indicated with a light yellow background. The difference and percent difference will be computed for all the other Over Water formulations.

The initial threshold is ± 0.5% (which you can change) - values outside that range are colored light red. A checkbox will disable the color.

The basic Magnus equation (1844) is used in many programs, online calculators, and journal papers. However, there are many sets of coefficients! Way too many to include them all in a general calculator. (My programs implement 4.) For example, the purpose of Review of the vapour pressures of ice and supercooled water for atmospheric applications by D. M. Murphy and T. Koop, 29 Dec 2006, was to find new Magnus coefficients, and several sets were found. At any rate, I have provided a way for you to compare the odd stuff to the 19 over liquid water formulations provided. Note that the temperature used is in degrees-C and that some formulations use Kelvin in a way that simply subtracting 273.15 will not produce the expected result. For example, for the MagnusTetens formulation, you need to subtract 273.16 and add 0.01 to the C parameter. Here are a few Other Formulas (Careful - A, B, C are in a different order).

### Water_Vapor.html

Originally, I just wanted to investigate the relation between Dew Point, Relative Humidity, and the Mixing Ratio - the value needed to compute IR absorption and emission. I had no idea there were so many formulations - especially since most references simply imply that their equation is the only one!

Once I had code to compute the saturation vapor pressure - the rest of the code was simple and very straight forward.

Water_Vapor.html was written to

• Compute the various relationships
• Show the difference between RH over water and over ice
• Develop components and code that could be used in other programs

Assuming the RH is known

 ```Mixing_Ratio = Saturation_Mixing_Ratio * RH / 100; ```
Assuming the mixing ratio is known
 ```RH = Mixing_Ratio / Saturation_Mixing_Ratio * 100; ```
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.
 ```Saturation_Mixing_Ratio = Saturation_Partial_Pressure / Pressure * 1e6; ```
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.

The temperature inputs are rounded to 2 decimal points. Most other fields are rounded to 5. As a result, some 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.

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, several parameters are tightly linked - radio buttons are provided to select which one to hold constant as other values are changed.

• %RH over water
• %RH over ice
• Mixing ration (ppm)
• Dew Point Suppression
• Dew Point

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

### Numeric Fields

All the numeric data entry fields have associated spin buttons. In addition to typing in new values, you can use the buttons or use the mouse wheel. Use (press and hold) the Shift, Ctrl, and Alt keys to control the increment size.
Step Size Alt Ctrl Shift
1000        x x
100        x
10          x
1
0.1    x
0.01   x   x
0.001  x x
0.0001 x x x

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).

### Versions

All major software changes. Spelling and format changes are not listed.

 mcSaturationVaporPressure.js The main program, it contains most of the formulations. mcWaterVapor.js Computes Dewpoint, RH, mixing ratio, calls mcSaturationVaporPressure.js mcTemperature.js mcDewPointTemperature.js Displays the 3 temperature values and converts between them
 06-05-16 Converted Delphi files to javascript mcSaturationVaporPressure.js, mcWaterVapor.js, mcTemperature.js 06-07-16 First html uploads Saturation_vapor_pressure.html & Water_Vapor.html 06-28-16 Fixed issues in several files so calculators would work in IE8 07-13-16 mcTemperature.js Modified to use mcUITools.js When Kelvin field has max value, all fields are forced to have a max value mcSaturationVaporPressure.js Added a test for calibration range - allows an out of range indication Saturation_vapor_pressure.html & Water_Vapor.html Added calibration test - red when out of calibration 07-30-16 mcDewPointTemperature.js Made from mcTemperature.js because javascript is not object oriented Water_Vapor.html Added new temperature component to the dewpoint section 10-13-16 mcSaturationVaporPressure.js Modified calibration range for HylandWexler over ice, now red T_C>0.01 Saturation_vapor_pressure.html Added hints when placing the mouse over the formulation names 09-15-19 mcWaterVapor.js Changed Dewpoint - when the Mixing_Ratio is zero, Dewpoint is undefined Water_Vapor.html Fixed issue with mixing ratio zero and near zero 11-08-19 Saturation_vapor_pressure_percent_difference.html Created new calculator from Saturation_vapor_pressure.html 11-17-19 mcSaturationVaporPressure.js Fixed Wexler over water and Sonntag over ice coefficients Added Wexler over ice 11-25-19 Added Wexler over ice v1.2 Saturation_vapor_pressure.html v1.2 Saturation_vapor_pressure_percent_difference.html

Author: Robert Clemenzi