-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsal_humidity.m
More file actions
31 lines (29 loc) · 948 Bytes
/
sal_humidity.m
File metadata and controls
31 lines (29 loc) · 948 Bytes
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
30
31
function [x_h2o] = sal_humidity(p,T,RH)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% sal_humidity - calculate h2o mole fraction from temp. and humidity %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sal_humidity - version 0.90 - Jacob E. McKenzie - mofified: 05/05/14
%
% inputs:
% - p [mbar] : absolute pressure
% - T [C] : ambient temperature
% - RH [%] : relative humidity
%
% output:
% - x_h2o [1] : mole fraction of h2o in air
%
% notes:
% no error checking.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% constants
a = 6.1121; %millibar
b = 18.678;
c = 257.14; % deg C
d = 234.5; % deg C
g = log(RH/100*exp((b-T/d)*(T/(c+T))));
P = a*exp(g);
x_h2o = P/p;
end