GFS Operational Physics Documentation  gsm/branches/DTC/phys-doc-all phys-doc-all R82971
gscond.f
Go to the documentation of this file.
1 
5 
39 
52 
84  subroutine gscond (im,ix,km,dt,dtf,prsl,ps,q,cwm,t &
85  &, tp, qp, psp, tp1, qp1, psp1, u, lprnt, ipr)
86 !
87 ! ******************************************************************
88 ! * *
89 ! * subroutine for grid-scale condensation & evaporation *
90 ! * for the mrf model at ncep. *
91 ! * *
92 ! ******************************************************************
93 ! * *
94 ! * created by: q. zhao jan. 1995 *
95 ! * modified by: h.-l. pan sep. 1998 *
96 ! * modified by: s. moorthi aug. 1998, 1999, 2000 *
97 ! * *
98 ! * references: *
99 ! * *
100 ! ******************************************************************
101 !
102  use machine , only : kind_phys
103  use funcphys , only : fpvs
104  use physcons, psat => con_psat, hvap => con_hvap, grav => con_g
105  &, hfus => con_hfus, ttp => con_ttp, rd => con_rd
106  &, cp => con_cp, eps => con_eps, epsm1 => con_epsm1
107  &, rv => con_rv
108 ! use namelist_def, only: nsdfi,fhdfi
109  implicit none
110 !
111  real (kind=kind_phys) h1
112  &, d00, elwv, eliv
113  &, epsq
114  &, r, cpr, rcp
115  parameter(h1=1.e0, d00=0.e0
116  &, elwv=hvap, eliv=hvap+hfus
117  &, epsq=2.e-12, r=rd
118  &, cpr=cp*r, rcp=h1/cp)
119 !
120  real(kind=kind_phys), parameter :: cons_0=0.0, cons_m15=-15.0
121 !
122  integer im, ix, km, ipr
123  real (kind=kind_phys) q(ix,km), t(ix,km), cwm(ix,km) &
124  &, prsl(ix,km), ps(im), dt, dtf &
125  &, tp(ix,km), qp(ix,km), psp(im) &
126  &, tp1(ix,km), qp1(ix,km), psp1(im)
127 !
128  real (kind=kind_phys) qi(im), qint(im), u(im,km), ccrik, e0
129  &, cond, rdt, us, cclimit, climit
130  &, tmt0, tmt15, qik, cwmik
131  &, ai, qw, u00ik, tik, pres, pp0, fi
132  &, at, aq, ap, fiw, elv, qc, rqik
133  &, rqikk, tx1, tx2, tx3, es, qs
134  &, tsq, delq, condi, cone0, us00, ccrik1
135  &, aa, ab, ac, ad, ae, af, ag
136  &, el2orc, albycp
137 ! real (kind=kind_phys) vprs(im)
138  integer iw(im,km), i, k, iwik
139  logical lprnt
140 !
141 !-----------------prepare constants for later uses-----------------
142 !
143  el2orc = hvap*hvap / (rv*cp)
144  albycp = hvap / cp
145 ! write(0,*)' in gscond im=',im,' ix=',ix
146 !
147  rdt = h1/dt
148  us = h1
149  cclimit = 1.0e-3
150  climit = 1.0e-20
151 !
152  do i = 1, im
153  iw(i,km) = d00
154  enddo
155 !
156 ! check for first time step
157 !
158 ! if (tp(1,1) < 1.) then
159 ! do k = 1, km
160 ! do i = 1, im
161 ! tp(i,k) = t(i,k)
162 ! qp(i,k) = max(q(i,k),epsq)
163 ! tp1(i,k) = t(i,k)
164 ! qp1(i,k) = max(q(i,k),epsq)
165 ! enddo
166 ! enddo
167 ! do i = 1, im
168 ! psp(i) = ps(i)
169 ! psp1(i) = ps(i)
170 ! enddo
171 ! endif
172 !
173 !*************************************************************
176 !*************************************************************
177 !
178 ! do k = km-1,2,-1
179  do k = km,1,-1
180 ! vprs(:) = 0.001 * fpvs(t(:,k)) ! fpvs in pa
181 !-----------------------------------------------------------------------
182 !------------------qw, qi and qint--------------------------------------
183  do i = 1, im
184  tmt0 = t(i,k)-273.16
185  tmt15 = min(tmt0,cons_m15)
186  qik = max(q(i,k),epsq)
187  cwmik = max(cwm(i,k),climit)
188 !
189 ! ai = 0.008855
190 ! bi = 1.0
191 ! if (tmt0 .lt. -20.0) then
192 ! ai = 0.007225
193 ! bi = 0.9674
194 ! end if
195 !
196 ! the global qsat computation is done in pa
197  pres = prsl(i,k)
198 !
199 ! qw = vprs(i)
200  qw = min(pres, fpvs(t(i,k)))
201 !
202  qw = eps * qw / (pres + epsm1 * qw)
203  qw = max(qw,epsq)
204 ! qi(i) = qw *(bi+ai*min(tmt0,cons_0))
205 ! qint(i) = qw *(1.-0.00032*tmt15*(tmt15+15.))
206  qi(i) = qw
207  qint(i) = qw
208 ! if (tmt0 .le. -40.) qint(i) = qi(i)
225 !-------------------ice-water id number iw------------------------------
226  if(tmt0.lt.-15.0) then
227  u00ik = u(i,k)
228  fi = qik - u00ik*qi(i)
229  if(fi > d00.or.cwmik > climit) then
230  iw(i,k) = 1
231  else
232  iw(i,k) = 0
233  end if
234  end if
235 !
236  if(tmt0.ge.0.0) then
237  iw(i,k) = 0
238  end if
239 !
240  if (tmt0 < 0.0 .and. tmt0 >= -15.0) then
241  iw(i,k) = 0
242  if (k < km) then
243  if (iw(i,k+1) == 1 .and. cwmik > climit) iw(i,k) = 1
244  endif
245  end if
246  enddo
248 !--------------condensation and evaporation of cloud--------------------
249  do i = 1, im
262 !------------------------at, aq and dp/dt-------------------------------
263  qik = max(q(i,k),epsq)
264  cwmik = max(cwm(i,k),climit)
265  iwik = iw(i,k)
266  u00ik = u(i,k)
267  tik = t(i,k)
268  pres = prsl(i,k)
269  pp0 = (pres / ps(i)) * psp(i)
270  at = (tik-tp(i,k)) * rdt
271  aq = (qik-qp(i,k)) * rdt
272  ap = (pres-pp0) * rdt
275 !----------------the satuation specific humidity------------------------
276  fiw = float(iwik)
277  elv = (h1-fiw)*elwv + fiw*eliv
278  qc = (h1-fiw)*qint(i) + fiw*qi(i)
279 ! if (lprnt) print *,' qc=',qc,' qint=',qint(i),' qi=',qi(i)
280 !----------------the relative humidity----------------------------------
281  if(qc.le.1.0e-10) then
282  rqik=d00
283  else
284  rqik = qik/qc
285  endif
369 !----------------cloud cover ratio ccrik--------------------------------
370  if (rqik .lt. u00ik) then
371  ccrik = d00
372  elseif(rqik.ge.us) then
373  ccrik = us
374  else
375  rqikk = min(us,rqik)
376  ccrik = h1-sqrt((us-rqikk)/(us-u00ik))
377  endif
378 !-----------correct ccr if it is too small in large cwm regions--------
379 ! if(ccrik.ge.0.01.and.ccrik.le.0.2.and
380 ! & .cwmik.ge.0.2e-3) then
381 ! ccrik=min(1.0,cwmik*1.0e3)
382 ! end if
383 !----------------------------------------------------------------------
384 ! if no cloud exists then evaporate any existing cloud condensate
385 !----------------evaporation of cloud water-----------------------------
386  e0 = d00
387  if (ccrik <= cclimit.and. cwmik > climit) then
388 !
389 ! first iteration - increment halved
390 !
391  tx1 = tik
392  tx3 = qik
393 !
394  es = min(pres, fpvs(tx1))
395  qs = u00ik * eps * es / (pres + epsm1*es)
396  tsq = tx1 * tx1
397  delq = 0.5 * (qs - tx3) * tsq / (tsq + el2orc * qs)
398 !
399  tx2 = delq
400  tx1 = tx1 - delq * albycp
401  tx3 = tx3 + delq
402 !
403 ! second iteration
404 !
405  es = min(pres, fpvs(tx1))
406  qs = u00ik * eps * es / (pres + epsm1*es)
407  tsq = tx1 * tx1
408  delq = (qs - tx3) * tsq / (tsq + el2orc * qs)
409 !
410  tx2 = tx2 + delq
411  tx1 = tx1 - delq * albycp
412  tx3 = tx3 + delq
413 !
414 ! third iteration
415 !
416  es = min(pres, fpvs(tx1))
417  qs = u00ik * eps * es / (pres + epsm1*es)
418  tsq = tx1 * tx1
419  delq = (qs - tx3) * tsq / (tsq + el2orc * qs)
420  tx2 = tx2 + delq
421 !
422  e0 = max(tx2*rdt, cons_0)
423 ! if (lprnt .and. i .eq. ipr .and. k .eq. 34)
424 ! & print *,' tx2=',tx2,' qc=',qc,' u00ik=',u00ik,' rqik=',rqik
425 ! &,' cwmik=',cwmik,' e0',e0
426 
427 ! e0 = max(qc*(u00ik-rqik)*rdt, cons_0)
428  e0 = min(cwmik*rdt, e0)
429  e0 = max(cons_0,e0)
430  end if
431 ! if cloud cover > 0.2 condense water vapor in to cloud condensate
432 !-----------the eqs. for cond. has been reorganized to reduce cpu------
433  cond = d00
434 ! if (ccrik .gt. 0.20 .and. qc .gt. epsq) then
435  if (ccrik .gt. cclimit .and. qc .gt. epsq) then
436  us00 = us - u00ik
437  ccrik1 = 1.0 - ccrik
438  aa = eps*elv*pres*qik
439  ab = ccrik*ccrik1*qc*us00
440  ac = ab + 0.5*cwmik
441  ad = ab * ccrik1
442  ae = cpr*tik*tik
443  af = ae * pres
444  ag = aa * elv
445  ai = cp * aa
446  cond = (ac-ad)*(af*aq-ai*at+ae*qik*ap)/(ac*(af+ag))
447 !-----------check & correct if over condensation occurs-----------------
448  condi = (qik -u00ik *qc*1.0)*rdt
449  cond = min(cond, condi)
450 !----------check & correct if supersatuation is too high----------------
451 ! qtemp=qik-max(0.,(cond-e0))*dt
452 ! if(qc.le.1.0e-10) then
453 ! rqtmp=0.0
454 ! else
455 ! rqtmp=qtemp/qc
456 ! end if
457 ! if(rqtmp.ge.1.10) then
458 ! cond=(qik-1.10*qc)*rdt
459 ! end if
460 !-----------------------------------------------------------------------
461  cond = max(cond, d00)
462 !-------------------update of t, q and cwm------------------------------
463  end if
464  cone0 = (cond-e0) * dt
465  cwm(i,k) = cwm(i,k) + cone0
466 ! if (lprnt .and. i .eq. ipr) print *,' t=',t(i,k),' cone0',cone0
467 ! &,' cond=',cond,' e0=',e0,' elv=',elv,' rcp=',rcp,' k=',k
468 ! &,' cwm=',cwm(i,k)
469  t(i,k) = t(i,k) + elv*rcp*cone0
470  q(i,k) = q(i,k) - cone0
471  enddo ! end of i-loop!
472  enddo ! end of k-loop!
473 !
474 !*********************************************************************
476 !*********************************************************************
477 !
478 
480 
481  if (dt > dtf+0.001) then ! three time level
482  do k = 1, km
483  do i = 1, im
484  tp(i,k) = tp1(i,k)
485  qp(i,k) = qp1(i,k)
486 !
487  tp1(i,k) = t(i,k)
488  qp1(i,k) = max(q(i,k),epsq)
489  enddo
490  enddo
491  do i = 1, im
492  psp(i) = psp1(i)
493  psp1(i) = ps(i)
494  enddo
495  else ! two time level scheme - tp1, qp1, psp1 not used
496  do k = 1, km
497 ! write(0,*)' in gscond k=',k,' im=',im,' km=',km
498  do i = 1, im
499 ! write(0,*)' in gscond i=',i
500  tp(i,k) = t(i,k)
501  qp(i,k) = max(q(i,k),epsq)
502 ! qp(i,k) = q(i,k)
503  tp1(i,k) = tp(i,k)
504  qp1(i,k) = qp(i,k)
505  enddo
506  enddo
507  do i = 1, im
508  psp(i) = ps(i)
509  psp1(i) = ps(i)
510  enddo
511  endif
512 !-----------------------------------------------------------------------
513  return
514  end
515 
real(kind=kind_phys), parameter con_g
gravity ( )
Definition: physcons.f:59
real(kind=kind_phys), parameter con_rv
gas constant H2O ( )
Definition: physcons.f:78
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
subroutine gscond(im, ix, km, dt, dtf, prsl, ps, q, cwm, t , tp, qp, psp, tp1, qp1, psp1, u, lprnt, ipr)
Definition: gscond.f:86
real(kind=kind_phys), parameter con_ttp
temp at H2O 3pt (K)
Definition: physcons.f:98
real(kind=kind_phys), parameter con_rd
gas constant air ( )
Definition: physcons.f:76
real(kind=kind_phys), parameter con_psat
pres at H2O 3pt (Pa)
Definition: physcons.f:94