# Humid Air Properties¶

If you are feeling impatient, jump to Sample HAPropsSI Code, or to go to the code documentation CoolProp.HumidAirProp, otherwise, hang in there.

The equations implemented in CoolProp are based on a publication by Hermann et al. [2], which describes the outcome of the ASHRAE research project ASHREA-RP1485. The same source has been used in the ASHRAE Handbook 2009 to generate reference saturation property tables. The code implemented here passes all tests and reproduces the original data with a very high accuracy. It is applicable for pressure from 0.01 kPa up to 10 MPa, in a temperature range from -143.15 °C up to 350 °C with a humidity ratio from 0 kg of water up to 10 kg of water per kg of dry air.

Humid air can be modeled as a mixture of air and water vapor. In the simplest analysis, water and air are treated as ideal gases but in principle there is interaction between the air and water molecules that must be included through the use of interaction parameters.

Because humid air is a mixture of dry air (treated as a pseudo-pure gas) and water vapor (treated as a real gas), three variables are required to fix the state by the state postulate.

In the analysis that follows, the three parameters that are ultimately needed to calculate everything else are the dry bulb temperature $$T$$, the total pressure $$p$$, and the molar fraction of water $$\psi_w$$. The molar fraction of air is simply $$\psi_a=1-\psi_w$$.

Of course, it is not so straightforward to measure the mole fraction of water vapor molecules, so other measures are used. There are three different variables that can be used to obtain the mole fraction of water vapor without resorting to iterative methods.

1. Humidity ratio

The humidity ratio $$W$$ is the ratio of the mass of water vapor to the mass of air in the mixture. Thus the mole fraction of water can be obtained from

$\psi_w=\frac{n_w}{n}=\frac{n_w}{n_a+n_w}=\frac{m_w/M_w}{m_a/M_a+m_w/M_w}=\frac{m_w}{(M_w/M_a)m_a+m_w}=\frac{1}{(M_w/M_a)/W+1}=\frac{W}{(M_w/M_a)+W}$

or

$\psi_w=\frac{W}{\varepsilon+W}$

where the ratio of mole masses $$\varepsilon$$ is given by $$\varepsilon=M_w/M_a$$

1. Relative Humidity

The relative humidity $$\varphi$$ is defined as the ratio of the mole fraction of water in the humid air to the saturation mole fraction of water. Because of the presence of air with the water, the pure water saturated vapor pressure $$p_{w,s}$$ must be multiplied by an enhancement factor $$f$$ that is very close to one near atmospheric conditions.

Mathematically, the result is

$\varphi=\frac{\psi_w}{\psi_{w,s}}$

where

$\psi_{w,s}=\frac{fp_{w,s}}{p}$

The product $$p_s$$ is defined by $$p_s=fp_{w,s}$$, and $$p_{w,s}$$ is the saturation pressure of pure water (or ice) at temperature $$T$$. This yields the result for $$\psi_w$$ of

$\varphi=\frac{\psi_w}{p_s/p}$
$\psi_w=\frac{\varphi p_s}{p}$
1. Dewpoint temperature

The dewpoint temperature is defined as the temperature at which the actual vapor pressure of water is equal to the saturation vapor pressure. At the given dewpoint, the vapor pressure of water is given by

$p_w=f(p,T_{dp})p_{w,s}(T_{dp})$

and the mole fraction of water vapor is obtained from

$\psi_w=\frac{p_w}{p}$

Once the state has been fixed by a set of $$T,p,\psi_w$$, any parameter of interest can be calculated

## Molar Volume¶

(1)$p=\frac{\bar R T}{\bar v}\left( 1+\frac{B_m}{\bar v}+\frac{C_m}{\bar v^2}\right)$

The bracketed term on the right hand side is the compressibility Z factor, equal to 1 for ideal gas, and is a measure of non-ideality of the air. The virial terms are given by

$B_m=(1-\psi_w)^2B_{aa}+2(1-\psi_w)\psi_wB_{aw}+\psi_w^2B_{ww}$$C_m=(1-\psi_w)^3C_{aaa}+3(1-\psi_w)^2\psi_wC_{aaw}+3(1-\psi_w)\psi_w^2C_{aww}+\psi_w^3C_{www}$

