Last Updated: August 02, 2000
[ Algorithms Index | Index | Feedback ]
Calculates the vapor pressure for a given temperature. There is no one algorithm for calculating vapor pressure so I've included two that you can use. Which ever one you choose, make sure to use the corresponding source in Vapor Pressure From Temperauture.
function calcVaporPressure(t) { return 6.112 * Math.pow(10, (7.5 * t) / (237.7 + t)); }
function calcVaporPressure(t) { return 6.112 * Math.exp((17.67 * t) / (243.5 + t)) }
t is the temperature in Celsius
Returns the vapor pressure in millibars.
t = 22, function #1 returns: 26.3956
t = 11, function #1 returns: 13.1192
t = 22, function #2 returns: 26.4283
t = 11, function #2 returns: 13.1180
Finds the temperature from a given vapor pressure.
function calcTcFromVaporPressure(vp) { var logs = Math.log(vp / 6.112) / Math.LN10; return (237.7 * logs) / (7.5 - logs); }
function calcTcFromVaporPressure(vp) { var logs = Math.log(vp / 6.112); return (243.15 * logs) / (17.67 - logs); }
vp is the vapor pressure in millibars
Returns the corresponding temperature in Celsius.
vp = 26.3956, function #1 returns 22.0
vp = 13.1192, function #1 returns 11.0
vp =26.4283, function #2 returns 22.0
vp = 13.1180, function #2 returns 11.0
Finds the relative humidity from the actual and saturated vapor pressures.
function calcRelHumidityFromVp(actual, satur) { return actual / satur * 100.0; }
actual is the vapor pressure in millibars found using the dewpoint temperature in degrees Celsius.
satur is the vapor pressure in millibars found using the drybulb temperature in degrees Celsius.
Returns the relative humidity as a decimal. For a percentage, multiply by 100.
dewpoint = 11, actual = 13.1
drybulb = 22, satur = 26.4
result is: .496 or 49.6%
Estimates the wetbulb temperature given pressure, drybulb, and dewpoint.
function calcWetbulb (press, t, dp) { var tmin = Math.min(dp,t); var tmax = Math.max(dp,t); var e = calcVaporPressure(dp); var vpcur; var peq; var diff; var tcur; while (true) { tcur = (tmax + tmin) / 2; vpcur = calcVaporPressure(tcur); peq = 0.00066 * (1+0.00155 * tcur) * press * (t - tcur); diff = peq - vpcur + e; if (Math.abs(diff) < 0.01) break; if (diff < 0) tmax = tcur; else tmin = tcur; } return tcur; }
press is the barometric pressure in millibars
t is a temperature in degrees Celsius
dp is the dewpoint temperature in degrees Celsius
Returns the estimate of the wetbulb temperature in degrees Celsius.
press = 1013, t = 22, dp = 11, function returns: 15.5
press = 950, t = 22, dp = 11, function returns: 15.3
press = 1013, t = 0, dp = -8, function returns: -2.6
Calculates the specific humidity from the actual vapor pressure and barometric pressure.
function calcSpecHumidity(e, press) { return (0.62197 * e) / (press - (0.37803 * e)) * 1000.0; }
e is the vapor pressure in millibars of the dewpoint temperature.
press is the barometric pressure in millibars.
Returns the specific humidity in grams per kilogram.
e = 13.12 (from dewpoint of 11 °C), press = 1013, function returns: 8.09
e = 6.11 (from dewpoint of 0 °C), press = 1013, function returns: 3.76
Calculates the mixing ratio from the actual vapor pressure and barometric pressure.
function calcMixingRatio(e, press) { return ((0.62197 * e)/(press - e)) * 1000.0; }
e is the vapor pressure in millibars of the dewpoint temperature.
press is the barometric pressure in millibars.
Returns the mixing ratio in grams per kilogram.
e = 13.12 (from dewpoint of 11 °C), press = 1013, function returns: 8.2
e = 6.11 (from dewpoint of 0 °C), press = 1013, function returns: 3.8
Calculates absolute humidity from the actual vapor pressure and temperature.
function calcAbsHumidity(e, t) { return (e * 100) / (461.51 * (273.15 + t)) * 1000.0; }
For a function that takes dewpoint temperature instead of the vapor pressure derived from the dewpoint, use this code:
function calcAbsHumidityDp(dp, t) { var e = calcVaporPressure (dp); return calcAbsHumidity (e, t); }
e is the vapor pressure in millibars of the dewpoint temperature.
t is the temperature in Celsius.
Returns the absolute humidity in grams per cubed meter.
e = 13.12 (from dewpoint of 11 °C), press = 1013, function returns: 9.6
e = 6.11 (from dewpoint of 0 °C), press = 1013, function returns: 4.7
[ Algorithms Index | Index | Feedback ]
Copyright © 1997-1999 by Mark E. All Rights Reserved.