72 subroutine gwdc(im,ix,iy,km,lat,u1,v1,t1,q1,
73 & pmid1,pint1,dpmid1,qmax,ktop,kbot,kcnv,cldf,
74 & grav,cp,rd,fv,dlength,lprnt,ipr,fhour,
75 & utgwc,vtgwc,tauctx,taucty)
85 USE machine
, ONLY : kind_phys
111 integer im, ix, iy, km, lat, ipr
112 integer ktop(im),kbot(im),kcnv(im)
114 real(kind=kind_phys) grav,cp,rd,fv,fhour,fhourpr
115 real(kind=kind_phys),
dimension(ix) :: qmax
117 real(kind=kind_phys),
dimension(im) :: cldf,dlength
118 real(kind=kind_phys),
dimension(ix,km) :: u1,v1,t1,q1,
121 real(kind=kind_phys),
dimension(iy,km) :: utgwc,vtgwc
122 real(kind=kind_phys),
dimension(ix,km+1) :: pint1
179 integer i,ii,k,k1,kk,kb,ilev,npt,kcb,kcldm,npr
180 integer,
dimension(im) :: ipt
182 real(kind=kind_phys) tem, tem1, tem2, qtem, wtgwc, tauct,
183 & windcltop, shear, nonlinct, nonlin, nonlins,
184 & n2, dtdp, crit1, crit2, pi, p1, p2,
188 integer,
allocatable :: kcldtop(:),kcldbot(:)
189 logical,
allocatable :: do_gwc(:)
190 real(kind=kind_phys),
allocatable :: tauctxl(:), tauctyl(:),
191 & gwdcloc(:), break(:),
194 & cosphi(:), sinphi(:),
195 & xstress(:), ystress(:),
196 & ucltop(:), vcltop(:),
198 & dlen(:), gqmcldlen(:)
203 real(kind=kind_phys),
allocatable :: plnint(:,:),
204 & taugwci(:,:), bruni(:,:),
205 & rhoi(:,:), basicui(:,:),
206 & ti(:,:), riloc(:,:),
207 & rimin(:,:), pint(:,:)
209 real(kind=kind_phys),
allocatable ::
212 & utgwcl(:,:), vtgwcl(:,:),
213 & basicum(:,:), u(:,:),v(:,:),
215 & pmid(:,:), dpmid(:,:),
217 & brunm(:,:), rhom(:,:)
243 real(kind=kind_phys),
parameter ::
244 & c1=1.41, c2=-0.38, ricrit=0.25
245 &, n2min=1.e-32, zero=0.0, one=1.0
247 &, taumin=1.0e-20, tauctmax=-5.
248 &, qmin=1.0e-10, shmin=1.0e-20
249 &, rimax=1.0e+20, rimaxm=0.99e+20
250 &, rimaxp=1.01e+20, rilarge=0.9e+20
251 &, riminx=-1.0e+20, riminm=-1.01e+20
252 &, riminp=-0.99e+20, rismall=-0.9e+20
258 if (kcnv(i) /= 0 .and. qmax(i) > zero)
then
328 allocate (kcldtop(npt), kcldbot(npt), do_gwc(npt))
329 allocate (tauctxl(npt), tauctyl(npt),
330 & gwdcloc(npt), break(npt), critic(npt), cosphi(npt),
331 & sinphi(npt), xstress(npt), ystress(npt), wrk(npt),
332 & ucltop(npt), vcltop(npt),dlen(npt), gqmcldlen(npt))
337 allocate (plnint(npt,2:km+1),
338 & taugwci(npt,km+1), bruni(npt,km+1),
339 & rhoi(npt,km+1), basicui(npt,km+1),
340 & ti(npt,km+1), riloc(npt,km+1),
341 & rimin(npt,km+1), pint(npt,km+1))
347 & utgwcl(npt,km), vtgwcl(npt,km),
348 & basicum(npt,km), u(npt,km), v(npt,km),
349 & t(npt,km), spfh(npt,km), pmid(npt,km),
352 & brunm(npt,km), rhom(npt,km))
364 if (ipr == ipt(i))
then
378 spfh(i,k) = max(q1(ii,k1),qmin)
379 pmid(i,k) = pmid1(ii,k1)
380 dpmid(i,k) = dpmid1(ii,k1) * onebg
383 rhom(i,k) = pmid(i,k) / (rd*t(i,k)*(1.0+fv*spfh(i,k)))
384 plnmid(i,k) = log(pmid(i,k))
398 pint(i,k) = pint1(ii,k1)
410 plnint(i,k) = log(pint(i,k))
416 kcldtop(i) = km - ktop(ii) + 1
417 kcldbot(i) = km - kbot(ii) + 1
418 dlen(i) = dlength(ii)
420 gqmcldlen(i) = grav*qmax(ii)*cldf(ii)*dlen(i)
490 rhoi(i,1) = pint(i,1)/(rd*ti(i,1))
491 bruni(i,1) = sqrt( gsqr / (cp*ti(i,1)) )
498 rhoi(i,km+1) = pint(i,km+1)/(rd*ti(i,km+1)*(1.0+fv*spfh(i,km)))
499 bruni(i,km+1) = sqrt( gsqr / (cp*ti(i,km+1)) )
512 tem1 = (plnmid(i,k)-plnint(i,k)) / (plnmid(i,k)-plnmid(i,k-1))
514 ti(i,k) = t(i,k-1) * tem1 + t(i,k) * tem2
515 qtem = spfh(i,k-1) * tem1 + spfh(i,k) * tem2
516 rhoi(i,k) = pint(i,k) / ( rd * ti(i,k)*(1.0+fv*qtem) )
517 dtdp = (t(i,k)-t(i,k-1)) / (pmid(i,k)-pmid(i,k-1))
518 n2 = gsqr / ti(i,k) * ( 1./cp - rhoi(i,k)*dtdp )
519 bruni(i,k) = sqrt(max(n2min, n2))
532 dtdp = (ti(i,k+1)-ti(i,k)) / (pint(i,k+1)-pint(i,k))
533 n2 = gsqr / t(i,k) * ( 1./cp - rhom(i,k)*dtdp )
534 brunm(i,k) = sqrt(max(n2min, n2))
591 kcldm = max(kcldm,kk)
604 windcltop = 1.0 / sqrt( ucltop(i)*ucltop(i)
605 & + vcltop(i)*vcltop(i) )
606 cosphi(i) = ucltop(i)*windcltop
607 sinphi(i) = vcltop(i)*windcltop
625 basicum(i,k) = u(i,k)*cosphi(i) + v(i,k)*sinphi(i)
640 basicui(i,1) = basicum(i,1)
641 basicui(i,km+1) = basicum(i,km)
645 tem1 = (plnmid(i,k)-plnint(i,k)) / (plnmid(i,k)-plnmid(i,k-1))
647 basicui(i,k) = basicum(i,k)*tem2 + basicum(i,k-1)*tem1
681 shear = grav*rhoi(i,k) * (basicum(i,k) - basicum(i,k-1))
682 & / (pmid(i,k) - pmid(i,k-1))
683 if ( abs(shear) < shmin )
then
686 tem = bruni(i,k) / shear
687 riloc(i,k) = tem * tem
688 if (riloc(i,k) >= rimax ) riloc(i,k) = rilarge
694 riloc(i,1) = riloc(i,2)
695 riloc(i,km+1) = riloc(i,km)
809 if ( abs(basicui(i,kk)) > zero .and. riloc(i,kk) > ricrit)
then
813 nonlinct = gqmcldlen(i) / (bruni(i,kk)*t(i,kk)*tem1)
816 tauct = - rhom(i,kk) * tem * tem1 * c1 * tem2 * tem2
817 & / (bruni(i,kk)*dlen(i))
819 tauct = max(tauctmax, tauct)
820 tauctxl(i) = tauct * cosphi(i)
821 tauctyl(i) = tauct * sinphi(i)
822 taugwci(i,kk) = tauct
877 crit1 = ucltop(i)*(u(i,k)+u(i,k-1))*0.5
878 crit2 = vcltop(i)*(v(i,k)+v(i,k-1))*0.5
880 crit1 = ucltop(i)*u(i,1)
881 crit2 = vcltop(i)*v(i,1)
884 if ( abs(basicui(i,k)) > zero .and. crit1 > zero
885 & .and. crit2 > zero )
then
886 tem = basicui(i,k) * basicui(i,k)
887 nonlin = gqmcldlen(i) / (bruni(i,k)*ti(i,k)*tem)
889 if ( riloc(i,k) < rimaxm )
then
890 tem1 = 1 + tem*sqrt(riloc(i,k))
891 rimin(i,k) = riloc(i,k) * (1-tem) / (tem1*tem1)
892 else if((riloc(i,k) > rimaxm) .and.
893 & (riloc(i,k) < rimaxp))
then
894 rimin(i,k) = ( 1 - tem) / (tem*tem)
896 if ( rimin(i,k) <= riminx )
then
977 if (k < kk .and. k > 1)
then
978 if ( abs(taugwci(i,k+1)) > taumin )
then
979 if ( riloc(i,k) > ricrit )
then
980 if ( rimin(i,k) > ricrit )
then
981 taugwci(i,k) = taugwci(i,k+1)
982 elseif (rimin(i,k) > riminp)
then
983 tem = 2.0 + 1.0 / sqrt(riloc(i,k))
984 nonlins = (1.0/abs(c2)) * (2.*sqrt(tem) - tem)
986 tem2 = c2*nonlins*tem1
987 taugwci(i,k) = - rhoi(i,k) * c1 * tem1 * tem2 * tem2
988 & / (bruni(i,k)*dlen(i))
989 elseif (rimin(i,k) > riminm)
then
1004 if ( (basicum(i,k+1)*basicum(i,k) ) < 0. )
then
1005 taugwci(i,k+1) = zero
1009 if (abs(taugwci(i,k)) > abs(taugwci(i,k+1)))
then
1010 taugwci(i,k) = taugwci(i,k+1)
1013 elseif (k == 1)
then
1018 taugwci(i,1) = taugwci(i,2)
1033 wtgwc = (taugwci(i,k+1) - taugwci(i,k)) / dpmid(i,k)
1034 utgwcl(i,k) = wtgwc * cosphi(i)
1035 vtgwcl(i,k) = wtgwc * sinphi(i)
1058 xstress(i) = xstress(i) + utgwcl(i,k)*dpmid(i,k)
1059 ystress(i) = ystress(i) + vtgwcl(i,k)*dpmid(i,k)
1079 wrk(i) = 0.5 * pi / (pint(i,kcldbot(i)+1)-pint(i,kcldtop(i)))
1086 if (k >= kk .and. k <= kcldbot(i))
then
1087 p1 = sin(wrk(i) * (pint(i,k) -pint(i,kk)))
1088 p2 = sin(wrk(i) * (pint(i,k+1)-pint(i,kk)))
1089 tem = - (p2-p1) / dpmid(i,k)
1090 utgwcl(i,k) = tem*xstress(i)
1091 vtgwcl(i,k) = tem*ystress(i)
1244 utgwc(ii,k1) = utgwcl(i,k)
1246 vtgwc(ii,k1) = vtgwcl(i,k)
1257 tauctx(ii) = tauctxl(i)
1258 taucty(ii) = tauctyl(i)
1276 deallocate (kcldtop,kcldbot,do_gwc)
1277 deallocate (tauctxl, tauctyl,
1278 & gwdcloc, break, critic, cosphi,
1279 & sinphi, xstress, ystress,
1280 & dlen, ucltop, vcltop, gqmcldlen, wrk)
1282 deallocate (plnint, taugwci,
1283 & bruni, rhoi, basicui,
1284 & ti, riloc, rimin, pint)
1286 deallocate (plnmid, utgwcl, vtgwcl, basicum, u, v, t,
1287 & pmid, dpmid, brunm, rhom)
subroutine gwdc(im, ix, iy, km, lat, u1, v1, t1, q1, pmid1, pint1, dpmid1, qmax, ktop, kbot, kcnv, cldf, grav, cp, rd, fv, dlength, lprnt, ipr, fhour, utgwc, vtgwc, tauctx, taucty)