where the virial coefficients are described in ASRAE RP-1485 and their values are provided in Humid Air Validation. All virial terms are functions only of temperature.

Usually the temperature is known, the water mole fraction is calculated, and $$\bar v$$ is found using iterative methods, in HAProps, using a secant solver and the first guess that the compressibility factor is 1.0.

## Molar Enthalpy¶

The molar enthalpy of humid air is obtained from

$\bar h=(1-\psi_w)\bar h_a^o+\psi_w\bar h_w^o+\bar R T \left[(B_m-T\frac{dB_m}{dT})\frac{1}{\bar v}+\left(C_m-\frac{T}{2}\frac{dC_m}{dT}\right) \frac{1}{\bar v^2}\right]$

with $$\bar h$$ in kJ/kmol. For both air and water, the full EOS is used to evaluate the enthalpy

$\bar h_a^o=\bar h_0+\bar RT\left[ 1+\tau\left( \frac{\partial \alpha^o}{\partial \tau}\right)_{\delta}\right]$

which is in kJ/kmol, using the mixture $$\bar v$$ to define the parameter $$\delta=1/(\bar v \bar \rho_c)$$ for each fluid, and using the critical molar density for the fluid obtained from $$\bar \rho_c=1000\rho_c/M$$ to give units of mol/m3. The offset enthalpies for air and water are given by

$\bar h_{0,a}=-7,914.149298\mbox{ kJ/kmol}$$\bar h_{0,w}=-0.01102303806\mbox{ kJ/kmol}$

respectively. The enthalpy per kg of dry air is given by

$h=\bar h\frac{1+W}{M_{ha}}$

## Enhancement factor¶

The enhancement factor is a parameter that includes the impact of the air on the saturation pressure of water vapor. It is only a function of temperature and pressure, but it must be iteratively obtained due to the nature of the expression for the enhancement factor.

$$\psi_{w,s}$$ is given by $$\psi_{w,s}=fp_{w,s}/p$$, where $$f$$ can be obtained from

$\begin{split}\ln(f)=\left[ \begin{array}{l}\left [ \dfrac{(1+k_Tp_{w,s})(p-p_{w,s})-k_T\dfrac{(p^2-p_{w,s}^2)}{2}}{\overline {R} T}\right] \bar v_{w,s}+\ln[1-\beta_H(1-\psi_{w,s})p]\\ +\left[\dfrac{(1-\psi_{w,s})^2p}{\bar R T}\right] B_{aa}-2\left[\dfrac{(1-\psi_{w,s})^2p}{\bar R T}\right]B_{aw}-\left[\dfrac{(p-p_{w,s}-(1-\psi_{w,s})^2p)}{\bar R T}\right]B_{ww} \\ +\left[\dfrac{(1-\psi_{w,s})^3 p^2}{(\bar R T)^2}\right] C_{aaa}+\left[\dfrac{3(1-\psi_{w,s})^2[1-2(1-\psi_{w,s})]p^2}{2(\bar R T)^2}\right]C_{aaw}\\ -\left[\dfrac{3(1-\psi_{w,s})^2\psi_{w,s}p^2}{(\bar R T)^2}\right]C_{aww}-\left[\dfrac{(3-2\psi_{w,s})\psi_{w,s}^2p^2-p_{w,s}^2}{2(\bar R T)^2}\right]C_{www}\\ -\left[\dfrac{(1-\psi_{w,s})^2(-2+3\psi_{w,s})\psi_{w,s}p^2}{(\bar R T)^2}\right]B_{aa}B_{ww}\\ -\left[\dfrac{2(1-\psi_{w,s})^3(-1+3\psi_{w,s})p^2}{(\bar R T)^2}\right]B_{aa}B_{aw}\\ +\left[\dfrac{6(1-\psi_{w,s})^2\psi_{w,s}^2p^2}{(\bar R T)^2}\right]B_{ww}B_{aw}-\left[\dfrac{3(1-\psi_{w,s})^4p^2}{2(\bar R T)^2}\right]B_{aa}^2\\ -\left[\dfrac{2(1-\psi_{w,s})^2\psi_{w,s}(-2+3\psi_{w,s})p^2}{(\bar R T)^2}\right]B_{aw}^2-\left[\dfrac{p_{w,s}^2-(4-3\psi_{w,s})(\psi_{w,s})^3p^2}{2(\bar R T)^2}\right]B_{ww}^2 \end{array}\right]\end{split}$

