function vg = gasexcvel(T,Uav,G)

% Function to compute gas exchange velocity in m/s, using the
% formulation of Wanninkhof, 1992: JGR 97,C5,p7373-7382, eqn 1.
% The function schmidt.m is used to compute the schmidt number.
% 
% USAGE: vg [m/d] = gasexcvel(T,Uav,G) gives the gas exchange velocity
% in m/d at temperature T [deg C] and avg. wind velocity Uav [m/s] for 
% gas G. G is a STRING specifying the gas. Valid gases are:
% 	1	He
% 	2	Ne
% 	3	Ar
% 	4	O2
% 	5	CH4
% 	6	CO2
% 	7	N2
% 	8	Kr
% 	9	N2O
% 	10	Rn
% 	11	SF6
% 	12	F12
% 	13	F11
% If G is omitted, it is assumed to be 'He'.

% Samar Khatiwala (spk@ldeo.columbia.edu)

% SPK 10/10/05: modified to accept string (instead of integer) 
%               to specify gas

if nargin<3
  G='He';
end

% switch lower(G)
%   case 'he'
%     G=1;
%   case 'ne'
%     G=2;
%   case 'ar'
%     G=3;
%   case 'o2'
%     G=4;
%   case 'ch4'
%     G=5;
%   case 'co2'
%     G=6;
%   case 'n2'
%     G=7
%   case 'kr'
%     G=8;
%   case 'n2o'
%     G=9;
%   case 'rn'
%     G=10;
%   case 'sf6'
%     G=11;
%   case 'f12'
%     G=12;
%   case 'f11'
%     G=13;
%   otherwise
%     error(['Unknown gas ' G])
% end

% get schmidt number
if nargin<3, % default is helium
	Sc = 410.14 - 20.503*T + 0.53175*(T.^2) - 0.0060111*(T.^3);
else
	Sc = schmidt(T,G);
end
fac=24/100; % to convert from cm/hr to m/d
vg=fac*0.39*(Uav.^2)./sqrt(Sc/660);

