-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdntc.m
104 lines (42 loc) · 1.38 KB
/
cdntc.m
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [cd,u10]=cdntc(sp,z,Ta)
% CTDTC: computes the neutral drag coefficient following Smith (1988).
% [cd,u10]=CDNTC(sp,z,Ta) computes the neutral drag coefficient and
% wind speed at 10m given the wind speed and air temperature at height z
% following Smith (1988), J. Geophys. Res., 93, 311-326.
%
% INPUT: sp - wind speed [m/s]
% z - measurement height [m]
% Ta - air temperature (optional) [C]
%
% OUTPUT: cd - neutral drag coefficient at 10m
% u10 - wind speed at 10m [m/s]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3/8/97: version 1.0
% 8/26/98: version 1.1 (vectorized by RP)
% 8/5/99: version 2.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% get constants
as_consts;
if nargin==2,
Ta=Ta_default;
end;
% iteration endpoint
tol=.00001;
visc=viscair(Ta);
% remove any sp==0 to prevent division by zero
i=find(sp==0);
sp(i)=.1.*ones(length(i),1);
% initial guess
ustaro=zeros(size(sp));
ustarn=.036.*sp;
% iterate to find z0 and ustar
ii=abs(ustarn-ustaro)>tol;
while any(ii(:)),
ustaro=ustarn;
z0=Charnock_alpha.*ustaro.^2./g + R_roughness*visc./ustaro;
ustarn=sp.*(kappa./log(z./z0));
ii=abs(ustarn-ustaro)>tol;
end
sqrcd=kappa./log((10)./z0);
cd=sqrcd.^2;
u10=ustarn./sqrcd;