## Isothermal Compressibility¶

For water, the isothermal compressibility [in 1/Pa] is evaluated from

$k_T=\frac{1}{\rho\frac{\partial p}{\partial \rho}}\frac{1\mbox{ kPa}}{1000\mbox{ Pa}}$

with

$\frac{\partial p}{\partial \rho}=RT\left[1+2\delta\left(\frac{\partial \alpha^r}{\partial \delta}\right)_{\tau}+\delta^2\left(\frac{\partial^2 \alpha^r}{\partial \delta^2}\right)_{\tau}\right]$

in kPa/(kg/m3). And for ice,

$k_T=\left( \frac{\partial^2 g}{\partial p^2}\right) \left( \frac{\partial g}{\partial p}\right)_T^{-1}\frac{1\mbox{ kPa}}{1000\mbox{ Pa}}$

## Sample HAPropsSI Code¶

To use the HAPropsSI function, import it and do some calls, do something like this

#import the things you need
In [1]: from CoolProp.HumidAirProp import HAPropsSI

#Enthalpy (J per kg dry air) as a function of temperature, pressure,
#    and relative humidity at dry bulb temperature T of 25C, pressure
#    P of one atmosphere, relative humidity R of 50%
In [2]: h = HAPropsSI('H','T',298.15,'P',101325,'R',0.5); print h
File "<ipython-input-2-04ce9ee48974>", line 1
h = HAPropsSI('H','T',298.15,'P',101325,'R',0.5); print h
^
SyntaxError: invalid syntax

#Temperature of saturated air at the previous enthalpy
In [3]: T = HAPropsSI('T','P',101325,'H',h,'R',1.0); print T
File "<ipython-input-3-7575078e82ea>", line 1
T = HAPropsSI('T','P',101325,'H',h,'R',1.0); print T
^
SyntaxError: invalid syntax

#Temperature of saturated air - order of inputs doesn't matter
In [4]: T = HAPropsSI('T','H',h,'R',1.0,'P',101325); print T
File "<ipython-input-4-fa2d6d9f898e>", line 1
T = HAPropsSI('T','H',h,'R',1.0,'P',101325); print T
^
SyntaxError: invalid syntax


## Table of Inputs/Outputs to HAPropsSI¶

Input/Output parameters
Parameter Units Input/Output Description
B, Twb, T_wb, WetBulb K Input/Output Wet-Bulb Temperature
C, cp J/kg dry air/K Output Mixture specific heat per unit dry air
Cha, cp_ha J/kg humid air/K Output Mixture specific heat per unit humid air
D, Tdp, DewPoint, T_dp K Input/Output Dew-Point Temperature
H, Hda, Enthalpy J/kg dry air Input/Output Mixture enthalpy per dry air
Hha J/kg humid air Input/Output Mixture enthalpy per humid air
K, k, Conductivity W/m/K Output Mixture thermal conductivity
M, Visc, mu Pa-s Output Mixture viscosity
psi_w, Y mol water/mol humid air Input/Output Water mole fraction
P Pa Input Pressure
P_w Pa Input Partial pressure of water vapor
R, RH, RelHum   Input/Output Relative humidity in [0, 1]
S, Sda, Entropy J/kg dry air/K Input/Output Mixture entropy per unit dry air
Sha J/kg humid air/K Input/Output Mixture entropy per unit humid air
T, Tdb, T_db K Input/Output Dry-Bulb Temperature
V, Vda m $$^3$$ /kg dry air Input/Output Mixture volume per unit dry air
Vha m $$^3$$ /kg humid air Input/Output Mixture volume per unit humid air
W, Omega, HumRat kg water/kg dry air Input/Output Humidity Ratio
Z   Output Compressibility factor ($$Z = pv/(RT)$$)

## Humid Air Validation¶

Values here are obtained at documentation build-time using the Humid Air Properties module

In [5]: execfile('fluid_properties/Validation/HAValidation.py')
File "fluid_properties/Validation/HAValidation.py", line 4
print ' Replicating the tables from ASHRAE RP-1485'
^
SyntaxError: invalid syntax
`