FV3 Bundle
fv_sg_tlm.F90
Go to the documentation of this file.
1 !***********************************************************************
2 !* GNU General Public License *
3 !* This file is a part of fvGFS. *
4 !* *
5 !* fvGFS is free software; you can redistribute it and/or modify it *
6 !* and are expected to follow the terms of the GNU General Public *
7 !* License as published by the Free Software Foundation; either *
8 !* version 2 of the License, or (at your option) any later version. *
9 !* *
10 !* fvGFS is distributed in the hope that it will be useful, but *
11 !* WITHOUT ANY WARRANTY; without even the implied warranty of *
12 !* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13 !* General Public License for more details. *
14 !* *
15 !* For the full text of the GNU General Public License, *
16 !* write to: Free Software Foundation, Inc., *
17 !* 675 Mass Ave, Cambridge, MA 02139, USA. *
18 !* or see: http://www.gnu.org/licenses/gpl.html *
19 !***********************************************************************
21 
22 !-----------------------------------------------------------------------
23 ! FV sub-grid mixing
24 !-----------------------------------------------------------------------
29  use fv_mp_nlm_mod, only: mp_reduce_min, is_master
30 
31 implicit none
32 private
33 
34 public fv_subgrid_z_tlm
35 public fv_subgrid_z, neg_adj3
36 
37  real, parameter:: esl = 0.621971831
38  real, parameter:: tice = 273.16
39 ! real, parameter:: c_ice = 2106. ! Emanuel table, page 566
40  real, parameter:: c_ice = 1972. ! -15 C
41  real, parameter:: c_liq = 4.1855e+3 ! GFS
42 ! real, parameter:: c_liq = 4218. ! ECMWF-IFS
43  real, parameter:: cv_vap = cp_vapor - rvgas ! 1384.5
44  real, parameter:: c_con = c_ice
45 
46 ! real, parameter:: dc_vap = cp_vapor - c_liq ! = -2368.
47  real, parameter:: dc_vap = cv_vap - c_liq ! = -2368.
48  real, parameter:: dc_ice = c_liq - c_ice ! = 2112.
49 ! Values at 0 Deg C
50  real, parameter:: hlv0 = 2.5e6
51  real, parameter:: hlf0 = 3.3358e5
52 ! real, parameter:: hlv0 = 2.501e6 ! Emanual Appendix-2
53 ! real, parameter:: hlf0 = 3.337e5 ! Emanual
54  real, parameter:: t_ice = 273.16
55  real, parameter:: ri_max = 1.
56  real, parameter:: ri_min = 0.25
57  real, parameter:: t1_min = 160.
58  real, parameter:: t2_min = 165.
59  real, parameter:: t2_max = 315.
60  real, parameter:: t3_max = 325.
61  real, parameter:: lv0 = hlv0 - dc_vap*t_ice ! = 3.147782e6
62  real, parameter:: li0 = hlf0 - dc_ice*t_ice ! = -2.431928e5
63 
64  real, parameter:: zvir = rvgas/rdgas - 1. ! = 0.607789855
65  real, allocatable:: table(:),des(:)
66  real:: lv00, d0_vap
67 
68 CONTAINS
69 ! Differentiation of fv_subgrid_z in forward (tangent) mode:
70 ! variations of useful results: qa w ta
71 ! with respect to varying inputs: qa peln w delp ua delz va pkz
72 ! pe ta
73  SUBROUTINE fv_subgrid_z_tlm(isd, ied, jsd, jed, is, ie, js, je, km, nq&
74 & , dt, tau, nwat, delp, delp_tl, pe, pe_tl, peln, peln_tl, pkz, &
75 & pkz_tl, ta, ta_tl, qa, qa_tl, ua, ua_tl, va, va_tl, hydrostatic, w, &
76 & w_tl, delz, delz_tl, u_dt, v_dt, t_dt, k_bot)
77  IMPLICIT NONE
78 ! Dry convective adjustment-mixing
79 !-------------------------------------------
80  INTEGER, INTENT(IN) :: is, ie, js, je, km, nq, nwat
81  INTEGER, INTENT(IN) :: isd, ied, jsd, jed
82 ! Relaxation time scale
83  INTEGER, INTENT(IN) :: tau
84 ! model time step
85  REAL, INTENT(IN) :: dt
86  REAL, INTENT(IN) :: pe(is-1:ie+1, km+1, js-1:je+1)
87  REAL, INTENT(IN) :: pe_tl(is-1:ie+1, km+1, js-1:je+1)
88  REAL, INTENT(IN) :: peln(is:ie, km+1, js:je)
89  REAL, INTENT(IN) :: peln_tl(is:ie, km+1, js:je)
90 ! Delta p at each model level
91  REAL, INTENT(IN) :: delp(isd:ied, jsd:jed, km)
92  REAL, INTENT(IN) :: delp_tl(isd:ied, jsd:jed, km)
93 ! Delta z at each model level
94  REAL, INTENT(IN) :: delz(isd:, jsd:, :)
95  REAL, INTENT(IN) :: delz_tl(isd:, jsd:, :)
96  REAL, INTENT(IN) :: pkz(is:ie, js:je, km)
97  REAL, INTENT(IN) :: pkz_tl(is:ie, js:je, km)
98  LOGICAL, INTENT(IN) :: hydrostatic
99  INTEGER, INTENT(IN), OPTIONAL :: k_bot
100 !
101  REAL, INTENT(INOUT) :: ua(isd:ied, jsd:jed, km)
102  REAL, INTENT(INOUT) :: ua_tl(isd:ied, jsd:jed, km)
103  REAL, INTENT(INOUT) :: va(isd:ied, jsd:jed, km)
104  REAL, INTENT(INOUT) :: va_tl(isd:ied, jsd:jed, km)
105  REAL, INTENT(INOUT) :: w(isd:, jsd:, :)
106  REAL, INTENT(INOUT) :: w_tl(isd:, jsd:, :)
107 ! Temperature
108  REAL, INTENT(INOUT) :: ta(isd:ied, jsd:jed, km)
109  REAL, INTENT(INOUT) :: ta_tl(isd:ied, jsd:jed, km)
110 ! Specific humidity & tracers
111  REAL, INTENT(INOUT) :: qa(isd:ied, jsd:jed, km, nq)
112  REAL, INTENT(INOUT) :: qa_tl(isd:ied, jsd:jed, km, nq)
113  REAL, INTENT(INOUT) :: u_dt(isd:ied, jsd:jed, km)
114  REAL, INTENT(INOUT) :: v_dt(isd:ied, jsd:jed, km)
115  REAL, INTENT(INOUT) :: t_dt(is:ie, js:je, km)
116 !---------------------------Local variables-----------------------------
117  REAL, DIMENSION(is:ie, km) :: u0, v0, w0, t0, hd, te, gz, tvm, pm, &
118 & den
119  REAL, DIMENSION(is:ie, km) :: u0_tl, v0_tl, w0_tl, t0_tl, hd_tl, &
120 & te_tl, gz_tl, tvm_tl, pm_tl
121  REAL :: q0(is:ie, km, nq), qcon(is:ie, km)
122  REAL :: q0_tl(is:ie, km, nq), qcon_tl(is:ie, km)
123  REAL, DIMENSION(is:ie) :: gzh, lcp2, icp2, cvm, cpm, qs
124  REAL, DIMENSION(is:ie) :: gzh_tl, cvm_tl, cpm_tl
125  REAL :: ri_ref, ri, pt1, pt2, ratio, tv, cv, tmp, q_liq, q_sol
126  REAL :: ri_ref_tl, ri_tl, pt1_tl, pt2_tl, tv_tl, tmp_tl, q_liq_tl, &
127 & q_sol_tl
128  REAL :: tv1, tv2, g2, h0, mc, fra, rk, rz, rdt, tvd, tv_surf
129  REAL :: tv1_tl, tv2_tl, h0_tl, mc_tl
130  REAL :: dh, dq, qsw, dqsdt, tcp3, t_max, t_min
131  INTEGER :: i, j, k, kk, n, m, iq, km1, im, kbot
132  REAL, PARAMETER :: ustar2=1.e-4
133  REAL :: cv_air, xvir
134  INTEGER :: sphum, liq_wat, rainwat, snowwat, graupel, ice_wat, &
135 & cld_amt
136  INTRINSIC present
137  INTRINSIC min
138  INTRINSIC real
139  INTRINSIC max
140  INTEGER :: min1
141  REAL :: max1
142  REAL :: max1_tl
143  REAL :: max2
144  REAL :: max2_tl
145  REAL :: y1_tl
146  REAL :: y1
147 ! = rdgas * (7/2-1) = 2.5*rdgas=717.68
148  cv_air = cp_air - rdgas
149  rk = cp_air/rdgas + 1.
150  cv = cp_air - rdgas
151  g2 = 0.5*grav
152  rdt = 1./dt
153  im = ie - is + 1
154  IF (PRESENT(k_bot)) THEN
155  IF (k_bot .LT. 3) THEN
156  RETURN
157  ELSE
158  kbot = k_bot
159  END IF
160  ELSE
161  kbot = km
162  END IF
163  IF (pe(is, 1, js) .LT. 2.) THEN
164  t_min = t1_min
165  ELSE
166  t_min = t2_min
167  END IF
168  IF (km .GT. 24) THEN
169  min1 = 24
170  ELSE
171  min1 = km
172  END IF
173  IF (k_bot .LT. min1) THEN
174  t_max = t2_max
175  ELSE
176  t_max = t3_max
177  END IF
178  sphum = 1
179  rainwat = -1
180  snowwat = -1
181  graupel = -1
182  IF (nwat .EQ. 0) THEN
183  xvir = 0.
184  rz = 0.
185  ELSE
186  xvir = zvir
187 ! rz = zvir * rdgas
188  rz = rvgas - rdgas
189  IF (nwat .EQ. 3) THEN
190  liq_wat = 2
191  ice_wat = 3
192  END IF
193  END IF
194 !------------------------------------------------------------------------
195 ! The nonhydrostatic pressure changes if there is heating (under constant
196 ! volume and mass is locally conserved).
197 !------------------------------------------------------------------------
198  m = 3
199  fra = dt/REAL(tau)
200  cvm_tl = 0.0
201  v0_tl = 0.0
202  gz_tl = 0.0
203  cpm_tl = 0.0
204  hd_tl = 0.0
205  w0_tl = 0.0
206  tvm_tl = 0.0
207  t0_tl = 0.0
208  q0_tl = 0.0
209  gzh_tl = 0.0
210  qcon_tl = 0.0
211  u0_tl = 0.0
212  pm_tl = 0.0
213  te_tl = 0.0
214 !$OMP parallel do default(none) shared(im,is,ie,js,je,nq,kbot,qa,ta,sphum,ua,va,delp,peln, &
215 !$OMP hydrostatic,pe,delz,g2,w,liq_wat,rainwat,ice_wat, &
216 !$OMP snowwat,cv_air,m,graupel,pkz,rk,rz,fra, t_max, t_min, &
217 !$OMP u_dt,rdt,v_dt,xvir,nwat) &
218 !$OMP private(kk,lcp2,icp2,tcp3,dh,dq,den,qs,qsw,dqsdt,qcon,q0, &
219 !$OMP t0,u0,v0,w0,h0,pm,gzh,tvm,tmp,cpm,cvm,q_liq,q_sol, &
220 !$OMP tv,gz,hd,te,ratio,pt1,pt2,tv1,tv2,ri_ref, ri,mc,km1)
221  DO j=js,je
222  DO iq=1,nq
223  DO k=1,kbot
224  DO i=is,ie
225  q0_tl(i, k, iq) = qa_tl(i, j, k, iq)
226  q0(i, k, iq) = qa(i, j, k, iq)
227  END DO
228  END DO
229  END DO
230  DO k=1,kbot
231  DO i=is,ie
232  t0_tl(i, k) = ta_tl(i, j, k)
233  t0(i, k) = ta(i, j, k)
234  tvm_tl(i, k) = t0_tl(i, k)*(1.+xvir*q0(i, k, sphum)) + t0(i, k&
235 & )*xvir*q0_tl(i, k, sphum)
236  tvm(i, k) = t0(i, k)*(1.+xvir*q0(i, k, sphum))
237  u0_tl(i, k) = ua_tl(i, j, k)
238  u0(i, k) = ua(i, j, k)
239  v0_tl(i, k) = va_tl(i, j, k)
240  v0(i, k) = va(i, j, k)
241  pm_tl(i, k) = (delp_tl(i, j, k)*(peln(i, k+1, j)-peln(i, k, j)&
242 & )-delp(i, j, k)*(peln_tl(i, k+1, j)-peln_tl(i, k, j)))/(peln&
243 & (i, k+1, j)-peln(i, k, j))**2
244  pm(i, k) = delp(i, j, k)/(peln(i, k+1, j)-peln(i, k, j))
245  END DO
246  END DO
247  DO i=is,ie
248  gzh_tl(i) = 0.0
249  gzh(i) = 0.
250  END DO
251  IF (hydrostatic) THEN
252  DO k=kbot,1,-1
253  DO i=is,ie
254  tv_tl = rdgas*tvm_tl(i, k)
255  tv = rdgas*tvm(i, k)
256  den(i, k) = pm(i, k)/tv
257  gz_tl(i, k) = gzh_tl(i) + tv_tl*(1.-pe(i, k, j)/pm(i, k)) - &
258 & tv*(pe_tl(i, k, j)*pm(i, k)-pe(i, k, j)*pm_tl(i, k))/pm(i&
259 & , k)**2
260  gz(i, k) = gzh(i) + tv*(1.-pe(i, k, j)/pm(i, k))
261  hd_tl(i, k) = cp_air*tvm_tl(i, k) + gz_tl(i, k) + 0.5*(2*u0(&
262 & i, k)*u0_tl(i, k)+2*v0(i, k)*v0_tl(i, k))
263  hd(i, k) = cp_air*tvm(i, k) + gz(i, k) + 0.5*(u0(i, k)**2+v0&
264 & (i, k)**2)
265  gzh_tl(i) = gzh_tl(i) + tv_tl*(peln(i, k+1, j)-peln(i, k, j)&
266 & ) + tv*(peln_tl(i, k+1, j)-peln_tl(i, k, j))
267  gzh(i) = gzh(i) + tv*(peln(i, k+1, j)-peln(i, k, j))
268  END DO
269  END DO
270  ELSE
271  DO k=kbot,1,-1
272  IF (nwat .EQ. 0) THEN
273  DO i=is,ie
274  cpm_tl(i) = 0.0
275  cpm(i) = cp_air
276  cvm_tl(i) = 0.0
277  cvm(i) = cv_air
278  END DO
279  ELSE IF (nwat .EQ. 1) THEN
280  DO i=is,ie
281  cpm_tl(i) = cp_vapor*q0_tl(i, k, sphum) - cp_air*q0_tl(i, &
282 & k, sphum)
283  cpm(i) = (1.-q0(i, k, sphum))*cp_air + q0(i, k, sphum)*&
284 & cp_vapor
285  cvm_tl(i) = cv_vap*q0_tl(i, k, sphum) - cv_air*q0_tl(i, k&
286 & , sphum)
287  cvm(i) = (1.-q0(i, k, sphum))*cv_air + q0(i, k, sphum)*&
288 & cv_vap
289  END DO
290  ELSE IF (nwat .EQ. 2) THEN
291 ! GFS
292  DO i=is,ie
293  cpm_tl(i) = cp_vapor*q0_tl(i, k, sphum) - cp_air*q0_tl(i, &
294 & k, sphum)
295  cpm(i) = (1.-q0(i, k, sphum))*cp_air + q0(i, k, sphum)*&
296 & cp_vapor
297  cvm_tl(i) = cv_vap*q0_tl(i, k, sphum) - cv_air*q0_tl(i, k&
298 & , sphum)
299  cvm(i) = (1.-q0(i, k, sphum))*cv_air + q0(i, k, sphum)*&
300 & cv_vap
301  END DO
302  ELSE IF (nwat .EQ. 3) THEN
303  DO i=is,ie
304  q_liq_tl = q0_tl(i, k, liq_wat)
305  q_liq = q0(i, k, liq_wat)
306  q_sol_tl = q0_tl(i, k, ice_wat)
307  q_sol = q0(i, k, ice_wat)
308  cpm_tl(i) = cp_air*(-q0_tl(i, k, sphum)-q_liq_tl-q_sol_tl)&
309 & + cp_vapor*q0_tl(i, k, sphum) + c_liq*q_liq_tl + c_ice*&
310 & q_sol_tl
311  cpm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cp_air + q0(i&
312 & , k, sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
313  cvm_tl(i) = cv_air*(-q0_tl(i, k, sphum)-q_liq_tl-q_sol_tl)&
314 & + cv_vap*q0_tl(i, k, sphum) + c_liq*q_liq_tl + c_ice*&
315 & q_sol_tl
316  cvm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cv_air + q0(i&
317 & , k, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
318  END DO
319  ELSE IF (nwat .EQ. 4) THEN
320  DO i=is,ie
321  q_liq_tl = q0_tl(i, k, liq_wat) + q0_tl(i, k, rainwat)
322  q_liq = q0(i, k, liq_wat) + q0(i, k, rainwat)
323  cpm_tl(i) = cp_air*(-q0_tl(i, k, sphum)-q_liq_tl) + &
324 & cp_vapor*q0_tl(i, k, sphum) + c_liq*q_liq_tl
325  cpm(i) = (1.-(q0(i, k, sphum)+q_liq))*cp_air + q0(i, k, &
326 & sphum)*cp_vapor + q_liq*c_liq
327  cvm_tl(i) = cv_air*(-q0_tl(i, k, sphum)-q_liq_tl) + cv_vap&
328 & *q0_tl(i, k, sphum) + c_liq*q_liq_tl
329  cvm(i) = (1.-(q0(i, k, sphum)+q_liq))*cv_air + q0(i, k, &
330 & sphum)*cv_vap + q_liq*c_liq
331  END DO
332  ELSE
333  DO i=is,ie
334  q_liq_tl = q0_tl(i, k, liq_wat) + q0_tl(i, k, rainwat)
335  q_liq = q0(i, k, liq_wat) + q0(i, k, rainwat)
336  q_sol_tl = q0_tl(i, k, ice_wat) + q0_tl(i, k, snowwat) + &
337 & q0_tl(i, k, graupel)
338  q_sol = q0(i, k, ice_wat) + q0(i, k, snowwat) + q0(i, k, &
339 & graupel)
340  cpm_tl(i) = cp_air*(-q0_tl(i, k, sphum)-q_liq_tl-q_sol_tl)&
341 & + cp_vapor*q0_tl(i, k, sphum) + c_liq*q_liq_tl + c_ice*&
342 & q_sol_tl
343  cpm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cp_air + q0(i&
344 & , k, sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
345  cvm_tl(i) = cv_air*(-q0_tl(i, k, sphum)-q_liq_tl-q_sol_tl)&
346 & + cv_vap*q0_tl(i, k, sphum) + c_liq*q_liq_tl + c_ice*&
347 & q_sol_tl
348  cvm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cv_air + q0(i&
349 & , k, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
350  END DO
351  END IF
352  DO i=is,ie
353  den(i, k) = -(delp(i, j, k)/(grav*delz(i, j, k)))
354  w0_tl(i, k) = w_tl(i, j, k)
355  w0(i, k) = w(i, j, k)
356  gz_tl(i, k) = gzh_tl(i) - g2*delz_tl(i, j, k)
357  gz(i, k) = gzh(i) - g2*delz(i, j, k)
358  tmp_tl = gz_tl(i, k) + 0.5*(2*u0(i, k)*u0_tl(i, k)+2*v0(i, k&
359 & )*v0_tl(i, k)+2*w0(i, k)*w0_tl(i, k))
360  tmp = gz(i, k) + 0.5*(u0(i, k)**2+v0(i, k)**2+w0(i, k)**2)
361  hd_tl(i, k) = cpm_tl(i)*t0(i, k) + cpm(i)*t0_tl(i, k) + &
362 & tmp_tl
363  hd(i, k) = cpm(i)*t0(i, k) + tmp
364  te_tl(i, k) = cvm_tl(i)*t0(i, k) + cvm(i)*t0_tl(i, k) + &
365 & tmp_tl
366  te(i, k) = cvm(i)*t0(i, k) + tmp
367  gzh_tl(i) = gzh_tl(i) - grav*delz_tl(i, j, k)
368  gzh(i) = gzh(i) - grav*delz(i, j, k)
369  END DO
370  END DO
371  END IF
372  DO n=1,m
373  IF (m .EQ. 3) THEN
374  IF (n .EQ. 1) ratio = 0.25
375  IF (n .EQ. 2) ratio = 0.5
376  IF (n .EQ. 3) ratio = 0.999
377  ELSE
378  ratio = REAL(n)/REAL(m)
379  END IF
380  DO i=is,ie
381  gzh_tl(i) = 0.0
382  gzh(i) = 0.
383  END DO
384 ! Compute total condensate
385  IF (nwat .LT. 2) THEN
386  DO k=1,kbot
387  DO i=is,ie
388  qcon_tl(i, k) = 0.0
389  qcon(i, k) = 0.
390  END DO
391  END DO
392  ELSE IF (nwat .EQ. 2) THEN
393 ! GFS_2015
394  DO k=1,kbot
395  DO i=is,ie
396  qcon_tl(i, k) = q0_tl(i, k, liq_wat)
397  qcon(i, k) = q0(i, k, liq_wat)
398  END DO
399  END DO
400  ELSE IF (nwat .EQ. 3) THEN
401  DO k=1,kbot
402  DO i=is,ie
403  qcon_tl(i, k) = q0_tl(i, k, liq_wat) + q0_tl(i, k, ice_wat&
404 & )
405  qcon(i, k) = q0(i, k, liq_wat) + q0(i, k, ice_wat)
406  END DO
407  END DO
408  ELSE IF (nwat .EQ. 4) THEN
409  DO k=1,kbot
410  DO i=is,ie
411  qcon_tl(i, k) = q0_tl(i, k, liq_wat) + q0_tl(i, k, rainwat&
412 & )
413  qcon(i, k) = q0(i, k, liq_wat) + q0(i, k, rainwat)
414  END DO
415  END DO
416  ELSE
417  DO k=1,kbot
418  DO i=is,ie
419  qcon_tl(i, k) = q0_tl(i, k, liq_wat) + q0_tl(i, k, ice_wat&
420 & ) + q0_tl(i, k, snowwat) + q0_tl(i, k, rainwat) + q0_tl(&
421 & i, k, graupel)
422  qcon(i, k) = q0(i, k, liq_wat) + q0(i, k, ice_wat) + q0(i&
423 & , k, snowwat) + q0(i, k, rainwat) + q0(i, k, graupel)
424  END DO
425  END DO
426  END IF
427  DO k=kbot,2,-1
428  km1 = k - 1
429  DO i=is,ie
430 ! Richardson number = g*delz * del_theta/theta / (del_u**2 + del_v**2)
431 ! Use exact form for "density temperature"
432  tv1_tl = t0_tl(i, km1)*(1.+xvir*q0(i, km1, sphum)-qcon(i, &
433 & km1)) + t0(i, km1)*(xvir*q0_tl(i, km1, sphum)-qcon_tl(i, &
434 & km1))
435  tv1 = t0(i, km1)*(1.+xvir*q0(i, km1, sphum)-qcon(i, km1))
436  tv2_tl = t0_tl(i, k)*(1.+xvir*q0(i, k, sphum)-qcon(i, k)) + &
437 & t0(i, k)*(xvir*q0_tl(i, k, sphum)-qcon_tl(i, k))
438  tv2 = t0(i, k)*(1.+xvir*q0(i, k, sphum)-qcon(i, k))
439  pt1_tl = (tv1_tl*pkz(i, j, km1)-tv1*pkz_tl(i, j, km1))/pkz(i&
440 & , j, km1)**2
441  pt1 = tv1/pkz(i, j, km1)
442  pt2_tl = (tv2_tl*pkz(i, j, k)-tv2*pkz_tl(i, j, k))/pkz(i, j&
443 & , k)**2
444  pt2 = tv2/pkz(i, j, k)
445 !
446  ri_tl = (((gz_tl(i, km1)-gz_tl(i, k))*(pt1-pt2)+(gz(i, km1)-&
447 & gz(i, k))*(pt1_tl-pt2_tl))*0.5*(pt1+pt2)*((u0(i, km1)-u0(i&
448 & , k))**2+(v0(i, km1)-v0(i, k))**2+ustar2)-(gz(i, km1)-gz(i&
449 & , k))*(pt1-pt2)*0.5*((pt1_tl+pt2_tl)*((u0(i, km1)-u0(i, k)&
450 & )**2+(v0(i, km1)-v0(i, k))**2+ustar2)+(pt1+pt2)*(2*(u0(i, &
451 & km1)-u0(i, k))*(u0_tl(i, km1)-u0_tl(i, k))+2*(v0(i, km1)-&
452 & v0(i, k))*(v0_tl(i, km1)-v0_tl(i, k)))))/(0.5*(pt1+pt2)*((&
453 & u0(i, km1)-u0(i, k))**2+(v0(i, km1)-v0(i, k))**2+ustar2))&
454 & **2
455  ri = (gz(i, km1)-gz(i, k))*(pt1-pt2)/(0.5*(pt1+pt2)*((u0(i, &
456 & km1)-u0(i, k))**2+(v0(i, km1)-v0(i, k))**2+ustar2))
457  IF (tv1 .GT. t_max .AND. tv1 .GT. tv2) THEN
458 ! top layer unphysically warm
459  ri = 0.
460  ri_tl = 0.0
461  ELSE IF (tv2 .LT. t_min) THEN
462  IF (ri .GT. 0.2) THEN
463  ri = 0.2
464  ri_tl = 0.0
465  ELSE
466  ri = ri
467  END IF
468  END IF
469  IF (400.e2 - pm(i, k) .LT. 0.) THEN
470  max2 = 0.
471  max2_tl = 0.0
472  ELSE
473  max2_tl = -pm_tl(i, k)
474  max2 = 400.e2 - pm(i, k)
475  END IF
476  y1_tl = (ri_max-ri_min)*max2_tl/200.e2
477  y1 = ri_min + (ri_max-ri_min)*max2/200.e2
478  IF (ri_max .GT. y1) THEN
479  ri_ref_tl = y1_tl
480  ri_ref = y1
481  ELSE
482  ri_ref = ri_max
483  ri_ref_tl = 0.0
484  END IF
485 ! Enhancing mixing at the model top
486  IF (k .EQ. 2) THEN
487  ri_ref_tl = 4.*ri_ref_tl
488  ri_ref = 4.*ri_ref
489  ELSE IF (k .EQ. 3) THEN
490  ri_ref_tl = 2.*ri_ref_tl
491  ri_ref = 2.*ri_ref
492  ELSE IF (k .EQ. 4) THEN
493  ri_ref_tl = 1.5*ri_ref_tl
494  ri_ref = 1.5*ri_ref
495  END IF
496  IF (ri .LT. ri_ref) THEN
497  IF (0.0 .LT. ri/ri_ref) THEN
498  max1_tl = (ri_tl*ri_ref-ri*ri_ref_tl)/ri_ref**2
499  max1 = ri/ri_ref
500  ELSE
501  max1 = 0.0
502  max1_tl = 0.0
503  END IF
504  mc_tl = (ratio*(delp_tl(i, j, km1)*delp(i, j, k)+delp(i, j&
505 & , km1)*delp_tl(i, j, k))*(delp(i, j, km1)+delp(i, j, k))&
506 & -ratio*delp(i, j, km1)*delp(i, j, k)*(delp_tl(i, j, km1)&
507 & +delp_tl(i, j, k)))*(1.-max1)**2/(delp(i, j, km1)+delp(i&
508 & , j, k))**2 - ratio*delp(i, j, km1)*delp(i, j, k)*2*(1.-&
509 & max1)*max1_tl/(delp(i, j, km1)+delp(i, j, k))
510  mc = ratio*delp(i, j, km1)*delp(i, j, k)/(delp(i, j, km1)+&
511 & delp(i, j, k))*(1.-max1)**2
512  DO iq=1,nq
513  h0_tl = mc_tl*(q0(i, k, iq)-q0(i, km1, iq)) + mc*(q0_tl(&
514 & i, k, iq)-q0_tl(i, km1, iq))
515  h0 = mc*(q0(i, k, iq)-q0(i, km1, iq))
516  q0_tl(i, km1, iq) = q0_tl(i, km1, iq) + (h0_tl*delp(i, j&
517 & , km1)-h0*delp_tl(i, j, km1))/delp(i, j, km1)**2
518  q0(i, km1, iq) = q0(i, km1, iq) + h0/delp(i, j, km1)
519  q0_tl(i, k, iq) = q0_tl(i, k, iq) - (h0_tl*delp(i, j, k)&
520 & -h0*delp_tl(i, j, k))/delp(i, j, k)**2
521  q0(i, k, iq) = q0(i, k, iq) - h0/delp(i, j, k)
522  END DO
523 ! Recompute qcon
524  IF (nwat .LT. 2) THEN
525  qcon_tl(i, km1) = 0.0
526  qcon(i, km1) = 0.
527  ELSE IF (nwat .EQ. 2) THEN
528 ! GFS_2015
529  qcon_tl(i, km1) = q0_tl(i, km1, liq_wat)
530  qcon(i, km1) = q0(i, km1, liq_wat)
531  ELSE IF (nwat .EQ. 3) THEN
532 ! AM3/AM4
533  qcon_tl(i, km1) = q0_tl(i, km1, liq_wat) + q0_tl(i, km1&
534 & , ice_wat)
535  qcon(i, km1) = q0(i, km1, liq_wat) + q0(i, km1, ice_wat)
536  ELSE IF (nwat .EQ. 4) THEN
537 ! K_warm_rain scheme with fake ice
538  qcon_tl(i, km1) = q0_tl(i, km1, liq_wat) + q0_tl(i, km1&
539 & , rainwat)
540  qcon(i, km1) = q0(i, km1, liq_wat) + q0(i, km1, rainwat)
541  ELSE
542  qcon_tl(i, km1) = q0_tl(i, km1, liq_wat) + q0_tl(i, km1&
543 & , ice_wat) + q0_tl(i, km1, snowwat) + q0_tl(i, km1, &
544 & rainwat) + q0_tl(i, km1, graupel)
545  qcon(i, km1) = q0(i, km1, liq_wat) + q0(i, km1, ice_wat)&
546 & + q0(i, km1, snowwat) + q0(i, km1, rainwat) + q0(i, &
547 & km1, graupel)
548  END IF
549 ! u:
550  h0_tl = mc_tl*(u0(i, k)-u0(i, k-1)) + mc*(u0_tl(i, k)-&
551 & u0_tl(i, k-1))
552  h0 = mc*(u0(i, k)-u0(i, k-1))
553  u0_tl(i, k-1) = u0_tl(i, k-1) + (h0_tl*delp(i, j, k-1)-h0*&
554 & delp_tl(i, j, k-1))/delp(i, j, k-1)**2
555  u0(i, k-1) = u0(i, k-1) + h0/delp(i, j, k-1)
556  u0_tl(i, k) = u0_tl(i, k) - (h0_tl*delp(i, j, k)-h0*&
557 & delp_tl(i, j, k))/delp(i, j, k)**2
558  u0(i, k) = u0(i, k) - h0/delp(i, j, k)
559 ! v:
560  h0_tl = mc_tl*(v0(i, k)-v0(i, k-1)) + mc*(v0_tl(i, k)-&
561 & v0_tl(i, k-1))
562  h0 = mc*(v0(i, k)-v0(i, k-1))
563  v0_tl(i, k-1) = v0_tl(i, k-1) + (h0_tl*delp(i, j, k-1)-h0*&
564 & delp_tl(i, j, k-1))/delp(i, j, k-1)**2
565  v0(i, k-1) = v0(i, k-1) + h0/delp(i, j, k-1)
566  v0_tl(i, k) = v0_tl(i, k) - (h0_tl*delp(i, j, k)-h0*&
567 & delp_tl(i, j, k))/delp(i, j, k)**2
568  v0(i, k) = v0(i, k) - h0/delp(i, j, k)
569  IF (hydrostatic) THEN
570 ! Static energy
571  h0_tl = mc_tl*(hd(i, k)-hd(i, k-1)) + mc*(hd_tl(i, k)-&
572 & hd_tl(i, k-1))
573  h0 = mc*(hd(i, k)-hd(i, k-1))
574  hd_tl(i, k-1) = hd_tl(i, k-1) + (h0_tl*delp(i, j, k-1)-&
575 & h0*delp_tl(i, j, k-1))/delp(i, j, k-1)**2
576  hd(i, k-1) = hd(i, k-1) + h0/delp(i, j, k-1)
577  hd_tl(i, k) = hd_tl(i, k) - (h0_tl*delp(i, j, k)-h0*&
578 & delp_tl(i, j, k))/delp(i, j, k)**2
579  hd(i, k) = hd(i, k) - h0/delp(i, j, k)
580  ELSE
581 ! Total energy
582  h0_tl = mc_tl*(hd(i, k)-hd(i, k-1)) + mc*(hd_tl(i, k)-&
583 & hd_tl(i, k-1))
584  h0 = mc*(hd(i, k)-hd(i, k-1))
585  te_tl(i, k-1) = te_tl(i, k-1) + (h0_tl*delp(i, j, k-1)-&
586 & h0*delp_tl(i, j, k-1))/delp(i, j, k-1)**2
587  te(i, k-1) = te(i, k-1) + h0/delp(i, j, k-1)
588  te_tl(i, k) = te_tl(i, k) - (h0_tl*delp(i, j, k)-h0*&
589 & delp_tl(i, j, k))/delp(i, j, k)**2
590  te(i, k) = te(i, k) - h0/delp(i, j, k)
591 ! w:
592  h0_tl = mc_tl*(w0(i, k)-w0(i, k-1)) + mc*(w0_tl(i, k)-&
593 & w0_tl(i, k-1))
594  h0 = mc*(w0(i, k)-w0(i, k-1))
595  w0_tl(i, k-1) = w0_tl(i, k-1) + (h0_tl*delp(i, j, k-1)-&
596 & h0*delp_tl(i, j, k-1))/delp(i, j, k-1)**2
597  w0(i, k-1) = w0(i, k-1) + h0/delp(i, j, k-1)
598  w0_tl(i, k) = w0_tl(i, k) - (h0_tl*delp(i, j, k)-h0*&
599 & delp_tl(i, j, k))/delp(i, j, k)**2
600  w0(i, k) = w0(i, k) - h0/delp(i, j, k)
601  END IF
602  END IF
603  END DO
604 !--------------
605 ! Retrive Temp:
606 !--------------
607  IF (hydrostatic) THEN
608  kk = k
609  DO i=is,ie
610  t0_tl(i, kk) = ((hd_tl(i, kk)-gzh_tl(i)-0.5*(2*u0(i, kk)*&
611 & u0_tl(i, kk)+2*v0(i, kk)*v0_tl(i, kk)))*(rk-pe(i, kk, j)&
612 & /pm(i, kk))+(hd(i, kk)-gzh(i)-0.5*(u0(i, kk)**2+v0(i, kk&
613 & )**2))*(pe_tl(i, kk, j)*pm(i, kk)-pe(i, kk, j)*pm_tl(i, &
614 & kk))/pm(i, kk)**2)/(rk-pe(i, kk, j)/pm(i, kk))**2
615  t0(i, kk) = (hd(i, kk)-gzh(i)-0.5*(u0(i, kk)**2+v0(i, kk)&
616 & **2))/(rk-pe(i, kk, j)/pm(i, kk))
617  gzh_tl(i) = gzh_tl(i) + t0_tl(i, kk)*(peln(i, kk+1, j)-&
618 & peln(i, kk, j)) + t0(i, kk)*(peln_tl(i, kk+1, j)-peln_tl&
619 & (i, kk, j))
620  gzh(i) = gzh(i) + t0(i, kk)*(peln(i, kk+1, j)-peln(i, kk, &
621 & j))
622  t0_tl(i, kk) = (t0_tl(i, kk)*(rdgas+rz*q0(i, kk, sphum))-&
623 & t0(i, kk)*rz*q0_tl(i, kk, sphum))/(rdgas+rz*q0(i, kk, &
624 & sphum))**2
625  t0(i, kk) = t0(i, kk)/(rdgas+rz*q0(i, kk, sphum))
626  END DO
627  kk = k - 1
628  DO i=is,ie
629  t0_tl(i, kk) = ((hd_tl(i, kk)-gzh_tl(i)-0.5*(2*u0(i, kk)*&
630 & u0_tl(i, kk)+2*v0(i, kk)*v0_tl(i, kk)))*(rk-pe(i, kk, j)&
631 & /pm(i, kk))*(rdgas+rz*q0(i, kk, sphum))-(hd(i, kk)-gzh(i&
632 & )-0.5*(u0(i, kk)**2+v0(i, kk)**2))*((rk-pe(i, kk, j)/pm(&
633 & i, kk))*rz*q0_tl(i, kk, sphum)-(pe_tl(i, kk, j)*pm(i, kk&
634 & )-pe(i, kk, j)*pm_tl(i, kk))*(rdgas+rz*q0(i, kk, sphum))&
635 & /pm(i, kk)**2))/((rk-pe(i, kk, j)/pm(i, kk))*(rdgas+rz*&
636 & q0(i, kk, sphum)))**2
637  t0(i, kk) = (hd(i, kk)-gzh(i)-0.5*(u0(i, kk)**2+v0(i, kk)&
638 & **2))/((rk-pe(i, kk, j)/pm(i, kk))*(rdgas+rz*q0(i, kk, &
639 & sphum)))
640  END DO
641  ELSE
642 ! Non-hydrostatic under constant volume heating/cooling
643  DO kk=k-1,k
644  IF (nwat .EQ. 0) THEN
645  DO i=is,ie
646  cpm_tl(i) = 0.0
647  cpm(i) = cp_air
648  cvm_tl(i) = 0.0
649  cvm(i) = cv_air
650  END DO
651  ELSE IF (nwat .EQ. 1) THEN
652  DO i=is,ie
653  cpm_tl(i) = cp_vapor*q0_tl(i, kk, sphum) - cp_air*&
654 & q0_tl(i, kk, sphum)
655  cpm(i) = (1.-q0(i, kk, sphum))*cp_air + q0(i, kk, &
656 & sphum)*cp_vapor
657  cvm_tl(i) = cv_vap*q0_tl(i, kk, sphum) - cv_air*q0_tl(&
658 & i, kk, sphum)
659  cvm(i) = (1.-q0(i, kk, sphum))*cv_air + q0(i, kk, &
660 & sphum)*cv_vap
661  END DO
662  ELSE IF (nwat .EQ. 2) THEN
663  DO i=is,ie
664  cpm_tl(i) = cp_vapor*q0_tl(i, kk, sphum) - cp_air*&
665 & q0_tl(i, kk, sphum)
666  cpm(i) = (1.-q0(i, kk, sphum))*cp_air + q0(i, kk, &
667 & sphum)*cp_vapor
668  cvm_tl(i) = cv_vap*q0_tl(i, kk, sphum) - cv_air*q0_tl(&
669 & i, kk, sphum)
670  cvm(i) = (1.-q0(i, kk, sphum))*cv_air + q0(i, kk, &
671 & sphum)*cv_vap
672  END DO
673  ELSE IF (nwat .EQ. 3) THEN
674  DO i=is,ie
675  q_liq_tl = q0_tl(i, kk, liq_wat)
676  q_liq = q0(i, kk, liq_wat)
677  q_sol_tl = q0_tl(i, kk, ice_wat)
678  q_sol = q0(i, kk, ice_wat)
679  cpm_tl(i) = cp_air*(-q0_tl(i, kk, sphum)-q_liq_tl-&
680 & q_sol_tl) + cp_vapor*q0_tl(i, kk, sphum) + c_liq*&
681 & q_liq_tl + c_ice*q_sol_tl
682  cpm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cp_air + &
683 & q0(i, kk, sphum)*cp_vapor + q_liq*c_liq + q_sol*&
684 & c_ice
685  cvm_tl(i) = cv_air*(-q0_tl(i, kk, sphum)-q_liq_tl-&
686 & q_sol_tl) + cv_vap*q0_tl(i, kk, sphum) + c_liq*&
687 & q_liq_tl + c_ice*q_sol_tl
688  cvm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cv_air + &
689 & q0(i, kk, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
690  END DO
691  ELSE IF (nwat .EQ. 4) THEN
692  DO i=is,ie
693  q_liq_tl = q0_tl(i, kk, liq_wat) + q0_tl(i, kk, &
694 & rainwat)
695  q_liq = q0(i, kk, liq_wat) + q0(i, kk, rainwat)
696  cpm_tl(i) = cp_air*(-q0_tl(i, kk, sphum)-q_liq_tl) + &
697 & cp_vapor*q0_tl(i, kk, sphum) + c_liq*q_liq_tl
698  cpm(i) = (1.-(q0(i, kk, sphum)+q_liq))*cp_air + q0(i, &
699 & kk, sphum)*cp_vapor + q_liq*c_liq
700  cvm_tl(i) = cv_air*(-q0_tl(i, kk, sphum)-q_liq_tl) + &
701 & cv_vap*q0_tl(i, kk, sphum) + c_liq*q_liq_tl
702  cvm(i) = (1.-(q0(i, kk, sphum)+q_liq))*cv_air + q0(i, &
703 & kk, sphum)*cv_vap + q_liq*c_liq
704  END DO
705  ELSE
706  DO i=is,ie
707  q_liq_tl = q0_tl(i, kk, liq_wat) + q0_tl(i, kk, &
708 & rainwat)
709  q_liq = q0(i, kk, liq_wat) + q0(i, kk, rainwat)
710  q_sol_tl = q0_tl(i, kk, ice_wat) + q0_tl(i, kk, &
711 & snowwat) + q0_tl(i, kk, graupel)
712  q_sol = q0(i, kk, ice_wat) + q0(i, kk, snowwat) + q0(i&
713 & , kk, graupel)
714  cpm_tl(i) = cp_air*(-q0_tl(i, kk, sphum)-q_liq_tl-&
715 & q_sol_tl) + cp_vapor*q0_tl(i, kk, sphum) + c_liq*&
716 & q_liq_tl + c_ice*q_sol_tl
717  cpm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cp_air + &
718 & q0(i, kk, sphum)*cp_vapor + q_liq*c_liq + q_sol*&
719 & c_ice
720  cvm_tl(i) = cv_air*(-q0_tl(i, kk, sphum)-q_liq_tl-&
721 & q_sol_tl) + cv_vap*q0_tl(i, kk, sphum) + c_liq*&
722 & q_liq_tl + c_ice*q_sol_tl
723  cvm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cv_air + &
724 & q0(i, kk, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
725  END DO
726  END IF
727  DO i=is,ie
728  tv_tl = gz_tl(i, kk) + 0.5*(2*u0(i, kk)*u0_tl(i, kk)+2*&
729 & v0(i, kk)*v0_tl(i, kk)+2*w0(i, kk)*w0_tl(i, kk))
730  tv = gz(i, kk) + 0.5*(u0(i, kk)**2+v0(i, kk)**2+w0(i, kk&
731 & )**2)
732  t0_tl(i, kk) = ((te_tl(i, kk)-tv_tl)*cvm(i)-(te(i, kk)-&
733 & tv)*cvm_tl(i))/cvm(i)**2
734  t0(i, kk) = (te(i, kk)-tv)/cvm(i)
735  hd_tl(i, kk) = cpm_tl(i)*t0(i, kk) + cpm(i)*t0_tl(i, kk)&
736 & + tv_tl
737  hd(i, kk) = cpm(i)*t0(i, kk) + tv
738  END DO
739  END DO
740  END IF
741  END DO
742  END DO
743 ! k-loop
744 ! n-loop
745 !--------------------
746  IF (fra .LT. 1.) THEN
747  DO k=1,kbot
748  DO i=is,ie
749  t0_tl(i, k) = ta_tl(i, j, k) + fra*(t0_tl(i, k)-ta_tl(i, j, &
750 & k))
751  t0(i, k) = ta(i, j, k) + (t0(i, k)-ta(i, j, k))*fra
752  u0_tl(i, k) = ua_tl(i, j, k) + fra*(u0_tl(i, k)-ua_tl(i, j, &
753 & k))
754  u0(i, k) = ua(i, j, k) + (u0(i, k)-ua(i, j, k))*fra
755  v0_tl(i, k) = va_tl(i, j, k) + fra*(v0_tl(i, k)-va_tl(i, j, &
756 & k))
757  v0(i, k) = va(i, j, k) + (v0(i, k)-va(i, j, k))*fra
758  END DO
759  END DO
760  IF (.NOT.hydrostatic) THEN
761  DO k=1,kbot
762  DO i=is,ie
763  w0_tl(i, k) = w_tl(i, j, k) + fra*(w0_tl(i, k)-w_tl(i, j, &
764 & k))
765  w0(i, k) = w(i, j, k) + (w0(i, k)-w(i, j, k))*fra
766  END DO
767  END DO
768  END IF
769  DO iq=1,nq
770  DO k=1,kbot
771  DO i=is,ie
772  q0_tl(i, k, iq) = qa_tl(i, j, k, iq) + fra*(q0_tl(i, k, iq&
773 & )-qa_tl(i, j, k, iq))
774  q0(i, k, iq) = qa(i, j, k, iq) + (q0(i, k, iq)-qa(i, j, k&
775 & , iq))*fra
776  END DO
777  END DO
778  END DO
779  END IF
780  DO k=1,kbot
781  DO i=is,ie
782  u_dt(i, j, k) = rdt*(u0(i, k)-ua(i, j, k))
783  v_dt(i, j, k) = rdt*(v0(i, k)-va(i, j, k))
784 ! *** temperature updated ***
785  ta_tl(i, j, k) = t0_tl(i, k)
786  ta(i, j, k) = t0(i, k)
787  ua_tl(i, j, k) = u0_tl(i, k)
788  ua(i, j, k) = u0(i, k)
789  va_tl(i, j, k) = v0_tl(i, k)
790  va(i, j, k) = v0(i, k)
791  END DO
792  DO iq=1,nq
793  DO i=is,ie
794  qa_tl(i, j, k, iq) = q0_tl(i, k, iq)
795  qa(i, j, k, iq) = q0(i, k, iq)
796  END DO
797  END DO
798  END DO
799  IF (.NOT.hydrostatic) THEN
800  DO k=1,kbot
801  DO i=is,ie
802 ! w updated
803  w_tl(i, j, k) = w0_tl(i, k)
804  w(i, j, k) = w0(i, k)
805  END DO
806  END DO
807  END IF
808  END DO
809  END SUBROUTINE fv_subgrid_z_tlm
810  SUBROUTINE fv_subgrid_z(isd, ied, jsd, jed, is, ie, js, je, km, nq, dt&
811 & , tau, nwat, delp, pe, peln, pkz, ta, qa, ua, va, hydrostatic, w, &
812 & delz, u_dt, v_dt, t_dt, k_bot)
813  IMPLICIT NONE
814 ! Dry convective adjustment-mixing
815 !-------------------------------------------
816  INTEGER, INTENT(IN) :: is, ie, js, je, km, nq, nwat
817  INTEGER, INTENT(IN) :: isd, ied, jsd, jed
818 ! Relaxation time scale
819  INTEGER, INTENT(IN) :: tau
820 ! model time step
821  REAL, INTENT(IN) :: dt
822  REAL, INTENT(IN) :: pe(is-1:ie+1, km+1, js-1:je+1)
823  REAL, INTENT(IN) :: peln(is:ie, km+1, js:je)
824 ! Delta p at each model level
825  REAL, INTENT(IN) :: delp(isd:ied, jsd:jed, km)
826 ! Delta z at each model level
827  REAL, INTENT(IN) :: delz(isd:, jsd:, :)
828  REAL, INTENT(IN) :: pkz(is:ie, js:je, km)
829  LOGICAL, INTENT(IN) :: hydrostatic
830  INTEGER, INTENT(IN), OPTIONAL :: k_bot
831 !
832  REAL, INTENT(INOUT) :: ua(isd:ied, jsd:jed, km)
833  REAL, INTENT(INOUT) :: va(isd:ied, jsd:jed, km)
834  REAL, INTENT(INOUT) :: w(isd:, jsd:, :)
835 ! Temperature
836  REAL, INTENT(INOUT) :: ta(isd:ied, jsd:jed, km)
837 ! Specific humidity & tracers
838  REAL, INTENT(INOUT) :: qa(isd:ied, jsd:jed, km, nq)
839  REAL, INTENT(INOUT) :: u_dt(isd:ied, jsd:jed, km)
840  REAL, INTENT(INOUT) :: v_dt(isd:ied, jsd:jed, km)
841  REAL, INTENT(INOUT) :: t_dt(is:ie, js:je, km)
842 !---------------------------Local variables-----------------------------
843  REAL, DIMENSION(is:ie, km) :: u0, v0, w0, t0, hd, te, gz, tvm, pm, &
844 & den
845  REAL :: q0(is:ie, km, nq), qcon(is:ie, km)
846  REAL, DIMENSION(is:ie) :: gzh, lcp2, icp2, cvm, cpm, qs
847  REAL :: ri_ref, ri, pt1, pt2, ratio, tv, cv, tmp, q_liq, q_sol
848  REAL :: tv1, tv2, g2, h0, mc, fra, rk, rz, rdt, tvd, tv_surf
849  REAL :: dh, dq, qsw, dqsdt, tcp3, t_max, t_min
850  INTEGER :: i, j, k, kk, n, m, iq, km1, im, kbot
851  REAL, PARAMETER :: ustar2=1.e-4
852  REAL :: cv_air, xvir
853  INTEGER :: sphum, liq_wat, rainwat, snowwat, graupel, ice_wat, &
854 & cld_amt
855  INTRINSIC present
856  INTRINSIC min
857  INTRINSIC real
858  INTRINSIC max
859  INTEGER :: min1
860  REAL :: max1
861  REAL :: max2
862  REAL :: y1
863 ! = rdgas * (7/2-1) = 2.5*rdgas=717.68
864  cv_air = cp_air - rdgas
865  rk = cp_air/rdgas + 1.
866  cv = cp_air - rdgas
867  g2 = 0.5*grav
868  rdt = 1./dt
869  im = ie - is + 1
870  IF (PRESENT(k_bot)) THEN
871  IF (k_bot .LT. 3) THEN
872  RETURN
873  ELSE
874  kbot = k_bot
875  END IF
876  ELSE
877  kbot = km
878  END IF
879  IF (pe(is, 1, js) .LT. 2.) THEN
880  t_min = t1_min
881  ELSE
882  t_min = t2_min
883  END IF
884  IF (km .GT. 24) THEN
885  min1 = 24
886  ELSE
887  min1 = km
888  END IF
889  IF (k_bot .LT. min1) THEN
890  t_max = t2_max
891  ELSE
892  t_max = t3_max
893  END IF
894  sphum = 1
895  rainwat = -1
896  snowwat = -1
897  graupel = -1
898  IF (nwat .EQ. 0) THEN
899  xvir = 0.
900  rz = 0.
901  ELSE
902  xvir = zvir
903 ! rz = zvir * rdgas
904  rz = rvgas - rdgas
905  IF (nwat .EQ. 3) THEN
906  liq_wat = 2
907  ice_wat = 3
908  END IF
909  END IF
910 !------------------------------------------------------------------------
911 ! The nonhydrostatic pressure changes if there is heating (under constant
912 ! volume and mass is locally conserved).
913 !------------------------------------------------------------------------
914  m = 3
915  fra = dt/REAL(tau)
916 !$OMP parallel do default(none) shared(im,is,ie,js,je,nq,kbot,qa,ta,sphum,ua,va,delp,peln, &
917 !$OMP hydrostatic,pe,delz,g2,w,liq_wat,rainwat,ice_wat, &
918 !$OMP snowwat,cv_air,m,graupel,pkz,rk,rz,fra, t_max, t_min, &
919 !$OMP u_dt,rdt,v_dt,xvir,nwat) &
920 !$OMP private(kk,lcp2,icp2,tcp3,dh,dq,den,qs,qsw,dqsdt,qcon,q0, &
921 !$OMP t0,u0,v0,w0,h0,pm,gzh,tvm,tmp,cpm,cvm,q_liq,q_sol, &
922 !$OMP tv,gz,hd,te,ratio,pt1,pt2,tv1,tv2,ri_ref, ri,mc,km1)
923  DO j=js,je
924  DO iq=1,nq
925  DO k=1,kbot
926  DO i=is,ie
927  q0(i, k, iq) = qa(i, j, k, iq)
928  END DO
929  END DO
930  END DO
931  DO k=1,kbot
932  DO i=is,ie
933  t0(i, k) = ta(i, j, k)
934  tvm(i, k) = t0(i, k)*(1.+xvir*q0(i, k, sphum))
935  u0(i, k) = ua(i, j, k)
936  v0(i, k) = va(i, j, k)
937  pm(i, k) = delp(i, j, k)/(peln(i, k+1, j)-peln(i, k, j))
938  END DO
939  END DO
940  DO i=is,ie
941  gzh(i) = 0.
942  END DO
943  IF (hydrostatic) THEN
944  DO k=kbot,1,-1
945  DO i=is,ie
946  tv = rdgas*tvm(i, k)
947  den(i, k) = pm(i, k)/tv
948  gz(i, k) = gzh(i) + tv*(1.-pe(i, k, j)/pm(i, k))
949  hd(i, k) = cp_air*tvm(i, k) + gz(i, k) + 0.5*(u0(i, k)**2+v0&
950 & (i, k)**2)
951  gzh(i) = gzh(i) + tv*(peln(i, k+1, j)-peln(i, k, j))
952  END DO
953  END DO
954  ELSE
955  DO k=kbot,1,-1
956  IF (nwat .EQ. 0) THEN
957  DO i=is,ie
958  cpm(i) = cp_air
959  cvm(i) = cv_air
960  END DO
961  ELSE IF (nwat .EQ. 1) THEN
962  DO i=is,ie
963  cpm(i) = (1.-q0(i, k, sphum))*cp_air + q0(i, k, sphum)*&
964 & cp_vapor
965  cvm(i) = (1.-q0(i, k, sphum))*cv_air + q0(i, k, sphum)*&
966 & cv_vap
967  END DO
968  ELSE IF (nwat .EQ. 2) THEN
969 ! GFS
970  DO i=is,ie
971  cpm(i) = (1.-q0(i, k, sphum))*cp_air + q0(i, k, sphum)*&
972 & cp_vapor
973  cvm(i) = (1.-q0(i, k, sphum))*cv_air + q0(i, k, sphum)*&
974 & cv_vap
975  END DO
976  ELSE IF (nwat .EQ. 3) THEN
977  DO i=is,ie
978  q_liq = q0(i, k, liq_wat)
979  q_sol = q0(i, k, ice_wat)
980  cpm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cp_air + q0(i&
981 & , k, sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
982  cvm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cv_air + q0(i&
983 & , k, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
984  END DO
985  ELSE IF (nwat .EQ. 4) THEN
986  DO i=is,ie
987  q_liq = q0(i, k, liq_wat) + q0(i, k, rainwat)
988  cpm(i) = (1.-(q0(i, k, sphum)+q_liq))*cp_air + q0(i, k, &
989 & sphum)*cp_vapor + q_liq*c_liq
990  cvm(i) = (1.-(q0(i, k, sphum)+q_liq))*cv_air + q0(i, k, &
991 & sphum)*cv_vap + q_liq*c_liq
992  END DO
993  ELSE
994  DO i=is,ie
995  q_liq = q0(i, k, liq_wat) + q0(i, k, rainwat)
996  q_sol = q0(i, k, ice_wat) + q0(i, k, snowwat) + q0(i, k, &
997 & graupel)
998  cpm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cp_air + q0(i&
999 & , k, sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
1000  cvm(i) = (1.-(q0(i, k, sphum)+q_liq+q_sol))*cv_air + q0(i&
1001 & , k, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
1002  END DO
1003  END IF
1004  DO i=is,ie
1005  den(i, k) = -(delp(i, j, k)/(grav*delz(i, j, k)))
1006  w0(i, k) = w(i, j, k)
1007  gz(i, k) = gzh(i) - g2*delz(i, j, k)
1008  tmp = gz(i, k) + 0.5*(u0(i, k)**2+v0(i, k)**2+w0(i, k)**2)
1009  hd(i, k) = cpm(i)*t0(i, k) + tmp
1010  te(i, k) = cvm(i)*t0(i, k) + tmp
1011  gzh(i) = gzh(i) - grav*delz(i, j, k)
1012  END DO
1013  END DO
1014  END IF
1015  DO n=1,m
1016  IF (m .EQ. 3) THEN
1017  IF (n .EQ. 1) ratio = 0.25
1018  IF (n .EQ. 2) ratio = 0.5
1019  IF (n .EQ. 3) ratio = 0.999
1020  ELSE
1021  ratio = REAL(n)/REAL(m)
1022  END IF
1023  DO i=is,ie
1024  gzh(i) = 0.
1025  END DO
1026 ! Compute total condensate
1027  IF (nwat .LT. 2) THEN
1028  DO k=1,kbot
1029  DO i=is,ie
1030  qcon(i, k) = 0.
1031  END DO
1032  END DO
1033  ELSE IF (nwat .EQ. 2) THEN
1034 ! GFS_2015
1035  DO k=1,kbot
1036  DO i=is,ie
1037  qcon(i, k) = q0(i, k, liq_wat)
1038  END DO
1039  END DO
1040  ELSE IF (nwat .EQ. 3) THEN
1041  DO k=1,kbot
1042  DO i=is,ie
1043  qcon(i, k) = q0(i, k, liq_wat) + q0(i, k, ice_wat)
1044  END DO
1045  END DO
1046  ELSE IF (nwat .EQ. 4) THEN
1047  DO k=1,kbot
1048  DO i=is,ie
1049  qcon(i, k) = q0(i, k, liq_wat) + q0(i, k, rainwat)
1050  END DO
1051  END DO
1052  ELSE
1053  DO k=1,kbot
1054  DO i=is,ie
1055  qcon(i, k) = q0(i, k, liq_wat) + q0(i, k, ice_wat) + q0(i&
1056 & , k, snowwat) + q0(i, k, rainwat) + q0(i, k, graupel)
1057  END DO
1058  END DO
1059  END IF
1060  DO k=kbot,2,-1
1061  km1 = k - 1
1062  DO i=is,ie
1063 ! Richardson number = g*delz * del_theta/theta / (del_u**2 + del_v**2)
1064 ! Use exact form for "density temperature"
1065  tv1 = t0(i, km1)*(1.+xvir*q0(i, km1, sphum)-qcon(i, km1))
1066  tv2 = t0(i, k)*(1.+xvir*q0(i, k, sphum)-qcon(i, k))
1067  pt1 = tv1/pkz(i, j, km1)
1068  pt2 = tv2/pkz(i, j, k)
1069 !
1070  ri = (gz(i, km1)-gz(i, k))*(pt1-pt2)/(0.5*(pt1+pt2)*((u0(i, &
1071 & km1)-u0(i, k))**2+(v0(i, km1)-v0(i, k))**2+ustar2))
1072  IF (tv1 .GT. t_max .AND. tv1 .GT. tv2) THEN
1073 ! top layer unphysically warm
1074  ri = 0.
1075  ELSE IF (tv2 .LT. t_min) THEN
1076  IF (ri .GT. 0.2) THEN
1077  ri = 0.2
1078  ELSE
1079  ri = ri
1080  END IF
1081  END IF
1082  IF (400.e2 - pm(i, k) .LT. 0.) THEN
1083  max2 = 0.
1084  ELSE
1085  max2 = 400.e2 - pm(i, k)
1086  END IF
1087  y1 = ri_min + (ri_max-ri_min)*max2/200.e2
1088  IF (ri_max .GT. y1) THEN
1089  ri_ref = y1
1090  ELSE
1091  ri_ref = ri_max
1092  END IF
1093 ! Enhancing mixing at the model top
1094  IF (k .EQ. 2) THEN
1095  ri_ref = 4.*ri_ref
1096  ELSE IF (k .EQ. 3) THEN
1097  ri_ref = 2.*ri_ref
1098  ELSE IF (k .EQ. 4) THEN
1099  ri_ref = 1.5*ri_ref
1100  END IF
1101  IF (ri .LT. ri_ref) THEN
1102  IF (0.0 .LT. ri/ri_ref) THEN
1103  max1 = ri/ri_ref
1104  ELSE
1105  max1 = 0.0
1106  END IF
1107  mc = ratio*delp(i, j, km1)*delp(i, j, k)/(delp(i, j, km1)+&
1108 & delp(i, j, k))*(1.-max1)**2
1109  DO iq=1,nq
1110  h0 = mc*(q0(i, k, iq)-q0(i, km1, iq))
1111  q0(i, km1, iq) = q0(i, km1, iq) + h0/delp(i, j, km1)
1112  q0(i, k, iq) = q0(i, k, iq) - h0/delp(i, j, k)
1113  END DO
1114 ! Recompute qcon
1115  IF (nwat .LT. 2) THEN
1116  qcon(i, km1) = 0.
1117  ELSE IF (nwat .EQ. 2) THEN
1118 ! GFS_2015
1119  qcon(i, km1) = q0(i, km1, liq_wat)
1120  ELSE IF (nwat .EQ. 3) THEN
1121 ! AM3/AM4
1122  qcon(i, km1) = q0(i, km1, liq_wat) + q0(i, km1, ice_wat)
1123  ELSE IF (nwat .EQ. 4) THEN
1124 ! K_warm_rain scheme with fake ice
1125  qcon(i, km1) = q0(i, km1, liq_wat) + q0(i, km1, rainwat)
1126  ELSE
1127  qcon(i, km1) = q0(i, km1, liq_wat) + q0(i, km1, ice_wat)&
1128 & + q0(i, km1, snowwat) + q0(i, km1, rainwat) + q0(i, &
1129 & km1, graupel)
1130  END IF
1131 ! u:
1132  h0 = mc*(u0(i, k)-u0(i, k-1))
1133  u0(i, k-1) = u0(i, k-1) + h0/delp(i, j, k-1)
1134  u0(i, k) = u0(i, k) - h0/delp(i, j, k)
1135 ! v:
1136  h0 = mc*(v0(i, k)-v0(i, k-1))
1137  v0(i, k-1) = v0(i, k-1) + h0/delp(i, j, k-1)
1138  v0(i, k) = v0(i, k) - h0/delp(i, j, k)
1139  IF (hydrostatic) THEN
1140 ! Static energy
1141  h0 = mc*(hd(i, k)-hd(i, k-1))
1142  hd(i, k-1) = hd(i, k-1) + h0/delp(i, j, k-1)
1143  hd(i, k) = hd(i, k) - h0/delp(i, j, k)
1144  ELSE
1145 ! Total energy
1146  h0 = mc*(hd(i, k)-hd(i, k-1))
1147  te(i, k-1) = te(i, k-1) + h0/delp(i, j, k-1)
1148  te(i, k) = te(i, k) - h0/delp(i, j, k)
1149 ! w:
1150  h0 = mc*(w0(i, k)-w0(i, k-1))
1151  w0(i, k-1) = w0(i, k-1) + h0/delp(i, j, k-1)
1152  w0(i, k) = w0(i, k) - h0/delp(i, j, k)
1153  END IF
1154  END IF
1155  END DO
1156 !--------------
1157 ! Retrive Temp:
1158 !--------------
1159  IF (hydrostatic) THEN
1160  kk = k
1161  DO i=is,ie
1162  t0(i, kk) = (hd(i, kk)-gzh(i)-0.5*(u0(i, kk)**2+v0(i, kk)&
1163 & **2))/(rk-pe(i, kk, j)/pm(i, kk))
1164  gzh(i) = gzh(i) + t0(i, kk)*(peln(i, kk+1, j)-peln(i, kk, &
1165 & j))
1166  t0(i, kk) = t0(i, kk)/(rdgas+rz*q0(i, kk, sphum))
1167  END DO
1168  kk = k - 1
1169  DO i=is,ie
1170  t0(i, kk) = (hd(i, kk)-gzh(i)-0.5*(u0(i, kk)**2+v0(i, kk)&
1171 & **2))/((rk-pe(i, kk, j)/pm(i, kk))*(rdgas+rz*q0(i, kk, &
1172 & sphum)))
1173  END DO
1174  ELSE
1175 ! Non-hydrostatic under constant volume heating/cooling
1176  DO kk=k-1,k
1177  IF (nwat .EQ. 0) THEN
1178  DO i=is,ie
1179  cpm(i) = cp_air
1180  cvm(i) = cv_air
1181  END DO
1182  ELSE IF (nwat .EQ. 1) THEN
1183  DO i=is,ie
1184  cpm(i) = (1.-q0(i, kk, sphum))*cp_air + q0(i, kk, &
1185 & sphum)*cp_vapor
1186  cvm(i) = (1.-q0(i, kk, sphum))*cv_air + q0(i, kk, &
1187 & sphum)*cv_vap
1188  END DO
1189  ELSE IF (nwat .EQ. 2) THEN
1190  DO i=is,ie
1191  cpm(i) = (1.-q0(i, kk, sphum))*cp_air + q0(i, kk, &
1192 & sphum)*cp_vapor
1193  cvm(i) = (1.-q0(i, kk, sphum))*cv_air + q0(i, kk, &
1194 & sphum)*cv_vap
1195  END DO
1196  ELSE IF (nwat .EQ. 3) THEN
1197  DO i=is,ie
1198  q_liq = q0(i, kk, liq_wat)
1199  q_sol = q0(i, kk, ice_wat)
1200  cpm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cp_air + &
1201 & q0(i, kk, sphum)*cp_vapor + q_liq*c_liq + q_sol*&
1202 & c_ice
1203  cvm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cv_air + &
1204 & q0(i, kk, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
1205  END DO
1206  ELSE IF (nwat .EQ. 4) THEN
1207  DO i=is,ie
1208  q_liq = q0(i, kk, liq_wat) + q0(i, kk, rainwat)
1209  cpm(i) = (1.-(q0(i, kk, sphum)+q_liq))*cp_air + q0(i, &
1210 & kk, sphum)*cp_vapor + q_liq*c_liq
1211  cvm(i) = (1.-(q0(i, kk, sphum)+q_liq))*cv_air + q0(i, &
1212 & kk, sphum)*cv_vap + q_liq*c_liq
1213  END DO
1214  ELSE
1215  DO i=is,ie
1216  q_liq = q0(i, kk, liq_wat) + q0(i, kk, rainwat)
1217  q_sol = q0(i, kk, ice_wat) + q0(i, kk, snowwat) + q0(i&
1218 & , kk, graupel)
1219  cpm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cp_air + &
1220 & q0(i, kk, sphum)*cp_vapor + q_liq*c_liq + q_sol*&
1221 & c_ice
1222  cvm(i) = (1.-(q0(i, kk, sphum)+q_liq+q_sol))*cv_air + &
1223 & q0(i, kk, sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
1224  END DO
1225  END IF
1226  DO i=is,ie
1227  tv = gz(i, kk) + 0.5*(u0(i, kk)**2+v0(i, kk)**2+w0(i, kk&
1228 & )**2)
1229  t0(i, kk) = (te(i, kk)-tv)/cvm(i)
1230  hd(i, kk) = cpm(i)*t0(i, kk) + tv
1231  END DO
1232  END DO
1233  END IF
1234  END DO
1235  END DO
1236 ! k-loop
1237 ! n-loop
1238 !--------------------
1239  IF (fra .LT. 1.) THEN
1240  DO k=1,kbot
1241  DO i=is,ie
1242  t0(i, k) = ta(i, j, k) + (t0(i, k)-ta(i, j, k))*fra
1243  u0(i, k) = ua(i, j, k) + (u0(i, k)-ua(i, j, k))*fra
1244  v0(i, k) = va(i, j, k) + (v0(i, k)-va(i, j, k))*fra
1245  END DO
1246  END DO
1247  IF (.NOT.hydrostatic) THEN
1248  DO k=1,kbot
1249  DO i=is,ie
1250  w0(i, k) = w(i, j, k) + (w0(i, k)-w(i, j, k))*fra
1251  END DO
1252  END DO
1253  END IF
1254  DO iq=1,nq
1255  DO k=1,kbot
1256  DO i=is,ie
1257  q0(i, k, iq) = qa(i, j, k, iq) + (q0(i, k, iq)-qa(i, j, k&
1258 & , iq))*fra
1259  END DO
1260  END DO
1261  END DO
1262  END IF
1263  DO k=1,kbot
1264  DO i=is,ie
1265  u_dt(i, j, k) = rdt*(u0(i, k)-ua(i, j, k))
1266  v_dt(i, j, k) = rdt*(v0(i, k)-va(i, j, k))
1267 ! *** temperature updated ***
1268  ta(i, j, k) = t0(i, k)
1269  ua(i, j, k) = u0(i, k)
1270  va(i, j, k) = v0(i, k)
1271  END DO
1272  DO iq=1,nq
1273  DO i=is,ie
1274  qa(i, j, k, iq) = q0(i, k, iq)
1275  END DO
1276  END DO
1277  END DO
1278  IF (.NOT.hydrostatic) THEN
1279  DO k=1,kbot
1280  DO i=is,ie
1281 ! w updated
1282  w(i, j, k) = w0(i, k)
1283  END DO
1284  END DO
1285  END IF
1286  END DO
1287  END SUBROUTINE fv_subgrid_z
1288  SUBROUTINE neg_adj3(is, ie, js, je, ng, kbot, hydrostatic, peln, delz&
1289 & , pt, dp, qv, ql, qr, qi, qs, qg, qa, check_negative)
1290  IMPLICIT NONE
1291 !Stubbed, would require careful checking of nonlinearity
1292 ! This is designed for 6-class micro-physics schemes
1293  INTEGER, INTENT(IN) :: is, ie, js, je, ng, kbot
1294  LOGICAL, INTENT(IN) :: hydrostatic
1295 ! total delp-p
1296  REAL, INTENT(IN) :: dp(is-ng:ie+ng, js-ng:je+ng, kbot)
1297  REAL, INTENT(IN) :: delz(is-ng:, js-ng:, :)
1298 ! ln(pe)
1299  REAL, INTENT(IN) :: peln(is:ie, kbot+1, js:je)
1300  LOGICAL, INTENT(IN), OPTIONAL :: check_negative
1301  REAL, DIMENSION(is-ng:ie+ng, js-ng:je+ng, kbot), INTENT(INOUT) :: pt&
1302 & , qv, ql, qr, qi, qs, qg
1303  REAL, DIMENSION(is-ng:ie+ng, js-ng:je+ng, kbot), INTENT(INOUT), &
1304 & OPTIONAL :: qa
1305  end subroutine neg_adj3
1306 
1307 end module fv_sg_tlm_mod
real, parameter dc_vap
Definition: fv_sg_tlm.F90:47
real, parameter t1_min
Definition: fv_sg_tlm.F90:57
real function, public wqs2(ta, den, dqdt)
integer, parameter, public model_atmos
real, parameter c_con
Definition: fv_sg_tlm.F90:44
real, parameter li0
Definition: fv_sg_tlm.F90:62
subroutine, public neg_adj3(is, ie, js, je, ng, kbot, hydrostatic, peln, delz, pt, dp, qv, ql, qr, qi, qs, qg, qa, check_negative)
Definition: fv_sg_tlm.F90:1290
real, parameter t2_max
Definition: fv_sg_tlm.F90:59
real, parameter tice
Definition: fv_sg_tlm.F90:38
real, parameter cv_vap
Definition: fv_sg_tlm.F90:43
real, parameter zvir
Definition: fv_sg_tlm.F90:64
real, parameter ri_max
Definition: fv_sg_tlm.F90:55
real, parameter, public hlv
Latent heat of evaporation [J/kg].
Definition: constants.F90:80
real, parameter lv0
Definition: fv_sg_tlm.F90:61
subroutine, public fv_subgrid_z_tlm(isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, tau, nwat, delp, delp_tl, pe, pe_tl, peln, peln_tl, pkz, pkz_tl, ta, ta_tl, qa, qa_tl, ua, ua_tl, va, va_tl, hydrostatic, w, w_tl, delz, delz_tl, u_dt, v_dt, t_dt, k_bot)
Definition: fv_sg_tlm.F90:77
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
Definition: constants.F90:77
real, parameter, public cp_vapor
Specific heat capacity of water vapor at constant pressure [J/kg/deg].
Definition: constants.F90:89
real, parameter hlv0
Definition: fv_sg_tlm.F90:50
real, dimension(:), allocatable table
Definition: fv_sg_tlm.F90:65
real, dimension(:), allocatable des
Definition: fv_sg_tlm.F90:65
real, parameter t2_min
Definition: fv_sg_tlm.F90:58
real, parameter esl
Definition: fv_sg_tlm.F90:37
real, parameter, public rvgas
Gas constant for water vapor [J/kg/deg].
Definition: constants.F90:78
real, parameter c_ice
Definition: fv_sg_tlm.F90:40
real, parameter, public cp_air
Specific heat capacity of dry air at constant pressure [J/kg/deg].
Definition: constants.F90:83
subroutine, public fv_subgrid_z(isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, tau, nwat, delp, pe, peln, pkz, ta, qa, ua, va, hydrostatic, w, delz, u_dt, v_dt, t_dt, k_bot)
Definition: fv_sg_tlm.F90:813
real, parameter, public hlf
Latent heat of fusion [J/kg].
Definition: constants.F90:81
real, parameter c_liq
Definition: fv_sg_tlm.F90:41
real, parameter ri_min
Definition: fv_sg_tlm.F90:56
real, parameter, public grav
Acceleration due to gravity [m/s^2].
Definition: constants.F90:76
real, parameter hlf0
Definition: fv_sg_tlm.F90:51
#define max(a, b)
Definition: mosaic_util.h:33
#define min(a, b)
Definition: mosaic_util.h:32
real function, public wqsat2_moist(ta, qv, pa, dqdt)
real, parameter t_ice
Definition: fv_sg_tlm.F90:54
real, parameter, public kappa
RDGAS / CP_AIR [dimensionless].
Definition: constants.F90:82
real, parameter dc_ice
Definition: fv_sg_tlm.F90:48
real, parameter t3_max
Definition: fv_sg_tlm.F90:60