-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathair_dens.m
29 lines (24 loc) · 966 Bytes
/
air_dens.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function rhoa=air_dens(Ta,RH,Pa)
% AIR_DENS: computes computes the density of moist air.
% rhoa=AIR_DENS(Ta,RH,Pa) computes the density of moist air.
% Air pressure is optional.
%
% INPUT: Ta - air temperature Ta [C]
% RH - relative humidity [%]
% Pa - air pressure (optional) [mb]
%
% OUTPUT: rhoa - air density [kg/m^3]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4/7/99: version 1.2 (contributed by AA)
% 8/5/99: version 2.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load constants
as_consts;
if nargin == 2
Pa = P_default;
end
o61 = 1/eps_air-1; % 0.61 (moisture correction for temp.)
Q = (0.01.*RH).*qsat(Ta,Pa); % specific humidity of air [kg/kg]
T = Ta+CtoK; % convert to K
Tv = T.*(1 + o61*Q); % air virtual temperature
rhoa = (100*Pa)./(gas_const_R*Tv); % air density [kg/m^3]