48 use vrbls4d,
only: dust, salt, soot, waso, suso, no3, nh4, pp25, pp10
49 use vrbls3d,
only: u, v, t, q, uh, vh, wh, pmid, pmidv, pint, alpint, zmid, &
50 zint, q2, omga, t_adj, ttnd, rswtt, rlwtt, exch_h, train, tcucn, &
51 el_pbl, cwm, f_ice, f_rain, f_rimef, qqw, qqi, qqr, qqs,qqg, qqni, qqnr, &
52 extcof55, cfr, dbz, dbzr, dbzi, dbzc, mcvg, nlice, nrain, o3, vdifftt, &
53 tcucns, vdiffmois, dconvmois, sconvmois, nradtt, o3vdiff, o3prod, &
54 o3tndy, mwpv, unknown, vdiffzacce, zgdrag, cnvctummixing, vdiffmacce, &
55 mgdrag, cnvctvmmixing, ncnvctcfrac, cnvctumflx, cnvctdmflx, cnvctdetmflx,&
56 cnvctzgdrag, cnvctmgdrag, icing_gfip, asy, ssa, duem, dusd, dudp, &
57 duwt, suem, susd, sudp, suwt, ocem, ocsd, ocdp, ocwt, bcem, bcsd, &
58 bcdp, bcwt, ssem, sssd, ssdp, sswt, ext, dpres, rhomid, effri, effrl, &
60 use vrbls2d,
only: wspd10max, w_up_max, w_dn_max, w_mean, refd_max, up_heli_max, &
61 prate_max, fprate_max, swupt, &
62 up_heli_max16, grpl_max, up_heli, up_heli16, ltg1_max, ltg2_max, &
63 up_heli_min, up_heli_min16, up_heli_max02, up_heli_min02, up_heli_max03, &
64 up_heli_min03, rel_vort_max, rel_vort_max01, wspd10umax, wspd10vmax, &
65 refdm10c_max, hail_max2d, hail_maxk1, ltg3_max,rel_vort_maxhy1, &
66 nci_ltg, nca_ltg, nci_wq, nca_wq, nci_refd, &
67 u10, v10, tshltr, qshltr, mrshltr, smstav, ssroff, bgroff, &
68 nca_refd, vegfrc, acsnow, acsnom, cmc, sst, qz0, thz0, uz0, vz0, qs, ths,&
69 sno, snonc, snoavg, psfcavg, t10m, t10avg, akmsavg, akhsavg, u10max, &
70 v10max, u10h, v10h, akms, akhs, cuprec, acprec, ancprc, cuppt, &
71 rainc_bucket, rainnc_bucket, pcp_bucket, snow_bucket, qrmax, tmax, &
72 snownc, graupelnc, tsnow, qvg, qv2m, rswin, rlwin, rlwtoa, tg, sfcshx, &
73 fis, t500, cfracl, cfracm, cfrach, acfrst, acfrcv, hbot, potevp, &
74 sfclhx, htop, aswin, alwin, aswout, alwout, aswtoa, alwtoa, czen, czmean,&
75 sigt4, rswout, radot, ncfrst, ncfrcv, smstot, pctsno, pshltr, th10, &
76 q10, sr, prec, subshx, snopcx, sfcuvx, sfcevp, z0, ustar, pblh, mixht, &
77 twbs, qwbs, sfcexc, grnflx, soiltb, z1000, slp, pslp, f, albedo, albase, &
78 cldfra, cprate, cnvcfr, ivgtyp, hbotd, htopd, hbots, isltyp, htops, &
79 cldefi, islope, si, lspa, rswinc, vis, pd, mxsnal, epsr, sfcux, &
80 sfcvx, sfcuxi, sfcvxi, avgalbedo, avgcprate, avgprec, ptop, pbot, avgcfrach, avgcfracm, &
81 avgcfracl, avgtcdc, auvbin, auvbinc, ptopl, pbotl, ttopl, ptopm, &
82 pbotm, ttopm, ptoph, pboth, ttoph, sfcugs, sfcvgs, pblcfr, cldwork, &
83 gtaux, gtauy, mdltaux, mdltauy, runoff, maxtshltr, mintshltr, &
84 maxrhshltr, minrhshltr, dzice, alwinc, alwoutc, alwtoac, aswinc, &
85 aswoutc,aswtoac, aswintoa, smcwlt, suntime, fieldcapa, avisbeamswin, &
86 avisdiffswin, airbeamswin, airdiffswin, snowfall, dusmass, ducmass, &
87 dusmass25, susmass, sucmass, susmass25, sucmass25, ocsmass, occmass, &
88 ocsmass25, occmass25, bcsmass, bccmass, bcsmass25, bccmass25, &
89 sssmass, sscmass, sssmass25, sscmass25, ducmass25, &
90 dustcb, sscb, bccb, occb, sulfcb, dustallcb, ssallcb,dustpm,sspm, pp25cb,&
91 no3cb, nh4cb, dustpm10, pp10cb, maod, ti
92 use soil,
only: smc, stc, sh2o, sldpth, rtdpth, sllevel
93 use masks,
only: htm, vtm, hbm2, sm, sice, lmh, gdlat, gdlon, dx, dy, lmv
94 use ctlblk_mod,
only: me, num_procs, jm, jsta, jend, jsta_m, jsta_m2,ista,iend , &
95 jend_m, jend_m2, iup, idn, icnt, im, idsp, jsta_2l, jend_2u,idsp2,icnt2, &
96 jvend_2u, lm, lp1, jsta_2l, jend_2u, nsoil, nbin_du, nbin_ss, &
97 nbin_bc, nbin_oc, nbin_su, nbin_no3, nbin_nh4, &
98 ista_m,iend_m,ista_m2,iend_m2, ista_m,iend_m,ista_m2,iend_m2, &
99 ileft,iright,ileftb,irightb,ibsize,ibsum, isxa,iexa,jsxa,jexa, &
101 ista_2l, iend_2u,ivend_2u,numx,modelname
110 integer ierr,i,jsx,jex,isx,iex,j
111 integer size,ubound,lbound
112 integer isumm,isum ,ii,jj,isumm2
113 integer ,
allocatable :: ibuff(:)
114 real ,
allocatable :: rbuff(:)
115 integer,
allocatable :: ipole(:),ipoles(:,:)
116 real ,
allocatable :: rpole(:),rpoles(:,:)
122 write(*,*)
' NUM_PROCS,NUMX,NUMY = ',num_procs,numx,num_procs/numx
125 if ( num_procs > 1024 )
then
126 print *,
' too many MPI tasks, max is 1024, stopping'
127 call mpi_abort(mpi_comm_world,1,ierr)
133 if ( num_procs > jm/2 )
then
134 print *,
' too many MPI tasks, max is ',jm/2,
' stopping'
135 call mpi_abort(mpi_comm_world,1,ierr)
153 call para_range2(im,jm,numx,num_procs/numx,me,ista,iend,jsta,jend)
169 if(mod(me,numx)==0)
then
174 if (me>=(num_procs-numx))
then
179 if(mod(me+1,numx)==0)
then
190 if ( me == num_procs - 1 )
then
203 allocate(ibuff(im*jm))
204 allocate(rbuff(im*jm))
217 allocate(isxa(0:num_procs-1) )
218 allocate(jsxa(0:num_procs-1) )
219 allocate(iexa(0:num_procs-1) )
220 allocate(jexa(0:num_procs-1) )
221 do i = 0, num_procs - 1
222 call para_range2(im,jm,numx,num_procs/numx,i,isx,iex,jsx,jex)
223 icnt(i) = ((jex-jsx)+1)*((iex-isx)+1)
231 if(jsx .eq. 1 .or. jex .eq. jm)
then
232 icnt2(i) = (iex-isx+1)
237 if(jsx .eq. 1 .or. jex .eq. jm) isumm2=isumm2+(iex-isx+1)
257 jsta_2l = max(jsta - 2, 1 )
258 jend_2u = min(jend + 2, jm )
259 if(modelname==
'GFS')
then
260 ista_2l=max(ista-2,0)
261 iend_2u=min(iend+2,im+1)
263 ista_2l=max(ista-2,1)
264 iend_2u=min(iend+2,im)
268 jvend_2u = min(jend + 2, jm+1 )
279 if(mod(me,numx) .eq. 0) ileft=mpi_proc_null
280 if(mod(me,numx) .eq. 0) ileftb=me+numx-1
281 if(mod(me+1,numx) .eq. 0 .or. me .eq. num_procs-1) iright=mpi_proc_null
282 if(mod(me+1,numx) .eq. 0 .or. me .eq. num_procs-1) irightb=me-numx+1
283 if(me .ge. numx) idn=me-numx
284 if(me+1 .le. num_procs-numx) iup=me+numx
290 ibsize = ( (iend-ista) +1) * ( (jend-jsta)+1)
291 allocate(
ibcoords(ista_2l:iend_2u,jsta_2l:jend_2u))
292 allocate(
rbcoords(ista_2l:iend_2u,jsta_2l:jend_2u))
293 allocate(ibufs(ibsize))
294 allocate(rbufs(ibsize))
295 call mpi_scatterv(ibuff,icnt,idsp,mpi_integer &
296 ,ibufs,icnt(me),mpi_integer ,0,mpi_comm_world,j)
297 call mpi_scatterv(rbuff,icnt,idsp,mpi_real &
298 ,rbufs,icnt(me),mpi_real ,0,mpi_comm_world,j)
317 if(ii .ne. i .or. jj .ne. j)
then
318 print *,i,j,ii,jj,
ibcoords(i,j),
' GWVX FAIL '
325 allocate(ipoles(im,2),ipole(ista:iend))
326 allocate(rpoles(im,2),rpole(ista:iend))
331 if(me .lt. num_procs/2. .and. jsta_2l .le. 1 .and. icnt2(me) .gt. 0) ipole(i)=
ibcoords(i,1)
332 if(me .lt. num_procs/2. .and. jsta_2l .le. 1 .and. icnt2(me) .gt. 0) rpole(i)=
rbcoords(i,1)
333 if(me .gt. num_procs/2. .and. jend_2u .ge. jm .and. icnt2(me) .gt. 0) ipole(i)=
ibcoords(i,jm)
334 if(me .gt. num_procs/2. .and. jend_2u .ge. jm .and. icnt2(me) .gt. 0) rpole(i)=
rbcoords(i,jm)
337 if(me .lt. num_procs/2. .and. jsx .eq. 1)
then
340 if(me .gt. num_procs/2. .and. jend_2u .ge. jm)
then
349 call mpi_gatherv(ipole(ista),icnt2(me),mpi_integer, ipoles,icnt2,idsp2,mpi_integer,0,mpi_comm_world, ierr )
350 call mpi_gatherv(rpole(ista),icnt2(me),mpi_real , rpoles,icnt2,idsp2,mpi_real ,0,mpi_comm_world, ierr )
356 jj=rpoles(i,j) -ii*4000
357 if(ii .ne. i .or. jj .ne. 1 .and. jj .ne. jm )
then
358 write(*,169)
' IPOLES BAD POINT',rpoles(i,j),ii,i,jj,
' jm= ',jm
367 107
format(a20,10i10)
368 169
format(a25,f20.1,3i10,a10,4i10)