/[MITgcm]/MITgcm_contrib/verification_other/offline_cheapaml/code/cheapaml_coare3_flux.F
ViewVC logotype

Annotation of /MITgcm_contrib/verification_other/offline_cheapaml/code/cheapaml_coare3_flux.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Wed May 22 19:39:51 2013 UTC (13 years, 3 months ago) by jmc
Branch: MAIN
unfinished set-up to test pkg/cheapaml with thsice

1 jmc 1.1 C $Header: /u/gcmpack/MITgcm/pkg/cheapaml/cheapaml_coare3_flux.F,v 1.13 2013/02/18 22:15:40 jmc Exp $
2     C $Name: $
3    
4     #include "CHEAPAML_OPTIONS.h"
5    
6     C-- File cheapaml_coare3_flux.F:
7     C-- Contents:
8     C-- o CHEAPAML_COARE3_FLUX
9     C-- o PSIU (Function)
10     C-- o PSIT (Function)
11    
12     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
13    
14     CBOP
15     C !ROUTINE: CHEAPAML_COARE3_FLUX
16     C !INTERFACE:
17     SUBROUTINE CHEAPAML_COARE3_FLUX(
18     I i,j,bi,bj, iceOrNot,
19     I tSurf, uRelWind, vRelWind,
20     O hf, ef, evap, Rnl, ssqt, q100, cdq,
21     O dSensdTs, dEvapdTs, dLWdTs, dQAdTs,
22     I myIter, myThid )
23    
24     C !DESCRIPTION:
25    
26     C !USES:
27     IMPLICIT NONE
28     C === Global variables ===
29     #include "SIZE.h"
30     #include "EEPARAMS.h"
31     #include "PARAMS.h"
32     #include "CHEAPAML.h"
33    
34     C !INPUT PARAMETERS:
35     C i, j :: local indices of current grid-point
36     C bi, bj :: current tile indices
37     C iceOrNot :: 0=open water, 1=ice cover, 2=ice+snow
38     C tSurf :: surface temperature
39     C uRelWind :: relative wind (vs surface motion), 1rst component
40     C vRelWind :: relative wind (vs surface motion), 2nd component
41     C myIter :: Current iteration number in simulation
42     C myThid :: My Thread Id number
43     INTEGER i,j,bi,bj
44     INTEGER iceOrNot
45     _RL tSurf (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
46     _RL uRelWind(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
47     _RL vRelWind(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
48     INTEGER myIter, myThid
49     C !OUTPUT PARAMETERS:
50     _RL hf, ef, evap, Rnl, ssqt, q100, cdq
51     C derivative vs surf. temp of Sensible, Evap, LW, Qair(ssqt,q100,cdq)
52     _RL dSensdTs, dEvapdTs, dLWdTs, dQAdTs(3)
53     CEOP
54    
55     C !LOCAL VARIABLES:
56     INTEGER iter,nits
57     _RL tau,L,psu,pst,Bf
58     _RL CD,usr,tsr,qsr,ttas,essqt
59     _RL zo,zot,zoq,RR,zL,pt,ttt,tta,ttt2
60     _RL es,twoPI,cwave,lwave
61    
62     C various constants
63     _RL u,q,zi,qs,tsw
64     _RL psiu,psit,zot10,Ct10,CC,Ribu
65     _RL Du,Wg,Dt,Dq,u10,zo10,Cd10,Ch10
66     _RL xBeta,visa,Ribcu,QaR
67     _RL Ct,zetu,L10,Tas,ta,charn
68     c _RL qs1w, qs2w ! above freezing saturated specific humidity
69     c _RL qs1i, qs2i ! below freezing saturated specific humidity
70    
71     C Constants and coefficients (Stull 1988 p640).
72     xBeta = 1.2 _d 0 !Given as 1.25 in Fairall et al.(1996)
73     twoPI = 2. _d 0*PI
74     visa = 1.326 _d -5
75     C default relative humidity
76     QaR = 0.8 _d 0
77    
78     c DATA qs1w, qs2w
79     c & / 640.38 _d 3 , 5107.0 _d -0 /
80     c DATA qs1i, qs2i
81     c & / 11637.80 _d 3 , 5897.8 _d -0 /
82    
83     C sea surface temperature without skin correction
84     c tsw=theta(i,j,1,bi,bj)
85     tsw = tSurf(i,j)
86     Tas = Tair(i,j,bi,bj)
87    
88     c IF ( iceornot.EQ.0 ) THEN
89     c dEvapdTs = qs2w
90     c ELSE
91     c dEvapdTs = qs2i
92     c ENDIF
93    
94     C net upward long wave
95     Rnl = 0.96 _d 0*(stefan*(tsw+celsius2K)**4) !Net longwave (up = +).
96    
97     C Teten''s return s air svp es in mb
98     es = (1.0007 _d 0 + 3.46 _d -6*p0)*6.1121 _d 0
99     & *EXP( 17.502 _d 0*tsw/(240.97 _d 0+tsw) )
100     es = es*0.98 _d 0 !reduced for salinity Kraus 1972 p. 46
101     C convert from mb to spec. humidity kg/kg
102     qs = 0.62197 _d 0*es/(p0 -0.378 _d 0*es)
103     tta = Tas+celsius2K
104     ttas=tta+gamma_blk*zt
105     ttt=tta-(cheaphgrid(i,j,bi,bj) - zt)*gamma_blk
106     ttt2=tta-(cheaphgrid(i,j,bi,bj) - zt)*gamma_blk-celsius2K
107     pt = p0*(1.-gamma_blk*cheaphgrid(i,j,bi,bj)/ttas)
108     & **(gravity/gamma_blk/gasR)
109     essqt = (1.0007 _d 0 + 3.46 _d -6*pt)*6.1121 _d 0
110     & *EXP( 17.502 _d 0*ttt2/(240.97 _d 0+ttt2) )
111     C convert from mb to spec. humidity kg/kg
112     ssqt = 0.62197 _d 0*essqt/(pt -0.378 _d 0*essqt)
113     C LANL formulation
114     C saturation no more at the top:
115     ssqt=ssq0*EXP( lath*(ssq1-ssq2/tta) ) / p0
116    
117     IF (useFreshWaterFlux) THEN
118     q=qair(i,j,bi,bj)
119     ELSE
120     q=QaR*ssqt
121     ENDIF
122    
123     C Wave parameters
124     cwave=gravity*wavesp(i,j,bi,bj)/twoPI
125     lwave=cwave*wavesp(i,j,bi,bj)
126    
127     C Initial guesses
128     zo = 0.0001 _d 0
129     Wg = 0.5 _d 0 !Gustiness factor initial guess
130    
131     C Air-sea differences - includes warm layer in Dt and Dq
132     c u = (uwind(i,j,bi,bj)-uVel(i,j,1,bi,bj))**2
133     c & + (vwind(i,j,bi,bj)-vVel(i,j,1,bi,bj))**2
134     u = uRelWind(i,j)*uRelWind(i,j)
135     & + vRelWind(i,j)*vRelWind(i,j)
136     Du= SQRT(u + Wg**2 ) !include gustiness in wind spd. difference
137     u = SQRT(u)
138     Dt=tsw-Tas-gamma_blk*zt !potential temperature difference.
139     Dq=qs-q
140    
141     C **************** neutral coefficients ******************
142    
143     u10 = Du*LOG(10. _d 0/zo)/LOG(zu/zo)
144     usr = 0.035 _d 0*u10
145     zo10= 0.011 _d 0*usr*usr/gravity+0.11 _d 0*visa/usr
146     Cd10= (xkar/LOG(10. _d 0/zo10))**2
147     Ch10= 0.00115 _d 0
148     Ct10= Ch10/SQRT(Cd10)
149     zot10=10. _d 0/EXP(xkar/Ct10)
150     Cd = (xkar/LOG(zu/zo10))**2
151    
152     C standard coare3 boundary layer height
153     zi=600. _d 0
154    
155     C ************* Grachev and Fairall (JAM, 1997) **********
156    
157     ta=Tas+celsius2K
158     Ct=xkar/LOG(zt/zot10) ! Temperature transfer coefficient
159     CC=xkar*Ct/Cd ! z/L vs Rib linear coefficient
160     Ribcu=-zu/(zi*0.004 _d 0*xBeta**3) ! Saturation or plateau Rib
161     Ribu=-gravity*zu*(Dt+0.61 _d 0*ta*Dq)/(ta*Du**2)
162     IF (Ribu.LT.0. _d 0) THEN
163     zetu=CC*Ribu/(1. _d 0+Ribu/Ribcu) ! Unstable G and F
164     ELSE
165     zetu=CC*Ribu*(1. _d 0 +27. _d 0/9. _d 0*Ribu/CC) ! Stable
166     ENDIF
167     L10=zu/zetu ! MO length
168     IF (zetu.GT.50. _d 0) THEN
169     nits=1
170     ELSE
171     nits=3 ! number of iterations
172     ENDIF
173    
174     C First guess M-O stability dependent
175     C scaling params.(u*,t*,q*) to estimate zo and z/L
176    
177     usr= Du*xkar/(LOG(zu/zo10)-psiu(zu/L10))
178     tsr=-(Dt)*xkar/(LOG(zt/zot10)-psit(zt/L10))
179     qsr=-(Dq)*xkar/(LOG(zq/zot10)-psit(zq/L10))
180    
181     charn=0.011 _d 0 !then modify Charnock for high wind speeds Chris data
182     IF (Du.GT.10. _d 0) charn=0.011 _d 0
183     & + (0.018 _d 0-0.011 _d 0)*(Du-10.)/(18.-10.)
184     IF (Du.GT.18. _d 0) charn=0.018 _d 0
185    
186     C **** Iterate across u*(t*,q*),zo(zot,zoq) and z/L including cool skin ****
187    
188     DO iter=1,nits
189     IF (WAVEMODEL.EQ.'Smith') THEN
190     zo=charn*usr*usr/gravity + 0.11 _d 0*visa/usr !after Smith 1988
191     ELSEIF (WAVEMODEL.EQ.'Oost') THEN
192     zo=(50./twoPI)*lwave*(usr/cwave)**4.5 _d 0
193     & + 0.11 _d 0*visa/usr !Oost et al.
194     ELSEIF (WAVEMODEL.EQ.'TayYel') THEN
195     zo=1200. _d 0*wavesh(i,j,bi,bj)*(wavesh(i,j,bi,bj)/lwave)**4.5
196     & + 0.11 _d 0*visa/usr !Taylor and Yelland
197     ENDIF
198     rr=zo*usr/visa
199    
200     C *** zoq and zot fitted to results from several ETL cruises ************
201    
202     IF ( rr.LE.0. ) THEN
203     WRITE(errorMessageUnit,'(A,I8,I4,A,5I4)')
204     & 'CHEAPAML_COARE3_FLUX: myIter,iter=', myIter, iter,
205     & ' , in: i,j,bi,bj,thid=', i, j, bi, bj, myThid
206     WRITE(errorMessageUnit,'(A,1P4E17.9)')
207     & ' rr,zo,usr,visa=', rr, zo, usr, visa
208     WRITE(errorMessageUnit,'(A,1P4E17.9)')
209     & ' L,zu,zL,zt =', L, zu, zL, zt
210     WRITE(errorMessageUnit,'(A,1P4E16.8)')
211     & ' ln(zu/zo),psu,diff,zL*=', LOG(zu/zo), psu, LOG(zu/zo)-psu,
212     & ( tsr*(1.+0.61 _d 0*q)+0.61 _d 0*ta*qsr )
213     & /( ta*usr*usr*(1. _d 0+0.61 _d 0*q) )
214     WRITE(errorMessageUnit,'(A,1P4E17.9)')
215     & ' tsr,ta,q,qsr =', tsr, ta, q, qsr
216     CALL MDS_FLUSH( errorMessageUnit, myThid )
217     CALL MDS_FLUSH( standardMessageUnit, myThid )
218     ENDIF
219     zoq = MIN( 1.15 _d -4, 5.5 _d -5/rr**0.6 _d 0 )
220     zot = zoq
221    
222     zL=xkar*gravity*zu*( tsr*(1.+0.61 _d 0*q)+0.61 _d 0*ta*qsr )
223     & /( ta*usr*usr*(1. _d 0+0.61 _d 0*q) )
224     L=zu/zL
225     psu=psiu(zu/L)
226     pst=psit(zt/L)
227     usr=Du*xkar/(LOG(zu/zo)-psiu(zu/L))
228     tsr=-(Dt)*xkar/(LOG(zt/zot)-psit(zt/L))
229     qsr=-(Dq)*xkar/(LOG(zq/zoq)-psit(zq/L))
230     Bf=-gravity/ta*usr*(tsr+0.61 _d 0*ta*qsr)
231     IF (Bf.GT.0. _d 0) THEN
232     Wg=xBeta*(Bf*zi)**.333 _d 0
233     ELSE
234     Wg=0.2 _d 0
235     ENDIF
236     Du=SQRT(u**2 + Wg**2) !include gustiness in wind spd.
237     ENDDO
238    
239     C compute surface fluxes and other parameters
240     c tau=rhoa*usr*usr*u/Du !stress N/m2
241     tau=rhoa*usr*usr !stress N/m2
242     hf=-cpair*rhoa*usr*tsr !sensible W/m2
243     ef=-lath*rhoa*usr*qsr !latent W/m2
244     evap=-rhoa*usr*qsr
245     cdq = evap/Dq
246     IF (.NOT.useStressOption) THEN
247     c ustress(i,j,bi,bj)=tau*(uwind(i,j,bi,bj)-uVel(i,j,1,bi,bj))/u
248     c vstress(i,j,bi,bj)=tau*(vwind(i,j,bi,bj)-vVel(i,j,1,bi,bj))/u
249     ustress(i,j,bi,bj)=tau*uRelWind(i,j)/Du
250     vstress(i,j,bi,bj)=tau*vRelWind(i,j)/Du
251     ENDIF
252     q100=qs+qsr*(LOG(100. _d 0/zoq)-psit(100. _d 0/L))
253    
254     c dSensdTs = -cpair*rhoa*usr*(tsr/Dt)
255     dSensdTs = -cpair*rhoa*usr*(
256     & -xkar/(LOG(zt/zot10)-psit(zt/L10)) )
257     c dEvapdTs = rhoa*usr*ssqt*dEvapdTs*(qsr/Dq)/(tsr*tsr)
258     C-------------
259     c dEvapdTs =-rhoa*usr* d/dTs(qsr)
260     c dEvapdTs =-rhoa*usr*(-xkar/(LOG(zq/zoq)-psit(zq/L)) )* d/dTs(qs)
261     c es = (1.0007 _d 0 + 3.46 _d -6*p0)*6.1121 _d 0
262     c & *EXP( 17.502 _d 0*tsw/(240.97 _d 0+tsw) )
263     c es = es*0.98 _d 0 !reduced for salinity Kraus 1972 p. 46
264     C convert from mb to spec. humidity kg/kg
265     c qs = 0.62197 _d 0*es/(p0 -0.378 _d 0*es)
266     c dEvapdTs = rhoa*usr*( xkar/(LOG(zq/zoq)-psit(zq/L)) )
267     c & * 0.62197 _d 0*p0/(p0 -0.378 _d 0*es)**2
268     c & *0.98 _d 0
269     c & * es * 17.502 _d 0 * 240.97 _d 0 / (240.97 _d 0+tsw)**2
270     dEvapdTs = rhoa*usr*( xkar/(LOG(zq/zoq)-psit(zq/L)) )
271     & * qs*p0/(p0 -0.378 _d 0*es)
272     c & *0.98 _d 0
273     & * 17.502 _d 0 * 240.97 _d 0 / (240.97 _d 0+tsw)**2
274    
275     if (iceornot.EQ.0) THEN
276     c dLWdTs = 4. _d 0*ocean_emissivity*stefan*tsr*tsr*tsr
277     dLWdTs = 4. _d 0 * 0.96 _d 0 *stefan*tsr*tsr*tsr
278     ELSEIF (iceornot.EQ.2) THEN
279     c dLWdTs = 4. _d 0*snow_emissivity*stefan*tsr*tsr*tsr
280     dLWdTs = 4. _d 0 * 0.96 _d 0 *stefan*tsr*tsr*tsr
281     ELSEIF (iceornot.EQ.1) THEN
282     c dLWdTs = 4. _d 0*ice_emissivity*stefan*tsr*tsr*tsr
283     dLWdTs = 4. _d 0 * 0.96 _d 0 *stefan*tsr*tsr*tsr
284     ENDIF
285    
286     dQAdTs(1)= 0.
287     dQAdTs(2)= 0.
288     dQAdTs(3)= 0.
289    
290     RETURN
291     END
292    
293     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
294    
295     CBOP 0
296     C !ROUTINE: PSIU
297    
298     C !INTERFACE:
299     _RL FUNCTION psiu(zL)
300    
301     C !DESCRIPTION:
302     C psiu and psit evaluate stability function for wind speed and scalars
303     C matching Kansas and free convection forms with weighting f
304     C convective form follows Fairall et al (1996) with profile constants
305     C from Grachev et al (2000) BLM
306     C stable form from Beljaars and Holtslag (1991)
307    
308     C !USES:
309     IMPLICIT NONE
310     #include "EEPARAMS.h"
311    
312     C !INPUT PARAMETERS:
313     _RL zL
314     C !LOCAL VARIABLES:
315     _RL x,y,psik,psic,f,c
316     CEOP
317    
318     IF (zL.LT.0.0) THEN
319     x = (1. - 15.*zL)**.25 !Kansas unstable
320     psik=2.*LOG((1.+x)/2.)+LOG((1.+x*x)/2.)-2.*ATAN(x)+2.*ATAN(oneRL)
321     y = (1. - 10.15 _d 0*zL)**.3333 _d 0 !Convective
322     psic = 1.5*LOG((1.+y+y*y)/3.)
323     & - SQRT(3. _d 0)*ATAN( (1.+2.*y)/SQRT(3. _d 0) )
324     & + 4.*ATAN(oneRL)/SQRT(3. _d 0)
325     f = zL*zL/(1.+zL*zL)
326     psiu = (1.-f)*psik+f*psic
327     ELSE
328     c = MIN( 50. _d 0, 0.35 _d 0*zL ) !Stable
329     c psiu=-((1.+1.*zL)**1.+.6667*(zL-14.28)/EXP(c)+8.525)
330     psiu = -( (1.+zL) + 0.6667 _d 0*(zL-14.28 _d 0)/EXP(c)
331     & + 8.525 _d 0 )
332     ENDIF
333     RETURN
334     END
335    
336     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
337    
338     CBOP 0
339     C !ROUTINE: PSIT
340    
341     C !INTERFACE:
342     _RL FUNCTION psit(zL)
343    
344     C !DESCRIPTION:
345    
346     C !USES:
347     IMPLICIT NONE
348     #include "EEPARAMS.h"
349    
350     C !INPUT PARAMETERS:
351     _RL zL
352     C !LOCAL VARIABLES:
353     _RL x,y,psik,psic,f,c
354     CEOP
355    
356     IF (zL.LT.0.0) THEN
357     x = (1. - 15.*zL)**.5 !Kansas unstable
358     psik = 2.*LOG((1.+x)/2.)
359     y = (1. - 34.15 _d 0*zL)**.3333 _d 0 !Convective
360     psic = 1.5*LOG((1.+y+y*y)/3.)
361     & - SQRT(3. _d 0)*ATAN( (1.+2.*y)/SQRT(3. _d 0) )
362     & + 4.*ATAN(oneRL)/SQRT(3. _d 0)
363     f = zL*zL/(1.+zL*zL)
364     psit = (1.-f)*psik+f*psic
365     ELSE
366     c = MIN( 50. _d 0, 0.35 _d 0*zL ) !Stable
367     psit = -( (1.+2.*zL/3.)**1.5
368     & + 0.6667 _d 0*(zL-14.28 _d 0)/EXP(c)
369     & + 8.525 _d 0 )
370     ENDIF
371    
372     RETURN
373     END

  ViewVC Help
Powered by ViewVC 1.1.22