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

Diff of /MITgcm/pkg/fizhi/fizhi_moist.F

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

revision 1.6 by molod, Thu Jul 8 14:53:45 2004 UTC revision 1.17 by molod, Thu Aug 12 15:21:22 2004 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4  #include "CPP_OPTIONS.h"  #include "FIZHI_OPTIONS.h"
5        subroutine moistio (ndmoist,istrip,npcs,        subroutine moistio (ndmoist,istrip,npcs,
6       .   lowlevel,midlevel,nltop,nsubmin,nsubmax,Lup,       .   lowlevel,midlevel,nltop,nsubmin,nsubmax,Lup,
7       .   pz,plz,plze,dpres,pkht,pkl,tz,qz,bi,bj,ntracer,ptracer,       .   pz,plz,plze,dpres,pkht,pkl,tz,qz,bi,bj,ntracer,ptracer,
# Line 12  C $Name$ Line 12  C $Name$
12       .   nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz,       .   nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz,
13       .   lpnt,myid)       .   lpnt,myid)
14    
15           implicit none
16    
17  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
18    #include "SIZE.h"
19    #include "diagnostics_SIZE.h"
20  #include "diagnostics.h"  #include "diagnostics.h"
21  #endif  #endif
22    
23  c Input Variables  c Input Variables
24  c ---------------  c ---------------
25          integer im,jm,lm
26        integer ndmoist,istrip,npcs        integer ndmoist,istrip,npcs
       integer lowlevel,midlevel,nltop,nsubmin,nsubmax,Lup  
       real pz(im,jm),plz(im,jm,lm),plze(im,jm,lm+1),dpres(im,jm,lm)  
       real pkht(im,jm,lm+1),pkl(im,jm,lm)  
       real tz(im,jm,lm),qz(im,jm,lm,ntracer)        
27        integer bi,bj,ntracer,ptracer                integer bi,bj,ntracer,ptracer        
28        real qqz(im,jm,lm)        integer lowlevel,midlevel,nltop,nsubmin,nsubmax,Lup
29        real dumoist(im,jm,lm),dvmoist(im,jm,lm)        _RL pz(im,jm),plz(im,jm,lm),plze(im,jm,lm+1),dpres(im,jm,lm)
30        real dtmoist(im,jm,lm),dqmoist(im,jm,lm,ntracer)        _RL pkht(im,jm,lm+1),pkl(im,jm,lm)
31        integer im,jm,lm        _RL tz(im,jm,lm),qz(im,jm,lm,ntracer)      
32        real ptop        _RL qqz(im,jm,lm)
33          _RL dumoist(im,jm,lm),dvmoist(im,jm,lm)
34          _RL dtmoist(im,jm,lm),dqmoist(im,jm,lm,ntracer)
35          _RL ptop
36        integer iras        integer iras
37        real rainlsp(im,jm),rainconv(im,jm),snowfall(im,jm)        _RL rainlsp(im,jm),rainconv(im,jm),snowfall(im,jm)
38        integer nswcld,nswlz        integer nswcld,nswlz
39        real cldlsp_sw(im,jm,lm),cldras_sw(im,jm,lm)        _RL cldlsp_sw(im,jm,lm),cldras_sw(im,jm,lm)
40        real cldtot_sw(im,jm,lm),swlz(im,jm,lm)        _RL cldtot_sw(im,jm,lm),swlz(im,jm,lm)
41        integer nlwcld,nlwlz        integer nlwcld,nlwlz
42        real  cldlsp_lw(im,jm,lm),cldras_lw(im,jm,lm)        _RL  cldlsp_lw(im,jm,lm),cldras_lw(im,jm,lm)
43        real  cldtot_lw(im,jm,lm),lwlz(im,jm,lm)        _RL  cldtot_lw(im,jm,lm),lwlz(im,jm,lm)
44        logical lpnt        logical lpnt
45        integer myid        integer myid
46    
# Line 44  c Local Variables Line 48  c Local Variables
48  c ---------------  c ---------------
49        integer    ncrnd,nsecf        integer    ncrnd,nsecf
50    
51        real       fracqq, rh,temp1,temp2,dum        _RL       fracqq, dum
52        integer    snowcrit        integer    snowcrit
53        parameter (fracqq = 0.1)        parameter (fracqq = 0.1)
54          _RL one
55          parameter (one=1.)
56    
57        real   cldsr(im,jm,lm)        _RL   cldsr(im,jm,lm)
58        real   srcld(istrip,lm)        _RL   srcld(istrip,lm)
59    
60        real plev        _RL plev
61        real cldnow,cldlsp_mem,cldras_mem,cldras,watnow,watmin,cldmin        _RL cldnow,cldlsp_mem,cldlsp,cldras_mem,cldras
62        real cldprs(im,jm),cldtmp(im,jm)        _RL watnow,watmin,cldmin
63        real cldhi (im,jm),cldlow(im,jm)        _RL cldprs(im,jm),cldtmp(im,jm)
64        real cldmid(im,jm),totcld(im,jm)        _RL cldhi (im,jm),cldlow(im,jm)
65          _RL cldmid(im,jm),totcld(im,jm)
66        real   CLDLS(im,jm,lm)  , CPEN(im,jm,lm)  
67        real    tmpimjm(im,jm)        _RL   CLDLS(im,jm,lm)  , CPEN(im,jm,lm)
68        real    lsp_new(im,jm)        _RL    tmpimjm(im,jm)
69        real   conv_new(im,jm)        _RL    lsp_new(im,jm)
70        real   snow_new(im,jm)        _RL   conv_new(im,jm)
71          _RL   snow_new(im,jm)
72    
73        real  qqcolmin(im,jm)        _RL  qqcolmin(im,jm)
74        real  qqcolmax(im,jm)        _RL  qqcolmax(im,jm)
75        integer levpbl(im,jm)        integer levpbl(im,jm)
76    
77  c Gathered Arrays for Variable Cloud Base  c Gathered Arrays for Variable Cloud Base
78  c ---------------------------------------  c ---------------------------------------
79        real    raincgath(im*jm)        _RL    raincgath(im*jm)
80        real     pigather(im*jm)        _RL     pigather(im*jm)
81        real     thgather(im*jm,lm)        _RL     thgather(im*jm,lm)
82        real     shgather(im*jm,lm)        _RL     shgather(im*jm,lm)
83        real    pkzgather(im*jm,lm)        _RL    pkzgather(im*jm,lm)
84        real    pkegather(im*jm,lm+1)        _RL    pkegather(im*jm,lm+1)
85        real    plzgather(im*jm,lm)        _RL    plzgather(im*jm,lm)
86        real    plegather(im*jm,lm+1)        _RL    plegather(im*jm,lm+1)
87        real     dpgather(im*jm,lm)        _RL     dpgather(im*jm,lm)
88        real    tmpgather(im*jm,lm)        _RL    tmpgather(im*jm,lm)
89        real   deltgather(im*jm,lm)        _RL   deltgather(im*jm,lm)
90        real   delqgather(im*jm,lm)        _RL   delqgather(im*jm,lm)
91        real      ugather(im*jm,lm,ntracer)        _RL      ugather(im*jm,lm,ntracer)
92        real   delugather(im*jm,lm,ntracer)        _RL   delugather(im*jm,lm,ntracer)
93        real     deltrnev(im*jm,lm)        _RL     deltrnev(im*jm,lm)
94        real     delqrnev(im*jm,lm)        _RL     delqrnev(im*jm,lm)
95    
96        integer  nindeces(lm)        integer  nindeces(lm)
97        integer  pblindex(im*jm)        integer  pblindex(im*jm)
# Line 92  c -------------------------------------- Line 99  c --------------------------------------
99    
100  c Stripped Arrays  c Stripped Arrays
101  c ---------------  c ---------------
102        real saveth (istrip,lm)        _RL saveth (istrip,lm)
103        real saveq  (istrip,lm)        _RL saveq  (istrip,lm)
104        real saveu  (istrip,lm,ntracer)        _RL saveu  (istrip,lm,ntracer)
105        real usubcl (istrip,   ntracer)        _RL usubcl (istrip,   ntracer)
106    
107        real     ple(istrip,lm+1), gam(istrip,lm)        _RL     ple(istrip,lm+1)
108        real      dp(istrip,lm)        _RL      dp(istrip,lm)
109        real      TL(ISTRIP,lm)  , SHL(ISTRIP,lm)        _RL      TL(ISTRIP,lm)  , SHL(ISTRIP,lm)
110        real      PL(ISTRIP,lm)  , PLK(ISTRIP,lm)        _RL      PL(ISTRIP,lm)  , PLK(ISTRIP,lm)
111        real    PLKE(ISTRIP,lm+1)        _RL    PLKE(ISTRIP,lm+1)
112        real      TH(ISTRIP,lm)  ,CVTH(ISTRIP,lm)        _RL      TH(ISTRIP,lm)  ,CVTH(ISTRIP,lm)
113        real   SHSAT(ISTRIP,lm)  , CVQ(ISTRIP,lm)        _RL   CVQ(ISTRIP,lm)
114        real      UL(ISTRIP,lm,ntracer)        _RL      UL(ISTRIP,lm,ntracer)
115        real     cvu(istrip,lm,ntracer)        _RL     cvu(istrip,lm,ntracer)
116        real  CLMAXO(ISTRIP,lm),CLBOTH(ISTRIP,lm)        _RL  CLMAXO(ISTRIP,lm),CLBOTH(ISTRIP,lm)
117        real  CLSBTH(ISTRIP,lm)        _RL  CLSBTH(ISTRIP,lm)
118        real    TMP1(ISTRIP,lm),  TMP2(ISTRIP,lm)        _RL    TMP1(ISTRIP,lm),  TMP2(ISTRIP,lm)
119        real    TMP3(ISTRIP,lm),  TMP4(ISTRIP,lm+1)        _RL    TMP3(ISTRIP,lm),  TMP4(ISTRIP,lm+1)
120        real    TMP5(ISTRIP,lm+1)        _RL    TMP5(ISTRIP,lm+1)
121        integer   ITMP1(ISTRIP,lm), ITMP2(ISTRIP,lm)        integer   ITMP1(ISTRIP,lm), ITMP2(ISTRIP,lm)
       integer   ITMP3(ISTRIP,lm)  
