/[MITgcm]/MITgcm/pkg/fizhi/fizhi_gwdrag.F
ViewVC logotype

Annotation of /MITgcm/pkg/fizhi/fizhi_gwdrag.F

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


Revision 1.1 - (hide annotations) (download)
Fri May 20 23:50:52 2005 UTC (19 years, 1 month ago) by molod
Branch: MAIN
Again more prep work for gravity wave drag parameterization - add code and
modify calling routine -- still not active

1 molod 1.1 C $Header: $
2     C $Name: $
3     #include "FIZHI_OPTIONS.h"
4     subroutine gwdrag (myid,pz,pl,ple,dpres,pkz,uz,vz,tz,qz,phis_var,
5     . dudt,dvdt,dtdt,im,jm,lm,bi,bj,istrip,npcs,imglobal)
6     C***********************************************************************
7     C
8     C PURPOSE:
9     C ========
10     C Driver Routine for Gravity Wave Drag
11     C
12     C INPUT:
13     C ======
14     C myid ....... Process ID
15     C pz ....... Surface Pressure [im,jm]
16     C pl ....... 3D pressure field [im,jm,lm]
17     C ple ....... 3d pressure at model level edges [im,jm,lm+1]
18     C dpres ....... pressure difference across level [im,jm,lm]
19     C pkz ....... pressure**kappa [im,jm,lm]
20     C uz ....... zonal velocity [im,jm,lm]
21     C vz ....... meridional velocity [im,jm,lm]
22     C tz ....... temperature [im,jm,lm]
23     C qz ....... specific humidity [im,jm,lm]
24     C phis_var .... topography variance
25     C im ....... number of grid points in x direction
26     C jm ....... number of grid points in y direction
27     C lm ....... number of grid points in vertical
28     C istrip ...... 'strip' length for cache size control
29     C npcs ....... number of strips
30     C imglobal .... (avg) number of longitude points around the globe
31     C
32     C INPUT/OUTPUT:
33     C ============
34     C dudt ....... Updated U-Wind Tendency including Gravity Wave Drag
35     C dvdt ....... Updated V-Wind Tendency including Gravity Wave Drag
36     C dtdt ....... Updated Pi*Theta Tendency including Gravity Wave Drag
37     C
38     C***********************************************************************
39     implicit none
40    
41     #ifdef ALLOW_DIAGNOSTICS
42     #include "SIZE.h"
43     #include "DIAGNOSTICS_SIZE.h"
44     #include "DIAGNOSTICS.h"
45     #endif
46    
47     c Input Variables
48     c ---------------
49     integer myid,im,jm,lm,bi,bj,istrip,npcs,imglobal
50     real pz(im,jm)
51     real pl(im,jm,lm)
52     real ple(im,jm,lm+1)
53     real dpres(im,jm,lm)
54     real pkz(im,jm,lm)
55     real uz(im,jm,lm)
56     real vz(im,jm,lm)
57     real tz(im,jm,lm)
58     real qz(im,jm,lm)
59     real phis_var(im,jm)
60    
61     real dudt(im,jm,lm)
62     real dvdt(im,jm,lm)
63     real dtdt(im,jm,lm)
64    
65     c Local Variables
66     c ---------------
67     real tv(im,jm,lm)
68     real dragu(im,jm,lm), dragv(im,jm,lm)
69     real dragt(im,jm,lm)
70     real dragx(im,jm), dragy(im,jm)
71     real sumu(im,jm)
72     integer nthin(im,jm),nbase(im,jm)
73     integer nthini, nbasei
74    
75     real phis_std(im,jm)
76    
77     real std(istrip), ps(istrip)
78     real us(istrip,lm), vs(istrip,lm), ts(istrip,lm)
79     real dragus(istrip,lm), dragvs(istrip,lm)
80     real dragxs(istrip), dragys(istrip)
81     real plstr(istrip,lm),plestr(istrip,lm),dpresstr(istrip,lm)
82     integer nthinstr(istrip),nbasestr(istrip)
83    
84     integer n,i,j,L
85     real getcon, pi
86     real grav, rgas, cp, cpinv, lstar
87    
88     c Initialization
89     c --------------
90     pi = 4.0*atan(1.0)
91     grav = getcon('GRAVITY')
92     rgas = getcon('RGAS')
93     cp = getcon('CP')
94     cpinv = 1.0/cp
95     lstar = 2*getcon('EARTH RADIUS')*cos(pi/3.0)/imglobal
96    
97     c Compute NTHIN and NBASE
98     c -----------------------
99     do j=1,jm
100     do i=1,im
101    
102     do nthini = 1,lm+1
103     if( 1000.0-ple(i,j,lm+2-nthini).gt.25. ) then
104     nthin(i,j) = nthini
105     goto 10
106     endif
107     enddo
108     10 continue
109     do nbasei = 1,lm+1
110     if( ple(i,j,lm+2-nbasei).lt.666.7 ) then
111     nbase(i,j) = nbasei
112     goto 20
113     endif
114     enddo
115     20 continue
116     if( 666.7-ple(i,j,lm+2-nbase(i,j)) .gt.
117     . ple(i,j,lm+3-nbase(i,j))-666.7 ) then
118     nbase(i,j) = nbase(i,j)-1
119     endif
120    
121     enddo
122     enddo
123     c Compute Topography Sub-Grid Standard Deviation
124     c ----------------------------------------------
125     do j=1,jm
126     do i=1,im
127     phis_std(i,j) = min( 400.0, sqrt( max(0.0,phis_var(i,j)) )/grav )
128     enddo
129     enddo
130    
131     c Compute Virtual Temperatures
132     c ----------------------------
133     do L = 1,lm
134     do j = 1,jm
135     do i = 1,im
136     tv(i,j,L) = tz(i,j,L)*pkz(i,j,L)*(1.+.609*qz(i,j,L))
137     enddo
138     enddo
139     enddo
140    
141     c Call Gravity Wave Drag Paramterization on A-Grid
142     c ------------------------------------------------
143    
144     do n=1,npcs
145    
146     call strip ( phis_std,std,im*jm,istrip,1,n )
147    
148     call strip ( pz,ps,im*jm,istrip,1 ,n )
149     call strip ( uz,us,im*jm,istrip,lm,n )
150     call strip ( vz,vs,im*jm,istrip,lm,n )
151     call strip ( tv,ts,im*jm,istrip,lm,n )
152     call strip ( pl,plstr,im*jm,istrip,lm,n )
153     call strip ( ple,plestr,im*jm,istrip,lm,n )
154     call strip ( dpres,dpresstr,im*jm,istrip,lm,n )
155     call stripint ( nthin,nthinstr,im*jm,istrip,lm,n )
156     call stripint ( nbase,nbasestr,im*jm,istrip,lm,n )
157    
158     call GWDD ( ps,us,vs,ts,
159     . dragus,dragvs,dragxs,dragys,std,
160     . plstr,plestr,dpresstr,grav,rgas,cp,
161     . istrip,lm,nthinstr,nbasestr,lstar )
162    
163     call paste ( dragus,dragu,istrip,im*jm,lm,n )
164     call paste ( dragvs,dragv,istrip,im*jm,lm,n )
165     call paste ( dragxs,dragx,istrip,im*jm,1 ,n )
166     call paste ( dragys,dragy,istrip,im*jm,1 ,n )
167    
168     enddo
169    
170     c Add Gravity-Wave Drag to Wind and Theta Tendencies
171     c --------------------------------------------------
172     do L = 1,lm
173     do j = 1,jm
174     do i = 1,im
175     dragu(i,j,L) = sign( min(0.006,abs(dragu(i,j,L))),dragu(i,j,L) )
176     dragv(i,j,L) = sign( min(0.006,abs(dragv(i,j,L))),dragv(i,j,L) )
177     dragt(i,j,L) = -( uz(i,j,L)*dragu(i,j,L)+vz(i,j,L)*dragv(i,j,L) )
178     . *cpinv
179     dudt(i,j,L) = dudt(i,j,L) + dragu(i,j,L)
180     dvdt(i,j,L) = dvdt(i,j,L) + dragv(i,j,L)
181     dtdt(i,j,L) = dtdt(i,j,L) + dragt(i,j,L)*pz(i,j)/pkz(i,j,L)
182     enddo
183     enddo
184     enddo
185    
186     c Compute Diagnostics
187     c -------------------
188     if( igwdu.ne.0 .or. igwdv.ne.0 .or. igwdt.ne.0 ) then
189     do L = 1,lm
190     if( igwdu.ne.0 ) then
191     do j = 1,jm
192     do i = 1,im
193     qdiag(i,j,igwdu+L-1,bi,bj) = qdiag(i,j,igwdu+L-1,bi,bj) +
194     . dragu(i,j,L)*86400
195     enddo
196     enddo
197     endif
198     if( igwdv.ne.0 ) then
199     do j = 1,jm
200     do i = 1,im
201     qdiag(i,j,igwdv+L-1,bi,bj) = qdiag(i,j,igwdv+L-1,bi,bj) +
202     . dragv(i,j,L)*86400
203     enddo
204     enddo
205     endif
206     if( igwdt.ne.0 ) then
207     do j = 1,jm
208     do i = 1,im
209     qdiag(i,j,igwdt+L-1,bi,bj) = qdiag(i,j,igwdt+L-1,bi,bj) +
210     . dragt(i,j,L)*86400
211     enddo
212     enddo
213     endif
214     enddo
215     endif
216    
217     c Gravity Wave Drag at Surface (U-Wind)
218     c -------------------------------------
219     if( igwdus.ne.0 ) then
220     do j = 1,jm
221     do i = 1,im
222     qdiag(i,j,igwdus,bi,bj) = qdiag(i,j,igwdus,bi,bj) + dragx(i,j)
223     enddo
224     enddo
225     endif
226    
227     c Gravity Wave Drag at Surface (V-Wind)
228     c -------------------------------------
229     if( igwdvs.ne.0 ) then
230     do j = 1,jm
231     do i = 1,im
232     qdiag(i,j,igwdvs,bi,bj) = qdiag(i,j,igwdvs,bi,bj) + dragy(i,j)
233     enddo
234     enddo
235     endif
236    
237     c Gravity Wave Drag at Model Top (U-Wind)
238     c ---------------------------------------
239     if( igwdut.ne.0 ) then
240     do j = 1,jm
241     do i = 1,im
242     sumu(i,j) = 0.0
243     enddo
244     enddo
245     do L = 1,lm
246     do j = 1,jm
247     do i = 1,im
248     sumu(i,j) = sumu(i,j) + dragu(i,j,L)*dpres(i,j,L)/pz(i,j)
249     enddo
250     enddo
251     enddo
252     do j = 1,jm
253     do i = 1,im
254     qdiag(i,j,igwdut,bi,bj) = qdiag(i,j,igwdut,bi,bj) + dragx(i,j)
255     . + sumu(i,j)*pz(i,j)/grav*100
256     enddo
257     enddo
258     endif
259    
260     c Gravity Wave Drag at Model Top (V-Wind)
261     c ---------------------------------------
262     if( igwdvt.ne.0 ) then
263     do j = 1,jm
264     do i = 1,im
265     sumu(i,j) = 0.0
266     enddo
267     enddo
268     do L = 1,lm
269     do j = 1,jm
270     do i = 1,im
271     sumu(i,j) = sumu(i,j) + dragv(i,j,L)*dpres(i,j,L)/pz(i,j)
272     enddo
273     enddo
274     enddo
275     do j = 1,jm
276     do i = 1,im
277     qdiag(i,j,igwdvt,bi,bj) = qdiag(i,j,igwdvt,bi,bj) + dragy(i,j)
278     . + sumu(i,j)*pz(i,j)/grav*100
279     enddo
280     enddo
281     endif
282    
283     ngwdu = ngwdu + 1
284     ngwdv = ngwdv + 1
285     ngwdt = ngwdt + 1
286     ngwdus = ngwdus + 1
287     ngwdvs = ngwdvs + 1
288     ngwdut = ngwdut + 1
289     ngwdvt = ngwdvt + 1
290    
291     return
292     end
293     SUBROUTINE GWDD ( ps,u,v,t,dudt,dvdt,xdrag,ydrag,
294     . std,pl,ple,dpres,
295     . grav,rgas,cp,irun,lm,nthin,nbase,lstar )
296     C***********************************************************************
297     C
298     C Description:
299     C ============
300     C Parameterization to introduce a Gravity Wave Drag
301     C due to sub-grid scale orographic forcing
302     C
303     C Input:
304     C ======
305     C ps ......... Surface Pressure
306     C u .......... Zonal Wind (m/sec)
307     C v .......... Meridional Wind (m/sec)
308     C t .......... Virtual Temperature (deg K)
309     C std ........ Standard Deviation of sub-grid Orography (m)
310     C ple ....... Model pressure Edge Values
311     C pl ........ Model pressure Values
312     C dpres....... Model Delta pressure Values
313     C grav ....... Gravitational constant (m/sec**2)
314     C rgas ....... Gas constant
315     C cp ......... Specific Heat at constant pressure
316     C irun ....... Number of grid-points in horizontal dimension
317     C lm ......... Number of grid-points in vertical dimension
318     C lstar ...... Monochromatic Wavelength/(2*pi)
319     C
320     C Output:
321     C =======
322     C dudt ....... Zonal Acceleration due to GW Drag (m/sec**2)
323     C dvdt ....... Meridional Acceleration due to GW Drag (m/sec**2)
324     C xdrag ...... Zonal Surface and Base Layer Stress (Pa)
325     C ydrag ...... Meridional Surface and Base Layer Stress (Pa)
326     C
327     C***********************************************************************
328    
329     implicit none
330    
331     c Input Variables
332     c ---------------
333     integer irun,lm
334     real ps(irun)
335     real u(irun,lm), v(irun,lm), t(irun,lm)
336     real dudt(irun,lm), dvdt(irun,lm)
337     real xdrag(irun), ydrag(irun)
338     real std(irun)
339     real ple(irun,lm+1), pl(irun,lm), dpres(irun,lm)
340     real grav, rgas, cp
341     integer nthin(irun),nbase(irun)
342     real lstar
343    
344     c Dynamic Allocation Variables
345     c ----------------------------
346     real ubar(irun), vbar(irun), robar(irun)
347     real speed(irun), ang(irun)
348     real bv(irun,lm)
349     real nbar(irun)
350    
351     real tstd(irun)
352     real XTENS(irun,lm+1), YTENS(irun,lm+1)
353     real TENSIO(irun,lm+1)
354     real DRAGSF(irun)
355     real RO(irun,lm), DZ(irun,lm)
356    
357     integer icrilv(irun)
358    
359     c Local Variables
360     c ---------------
361     integer i,l
362     real a,g,stdmax,agrav,akwnmb
363     real gocp,roave,roiave,frsf,gstar,vai1,vai2
364     real vaisd,velco,deluu,delvv,delve2,delz,vsqua
365     real richsn,crifro,crif2,fro2,coef
366    
367     c Initialization
368     c --------------
369     a = 1.0
370     g = 1.0
371     agrav = 1.0/GRAV
372     akwnmb = 1.0/lstar
373     gocp = GRAV/CP
374    
375     c Constrain the Maximum Value of the Standard Deviation
376     c -----------------------------------------------------
377     stdmax = 400.
378     do i = 1,irun
379     tstd(i) = std(i)
380     if( std(i).gt.stdmax ) tstd(i) = stdmax
381     enddo
382    
383     c Compute Atmospheric Density
384     c ---------------------------
385     do l = 1,lm
386     do i = 1,irun
387     ro(i,l) = pl(i,l)/(rgas*t(i,lm+1-l))
388     enddo
389     enddo
390    
391     c Compute Layer Thicknesses
392     c -------------------------
393     do l = 2,lm
394     do i = 1,irun
395     roiave = ( 1./ro(i,l-1) + 1./ro(i,l) )*0.5
396     dz(i,l) = agrav*roiave*( pl(i,l-1)-pl(i,l) )
397     enddo
398     enddo
399    
400    
401     c******************************************************
402     c Surface and Base Layer Stress *
403     c******************************************************
404    
405     c Definition of Surface Wind Vector
406     c ---------------------------------
407     do i = 1,irun
408     robar(i) = 0.0
409     ubar(i) = 0.0
410     vbar(i) = 0.0
411     enddo
412    
413     do i = 1,irun
414     do L = 1,nbase(i)-1
415     robar(i) = robar(i) + ro(i,L) *(ple(i,L)-ple(i,L+1))
416     ubar(i) = ubar(i) + u(i,lm+1-L)*(ple(i,L)-ple(i,L+1))
417     vbar(i) = vbar(i) + v(i,lm+1-L)*(ple(i,L)-ple(i,L+1))
418     enddo
419     enddo
420    
421     do i = 1,irun
422     robar(i) = robar(i)/(ple(i,1)-ple(i,nbase(i))) * 100.0
423     ubar(i) = ubar(i)/(ple(i,1)-ple(i,nbase(i)))
424     vbar(i) = vbar(i)/(ple(i,1)-ple(i,nbase(i)))
425    
426     speed(i) = SQRT( ubar(i)*ubar(i) + vbar(i)*vbar(i) )
427     ang(i) = ATAN2(vbar(i),ubar(i))
428    
429     enddo
430    
431     c Brunt Vaisala Frequency
432     c -----------------------
433     do i = 1,irun
434     do l = 2,nbase(i)
435     VAI1 = (T(i,lm+1-l)-T(i,lm+2-l))/DZ(i,l)+GOCP
436     if( VAI1.LT.0.0 ) then
437     VAI1 = 0.0
438     endif
439     VAI2 = 2.0*GRAV/( T(i,lm+1-l)+T(i,lm+2-l) )
440     VSQUA = VAI1*VAI2
441     BV(i,l) = SQRT(VSQUA)
442     enddo
443     enddo
444    
445     c Stress at the Surface Level
446     c ---------------------------
447     do i = 1,irun
448     nbar(i) = 0.0
449     enddo
450     do i = 1,irun
451     do l = 2,nbase(i)
452     NBAR(i) = NBAR(i) + BV(i,l)*(pl(i,l-1)-pl(i,l))
453     enddo
454     enddo
455    
456     do i = 1,irun
457     NBAR(i) = NBAR(i)/(pl(i,1)-pl(i,nbase(i)))
458     FRSF = NBAR(i)*tstd(i)/speed(i)
459    
460     if( speed(i).eq.0.0 .or. nbar(i).eq.0.0 ) then
461     TENSIO(i,1) = 0.0
462     else
463     GSTAR = G*FRSF*FRSF/(FRSF*FRSF+A*A)
464     TENSIO(i,1) = GSTAR*(ROBAR(i)*speed(i)*speed(i)*speed(i))
465     . / (NBAR(i)*LSTAR)
466     endif
467    
468     XTENS(i,1) = TENSIO(i,1) * cos(ang(i))
469     YTENS(i,1) = TENSIO(i,1) * sin(ang(i))
470     DRAGSF(i) = TENSIO(i,1)
471     XDRAG(i) = XTENS(i,1)
472     YDRAG(i) = YTENS(i,1)
473     enddo
474    
475     c Check for Very thin lowest layer
476     c --------------------------------
477     do i = 1,irun
478     if( NTHIN(i).gt.1 ) then
479     do l = 1,nthin(i)
480     TENSIO(i,l) = TENSIO(i,1)
481     XTENS(i,l) = XTENS(i,1)
482     YTENS(i,l) = YTENS(i,1)
483     enddo
484     endif
485     enddo
486    
487     c******************************************************
488     c Compute Gravity Wave Stress from NTHIN+1 to NBASE *
489     c******************************************************
490    
491     do i = 1,irun
492     do l = nthin(i)+1,nbase(i)
493    
494     velco = 0.5*( (u(i,lm+1-l)*ubar(i) + v(i,lm+1-l)*vbar(i))
495     . + (u(i,lm+2-l)*ubar(i) + v(i,lm+2-l)*vbar(i)) )
496     . / speed(i)
497    
498     C Convert to Newton/m**2
499     roave = 0.5*(ro(i,l-1)+ro(i,l)) * 100.0
500    
501     if( VELCO.le.0.0 ) then
502     TENSIO(i,l) = TENSIO(i,l-1)
503     goto 1500
504     endif
505    
506     c Froude number squared
507     c ---------------------
508     FRO2 = bv(i,l)/(AKWNMB*ROAVE*VELCO*VELCO*VELCO)*TENSIO(i,l-1)
509     DELUU = u(i,lm+1-l)-u(i,lm+2-l)
510     DELVV = v(i,lm+1-l)-v(i,lm+2-l)
511     DELVE2 = ( DELUU*DELUU + DELVV*DELVV )
512    
513     c Compute Richarson Number
514     c ------------------------
515     if( DELVE2.ne.0.0 ) then
516     DELZ = DZ(i,l)
517     VSQUA = BV(i,l)*BV(i,l)
518     RICHSN = DELZ*DELZ*VSQUA/DELVE2
519     else
520     RICHSN = 99999.0
521     endif
522    
523     if( RICHSN.le.0.25 ) then
524     TENSIO(i,l) = TENSIO(i,l-1)
525     goto 1500
526     endif
527    
528     c Stress in the Base Layer changes if the local Froude number
529     c exceeds the Critical Froude number
530     c ----------------------------------
531     CRIFRO = 1.0 - 0.25/RICHSN
532     CRIF2 = CRIFRO*CRIFRO
533     if( l.eq.2 ) CRIF2 = MIN(0.7,CRIF2)
534    
535     if( FRO2.gt.CRIF2 ) then
536     TENSIO(i,l) = CRIF2/FRO2*TENSIO(i,l-1)
537     else
538     TENSIO(i,l) = TENSIO(i,l-1)
539     endif
540    
541     1500 CONTINUE
542     XTENS(i,l) = TENSIO(i,l)*COS(ang(i))
543     YTENS(i,l) = TENSIO(i,l)*SIN(ang(i))
544    
545     enddo
546     enddo
547    
548     c******************************************************
549     c Compute Gravity Wave Stress from Base+1 to Top *
550     c******************************************************
551    
552     do i = 1,irun
553     icrilv(i) = 0
554     enddo
555    
556     do i = 1,irun
557     do l = nbase(i)+1,lm+1
558    
559     TENSIO(i,l) = 0.0
560    
561     c Check for Critical Level Absorption
562     c -----------------------------------
563     if( icrilv(i).eq.1 ) goto 130
564    
565     c Let Remaining Stress escape out the top edge of model
566     c -----------------------------------------------------
567     if( l.eq.lm+1 ) then
568     TENSIO(i,l) = TENSIO(i,l-1)
569     goto 130
570     endif
571    
572     ROAVE = 0.5*(ro(i,l-1)+ro(i,l)) * 100.0
573     VAI1 = (T(i,lm+1-l)-T(i,lm+2-l))/DZ(i,l)+GOCP
574    
575     if( VAI1.lt.0.0 ) then
576     icrilv(i) = 1
577     TENSIO(i,l) = 0.0
578     goto 130
579     endif
580    
581     VAI2 = 2.0*GRAV/(T(i,lm+1-l)+T(i,lm+2-l))
582     VSQUA = VAI1*VAI2
583     VAISD = SQRT(VSQUA)
584    
585     velco = 0.5*( (u(i,lm+1-l)*ubar(i) + v(i,lm+1-l)*vbar(i))
586     . + (u(i,lm+2-l)*ubar(i) + v(i,lm+2-l)*vbar(i)) )
587     . / speed(i)
588    
589     if( velco.lt.0.0 ) then
590     icrilv(i) = 1
591     TENSIO(i,l) = 0.0
592     goto 130
593     endif
594    
595     c Froude number squared
596     c ---------------------
597     FRO2 = vaisd/(AKWNMB*ROAVE*VELCO*VELCO*VELCO)*TENSIO(i,l-1)
598     DELUU = u(i,lm+1-l)-u(i,lm+2-l)
599     DELVV = v(i,lm+1-l)-v(i,lm+2-l)
600     DELVE2 = ( DELUU*DELUU + DELVV*DELVV )
601    
602     c Compute Richarson Number
603     c ------------------------
604     if( DELVE2.ne.0.0 ) then
605     DELZ = DZ(i,l)
606     RICHSN = DELZ*DELZ*VSQUA/DELVE2
607     else
608     RICHSN = 99999.0
609     endif
610    
611     if( RICHSN.le.0.25 ) then
612     TENSIO(i,l) = 0.0
613     icrilv(i) = 1
614     goto 130
615     endif
616    
617     c Stress in Layer changes if the local Froude number
618     c exceeds the Critical Froude number
619     c ----------------------------------
620     CRIFRO = 1.0 - 0.25/RICHSN
621     CRIF2 = CRIFRO*CRIFRO
622    
623     if( FRO2.ge.CRIF2 ) then
624     TENSIO(i,l) = CRIF2/FRO2*TENSIO(i,l-1)
625     else
626     TENSIO(i,l) = TENSIO(i,l-1)
627     endif
628    
629     130 continue
630     XTENS(i,l) = TENSIO(i,l)*COS(ang(i))
631     YTENS(i,l) = TENSIO(i,l)*SIN(ang(i))
632     enddo
633     enddo
634    
635     C ******************************************************
636     C MOMENTUM CHANGE FOR FREE ATMOSPHERE *
637     C ******************************************************
638    
639     do i = 1,irun
640     do l = nthin(i)+1,lm
641     coef = -grav*ple(i,lm+1)/dpres(i,lm+1-l)
642     dudt(i,lm+1-l) = coef*(XTENS(i,l+1)-XTENS(i,l))
643     dvdt(i,lm+1-l) = coef*(YTENS(i,l+1)-YTENS(i,l))
644     enddo
645     enddo
646    
647     c Momentum change near the surface
648     c --------------------------------
649     do i = 1,irun
650     coef = grav*ple(i,lm+1)/(ple(i,lm+1-nthin(i))-ple(i,lm+1))
651     dudt(i,lm) = coef*(XTENS(i,nthin(i)+1)-XTENS(i,1))
652     dvdt(i,lm) = coef*(YTENS(i,nthin(i)+1)-YTENS(i,1))
653     enddo
654    
655     c If Lowest layer is very thin, it is strapped to next layer
656     c ----------------------------------------------------------
657     do i = 1,irun
658     if( nthin(i).gt.1 ) then
659     do l = 2,nthin(i)
660     dudt(i,lm+1-l) = dudt(i,lm)
661     dvdt(i,lm+1-l) = dvdt(i,lm)
662     enddo
663     endif
664     enddo
665    
666     c Convert Units to (m/sec**2)
667     c ---------------------------
668     do l = 1,lm
669     do i = 1,irun
670     dudt(i,l) = - dudt(i,l)/ps(i)*0.01
671     dvdt(i,l) = - dvdt(i,l)/ps(i)*0.01
672     enddo
673     enddo
674    
675     return
676     end

  ViewVC Help
Powered by ViewVC 1.1.22