42 lines
1.4 KiB
Matlab
42 lines
1.4 KiB
Matlab
function Napp_p_RH(T_current,RH)
|
|
%Napp_p_RH helper function that calculates the partial pressure of water for a given temperature and relative humidity.
|
|
% With the relative humidity referenced
|
|
% to liquid water (RH_w) as opposed to ice (RH_i), the activity of water
|
|
% is: activity_w = RH_{water}/100
|
|
%
|
|
% * Napp_p_RH(T_current,RH)
|
|
% * Napp_p_RH([253.15, 263.15, 273.15],[60, 80, 90])
|
|
% * Napp_p_RH(273.15-20,80)
|
|
%
|
|
%
|
|
% *input*
|
|
% T_current in K: temperature; (format: scalar, or row/column vector)
|
|
% RH in %: relative humidity (RH_{water}); same shape/length as T_current
|
|
%
|
|
% *output*
|
|
% partial pressure of water in mbar
|
|
|
|
%% input validation
|
|
if ~isvector(T_current) || ~isvector(RH)
|
|
error('Napp_p_RH:InvalidInput','T_current and RH must be scalars or vectors (row or column).');
|
|
end
|
|
if numel(T_current) ~= numel(RH)
|
|
error('Napp_p_RH:InvalidInput','T_current and RH must have the same number of elements.');
|
|
end
|
|
|
|
%%
|
|
%
|
|
% *water*:
|
|
% NIST webbook: Bridgeman and Aldrich, 1964 give parametrisation from 273
|
|
% to 303 K in bar. log10(p) = A - B/ (T+C).
|
|
A = 5.40221;
|
|
B = 1838.675;
|
|
C = -31.737;
|
|
|
|
p_w = 10.^(A - B./(T_current+C)) .* 1E3; % mbar
|
|
|
|
|
|
for i = 1:length(T_current)
|
|
fprintf('The partial pressure of water with a RH of %.0f percent at %.1f K (%.1f dC) is %.2f mbar .\n',RH(i),T_current(i),T_current(i)-273.15,p_w(i).*RH(i)./100)
|
|
end
|
|
end |