122    
123        real   PRECIP(ISTRIP), PCMID(ISTRIP), PCNET(ISTRIP)        _RL   PRECIP(ISTRIP), PCNET(ISTRIP)
124        real   PCLOW (ISTRIP),    SP(ISTRIP),  PREP(ISTRIP)        _RL   SP(ISTRIP),  PREP(ISTRIP)
125        real   PCPEN (ISTRIP,lm)        _RL   PCPEN (ISTRIP,lm)
126        integer pbl(istrip),depths(lm)        integer pbl(istrip),depths(lm)
127    
128        real   cldlz(istrip,lm), cldwater(im,jm,lm)        _RL   cldlz(istrip,lm), cldwater(im,jm,lm)
129        real   rhfrac(istrip), rhmin, pup, ppbl, rhcrit(istrip,lm)        _RL   rhfrac(istrip), rhmin, pup, ppbl, rhcrit(istrip,lm)
130        real   offset, alpha, rasmax        _RL   offset, alpha, rasmax
131    
132        logical first        logical first
133        logical lras        logical lras
134        real    clfrac (istrip,lm)        _RL    clfrac (istrip,lm)
135        real    cldmas (istrip,lm)        _RL    cldmas (istrip,lm)
136        real    detrain(istrip,lm)        _RL    detrain(istrip,lm)
137        real    psubcld    (istrip), psubcldg (im,jm)        _RL    psubcld    (istrip), psubcldg (im,jm)
138        real    psubcld_cnt(istrip), psubcldgc(im,jm)        _RL    psubcld_cnt(istrip), psubcldgc(im,jm)
139        real rnd(lm/2)        _RL rnd(lm/2)
140        DATA      FIRST /.TRUE./        DATA      FIRST /.TRUE./
141    
142        integer imstp,nsubcl,nlras        integer imstp,nsubcl,nlras
143        integer i,j,iloop,index,l,nn,num,numdeps,nt        integer i,j,iloop,indx,indgath,l,nn,num,numdeps,nt
144        real tmstp,tminv,sday,grav,alhl,cp,elocp,gamfac        _RL tmstp,tminv,sday,grav,alhl,cp,elocp,gamfac
145        real rkappa,p0kappa,p0kinv,ptopkap,pcheck        _RL rkappa,p0kappa,p0kinv,ptopkap,pcheck
146        real tice,getcon,pi        _RL tice,getcon,pi
147    
148  C **********************************************************************  C **********************************************************************
149  C ****                     INITIALIZATION                           ****  C ****                     INITIALIZATION                           ****
# Line 180  c Determine Total number of Random Cloud Line 186  c Determine Total number of Random Cloud
186  c ---------------------------------------------  c ---------------------------------------------
187        ncrnd = (lm-nltop+1)/2        ncrnd = (lm-nltop+1)/2
188    
189        if(first .and. myid.eq.0) then        if(first .and. myid.eq.1) then
190         print *         print *
191         print *,'Top Level Allowed for Convection : ',nltop         print *,'Top Level Allowed for Convection : ',nltop
192         print *,'          Highest Sub-Cloud Level: ',nsubmax         print *,'          Highest Sub-Cloud Level: ',nsubmax
# Line 224  c -------------------------------------- Line 230  c --------------------------------------
230    
231  c Set up the array of indeces of subcloud levels for the gathering  c Set up the array of indeces of subcloud levels for the gathering
232  c ----------------------------------------------------------------  c ----------------------------------------------------------------
233        index = 0        indx = 0
234        do L = nsubmin,nltop,-1        do L = nsubmin,nltop,-1
235         do j = 1,jm         do j = 1,jm
236         do i = 1,im         do i = 1,im
237          if(levpbl(i,j).eq.L) then          if(levpbl(i,j).eq.L) then
238           index = index + 1           indx = indx + 1
239           pblindex(index) = (j-1)*im + i           pblindex(indx) = (j-1)*im + i
240          endif          endif
241         enddo         enddo
242         enddo         enddo
243        enddo        enddo
244    
245        do index = 1,im*jm        do indx = 1,im*jm
246         levgather(index) = levpbl(pblindex(index),1)         levgather(indx) = levpbl(pblindex(indx),1)
247          pigather(index) =     pz(pblindex(index),1)          pigather(indx) =     pz(pblindex(indx),1)
248          pkegather(index,lm+1) = pkht(pblindex(index),1,lm+1)          pkegather(indx,lm+1) = pkht(pblindex(indx),1,lm+1)
249          plegather(index,lm+1) = ple(pblindex(index),1,lm+1)          plegather(indx,lm+1) = plze(pblindex(indx),1,lm+1)
250        enddo        enddo
251    
252        do L = 1,lm        do L = 1,lm
253         do index = 1,im*jm         do indx = 1,im*jm
254           thgather(index,L) = tz(pblindex(index),1,L)           thgather(indx,L) = tz(pblindex(indx),1,L)
255           shgather(index,L) = qz(pblindex(index),1,L,1)           shgather(indx,L) = qz(pblindex(indx),1,L,1)
256          pkegather(index,L) = pkht(pblindex(index),1,L)          pkegather(indx,L) = pkht(pblindex(indx),1,L)
257          pkzgather(index,L) = pkl(pblindex(index),1,L)          pkzgather(indx,L) = pkl(pblindex(indx),1,L)
258          plegather(index,L) = plze(pblindex(index),1,L)          plegather(indx,L) = plze(pblindex(indx),1,L)
259          plzgather(index,L) = plz(pblindex(index),1,L)          plzgather(indx,L) = plz(pblindex(indx),1,L)
260           dpgather(index,L) = dpres(pblindex(index),1,L)           dpgather(indx,L) = dpres(pblindex(indx),1,L)
261         enddo         enddo
262        enddo        enddo
263        do nt = 1,ntracer-ptracer        do nt = 1,ntracer-ptracer
264        do L = 1,lm        do L = 1,lm
265         do index = 1,im*jm         do indx = 1,im*jm
266          ugather(index,L,nt) = qz(pblindex(index),1,L,nt+ptracer)          ugather(indx,L,nt) = qz(pblindex(indx),1,L,nt+ptracer)
267         enddo         enddo
268        enddo        enddo
269        enddo        enddo
# Line 598  C ************************************** Line 604  C **************************************
604    
605         CALL RNEVP (NN,ISTRIP,lm,TL,SHL,PCPEN,PL,CLFRAC,SP,DP,PLKE,         CALL RNEVP (NN,ISTRIP,lm,TL,SHL,PCPEN,PL,CLFRAC,SP,DP,PLKE,
606       .  PLK,TH,TMP1,TMP2,TMP3,ITMP1,ITMP2,PCNET,PRECIP,       .  PLK,TH,TMP1,TMP2,TMP3,ITMP1,ITMP2,PCNET,PRECIP,
607       .  CLSBTH,TMSTP,1.,cp,grav,alhl,gamfac,cldlz,rhcrit,offset,alpha)       .  CLSBTH,TMSTP,one,cp,grav,alhl,gamfac,cldlz,rhcrit,offset,alpha)
608    
609  C **********************************************************************  C **********************************************************************
610  C ****                     TENDENCY UPDATES                         ****  C ****                     TENDENCY UPDATES                         ****
# Line 770  C ************************************** Line 776  C **************************************
776  C                          BUMP DIAGNOSTICS  C                          BUMP DIAGNOSTICS
777  C **********************************************************************  C **********************************************************************
778    
 c Clear-Sky (Above 400mb) Temperature  
 c -----------------------------------  
       if( itmpuclr.ne.0 .or. isphuclr.ne.0 ) then  
       do j = 1,jm  
       do i = 1,im  
       totcld(i,j) = 0.0  
       enddo  
       enddo  
       do L = 1,midlevel  
       do j = 1,jm  
       do i = 1,im  
        if(cldls(i,j,L).ne.0.0.or.cpen(i,j,L).ne.0.0)totcld(i,j) = 1.0  
       enddo  
       enddo  
       enddo  
       do L = 1,lm  
        if( itmpuclr.ne.0 ) then  
         do i = 1,im*jm  
         if( totcld(i,1).eq.0.0 ) then  
          qdiag(i,1,itmpuclr +L-1,bi,bj) =  
      .         qdiag(i,1,itmpuclr +L-1,bi,bj) + tz(i,1,L)*pkzgather(i,L)  
          qdiag(i,1,itmpuclrc+L-1,bi,bj) =  
      .                            qdiag(i,1,itmpuclrc+L-1,bi,bj)+1.0  
         endif  
         enddo  
        endif  
   
        if( isphuclr.ne.0 ) then  
         do i = 1,im*jm  
         if( totcld(i,1).eq.0.0 ) then  
          qdiag(i,1,isphuclr +L-1,bi,bj) =  
      .              qdiag(i,1,isphuclr +L-1,bi,bj) + qz(i,1,L,1)*1000.0  
          qdiag(i,1,isphuclrc+L-1,bi,bj) =  
      .                      qdiag(i,1,isphuclrc+L-1,bi,bj) + 1.0  
         endif  
         enddo  
        endif  
       enddo  
       endif  
