1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "PACKAGES_CONFIG.h" |
#include "FIZHI_OPTIONS.h" |
|
#include "CPP_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,uz,vz,tz,qz,bi,bj,ntracerin,ptracer, |
8 |
. qqz,dumoist,dvmoist,dtmoist,dqmoist, |
. qqz,dumoist,dvmoist,dtmoist,dqmoist,cumfric, |
9 |
. im,jm,lm,ptop, |
. im,jm,lm,ptop, |
10 |
. iras,rainlsp,rainconv,snowfall, |
. iras,rainlsp,rainconv,snowfall, |
11 |
. nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz, |
. nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz, |
24 |
c --------------- |
c --------------- |
25 |
integer im,jm,lm |
integer im,jm,lm |
26 |
integer ndmoist,istrip,npcs |
integer ndmoist,istrip,npcs |
27 |
integer bi,bj,ntracer,ptracer |
integer bi,bj,ntracerin,ptracer |
28 |
integer lowlevel,midlevel,nltop,nsubmin,nsubmax,Lup |
integer lowlevel,midlevel,nltop,nsubmin,nsubmax,Lup |
29 |
real pz(im,jm),plz(im,jm,lm),plze(im,jm,lm+1),dpres(im,jm,lm) |
_RL pz(im,jm),plz(im,jm,lm),plze(im,jm,lm+1),dpres(im,jm,lm) |
30 |
real pkht(im,jm,lm+1),pkl(im,jm,lm) |
_RL pkht(im,jm,lm+1),pkl(im,jm,lm) |
31 |
real tz(im,jm,lm),qz(im,jm,lm,ntracer) |
_RL tz(im,jm,lm),qz(im,jm,lm,ntracerin) |
32 |
real qqz(im,jm,lm) |
_RL uz(im,jm,lm),vz(im,jm,lm) |
33 |
real dumoist(im,jm,lm),dvmoist(im,jm,lm) |
_RL qqz(im,jm,lm) |
34 |
real dtmoist(im,jm,lm),dqmoist(im,jm,lm,ntracer) |
_RL dumoist(im,jm,lm),dvmoist(im,jm,lm) |
35 |
real ptop |
_RL dtmoist(im,jm,lm),dqmoist(im,jm,lm,ntracerin) |
36 |
|
logical cumfric |
37 |
|
_RL ptop |
38 |
integer iras |
integer iras |
39 |
real rainlsp(im,jm),rainconv(im,jm),snowfall(im,jm) |
_RL rainlsp(im,jm),rainconv(im,jm),snowfall(im,jm) |
40 |
integer nswcld,nswlz |
integer nswcld,nswlz |
41 |
real cldlsp_sw(im,jm,lm),cldras_sw(im,jm,lm) |
_RL cldlsp_sw(im,jm,lm),cldras_sw(im,jm,lm) |
42 |
real cldtot_sw(im,jm,lm),swlz(im,jm,lm) |
_RL cldtot_sw(im,jm,lm),swlz(im,jm,lm) |
43 |
integer nlwcld,nlwlz |
integer nlwcld,nlwlz |
44 |
real cldlsp_lw(im,jm,lm),cldras_lw(im,jm,lm) |
_RL cldlsp_lw(im,jm,lm),cldras_lw(im,jm,lm) |
45 |
real cldtot_lw(im,jm,lm),lwlz(im,jm,lm) |
_RL cldtot_lw(im,jm,lm),lwlz(im,jm,lm) |
46 |
logical lpnt |
logical lpnt |
47 |
integer myid |
integer myid |
48 |
|
|
50 |
c --------------- |
c --------------- |
51 |
integer ncrnd,nsecf |
integer ncrnd,nsecf |
52 |
|
|
53 |
real fracqq, dum |
_RL fracqq, dum |
54 |
integer snowcrit |
integer snowcrit |
55 |
parameter (fracqq = 0.1) |
parameter (fracqq = 0.1) |
56 |
|
_RL one |
57 |
|
parameter (one=1.) |
58 |
|
|
59 |
real cldsr(im,jm,lm) |
_RL cldsr(im,jm,lm) |
60 |
real srcld(istrip,lm) |
_RL srcld(istrip,lm) |
61 |
|
|
62 |
real plev |
_RL plev |
63 |
real cldnow,cldlsp_mem,cldlsp,cldras_mem,cldras |
_RL cldnow,cldlsp_mem,cldlsp,cldras_mem,cldras |
64 |
real watnow,watmin,cldmin |
_RL watnow,watmin,cldmin |
65 |
real cldprs(im,jm),cldtmp(im,jm) |
_RL cldprs(im,jm),cldtmp(im,jm) |
66 |
real cldhi (im,jm),cldlow(im,jm) |
_RL cldhi (im,jm),cldlow(im,jm) |
67 |
real cldmid(im,jm),totcld(im,jm) |
_RL cldmid(im,jm),totcld(im,jm) |
68 |
|
|
69 |
real CLDLS(im,jm,lm) , CPEN(im,jm,lm) |
_RL CLDLS(im,jm,lm) , CPEN(im,jm,lm) |
70 |
real tmpimjm(im,jm) |
_RL tmpimjm(im,jm) |
71 |
real lsp_new(im,jm) |
_RL lsp_new(im,jm) |
72 |
real conv_new(im,jm) |
_RL conv_new(im,jm) |
73 |
real snow_new(im,jm) |
_RL snow_new(im,jm) |
74 |
|
|
75 |
real qqcolmin(im,jm) |
_RL qqcolmin(im,jm) |
76 |
real qqcolmax(im,jm) |
_RL qqcolmax(im,jm) |
77 |
integer levpbl(im,jm) |
integer levpbl(im,jm) |
78 |
|
|
79 |
c Gathered Arrays for Variable Cloud Base |
c Gathered Arrays for Variable Cloud Base |
80 |
c --------------------------------------- |
c --------------------------------------- |
81 |
real raincgath(im*jm) |
_RL raincgath(im*jm) |
82 |
real pigather(im*jm) |
_RL pigather(im*jm) |
83 |
real thgather(im*jm,lm) |
_RL thgather(im*jm,lm) |
84 |
real shgather(im*jm,lm) |
_RL shgather(im*jm,lm) |
85 |
real pkzgather(im*jm,lm) |
_RL pkzgather(im*jm,lm) |
86 |
real pkegather(im*jm,lm+1) |
_RL pkegather(im*jm,lm+1) |
87 |
real plzgather(im*jm,lm) |
_RL plzgather(im*jm,lm) |
88 |
real plegather(im*jm,lm+1) |
_RL plegather(im*jm,lm+1) |
89 |
real dpgather(im*jm,lm) |
_RL dpgather(im*jm,lm) |
90 |
real tmpgather(im*jm,lm) |
_RL tmpgather(im*jm,lm) |
91 |
real deltgather(im*jm,lm) |
_RL deltgather(im*jm,lm) |
92 |
real delqgather(im*jm,lm) |
_RL delqgather(im*jm,lm) |
93 |
real ugather(im*jm,lm,ntracer) |
_RL ugather(im*jm,lm,ntracerin+2-ptracer) |
94 |
real delugather(im*jm,lm,ntracer) |
_RL delugather(im*jm,lm,ntracerin+2-ptracer) |
95 |
real deltrnev(im*jm,lm) |
_RL deltrnev(im*jm,lm) |
96 |
real delqrnev(im*jm,lm) |
_RL delqrnev(im*jm,lm) |
97 |
|
|
98 |
integer nindeces(lm) |
integer nindeces(lm) |
99 |
integer pblindex(im*jm) |
integer pblindex(im*jm) |
101 |
|
|
102 |
c Stripped Arrays |
c Stripped Arrays |
103 |
c --------------- |
c --------------- |
104 |
real saveth (istrip,lm) |
_RL saveth (istrip,lm) |
105 |
real saveq (istrip,lm) |
_RL saveq (istrip,lm) |
106 |
real saveu (istrip,lm,ntracer) |
_RL saveu (istrip,lm,ntracerin+2-ptracer) |
107 |
real usubcl (istrip, ntracer) |
_RL usubcl (istrip, ntracerin+2-ptracer) |
108 |
|
|
109 |
real ple(istrip,lm+1) |
_RL ple(istrip,lm+1) |
110 |
real dp(istrip,lm) |
_RL dp(istrip,lm) |
111 |
real TL(ISTRIP,lm) , SHL(ISTRIP,lm) |
_RL TL(ISTRIP,lm) , SHL(ISTRIP,lm) |
112 |
real PL(ISTRIP,lm) , PLK(ISTRIP,lm) |
_RL PL(ISTRIP,lm) , PLK(ISTRIP,lm) |
113 |
real PLKE(ISTRIP,lm+1) |
_RL PLKE(ISTRIP,lm+1) |
114 |
real TH(ISTRIP,lm) ,CVTH(ISTRIP,lm) |
_RL TH(ISTRIP,lm) ,CVTH(ISTRIP,lm) |
115 |
real CVQ(ISTRIP,lm) |
_RL CVQ(ISTRIP,lm) |
116 |
real UL(ISTRIP,lm,ntracer) |
_RL UL(ISTRIP,lm,ntracerin+2-ptracer) |
117 |
real cvu(istrip,lm,ntracer) |
_RL cvu(istrip,lm,ntracerin+2-ptracer) |
118 |
real CLMAXO(ISTRIP,lm),CLBOTH(ISTRIP,lm) |
_RL CLMAXO(ISTRIP,lm),CLBOTH(ISTRIP,lm) |
119 |
real CLSBTH(ISTRIP,lm) |
_RL CLSBTH(ISTRIP,lm) |
120 |
real TMP1(ISTRIP,lm), TMP2(ISTRIP,lm) |
_RL TMP1(ISTRIP,lm), TMP2(ISTRIP,lm) |
121 |
real TMP3(ISTRIP,lm), TMP4(ISTRIP,lm+1) |
_RL TMP3(ISTRIP,lm), TMP4(ISTRIP,lm+1) |
122 |
real TMP5(ISTRIP,lm+1) |
_RL TMP5(ISTRIP,lm+1) |
123 |
integer ITMP1(ISTRIP,lm), ITMP2(ISTRIP,lm) |
integer ITMP1(ISTRIP,lm), ITMP2(ISTRIP,lm) |
124 |
|
|
125 |
real PRECIP(ISTRIP), PCNET(ISTRIP) |
_RL PRECIP(ISTRIP), PCNET(ISTRIP) |
126 |
real SP(ISTRIP), PREP(ISTRIP) |
_RL SP(ISTRIP), PREP(ISTRIP) |
127 |
real PCPEN (ISTRIP,lm) |
_RL PCPEN (ISTRIP,lm) |
128 |
integer pbl(istrip),depths(lm) |
integer pbl(istrip),depths(lm) |
129 |
|
|
130 |
real cldlz(istrip,lm), cldwater(im,jm,lm) |
_RL cldlz(istrip,lm), cldwater(im,jm,lm) |
131 |
real rhfrac(istrip), rhmin, pup, ppbl, rhcrit(istrip,lm) |
_RL rhfrac(istrip), rhmin, pup, ppbl, rhcrit(istrip,lm) |
132 |
real offset, alpha, rasmax |
_RL offset, alpha, rasmax |
133 |
|
|
134 |
logical first |
logical first |
135 |
logical lras |
logical lras |
136 |
real clfrac (istrip,lm) |
_RL clfrac (istrip,lm) |
137 |
real cldmas (istrip,lm) |
_RL cldmas (istrip,lm) |
138 |
real detrain(istrip,lm) |
_RL detrain(istrip,lm) |
139 |
real psubcld (istrip), psubcldg (im,jm) |
_RL psubcld (istrip), psubcldg (im,jm) |
140 |
real psubcld_cnt(istrip), psubcldgc(im,jm) |
_RL psubcld_cnt(istrip), psubcldgc(im,jm) |
141 |
real rnd(lm/2) |
_RL rnd(lm/2) |
142 |
DATA FIRST /.TRUE./ |
DATA FIRST /.TRUE./ |
143 |
|
|
144 |
integer imstp,nsubcl,nlras |
integer imstp,nsubcl,nlras |
145 |
integer i,j,iloop,index,l,nn,num,numdeps,nt |
integer i,j,iloop,indx,indgath,l,nn,num,numdeps,nt |
146 |
real tmstp,tminv,sday,grav,alhl,cp,elocp,gamfac |
_RL tmstp,tminv,sday,grav,alhl,cp,elocp,gamfac |
147 |
real rkappa,p0kappa,p0kinv,ptopkap,pcheck |
_RL rkappa,p0kappa,p0kinv,ptopkap,pcheck |
148 |
real tice,getcon,pi |
_RL tice,getcon,pi |
149 |
|
integer ntracer,ntracedim, ntracex |
150 |
|
|
151 |
C ********************************************************************** |
C ********************************************************************** |
152 |
C **** INITIALIZATION **** |
C **** INITIALIZATION **** |
153 |
C ********************************************************************** |
C ********************************************************************** |
154 |
|
|
155 |
|
C Add U and V components to tracer array for cumulus friction |
156 |
|
|
157 |
|
if(cumfric) then |
158 |
|
ntracer = ntracerin + 2 |
159 |
|
else |
160 |
|
ntracer = ntracerin |
161 |
|
endif |
162 |
|
ntracedim= max(ntracer-ptracer,1) |
163 |
|
ntracex= ntracer-ptracer |
164 |
IMSTP = nsecf(NDMOIST) |
IMSTP = nsecf(NDMOIST) |
165 |
TMSTP = FLOAT(IMSTP) |
TMSTP = FLOAT(IMSTP) |
166 |
TMINV = 1. / TMSTP |
TMINV = 1. / TMSTP |
198 |
c --------------------------------------------- |
c --------------------------------------------- |
199 |
ncrnd = (lm-nltop+1)/2 |
ncrnd = (lm-nltop+1)/2 |
200 |
|
|
201 |
if(first .and. myid.eq.0) then |
if(first .and. myid.eq.1 .and. bi.eq.1 ) then |
202 |
print * |
print * |
203 |
print *,'Top Level Allowed for Convection : ',nltop |
print *,'Top Level Allowed for Convection : ',nltop |
204 |
print *,' Highest Sub-Cloud Level: ',nsubmax |
print *,' Highest Sub-Cloud Level: ',nsubmax |
242 |
|
|
243 |
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 |
244 |
c ---------------------------------------------------------------- |
c ---------------------------------------------------------------- |
245 |
index = 0 |
indx = 0 |
246 |
do L = nsubmin,nltop,-1 |
do L = nsubmin,nltop,-1 |
247 |
do j = 1,jm |
do j = 1,jm |
248 |
do i = 1,im |
do i = 1,im |
249 |
if(levpbl(i,j).eq.L) then |
if(levpbl(i,j).eq.L) then |
250 |
index = index + 1 |
indx = indx + 1 |
251 |
pblindex(index) = (j-1)*im + i |
pblindex(indx) = (j-1)*im + i |
252 |
endif |
endif |
253 |
enddo |
enddo |
254 |
enddo |
enddo |
255 |
enddo |
enddo |
256 |
|
|
257 |
do index = 1,im*jm |
do indx = 1,im*jm |
258 |
levgather(index) = levpbl(pblindex(index),1) |
levgather(indx) = levpbl(pblindex(indx),1) |
259 |
pigather(index) = pz(pblindex(index),1) |
pigather(indx) = pz(pblindex(indx),1) |
260 |
pkegather(index,lm+1) = pkht(pblindex(index),1,lm+1) |
pkegather(indx,lm+1) = pkht(pblindex(indx),1,lm+1) |
261 |
plegather(index,lm+1) = plze(pblindex(index),1,lm+1) |
plegather(indx,lm+1) = plze(pblindex(indx),1,lm+1) |
262 |
enddo |
enddo |
263 |
|
|
264 |
do L = 1,lm |
do L = 1,lm |
265 |
do index = 1,im*jm |
do indx = 1,im*jm |
266 |
thgather(index,L) = tz(pblindex(index),1,L) |
thgather(indx,L) = tz(pblindex(indx),1,L) |
267 |
shgather(index,L) = qz(pblindex(index),1,L,1) |
shgather(indx,L) = qz(pblindex(indx),1,L,1) |
268 |
pkegather(index,L) = pkht(pblindex(index),1,L) |
pkegather(indx,L) = pkht(pblindex(indx),1,L) |
269 |
pkzgather(index,L) = pkl(pblindex(index),1,L) |
pkzgather(indx,L) = pkl(pblindex(indx),1,L) |
270 |
plegather(index,L) = plze(pblindex(index),1,L) |
plegather(indx,L) = plze(pblindex(indx),1,L) |
271 |
plzgather(index,L) = plz(pblindex(index),1,L) |
plzgather(indx,L) = plz(pblindex(indx),1,L) |
272 |
dpgather(index,L) = dpres(pblindex(index),1,L) |
dpgather(indx,L) = dpres(pblindex(indx),1,L) |
273 |
enddo |
enddo |
274 |
enddo |
enddo |
275 |
do nt = 1,ntracer-ptracer |
C General Tracers |
276 |
|
C---------------- |
277 |
|
do nt = 1,ntracerin-ptracer |
278 |
do L = 1,lm |
do L = 1,lm |
279 |
do index = 1,im*jm |
do indx = 1,im*jm |
280 |
ugather(index,L,nt) = qz(pblindex(index),1,L,nt+ptracer) |
ugather(indx,L,nt) = qz(pblindex(indx),1,L,nt+ptracer) |
281 |
enddo |
enddo |
282 |
enddo |
enddo |
283 |
enddo |
enddo |
284 |
|
|
285 |
|
if(cumfric) then |
286 |
|
C Cumulus Friction - load u and v wind components into tracer array |
287 |
|
C------------------------------------------------------------------ |
288 |
|
do L = 1,lm |
289 |
|
do indx = 1,im*jm |
290 |
|
ugather(indx,L,ntracerin-ptracer+1) = uz(pblindex(indx),1,L) |
291 |
|
ugather(indx,L,ntracerin-ptracer+2) = vz(pblindex(indx),1,L) |
292 |
|
enddo |
293 |
|
enddo |
294 |
|
|
295 |
|
endif |
296 |
|
|
297 |
c bump the counter for number of calls to convection |
c bump the counter for number of calls to convection |
298 |
c -------------------------------------------------- |
c -------------------------------------------------- |
299 |
iras = iras + 1 |
iras = iras + 1 |
306 |
do l=1,lm |
do l=1,lm |
307 |
do j=1,jm |
do j=1,jm |
308 |
do i=1,im |
do i=1,im |
309 |
|
dumoist(i,j,l) = 0. |
310 |
|
dvmoist(i,j,l) = 0. |
311 |
dtmoist(i,j,l) = 0. |
dtmoist(i,j,l) = 0. |
312 |
do nt = 1,ntracer |
do nt = 1,ntracerin |
313 |
dqmoist(i,j,l,nt) = 0. |
dqmoist(i,j,l,nt) = 0. |
314 |
enddo |
enddo |
315 |
enddo |
enddo |
337 |
CALL STRINT( levgather, pbl ,im*jm,ISTRIP,1 ,NN ) |
CALL STRINT( levgather, pbl ,im*jm,ISTRIP,1 ,NN ) |
338 |
|
|
339 |
do nt = 1,ntracer-ptracer |
do nt = 1,ntracer-ptracer |
340 |
call strip ( ugather(1,1,nt), ul(1,1,nt),im*jm,istrip,lm,nn ) |
call strip ( ugather(1,1,nt), ul(1,1,nt),im*jm,istrip,lm,nn ) |
341 |
enddo |
enddo |
342 |
|
|
343 |
C ********************************************************************** |
C ********************************************************************** |
370 |
endif |
endif |
371 |
enddo |
enddo |
372 |
|
|
|
|
|
373 |
C Initiate a do-loop around RAS for the number of different |
C Initiate a do-loop around RAS for the number of different |
374 |
C sub-cloud layer depths in this strip |
C sub-cloud layer depths in this strip |
375 |
C --If all subcloud depths are the same, execute loop once |
C --If all subcloud depths are the same, execute loop once |
505 |
enddo |
enddo |
506 |
|
|
507 |
CALL RAS ( NN,istrip,nindeces(nsubcl),NLRAS,NLTOP,lm,TMSTP |
CALL RAS ( NN,istrip,nindeces(nsubcl),NLRAS,NLTOP,lm,TMSTP |
508 |
1, UL(num,1,1),ntracer-ptracer,TH(num,NLTOP),SHL(num,NLTOP) |
1, UL(num,1,1),ntracedim,ntracex,TH(num,NLTOP),SHL(num,NLTOP) |
509 |
2, TMP4(num,NLTOP), TMP5(num,NLTOP),rnd, ncrnd, PCPEN(num,NLTOP) |
2, TMP4(num,NLTOP), TMP5(num,NLTOP),rnd, ncrnd, PCPEN(num,NLTOP) |
510 |
3, CLBOTH(num,NLTOP), CLFRAC(num,NLTOP) |
3, CLBOTH(num,NLTOP), CLFRAC(num,NLTOP) |
511 |
4, cldmas(num,nltop), detrain(num,nltop) |
4, cldmas(num,nltop), detrain(num,nltop) |
631 |
|
|
632 |
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, |
633 |
. PLK,TH,TMP1,TMP2,TMP3,ITMP1,ITMP2,PCNET,PRECIP, |
. PLK,TH,TMP1,TMP2,TMP3,ITMP1,ITMP2,PCNET,PRECIP, |
634 |
. CLSBTH,TMSTP,1.,cp,grav,alhl,gamfac,cldlz,rhcrit,offset,alpha) |
. CLSBTH,TMSTP,one,cp,grav,alhl,gamfac,cldlz,rhcrit,offset,alpha) |
635 |
|
|
636 |
C ********************************************************************** |
C ********************************************************************** |
637 |
C **** TENDENCY UPDATES **** |
C **** TENDENCY UPDATES **** |
789 |
. cldsr(1,1,L),im*jm) |
. cldsr(1,1,L),im*jm) |
790 |
enddo |
enddo |
791 |
|
|
792 |
c Tracers |
c General Tracers |
793 |
c ------- |
c --------------- |
794 |
do nt = 1,ntracer-ptracer |
do nt = 1,ntracerin-ptracer |
795 |
do L = 1,lm |
do L = 1,lm |
796 |
call back2grd (delugather(1,L,nt),pblindex, |
call back2grd (delugather(1,L,nt),pblindex, |
797 |
. dqmoist(1,1,L,ptracer+nt),im*jm) |
. dqmoist(1,1,L,ptracer+nt),im*jm) |
798 |
enddo |
enddo |
799 |
enddo |
enddo |
800 |
|
|
801 |
|
if(cumfric) then |
802 |
|
|
803 |
|
c U and V for cumulus friction |
804 |
|
c ---------------------------- |
805 |
|
do L = 1,lm |
806 |
|
call back2grd (delugather(1,L,ntracerin-ptracer+1),pblindex, |
807 |
|
. dumoist(1,1,L),im*jm) |
808 |
|
call back2grd (delugather(1,L,ntracerin-ptracer+2),pblindex, |
809 |
|
. dvmoist(1,1,L),im*jm) |
810 |
|
enddo |
811 |
|
|
812 |
|
C Remove pi-weighting for u and v tendencies |
813 |
|
do j = 1,jm |
814 |
|
do i = 1,im |
815 |
|
tmpimjm(i,j) = 1./pz(i,j) |
816 |
|
enddo |
817 |
|
enddo |
818 |
|
do L = 1,lm |
819 |
|
do j = 1,jm |
820 |
|
do i = 1,im |
821 |
|
dumoist(i,j,L) = dumoist(i,j,L) * tmpimjm(i,j) |
822 |
|
dvmoist(i,j,L) = dvmoist(i,j,L) * tmpimjm(i,j) |
823 |
|
enddo |
824 |
|
enddo |
825 |
|
enddo |
826 |
|
|
827 |
|
|
828 |
|
endif |
829 |
|
|
830 |
C ********************************************************************** |
C ********************************************************************** |
831 |
C BUMP DIAGNOSTICS |
C BUMP DIAGNOSTICS |
832 |
C ********************************************************************** |
C ********************************************************************** |
833 |
|
|
834 |
|
|
835 |
c Sub-Cloud Layer |
c Sub-Cloud Layer |
836 |
c ------------------------- |
c ------------------------- |
837 |
if( ipsubcld.ne.0 ) then |
if( ipsubcld.ne.0 ) then |
863 |
c ---------------------------- |
c ---------------------------- |
864 |
if(imoistt.gt.0) then |
if(imoistt.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,imoistt+L-1,bi,bj) = qdiag(i,1,imoistt+L-1,bi,bj) + |
do i = 1,im |
868 |
. (dtmoist(i,1,L)*sday*pkzgather(i,L)/pz(i,1)) |
indgath = (j-1)*im + i |
869 |
|
qdiag(i,j,imoistt+L-1,bi,bj) = qdiag(i,j,imoistt+L-1,bi,bj) + |
870 |
|
. (dtmoist(i,j,L)*sday*pkzgather(indgath,L)/pz(i,j)) |
871 |
|
enddo |
872 |
enddo |
enddo |
873 |
enddo |
enddo |
874 |
endif |
endif |
886 |
enddo |
enddo |
887 |
endif |
endif |
888 |
|
|
889 |
|
c Moist Processes Change in U-Momentum (Cumulus Friction) |
890 |
|
c ------------------------------------------------------ |
891 |
|
if(iudiag1.gt.0) then |
892 |
|
do L = 1,lm |
893 |
|
do j = 1,jm |
894 |
|
do i = 1,im |
895 |
|
indgath = (j-1)*im + i |
896 |
|
qdiag(i,j,iudiag1+L-1,bi,bj) = qdiag(i,j,iudiag1+L-1,bi,bj) + |
897 |
|
. dumoist(i,j,L)*sday |
898 |
|
enddo |
899 |
|
enddo |
900 |
|
enddo |
901 |
|
endif |
902 |
|
|
903 |
|
c Moist Processes Change in V-Momentum (Cumulus Friction) |
904 |
|
c ------------------------------------------------------ |
905 |
|
if(iudiag2.gt.0) then |
906 |
|
do L = 1,lm |
907 |
|
do j = 1,jm |
908 |
|
do i = 1,im |
909 |
|
indgath = (j-1)*im + i |
910 |
|
qdiag(i,j,iudiag2+L-1,bi,bj) = qdiag(i,j,iudiag2+L-1,bi,bj) + |
911 |
|
. dvmoist(i,j,L)*sday |
912 |
|
enddo |
913 |
|
enddo |
914 |
|
enddo |
915 |
|
endif |
916 |
|
|
917 |
c Cloud Mass Flux |
c Cloud Mass Flux |
918 |
c --------------- |
c --------------- |
919 |
if(icldmas.gt.0) then |
if(icldmas.gt.0) then |
920 |
do L = 1,lm |
do L = 1,lm |
921 |
do i = 1,im*jm |
do j = 1,jm |
922 |
qdiag(i,1,icldmas+L-1,bi,bj) = qdiag(i,1,icldmas+L-1,bi,bj) + |
do i = 1,im |
923 |
. tmpgather(i,L) |
indgath = (j-1)*im + i |
924 |
|
qdiag(i,j,icldmas+L-1,bi,bj) = qdiag(i,j,icldmas+L-1,bi,bj) + |
925 |
|
. tmpgather(indgath,L) |
926 |
|
enddo |
927 |
enddo |
enddo |
928 |
enddo |
enddo |
929 |
endif |
endif |
932 |
c ------------------------- |
c ------------------------- |
933 |
if(idtrain.gt.0) then |
if(idtrain.gt.0) then |
934 |
do L = 1,lm |
do L = 1,lm |
935 |
do i = 1,im*jm |
do j = 1,jm |
936 |
qdiag(i,1,idtrain+L-1,bi,bj) = qdiag(i,1,idtrain+L-1,bi,bj) + |
do i = 1,im |
937 |
. pkegather(i,L) |
indgath = (j-1)*im + i |
938 |
|
qdiag(i,j,idtrain+L-1,bi,bj) = qdiag(i,j,idtrain+L-1,bi,bj) + |
939 |
|
. pkegather(indgath,L) |
940 |
|
enddo |
941 |
enddo |
enddo |
942 |
enddo |
enddo |
943 |
endif |
endif |
946 |
c -------------------------------------- |
c -------------------------------------- |
947 |
if(idtls.gt.0) then |
if(idtls.gt.0) then |
948 |
do L = 1,lm |
do L = 1,lm |
949 |
do i = 1,im*jm |
do j = 1,jm |
950 |
qdiag(i,1,idtls+L-1,bi,bj) = qdiag(i,1,idtls+L-1,bi,bj) + |
do i = 1,im |
951 |
. deltrnev(i,L) |
indgath = (j-1)*im + i |
952 |
|
qdiag(i,j,idtls+L-1,bi,bj) = qdiag(i,j,idtls+L-1,bi,bj) + |
953 |
|
. deltrnev(indgath,L) |
954 |
|
enddo |
955 |
enddo |
enddo |
956 |
enddo |
enddo |
957 |
endif |
endif |
960 |
c ----------------------------------------- |
c ----------------------------------------- |
961 |
if(idqls.gt.0) then |
if(idqls.gt.0) then |
962 |
do L = 1,lm |
do L = 1,lm |
963 |
do i = 1,im*jm |
do j = 1,jm |
964 |
qdiag(i,1,idqls+L-1,bi,bj) = qdiag(i,1,idqls+L-1,bi,bj) + |
do i = 1,im |
965 |
. delqrnev(i,L) |
indgath = (j-1)*im + i |
966 |
|
qdiag(i,j,idqls+L-1,bi,bj) = qdiag(i,j,idqls+L-1,bi,bj) + |
967 |
|
. delqrnev(indgath,L) |
968 |
|
enddo |
969 |
enddo |
enddo |
970 |
enddo |
enddo |
971 |
endif |
endif |
986 |
c Convective Precipitation |
c Convective Precipitation |
987 |
c ------------------------ |
c ------------------------ |
988 |
if(iprecon.gt.0) then |
if(iprecon.gt.0) then |
989 |
do i = 1,im*jm |
do j = 1,jm |
990 |
qdiag(i,1,iprecon,bi,bj) = qdiag(i,1,iprecon,bi,bj) + |
do i = 1,im |
991 |
. raincgath(i)*sday*tminv |
indgath = (j-1)*im + i |
992 |
|
qdiag(i,j,iprecon,bi,bj) = qdiag(i,j,iprecon,bi,bj) + |
993 |
|
. raincgath(indgath)*sday*tminv |
994 |
|
enddo |
995 |
enddo |
enddo |
996 |
endif |
endif |
997 |
|
|
1094 |
enddo |
enddo |
1095 |
enddo |
enddo |
1096 |
|
|
1097 |
c Compute Instantanious Total 2-D Cloud Fraction |
c Compute Instantaneous Total 2-D Cloud Fraction |
1098 |
c ---------------------------------------------- |
c ---------------------------------------------- |
1099 |
do j = 1,jm |
do j = 1,jm |
1100 |
do i = 1,im |
do i = 1,im |
1145 |
nlwcld = nlwcld + 1 |
nlwcld = nlwcld + 1 |
1146 |
nswcld = nswcld + 1 |
nswcld = nswcld + 1 |
1147 |
|
|
1148 |
|
#ifdef ALLOW_DIAGNOSTICS |
1149 |
|
if( (bi.eq.1) .and. (bj.eq.1) ) then |
1150 |
nmoistt = nmoistt + 1 |
nmoistt = nmoistt + 1 |
1151 |
nmoistq = nmoistq + 1 |
nmoistq = nmoistq + 1 |
1152 |
npreacc = npreacc + 1 |
npreacc = npreacc + 1 |
1157 |
|
|
1158 |
ndtls = ndtls + 1 |
ndtls = ndtls + 1 |
1159 |
ndqls = ndqls + 1 |
ndqls = ndqls + 1 |
1160 |
|
|
1161 |
|
nudiag1 = nudiag1 + 1 |
1162 |
|
nudiag2 = nudiag2 + 1 |
1163 |
|
|
1164 |
|
endif |
1165 |
|
#endif |
1166 |
|
|
1167 |
RETURN |
RETURN |
1168 |
END |
END |
1169 |
SUBROUTINE RAS( NN, LEN, LENC, K, NLTOP, nlayr, DT |
SUBROUTINE RAS( NN, LNG, LENC, K, NLTOP, nlayr, DT |
1170 |
*, UOI, ntracer, POI, QOI, PRS, PRJ, rnd, ncrnd |
*, UOI, ntracedim, ntracer, POI, QOI, PRS, PRJ, rnd, ncrnd |
1171 |
*, RAINS, CLN, CLF, cldmas, detrain |
*, RAINS, CLN, CLF, cldmas, detrain |
1172 |
*, cp,grav,rkappa,alhl,rhfrac,rasmax ) |
*, cp,grav,rkappa,alhl,rhfrac,rasmax ) |
1173 |
C |
C |
1174 |
C********************************************************************* |
C********************************************************************* |
1175 |
C********************* SUBROUTINE RAS ***************************** |
C********************* SUBROUTINE RAS ***************************** |
1179 |
implicit none |
implicit none |
1180 |
|
|
1181 |
C Argument List |
C Argument List |
1182 |
integer nn,len,lenc,k,nltop,nlayr |
integer nn,lng,lenc,k,nltop,nlayr |
1183 |
integer ntracer |
integer ntracedim, ntracer |
1184 |
integer ncrnd |
integer ncrnd |
1185 |
real dt |
_RL dt |
1186 |
real UOI(len,nlayr,ntracer), POI(len,K) |
_RL UOI(lng,nlayr,ntracedim), POI(lng,K) |
1187 |
real QOI(len,K), PRS(len,K+1), PRJ(len,K+1) |
_RL QOI(lng,K), PRS(lng,K+1), PRJ(lng,K+1) |
1188 |
real rnd(ncrnd) |
_RL rnd(ncrnd) |
1189 |
real RAINS(len,K), CLN(len,K), CLF(len,K) |
_RL RAINS(lng,K), CLN(lng,K), CLF(lng,K) |
1190 |
real cldmas(len,K), detrain(len,K) |
_RL cldmas(lng,K), detrain(lng,K) |
1191 |
real cp,grav,rkappa,alhl,rhfrac(len),rasmax |
_RL cp,grav,rkappa,alhl,rhfrac(lng),rasmax |
1192 |
|
|
1193 |
C Local Variables |
C Local Variables |
1194 |
real TCU(len,K), QCU(len,K) |
_RL TCU(lng,K), QCU(lng,K) |
1195 |
real ucu(len,K,ntracer) |
_RL ucu(lng,K,ntracedim) |
1196 |
real ALF(len,K), BET(len,K), GAM(len,K) |
_RL ALF(lng,K), BET(lng,K), GAM(lng,K) |
1197 |
*, ETA(len,K), HOI(len,K) |
*, ETA(lng,K), HOI(lng,K) |
1198 |
*, PRH(len,K), PRI(len,K) |
*, PRH(lng,K), PRI(lng,K) |
1199 |
real HST(len,K), QOL(len,K), GMH(len,K) |
_RL HST(lng,K), QOL(lng,K), GMH(lng,K) |
1200 |
|
|
1201 |
real TX1(len), TX2(len), TX3(len), TX4(len), TX5(len) |
_RL TX1(lng), TX2(lng), TX3(lng), TX4(lng), TX5(lng) |
1202 |
*, TX6(len), TX7(len), TX8(len), TX9(len) |
*, TX6(lng), TX7(lng), TX8(lng), TX9(lng) |
1203 |
*, TX11(len), TX12(len), TX13(len), TX14(len,ntracer) |
*, TX11(lng), TX12(lng), TX13(lng), TX14(lng,ntracedim) |
1204 |
*, TX15(len) |
*, TX15(lng) |
1205 |
*, WFN(len) |
*, WFN(lng) |
1206 |
integer IA1(len), IA2(len), IA3(len) |
integer IA1(lng), IA2(lng), IA3(lng) |
1207 |
real cloudn(len), pcu(len) |
_RL cloudn(lng), pcu(lng) |
1208 |
|
|
1209 |
integer krmin,icm |
integer krmin,icm |
1210 |
real rknob, cmb2pa |
_RL rknob, cmb2pa |
1211 |
PARAMETER (KRMIN=01) |
PARAMETER (KRMIN=01) |
1212 |
PARAMETER (ICM=1000) |
PARAMETER (ICM=1000) |
1213 |
PARAMETER (CMB2PA=100.0) |
PARAMETER (CMB2PA=100.0) |
1214 |
PARAMETER (rknob = 10.) |
PARAMETER (rknob = 10.) |
1215 |
|
|
1216 |
integer IC(ICM), IRND(icm) |
integer IC(ICM), IRND(icm) |
1217 |
real cmass(len,K) |
_RL cmass(lng,K) |
1218 |
LOGICAL SETRAS |
LOGICAL SETRAS |
1219 |
|
integer ifound |
1220 |
|
_RL temp |
1221 |
|
_RL thbef(lng,K) |
1222 |
|
|
1223 |
integer i,L,nc,ib,nt |
integer i,L,nc,ib,nt |
1224 |
integer km1,kp1,kprv,kcr,kfx,ncmx |
integer km1,kp1,kprv,kcr,kfx,ncmx |
1225 |
real p00, crtmsf, frac, rasblf |
_RL p00, crtmsf, frac, rasblf |
1226 |
|
|
1227 |
do L = 1,k |
do L = 1,k |
1228 |
do I = 1,LENC |
do I = 1,LENC |
1237 |
C allowed to entrain into the cloud |
C allowed to entrain into the cloud |
1238 |
|
|
1239 |
CCC FRAC = 1./dt |
CCC FRAC = 1./dt |
1240 |
|
CCC FRAC = 0.5/dt |
1241 |
FRAC = 0.5/dt |
FRAC = 0.5/dt |
1242 |
|
|
1243 |
KM1 = K - 1 |
KM1 = K - 1 |
1283 |
cloudn(i) = 0.0 |
cloudn(i) = 0.0 |
1284 |
enddo |
enddo |
1285 |
|
|
1286 |
CALL CLOUD(nn,LEN, LENC, K, NLTOP, nlayr, IB, RASBLF,SETRAS,FRAC |
CALL CLOUD(nn,lng, LENC, K, NLTOP, nlayr, IB, RASBLF,SETRAS,FRAC |
1287 |
*, CP, ALHL, RKAPPA, GRAV, P00, CRTMSF |
*, CP, ALHL, RKAPPA, GRAV, P00, CRTMSF |
1288 |
*, POI, QOI, UOI, Ntracer, PRS, PRJ |
*, POI, QOI, UOI, ntracedim, Ntracer, PRS, PRJ |
1289 |
*, PCU, CLOUDN, TCU, QCU, UCU, CMASS |
*, PCU, CLOUDN, TCU, QCU, UCU, CMASS |
1290 |
*, ALF, BET, GAM, PRH, PRI, HOI, ETA |
*, ALF, BET, GAM, PRH, PRI, HOI, ETA |
1291 |
*, HST, QOL, GMH |
*, HST, QOL, GMH |
1328 |
|
|
1329 |
DO L=IB,K |
DO L=IB,K |
1330 |
DO I=1,LENC |
DO I=1,LENC |
1331 |
|
thbef(I,L) = POI(I,L) |
1332 |
POI(I,L) = POI(I,L) + TCU(I,L) * DT * rhfrac(i) |
POI(I,L) = POI(I,L) + TCU(I,L) * DT * rhfrac(i) |
1333 |
QOI(I,L) = QOI(I,L) + QCU(I,L) * DT * rhfrac(i) |
QOI(I,L) = QOI(I,L) + QCU(I,L) * DT * rhfrac(i) |
1334 |
ENDDO |
ENDDO |
1344 |
rains(I,ib) = rains(I,ib) + PCU(I)*dt * rhfrac(i) |
rains(I,ib) = rains(I,ib) + PCU(I)*dt * rhfrac(i) |
1345 |
ENDDO |
ENDDO |
1346 |
|
|
1347 |
|
do i = 1,lenc |
1348 |
|
ifound = 0 |
1349 |
|
do L = 1,k |
1350 |
|
if(tcu(i,L).ne.0.)ifound = ifound + 1 |
1351 |
|
enddo |
1352 |
|
if(ifound.ne.0) then |
1353 |
|
c print *,i,' made a cloud detraining at ',ib |
1354 |
|
do L = 1,k |
1355 |
|
temp = TCU(I,L) * DT * rhfrac(i) |
1356 |
|
c write(6,122)L,thbef(i,L),poi(i,L),temp |
1357 |
|
enddo |
1358 |
|
endif |
1359 |
|
enddo |
1360 |
|
|
1361 |
100 CONTINUE |
100 CONTINUE |
1362 |
|
|
1363 |
|
122 format(' ',i3,' TH B ',e10.3,' TH A ',e10.3,' DTH ',e10.3) |
1364 |
|
|
1365 |
c Fill Convective Cloud Fractions based on 3-D Rain Amounts |
c Fill Convective Cloud Fractions based on 3-D Rain Amounts |
1366 |
c --------------------------------------------------------- |
c --------------------------------------------------------- |
1376 |
subroutine rndcloud (iras,nrnd,rnd,myid) |
subroutine rndcloud (iras,nrnd,rnd,myid) |
1377 |
implicit none |
implicit none |
1378 |
integer n,iras,nrnd,myid |
integer n,iras,nrnd,myid |
1379 |
real random_numbx |
_RL random_numbx |
1380 |
real rnd(nrnd) |
_RL rnd(nrnd) |
1381 |
integer irm |
integer irm |
1382 |
parameter (irm = 1000) |
parameter (irm = 1000) |
1383 |
real random(irm) |
_RL random(irm) |
1384 |
integer i,mcheck,numrand,iseed,index |
integer i,mcheck,numrand,iseed,indx |
1385 |
logical first |
logical first |
1386 |
data first /.true./ |
data first /.true./ |
1387 |
integer iras0 |
integer iras0 |
1392 |
do i = 1,nrnd |
do i = 1,nrnd |
1393 |
rnd(i) = 0 |
rnd(i) = 0 |
1394 |
enddo |
enddo |
1395 |
if(first .and. myid.eq.0) print *,' NO RANDOM CLOUDS IN RAS ' |
if(first .and. myid.eq.1) print *,' NO RANDOM CLOUDS IN RAS ' |
1396 |
go to 100 |
go to 100 |
1397 |
endif |
endif |
1398 |
|
|
1401 |
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 |
1402 |
c ---------------------------------------------------------------------------- |
c ---------------------------------------------------------------------------- |
1403 |
if( first.and.(iras.gt.1) .or. iras.ne.iras0+1 )then |
if( first.and.(iras.gt.1) .or. iras.ne.iras0+1 )then |
1404 |
if( myid.eq.0 ) print *, 'Recreating Rand Numb Array in RNDCLOUD' |
print *,' first ',first,' iras ',iras,' iras0 ',iras0 |
1405 |
if( myid.eq.0 ) print *, 'IRAS: ',iras,' IRAS0: ',iras0 |
if( myid.eq.1 ) print *, 'Recreating Rand Numb Array in RNDCLOUD' |
1406 |
|
if( myid.eq.1 ) print *, 'IRAS: ',iras,' IRAS0: ',iras0 |
1407 |
numrand = mod(iras,irm/nrnd) * nrnd |
numrand = mod(iras,irm/nrnd) * nrnd |
1408 |
iseed = iras * nrnd - numrand |
iseed = iras * nrnd - numrand |
1409 |
call random_seedx(iseed) |
call random_seedx(iseed) |
1410 |
do i = 1,irm |
do i = 1,irm |
1411 |
random(i) = random_numbx() |
random(i) = random_numbx(iseed) |
1412 |
enddo |
enddo |
1413 |
index = (iras-1)*nrnd |
indx = (iras-1)*nrnd |
1414 |
|
|
1415 |
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) |
1416 |
c ---------------------------------------------------------------- |
c ---------------------------------------------------------------- |
1418 |
iseed = (iras-1)*nrnd |
iseed = (iras-1)*nrnd |
1419 |
call random_seedx(iseed) |
call random_seedx(iseed) |
1420 |
do i = 1,irm |
do i = 1,irm |
1421 |
random(i) = random_numbx() |
random(i) = random_numbx(iseed) |
1422 |
enddo |
enddo |
1423 |
index = iseed |
indx = iseed |
1424 |
|
|
1425 |
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) |
1426 |
c -------------------------------------------------------------------- |
c -------------------------------------------------------------------- |
1427 |
else |
else |
1428 |
index = (iras-1)*nrnd |
indx = (iras-1)*nrnd |
1429 |
endif |
endif |
1430 |
|
|
1431 |
index = mod(index,irm) |
indx = mod(indx,irm) |
1432 |
if( index+nrnd.gt.1000 ) index=1000-nrnd |
if( indx+nrnd.gt.1000 ) indx=1000-nrnd |
1433 |
|
|
1434 |
do n = 1,nrnd |
do n = 1,nrnd |
1435 |
rnd(n) = random(index+n) |
rnd(n) = random(indx+n) |
1436 |
enddo |
enddo |
1437 |
|
|
1438 |
100 continue |
100 continue |
1440 |
iras0 = iras |
iras0 = iras |
1441 |
return |
return |
1442 |
end |
end |
1443 |
function random_numbx() |
function random_numbx(iseed) |
1444 |
implicit none |
implicit none |
1445 |
real random_numbx |
integer iseed |
1446 |
|
real *8 seed,port_rand |
1447 |
|
_RL random_numbx |
1448 |
|
random_numbx = 0 |
1449 |
#ifdef CRAY |
#ifdef CRAY |
1450 |
real ranf |
_RL ranf |
1451 |
random_numbx = ranf() |
random_numbx = ranf() |
1452 |
#endif |
#else |
1453 |
#ifdef SGI |
#ifdef SGI |
1454 |
real rand |
_RL rand |
1455 |
random_numbx = rand() |
random_numbx = rand() |
1456 |
#endif |
#endif |
1457 |
|
random_numbx = port_rand(seed) |
1458 |
|
#endif |
1459 |
return |
return |
1460 |
end |
end |
1461 |
subroutine random_seedx (iseed) |
subroutine random_seedx (iseed) |
1471 |
#endif |
#endif |
1472 |
return |
return |
1473 |
end |
end |
1474 |
SUBROUTINE CLOUD(nn,LEN, LENC, K, NLTOP, nlayr, IC, RASALF |
SUBROUTINE CLOUD(nn,lng, LENC, K, NLTOP, nlayr, IC, RASALF |
1475 |
*, SETRAS, FRAC |
*, SETRAS, FRAC |
1476 |
*, CP, ALHL, RKAP, GRAV, P00, CRTMSF |
*, CP, ALHL, RKAP, GRAV, P00, CRTMSF |
1477 |
*, POI, QOI, UOI, Ntracer, PRS, PRJ |
*, POI, QOI, UOI, ntracedim, Ntracer, PRS, PRJ |
1478 |
*, PCU, CLN, TCU, QCU, UCU, CMASS |
*, PCU, CLN, TCU, QCU, UCU, CMASS |
1479 |
*, ALF, BET, GAM, PRH, PRI, HOL, ETA |
*, ALF, BET, GAM, PRH, PRI, HOL, ETA |
1480 |
*, HST, QOL, GMH |
*, HST, QOL, GMH |
1513 |
C Input: |
C Input: |
1514 |
C ------ |
C ------ |
1515 |
C |
C |
1516 |
C LEN : The inner dimension of update and input arrays. |
C lng : The inner dimension of update and input arrays. |
1517 |
C |
C |
1518 |
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. |
1519 |
C RAS works on the first LENC of the LEN soundings |
C RAS works on the first LENC of the lng soundings |
1520 |
C passed. This allows working on pieces of the world |
C passed. This allows working on pieces of the world |
1521 |
C say for multitasking, without declaring temporary arrays |
C say for multitasking, without declaring temporary arrays |
1522 |
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 |
1523 |
C version. An F90 version would have to allow more |
C version. An F90 version would have to allow more |
1524 |
C flexibility in the argument declarations. Obviously |
C flexibility in the argument declarations. Obviously |
1525 |
C (LENC<=LEN). |
C (LENC<=lng). |
1526 |
C |
C |
1527 |
C K : Number of vertical layers (increasing downwards). |
C K : Number of vertical layers (increasing downwards). |
1528 |
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 |
1553 |
C the detrainment layer of that cloud-type is assumed. |
C the detrainment layer of that cloud-type is assumed. |
1554 |
C Affects only cloudiness calculation. |
C Affects only cloudiness calculation. |
1555 |
C |
C |
1556 |
C POI : 2D array of dimension (LEN,K) containing potential |
C POI : 2D array of dimension (lng,K) containing potential |
1557 |
C temperature. Updated but not initialized by RAS. |
C temperature. Updated but not initialized by RAS. |
1558 |
C |
C |
1559 |
C QOI : 2D array of dimension (LEN,K) containing specific |
C QOI : 2D array of dimension (lng,K) containing specific |
1560 |
C humidity. Updated but not initialized by RAS. |
C humidity. Updated but not initialized by RAS. |
1561 |
C |
C |
1562 |
C UOI : 3D array of dimension (LEN,K,NTRACER) containing tracers |
C UOI : 3D array of dimension (lng,K,NTRACER) containing tracers |
1563 |
C Updated but not initialized by RAS. |
C Updated but not initialized by RAS. |
1564 |
C |
C |
1565 |
C PRS : 2D array of dimension (LEN,K+1) containing pressure |
C PRS : 2D array of dimension (lng,K+1) containing pressure |
1566 |
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 |
1567 |
C atmosphere to the bottom. Not modified. |
C atmosphere to the bottom. Not modified. |
1568 |
C |
C |
1569 |
C PRJ : 2D array of dimension (LEN,K+1) containing (PRS/P00) ** |
C PRJ : 2D array of dimension (lng,K+1) containing (PRS/P00) ** |
1570 |
C RKAP. i.e. Exner function at layer edges. Not modified. |
C RKAP. i.e. Exner function at layer edges. Not modified. |
1571 |
C |
C |
1572 |
C rhfrac : 1D array of dimension (LEN) containing a rel.hum. scaling |
C rhfrac : 1D array of dimension (lng) containing a rel.hum. scaling |
1573 |
C fraction. Not modified. |
C fraction. Not modified. |
1574 |
C |
C |
1575 |
C Output: |
C Output: |
1576 |
C ------- |
C ------- |
1577 |
C |
C |
1578 |
C PCU : 1D array of length LEN containing accumulated |
C PCU : 1D array of length lng containing accumulated |
1579 |
C precipitation in mm/sec. |
C precipitation in mm/sec. |
1580 |
C |
C |
1581 |
C CLN : 2D array of dimension (LEN,K) containing cloudiness |
C CLN : 2D array of dimension (lng,K) containing cloudiness |
1582 |
C Note: CLN is bumped but NOT initialized |
C Note: CLN is bumped but NOT initialized |
1583 |
C |
C |
1584 |
C TCU : 2D array of dimension (LEN,K) containing accumulated |
C TCU : 2D array of dimension (lng,K) containing accumulated |
1585 |
C convective heating (K/sec). |
C convective heating (K/sec). |
1586 |
C |
C |
1587 |
C QCU : 2D array of dimension (LEN,K) containing accumulated |
C QCU : 2D array of dimension (lng,K) containing accumulated |
1588 |
C convective drying (kg/kg/sec). |
C convective drying (kg/kg/sec). |
1589 |
C |
C |
1590 |
C CMASS : 2D array of dimension (LEN,K) containing the |
C CMASS : 2D array of dimension (lng,K) containing the |
1591 |
C cloud mass flux (kg/sec). Filled from cloud top |
C cloud mass flux (kg/sec). Filled from cloud top |
1592 |
C to base. |
C to base. |
1593 |
C |
C |
1607 |
C************************************************************************ |
C************************************************************************ |
1608 |
implicit none |
implicit none |
1609 |
C Argument List declarations |
C Argument List declarations |
1610 |
integer nn,LEN,LENC,K,NLTOP,nlayr,ic,ntracer |
integer nn,lng,LENC,K,NLTOP,nlayr,ic,ntracedim, ntracer |
1611 |
real rasalf |
_RL rasalf |
1612 |
LOGICAL SETRAS |
LOGICAL SETRAS |
1613 |
real frac, cp, alhl, rkap, grav, p00, crtmsf |
_RL frac, cp, alhl, rkap, grav, p00, crtmsf |
1614 |
real POI(LEN,K),QOI(LEN,K),PRS(LEN,K+1),PRJ(LEN,K+1) |
_RL POI(lng,K),QOI(lng,K),PRS(lng,K+1),PRJ(lng,K+1) |
1615 |
real uoi(len,nlayr,ntracer) |
_RL uoi(lng,nlayr,ntracedim) |
1616 |
real PCU(LENC), CLN(LEN) |
_RL PCU(LENC), CLN(lng) |
1617 |
real TCU(LEN,K), QCU(LEN,K), ucu(len,k,ntracer), CMASS(LEN,K) |
_RL TCU(lng,K),QCU(lng,K),ucu(lng,k,ntracedim),CMASS(lng,K) |
1618 |
real ALF(LEN,K), BET(LEN,K), GAM(LEN,K), PRH(LEN,K), PRI(LEN,K) |
_RL ALF(lng,K), BET(lng,K), GAM(lng,K), PRH(lng,K), PRI(lng,K) |
1619 |
real HOL(LENC,K), ETA(LENC,K), HST(LENC,K), QOL(LENC,K) |
_RL HOL(LENC,K), ETA(LENC,K), HST(LENC,K), QOL(LENC,K) |
1620 |
real GMH(LENC,K) |
_RL GMH(LENC,K) |
1621 |
real TX1(LENC), TX2(LENC), TX3(LENC), TX4(LENC) |
_RL TX1(LENC), TX2(LENC), TX3(LENC), TX4(LENC) |
1622 |
real TX5(LENC), TX6(LENC), TX7(LENC), TX8(LENC) |
_RL TX5(LENC), TX6(LENC), TX7(LENC), TX8(LENC) |
1623 |
real ALM(LENC), WFN(LENC), AKM(LENC), QS1(LENC) |
_RL ALM(LENC), WFN(LENC), AKM(LENC), QS1(LENC) |
1624 |
real WLQ(LENC), CLF(LENC) |
_RL WLQ(LENC), CLF(LENC) |
1625 |
real uht(len,ntracer) |
_RL uht(lng,ntracedim) |
1626 |
integer IA(LENC), I1(LENC),I2(LENC) |
integer IA(LENC), I1(LENC),I2(LENC) |
1627 |
real rhfrac(len) |
_RL rhfrac(lng) |
1628 |
|
|
1629 |
C Local Variables |
C Local Variables |
1630 |
real daylen,half,one,zero,cmb2pa,rhmax |
_RL daylen,half,one,zero,cmb2pa,rhmax |
1631 |
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) |
1632 |
PARAMETER (CMB2PA=100.0) |
PARAMETER (CMB2PA=100.0) |
1633 |
PARAMETER (RHMAX=0.9999) |
PARAMETER (RHMAX=0.9999) |
1634 |
real rkapp1,onebcp,albcp,onebg,cpbg,twobal |
_RL rkapp1,onebcp,albcp,onebg,cpbg,twobal |
1635 |
C |
C |
1636 |
integer nt,km1,ic1,i,L,len1,len2,isav,len11,ii |
integer nt,km1,ic1,i,L,len1,len2,isav,len11,ii |
1637 |
integer lena,lena1,lenb,tem,tem1 |
integer lena,lena1,lenb |
1638 |
|
_RL tem,tem1 |
1639 |
|
|
1640 |
c Explicit Inline Directives |
c Explicit Inline Directives |
1641 |
c -------------------------- |
c -------------------------- |
1651 |
ONEBG = 1.0 / GRAV |
ONEBG = 1.0 / GRAV |
1652 |
CPBG = CP * ONEBG |
CPBG = CP * ONEBG |
1653 |
TWOBAL = 2.0 / ALHL |
TWOBAL = 2.0 / ALHL |
1654 |
|
|
1655 |
C |
C |
1656 |
KM1 = K - 1 |
KM1 = K - 1 |
1657 |
IC1 = IC + 1 |
IC1 = IC + 1 |
1685 |
C |
C |
1686 |
C |
C |
1687 |
DO 10 L=1,K |
DO 10 L=1,K |
1688 |
DO 10 I=1,LEN |
DO 10 I=1,lng |
1689 |
TCU(I,L) = 0.0 |
TCU(I,L) = 0.0 |
1690 |
QCU(I,L) = 0.0 |
QCU(I,L) = 0.0 |
1691 |
CMASS(I,L) = 0.0 |
CMASS(I,L) = 0.0 |
1953 |
DO I=1,LENB |
DO I=1,LENB |
1954 |
II = I1(I) |
II = I1(I) |
1955 |
TEM = ETA(I,L) - ETA(I,L+1) |
TEM = ETA(I,L) - ETA(I,L+1) |
1956 |
UHT(I,NT) = UHT(I,NT) + TEM * UOI(II,L+nltop-1,NT) |
UHT(I,NT) = UHT(I,NT) + TEM * UOI(II,L+nltop-1,NT) |
1957 |
ENDDO |
ENDDO |
1958 |
ENDDO |
ENDDO |
1959 |
ENDDO |
ENDDO |
2173 |
c Compute Tracer Tendencies |
c Compute Tracer Tendencies |
2174 |
c ------------------------- |
c ------------------------- |
2175 |
do nt = 1,ntracer |
do nt = 1,ntracer |
2176 |
|
c |
2177 |
c Tracer Tendency at the Bottom Layer |
c Tracer Tendency at the Bottom Layer |
2178 |
c ----------------------------------- |
c ----------------------------------- |
2179 |
DO 995 I=1,LENB |
DO 995 I=1,LENB |
2180 |
II = I1(I) |
II = I1(I) |
2181 |
TEM = half*TX5(I) * PRI(II,K) |
TEM = half*TX5(I) * PRI(II,K) |
2182 |
TX1(I) = (UOI(II,KM1+nltop-1,nt) - UOI(II,K+nltop-1,nt)) |
TX1(I) = ( UOI(II,KM1+nltop-1,nt) - UOI(II,K+nltop-1,nt)) |
2183 |
ucu(II,K,nt) = TEM * TX1(I) |
ucu(II,K,nt) = TEM * TX1(I) |
2184 |
995 CONTINUE |
995 CONTINUE |
2185 |
|
c |
2186 |
c Tracer Tendency at all other Levels |
c Tracer Tendency at all other Levels |
2187 |
c ----------------------------------- |
c ----------------------------------- |
2188 |
DO 1020 L=KM1,IC1,-1 |
DO 1020 L=KM1,IC1,-1 |
2211 |
II = I1(I) |
II = I1(I) |
2212 |
ucu(II,IC,nt) = TX1(I) |
ucu(II,IC,nt) = TX1(I) |
2213 |
1040 CONTINUE |
1040 CONTINUE |
2214 |
|
|
2215 |
enddo |
enddo |
2216 |
C |
C |
2217 |
C PENETRATIVE CONVECTION CALCULATION OVER |
C PENETRATIVE CONVECTION CALCULATION OVER |
2219 |
|
|
2220 |
RETURN |
RETURN |
2221 |
END |
END |
2222 |
SUBROUTINE RNCL(LEN, PL, RNO, CLF) |
SUBROUTINE RNCL(lng, PL, RNO, CLF) |
2223 |
C |
C |
2224 |
C********************************************************************* |
C********************************************************************* |
2225 |
C********************** Relaxed Arakawa-Schubert ********************* |
C********************** Relaxed Arakawa-Schubert ********************* |
2228 |
C********************************************************************* |
C********************************************************************* |
2229 |
implicit none |
implicit none |
2230 |
C Argument List declarations |
C Argument List declarations |
2231 |
integer len |
integer lng |
2232 |
real PL(LEN), RNO(LEN), CLF(LEN) |
_RL PL(lng), RNO(lng), CLF(lng) |
2233 |
|
|
2234 |
C Local Variables |
C Local Variables |
2235 |
real p5,p8,pt8,pt2,pfac,p4,p6,p7,p9,cucld,cfac |
_RL p5,p8,pt8,pt2,pfac,p4,p6,p7,p9,cucld,cfac |
2236 |
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) |
2237 |
PARAMETER (PFAC=PT2/(P8-P5)) |
PARAMETER (PFAC=PT2/(P8-P5)) |
2238 |
PARAMETER (P4=400.0, P6=401.0) |
PARAMETER (P4=400.0, P6=401.0) |
2241 |
|
|
2242 |
integer i |
integer i |
2243 |
C |
C |
2244 |
DO 10 I=1,LEN |
DO 10 I=1,lng |
2245 |
rno(i) = 1.0 |
rno(i) = 1.0 |
2246 |
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)) ) |
2247 |
|
|
2268 |
C |
C |
2269 |
RETURN |
RETURN |
2270 |
END |
END |
2271 |
SUBROUTINE ACRITN ( LEN,PL,PLB,ACR ) |
SUBROUTINE ACRITN ( lng,PL,PLB,ACR ) |
2272 |
|
|
2273 |
C********************************************************************* |
C********************************************************************* |
2274 |
C********************** Relaxed Arakawa-Schubert ********************* |
C********************** Relaxed Arakawa-Schubert ********************* |
2281 |
C********************************************************************* |
C********************************************************************* |
2282 |
implicit none |
implicit none |
2283 |
C Argument List declarations |
C Argument List declarations |
2284 |
integer len |
integer lng |
2285 |
real PL(LEN), PLB(LEN), ACR(LEN) |
_RL PL(lng), PLB(lng), ACR(lng) |
2286 |
|
|
2287 |
C Local variables |
C Local variables |
2288 |
integer lma |
integer lma |
2289 |
parameter (lma=18) |
parameter (lma=18) |
2290 |
real p(lma) |
_RL p(lma) |
2291 |
real a(lma) |
_RL a(lma) |
2292 |
integer i,L |
integer i,L |
2293 |
real temp |
_RL temp |
2294 |
|
|
2295 |
data p / 93.81, 111.65, 133.46, 157.80, 186.51, |
data p / 93.81, 111.65, 133.46, 157.80, 186.51, |
2296 |
. 219.88, 257.40, 301.21, 352.49, 409.76, |
. 219.88, 257.40, 301.21, 352.49, 409.76, |
2304 |
|
|
2305 |
|
|
2306 |
do L=1,lma-1 |
do L=1,lma-1 |
2307 |
do i=1,len |
do i=1,lng |
2308 |
if( pl(i).ge.p(L) .and. |
if( pl(i).ge.p(L) .and. |
2309 |
. pl(i).le.p(L+1)) then |
. pl(i).le.p(L+1)) then |
2310 |
temp = ( pl(i)-p(L) )/( p(L+1)-p(L) ) |
temp = ( pl(i)-p(L) )/( p(L+1)-p(L) ) |
2313 |
enddo |
enddo |
2314 |
enddo |
enddo |
2315 |
|
|
2316 |
do i=1,len |
do i=1,lng |
2317 |
if( pl(i).lt.p(1) ) acr(i) = a(1) |
if( pl(i).lt.p(1) ) acr(i) = a(1) |
2318 |
if( pl(i).gt.p(lma) ) acr(i) = a(lma) |
if( pl(i).gt.p(lma) ) acr(i) = a(lma) |
2319 |
enddo |
enddo |
2320 |
|
|
2321 |
do i=1,len |
do i=1,lng |
2322 |
acr(i) = acr(i) * (plb(i)-pl(i)) |
acr(i) = acr(i) * (plb(i)-pl(i)) |
2323 |
enddo |
enddo |
2324 |
|
|
2331 |
implicit none |
implicit none |
2332 |
C Argument List declarations |
C Argument List declarations |
2333 |
integer nn,irun,nlay |
integer nn,irun,nlay |
2334 |
real TL(IRUN,NLAY),QL(IRUN,NLAY),RAIN(IRUN,NLAY), |
_RL TL(IRUN,NLAY),QL(IRUN,NLAY),RAIN(IRUN,NLAY), |
2335 |
. PL(IRUN,NLAY),CLFRAC(IRUN,NLAY),SP(IRUN),TEMP1(IRUN,NLAY), |
. PL(IRUN,NLAY),CLFRAC(IRUN,NLAY),SP(IRUN),TEMP1(IRUN,NLAY), |
2336 |
. TEMP2(IRUN,NLAY),PLKE(IRUN,NLAY+1), |
. TEMP2(IRUN,NLAY),PLKE(IRUN,NLAY+1), |
2337 |
. RCON(IRUN),RLAR(IRUN),DP(IRUN,NLAY),PLK(IRUN,NLAY),TH(IRUN,NLAY), |
. RCON(IRUN),RLAR(IRUN),DP(IRUN,NLAY),PLK(IRUN,NLAY),TH(IRUN,NLAY), |
2338 |
. TEMP3(IRUN,NLAY) |
. TEMP3(IRUN,NLAY) |
2339 |
integer ITMP1(IRUN,NLAY),ITMP2(IRUN,NLAY) |
integer ITMP1(IRUN,NLAY),ITMP2(IRUN,NLAY) |
2340 |
real CLSBTH(IRUN,NLAY) |
_RL CLSBTH(IRUN,NLAY) |
2341 |
real tmscl,tmfrc,cp,gravity,alhl,gamfac,offset,alpha |
_RL tmscl,tmfrc,cp,gravity,alhl,gamfac,offset,alpha |
2342 |
real cldlz(irun,nlay) |
_RL cldlz(irun,nlay) |
2343 |
real rhcrit(irun,nlay) |
_RL rhcrit(irun,nlay) |
2344 |
C |
C |
2345 |
C Local Variables |
C Local Variables |
2346 |
real zm1p04,zero,two89,zp44,zp01,half,zp578,one,thousand,z3600 |
_RL zm1p04,zero,two89,zp44,zp01,half,zp578,one,thousand,z3600 |
2347 |
real zp1,zp001 |
_RL zp1,zp001 |
2348 |
PARAMETER (ZM1P04 = -1.04E-4 ) |
PARAMETER (ZM1P04 = -1.04E-4 ) |
2349 |
PARAMETER (ZERO = 0.) |
PARAMETER (ZERO = 0.) |
2350 |
PARAMETER (TWO89= 2.89E-5) |
PARAMETER (TWO89= 2.89E-5) |
2358 |
PARAMETER ( THOUSAND = 1000.) |
PARAMETER ( THOUSAND = 1000.) |
2359 |
PARAMETER ( Z3600 = 3600.) |
PARAMETER ( Z3600 = 3600.) |
2360 |
C |
C |
2361 |
real EVP9(IRUN,NLAY) |
_RL EVP9(IRUN,NLAY) |
2362 |
real water(irun),crystal(irun) |
_RL water(irun),crystal(irun) |
2363 |
real watevap(irun),iceevap(irun) |
_RL watevap(irun),iceevap(irun) |
2364 |
real fracwat,fracice, tice,rh,fact,dum |
_RL fracwat,fracice, tice,rh,fact,dum |
2365 |
real rainmax(irun) |
_RL rainmax(irun) |
2366 |
real getcon,rphf,elocp,cpog,relax |
_RL getcon,rphf,elocp,cpog,relax |
2367 |
real exparg,arearat,rpow |
_RL exparg,arearat,rpow |
2368 |
|
|
2369 |
integer i,L,n,nlaym1,irnlay,irnlm1 |
integer i,L,n,nlaym1,irnlay,irnlm1 |
2370 |
|
|
2572 |
implicit none |
implicit none |
2573 |
integer irun,irise |
integer irun,irise |
2574 |
|
|
2575 |
real th(irun,irise) |
_RL th(irun,irise) |
2576 |
real q(irun,irise) |
_RL q(irun,irise) |
2577 |
real plk(irun,irise) |
_RL plk(irun,irise) |
2578 |
real pl(irun,irise) |
_RL pl(irun,irise) |
2579 |
real plke(irun,irise+1) |
_RL plke(irun,irise+1) |
2580 |
|
|
2581 |
real cloud(irun,irise) |
_RL cloud(irun,irise) |
2582 |
real cldwat(irun,irise) |
_RL cldwat(irun,irise) |
2583 |
real qs(irun,irise) |
_RL qs(irun,irise) |
2584 |
|
|
2585 |
real cp, alhl, getcon, akap |
_RL cp, alhl, getcon, akap |
2586 |
real ratio, temp, elocp |
_RL ratio, temp, elocp |
2587 |
real rhcrit,rh,dum |
_RL rhcrit,rh,dum |
2588 |
integer i,L |
integer i,L |
2589 |
|
|
2590 |
real rhc(irun,irise) |
_RL rhc(irun,irise) |
2591 |
real offset,alpha |
_RL offset,alpha |
2592 |
|
|
2593 |
c Explicit Inline Directives |
c Explicit Inline Directives |
2594 |
c -------------------------- |
c -------------------------- |
2634 |
subroutine ctei ( th,q,cldfrc,cldwat,pl,plk,plke,im,lm ) |
subroutine ctei ( th,q,cldfrc,cldwat,pl,plk,plke,im,lm ) |
2635 |
implicit none |
implicit none |
2636 |
integer im,lm |
integer im,lm |
2637 |
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) |
2638 |
real plk(im,lm),pl(im,lm),cldfrc(im,lm) |
_RL plk(im,lm),pl(im,lm),cldfrc(im,lm) |
2639 |
integer i,L |
integer i,L |
2640 |
real getcon,cp,alhl,elocp,cpoel,t,p,s,qs,dqsdt,dq |
_RL getcon,cp,alhl,elocp,cpoel,t,p,s,qs,dqsdt,dq |
2641 |
real k,krd,kmm,f |
_RL k,krd,kmm,f |
2642 |
|
|
2643 |
cp = getcon('CP') |
cp = getcon('CP') |
2644 |
alhl = getcon('LATENT HEAT COND') |
alhl = getcon('LATENT HEAT COND') |
2675 |
subroutine back2grd(gathered,indeces,scattered,irun) |
subroutine back2grd(gathered,indeces,scattered,irun) |
2676 |
implicit none |
implicit none |
2677 |
integer i,irun,indeces(irun) |
integer i,irun,indeces(irun) |
2678 |
real gathered(irun),scattered(irun) |
_RL gathered(irun),scattered(irun) |
2679 |
real temp(irun) |
_RL temp(irun) |
2680 |
do i = 1,irun |
do i = 1,irun |
2681 |
temp(indeces(i)) = gathered(i) |
temp(indeces(i)) = gathered(i) |
2682 |
enddo |
enddo |