source: LMDZ6/trunk/libf/phylmd/lmdz_lscp_poprecip.F90 @ 4884

Last change on this file since 4884 was 4884, checked in by evignon, 6 weeks ago

petite correction commit precedent

File size: 40.8 KB
Line 
1MODULE lmdz_lscp_poprecip
2!----------------------------------------------------------------
3! Module for the process-oriented treament of precipitation
4! that are called in LSCP
5! Authors: Atelier Nuage (G. Riviere, L. Raillard, M. Wimmer,
6! N. Dutrievoz, E. Vignon, A. Borella, et al.)
7! Jan. 2024
8
9
10IMPLICIT NONE
11
12CONTAINS
13
14!----------------------------------------------------------------
15! Computes the processes-oriented precipitation formulations for
16! evaporation and sublimation
17!
18SUBROUTINE poprecip_precld( &
19           klon, dtime, iftop, paprsdn, paprsup, pplay, temp, tempupnew, qvap, &
20           qprecip, precipfracclr, precipfraccld, &
21           rain, rainclr, raincld, snow, snowclr, snowcld, dqreva, dqssub &
22           )
23
24USE lmdz_lscp_ini, ONLY : prt_level, lunout
25USE lmdz_lscp_ini, ONLY : coef_eva, coef_sub, expo_eva, expo_sub, thresh_precip_frac
26USE lmdz_lscp_ini, ONLY : RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG
27USE lmdz_lscp_tools, ONLY : calc_qsat_ecmwf
28
29IMPLICIT NONE
30
31
32INTEGER, INTENT(IN)                     :: klon           !--number of horizontal grid points [-]
33REAL,    INTENT(IN)                     :: dtime          !--time step [s]
34LOGICAL, INTENT(IN)                     :: iftop          !--if top of the column
35
36
37REAL,    INTENT(IN),    DIMENSION(klon) :: paprsdn        !--pressure at the bottom interface of the layer [Pa]
38REAL,    INTENT(IN),    DIMENSION(klon) :: paprsup        !--pressure at the top interface of the layer [Pa]
39REAL,    INTENT(IN),    DIMENSION(klon) :: pplay          !--pressure in the middle of the layer [Pa]
40
41REAL,    INTENT(INOUT), DIMENSION(klon) :: temp           !--current temperature [K]
42REAL,    INTENT(INOUT), DIMENSION(klon) :: tempupnew      !--updated temperature of the overlying layer [K]
43
44REAL,    INTENT(INOUT), DIMENSION(klon) :: qvap           !--current water vapor specific humidity (includes evaporated qi and ql) [kg/kg]
45REAL,    INTENT(INOUT), DIMENSION(klon) :: qprecip        !--specific humidity in the precipitation falling from the upper layer [kg/kg]
46
47REAL,    INTENT(INOUT), DIMENSION(klon) :: precipfracclr  !--fraction of precipitation in the clear sky IN THE LAYER ABOVE [-]
48REAL,    INTENT(INOUT), DIMENSION(klon) :: precipfraccld  !--fraction of precipitation in the cloudy air IN THE LAYER ABOVE [-]
49
50REAL,    INTENT(INOUT), DIMENSION(klon) :: rain           !--flux of rain gridbox-mean coming from the layer above [kg/s/m2]
51REAL,    INTENT(INOUT), DIMENSION(klon) :: rainclr        !--flux of rain gridbox-mean in clear sky coming from the layer above [kg/s/m2]
52REAL,    INTENT(IN),    DIMENSION(klon) :: raincld        !--flux of rain gridbox-mean in cloudy air coming from the layer above [kg/s/m2]
53REAL,    INTENT(INOUT), DIMENSION(klon) :: snow           !--flux of snow gridbox-mean coming from the layer above [kg/s/m2]
54REAL,    INTENT(INOUT), DIMENSION(klon) :: snowclr        !--flux of snow gridbox-mean in clear sky coming from the layer above [kg/s/m2]
55REAL,    INTENT(IN),    DIMENSION(klon) :: snowcld        !--flux of snow gridbox-mean in cloudy air coming from the layer above [kg/s/m2]
56
57REAL,    INTENT(OUT),   DIMENSION(klon) :: dqreva         !--rain tendency due to evaporation [kg/kg/s]
58REAL,    INTENT(OUT),   DIMENSION(klon) :: dqssub         !--snow tendency due to sublimation [kg/kg/s]
59
60
61
62
63!--Integer for interating over klon
64INTEGER :: i
65!--dhum_to_dflux: coef to convert a specific quantity to a flux
66REAL, DIMENSION(klon) :: dhum_to_dflux
67!--
68REAL, DIMENSION(klon) :: rho, dz
69
70!--Saturation values
71REAL, DIMENSION(klon) :: qzero, qsat, dqsat, qsatl, dqsatl, qsati, dqsati
72!--Fluxes tendencies because of evaporation and sublimation
73REAL :: dprecip_evasub_max, draineva, dsnowsub, dprecip_evasub_tot
74!--Specific humidity tendencies because of evaporation and sublimation
75REAL :: dqrevap, dqssubl
76!--Specific heat constant
77REAL :: cpair, cpw
78
79!--Initialisation
80qzero(:)  = 0.
81dqreva(:) = 0.
82dqssub(:) = 0.
83dqrevap   = 0.
84dqssubl   = 0.
85
86!-- dhum_to_dflux = rho * dz/dt = 1 / g * dP/dt
87dhum_to_dflux(:) = ( paprsdn(:) - paprsup(:) ) / RG / dtime
88rho(:) = pplay(:) / temp(:) / RD
89dz(:) = ( paprsdn(:) - paprsup(:) ) / RG / rho(:)
90
91!--Calculation of saturation specific humidity
92!--depending on temperature:
93CALL calc_qsat_ecmwf(klon,temp(:),qzero(:),pplay(:),RTT,0,.false.,qsat(:),dqsat(:))
94!--wrt liquid water
95CALL calc_qsat_ecmwf(klon,temp(:),qzero(:),pplay(:),RTT,1,.false.,qsatl(:),dqsatl(:))
96!--wrt ice
97CALL calc_qsat_ecmwf(klon,temp(:),qzero(:),pplay(:),RTT,2,.false.,qsati(:),dqsati(:))
98
99
100
101!--First step consists in "thermalizing" the layer:
102!--as the flux of precip from layer above "advects" some heat (as the precip is at the temperature
103!--of the overlying layer) we recalculate a mean temperature that both the air and the precip in the
104!--layer have.
105
106IF (iftop) THEN
107
108  DO i = 1, klon
109    qprecip(i) = 0.
110  ENDDO
111
112ELSE
113
114  DO i = 1, klon
115    !--No condensed water so cp=cp(vapor+dry air)
116    !-- RVTMP2=rcpv/rcpd-1
117    cpair = RCPD * ( 1. + RVTMP2 * qvap(i) )
118    cpw = RCPD * RVTMP2
119    !--qprecip has to be thermalized with
120    !--layer's air so that precipitation at the ground has the
121    !--same temperature as the lowermost layer
122    !--we convert the flux into a specific quantity qprecip
123    qprecip(i) = ( rain(i) + snow(i) ) / dhum_to_dflux(i)
124    !-- t(i,k+1) + d_t(i,k+1): new temperature of the overlying layer
125    temp(i) = ( tempupnew(i) * qprecip(i) * cpw + cpair * temp(i) ) &
126            / ( cpair + qprecip(i) * cpw )
127  ENDDO
128
129ENDIF
130
131
132DO i = 1, klon
133
134  !--If there is precipitation from the layer above
135  IF ( ( rain(i) + snow(i) ) .GT. 0. ) THEN
136
137    !--Evaporation of liquid precipitation coming from above
138    !--in the clear sky only
139    !--dprecip/dz = -beta*(1-qvap/qsat)*(precip**expo_eva)
140    !--formula from Sundqvist 1988, Klemp & Wilhemson 1978
141    !--Explicit formulation
142    !draineva = - precipfracclr(i) * coef_eva * (1. - qvap(i) / qsatl(i)) * dz(i) &
143    !         * ( rainclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) ) ** expo_eva &
144    !draineva = MAX( - rainclr(i), draineva)
145    !--Exact explicit formulation (rainclr is resolved exactly, qvap explicitly)
146    !--which does not need a barrier on rainclr, because included in the formula
147    draineva = precipfracclr(i) * ( MAX(0., &
148             - coef_eva * ( 1. - expo_eva ) * (1. - qvap(i) / qsatl(i)) * dz(i) &
149             + ( rainclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) )**( 1. - expo_eva ) &
150               ) )**( 1. / ( 1. - expo_eva ) ) - rainclr(i)
151             
152    !--Evaporation is limited by 0
153    draineva = MIN(0., draineva)
154
155
156    !--Sublimation of the solid precipitation coming from above
157    !--(same formula as for liquid precip)
158    !--Explicit formulation
159    !dsnowsub = - precipfracclr(i) * coef_sub * (1. - qvap(i) / qsatl(i)) * dz(i) &
160    !         * ( snowclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) ) ** expo_sub &
161    !dsnowsub = MAX( - snowclr(i), dsnowsub)
162    !--Exact explicit formulation (snowclr is resolved exactly, qvap explicitly)
163    !--which does not need a barrier on snowclr, because included in the formula
164    dsnowsub = precipfracclr(i) * ( MAX(0., &
165             - coef_sub * ( 1. - expo_sub ) * (1. - qvap(i) / qsati(i)) * dz(i) &
166             + ( snowclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) )**( 1. - expo_sub ) &
167             ) )**( 1. / ( 1. - expo_sub ) ) - snowclr(i)
168
169    !--Sublimation is limited by 0
170    ! TODO: change max when we will allow for vapor deposition in supersaturated regions
171    dsnowsub = MIN(0., dsnowsub)
172
173    !--Evaporation limit: we ensure that the layer's fraction below
174    !--the clear sky does not reach saturation. In this case, we
175    !--redistribute the maximum flux dprecip_evasub_max conserving the ratio liquid/ice
176    !--Max evaporation is computed not to saturate the clear sky precip fraction
177    !--(i.e., the fraction where evaporation occurs)
178    !--It is expressed as a max flux dprecip_evasub_max
179   
180    dprecip_evasub_max = MIN(0., ( qvap(i) - qsat(i) ) * precipfracclr(i)) &
181                     * dhum_to_dflux(i)
182    dprecip_evasub_tot = draineva + dsnowsub
183
184    !--Barriers
185    !--If activates if the total is LOWER than the max because
186    !--everything is negative
187    IF ( dprecip_evasub_tot .LT. dprecip_evasub_max ) THEN
188      draineva = dprecip_evasub_max * draineva / dprecip_evasub_tot
189      dsnowsub = dprecip_evasub_max * dsnowsub / dprecip_evasub_tot
190    ENDIF
191
192
193    !--New solid and liquid precipitation fluxes after evap and sublimation
194    dqrevap = draineva / dhum_to_dflux(i)
195    dqssubl = dsnowsub / dhum_to_dflux(i)
196
197
198    !--Vapor is updated after evaporation/sublimation (it is increased)
199    qvap(i) = qvap(i) - dqrevap - dqssubl
200    !--qprecip is the total condensed water in the precip flux (it is decreased)
201    qprecip(i) = qprecip(i) + dqrevap + dqssubl
202    !--Air and precip temperature (i.e., gridbox temperature)
203    !--is updated due to latent heat cooling
204    temp(i) = temp(i) &
205            + dqrevap * RLVTT / RCPD &
206            / ( 1. + RVTMP2 * ( qvap(i) + qprecip(i) ) ) &
207            + dqssubl * RLSTT / RCPD &
208            / ( 1. + RVTMP2 * ( qvap(i) + qprecip(i) ) )
209
210    !--Add tendencies
211    !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
212    rainclr(i) = MAX(0., rainclr(i) + draineva)
213    snowclr(i) = MAX(0., snowclr(i) + dsnowsub)
214
215    !--If there is no more precip fluxes, the precipitation fraction in clear
216    !--sky is set to 0
217    IF ( ( rainclr(i) + snowclr(i) ) .LE. 0. ) precipfracclr(i) = 0.
218
219    !--Calculation of the total fluxes
220    rain(i) = rainclr(i) + raincld(i)
221    snow(i) = snowclr(i) + snowcld(i)
222
223  ELSE
224    !--If no precip, we reinitialize the cloud fraction used for the precip to 0
225    precipfraccld(i) = 0.
226    precipfracclr(i) = 0.
227
228  ENDIF ! ( ( rain(i) + snow(i) ) .GT. 0. )
229
230  !--Diagnostic tendencies
231  dqssub(i) = dqssubl / dtime
232  dqreva(i) = dqrevap / dtime
233
234ENDDO ! loop on klon
235
236
237END SUBROUTINE poprecip_precld
238
239!----------------------------------------------------------------
240! Computes the processes-oriented precipitation formulations for
241! - autoconversion (auto) via a deposition process
242! - aggregation (agg)
243! - riming (rim)
244! - collection (col)
245! - melting (melt)
246! - freezing (freez)
247!
248SUBROUTINE poprecip_postcld( &
249           klon, dtime, paprsdn, paprsup, pplay, ctot_vol, ptconv, &
250           temp, qvap, qliq, qice, icefrac, cldfra, &
251           precipfracclr, precipfraccld, &
252           rain, rainclr, raincld, snow, snowclr, snowcld, &
253           qraindiag, qsnowdiag, dqrauto, dqrcol, dqrmelt, dqrfreez, &
254           dqsauto, dqsagg, dqsrim, dqsmelt, dqsfreez)
255
256USE lmdz_lscp_ini, ONLY : prt_level, lunout
257USE lmdz_lscp_ini, ONLY : RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG, RPI
258USE lmdz_lscp_tools, ONLY : calc_qsat_ecmwf
259
260USE lmdz_lscp_ini, ONLY : cld_lc_con, cld_tau_con, cld_expo_con, seuil_neb,    &
261                          cld_lc_lsc, cld_tau_lsc, cld_expo_lsc, rain_int_min, &
262                          thresh_precip_frac, gamma_col, gamma_agg, gamma_rim, &
263                          rho_rain, rho_snow, r_rain, r_snow, rho_ice, r_ice,  &
264                          tau_auto_snow_min, tau_auto_snow_max,                &
265                          thresh_precip_frac, eps,                             &
266                          coef_ventil, alpha_freez, beta_freez, temp_nowater,  &
267                          iflag_cloudth_vert, iflag_rain_incloud_vol,          &
268                          cld_lc_lsc_snow, cld_lc_con_snow, gamma_freez,       &
269                          rain_fallspeed_clr, rain_fallspeed_cld,              &
270                          snow_fallspeed_clr, snow_fallspeed_cld
271
272
273IMPLICIT NONE
274
275INTEGER, INTENT(IN)                     :: klon           !--number of horizontal grid points [-]
276REAL,    INTENT(IN)                     :: dtime          !--time step [s]
277
278REAL,    INTENT(IN),    DIMENSION(klon) :: paprsdn        !--pressure at the bottom interface of the layer [Pa]
279REAL,    INTENT(IN),    DIMENSION(klon) :: paprsup        !--pressure at the top interface of the layer [Pa]
280REAL,    INTENT(IN),    DIMENSION(klon) :: pplay          !--pressure in the middle of the layer [Pa]
281
282REAL,    INTENT(IN),    DIMENSION(klon) :: ctot_vol       !--volumic cloud fraction [-]
283LOGICAL, INTENT(IN),    DIMENSION(klon) :: ptconv         !--true if we are in a convective point
284
285REAL,    INTENT(INOUT), DIMENSION(klon) :: temp           !--current temperature [K]
286REAL,    INTENT(INOUT), DIMENSION(klon) :: qvap           !--current water vapor specific humidity [kg/kg]
287REAL,    INTENT(INOUT), DIMENSION(klon) :: qliq           !--current liquid water specific humidity [kg/kg]
288REAL,    INTENT(INOUT), DIMENSION(klon) :: qice           !--current ice water specific humidity [kg/kg]
289REAL,    INTENT(IN),    DIMENSION(klon) :: icefrac        !--ice fraction [-]
290REAL,    INTENT(IN),    DIMENSION(klon) :: cldfra         !--cloud fraction [-]
291
292REAL,    INTENT(INOUT), DIMENSION(klon) :: precipfracclr  !--fraction of precipitation in the clear sky IN THE LAYER ABOVE [-]
293REAL,    INTENT(INOUT), DIMENSION(klon) :: precipfraccld  !--fraction of precipitation in the cloudy air IN THE LAYER ABOVE [-]
294                                                          !--NB. at the end of the routine, becomes the fraction of precip
295                                                          !--in the current layer
296
297REAL,    INTENT(INOUT), DIMENSION(klon) :: rain           !--flux of rain gridbox-mean coming from the layer above [kg/s/m2]
298REAL,    INTENT(INOUT), DIMENSION(klon) :: rainclr        !--flux of rain gridbox-mean in clear sky coming from the layer above [kg/s/m2]
299REAL,    INTENT(INOUT), DIMENSION(klon) :: raincld        !--flux of rain gridbox-mean in cloudy air coming from the layer above [kg/s/m2]
300REAL,    INTENT(INOUT), DIMENSION(klon) :: snow           !--flux of snow gridbox-mean coming from the layer above [kg/s/m2]
301REAL,    INTENT(INOUT), DIMENSION(klon) :: snowclr        !--flux of snow gridbox-mean in clear sky coming from the layer above [kg/s/m2]
302REAL,    INTENT(INOUT), DIMENSION(klon) :: snowcld        !--flux of snow gridbox-mean in cloudy air coming from the layer above [kg/s/m2]
303
304REAL,    INTENT(OUT),   DIMENSION(klon) :: qraindiag      !--DIAGNOSTIC specific rain content [kg/kg]
305REAL,    INTENT(OUT),   DIMENSION(klon) :: qsnowdiag      !--DIAGNOSTIC specific snow content [kg/kg]
306REAL,    INTENT(OUT),   DIMENSION(klon) :: dqrcol         !--rain tendendy due to collection by rain of liquid cloud droplets [kg/kg/s]
307REAL,    INTENT(OUT),   DIMENSION(klon) :: dqsagg         !--snow tendency due to collection of lcoud ice by aggregation [kg/kg/s]
308REAL,    INTENT(OUT),   DIMENSION(klon) :: dqrauto        !--rain tendency due to autoconversion of cloud liquid [kg/kg/s]
309REAL,    INTENT(OUT),   DIMENSION(klon) :: dqsauto        !--snow tendency due to autoconversion of cloud ice [kg/kg/s]
310REAL,    INTENT(OUT),   DIMENSION(klon) :: dqsrim         !--snow tendency due to riming [kg/kg/s]
311REAL,    INTENT(OUT),   DIMENSION(klon) :: dqsmelt        !--snow tendency due to melting [kg/kg/s]
312REAL,    INTENT(OUT),   DIMENSION(klon) :: dqrmelt        !--rain tendency due to melting [kg/kg/s]
313REAL,    INTENT(OUT),   DIMENSION(klon) :: dqsfreez       !--snow tendency due to freezing [kg/kg/s]
314REAL,    INTENT(OUT),   DIMENSION(klon) :: dqrfreez       !--rain tendency due to freezing [kg/kg/s]
315
316
317
318!--Local variables
319
320INTEGER :: i
321REAL, DIMENSION(klon) :: dhum_to_dflux
322REAL, DIMENSION(klon) :: qtot !--includes vap, liq, ice and precip
323
324!--Partition of the fluxes
325REAL :: dcldfra
326REAL :: precipfractot
327REAL :: dprecipfracclr, dprecipfraccld
328REAL :: drainclr, dsnowclr
329REAL :: draincld, dsnowcld
330
331!--Collection, aggregation and riming
332REAL :: eff_cldfra
333REAL :: coef_col, coef_agg, coef_rim, coef_tmp, qrain_tmp
334REAL :: Eff_rain_liq, Eff_snow_ice, Eff_snow_liq
335REAL :: dqlcol           !--loss of liquid cloud content due to collection by rain [kg/kg/s]
336REAL :: dqiagg           !--loss of ice cloud content due to collection by aggregation [kg/kg/s]
337REAL :: dqlrim           !--loss of liquid cloud content due to riming on snow [kg/kg/s]
338
339!--Autoconversion
340REAL :: qthresh_auto_rain, tau_auto_rain, expo_auto_rain
341REAL :: qthresh_auto_snow, tau_auto_snow, expo_auto_snow
342REAL :: dqlauto          !--loss of liquid cloud content due to autoconversion to rain [kg/kg/s]
343REAL :: dqiauto          !--loss of ice cloud content due to autoconversion to snow [kg/kg/s]
344
345!--Melting
346REAL :: dqsmelt_max, air_thermal_conduct
347REAL :: nb_snowflake_clr, nb_snowflake_cld
348REAL :: capa_snowflake, temp_wetbulb
349REAL :: dqsclrmelt, dqscldmelt, dqstotmelt
350REAL, DIMENSION(klon) :: qzero, qsat, dqsat
351
352!--Freezing
353REAL :: dqrfreez_max
354REAL :: tau_freez
355REAL :: dqrclrfreez, dqrcldfreez, dqrtotfreez, dqrtotfreez_step1, dqrtotfreez_step2
356REAL :: coef_freez
357REAL :: dqifreez        !--loss of ice cloud content due to collection of ice from rain [kg/kg/s]
358REAL :: Eff_rain_ice
359
360
361!--Initialisation of variables
362
363qzero(:)    = 0.
364
365dqrcol(:)   = 0.
366dqsagg(:)   = 0.
367dqsauto(:)  = 0.
368dqrauto(:)  = 0.
369dqsrim(:)   = 0.
370dqrmelt(:)  = 0.
371dqsmelt(:)  = 0.
372dqrfreez(:) = 0.
373dqsfreez(:) = 0.
374
375
376DO i = 1, klon
377
378  !--Variables initialisation
379  dqlcol  = 0.
380  dqiagg  = 0.
381  dqiauto = 0.
382  dqlauto = 0.
383  dqlrim  = 0.
384  dqifreez= 0.
385
386  !--dhum_to_dflux: coef to convert a delta in specific quantity to a flux
387  !-- dhum_to_dflux = rho * dz/dt = 1 / g * dP/dt
388  dhum_to_dflux(i) = ( paprsdn(i) - paprsup(i) ) / RG / dtime
389  qtot(i) = qvap(i) + qliq(i) + qice(i) &
390          + ( raincld(i) + rainclr(i) + snowcld(i) + snowclr(i) ) / dhum_to_dflux(i)
391
392  !------------------------------------------------------------
393  !--     PRECIPITATION FRACTIONS UPDATE
394  !------------------------------------------------------------
395  !--The goal of this routine is to reattribute precipitation fractions
396  !--and fluxes to clear or cloudy air, depending on the variation of
397  !--the cloud fraction on the vertical dimension. We assume a
398  !--maximum-random overlap of the cloud cover (see Jakob and Klein, 2000,
399  !--and LTP thesis, 2021)
400  !--NB. in fact, we assume a maximum-random overlap of the total precip. frac
401
402  !--Initialisation
403  precipfractot = precipfracclr(i) + precipfraccld(i)
404
405  !--Instead of using the cloud cover which was use in LTP thesis, we use the
406  !--total precip. fraction to compute the maximum-random overlap. This is
407  !--because all the information of the cloud cover is embedded into
408  !--precipfractot, and this allows for taking into account the potential
409  !--reduction of the precipitation fraction because either the flux is too
410  !--small (see barrier at the end of poprecip_postcld) or the flux is completely
411  !--evaporated (see barrier at the end of poprecip_precld)
412  !--NB. precipfraccld(i) is here the cloud fraction of the layer above
413  !precipfractot = 1. - ( 1. - precipfractot ) * &
414  !               ( 1. - MAX( cldfra(i), precipfraccld(i) ) ) &
415  !             / ( 1. - MIN( precipfraccld(i), 1. - eps ) )
416
417
418  IF ( precipfraccld(i) .GT. ( 1. - eps ) ) THEN
419    precipfractot = 1.
420  ELSE
421    precipfractot = 1. - ( 1. - precipfractot ) * &
422                 ( 1. - MAX( cldfra(i), precipfraccld(i) ) ) &
423               / ( 1. - precipfraccld(i) )
424  ENDIF
425
426  !--precipfraccld(i) is here the cloud fraction of the layer above
427  dcldfra = cldfra(i) - precipfraccld(i)
428  !--Tendency of the clear-sky precipitation fraction. We add a MAX on the
429  !--calculation of the current CS precip. frac.
430  !dprecipfracclr = MAX( 0., ( precipfractot - cldfra(i) ) ) - precipfracclr(i)
431  !--We remove it, because precipfractot is guaranteed to be > cldfra (the MAX is activated
432  !--if precipfractot < cldfra)
433  dprecipfracclr = ( precipfractot - cldfra(i) ) - precipfracclr(i)
434  !--Tendency of the cloudy precipitation fraction. We add a MAX on the
435  !--calculation of the current CS precip. frac.
436  !dprecipfraccld = MAX( dcldfra , - precipfraccld(i) )
437  !--We remove it, because cldfra is guaranteed to be > 0 (the MAX is activated
438  !--if cldfra < 0)
439  dprecipfraccld = dcldfra
440
441
442  !--If the cloud extends
443  IF ( dprecipfraccld .GT. 0. ) THEN
444    !--If there is no CS precip, nothing happens.
445    !--If there is, we reattribute some of the CS precip flux
446    !--to the cloud precip flux, proportionnally to the
447    !--decrease of the CS precip fraction
448    IF ( precipfracclr(i) .LE. 0. ) THEN
449      drainclr = 0.
450      dsnowclr = 0.
451    ELSE
452      drainclr = dprecipfracclr / precipfracclr(i) * rainclr(i)
453      dsnowclr = dprecipfracclr / precipfracclr(i) * snowclr(i)
454    ENDIF
455  !--If the cloud narrows
456  ELSEIF ( dprecipfraccld .LT. 0. ) THEN
457    !--We reattribute some of the cloudy precip flux
458    !--to the CS precip flux, proportionnally to the
459    !--decrease of the cloud precip fraction
460    draincld = dprecipfraccld / precipfraccld(i) * raincld(i)
461    dsnowcld = dprecipfraccld / precipfraccld(i) * snowcld(i)
462    drainclr = - draincld
463    dsnowclr = - dsnowcld
464  !--If the cloud stays the same or if there is no cloud above and
465  !--in the current layer, nothing happens
466  ELSE
467    drainclr = 0.
468    dsnowclr = 0.
469  ENDIF
470
471  !--We add the tendencies
472  !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
473  precipfraccld(i) = precipfraccld(i) + dprecipfraccld
474  precipfracclr(i) = precipfracclr(i) + dprecipfracclr
475  rainclr(i) = MAX(0., rainclr(i) + drainclr)
476  snowclr(i) = MAX(0., snowclr(i) + dsnowclr)
477  raincld(i) = MAX(0., raincld(i) - drainclr)
478  snowcld(i) = MAX(0., snowcld(i) - dsnowclr)
479 
480  !--If vertical heterogeneity is taken into account, we use
481  !--the "true" volume fraction instead of a modified
482  !--surface fraction (which is larger and artificially
483  !--reduces the in-cloud water).
484  IF ( ( iflag_cloudth_vert .GE. 3 ) .AND. ( iflag_rain_incloud_vol .EQ. 1 ) ) THEN
485    eff_cldfra = ctot_vol(i)
486  ELSE
487    eff_cldfra = cldfra(i)
488  ENDIF
489
490
491  !--Start precipitation growth processes
492
493  !--If the cloud is big enough, the precipitation processes activate
494  IF ( cldfra(i) .GE. seuil_neb ) THEN
495
496    !---------------------------------------------------------
497    !--           COLLECTION AND AGGREGATION
498    !---------------------------------------------------------
499    !--Collection: processus through which rain collects small liquid droplets
500    !--in suspension, and add it to the rain flux
501    !--Aggregation: same for snow (precip flux) and ice crystals (in suspension)
502    !--Those processes are treated before autoconversion because we do not
503    !--want to collect/aggregate the newly formed fluxes, which already
504    !--"saw" the cloud as they come from it
505    !--The formulas come from Muench and Lohmann 2020
506
507    !--gamma_col: tuning coefficient [-]
508    !--rho_rain: volumic mass of rain [kg/m3]
509    !--r_rain: size of the rain droplets [m]
510    !--Eff_rain_liq: efficiency of the collection process [-] (between 0 and 1)
511    !--dqlcol is a gridbox-mean quantity, as is qliq and raincld. They are
512    !--divided by respectively eff_cldfra, eff_cldfra and precipfraccld to
513    !--get in-cloud mean quantities. The two divisions by eff_cldfra are
514    !--then simplified.
515
516    !--The collection efficiency is perfect.
517    Eff_rain_liq = 1.
518    coef_col = gamma_col * 3. / 4. / rho_rain / r_rain * Eff_rain_liq
519    IF ( raincld(i) .GT. 0. ) THEN
520      !-- ATTENTION Double implicit version
521      !-- BEWARE the formule below is FALSE (because raincld is a flux, not a delta flux)
522      !qrain_tmp = raincld(i) / dhum_to_dflux(i)
523      !coef_tmp = coef_col * dtime * ( qrain_tmp / precipfraccld(i) + qliq(i) / eff_cldfra )
524      !dqlcol = qliq(i) * ( 1. / ( 1. + 0.5 * ( coef_tmp - 1. + SQRT( &
525      !    ( 1. - coef_tmp )**2. + 4. * coef_col * dtime * qrain_tmp / precipfraccld(i) ) &
526      !                   ) ) - 1. )
527      !--Barriers so that the processes do not consume more liquid/ice than
528      !--available.
529      !dqlcol = MAX( - qliq(i), dqlcol )
530      !--Exact explicit version, which does not need a barrier because of
531      !--the exponential decrease
532      dqlcol = qliq(i) * ( EXP( - dtime * coef_col * raincld(i) / precipfraccld(i) ) - 1. )
533
534      !--Add tendencies
535      qliq(i) = qliq(i) + dqlcol
536      raincld(i) = raincld(i) - dqlcol * dhum_to_dflux(i)
537
538      !--Diagnostic tendencies
539      dqrcol(i)  = - dqlcol  / dtime
540    ENDIF
541
542    !--Same as for aggregation
543    !--Eff_snow_liq formula: following Milbrandt and Yau 2005,
544    !--it s a product of a collection efficiency and a sticking efficiency
545    Eff_snow_ice = 0.05 * EXP( 0.1 * ( temp(i) - RTT ) )
546    coef_agg = gamma_agg * 3. / 4. / rho_snow / r_snow * Eff_snow_ice
547    IF ( snowcld(i) .GT. 0. ) THEN
548      !-- ATTENTION Double implicit version?
549      !--Barriers so that the processes do not consume more liquid/ice than
550      !--available.
551      !dqiagg = MAX( - qice(i), dqiagg )
552      !--Exact explicit version, which does not need a barrier because of
553      !--the exponential decrease
554      dqiagg = qice(i) * ( EXP( - dtime * coef_agg * snowcld(i) / precipfraccld(i) ) - 1. )
555
556      !--Add tendencies
557      qice(i) = qice(i) + dqiagg
558      snowcld(i) = snowcld(i) - dqiagg * dhum_to_dflux(i)
559
560      !--Diagnostic tendencies
561      dqsagg(i)  = - dqiagg  / dtime
562    ENDIF
563
564
565    !---------------------------------------------------------
566    !--                  AUTOCONVERSION
567    !---------------------------------------------------------
568    !--Autoconversion converts liquid droplets/ice crystals into
569    !--rain drops/snowflakes. It relies on the formulations by
570    !--Sundqvist 1978.
571
572    !--If we are in a convective point, we have different parameters
573    !--for the autoconversion
574    IF ( ptconv(i) ) THEN
575        qthresh_auto_rain = cld_lc_con
576        qthresh_auto_snow = cld_lc_con_snow
577
578        tau_auto_rain = cld_tau_con
579        !--tau for snow depends on the ice fraction in mixed-phase clouds     
580        tau_auto_snow = tau_auto_snow_max &
581                      + ( tau_auto_snow_min - tau_auto_snow_max ) * ( 1. - icefrac(i) )
582
583        expo_auto_rain = cld_expo_con
584        expo_auto_snow = cld_expo_con
585    ELSE
586        qthresh_auto_rain = cld_lc_lsc
587        qthresh_auto_snow = cld_lc_lsc_snow
588
589        tau_auto_rain = cld_tau_lsc
590        !--tau for snow depends on the ice fraction in mixed-phase clouds     
591        tau_auto_snow = tau_auto_snow_max &
592                      + ( tau_auto_snow_min - tau_auto_snow_max ) * ( 1. - icefrac(i) )
593
594        expo_auto_rain = cld_expo_lsc
595        expo_auto_snow = cld_expo_lsc
596    ENDIF
597
598
599    ! Liquid water quantity to remove according to (Sundqvist, 1978)
600    ! dqliq/dt = -qliq/tau * ( 1-exp(-(qliqincld/qthresh)**2) )
601    !
602    !--And same formula for ice
603    !
604    !--We first treat the second term (with exponential) in an explicit way
605    !--and then treat the first term (-q/tau) in an exact way
606
607    dqlauto = - qliq(i) * ( 1. - exp( - dtime / tau_auto_rain * ( 1. - exp( &
608               - ( qliq(i) / eff_cldfra / qthresh_auto_rain ) ** expo_auto_rain ) ) ) )
609
610    dqiauto = - qice(i) * ( 1. - exp( - dtime / tau_auto_snow * ( 1. - exp( &
611               - ( qice(i) / eff_cldfra / qthresh_auto_snow ) ** expo_auto_snow ) ) ) )
612
613
614    !--Barriers so that we don t create more rain/snow
615    !--than there is liquid/ice
616    dqlauto = MAX( - qliq(i), dqlauto )
617    dqiauto = MAX( - qice(i), dqiauto )
618
619    !--Add tendencies
620    qliq(i) = qliq(i) + dqlauto
621    qice(i) = qice(i) + dqiauto
622    raincld(i) = raincld(i) - dqlauto * dhum_to_dflux(i)
623    snowcld(i) = snowcld(i) - dqiauto * dhum_to_dflux(i)
624
625    !--Diagnostic tendencies
626    dqsauto(i) = - dqiauto / dtime
627    dqrauto(i) = - dqlauto / dtime
628
629
630    !---------------------------------------------------------
631    !--                  RIMING
632    !---------------------------------------------------------
633    !--Process which converts liquid droplets in suspension into
634    !--snow (graupel in fact) because of the collision between
635    !--those and falling snowflakes.
636    !--The formula comes from Muench and Lohmann 2020
637    !--NB.: this process needs a temperature adjustment
638
639    !--Eff_snow_liq formula: following Seifert and Beheng 2006,
640    !--assuming a cloud droplet diameter of 20 microns.
641    Eff_snow_liq = 0.2
642    coef_rim = gamma_rim * 3. / 4. / rho_snow / r_snow * Eff_snow_liq
643    IF ( snowcld(i) .GT. 0. ) THEN
644      !-- ATTENTION Double implicit version?
645      !--Barriers so that the processes do not consume more liquid than
646      !--available.
647      !dqlrim = MAX( - qliq(i), dqlrim )
648      !--Exact version, which does not need a barrier because of
649      !--the exponential decrease
650      dqlrim = qliq(i) * ( EXP( - dtime * coef_rim * snowcld(i) / precipfraccld(i) ) - 1. )
651
652      !--Add tendencies
653      !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
654      qliq(i) = qliq(i) + dqlrim
655      snowcld(i) = snowcld(i) - dqlrim * dhum_to_dflux(i)
656
657      !--Temperature adjustment with the release of latent
658      !--heat because of solid condensation
659      temp(i) = temp(i) - dqlrim * RLMLT / RCPD &
660                        / ( 1. + RVTMP2 * qtot(i) )
661
662      !--Diagnostic tendencies
663      dqsrim(i)  = - dqlrim  / dtime
664    ENDIF
665
666  ENDIF ! cldfra .GE. seuil_neb
667
668ENDDO ! loop on klon
669
670
671!--Re-calculation of saturation specific humidity
672!--because riming changed temperature
673CALL calc_qsat_ecmwf(klon, temp, qzero, pplay, RTT, 0, .FALSE., qsat, dqsat)
674
675DO i = 1, klon
676
677  !---------------------------------------------------------
678  !--                  MELTING
679  !---------------------------------------------------------
680  !--Process through which snow melts into rain.
681  !--The formula is homemade.
682  !--NB.: this process needs a temperature adjustment
683
684  !--dqsmelt_max: maximum snow melting so that temperature
685  !--             stays higher than 273 K [kg/kg]
686  !--capa_snowflake: capacitance of a snowflake, equal to
687  !--                the radius if the snowflake is a sphere [m]
688  !--temp_wetbulb: wet-bulb temperature [K]
689  !--snow_fallspeed: snow fall velocity (in clear/cloudy sky) [m/s]
690  !--air_thermal_conduct: thermal conductivity of the air [J/m/K/s]
691  !--coef_ventil: ventilation coefficient [-]
692  !--nb_snowflake: number of snowflakes (in clear/cloudy air) [-]
693
694  IF ( ( snowclr(i) + snowcld(i) ) .GT. 0. ) THEN
695    !--Computed according to
696    !--Cpdry * Delta T * (1 + (Cpvap/Cpdry - 1) * qtot) = Lfusion * Delta q
697    dqsmelt_max = MIN(0., ( RTT - temp(i) ) / RLMLT * RCPD &
698                        * ( 1. + RVTMP2 * qtot(i) ))
699   
700    !--Initialisation
701    dqsclrmelt = 0.
702    dqscldmelt = 0.
703
704    capa_snowflake = r_snow
705    ! ATTENTION POUR L'INSTANT C'EST UN WBULB SELON FORMULE ECMWF
706    ! ATTENTION EST-CE QVAP ?????
707    temp_wetbulb = temp(i) - ( qsat(i) - qvap(i) ) &
708                 * ( 1329.31 + 0.0074615 * ( pplay(i) - 0.85e5 ) &
709                 - 40.637 * ( temp(i) - 275. ) )
710    air_thermal_conduct=(5.69+0.017*(temp(i)-RTT))*1.e-3*4.184                ! thermal conductivity of the air, SI
711
712    !--In clear air
713    IF ( snowclr(i) .GT. 0. ) THEN
714      !--Calculated according to
715      !-- flux = velocity_snowflakes * nb_snowflakes * volume_snowflakes * rho_snow
716      nb_snowflake_clr = snowclr(i) / precipfracclr(i) / snow_fallspeed_clr &
717                       / ( 4. / 3. * RPI * r_snow**3. * rho_snow )
718      dqsclrmelt = - nb_snowflake_clr * 4. * RPI * air_thermal_conduct &
719                   * capa_snowflake / RLMLT * coef_ventil &
720                   * MAX(0., temp_wetbulb - RTT) * dtime
721
722      !--Barrier to limit the melting flux to the clr snow flux in the mesh
723      dqsclrmelt = MAX( dqsclrmelt , -snowclr(i) / dhum_to_dflux(i))
724    ENDIF
725
726    !--In cloudy air
727    IF ( snowcld(i) .GT. 0. ) THEN
728      !--Calculated according to
729      !-- flux = velocity_snowflakes * nb_snowflakes * volume_snowflakes * rho_snow
730      nb_snowflake_cld = snowcld(i) / precipfraccld(i) / snow_fallspeed_cld &
731                       / ( 4. / 3. * RPI * r_snow**3. * rho_snow )
732      dqscldmelt = - nb_snowflake_cld * 4. * RPI * air_thermal_conduct &
733                   * capa_snowflake / RLMLT * coef_ventil &
734                   * MAX(0., temp_wetbulb - RTT) * dtime
735
736      !--Barrier to limit the melting flux to the cld snow flux in the mesh
737      dqscldmelt = MAX(dqscldmelt , - snowcld(i) / dhum_to_dflux(i))
738    ENDIF
739   
740    !--Barrier on temperature. If the total melting flux leads to a
741    !--positive temperature, it is limited to keep temperature above 0 degC.
742    !--It is activated if the total is LOWER than the max
743    !--because everything is negative
744    dqstotmelt = dqsclrmelt + dqscldmelt
745    IF ( dqstotmelt .LT. dqsmelt_max ) THEN
746      !--We redistribute the max melted snow keeping
747      !--the clear/cloud partition of the melted snow
748      dqsclrmelt = dqsmelt_max * dqsclrmelt / dqstotmelt
749      dqscldmelt = dqsmelt_max * dqscldmelt / dqstotmelt
750      dqstotmelt = dqsmelt_max
751
752    ENDIF
753
754    !--Add tendencies
755    !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
756    rainclr(i) = MAX(0., rainclr(i) - dqsclrmelt * dhum_to_dflux(i))
757    raincld(i) = MAX(0., raincld(i) - dqscldmelt * dhum_to_dflux(i))
758    snowclr(i) = MAX(0., snowclr(i) + dqsclrmelt * dhum_to_dflux(i))
759    snowcld(i) = MAX(0., snowcld(i) + dqscldmelt * dhum_to_dflux(i))
760
761
762    !--Temperature adjustment with the release of latent
763    !--heat because of melting
764    temp(i) = temp(i) + dqstotmelt * RLMLT / RCPD &
765                      / ( 1. + RVTMP2 * qtot(i) )
766
767    !--Diagnostic tendencies
768    dqrmelt(i) = - dqstotmelt / dtime
769    dqsmelt(i) = dqstotmelt / dtime
770
771  ENDIF
772
773
774  !---------------------------------------------------------
775  !--                  FREEZING
776  !---------------------------------------------------------
777  !--Process through which rain freezes into snow.
778  !-- We parameterize it as a 2 step process:
779  !-- first: freezing following collision with ice crystals
780  !-- second: immersion freezing following (inspired by Bigg 1953)
781  !-- the latter is parameterized as an exponential decrease of the rain
782  !-- water content with a homemade formulya
783  !--This is based on a caracteritic time of freezing, which
784  !--exponentially depends on temperature so that it is
785  !--equal to 1 for temp_nowater (see below) and is close to
786  !--0 for RTT (=273.15 K).
787  !--NB.: this process needs a temperature adjustment
788  !--dqrfreez_max: maximum rain freezing so that temperature
789  !--              stays lower than 273 K [kg/kg]
790  !--tau_freez: caracteristic time of freezing [s]
791  !--gamma_freez: tuning parameter [s-1]
792  !--alpha_freez: tuning parameter for the shape of the exponential curve [-]
793  !--temp_nowater: temperature below which no liquid water exists [K] (about -40 degC)
794
795  IF ( ( rainclr(i) + raincld(i) ) .GT. 0. ) THEN
796
797     
798    !--1st step: freezing following collision with ice crystals
799    !--Sub-process of freezing which quantifies the collision between
800    !--ice crystals in suspension and falling rain droplets.
801    !--The rain droplets freeze, becoming graupel, and carrying
802    !--the ice crystal (which acted as an ice nucleating particle).
803    !--The formula is adapted from the riming formula.
804    !-- it works only in the cloudy part
805
806    dqifreez = 0.
807    dqrtotfreez_step1 = 0.
808
809    IF ( ( qice(i) .GT. 0. ) .AND. ( raincld(i) .GT. 0. ) ) THEN
810      dqrclrfreez = 0.
811      dqrcldfreez = 0.
812
813      !--Computed according to
814      !--Cpdry * Delta T * (1 + (Cpvap/Cpdry - 1) * qtot) = Lfusion * Delta q
815      dqrfreez_max = MIN(0., ( temp(i) - RTT ) / RLMLT * RCPD &
816                         * ( 1. + RVTMP2 * qtot(i) ))
817 
818      !--Sub-process of freezing which quantifies the collision between
819      !--ice crystals in suspension and falling rain droplets.
820      !--The rain droplets freeze, becoming graupel, and carrying
821      !--the ice crystal (which acted as an ice nucleating particle).
822      !--The formula is adapted from the riming formula.
823
824      !--The collision efficiency is assumed unity
825      Eff_rain_ice = 1.
826      coef_freez = gamma_freez * 3. / 4. / rho_rain / r_rain * Eff_rain_ice
827      !--Exact version, which does not need a barrier because of
828      !--the exponential decrease.
829      dqifreez = qice(i) * ( EXP( - dtime * coef_freez * raincld(i) / precipfraccld(i) ) - 1. )
830
831      !--We add the part of rain water that freezes, limited by a temperature barrier
832      !--this quantity is calculated assuming that the number of drop that freeze correspond to the number
833      !--of crystals collected (and assuming uniform distributions of ice crystals and rain drops)
834      !--The ice specific humidity that collide with rain is dqi = dNi 4/3 PI rho_ice r_ice**3
835      !--The rain that collide with ice is, similarly, dqr = dNr 4/3 PI rho_rain r_rain**3
836      !--The assumption above corresponds to dNi = dNr, i.e.,
837      !-- dqr = dqi * (4/3 PI rho_rain * r_rain**3) / (4/3 PI rho_ice * r_ice**3)
838      dqrcldfreez = dqifreez * rho_rain * r_rain**3. / ( rho_ice * r_ice**3. )
839      dqrcldfreez = MAX(dqrcldfreez, - raincld(i) / dhum_to_dflux(i))
840      dqrcldfreez = MAX(dqrcldfreez, dqrfreez_max)
841      dqrtotfreez_step1 = dqrcldfreez
842
843      !--Add tendencies
844      !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
845      qice(i) = qice(i) + dqifreez
846      raincld(i) = MAX(0., raincld(i) + dqrcldfreez * dhum_to_dflux(i))
847      snowcld(i) = MAX(0., snowcld(i) - dqrcldfreez * dhum_to_dflux(i) - dqifreez * dhum_to_dflux(i))
848      temp(i) = temp(i) - dqrtotfreez_step1 * RLMLT / RCPD &
849                        / ( 1. + RVTMP2 * qtot(i) )
850
851    ENDIF
852   
853    !-- Second step immersion freezing of rain drops
854    !-- with a homemade timeconstant depending on temperature
855
856    dqrclrfreez = 0.
857    dqrcldfreez = 0.
858    dqrtotfreez_step2 = 0.
859    !--Computed according to
860    !--Cpdry * Delta T * (1 + (Cpvap/Cpdry - 1) * qtot) = Lfusion * Delta q
861
862    dqrfreez_max = MIN(0., ( temp(i) - RTT ) / RLMLT * RCPD &
863                         * ( 1. + RVTMP2 * qtot(i) ))
864
865   
866    tau_freez = 1. / ( beta_freez &
867              * EXP( - alpha_freez * ( temp(i) - temp_nowater ) / ( RTT - temp_nowater ) ) )
868
869
870    !--In clear air
871    IF ( rainclr(i) .GT. 0. ) THEN
872      !--Exact solution of dqrain/dt = -qrain/tau_freez
873      dqrclrfreez = rainclr(i) / dhum_to_dflux(i) * ( EXP( - dtime / tau_freez ) - 1. )
874    ENDIF
875
876    !--In cloudy air
877    IF ( raincld(i) .GT. 0. ) THEN
878      !--Exact solution of dqrain/dt = -qrain/tau_freez
879      dqrcldfreez = raincld(i) / dhum_to_dflux(i) * ( EXP( - dtime / tau_freez ) - 1. )
880    ENDIF
881
882    !--temperature barrie step 2
883    !--It is activated if the total is LOWER than the max
884    !--because everything is negative
885    dqrtotfreez_step2 = dqrclrfreez + dqrcldfreez
886 
887    IF ( dqrtotfreez_step2 .LT. dqrfreez_max ) THEN
888      !--We redistribute the max freezed rain keeping
889      !--the clear/cloud partition of the freezing rain
890      dqrclrfreez = dqrfreez_max * dqrclrfreez / dqrtotfreez_step2
891      dqrcldfreez = dqrfreez_max * dqrcldfreez / dqrtotfreez_step2
892      dqrtotfreez_step2 = dqrfreez_max
893    ENDIF
894
895
896    !--Add tendencies
897    !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
898    rainclr(i) = MAX(0., rainclr(i) + dqrclrfreez * dhum_to_dflux(i))
899    raincld(i) = MAX(0., raincld(i) + dqrcldfreez * dhum_to_dflux(i))
900    snowclr(i) = MAX(0., snowclr(i) - dqrclrfreez * dhum_to_dflux(i))
901    snowcld(i) = MAX(0., snowcld(i) - dqrcldfreez * dhum_to_dflux(i))
902
903
904    !--Temperature adjustment with the uptake of latent
905    !--heat because of freezing
906    temp(i) = temp(i) - dqrtotfreez_step2 * RLMLT / RCPD &
907                      / ( 1. + RVTMP2 * qtot(i) )
908
909    !--Diagnostic tendencies
910    dqrtotfreez = dqrtotfreez_step1 + dqrtotfreez_step2         
911    dqrfreez(i) = dqrtotfreez / dtime
912    dqsfreez(i) = -(dqrtotfreez + dqifreez) / dtime
913
914  ENDIF
915
916  !--If the local flux of rain+snow in clear/cloudy air is lower than rain_int_min,
917  !--we reduce the precipiration fraction in the clear/cloudy air so that the new
918  !--local flux of rain+snow is equal to rain_int_min.
919  !--Here, rain+snow is the gridbox-mean flux of precip.
920  !--Therefore, (rain+snow)/precipfrac is the local flux of precip.
921  !--If the local flux of precip is lower than rain_int_min, i.e.,
922  !-- (rain+snow)/precipfrac < rain_int_min , i.e.,
923  !-- (rain+snow)/rain_int_min < precipfrac , then we want to reduce
924  !--the precip fraction to the equality, i.e., precipfrac = (rain+snow)/rain_int_min.
925  !--Note that this is physically different than what is proposed in LTP thesis.
926  precipfracclr(i) = MIN( precipfracclr(i), ( rainclr(i) + snowclr(i) ) / rain_int_min )
927  precipfraccld(i) = MIN( precipfraccld(i), ( raincld(i) + snowcld(i) ) / rain_int_min )
928
929  !--Calculate outputs
930  rain(i) = rainclr(i) + raincld(i)
931  snow(i) = snowclr(i) + snowcld(i)
932
933  !--Diagnostics
934  !--BEWARE this is indeed a diagnostic: this is an estimation from
935  !--the value of the flux at the bottom interface of the mesh and
936  !--and assuming an upstream numerical calculation
937  !--If ok_radocond_snow is TRUE, then the diagnostic qsnowdiag is
938  !--used for computing the total ice water content in the mesh
939  !--for radiation only
940  qraindiag(i) = ( rainclr(i) / ( pplay(i) / RD / temp(i) ) / rain_fallspeed_clr &
941                 + raincld(i) / ( pplay(i) / RD / temp(i) ) / rain_fallspeed_cld )
942  qsnowdiag(i) = ( snowclr(i) / ( pplay(i) / RD / temp(i) ) / snow_fallspeed_clr &
943                 + snowcld(i) / ( pplay(i) / RD / temp(i) ) / snow_fallspeed_cld )
944
945ENDDO ! loop on klon
946
947END SUBROUTINE poprecip_postcld
948
949END MODULE lmdz_lscp_poprecip
Note: See TracBrowser for help on using the repository browser.