779    
780  c Sub-Cloud Layer  c Sub-Cloud Layer
781  c -------------------------  c -------------------------
# Line 841  c Moist Processes Heating Rate Line 808  c Moist Processes Heating Rate
808  c ----------------------------  c ----------------------------
809        if(imoistt.gt.0) then        if(imoistt.gt.0) then
810        do L = 1,lm        do L = 1,lm
811        do i = 1,im*jm        do j = 1,jm
812        qdiag(i,1,imoistt+L-1,bi,bj) = qdiag(i,1,imoistt+L-1,bi,bj) +        do i = 1,im
813       .                      (dtmoist(i,1,L)*sday*pkzgather(i,L)/pz(i,1))         indgath = (j-1)*im + i
814          qdiag(i,j,imoistt+L-1,bi,bj) = qdiag(i,j,imoistt+L-1,bi,bj) +
815         .    (dtmoist(i,j,L)*sday*pkzgather(indgath,L)/pz(i,j))
816          enddo
817        enddo        enddo
818        enddo        enddo
819        endif        endif
# Line 865  c Cloud Mass Flux Line 835  c Cloud Mass Flux
835  c ---------------  c ---------------
836        if(icldmas.gt.0) then        if(icldmas.gt.0) then
837        do L = 1,lm        do L = 1,lm
838        do i = 1,im*jm        do j = 1,jm
839        qdiag(i,1,icldmas+L-1,bi,bj) = qdiag(i,1,icldmas+L-1,bi,bj) +        do i = 1,im
840       .                                                  tmpgather(i,L)         indgath = (j-1)*im + i
841          qdiag(i,j,icldmas+L-1,bi,bj) = qdiag(i,j,icldmas+L-1,bi,bj) +
842         .                               tmpgather(indgath,L)
843          enddo
844        enddo        enddo
845        enddo        enddo
846        endif        endif
# Line 876  c Detrained Cloud Mass Flux Line 849  c Detrained Cloud Mass Flux
849  c -------------------------  c -------------------------
850        if(idtrain.gt.0) then        if(idtrain.gt.0) then
851        do L = 1,lm        do L = 1,lm
852        do i = 1,im*jm        do j = 1,jm
853        qdiag(i,1,idtrain+L-1,bi,bj) = qdiag(i,1,idtrain+L-1,bi,bj) +        do i = 1,im
854       .                                                  pkegather(i,L)         indgath = (j-1)*im + i
855          qdiag(i,j,idtrain+L-1,bi,bj) = qdiag(i,j,idtrain+L-1,bi,bj) +
856         .                                pkegather(indgath,L)
857          enddo
858        enddo        enddo
859        enddo        enddo
860        endif        endif
# Line 887  c Grid-Scale Condensational Heating Rate Line 863  c Grid-Scale Condensational Heating Rate
863  c --------------------------------------  c --------------------------------------
864        if(idtls.gt.0) then        if(idtls.gt.0) then
865        do L = 1,lm        do L = 1,lm
866        do i = 1,im*jm        do j = 1,jm
867        qdiag(i,1,idtls+L-1,bi,bj) = qdiag(i,1,idtls+L-1,bi,bj) +        do i = 1,im
868       .                                                  deltrnev(i,L)         indgath = (j-1)*im + i
869          qdiag(i,j,idtls+L-1,bi,bj) = qdiag(i,j,idtls+L-1,bi,bj) +
870         .                               deltrnev(indgath,L)
871          enddo
872        enddo        enddo
873        enddo        enddo
874        endif        endif
# Line 898  c Grid-Scale Condensational Moistening R Line 877  c Grid-Scale Condensational Moistening R
877  c -----------------------------------------  c -----------------------------------------
878        if(idqls.gt.0) then        if(idqls.gt.0) then
879        do L = 1,lm        do L = 1,lm
880        do i = 1,im*jm        do j = 1,jm
881        qdiag(i,1,idqls+L-1,bi,bj) = qdiag(i,1,idqls+L-1,bi,bj) +        do i = 1,im
882       .                                                  delqrnev(i,L)         indgath = (j-1)*im + i
883          qdiag(i,j,idqls+L-1,bi,bj) = qdiag(i,j,idqls+L-1,bi,bj) +
884         .                                delqrnev(indgath,L)
885          enddo
886        enddo        enddo
887        enddo        enddo
888        endif        endif
# Line 921  c ------------------- Line 903  c -------------------
903  c Convective Precipitation  c Convective Precipitation
904  c ------------------------  c ------------------------
905        if(iprecon.gt.0) then        if(iprecon.gt.0) then
906        do i = 1,im*jm        do j = 1,jm
907        qdiag(i,1,iprecon,bi,bj) = qdiag(i,1,iprecon,bi,bj) +        do i = 1,im
908       .                                         raincgath(i)*sday*tminv         indgath = (j-1)*im + i
909          qdiag(i,j,iprecon,bi,bj) = qdiag(i,j,iprecon,bi,bj) +
910         .                      raincgath(indgath)*sday*tminv
911          enddo
912        enddo        enddo
913        endif        endif
914    
# Line 1077  C ************************************** Line 1062  C **************************************
1062         nlwcld   = nlwcld   + 1         nlwcld   = nlwcld   + 1
1063         nswcld   = nswcld   + 1         nswcld   = nswcld   + 1
1064    
1065    #ifdef ALLOW_DIAGNOSTICS
1066           if( (bi.eq.1) .and. (bj.eq.1) ) then
1067         nmoistt  = nmoistt  + 1         nmoistt  = nmoistt  + 1
1068         nmoistq  = nmoistq  + 1         nmoistq  = nmoistq  + 1
1069         npreacc  = npreacc  + 1         npreacc  = npreacc  + 1
# Line 1087  C ************************************** Line 1074  C **************************************
1074    
1075         ndtls  = ndtls  + 1         ndtls  = ndtls  + 1
1076         ndqls  = ndqls  + 1         ndqls  = ndqls  + 1
1077           endif
1078    #endif
1079    
1080        RETURN        RETURN
1081        END        END
1082        SUBROUTINE RAS( NN, LEN, LENC, K, NLTOP, nlayr, DT        SUBROUTINE RAS( NN, LNG, LENC, K, NLTOP, nlayr, DT
1083       *,               UOI, ntracer, POI, QOI, PRS, PRJ, rnd, ncrnd       *,               UOI, ntracer, POI, QOI, PRS, PRJ, rnd, ncrnd
1084       *,               RAINS, CLN, CLF, cldmas, detrain       *,               RAINS, CLN, CLF, cldmas, detrain
1085       *,               cp,grav,rkappa,alhl,rhfrac,rasmax )       *,               cp,grav,rkappa,alhl,rhfrac,rasmax )
1086  C  C
1087  C*********************************************************************  C*********************************************************************
 C*********************** ARIES   MODEL *******************************  
