Files

53 lines
1.8 KiB
Matlab

function p = Napp_p_ice(T_current)
%Napp_p_ice marks the vapor pressure at a given temperature in a plot of the vapor pressure of ice between 200-270 K
% It also displays the vapor pressure at a temperature of choice in the command
% window.
%
% * Napp_p_ice(T_current)
% * p = Napp_p_ice([253.15, 263.15, 273.15])
%
% *input*
% T_current in K: temperature of ice; (format: scalar, or row/column vector)
%
% *output*
% vapour pressure of ice in mbar (same shape as T_current)
%% input validation
if ~isvector(T_current)
error('Napp_p_ice:InvalidInput','T_current must be a scalar or a vector (row or column).');
end
%% Water vapour pressure above the ice and in pure liquid water.
T = 200:0.2:273; % K, temperature range
% Marti, J., and K. Mauersberger, Geophys. Res.Lett., 20, 363?366, 1993.
% gives parameterization from 169 - 273K in Pa. (log10(p)= A1/T+B)
A_1 = -2663.5;
B_1 = 12.537;
p_i = 10.^(A_1./T + B_1).*1E-5.*1E3; % mbar
p = 10.^(A_1./T_current + B_1).*1E-5.*1E3; % mbar
% plot
figure( 'Name', 'vapour pressure over ice')
axes1 = axes('Parent',gcf,'XDir','reverse','FontSize',16);
box on
hold on
% relative humidity above ice
plot(p_i,T,'LineWidth',2)
xlim([0 6.5]);
ylim([220 275]);
xticks(0:0.5:6.5)
grid on
grid minor
title('vapour pressure over ice');
xlabel('p [mbar]');
ylabel('temperature [K]');
%% write to command line
for i = 1:length(T_current)
plot(10.^(A_1./T_current(i) + B_1).*1E-5.*1E3,T_current(i),'x','MarkerSize',25,'LineWidth',3);
text(10.^(A_1./T_current(i) + B_1).*1E-5.*1E3, T_current(i),[' <- ' num2str(T_current(i))],'FontSize',12);
fprintf('The vapour pressure of ice at %.1f K (%.1f dC) is %.2f mbar \n',T_current(i),T_current(i)-273.15,10.^(A_1./T_current(i) + B_1).*1E-5.*1E3)
end
end