source: trunk/src/cor30a.pro @ 70

Last change on this file since 70 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

  • Property svn:executable set to *
File size: 9.3 KB
Line 
1;+
2;
3; ==========
4; cor30a.pro
5; ==========
6;
7; .. function:: cor30a(u,us,ts,t,Qs,Q,Rs,Rl,rain,zi,P,zu,zt,zq,lat,jcool,jwave,twave,hwave)
8;
9;
10; COARE v3 algorithm to compute fluxes
11;
12; version with shortened iteration  modified Rt and Rq
13;
14; uses wave information wave period in s and wave ht in m
15; no wave, standard coare 2.6 charnock:  jwave=0
16;
17; Oost et al.  zo=50/2/pi L (u*/c)^4.5 if jwave=1
18;
19; taylor and yelland  zo=1200 h*(L/h)^4.5 jwave=2
20;
21;     :param u: wind speed (m/s)  at height zu (m)
22;     :param us: surface current speed in the wind direction (m/s)
23;     :param ts: bulk water temperature (C) if jcool=1, interface water T if jcool=0
24;     :param t: bulk air temperature (C), height zt
25;     :param Qs: bulk water spec hum (g/kg) if jcool=1, ...
26;     :param Q: bulk air spec hum (g/kg), height zq
27;     :param Rs: downward solar flux (W/m^2)    (modified because of cool skin)
28;     :param Rl: downard IR flux (W/m^2)        (modified because of cool skin)
29;     :param rain: rain rate (mm/hr)
30;     :param zi: PBL depth (m)
31;     :param P: Atmos surface pressure (mb)
32;     :param zu: wind speed measurement height (m)
33;     :param zt: air T measurement height (m)
34;     :param zq: air q measurement height (m)
35;     :param lat: latitude (deg, N=+)
36;     :param jcool: implement cool calculation skin switch, 0=no, 1=yes
37;     :param jwave: implement wave dependent roughness model
38;     :param twave: wave period (s)
39;     :param hwave: wave height (m)
40;
41; EXAMPLES
42; ========
43;
44; ::
45;
46;                  u  us  ts  ta   qs   qa   Qsw IRd   r  pbl  Ps   zu   zt  zq lat
47;
48;    IDL> x=cor30a(5.5,0,28.7,27.2,24.2,18.5,141.,419.,0.,600.,1010.,15.,15.,15.,0.,1,1,5.,1.)
49;
50; Result with these sample values with Matlab code::
51;
52;      8.64830      101.640    0.0352910  2.17780e-05  0.000115000  0.000115000
53;     -29.5800     0.175430   -0.0423670 -0.000205610     0.250950  0.000351300
54;  0.000969740      0.00000  8.11390e-05  0.000997340   0.00121410   0.00121400
55;  0.000941350   0.00107910   0.00107910     0.780060
56;
57; Result obtained with this idl routine::
58;
59;      8.64829      101.640    0.0352913  2.17780e-05  0.000115000  0.000115000
60;     -29.5802     0.175432   -0.0423667 -0.000205610     0.250948  0.000351304
61;  0.000969737      0.00000  8.11394e-05  0.000997343   0.00121407   0.00121400
62;  0.000941351   0.00107908   0.00107908     0.780056
63;
64; Maximum error on any parameter: .002 %    validated!
65;
66; SEE ALSO
67; ========
68;
69; :ref:`TropFlux_19890101_20091231.pro`
70;
71; TODO
72; ====
73;
74; hard coded directory - usage of ${PROJECT_ID}
75;
76; coding rules
77;
78; EVOLUTIONS
79; ==========
80;
81; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
82;
83;   * minimal header
84;
85; - pbk 2008
86;
87;   * creation
88;
89;-
90function cor30a, u,us,ts,t,Qs,Q,Rs,Rl,rain,zi,P,zu,zt,zq,lat,jcool,jwave,twave,hwave
91
92Qs=Qs/1000.
93Q=Q/1000.
94
95;***********   set constants *************
96pi=!pi
97Beta=1.2
98von=0.4
99fdg=1.00
100tdk=273.16
101;grav=grv(lat)
102grav=9.8
103;*************  air constants ************
104Rgas=287.1
105LLe=(2.501-.00237*ts)*1e6
106cpa=1004.67
107cpv=cpa*(1+0.84*Q)
108rhoa=P*100/(Rgas*(t+tdk)*(1+0.61*Q))
109visa=1.326e-5*(1+6.542e-3*t+8.301e-6*t*t-4.84e-9*t*t*t)
110;************  cool skin constants  *******
111Al=2.1e-5*(ts+3.2)^0.79
112be=0.026
113cpw=4000
114rhow=1022
115visw=1e-6
116tcw=0.6
117bigc=16*grav*cpw*(rhow*visw)^3/(tcw*tcw*rhoa*rhoa)
118wetc=0.622*LLe*Qs/(Rgas*(ts+tdk)^2)
119
120;***************   wave parameters  *********
121lwave=grav/2/pi*twave^2
122cwave=grav/2/pi*twave
123
124;**************  compute aux stuff *******
125Rns=Rs*.945
126Rnl=0.97*(5.67e-8*(ts-0.3*jcool+tdk)^4-Rl)
127
128
129
130;***************   Begin bulk loop *******
131
132;***************  first guess ************
133du=u-us
134dt=ts-t-.0098*zt
135dq=Qs-Q
136ta=t+tdk
137ug=0.5
138dter=0.3
139dqer=wetc*dter
140ut=sqrt(du*du+ug*ug)
141u10=ut*alog(10./1e-4)/alog(zu/1e-4)
142usr=.035*u10
143zo10=0.011*usr*usr/grav+0.11*visa/usr
144Cd10=(von/alog(10./zo10))^2
145Ch10=0.00115
146Ct10=Ch10/sqrt(Cd10)
147zot10=10/exp(von/Ct10)
148Cd=(von/alog(zu/zo10))^2
149Ct=von/alog(zt/zot10)
150CC=von*Ct/Cd
151Ribcu=-zu/zi/.004/Beta^3
152Ribu=-grav*zu/ta*((dt-dter*jcool)+.61*ta*dq)/ut^2
153nits=3
154;;if (Ribu le 0.) then begin
155;;  zetu=CC*Ribu/(1+Ribu/Ribcu)
156;;endif else begin
157;;  zetu=CC*Ribu*(1+27./9*Ribu/CC)
158;;endelse
159sw=(Ribu le 0.)
160zetu=sw*(CC*Ribu/(1+Ribu/Ribcu))+(1-sw)*(CC*Ribu*(1+27./9*Ribu/CC))
161;;
162L10=zu/zetu
163;;if (zetu gt 50 ) then nits=1
164usr=ut*von/(alog(zu/zo10)-psiu(zu/L10))
165tsr=-(dt-dter*jcool)*von*fdg/(alog(zt/zot10)-psit(zt/L10))
166qsr=-(dq-wetc*dter*jcool)*von*fdg/(alog(zq/zot10)-psit(zq/L10))
167
168tkt=.001
169
170;;charn=0.011
171;;if (ut gt 10.) then charn=0.011+(ut-10)/(18.-10)*(0.018-0.011)
172;;if (ut gt 18.) then charn=0.018
173charn=(((0.011+(ut-10)/(18.-10)*(0.018-0.011)) > .011) < .018)
174;;
175
176;***************  bulk loop ************
177for i=1,nits do begin
178  zet=von*grav*zu/ta*(tsr*(1+0.61*Q)+.61*ta*qsr)/(usr*usr)/(1+0.61*Q)
179  case jwave of
180    0: zo=charn*usr*usr/grav+0.11*visa/usr
181    1: zo=50./2/pi*lwave*(usr/cwave)^4.5+0.11*visa/usr ;Oost et al
182    2: zo=1200*hwave*(hwave/lwave)^4.5+0.11*visa/usr  ;Taylor and Yelland
183  endcase
184  rr=zo*usr/visa
185  L=zu/zet
186;;zoq=min([1.15e-4,5.5e-5/rr^.6])
187  zoq=(5.5e-5/rr^.6 < 1.15e-4)
188;;
189  zot=zoq
190  usr=ut*von/(alog(zu/zo)-psiu(zu/L))
191  tsr=-(dt-dter*jcool)*von*fdg/(alog(zt/zot)-psit(zt/L))
192  qsr=-(dq-wetc*dter*jcool)*von*fdg/(alog(zq/zoq)-psit(zq/L))
193  Bf=-grav/ta*usr*(tsr+.61*ta*qsr)
194;;if (Bf gt 0) then begin
195;;  ug=Beta*(Bf*zi)^.333
196;;endif else begin
197;;  ug=.2
198;;endelse
199  sw=(Bf gt 0)
200  ug=sw*(Beta*(Bf*zi)^.333)+(1-sw)*.2
201;;
202  ut=sqrt(du*du+ug*ug)
203  Rnl=0.97*(5.67e-8*(ts-dter*jcool+tdk)^4-Rl)
204  hsb=-rhoa*cpa*usr*tsr
205  hlb=-rhoa*LLe*usr*qsr
206  qout=Rnl+hsb+hlb
207  dels=Rns*(.065+11*tkt-6.6e-5/tkt*(1-exp(-tkt/8.0e-4)))        ; Eq.16 Shortwave
208  qcol=qout-dels
209  alq=Al*qcol+be*hlb*cpw/LLe                                    ; Eq. 7 Buoy flux water
210
211;;  if (alq gt 0) then begin
212;;    xlamx=6./(1+(bigc*alq/usr^4)^.75)^.333                    ; Eq 13 Saunders
213;;    tkt=xlamx*visw/(sqrt(rhoa/rhow)*usr)                      ;Eq.11 Sub. thk
214;;  endif else begin
215;;    xlamx=6.0
216;;;;  tkt=min([.01,xlamx*visw/(sqrt(rhoa/rhow)*usr)])           ;Eq.11 Sub. thk
217;;    tkt=(xlamx*visw/(sqrt(rhoa/rhow)*usr) < .01)
218;;;;
219;;  endelse
220  sw=(alq gt 0)
221  xlamx=sw*(6./(1+(bigc*alq/usr^4)^.75)^.333)+(1-sw)*6.0
222  tkt=sw*(xlamx*visw/(sqrt(rhoa/rhow)*usr))+(1-sw)*(xlamx*visw/(sqrt(rhoa/rhow)*usr) < .01)
223;;
224
225  dter=qcol*tkt/tcw ;  Eq.12 Cool skin
226  dqer=wetc*dter
227
228endfor      ;bulk iter loop
229
230tau=rhoa*usr*usr*du/ut                 ;stress
231hsb=-rhoa*cpa*usr*tsr                  ;sens
232hlb=-rhoa*LLe*usr*qsr                  ;lat
233                                       ; net solar Rns
234                                       ; net lw    Rnl
235
236;****************   rain heat flux ********
237dwat=2.11e-5*((t+tdk)/tdk)^1.94                         ;! water vapour diffusivity
238dtmp=(1.+3.309e-3*t-1.44e-6*t*t)*0.02411/(rhoa*cpa)     ;!heat diffusivity
239alfac= 1/(1+(wetc*LLe*dwat)/(cpa*dtmp))                 ;! wet bulb factor
240RF= rain*alfac*cpw*((ts-t-dter*jcool)+(Qs-Q-dqer*jcool)*LLe/cpa)/3600.
241
242
243;y=[[Rns],[-1.*Rnl],[-1.*hlb],[-1.*hsb],[-1.*RF],[tau]]
244
245;;****************   Webb et al. correection  ************
246;wbar=1.61*hlb/LLe/(1+1.61*Q)/rhoa+hsb/rhoa/cpa/ta      ;formulation in hlb already includes webb
247;hl_webb=rhoa*wbar*Q*LLe
248;;**************   compute transfer coeffs relative to ut @meas. ht **********
249;;Cd=tau/rhoa/ut/max([.1,du])
250;Cd=tau/rhoa/ut/(du > .1)
251;;;
252Ch=-usr*tsr/ut/(dt-dter*jcool)
253Ce=-usr*qsr/(dq-dqer*jcool)/ut
254;;************  10-m neutral coeff realtive to ut ********
255;Cdn_10=von*von/alog(10./zo)/alog(10./zo)
256;Chn_10=von*von*fdg/alog(10./zo)/alog(10./zot)
257;Cen_10=von*von*fdg/alog(10./zo)/alog(10./zoq)
258
259y=[[Rns],[-1.*Rnl],[-1.*hlb],[-1.*hsb],[-1.*RF],[tau],[Ch],[Ce]]
260;;y=[hsb,hlb,tau,zo,zot,zoq,L,usr,tsr,qsr,dter,dqer,tkt,RF,wbar,Cd,Ch,Ce,Cdn_10,Chn_10,Cen_10,ug ]
261;   1   2   3   4  5   6  7  8   9  10   11   12  13  14  15  16 17 18    19      20    21  22
262;       hsb=                    sensible heat flux (w/m^2)
263;       hlb=                    latent heat flux (w/m^2)
264;       RF=                     rain heat flux(w/m^2)
265;       wbar=                   webb mean w (m/s)
266;       tau=                    stress (nt/m^2)
267;       zo=                     velocity roughness length (m)
268;       zot                     temperature roughness length (m)
269;       zoq=                    moisture roughness length (m)
270;       L=                      Monin_Obukhov stability length
271;       usr=                    turbulent friction velocity (m/s), including gustiness
272;       tsr                     temperature scaling parameter (K)
273;       qsr                     humidity scaling parameter (g/g)
274;       dter=                   cool skin temperature depression (K)
275;       dqer=                   cool skin humidity depression (g/g)
276;       tkt=                    cool skin thickness (m)
277;       Cd=                     velocity drag coefficient at zu, referenced to u
278;       Ch=                     heat transfer coefficient at zt
279;       Ce=                     moisture transfer coefficient at zq
280;       Cdn_10=                 10-m velocity drag coeeficient, including gustiness
281;       Chn_10=                 10-m heat transfer coeeficient, including gustiness
282;       Cen_10=                 10-m humidity transfer coeeficient, including gustiness
283
284return, y
285
286end
Note: See TracBrowser for help on using the repository browser.