1088  C********************* SUBROUTINE  RAS   *****************************  C********************* SUBROUTINE  RAS   *****************************
1089  C********************** 16 MARCH   1988 ******************************  C********************** 16 MARCH   1988 ******************************
1090  C*********************************************************************  C*********************************************************************
1091  C  C
1092          implicit none
1093    
1094    C Argument List
1095          integer nn,lng,lenc,k,nltop,nlayr
1096          integer ntracer
1097          integer ncrnd
1098          _RL dt
1099          _RL UOI(lng,nlayr,ntracer),   POI(lng,K)
1100          _RL QOI(lng,K), PRS(lng,K+1), PRJ(lng,K+1)
1101          _RL rnd(ncrnd)
1102          _RL RAINS(lng,K), CLN(lng,K), CLF(lng,K)
1103          _RL cldmas(lng,K), detrain(lng,K)
1104          _RL cp,grav,rkappa,alhl,rhfrac(lng),rasmax
1105    
1106    C Local Variables
1107          _RL TCU(lng,K), QCU(lng,K)
1108          _RL ucu(lng,K,ntracer)
1109          _RL ALF(lng,K), BET(lng,K), GAM(lng,K)
1110         *,         ETA(lng,K), HOI(lng,K)
1111         *,         PRH(lng,K), PRI(lng,K)
1112          _RL HST(lng,K), QOL(lng,K), GMH(lng,K)
1113    
1114          _RL TX1(lng), TX2(lng), TX3(lng), TX4(lng), TX5(lng)
1115         *,         TX6(lng), TX7(lng), TX8(lng), TX9(lng)
1116         *,         TX11(lng), TX12(lng), TX13(lng), TX14(lng,ntracer)
1117         *,         TX15(lng)
1118         *,         WFN(lng)
1119          integer IA1(lng), IA2(lng), IA3(lng)
1120          _RL cloudn(lng), pcu(lng)
1121    
1122          integer krmin,icm
1123          _RL rknob, cmb2pa
1124        PARAMETER (KRMIN=01)        PARAMETER (KRMIN=01)
1125        PARAMETER (ICM=1000)        PARAMETER (ICM=1000)
1126        PARAMETER (CMB2PA=100.0)        PARAMETER (CMB2PA=100.0)
1127        PARAMETER (rknob = 10.)        PARAMETER (rknob = 10.)
 C  
       integer ntracer  
       integer nltop,nlayr  
       DIMENSION UOI(len,nlayr,ntracer),   POI(len,K)  
       DIMENSION QOI(len,K), PRS(len,K+1), PRJ(len,K+1)  
       dimension rnd(ncrnd)  
 C  
       DIMENSION RAINS(len,K), CLN(len,K), CLF(len,K)  
       DIMENSION cldmas(len,K), detrain(len,K)  
       DIMENSION TCU(len,K), QCU(len,K)  
       real ucu(len,K,ntracer)  
       DIMENSION ALF(len,K), BET(len,K), GAM(len,K)  
      *,         ETA(len,K), HOI(len,K)  
      *,         PRH(len,K), PRI(len,K)  
       DIMENSION HST(len,K), QOL(len,K), GMH(len,K)  
   
       DIMENSION TX1(len), TX2(len), TX3(len), TX4(len), TX5(len)  
      *,         TX6(len), TX7(len), TX8(len), TX9(len)  
      *,         TX11(len), TX12(len), TX13(len), TX14(len,ntracer)  
      *,         TX15(len), TX16(len)  
      *,         WFN(len), IA1(len), IA2(len), IA3(len)  
       DIMENSION cloudn(len), pcu(len)  
1128    
1129        real rhfrac(len),rasmax        integer IC(ICM),   IRND(icm)
1130          _RL cmass(lng,K)
       DIMENSION IC(ICM),   IRND(icm)  
       dimension cmass(len,K)  
