GFS Operational Physics Documentation  gsm/branches/DTC/phys-doc-all phys-doc-all R82971
precpd.f
Go to the documentation of this file.
1 
4 
49 
77  subroutine precpd (im,ix,km,dt,del,prsl,q,cwm,t,rn,sr &
78  &, rainp,u00k,psautco,prautco,evpco,wminco &
79  &, lprnt,jpr)
80 !
81 !
82 ! ******************************************************************
83 ! * *
84 ! * subroutine for precipitation processes *
85 ! * from suspended cloud water/ice *
86 ! * *
87 ! ******************************************************************
88 ! * *
89 ! * originally created by q. zhao jan. 1995 *
90 ! * ------- *
91 ! * modified and rewritten by shrinivas moorthi oct. 1998 *
92 ! * ----------------- *
93 ! * and hua-lu pan *
94 ! * ---------- *
95 ! * *
96 ! * references: *
97 ! * *
98 ! * zhao and carr (1997), monthly weather review (august) *
99 ! * sundqvist et al., (1989) monthly weather review. (august) *
100 ! * chuang 2013, modify sr to define frozen precipitation fraction*
101 ! ******************************************************************
102 !
103 ! in this code vertical indexing runs from surface to top of the
104 ! model
105 !
106 ! argument list:
107 ! --------------
108 ! im : inner dimension over which calculation is made
109 ! ix : maximum inner dimension
110 ! km : number of vertical levels
111 ! dt : time step in seconds
112 ! del(km) : pressure layer thickness (bottom to top)
113 ! prsl(km) : pressure values for model layers (bottom to top)
114 ! q(ix,km) : specific humidity (updated in the code)
115 ! cwm(ix,km) : condensate mixing ratio (updated in the code)
116 ! t(ix,km) : temperature (updated in the code)
117 ! rn(im) : precipitation over one time-step dt (m/dt)
118 !old sr(im) : index (=-1 snow, =0 rain/snow, =1 rain)
119 !new sr(im) : "snow ratio", ratio of snow to total precipitation
120 ! cll(ix,km) : cloud cover
121 !hchuang rn(im) unit in m per time step
122 ! precipitation rate conversion 1 mm/s = 1 kg/m2/s
123 !
124  use machine , only : kind_phys
125  use funcphys , only : fpvs
126  use physcons, grav => con_g, hvap => con_hvap, hfus => con_hfus
127  &, ttp => con_ttp, cp => con_cp
128  &, eps => con_eps, epsm1 => con_epsm1
129  implicit none
130 ! include 'constant.h'
131 !
132  real (kind=kind_phys) g, h1, h1000
133  &, d00
134  &, elwv, eliv, row
135  &, epsq, eliw
136  &, rcp, rrow
137  parameter(g=grav, h1=1.e0, h1000=1000.0
138  &, d00=0.e0
139  &, elwv=hvap, eliv=hvap+hfus, row=1.e3
140  &, epsq=2.e-12
141  &, eliw=eliv-elwv, rcp=h1/cp, rrow=h1/row)
142 !
143  real(kind=kind_phys), parameter :: cons_0=0.0, cons_p01=0.01
144  &, cons_20=20.0
145  &, cons_m30=-30.0, cons_50=50.0
146 !
147  integer im, ix, km, jpr
148  real (kind=kind_phys) q(ix,km), t(ix,km), cwm(ix,km) &
149  &, del(ix,km), prsl(ix,km) &
150  &, rn(im), sr(im) &
151  &, dt &
152  &, rainp(im,km), rnp(im), &
153  & psautco(im), prautco(im), evpco, wminco(2)
154 !
155 !
156  real (kind=kind_phys) err(im), ers(im), precrl(im) &
157  &, precsl(im), precrl1(im), precsl1(im) &
158  &, rq(im), condt(im) &
159  &, conde(im), rconde(im), tmt0(im) &
160  &, wmin(im,km), wmink(im), pres(im) &
161  &, wmini(im,km), ccr(im) &
162  &, tt(im), qq(im), ww(im) &
163  &, u00k(im,km) &
164  &, zaodt
165  real (kind=kind_phys) cclim(km)
166 !
167  integer iw(im,km), ipr(im), iwl(im), iwl1(im)
168 !
169  logical comput(im)
170  logical lprnt
171 !
172  real (kind=kind_phys) ke, rdt, us, climit, cws, csm1
173  &, crs1, crs2, cr, aa2, dtcp, c00, cmr
174  &, tem, c1, c2, wwn
175 ! &, tem, c1, c2, u00b, u00t, wwn
176  &, precrk, precsk, pres1, qk, qw, qi
177  &, qint, fiw, wws, cwmk, expf
178  &, psaut, psaci, amaxcm, tem1, tem2
179  &, tmt0k, psm1, psm2, ppr
180  &, rprs, erk, pps, sid, rid, amaxps
181  &, praut, fi, qc, amaxrq, rqkll
182  integer i, k, ihpr, n
183 !
184 !-----------------------preliminaries ---------------------------------
185 !
186 ! do k=1,km
187 ! do i=1,im
188 ! cll(i,k) = 0.0
189 ! enddo
190 ! enddo
191 !
192  rdt = h1 / dt
193 ! ke = 2.0e-5 ! commented on 09/10/99 -- opr value
194 ! ke = 2.0e-6
195 ! ke = 1.0e-5
196 !!! ke = 5.0e-5
197 !! ke = 7.0e-5
198  ke = evpco
199 ! ke = 7.0e-5
200  us = h1
201  climit = 1.0e-20
202  cws = 0.025
203 !
204  zaodt = 800.0 * rdt
205 !
206  csm1 = 5.0000e-8 * zaodt
207  crs1 = 5.00000e-6 * zaodt
208  crs2 = 6.66600e-10 * zaodt
209  cr = 5.0e-4 * zaodt
210  aa2 = 1.25e-3 * zaodt
211 !
212  ke = ke * sqrt(rdt)
213 ! ke = ke * sqrt(zaodt)
214 !
215  dtcp = dt * rcp
216 !
217 ! c00 = 1.5e-1 * dt
218 ! c00 = 10.0e-1 * dt
219 ! c00 = 3.0e-1 * dt !05/09/2000
220 ! c00 = 1.0e-4 * dt !05/09/2000
221 ! c00 = prautco * dt !05/09/2000
222  cmr = 1.0 / 3.0e-4
223 ! cmr = 1.0 / 5.0e-4
224 ! c1 = 100.0
225  c1 = 300.0
226  c2 = 0.5
227 !
228 !
229 !--------calculate c0 and cmr using lc at previous step-----------------
230 !
231  do k=1,km
232  do i=1,im
233  tem = (prsl(i,k)*0.00001)
234 ! tem = sqrt(tem)
235  iw(i,k) = 0.0
236 ! wmin(i,k) = 1.0e-5 * tem
237 ! wmini(i,k) = 1.0e-5 * tem ! testing for ras
238 !
239 
240  wmin(i,k) = wminco(1) * tem
241  wmini(i,k) = wminco(2) * tem
242 
243 
244  rainp(i,k) = 0.0
245 
246  enddo
247  enddo
248  do i=1,im
249 ! c0(i) = 1.5e-1
250 ! cmr(i) = 3.0e-4
251 !
252  iwl1(i) = 0
253  precrl1(i) = d00
254  precsl1(i) = d00
255  comput(i) = .false.
256  rn(i) = d00
257  sr(i) = d00
258  ccr(i) = d00
259 !
260  rnp(i) = d00
261  enddo
273 
274 !------------select columns where rain can be produced--------------
275  do k=1, km-1
276  do i=1,im
277  tem = min(wmin(i,k), wmini(i,k))
278  if (cwm(i,k) > tem) comput(i) = .true.
279  enddo
280  enddo
281  ihpr = 0
282  do i=1,im
283  if (comput(i)) then
284  ihpr = ihpr + 1
285  ipr(ihpr) = i
286  endif
287  enddo
288 !***********************************************************************
289 !-----------------begining of precipitation calculation-----------------
290 !***********************************************************************
291 ! do k=km-1,2,-1
292  do k=km,1,-1
293  do n=1,ihpr
294  precrl(n) = precrl1(n)
295  precsl(n) = precsl1(n)
296  err(n) = d00
297  ers(n) = d00
298  iwl(n) = 0
299 !
300  i = ipr(n)
301  tt(n) = t(i,k)
302  qq(n) = q(i,k)
303  ww(n) = cwm(i,k)
304  wmink(n) = wmin(i,k)
305  pres(n) = prsl(i,k)
306 !
307  precrk = max(cons_0, precrl1(n))
308  precsk = max(cons_0, precsl1(n))
309  wwn = max(ww(n), climit)
310 ! if (wwn .gt. wmink(n) .or. (precrk+precsk) .gt. d00) then
311  if (wwn > climit .or. (precrk+precsk) > d00) then
312  comput(n) = .true.
313  else
314  comput(n) = .false.
315  endif
316  enddo
317 !
318 ! es(1:ihpr) = fpvs(tt(1:ihpr))
319  do n=1,ihpr
320  if (comput(n)) then
321  i = ipr(n)
322  conde(n) = (dt/g) * del(i,k)
323  condt(n) = conde(n) * rdt
324  rconde(n) = h1 / conde(n)
325  qk = max(epsq, qq(n))
326  tmt0(n) = tt(n) - 273.16
327  wwn = max(ww(n), climit)
328 !
329 ! pl = pres(n) * 0.01
330 ! call qsatd(tt(n), pl, qc)
331 ! rq(n) = max(qq(n), epsq) / max(qc, 1.0e-10)
332 ! rq(n) = max(1.0e-10, rq(n)) ! -- relative humidity---
333 !
334 ! the global qsat computation is done in pa
335  pres1 = pres(n)
336 ! qw = es(n)
337  qw = min(pres1, fpvs(tt(n)))
338  qw = eps * qw / (pres1 + epsm1 * qw)
339  qw = max(qw,epsq)
340 !
341 ! tmt15 = min(tmt0(n), cons_m15)
342 ! ai = 0.008855
343 ! bi = 1.0
344 ! if (tmt0(n) .lt. -20.0) then
345 ! ai = 0.007225
346 ! bi = 0.9674
347 ! endif
348 ! qi = qw * (bi + ai*min(tmt0(n),cons_0))
349 ! qint = qw * (1.-0.00032*tmt15*(tmt15+15.))
350 !
351  qi = qw
352  qint = qw
353 ! if (tmt0(n).le.-40.) qint = qi
354 !
355 !-------------------ice-water id number iw------------------------------
358  if(tmt0(n) < -15.) then
359  fi = qk - u00k(i,k)*qi
360  if(fi > d00 .or. wwn > climit) then
361  iwl(n) = 1
362  else
363  iwl(n) = 0
364  endif
365 ! endif
366  elseif (tmt0(n) >= 0.) then
367  iwl(n) = 0
368 !
369 ! if(tmt0(n).lt.0.0.and.tmt0(n).ge.-15.0) then
370  else
371  iwl(n) = 0
372  if(iwl1(n) == 1 .and. wwn > climit) iwl(n) = 1
373  endif
374 !
375 ! if(tmt0(n).ge.0.) then
376 ! iwl(n) = 0
377 ! endif
378 !----------------the satuation specific humidity------------------------
379  fiw = float(iwl(n))
380  qc = (h1-fiw)*qint + fiw*qi
381 !----------------the relative humidity----------------------------------
382  if(qc <= 1.0e-10) then
383  rq(n) = d00
384  else
385  rq(n) = qk / qc
386  endif
387 !----------------cloud cover ratio ccr----------------------------------
389  if(rq(n) < u00k(i,k)) then
390  ccr(n) = d00
391  elseif(rq(n) >= us) then
392  ccr(n) = us
393  else
394  rqkll = min(us,rq(n))
395  ccr(n) = h1-sqrt((us-rqkll)/(us-u00k(i,k)))
396  endif
397 !
398  endif
399  enddo
400 !-------------------ice-water id number iwl------------------------------
401 ! do n=1,ihpr
402 ! if (comput(n) .and. (ww(n) .gt. climit)) then
403 ! if (tmt0(n) .lt. -15.0
404 ! * .or. (tmt0(n) .lt. 0.0 .and. iwl1(n) .eq. 1))
405 ! * iwl(n) = 1
406 ! cll(ipr(n),k) = 1.0 ! cloud cover!
407 ! cll(ipr(n),k) = min(1.0, ww(n)*cclim(k)) ! cloud cover!
408 ! endif
409 ! enddo
410 !
442 !--- precipitation production -- auto conversion and accretion
443 !
444  do n=1,ihpr
445  if (comput(n) .and. ccr(n) > 0.0) then
446  wws = ww(n)
447  cwmk = max(cons_0, wws)
448  i = ipr(n)
449 ! amaxcm = max(cons_0, cwmk - wmink(n))
450  if (iwl(n) == 1) then ! ice phase
451  amaxcm = max(cons_0, cwmk - wmini(i,k))
452  expf = dt * exp(0.025*tmt0(n))
453  psaut = min(cwmk, psautco(i)*expf*amaxcm)
454  ww(n) = ww(n) - psaut
455  cwmk = max(cons_0, ww(n))
456 ! cwmk = max(cons_0, ww(n)-wmini(i,k))
457  psaci = min(cwmk, aa2*expf*precsl1(n)*cwmk)
458 
459  ww(n) = ww(n) - psaci
460  precsl(n) = precsl(n) + (wws - ww(n)) * condt(n)
461  else ! liquid water
462 !
471 ! for using sundqvist precip formulation of rain
472 !
473  amaxcm = max(cons_0, cwmk - wmink(n))
474 !! amaxcm = cwmk
475  tem1 = precsl1(n) + precrl1(n)
476  tem2 = min(max(cons_0, 268.0-tt(n)), cons_20)
477  tem = (1.0+c1*sqrt(tem1*rdt)) * (1+c2*sqrt(tem2))
478 !
479  tem2 = amaxcm * cmr * tem / max(ccr(n),cons_p01)
480  tem2 = min(cons_50, tem2*tem2)
481 ! praut = c00 * tem * amaxcm * (1.0-exp(-tem2))
482  praut = (prautco(i)*dt) * tem * amaxcm
483  & * (1.0-exp(-tem2))
484  praut = min(praut, cwmk)
485  ww(n) = ww(n) - praut
486 !
496 ! below is for zhao's precip formulation (water)
497 !
498 ! amaxcm = max(cons_0, cwmk - wmink(n))
499 ! praut = min(cwmk, c00*amaxcm*amaxcm)
500 ! ww(n) = ww(n) - praut
501 !
502 ! cwmk = max(cons_0, ww(n))
503 ! tem1 = precsl1(n) + precrl1(n)
504 ! pracw = min(cwmk, cr*dt*tem1*cwmk)
505 ! ww(n) = ww(n) - pracw
506 !
507  precrl(n) = precrl(n) + (wws - ww(n)) * condt(n)
508 !
509 !hchuang code change [+1l] : add record to record information in vertical
510 ! turn rnp in unit of ww (cwm and q, kg/kg ???)
511  rnp(n) = rnp(n) + (wws - ww(n))
512  endif
513  endif
514  enddo
537 !
538 !-----evaporation of precipitation-------------------------
539 !**** err & ers positive--->evaporation-- negtive--->condensation
540 !
541  do n=1,ihpr
542  if (comput(n)) then
543  i = ipr(n)
544  qk = max(epsq, qq(n))
545  tmt0k = max(cons_m30, tmt0(n))
546  precrk = max(cons_0, precrl(n))
547  precsk = max(cons_0, precsl(n))
548  amaxrq = max(cons_0, u00k(i,k)-rq(n)) * conde(n)
549 !----------------------------------------------------------------------
550 ! increase the evaporation for strong/light prec
551 !----------------------------------------------------------------------
552  ppr = ke * amaxrq * sqrt(precrk)
553 ! ppr = ke * amaxrq * sqrt(precrk*rdt)
554  if (tmt0(n) .ge. 0.) then
555  pps = 0.
556  else
557  pps = (crs1+crs2*tmt0k) * amaxrq * precsk / u00k(i,k)
558  end if
559 !---------------correct if over-evapo./cond. occurs--------------------
560  erk=precrk+precsk
561  if(rq(n).ge.1.0e-10) erk = amaxrq * qk * rdt / rq(n)
562  if (ppr+pps .gt. abs(erk)) then
563  rprs = erk / (precrk+precsk)
564  ppr = precrk * rprs
565  pps = precsk * rprs
566  endif
567  ppr = min(ppr, precrk)
568  pps = min(pps, precsk)
569  err(n) = ppr * rconde(n)
570  ers(n) = pps * rconde(n)
571  precrl(n) = precrl(n) - ppr
572 !hchuang code change [+1l] : add record to record information in vertical
573 ! use err for kg/kg/dt not the ppr (mm/dt=kg/m2/dt)
574 !
575  rnp(n) = rnp(n) - err(n)
576 !
577  precsl(n) = precsl(n) - pps
578  endif
579  enddo
611 !--------------------melting of the snow--------------------------------
612  do n=1,ihpr
613  if (comput(n)) then
614  if (tmt0(n) .gt. 0.) then
615  amaxps = max(cons_0, precsl(n))
616  psm1 = csm1 * tmt0(n) * tmt0(n) * amaxps
617  psm2 = cws * cr * max(cons_0, ww(n)) * amaxps
618  ppr = (psm1 + psm2) * conde(n)
619  if (ppr .gt. amaxps) then
620  ppr = amaxps
621  psm1 = amaxps * rconde(n)
622  endif
623  precrl(n) = precrl(n) + ppr
624 !
625 !hchuang code change [+1l] : add record to record information in vertical
626 ! turn ppr (mm/dt=kg/m2/dt) to kg/kg/dt -> ppr/air density (kg/m3)
627  rnp(n) = rnp(n) + ppr * rconde(n)
628 !
629  precsl(n) = precsl(n) - ppr
630  else
631  psm1 = d00
632  endif
633 !
634 !---------------update t and q------------------------------------------
642 
643  tt(n) = tt(n) - dtcp * (elwv*err(n)+eliv*ers(n)+eliw*psm1)
644  qq(n) = qq(n) + dt * (err(n)+ers(n))
645  endif
646  enddo
647 !
648  do n=1,ihpr
649  iwl1(n) = iwl(n)
650  precrl1(n) = max(cons_0, precrl(n))
651  precsl1(n) = max(cons_0, precsl(n))
652  i = ipr(n)
653  t(i,k) = tt(n)
654  q(i,k) = qq(n)
655  cwm(i,k) = ww(n)
656  iw(i,k) = iwl(n)
657 !hchuang code change [+1l] : add record to record information in vertical
658 ! rnp = precrl1*rconde(n) unit in kg/kg/dt
659 !
660  rainp(i,k) = rnp(n)
661  enddo
662 !
663 ! move water from vapor to liquid should the liquid amount be negative
664 !
665  do i = 1, im
666  if (cwm(i,k) < 0.) then
667  tem = q(i,k) + cwm(i,k)
668  if (tem >= 0.0) then
669  q(i,k) = tem
670  t(i,k) = t(i,k) - elwv * rcp * cwm(i,k)
671  cwm(i,k) = 0.
672  elseif (q(i,k) > 0.0) then
673  cwm(i,k) = tem
674  t(i,k) = t(i,k) + elwv * rcp * q(i,k)
675  q(i,k) = 0.0
676  endif
677  endif
678  enddo
679 !
680  enddo ! k loop ends here!
681 !**********************************************************************
682 !-----------------------end of precipitation processes-----------------
683 !**********************************************************************
684 !
693  do n=1,ihpr
694  i = ipr(n)
695  rn(i) = (precrl1(n) + precsl1(n)) * rrow ! precip at surface
696 !
697 !----sr=1 if sfc prec is rain ; ----sr=-1 if sfc prec is snow
698 !----sr=0 for both of them or no sfc prec
699 !
700 ! rid = 0.
701 ! sid = 0.
702 ! if (precrl1(n) .ge. 1.e-13) rid = 1.
703 ! if (precsl1(n) .ge. 1.e-13) sid = -1.
704 ! sr(i) = rid + sid ! sr=1 --> rain, sr=-1 -->snow, sr=0 -->both
705 ! chuang, june 2013: change sr to define fraction of frozen precipitation instead
706 ! because wpc uses it in their winter experiment
707 
708  rid = precrl1(n) + precsl1(n)
709  if (rid < 1.e-13) then
710  sr(i) = 0.
711  else
712  sr(i) = precsl1(n)/rid
713  endif
714  enddo
715 !
716  return
717  end
718 !! @}
real(kind=kind_phys), parameter con_g
gravity ( )
Definition: physcons.f:59
subroutine precpd(im, ix, km, dt, del, prsl, q, cwm, t, rn, sr , rainp, u00k, psautco, prautco, evpco, wminco , lprnt, jpr)
Definition: precpd.f:80
real(kind=kind_phys), parameter con_hfus
lat heat H2O fusion ( )
Definition: physcons.f:92
real(kind=kind_phys), parameter con_cp
spec heat air at p ( )
Definition: physcons.f:80
real(kind=kind_phys), parameter con_hvap
lat heat H2O cond ( )
Definition: physcons.f:90
real(kind=kind_phys), parameter con_ttp
temp at H2O 3pt (K)
Definition: physcons.f:98