


QSAT: computes specific humidity at saturation.
q=QSAT(Ta) computes the specific humidity (kg/kg) at satuation at
air temperature Ta (deg C). Dependence on air pressure, Pa, is small,
but is included as an optional input.
INPUT: Ta - air temperature [C]
Pa - (optional) pressure [mb]
OUTPUT: q - saturation specific humidity [kg/kg]

0001 function q=qsat(Ta,Pa) 0002 % QSAT: computes specific humidity at saturation. 0003 % q=QSAT(Ta) computes the specific humidity (kg/kg) at satuation at 0004 % air temperature Ta (deg C). Dependence on air pressure, Pa, is small, 0005 % but is included as an optional input. 0006 % 0007 % INPUT: Ta - air temperature [C] 0008 % Pa - (optional) pressure [mb] 0009 % 0010 % OUTPUT: q - saturation specific humidity [kg/kg] 0011 0012 % Version 1.0 used Tetens' formula for saturation vapor pressure 0013 % from Buck (1981), J. App. Meteor., 1527-1532. This version 0014 % follows the saturation specific humidity computation in the COARE 0015 % Fortran code v2.5b. This results in an increase of ~5% in 0016 % latent heat flux compared to the calculation with version 1.0. 0017 0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0019 % 3/8/97: version 1.0 0020 % 4/7/99: version 1.2 (revised as above by AA) 0021 % 8/5/99: version 2.0 0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0023 0024 if nargin==1, 0025 as_consts; 0026 Pa=P_default; % pressure in mb 0027 end; 0028 0029 % original code 0030 % a=(1.004.*6.112*0.6220)./Pa; 0031 % q=a.*exp((17.502.*Ta)./(240.97+Ta)) 0032 0033 % as in Fortran code v2.5b for COARE 0034 ew = 6.1121*(1.0007+3.46e-6*Pa).*exp((17.502*Ta)./(240.97+Ta)); % in mb 0035 q = 0.62197*(ew./(Pa-0.378*ew)); % mb -> kg/kg