1131        LOGICAL SETRAS        LOGICAL SETRAS
1132    
1133           do L = 1,k        integer i,L,nc,ib,nt
1134           do I = 1,LENC        integer km1,kp1,kprv,kcr,kfx,ncmx
1135           rains(i,l) = 0.        _RL p00, crtmsf, frac, rasblf
1136           enddo  
1137           enddo        do L = 1,k
1138          do I = 1,LENC
1139           rains(i,l) = 0.
1140          enddo
1141          enddo
1142    
1143        p00 = 1000.        p00 = 1000.
1144        crtmsf = 0.        crtmsf = 0.
# Line 1192  c ------------------------------- Line 1192  c -------------------------------
1192        cloudn(i) = 0.0        cloudn(i) = 0.0
1193        enddo        enddo
1194    
1195         CALL CLOUD(nn,LEN, LENC, K, NLTOP, nlayr, IB, RASBLF,SETRAS,FRAC         CALL CLOUD(nn,lng, LENC, K, NLTOP, nlayr, IB, RASBLF,SETRAS,FRAC
1196       *,           CP,  ALHL, RKAPPA, GRAV, P00, CRTMSF       *,           CP,  ALHL, RKAPPA, GRAV, P00, CRTMSF
1197       *,           POI, QOI, UOI, Ntracer, PRS, PRJ       *,           POI, QOI, UOI, Ntracer, PRS, PRJ
1198       *,           PCU, CLOUDN, TCU, QCU, UCU, CMASS       *,           PCU, CLOUDN, TCU, QCU, UCU, CMASS
# Line 1265  c -------------------------------------- Line 1265  c --------------------------------------
1265    
1266        RETURN        RETURN
1267        END        END
   
1268        subroutine rndcloud (iras,nrnd,rnd,myid)        subroutine rndcloud (iras,nrnd,rnd,myid)
1269        implicit none        implicit none
1270        integer n,iras,nrnd,myid        integer n,iras,nrnd,myid
1271        real random_numbx        _RL random_numbx
1272        real rnd(nrnd)        _RL rnd(nrnd)
1273        integer irm        integer irm
1274        parameter (irm = 1000)        parameter (irm = 1000)
1275        real random(irm)        _RL random(irm)
1276        integer i,mcheck,numrand,iseed,index        integer i,mcheck,numrand,iseed,indx
1277        logical first        logical first
1278        data    first /.true./        data    first /.true./
1279        integer iras0        integer iras0
# Line 1285  c -------------------------------------- Line 1284  c --------------------------------------
1284         do i = 1,nrnd         do i = 1,nrnd
1285          rnd(i) = 0          rnd(i) = 0
1286         enddo         enddo
1287         if(first .and. myid.eq.0) print *,' NO RANDOM CLOUDS IN RAS '         if(first .and. myid.eq.1) print *,' NO RANDOM CLOUDS IN RAS '
1288         go to 100         go to 100
1289        endif        endif
1290    
# Line 1294  c -------------------------------------- Line 1293  c --------------------------------------
1293  c First Time In From a Continuing RESTART (IRAS.GT.1) or Reading a New RESTART  c First Time In From a Continuing RESTART (IRAS.GT.1) or Reading a New RESTART
1294  c ----------------------------------------------------------------------------  c ----------------------------------------------------------------------------
1295        if( first.and.(iras.gt.1) .or. iras.ne.iras0+1 )then        if( first.and.(iras.gt.1) .or. iras.ne.iras0+1 )then
1296         if( myid.eq.0 ) print *, 'Recreating Rand Numb Array in RNDCLOUD'         if( myid.eq.1 ) print *, 'Recreating Rand Numb Array in RNDCLOUD'
1297         if( myid.eq.0 ) print *, 'IRAS: ',iras,'  IRAS0: ',iras0         if( myid.eq.1 ) print *, 'IRAS: ',iras,'  IRAS0: ',iras0
1298         numrand = mod(iras,irm/nrnd) * nrnd         numrand = mod(iras,irm/nrnd) * nrnd
1299         iseed   = iras * nrnd - numrand         iseed   = iras * nrnd - numrand
1300         call random_seedx(iseed)         call random_seedx(iseed)
1301         do i = 1,irm         do i = 1,irm
1302          random(i) = random_numbx()          random(i) = random_numbx(iseed)
1303         enddo         enddo
1304         index = (iras-1)*nrnd         indx = (iras-1)*nrnd
1305    
1306  c Multiple Time In But have Used Up all 1000 numbers (MCHECK.EQ.0)  c Multiple Time In But have Used Up all 1000 numbers (MCHECK.EQ.0)
1307  c ----------------------------------------------------------------  c ----------------------------------------------------------------
# Line 1310  c -------------------------------------- Line 1309  c --------------------------------------
1309            iseed = (iras-1)*nrnd            iseed = (iras-1)*nrnd
1310            call random_seedx(iseed)            call random_seedx(iseed)
1311            do i = 1,irm            do i = 1,irm
1312             random(i) = random_numbx()             random(i) = random_numbx(iseed)
1313            enddo            enddo
1314            index = iseed            indx = iseed
1315    
1316  c Multiple Time In But have NOT Used Up all 1000 numbers (MCHECK.NE.0)  c Multiple Time In But have NOT Used Up all 1000 numbers (MCHECK.NE.0)
1317  c --------------------------------------------------------------------  c --------------------------------------------------------------------
1318        else        else
1319            index = (iras-1)*nrnd            indx = (iras-1)*nrnd
1320        endif        endif
1321    
1322            index = mod(index,irm)            indx = mod(indx,irm)
1323        if( index+nrnd.gt.1000 ) index=1000-nrnd        if( indx+nrnd.gt.1000 ) indx=1000-nrnd
1324    
1325        do n = 1,nrnd        do n = 1,nrnd
1326         rnd(n) = random(index+n)         rnd(n) = random(indx+n)
1327        enddo        enddo
1328    
1329   100  continue   100  continue
# Line 1332  c -------------------------------------- Line 1331  c --------------------------------------
1331        iras0 = iras        iras0 = iras
1332        return        return
1333        end        end
1334          function random_numbx(iseed)
       real function random_numbx()  
1335        implicit none        implicit none
1336  #if CRAY        integer iseed
1337        real ranf        real *8 seed,port_rand
1338          _RL random_numbx
1339          random_numbx = 0
1340    #ifdef CRAY
1341          _RL ranf
1342        random_numbx = ranf()        random_numbx = ranf()
1343  #endif  #else
1344  #if SGI  #ifdef SGI
1345        real rand        _RL rand
1346        random_numbx = rand()        random_numbx = rand()
1347  #endif  #endif
1348          random_numbx = port_rand(seed)
1349    #endif
1350        return        return
1351        end        end
1352        subroutine random_seedx (iseed)        subroutine random_seedx (iseed)
1353        implicit none        implicit none
1354        integer  iseed        integer  iseed
1355  #if CRAY  #ifdef CRAY
1356        call ranset (iseed)        call ranset (iseed)
1357  #endif  #endif
1358  #if SGI  #ifdef SGI
1359        integer*4   seed        integer*4   seed
1360                    seed = iseed                    seed = iseed
1361        call srand (seed)        call srand (seed)
1362  #endif  #endif
1363        return        return
1364        end        end
1365          SUBROUTINE CLOUD(nn,lng, LENC, K, NLTOP, nlayr, IC, RASALF
       SUBROUTINE CLOUD(nn,LEN, LENC, K, NLTOP, nlayr, IC, RASALF,  
1366       *,                 SETRAS, FRAC       *,                 SETRAS, FRAC
1367       *,                 CP,  ALHL, RKAP, GRAV, P00, CRTMSF       *,                 CP,  ALHL, RKAP, GRAV, P00, CRTMSF
1368       *,                 POI, QOI, UOI, Ntracer, PRS,  PRJ       *,                 POI, QOI, UOI, Ntracer, PRS,  PRJ
# Line 1401  C Line 1404  C
1404  C  Input:  C  Input:
1405  C  ------  C  ------
1406  C  C
1407  C     LEN     : The inner dimension of update and input arrays.  C     lng     : The inner dimension of update and input arrays.
1408  C  C
1409  C     LENC    : The run: the number of soundings processes in a single call.  C     LENC    : The run: the number of soundings processes in a single call.
1410  C               RAS works on the first LENC of the LEN soundings  C               RAS works on the first LENC of the lng soundings
1411  C               passed. This allows working on pieces of the world  C               passed. This allows working on pieces of the world
1412  C               say for multitasking, without declaring temporary arrays  C               say for multitasking, without declaring temporary arrays
1413  C               and copying the data to and from them.  This is an f77  C               and copying the data to and from them.  This is an f77
1414  C               version. An F90 version would have to allow more  C               version. An F90 version would have to allow more
1415  C               flexibility in the argument declarations.  Obviously  C               flexibility in the argument declarations.  Obviously
1416  C               (LENC<=LEN).    C               (LENC<=lng).  
1417  C  C
1418  C     K       : Number of vertical layers (increasing downwards).  C     K       : Number of vertical layers (increasing downwards).
1419  C               Need not be the same as the number of layers in the  C               Need not be the same as the number of layers in the
# Line 1441  C     CRTMSF  : Critical value of mass f Line 1444  C     CRTMSF  : Critical value of mass f
1444  C               the detrainment layer of that cloud-type is assumed.  C               the detrainment layer of that cloud-type is assumed.
1445  C               Affects only cloudiness calculation.  C               Affects only cloudiness calculation.
1446  C  C
1447  C     POI     : 2D array of dimension (LEN,K) containing potential  C     POI     : 2D array of dimension (lng,K) containing potential
1448  C               temperature. Updated but not initialized by RAS.  C               temperature. Updated but not initialized by RAS.
1449  C  C
1450  C     QOI     : 2D array of dimension (LEN,K) containing specific  C     QOI     : 2D array of dimension (lng,K) containing specific
1451  C               humidity. Updated but not initialized by RAS.  C               humidity. Updated but not initialized by RAS.
1452  C  C
1453  C     UOI     : 3D array of dimension (LEN,K,NTRACER) containing tracers  C     UOI     : 3D array of dimension (lng,K,NTRACER) containing tracers
1454  C               Updated but not initialized by RAS.  C               Updated but not initialized by RAS.
1455  C  C
1456  C     PRS     : 2D array of dimension (LEN,K+1) containing pressure  C     PRS     : 2D array of dimension (lng,K+1) containing pressure
1457  C               in hPa at the interfaces of K-layers from top of the  C               in hPa at the interfaces of K-layers from top of the
1458  C               atmosphere to the bottom. Not modified.  C               atmosphere to the bottom. Not modified.
1459  C  C
1460  C     PRJ     : 2D array of dimension (LEN,K+1) containing (PRS/P00) **  C     PRJ     : 2D array of dimension (lng,K+1) containing (PRS/P00) **
1461  C               RKAP.  i.e. Exner function at layer edges. Not modified.  C               RKAP.  i.e. Exner function at layer edges. Not modified.
1462  C  C
1463  C     rhfrac  : 1D array of dimension (LEN) containing a rel.hum. scaling  C     rhfrac  : 1D array of dimension (lng) containing a rel.hum. scaling
1464  C               fraction. Not modified.  C               fraction. Not modified.
1465  C  C
1466  C  Output:  C  Output:
1467  C  -------  C  -------
1468  C  C
1469  C     PCU     : 1D array of length LEN containing accumulated  C     PCU     : 1D array of length lng containing accumulated
1470  C               precipitation in mm/sec.  C               precipitation in mm/sec.
1471  C  C
1472  C     CLN     : 2D array of dimension (LEN,K) containing cloudiness  C     CLN     : 2D array of dimension (lng,K) containing cloudiness
1473  C               Note:  CLN is bumped but NOT initialized  C               Note:  CLN is bumped but NOT initialized
1474  C  C
1475  C     TCU     : 2D array of dimension (LEN,K) containing accumulated  C     TCU     : 2D array of dimension (lng,K) containing accumulated
1476  C               convective heating (K/sec).  C               convective heating (K/sec).
1477  C  C
1478  C     QCU     : 2D array of dimension (LEN,K) containing accumulated  C     QCU     : 2D array of dimension (lng,K) containing accumulated
1479  C               convective drying (kg/kg/sec).  C               convective drying (kg/kg/sec).
1480  C  C
1481  C     CMASS   : 2D array of dimension (LEN,K) containing the  C     CMASS   : 2D array of dimension (lng,K) containing the
1482  C               cloud mass flux (kg/sec). Filled from cloud top  C               cloud mass flux (kg/sec). Filled from cloud top
1483  C               to base.  C               to base.
1484  C  C
# Line 1493  C    IA, I1, and I2 are temporary intege Line 1496  C    IA, I1, and I2 are temporary intege
1496  C  C
1497  C  C
1498  C************************************************************************  C************************************************************************
1499  C        implicit none
1500  C  C Argument List declarations
1501          integer nn,lng,LENC,K,NLTOP,nlayr,ic,ntracer
1502          _RL rasalf
1503          LOGICAL SETRAS
1504          _RL frac, cp,  alhl, rkap, grav, p00, crtmsf
1505          _RL POI(lng,K),QOI(lng,K),PRS(lng,K+1),PRJ(lng,K+1)
1506          _RL uoi(lng,nlayr,ntracer)
1507          _RL PCU(LENC), CLN(lng)
1508          _RL TCU(lng,K),  QCU(lng,K),  ucu(lng,k,ntracer), CMASS(lng,K)
1509          _RL ALF(lng,K), BET(lng,K),  GAM(lng,K), PRH(lng,K), PRI(lng,K)
1510          _RL HOL(LENC,K), ETA(LENC,K), HST(LENC,K), QOL(LENC,K)
1511          _RL GMH(LENC,K)
1512          _RL TX1(LENC), TX2(LENC), TX3(LENC), TX4(LENC)
1513          _RL TX5(LENC), TX6(LENC), TX7(LENC), TX8(LENC)
1514          _RL ALM(LENC), WFN(LENC), AKM(LENC), QS1(LENC)
1515          _RL WLQ(LENC), CLF(LENC)
1516          _RL uht(lng,ntracer)
1517          integer IA(LENC), I1(LENC),I2(LENC)
1518          _RL      rhfrac(lng)
1519    
1520    C Local Variables
1521          _RL daylen,half,one,zero,cmb2pa,rhmax
1522        PARAMETER (DAYLEN=86400.0,  HALF=0.5,  ONE=1.0, ZERO=0.0)        PARAMETER (DAYLEN=86400.0,  HALF=0.5,  ONE=1.0, ZERO=0.0)
1523        PARAMETER (CMB2PA=100.0)        PARAMETER (CMB2PA=100.0)
1524        PARAMETER (RHMAX=0.9999)        PARAMETER (RHMAX=0.9999)
1525          _RL rkapp1,onebcp,albcp,onebg,cpbg,twobal
1526  C  C
1527        integer nltop,ntracer,nlayr        integer nt,km1,ic1,i,L,len1,len2,isav,len11,ii
1528        DIMENSION POI(LEN,K),  QOI(LEN,K),  PRS(LEN,K+1)        integer lena,lena1,lenb
1529       *,         PRJ(LEN,K+1)        _RL tem,tem1
      *,         TCU(LEN,K),  QCU(LEN,K),  CMASS(LEN,K), CLN(LEN)  
       real uoi(len,nlayr,ntracer)  
       DIMENSION ALF(LEN,K), BET(LEN,K),  GAM(LEN,K)  
      *,         PRH(LEN,K), PRI(LEN,K)  
       DIMENSION AKM(LENC),   WFN(LENC)  
       DIMENSION HOL(LENC,K), QOL(LENC,K),  ETA(LENC,K), HST(LENC,K)  
      *,         GMH(LENC,K), ALM(LENC),    WLQ(LENC),   QS1(LENC)  
      *,         TX1(LENC),   TX2(LENC), TX3(LENC),   TX4(LENC)  
      *,         TX5(LENC),   TX6(LENC), TX7(LENC),   TX8(LENC)  
      *,         CLF(LENC),   PCU(LENC)  
       DIMENSION IA(LENC),    I1(LENC),  I2(LENC)  
       real      rhfrac(len)  
       real ucu(len,k,ntracer),uht(len,ntracer)  
       LOGICAL SETRAS  
   
       integer nt  
1530    
1531  c Explicit Inline Directives  c Explicit Inline Directives
1532  c --------------------------  c --------------------------
1533  #if CRAY  #ifdef CRAY
1534  #if f77  #ifdef f77
1535  cfpp$ expand (qsat)  cfpp$ expand (qsat)
1536  #endif  #endif
1537  #endif  #endif
# Line 1538  C Line 1546  C
1546        KM1 = K  - 1        KM1 = K  - 1
1547        IC1 = IC + 1        IC1 = IC + 1
1548  C  C
1549  C      SETTIING ALF, BET, GAM, PRH, AND PRI : DONE ONLY WHEN SETRAS=.T.  C      SETTING ALF, BET, GAM, PRH, AND PRI : DONE ONLY WHEN SETRAS=.T.
1550  C  C
1551    
1552        IF (SETRAS) THEN        IF (SETRAS) THEN
# Line 1567  C Line 1575  C
1575  C  C
1576  C  C
1577        DO 10 L=1,K        DO 10 L=1,K
1578        DO 10 I=1,LEN        DO 10 I=1,lng
1579        TCU(I,L) = 0.0        TCU(I,L) = 0.0
1580        QCU(I,L) = 0.0        QCU(I,L) = 0.0
1581        CMASS(I,L) = 0.0        CMASS(I,L) = 0.0
# Line 2101  C Line 2109  C
2109    
2110        RETURN        RETURN
2111        END        END
2112        SUBROUTINE RNCL(LEN, PL, RNO, CLF)        SUBROUTINE RNCL(lng, PL, RNO, CLF)
 C  
2113  C  C
2114  C*********************************************************************  C*********************************************************************
2115  C********************** Relaxed Arakawa-Schubert *********************  C********************** Relaxed Arakawa-Schubert *********************
2116  C************************   SUBROUTINE  RNCL  ************************  C************************   SUBROUTINE  RNCL  ************************
2117  C**************************** 23 July 1992 ***************************  C**************************** 23 July 1992 ***************************
2118  C*********************************************************************  C*********************************************************************
2119          implicit none
2120    C Argument List declarations
2121          integer lng
2122          _RL PL(lng),  RNO(lng), CLF(lng)
2123    
2124    C Local Variables
2125          _RL p5,p8,pt8,pt2,pfac,p4,p6,p7,p9,cucld,cfac
2126        PARAMETER (P5=500.0,  P8=800.0, PT8=0.8, PT2=0.2)        PARAMETER (P5=500.0,  P8=800.0, PT8=0.8, PT2=0.2)
2127        PARAMETER (PFAC=PT2/(P8-P5))        PARAMETER (PFAC=PT2/(P8-P5))
 C  
2128        PARAMETER (P4=400.0,    P6=401.0)        PARAMETER (P4=400.0,    P6=401.0)
2129        PARAMETER (P7=700.0,    P9=900.0)        PARAMETER (P7=700.0,    P9=900.0)
2130        PARAMETER (CUCLD=0.5,CFAC=CUCLD/(P6-P4))        PARAMETER (CUCLD=0.5,CFAC=CUCLD/(P6-P4))
2131    
2132          integer i
2133  C  C
2134        DIMENSION PL(LEN),  RNO(LEN), CLF(LEN)        DO 10 I=1,lng
   
       DO 10 I=1,LEN  
2135                             rno(i) = 1.0                             rno(i) = 1.0
2136  ccc   if( pl(i).le.400.0 ) rno(i) = max( 0.75, 1.0-0.0025*(400.0-pl(i)) )  ccc   if( pl(i).le.400.0 ) rno(i) = max( 0.75, 1.0-0.0025*(400.0-pl(i)) )
2137    
# Line 2146  CARIES Line 2158  CARIES
2158  C  C
2159        RETURN        RETURN
2160        END        END
2161        SUBROUTINE ACRITN ( LEN,PL,PLB,ACR )        SUBROUTINE ACRITN ( lng,PL,PLB,ACR )
2162    
2163  C*********************************************************************  C*********************************************************************
2164  C********************** Relaxed Arakawa-Schubert *********************  C********************** Relaxed Arakawa-Schubert *********************
# Line 2157  C****  Note:  Data obtained from January Line 2169  C****  Note:  Data obtained from January
2169  C****         from 4x5 46-layer GEOS Assimilation                *****  C****         from 4x5 46-layer GEOS Assimilation                *****
2170  C****                                                            *****  C****                                                            *****
2171  C*********************************************************************  C*********************************************************************
2172          implicit none
2173        real PL(LEN), PLB(LEN), ACR(LEN)  C Argument List declarations
2174          integer lng
2175          _RL PL(lng), PLB(lng), ACR(lng)
2176    
2177    C Local variables
2178          integer lma
2179        parameter  (lma=18)        parameter  (lma=18)
2180        real      p(lma)        _RL p(lma)
2181        real      a(lma)        _RL a(lma)
2182          integer i,L
2183          _RL temp
2184    
2185        data p  / 93.81, 111.65, 133.46, 157.80, 186.51,        data p  / 93.81, 111.65, 133.46, 157.80, 186.51,
2186       .         219.88, 257.40, 301.21, 352.49, 409.76,       .         219.88, 257.40, 301.21, 352.49, 409.76,
# Line 2176  C*************************************** Line 2194  C***************************************
2194    
2195    
2196        do L=1,lma-1        do L=1,lma-1
2197        do i=1,len        do i=1,lng
2198           if( pl(i).ge.p(L)   .and.           if( pl(i).ge.p(L)   .and.
2199       .       pl(i).le.p(L+1)) then       .       pl(i).le.p(L+1)) then
2200           temp = ( pl(i)-p(L) )/( p(L+1)-p(L) )           temp = ( pl(i)-p(L) )/( p(L+1)-p(L) )
# Line 2185  C*************************************** Line 2203  C***************************************
2203        enddo        enddo
2204        enddo        enddo
2205    
2206        do i=1,len        do i=1,lng
2207        if( pl(i).lt.p(1)   ) acr(i) = a(1)        if( pl(i).lt.p(1)   ) acr(i) = a(1)
2208        if( pl(i).gt.p(lma) ) acr(i) = a(lma)        if( pl(i).gt.p(lma) ) acr(i) = a(lma)
2209        enddo        enddo
2210    
2211        do i=1,len        do i=1,lng
2212        acr(i) = acr(i) * (plb(i)-pl(i))        acr(i) = acr(i) * (plb(i)-pl(i))
2213        enddo        enddo
2214    
# Line 2200  C*************************************** Line 2218  C***************************************
2218       1   PLK,TH,TEMP1,TEMP2,TEMP3,ITMP1,ITMP2,RCON,RLAR,CLSBTH,tmscl,       1   PLK,TH,TEMP1,TEMP2,TEMP3,ITMP1,ITMP2,RCON,RLAR,CLSBTH,tmscl,
2219       2   tmfrc,cp,gravity,alhl,gamfac,cldlz,RHCRIT,offset,alpha)       2   tmfrc,cp,gravity,alhl,gamfac,cldlz,RHCRIT,offset,alpha)
2220    
2221          implicit none
2222    C Argument List declarations
2223          integer nn,irun,nlay
2224          _RL TL(IRUN,NLAY),QL(IRUN,NLAY),RAIN(IRUN,NLAY),
2225         . PL(IRUN,NLAY),CLFRAC(IRUN,NLAY),SP(IRUN),TEMP1(IRUN,NLAY),
2226         . TEMP2(IRUN,NLAY),PLKE(IRUN,NLAY+1),
2227         . RCON(IRUN),RLAR(IRUN),DP(IRUN,NLAY),PLK(IRUN,NLAY),TH(IRUN,NLAY),
2228         . TEMP3(IRUN,NLAY)
2229          integer ITMP1(IRUN,NLAY),ITMP2(IRUN,NLAY)
2230          _RL CLSBTH(IRUN,NLAY)
2231          _RL tmscl,tmfrc,cp,gravity,alhl,gamfac,offset,alpha
2232          _RL cldlz(irun,nlay)
2233          _RL rhcrit(irun,nlay)
2234    C
2235    C Local Variables
2236          _RL zm1p04,zero,two89,zp44,zp01,half,zp578,one,thousand,z3600
2237          _RL zp1,zp001
2238        PARAMETER (ZM1P04 = -1.04E-4 )        PARAMETER (ZM1P04 = -1.04E-4 )
2239        PARAMETER (ZERO = 0.)        PARAMETER (ZERO = 0.)
2240        PARAMETER (TWO89= 2.89E-5)        PARAMETER (TWO89= 2.89E-5)
# Line 2213  C*************************************** Line 2248  C***************************************
2248        PARAMETER ( THOUSAND = 1000.)        PARAMETER ( THOUSAND = 1000.)
2249        PARAMETER ( Z3600 = 3600.)        PARAMETER ( Z3600 = 3600.)
2250  C  C
2251         DIMENSION TL(IRUN,NLAY),QL(IRUN,NLAY),RAIN(IRUN,NLAY),        _RL EVP9(IRUN,NLAY)
2252       $ PL(IRUN,NLAY),CLFRAC(IRUN,NLAY),SP(IRUN),TEMP1(IRUN,NLAY),        _RL water(irun),crystal(irun)
2253       $ TEMP2(IRUN,NLAY),PLKE(IRUN,NLAY+1),        _RL watevap(irun),iceevap(irun)
2254       $ RCON(IRUN),RLAR(IRUN),DP(IRUN,NLAY),PLK(IRUN,NLAY),TH(IRUN,NLAY),        _RL fracwat,fracice, tice,rh,fact,dum
2255       $ TEMP3(IRUN,NLAY),ITMP1(IRUN,NLAY),        _RL rainmax(irun)
2256       $ ITMP2(IRUN,NLAY),CLSBTH(IRUN,NLAY)        _RL getcon,rphf,elocp,cpog,relax
2257  C        _RL exparg,arearat,rpow
2258         DIMENSION EVP9(IRUN,NLAY)  
2259         real water(irun),crystal(irun)        integer i,L,n,nlaym1,irnlay,irnlm1
        real watevap(irun),iceevap(irun)  
        real fracwat,fracice, tice,rh,fact,dum  
   
        real cldlz(irun,nlay)  
        real rhcrit(irun,nlay), rainmax(irun)  
        real offset, alpha  
2260    
2261  c Explicit Inline Directives  c Explicit Inline Directives
2262  c --------------------------  c --------------------------
2263  #if CRAY  #ifdef CRAY
2264  #if f77  #ifdef f77
2265  cfpp$ expand (qsat)  cfpp$ expand (qsat)
2266  #endif  #endif
2267  #endif  #endif
# Line 2429  C  ======= Line 2458  C  =======
2458  C    cloud ...... Cloud Fraction        (irun,irise)  C    cloud ...... Cloud Fraction        (irun,irise)
2459  C  C
2460  C***********************************************************************  C***********************************************************************
 C*                  GODDARD LABORATORY FOR ATMOSPHERES                 *  
 C***********************************************************************  
2461    
2462        implicit none        implicit none
2463        integer  irun,irise        integer  irun,irise
2464    
2465        real   th(irun,irise)        _RL   th(irun,irise)
2466        real    q(irun,irise)        _RL    q(irun,irise)
2467        real  plk(irun,irise)        _RL  plk(irun,irise)
2468        real   pl(irun,irise)        _RL   pl(irun,irise)
2469        real plke(irun,irise+1)        _RL plke(irun,irise+1)
2470    
2471        real tempth(irun)        _RL  cloud(irun,irise)
2472        real tempqs(irun)        _RL cldwat(irun,irise)
2473        real dhstar(irun)        _RL     qs(irun,irise)
2474        real  cloud(irun,irise)  
2475        real cldwat(irun,irise)        _RL cp, alhl, getcon, akap
2476        real     qs(irun,irise)        _RL ratio, temp, elocp
2477          _RL rhcrit,rh,dum
2478        real cp, alhl, getcon, akap, pcheck        integer i,L
2479        real ratio, temp, pke, elocp  
2480        real rhcrit,rh,dum,pbar,tbar        _RL rhc(irun,irise)
2481        integer i,L,ntradesu,ntradesl        _RL offset,alpha
   
       real factor  
       real rhc(irun,irise)  
       real offset,alpha  
2482    
2483  c Explicit Inline Directives  c Explicit Inline Directives
2484  c --------------------------  c --------------------------
2485  #if CRAY  #ifdef CRAY
2486  #if f77  #ifdef f77
2487  cfpp$ expand (qsat)  cfpp$ expand (qsat)
2488  #endif  #endif
2489  #endif  #endif
# Line 2501  c -------------------------------------- Line 2524  c --------------------------------------
2524        subroutine ctei ( th,q,cldfrc,cldwat,pl,plk,plke,im,lm )        subroutine ctei ( th,q,cldfrc,cldwat,pl,plk,plke,im,lm )
2525        implicit none        implicit none
2526        integer im,lm        integer im,lm
2527        real  th(im,lm),q(im,lm),plke(im,lm+1),cldwat(im,lm)        _RL  th(im,lm),q(im,lm),plke(im,lm+1),cldwat(im,lm)
2528        real plk(im,lm),pl(im,lm),cldfrc(im,lm)        _RL plk(im,lm),pl(im,lm),cldfrc(im,lm)
2529        integer i,L        integer i,L
2530        real    getcon,cp,alhl,elocp,cpoel,t,p,s,qs,dqsdt,dq        _RL    getcon,cp,alhl,elocp,cpoel,t,p,s,qs,dqsdt,dq
2531        real    k,krd,kmm,f        _RL    k,krd,kmm,f
2532    
2533        cp     = getcon('CP')        cp     = getcon('CP')
2534        alhl   = getcon('LATENT HEAT COND')        alhl   = getcon('LATENT HEAT COND')
# Line 2542  c -------------------------------------- Line 2565  c --------------------------------------
2565        subroutine back2grd(gathered,indeces,scattered,irun)        subroutine back2grd(gathered,indeces,scattered,irun)
2566        implicit none        implicit none
2567        integer i,irun,indeces(irun)        integer i,irun,indeces(irun)
2568        real gathered(irun),scattered(irun)        _RL gathered(irun),scattered(irun)
2569        real temp(irun)        _RL temp(irun)
2570        do i = 1,irun        do i = 1,irun
2571         temp(indeces(i)) = gathered(i)         temp(indeces(i)) = gathered(i)
2572        enddo        enddo

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.22