18 subroutine gfs_mp_generic_post_run( &
19 im, levs, kdt, nrcm, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_nssl, &
20 imp_physics_mg, imp_physics_fer_hires, cal_pre, cplflx, cplchm, cpllnd, progsigma, con_g, rhowater, rainmin, dtf, &
21 frain, rainc, rain1, rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, phil, htop, refl_10cm, &
22 imfshalcnv,imfshalcnv_gf,imfdeepcnv,imfdeepcnv_gf,imfdeepcnv_samf, con_t0c, snow, graupel, save_t, save_q, &
23 rain0, ice0, snow0, graupel0, del, rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, sr, cnvprcp,&
24 totprcp, totice, totsnw, totgrp, cnvprcpb, totprcpb, toticeb, totsnwb, totgrpb, rain_cpl, rainc_cpl, snow_cpl, &
25 pwat, frzr, frzrb, frozr, frozrb, tsnowp, tsnowpb, rhonewsn1, exticeden, &
26 drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
27 graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, &
28 dtend, dtidx, index_of_temperature, index_of_process_mp,ldiag3d, qdiag3d,dqdt_qmicro, lssav, num_dfi_radar, &
29 fh_dfi_radar,index_of_process_dfi_radar, ix_dfi_radar, dfi_radar_tten, radar_tten_limits, fhour, prevsq, &
30 iopt_lake, iopt_lake_clm, lkm, use_lake_model, errmsg, errflg)
36 integer,
intent(in) :: im, levs, kdt, nrcm, nncl, ntcw, ntrac, num_dfi_radar, index_of_process_dfi_radar
37 integer,
intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires
38 integer,
intent(in) :: imp_physics_nssl, iopt_lake_clm, iopt_lake, lkm
39 logical,
intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, cpllnd, progsigma, exticeden
40 integer,
intent(in) :: index_of_temperature,index_of_process_mp,use_lake_model(:)
41 integer,
intent(in) :: imfshalcnv,imfshalcnv_gf,imfdeepcnv,imfdeepcnv_gf,imfdeepcnv_samf
42 integer,
dimension (:),
intent(in) :: htop
43 real(kind=kind_phys),
intent(in) :: fh_dfi_radar(:), fhour, con_t0c
44 real(kind=kind_phys),
intent(in) :: radar_tten_limits(:)
45 integer,
intent(in) :: ix_dfi_radar(:)
46 real(kind=kind_phys),
dimension(:,:),
intent(inout) :: gt0,refl_10cm
48 real(kind=kind_phys),
intent(in) :: dtf, frain, con_g, rainmin, rhowater
49 real(kind=kind_phys),
dimension(:),
intent(in) :: rain1, xlat, xlon, tsfc
50 real(kind=kind_phys),
dimension(:),
intent(inout) :: ice, snow, graupel, rainc
51 real(kind=kind_phys),
dimension(:),
intent(in),
optional :: rain0, ice0, snow0, graupel0
52 real(kind=kind_phys),
dimension(:,:),
intent(in) :: rann
53 real(kind=kind_phys),
dimension(:,:),
intent(in) :: prsl, save_t, del
54 real(kind=kind_phys),
dimension(:,:),
intent(in) :: prsi, phii,phil
55 real(kind=kind_phys),
dimension(:,:,:),
intent(in) :: gq0, save_q
57 real(kind=kind_phys),
dimension(:,:,:),
intent(in),
optional :: dfi_radar_tten
59 real(kind=kind_phys),
dimension(:),
intent(in ) :: sr
60 real(kind=kind_phys),
dimension(:),
intent(inout) :: rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, &
61 srflag, cnvprcp, totprcp, totice, totsnw, totgrp, cnvprcpb, &
62 totprcpb, toticeb, totsnwb, totgrpb, pwat
63 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: rain_cpl, rainc_cpl, snow_cpl
65 real(kind=kind_phys),
dimension(:,:,:),
intent(inout),
optional :: dtend
66 integer,
dimension(:,:),
intent(in) :: dtidx
69 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: drain_cpl, dsnow_cpl
72 integer,
intent(in) :: lsm, lsm_ruc, lsm_noahmp
73 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: raincprv
74 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: rainncprv
75 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: iceprv
76 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: snowprv
77 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: graupelprv
78 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: draincprv
79 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: drainncprv
80 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: diceprv
81 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: dsnowprv
82 real(kind=kind_phys),
dimension(:),
intent(inout),
optional :: dgraupelprv
83 real(kind=kind_phys),
dimension(:),
intent(inout) :: frzr
84 real(kind=kind_phys),
dimension(:),
intent(inout) :: frzrb
85 real(kind=kind_phys),
dimension(:),
intent(inout) :: frozr
86 real(kind=kind_phys),
dimension(:),
intent(inout) :: frozrb
87 real(kind=kind_phys),
dimension(:),
intent(inout) :: tsnowp
88 real(kind=kind_phys),
dimension(:),
intent(inout) :: tsnowpb
89 real(kind=kind_phys),
dimension(:),
intent(inout) :: rhonewsn1
90 real(kind=kind_phys),
dimension(:,:),
intent(inout),
optional :: dqdt_qmicro
91 real(kind=kind_phys),
dimension(:,:),
intent(inout),
optional :: prevsq
92 real(kind=kind_phys),
intent(in) :: dtp
95 character(len=*),
intent(out) :: errmsg
96 integer,
intent(out) :: errflg
99 real(kind=kind_phys),
parameter :: con_p001= 0.001_kind_phys
100 real(kind=kind_phys),
parameter :: con_day = 86400.0_kind_phys
101 real(kind=kind_phys),
parameter :: p850 = 85000.0_kind_phys
104 integer :: i, k, ic, itrac, idtend, itime, idtend_radar, idtend_mp
106 real(kind=kind_phys),
parameter :: zero = 0.0_kind_phys, one = 1.0_kind_phys
107 real(kind=kind_phys) :: crain,
csnow, onebg, tem, total_precip, tem1, tem2, ttend
108 real(kind=kind_phys),
dimension(im) :: domr, domzr, domip, doms, t850, work1
110 real :: snowrat,grauprat,icerat,curat,prcpncfr,prcpcufr
111 real :: rhonewsnow,rhoprcpice,rhonewgr,rhonewice
113 real(kind_phys),
parameter :: dbzmin=-20.0
114 real(kind_phys) :: cuprate
115 real(kind_phys) :: ze, ze_conv, dbz_sum
117 real(kind_phys),
dimension(1:im,1:levs) :: zo
118 real(kind_phys),
dimension(1:im) :: zfrz
119 real(kind_phys),
dimension(1:im) :: factor
120 real(kind_phys) ze_mp, fctz, delz
131 rain(i) = rainc(i) + frain * rain1(i)
136 if ( (imp_physics==imp_physics_thompson .or. imp_physics==imp_physics_nssl) .and. &
137 (imfdeepcnv==imfdeepcnv_samf .or. imfdeepcnv==imfdeepcnv_gf .or. imfshalcnv==imfshalcnv_gf) )
then
141 zfrz(i) = phil(i,1)*onebg
143 zo(i,k) = phil(i,k)*onebg
144 if (gt0(i,k) >= con_t0c .and. lfrz)
then
152 if(rainc(i) > 0.0 .and. htop(i) > 0)
then
153 factor(i) = -2./max(1000., zo(i,htop(i)) - zfrz(i))
161 if(rainc(i) > 0. .and. k <= htop(i))
then
163 delz = zo(i,k) - zfrz(i)
167 fctz = 10.**(factor(i)*delz)
169 cuprate = rainc(i) * 3.6e6 / dtp
170 ze_conv = 300.0 * cuprate**1.4
171 ze_conv = fctz * ze_conv
172 ze_mp = 10._kind_phys ** (0.1 * refl_10cm(i,k))
173 dbz_sum = max(dbzmin, 10.*log10(ze_mp + ze_conv))
174 refl_10cm(i,k) = dbz_sum
181 if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson .or. imp_physics == imp_physics_nssl )
then
183 if (gt0(i,1) .le. 273)
then
184 frzr(i) = frzr(i) + rain0(i)
185 frzrb(i) = frzrb(i) + rain0(i)
187 tsnowp(i) = tsnowp(i) + snow0(i)
188 tsnowpb(i) = tsnowpb(i) + snow0(i)
189 frozr(i) = frozr(i) + graupel0(i)
190 frozrb(i) = frozrb(i) + graupel0(i)
208 prcpncfr = rain1(i)*sr(i)
209 if(sr(i) > 0..and. gt0(i,1) < 273.)
then
210 prcpcufr = max(0.,rainc(i)*sr(i))
212 if(gt0(i,1) < 273.)
then
213 prcpcufr = max(0.,rainc(i))
219 if((prcpncfr + prcpcufr) > 0.)
then
221 snowrat=min(1.,max(0.,snow0(i)/(prcpncfr + prcpcufr)))
222 grauprat=min(1.,max(0.,graupel0(i)/(prcpncfr + prcpcufr)))
223 icerat=min(1.,max(0.,(prcpncfr-snow0(i)-graupel0(i)) &
224 /(prcpncfr + prcpcufr)))
225 curat=min(1.,max(0.,(prcpcufr/(prcpncfr + prcpcufr))))
227 rhonewsnow=min(125.,1000.0/max(8.,(17.*tanh((276.65-gt0(i,1))*0.15))))
228 rhonewgr=min(500.,rhowater/max(2.,(3.5*tanh((274.15-gt0(i,1))*0.3333))))
233 rhoprcpice = min(500.,max(58.8,(rhonewsnow*snowrat + &
234 rhonewgr*grauprat + rhonewice*icerat + rhonewgr*curat)))
236 rhonewsn1(i)=rhoprcpice
250 if (imp_physics == imp_physics_gfdl)
then
251 tprcp = max(zero, rain)
259 else if (imp_physics == imp_physics_thompson .or. imp_physics == imp_physics_nssl )
then
260 tprcp = max(zero, rainc + frain * rain1)
261 graupel = frain*graupel0
264 else if (imp_physics == imp_physics_fer_hires)
then
265 tprcp = max(zero, rain)
269 if (lsm==
lsm_ruc .or. lsm==lsm_noahmp)
then
270 raincprv(:) = rainc(:)
271 rainncprv(:) = frain * rain1(:)
274 graupelprv(:) = graupel(:)
278 if (lsm == lsm_noahmp)
then
279 tem = one / (dtp*con_p001)
280 draincprv(:) = tem * raincprv(:)
281 drainncprv(:) = tem * rainncprv(:)
282 dsnowprv(:) = tem * snowprv(:)
283 dgraupelprv(:) = tem * graupelprv(:)
284 diceprv(:) = tem * iceprv(:)
286 else if(lkm>0 .and. iopt_lake==iopt_lake_clm)
then
288 if(use_lake_model(i)>0)
then
289 raincprv(i) = rainc(i)
290 rainncprv(i) = frain * rain1(i)
297 call calpreciptype (kdt, nrcm, im, im, levs, levs+1, &
298 rann, xlat, xlon, gt0, &
299 gq0(:,:,1), prsl, prsi, &
301 domr, domzr, domip, doms)
305 if (imp_physics /= imp_physics_gfdl .and. imp_physics /= imp_physics_thompson .and. imp_physics /= imp_physics_nssl)
then
307 tprcp(i) = max(zero, rain(i) )
308 if(doms(i) > zero .or. domip(i) > zero)
then
317 domr_diag(i) = domr_diag(i) + domr(i) * dtf
318 domzr_diag(i) = domzr_diag(i) + domzr(i) * dtf
319 domip_diag(i) = domip_diag(i) + domip(i) * dtf
320 doms_diag(i) = doms_diag(i) + doms(i) * dtf
326 do itime=1,num_dfi_radar
327 if(ix_dfi_radar(itime)<1) cycle
328 if(fhour<fh_dfi_radar(itime)) cycle
329 if(fhour>=fh_dfi_radar(itime+1)) cycle
332 if_radar:
if(itime<=num_dfi_radar)
then
333 radar_k:
do k=3,levs-2
335 ttend = dfi_radar_tten(i,k,itime)
336 if_active:
if (ttend>-19)
then
337 ttend = max(ttend,radar_tten_limits(1))
338 ttend = min(ttend,radar_tten_limits(2))
342 gt0(i,k) = save_t(i,k) + ttend*dtp
347 idtend_radar = dtidx(index_of_temperature,index_of_process_dfi_radar)
348 idtend_mp = dtidx(index_of_temperature,index_of_process_mp)
349 if(idtend_radar>0 .or. idtend_mp>0)
then
351 dtend(:,1:2,idtend_mp) = dtend(:,1:2,idtend_mp) + (gt0(:,1:2)-save_t(:,1:2))*frain
355 ttend = dfi_radar_tten(i,k,itime)
357 if(idtend_radar>0)
then
358 dtend(i,k,idtend_radar) = dtend(i,k,idtend_radar) + (gt0(i,k)-save_t(i,k)) * frain
360 else if(idtend_mp>0)
then
361 dtend(i,k,idtend_mp) = dtend(i,k,idtend_mp) + (gt0(i,k)-save_t(i,k)) * frain
366 dtend(:,levs-1:levs,idtend_mp) = dtend(:,levs-1:levs,idtend_mp) + (gt0(:,levs-1:levs)-save_t(:,levs-1:levs))*frain
372 t850(1:im) = gt0(1:im,1)
376 if (prsl(i,k) > p850 .and. prsl(i,k+1) <= p850)
then
377 t850(i) = gt0(i,k) - (prsl(i,k)-p850) / &
378 (prsl(i,k)-prsl(i,k+1)) * &
379 (gt0(i,k)-gt0(i,k+1))
385 tem = dtp * con_p001 / con_day
392 if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson .or. &
393 imp_physics == imp_physics_nssl )
then
402 if (tsfc(i) >= 273.15_kind_phys)
then
413 total_precip = snow0(i)+ice0(i)+graupel0(i)+rain0(i)+rainc(i)
414 if (total_precip > rainmin)
then
415 srflag(i) = (snow0(i)+ice0(i)+graupel0(i)+
csnow)/total_precip
424 elseif( .not. cal_pre)
then
425 if (imp_physics == imp_physics_mg)
then
427 if (rain(i) > rainmin)
then
428 tem1 = max(zero, (rain(i)-rainc(i))) * sr(i)
430 if (t850(i) > 273.16_kind_phys)
then
431 srflag(i) = max(zero, min(one, tem1*tem2))
433 srflag(i) = max(zero, min(one, (tem1+rainc(i))*tem2))
440 tprcp(i) = max(zero, rain(i))
444 tprcp(i) = max(zero, rain(i))
450 if_save_fields:
if (lssav)
then
455 cnvprcp(i) = cnvprcp(i) + rainc(i)
456 totprcp(i) = totprcp(i) + rain(i)
457 totice(i) = totice(i) + ice(i)
458 totsnw(i) = totsnw(i) + snow(i)
459 totgrp(i) = totgrp(i) + graupel(i)
461 cnvprcpb(i) = cnvprcpb(i) + rainc(i)
462 totprcpb(i) = totprcpb(i) + rain(i)
463 toticeb(i) = toticeb(i) + ice(i)
464 totsnwb(i) = totsnwb(i) + snow(i)
465 totgrpb(i) = totgrpb(i) + graupel(i)
468 if_tendency_diagnostics:
if (ldiag3d)
then
469 idtend = dtidx(index_of_temperature,index_of_process_mp)
473 dtend(i,k,idtend) = dtend(i,k,idtend) + (gt0(i,k)-save_t(i,k)) * frain
477 if_tracer_diagnostics:
if (qdiag3d)
then
478 dtend_q:
do itrac=1,ntrac
479 idtend = dtidx(itrac+100,index_of_process_mp)
483 dtend(i,k,idtend) = dtend(i,k,idtend) + (gq0(i,k,itrac)-save_q(i,k,itrac)) * frain
488 endif if_tracer_diagnostics
489 endif if_tendency_diagnostics
496 dqdt_qmicro(i,k)=(gq0(i,k,1)-save_q(i,k,1))/dtp
501 if (cplflx .or. cplchm .or. cpllnd)
then
503 dsnow_cpl(i)= max(zero, rain(i) * srflag(i))
504 drain_cpl(i)= max(zero, rain(i) - dsnow_cpl(i))
505 rain_cpl(i) = rain_cpl(i) + drain_cpl(i)
506 snow_cpl(i) = snow_cpl(i) + dsnow_cpl(i)
510 if (cplchm .or. cpllnd)
then
512 rainc_cpl(i) = rainc_cpl(i) + rainc(i)
522 do ic = ntcw, ntcw+nncl-1
524 work1(i) = work1(i) + gq0(i,k,ic)
529 pwat(i) = pwat(i) + del(i,k)*(gq0(i,k,1)+work1(i))
533 pwat(i) = pwat(i) * onebg
539 prevsq(i,k) = gq0(i,k,1)