PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_elec_tendencies.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 2022-2025 CNRS, Meteo-France and Universite Paul Sabatier
2!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
3!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4!MNH_LIC for details. version 1.
5!-----------------------------------------------------------------
7!
8IMPLICIT NONE
9CONTAINS
10!
11! #########################################################################################
12 SUBROUTINE elec_tendencies (D, CST, ICED, ICEP, ELECD, ELECP, &
13 LIMAP, LIMAC, LIMAM, &
14 KRR, KMICRO, PTSTEP, ODMICRO, &
15 BUCONF, TBUDGETS, KBUDGETS, &
16 HCLOUD, PTHVREFZIKB, &
17 PRHODREF, PRHODJ, PZT, PCIT, &
18 PRVT, PRCT, PRRT, PRIT, PRST, PRGT, &
19 PQPIT, PQCT, PQRT, PQIT, PQST, PQGT, PQNIT, &
20 PQPIS, PQCS, PQRS, PQIS, PQSS, PQGS, PQNIS, &
21 PRVHENI, PRRHONG, PRIMLTC, &
22 PRCHONI, PRVDEPS, PRIAGGS, PRIAUTS, PRVDEPG, &
23 PRCAUTR, PRCACCR, PRREVAV, &
24 PRCRIMSS, PRCRIMSG, PRSRIMCG, PRRACCSS, PRRACCSG, PRSACCRG, &
25 PRSMLTG, PRICFRRG, PRRCFRIG, &
26 PRCWETG, PRIWETG, PRRWETG, PRSWETG, &
27 PRCDRYG, PRIDRYG, PRRDRYG, PRSDRYG, &
28 PRGMLTR, PRCBERI, &
29 PRCMLTSR, PRICFRR, & !- opt. param. for ICE3
30 PCCT, PCRT, PCST, PCGT, & !-- optional
31 PRVHENC, PRCHINC, PRVHONH, & !| parameters
32 PRRCVRC, PRICNVI, PRVDEPI, PRSHMSI, PRGHMGI, & !| for
33 PRICIBU, PRIRDSF, & !| LIMA
34 PRCCORR2, PRRCORR2, PRICORR2, & !--
35 PRWETGH, PRCWETH, PRIWETH, PRSWETH, PRGWETH, PRRWETH, & !-- optional
36 PRCDRYH, PRIDRYH, PRSDRYH, PRRDRYH, PRGDRYH, & !| parameters
37 PRHMLTR, PRDRYHG, & !| for
38 PRHT, PCHT, PQHT, PQHS) !-- hail
39
40!$ACDC singlecolumn --dummy
41
42! ##########################################################################################
43!
44!!**** * - compute the explicit cloud electrification sources
45!!
46!! This routine is adapted from rain_ice_elec.f90.
47!! To avoid duplicated routines, the cloud electrification routine is now CALLed
48!! at the end of the microphysics scheme but needs the microphysical tendencies as arguments.
49!! The sedimentation source for electric charges is treated separately.
50!!
51!! AUTHOR
52!! ------
53!! C. Barthe * LAERO *
54!!
55!! MODIFICATIONS
56!! -------------
57!! Original February 2022
58!!
59!! Modifications
60!! C. Barthe 12/04/2022 include electrification from LIMA
61!! C. Barthe 22/03/2023 5-6: take into account news from LIMA (Ns, Ng, Nh, CIBU and RDSF) and PHYEX
62!! C. Barthe 13/07/2023 5-6: Ns, Ng and Nh can be pronostic variables (LIMA2)
63!! C. Barthe 22/11/2023 initialize Nx to 0 when 1-moment
64!!
65!------------------------------------------------------------------
66!
67!* 0. DECLARATIONS
68! ------------
69!
71!
72USE modd_cst, ONLY: cst_t
103!
104!#ifdef MNH_PGI
105!USE MODE_PACK_PGI
106!#endif
107use mode_tools, only: countjv
108!
111!
112IMPLICIT NONE
113!
114!
115!* 0.1 Declaration of dummy arguments
116!
117TYPE(dimphyex_t), INTENT(IN) :: D
118TYPE(cst_t), INTENT(IN) :: CST
119TYPE(tbudgetconf_t), INTENT(IN) :: BUCONF ! budget structure
120TYPE(rain_ice_descr_t), INTENT(IN) :: ICED
121TYPE(rain_ice_param_t), INTENT(IN) :: ICEP
122TYPE(elec_param_t), INTENT(IN) :: ELECP ! electrical parameters
123TYPE(elec_descr_t), INTENT(IN) :: ELECD ! electrical descriptive csts
124TYPE(param_lima_t),INTENT(IN)::LIMAP
125TYPE(param_lima_cold_t),INTENT(IN)::LIMAC
126TYPE(param_lima_mixed_t),INTENT(IN)::LIMAM
127TYPE(tbudgetdata_ptr), DIMENSION(KBUDGETS),INTENT(INOUT) :: TBUDGETS
128INTEGER, INTENT(IN) :: KBUDGETS
129!
130INTEGER, INTENT(IN) :: KMICRO
131REAL, INTENT(IN) :: PTSTEP ! Double Time step
132 ! (single if cold start)
133INTEGER, INTENT(IN) :: KRR ! Number of moist variable
134!
135LOGICAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: ODMICRO ! mask to limit computation
136CHARACTER (LEN=4), INTENT(IN) :: HCLOUD ! Kind of microphysical scheme
137!
138REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODREF! Reference density
139REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
140REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PZT ! Temperature (K)
141REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PCIT ! Pristine ice n.c. at t
142!
143REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRVT ! Water vapor m.r. at t
144REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRCT ! Cloud water m.r. at t
145REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRRT ! Rain water m.r. at t
146REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRIT ! Pristine ice m.r. at t
147REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRST ! Snow/aggregate m.r. at t
148REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRGT ! Graupel/hail m.r. at t
149!
150REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQPIT ! Positive ion (Nb/kg) at t
151REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQNIT ! Negative ion (Nb/kg) at t
152REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQCT ! Cloud water charge at t
153REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQRT ! Raindrops charge at t
154REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQIT ! Pristine ice charge at t
155REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQST ! Snow/aggregates charge at t
156REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PQGT ! Graupel charge at t
157!
158REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQPIS ! Positive ion (Nb/kg) source
159REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQNIS ! Negative ion (Nb/kg) source
160REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQCS ! Cloud water charge source
161REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQRS ! Raindrops charge source
162REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQIS ! Pristine ice charge source
163REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQSS ! Snow/aggregates charge source
164REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PQGS ! Graupel charge source
165!
166! microphysics rates common to ICE3 and LIMA
167REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRVHENI, & ! heterogeneous nucleation mixing ratio change (HIND for LIMA)
168 PRCHONI, & ! Homogeneous nucleation
169 PRRHONG, & ! Spontaneous freezing mixing ratio change
170 PRVDEPS, & ! Deposition on r_s,
171 PRIAGGS, & ! Aggregation on r_s
172 PRIAUTS, & ! Autoconversion of r_i for r_s production (CNVS for LIMA)
173 PRVDEPG, & ! Deposition on r_g
174 PRCAUTR, & ! Autoconversion of r_c for r_r production
175 PRCACCR, & ! Accretion of r_c for r_r production
176 PRREVAV, & ! Evaporation of r_r
177 PRIMLTC, & ! Cloud ice melting mixing ratio change
178 PRCBERI, & ! Bergeron-Findeisen effect
179 PRSMLTG, & ! Conversion-Melting of the aggregates
180 PRRACCSS, PRRACCSG, PRSACCRG, & ! Rain accretion onto the aggregates
181 PRCRIMSS, PRCRIMSG, PRSRIMCG, & ! Cloud droplet riming of the aggregates
182 PRICFRRG, PRRCFRIG, & ! Rain contact freezing
183 PRCWETG, PRIWETG, PRRWETG, PRSWETG, & ! Graupel wet growth
184 PRCDRYG, PRIDRYG, PRRDRYG, PRSDRYG, & ! Graupel dry growth
185 PRGMLTR ! Melting of the graupel
186! microphysics rates specific to ICE3 (knmoments==1)
187REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PRCMLTSR,& ! Cld droplet collection onto aggregates by pos. temp.
188 PRICFRR ! Rain contact frz (part of ri converted to rr)
189! microphysics rates specific to LIMA (knmoments==2)
190REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PRVHENC, & ! Cld droplet formation
191 PRCHINC, & ! Heterogeneous nucleation of coated IFN
192 PRVHONH, & ! Nucleation of haze
193 PRRCVRC, & ! Conversion of small drops into droplets
194 PRICNVI, & ! Conversion snow --> ice
195 PRVDEPI, & ! Deposition on r_i
196 PRSHMSI, PRGHMGI, & ! Hallett Mossop for snow and graupel
197 PRICIBU, & ! Collisional ice breakup
198 PRIRDSF, & ! Raindrop shattering by freezing
199 PRCCORR2, PRRCORR2, PRICORR2 ! Correction inside LIMA splitting
200! microphysics rates related to hail (krr == 7, lhail = .t.)
201REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PRWETGH, & ! Conversion of graupel into hail
202 PRCWETH, PRIWETH, PRSWETH, PRGWETH, PRRWETH, & ! Dry growth of hail
203 PRCDRYH, PRIDRYH, PRSDRYH, PRRDRYH, PRGDRYH, & ! Wet growth of hail
204 PRHMLTR, & ! Melting of hail
205 PRDRYHG ! Conversion of hail into graupel
206!
207REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCCT ! Cloud droplets conc. at t
208REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCRT ! Raindrops conc. at t
209REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCST ! Snow conc. at t
210REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCGT ! Graupel conc. at t
211REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCHT ! Hail conc. at t
212!
213REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PRHT ! Hail m.r. at t
214REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PQHT ! Hail charge at t
215REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(INOUT) :: PQHS ! Hail charge source
216REAL, INTENT(IN) :: PTHVREFZIKB ! Reference thv at IKB for electricity
217!
218!
219!* 0.2 Declaration of local variables
220!
221INTEGER :: II, JL ! Loop indexes
222INTEGER :: IIB, IIE, & ! Define the domain
223 IJB, IJE, & ! where the microphysical sources
224 IKB, IKE ! must be computed
225INTEGER :: IMICRO ! nb of pts where r_x > 0
226INTEGER, DIMENSION(KMICRO) :: I1
227INTEGER, DIMENSION(KMICRO) :: II1, II2, II3
228!
229LOGICAL, DIMENSION(KMICRO) :: GMASK ! Mask
230!REAL, DIMENSION(KMICRO) :: ZMASK ! to reduce
231INTEGER :: IGMASK ! the computation domain
232!
233REAL, DIMENSION(KMICRO) :: ZRHODREF ! Reference density
234REAL, DIMENSION(KMICRO) :: ZRHODJ ! RHO times Jacobian
235REAL, DIMENSION(KMICRO) :: ZZT ! Temperature
236!
237REAL, DIMENSION(KMICRO) :: ZRVT ! Water vapor m.r. at t
238REAL, DIMENSION(KMICRO) :: ZRCT ! Cloud water m.r. at t
239REAL, DIMENSION(KMICRO) :: ZRRT ! Rain water m.r. at t
240REAL, DIMENSION(KMICRO) :: ZRIT ! Pristine ice m.r. at t
241REAL, DIMENSION(KMICRO) :: ZRST ! Snow/aggregate m.r. at t
242REAL, DIMENSION(KMICRO) :: ZRGT ! Graupel m.r. at t
243REAL, DIMENSION(KMICRO) :: ZRHT ! Hail m.r. at t
244REAL, DIMENSION(KMICRO) :: ZCCT ! Cloud water conc. at t
245REAL, DIMENSION(KMICRO) :: ZCRT ! Raindrops conc. at t
246REAL, DIMENSION(KMICRO) :: ZCIT ! Pristine ice conc. at t
247REAL, DIMENSION(KMICRO) :: ZCST ! Snow/aggregate conc. at t
248REAL, DIMENSION(KMICRO) :: ZCGT ! Graupel conc. at t
249REAL, DIMENSION(KMICRO) :: ZCHT ! Hail conc. at t
250!
251REAL, DIMENSION(KMICRO) :: ZQPIT ! Positive ion (/kg) at t
252REAL, DIMENSION(KMICRO) :: ZQNIT ! Negative ion (/kg) at t
253REAL, DIMENSION(KMICRO) :: ZQCT ! Cloud water charge at t
254REAL, DIMENSION(KMICRO) :: ZQRT ! Raindrops charge at t
255REAL, DIMENSION(KMICRO) :: ZQIT ! Pristine ice charge at t
256REAL, DIMENSION(KMICRO) :: ZQST ! Snow/aggregate charge at t
257REAL, DIMENSION(KMICRO) :: ZQGT ! Graupel charge at t
258REAL, DIMENSION(KMICRO) :: ZQHT ! Hail charge at t
259!
260REAL, DIMENSION(KMICRO) :: ZQPIS ! Positive ion (/kg) source
261REAL, DIMENSION(KMICRO) :: ZQNIS ! Negative ion (/kg) source
262REAL, DIMENSION(KMICRO) :: ZQCS ! Cloud water charge source
263REAL, DIMENSION(KMICRO) :: ZQRS ! Raindrops charge source
264REAL, DIMENSION(KMICRO) :: ZQIS ! Pristine ice charge source
265REAL, DIMENSION(KMICRO) :: ZQSS ! Snow/aggregate charge source
266REAL, DIMENSION(KMICRO) :: ZQGS ! Graupel charge source
267REAL, DIMENSION(KMICRO) :: ZQHS ! Hail charge source
268!
269REAL, DIMENSION(KMICRO) :: ZLBDAC ! Slope parameter of the droplets distribution
270REAL, DIMENSION(KMICRO) :: ZLBDAR ! Slope parameter of the raindrop distribution
271REAL, DIMENSION(KMICRO) :: ZLBDAI ! Slope parameter of the pristine ice distribution
272REAL, DIMENSION(KMICRO) :: ZLBDAS ! Slope parameter of the aggregate distribution
273REAL, DIMENSION(KMICRO) :: ZLBDAG ! Slope parameter of the graupel distribution
274REAL, DIMENSION(KMICRO) :: ZLBDAH ! Slope parameter of the hail distribution
275!
276REAL, DIMENSION(KMICRO) :: ZECT !
277REAL, DIMENSION(KMICRO) :: ZERT ! e_x coef
278REAL, DIMENSION(KMICRO) :: ZEIT ! in the
279REAL, DIMENSION(KMICRO) :: ZEST ! q_x - D_x relation
280REAL, DIMENSION(KMICRO) :: ZEGT !
281REAL, DIMENSION(KMICRO) :: ZEHT !
282!
283LOGICAL, DIMENSION(KMICRO,4) :: GELEC ! Mask for non-inductive charging
284!
285REAL, DIMENSION(:), ALLOCATABLE :: ZDQ, ZDQ_IS, ZDQ_IG, ZDQ_SG
286!
287! Non-inductive charging process following Gardiner et al. (1995)
288REAL, DIMENSION(:), ALLOCATABLE :: ZDELTALWC ! Gap between LWC and a critical LWC
289REAL, DIMENSION(:), ALLOCATABLE :: ZFT ! Fct depending on temperature
290!
291! Non-inductive charging process following Saunders et al. (1991) / EW
292REAL, DIMENSION(:), ALLOCATABLE :: ZEW ! Effective liquid water content
293REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNSK ! constant B
294REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNIM ! d_i exponent
295REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNIN ! v_g/s-v_i
296REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNSM ! d_s exponent
297REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNSN ! v_g-v_s
298REAL, DIMENSION(:), ALLOCATABLE :: ZFQIAGGS, ZFQIDRYGBS
299REAL, DIMENSION(:), ALLOCATABLE :: ZLBQSDRYGB1S, ZLBQSDRYGB2S, ZLBQSDRYGB3S
300!
301! Non-inductive charging process following Saunders and Peck (1998) / RAR
302REAL, DIMENSION(:), ALLOCATABLE :: ZRAR ! Rime accretion rate
303REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNIM_IS ! d_i exponent
304REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNIN_IS ! v_g/s-v_i
305REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNIM_IG ! d_i exponent
306REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNIN_IG ! v_g/s-v_i
307REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNSK_SG ! constant B
308REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNSM_SG ! d_s exponent
309REAL, DIMENSION(:), ALLOCATABLE :: ZSAUNSN_SG ! v_g-v_s
310!
311! Inductive charging process (Ziegler et al., 1991)
312REAL, DIMENSION(:), ALLOCATABLE :: ZEFIELDW ! Vertical component of the electric field
313!
314REAL, DIMENSION(KMICRO) :: ZLIMIT ! Used to limit the charge separated during NI process
315REAL, DIMENSION(KMICRO) :: ZQCOLIS ! Collection efficiency between ice and snow
316REAL, DIMENSION(KMICRO) :: ZQCOLIG ! Collection efficiency between ice and graupeln
317REAL, DIMENSION(KMICRO) :: ZQCOLSG ! Collection efficiency between snow and graupeln
318!
319REAL :: ZRHO00, ZCOR00 ! Surface reference air density
320REAL, DIMENSION(KMICRO) :: ZRHOCOR ! Density correction for fallspeed
321!
322INTEGER, DIMENSION(:), ALLOCATABLE :: IVEC1, IVEC2 ! Vectors of indices for interpolation
323REAL, DIMENSION(:), ALLOCATABLE :: ZVEC1, ZVEC2 ! Work vectors for interpolation
324REAL, DIMENSION(:), ALLOCATABLE :: ZVECQ1, ZVECQ2, ZVECQ3, ZVECQ4 ! Work vectors for interpolation
325!
326REAL, DIMENSION(KMICRO) :: ZWQ, ZWQ_NI ! Work arrays
327REAL, DIMENSION(KMICRO) :: ZWQ1, ZWQ2, ZWQ3, ZWQ4 ! for
328REAL, DIMENSION(KMICRO,9) :: ZWQ5 ! charge transfer
329!
330! variables used to select between common parameters between ICEx and LIMA
331INTEGER :: IMOM_C, IMOM_R, IMOM_I, IMOM_S, IMOM_G, IMOM_H ! number of moments for each hydrometeor
332INTEGER :: IGAMINC, &
333 IACCLBDAR, IACCLBDAS, &
334 IDRYLBDAR, IDRYLBDAS, IDRYLBDAG
335!
336REAL :: ZCEXVT, &
337 ZALPHAI, ZNUI, ZAI, ZBI, ZDS, ZDG, ZCXS, ZCXG, &
338 ZCOLIS, ZCOLEXIS, ZCOLIG, ZCOLEXIG, ZCOLSG, ZCOLEXSG, &
339 ZACCINTP1S, ZACCINTP2S, ZACCINTP1R, ZACCINTP2R, &
340 ZDRYINTP1R, ZDRYINTP2R, ZDRYINTP1S, ZDRYINTP2S, &
341 ZDRYINTP1G, ZDRYINTP2G, &
342 ZRIMINTP1, ZRIMINTP2
343REAL, DIMENSION(:), ALLOCATABLE :: ZRTMIN
344!
345! microphysical tendencies have to be transformed in 1D arrays
346REAL, DIMENSION(KMICRO) :: ZRVHENI, ZRCHONI, ZRRHONG, ZRVDEPS, ZRIAGGS, &
347 ZRIAUTS, ZRVDEPG, ZRCAUTR, ZRCACCR, ZRREVAV, &
348 ZRIMLTC, ZRCBERI, ZRSMLTG, ZRRACCSS, ZRRACCSG, &
349 ZRSACCRG, ZRCRIMSS, ZRCRIMSG, ZRSRIMCG, ZRICFRRG, &
350 ZRRCFRIG, ZRCWETG, ZRIWETG, ZRRWETG, ZRSWETG, &
351 ZRCDRYG, ZRIDRYG, ZRRDRYG, ZRSDRYG, ZRGMLTR
352! optional microphysical tendencies
353REAL, DIMENSION(:), ALLOCATABLE :: ZRCMLTSR, ZRICFRR, ZRVHENC, ZRCHINC, ZRVHONH, &
354 ZRRCVRC, ZRICNVI, ZRVDEPI, ZRSHMSI, ZRGHMGI, &
355 ZRICIBU, ZRIRDSF, ZRCCORR2, ZRRCORR2, ZRICORR2, &
356 ZRWETGH, ZRCWETH, ZRIWETH, ZRSWETH, ZRGWETH, &
357 ZRRWETH, ZRCDRYH, ZRIDRYH, ZRSDRYH, ZRRDRYH, &
358 ZRGDRYH, ZRHMLTR, ZRDRYHG
359!
360!------------------------------------------------------------------
361associate(xcexvt_i=>iced%XCEXVT, xrtmin_i=>iced%XRTMIN, &
362 xalphai_i=>iced%XALPHAI, xnui_i=>iced%XNUI, xai_i=>iced%XAI, xbi_i=>iced%XBI, &
363 xds_i=>iced%XDS, xdg_i=>iced%XDG, &
364 xcxs_i=>iced%XCXS, xcxg_i=>iced%XCXG, &
365 xcolis_i=>icep%XCOLIS, xcolexis_i=>icep%XCOLEXIS, &
366 xcolig_i=>icep%XCOLIG, xcolexig_i=>icep%XCOLEXIG, &
367 xcolsg_i=>icep%XCOLSG, xcolexsg_i=>icep%XCOLEXSG, &
368 ngaminc_i=>icep%NGAMINC, &
369 nacclbdar_i=>icep%NACCLBDAR, nacclbdas_i=>icep%NACCLBDAS, &
370 xaccintp1s_i=>icep%XACCINTP1S, xaccintp2s_i=>icep%XACCINTP2S, &
371 xaccintp1r_i=>icep%XACCINTP1R, xaccintp2r_i=>icep%XACCINTP2R, &
372 ndrylbdar_i=>icep%NDRYLBDAR, ndrylbdas_i=>icep%NDRYLBDAS, &
373 ndrylbdag_i=>icep%NDRYLBDAG, &
374 xdryintp1r_i=>icep%XDRYINTP1R, xdryintp2r_i=>icep%XDRYINTP2R, &
375 xdryintp1s_i=>icep%XDRYINTP1S, xdryintp2s_i=>icep%XDRYINTP2S, &
376 xdryintp1g_i=>icep%XDRYINTP1G, xdryintp2g_i=>icep%XDRYINTP2G, &
377 xrimintp1_i=>icep%XRIMINTP1, xrimintp2_i=>icep%XRIMINTP2, &
378 xcexvt_l=>limap%XCEXVT, xrtmin_l=>limap%XRTMIN, &
379 xalphai_l=>limap%XALPHAI, xnui_l=>limap%XNUI, xai_l=>limac%XAI, xbi_l=>limac%XBI, &
380 xds_l=>limac%XDS, xdg_l=>limam%XDG, &
381 xcxs_l=>limac%XCXS, xcxg_l=>limam%XCXG, &
382 xcolis_l=>limac%XCOLIS, xcolexis_l=>limac%XCOLEXIS, &
383 xcolig_l=>limam%XCOLIG, xcolexig_l=>limam%XCOLEXIG, &
384 xcolsg_l=>limam%XCOLSG, xcolexsg_l=>limam%XCOLEXSG, &
385 ngaminc_l=>limam%NGAMINC, &
386 nacclbdar_l=>limam%NACCLBDAR, nacclbdas_l=>limam%NACCLBDAS, &
387 xaccintp1s_l=>limam%XACCINTP1S, xaccintp2s_l=>limam%XACCINTP2S, &
388 xaccintp1r_l=>limam%XACCINTP1R, xaccintp2r_l=>limam%XACCINTP2R, &
389 ndrylbdar_l=>limam%NDRYLBDAR, ndrylbdas_l=>limam%NDRYLBDAS, &
390 ndrylbdag_l=>limam%NDRYLBDAG, &
391 xdryintp1r_l=>limam%XDRYINTP1R, xdryintp2r_l=>limam%XDRYINTP2R, &
392 xdryintp1s_l=>limam%XDRYINTP1S, xdryintp2s_l=>limam%XDRYINTP2S, &
393 xdryintp1g_l=>limam%XDRYINTP1G, xdryintp2g_l=>limam%XDRYINTP2G, &
394 xrimintp1_l=>limam%XRIMINTP1, xrimintp2_l=>limam%XRIMINTP2 )
395!
396!* 1. INITIALIZATIONS
397! ---------------
398!
399!* 1.1 compute the loop bounds
400!
401iib = d%NIB
402iie = d%NIE
403ijb = d%NJB
404ije = d%NJE
405ikb = d%NKB
406ike = d%NKE
407!
408!
409!* 1.2 select parameters between ICEx and LIMA
410!
411IF (hcloud(1:3) == 'ICE') THEN
412 zcexvt = xcexvt_i
413 imom_c = 1
414 imom_r = 1
415 imom_i = 2 ! Ni is diagnostic and always available
416 imom_s = 1
417 imom_g = 1
418 IF (krr == 7) THEN
419 imom_h = 1
420 ELSE
421 imom_h = 0
422 END IF
423ELSE IF (hcloud == 'LIMA') THEN
424 zcexvt = xcexvt_l
425 imom_c = limap%NMOM_C
426 imom_r = limap%NMOM_R
427 imom_i = 2 ! Ni is diagnostic and always available
428 imom_s = limap%NMOM_S
429 imom_g = limap%NMOM_G
430 imom_h = limap%NMOM_H
431END IF
432!
433zrho00 = cst%XP00 / (cst%XRD * pthvrefzikb)
434zcor00 = zrho00**zcexvt
435!
436IF (linductive) ALLOCATE (zefieldw(kmicro))
437!
438!
439!* 1.3 packing
440!
441! optimization by looking for locations where
442! the microphysical fields are larger than a minimal value only !!!
443!
444IF (kmicro >= 0) THEN
445 imicro = countjv(odmicro(:,:,:), ii1(:), ii2(:), ii3(:))
446 !
447 ! some microphysical tendencies are optional: the corresponding 1D arrays must be allocated
448 IF (hcloud(1:3) == 'ICE') THEN ! ICE3 scheme
449 ALLOCATE(zrcmltsr(imicro))
450 ALLOCATE(zricfrr(imicro))
451 END IF
452 IF (hcloud == 'LIMA') THEN ! LIMA scheme
453 ALLOCATE(zrvhenc(imicro))
454 ALLOCATE(zrchinc(imicro))
455 ALLOCATE(zrvhonh(imicro))
456 ALLOCATE(zrrcvrc(imicro))
457 ALLOCATE(zricnvi(imicro))
458 ALLOCATE(zrvdepi(imicro))
459 ALLOCATE(zrshmsi(imicro))
460 ALLOCATE(zrghmgi(imicro))
461 ALLOCATE(zricibu(imicro))
462 ALLOCATE(zrirdsf(imicro))
463 ALLOCATE(zrccorr2(imicro))
464 ALLOCATE(zrrcorr2(imicro))
465 ALLOCATE(zricorr2(imicro))
466 END IF
467 IF (krr == 7) THEN ! hail activated
468 ALLOCATE(zrwetgh(imicro))
469 ALLOCATE(zrcweth(imicro))
470 ALLOCATE(zriweth(imicro))
471 ALLOCATE(zrsweth(imicro))
472 ALLOCATE(zrgweth(imicro))
473 ALLOCATE(zrrweth(imicro))
474 ALLOCATE(zrcdryh(imicro))
475 ALLOCATE(zrrdryh(imicro))
476 ALLOCATE(zridryh(imicro))
477 ALLOCATE(zrsdryh(imicro))
478 ALLOCATE(zrgdryh(imicro))
479 ALLOCATE(zrhmltr(imicro))
480 ALLOCATE(zrdryhg(imicro))
481 END IF
482 !
483 DO jl = 1, imicro
484 zzt(jl) = pzt(ii1(jl),ii2(jl),ii3(jl))
485 zrhodref(jl) = prhodref(ii1(jl),ii2(jl),ii3(jl))
486 zrhocor(jl) = (zrho00 / zrhodref(jl))**zcexvt
487 zrhodj(jl) = prhodj(ii1(jl),ii2(jl),ii3(jl))
488 !
489 zcit(jl) = pcit(ii1(jl),ii2(jl),ii3(jl))
490 IF (imom_c == 2) zcct(jl) = pcct(ii1(jl),ii2(jl),ii3(jl))
491 IF (imom_r == 2) zcrt(jl) = pcrt(ii1(jl),ii2(jl),ii3(jl))
492 IF (imom_s == 2) zcst(jl) = pcst(ii1(jl),ii2(jl),ii3(jl))
493 IF (imom_g == 2) zcgt(jl) = pcgt(ii1(jl),ii2(jl),ii3(jl))
494 IF (imom_h == 2) zcht(jl) = pcht(ii1(jl),ii2(jl),ii3(jl))
495 IF (imom_c == 1) zcct(jl) = 0.
496 IF (imom_r == 1) zcrt(jl) = 0.
497 IF (imom_s == 1) zcst(jl) = 0.
498 IF (imom_g == 1) zcgt(jl) = 0.
499 IF (imom_h == 1) zcht(jl) = 0.
500 !
501 zrvt(jl) = prvt(ii1(jl),ii2(jl),ii3(jl))
502 zrct(jl) = prct(ii1(jl),ii2(jl),ii3(jl))
503 zrrt(jl) = prrt(ii1(jl),ii2(jl),ii3(jl))
504 zrit(jl) = prit(ii1(jl),ii2(jl),ii3(jl))
505 zrst(jl) = prst(ii1(jl),ii2(jl),ii3(jl))
506 zrgt(jl) = prgt(ii1(jl),ii2(jl),ii3(jl))
507 IF (krr == 7) zrht(jl) = prht(ii1(jl),ii2(jl),ii3(jl))
508 !
509 zqpit(jl) = pqpit(ii1(jl),ii2(jl),ii3(jl))
510 zqnit(jl) = pqnit(ii1(jl),ii2(jl),ii3(jl))
511 zqct(jl) = pqct(ii1(jl),ii2(jl),ii3(jl))
512 zqrt(jl) = pqrt(ii1(jl),ii2(jl),ii3(jl))
513 zqit(jl) = pqit(ii1(jl),ii2(jl),ii3(jl))
514 zqst(jl) = pqst(ii1(jl),ii2(jl),ii3(jl))
515 zqgt(jl) = pqgt(ii1(jl),ii2(jl),ii3(jl))
516 IF (krr == 7) zqht(jl) = pqht(ii1(jl),ii2(jl),ii3(jl))
517 !
518 zqpis(jl) = pqpis(ii1(jl), ii2(jl), ii3(jl))
519 zqnis(jl) = pqnis(ii1(jl), ii2(jl), ii3(jl))
520 zqcs(jl) = pqcs(ii1(jl), ii2(jl), ii3(jl))
521 zqrs(jl) = pqrs(ii1(jl), ii2(jl), ii3(jl))
522 zqis(jl) = pqis(ii1(jl), ii2(jl), ii3(jl))
523 zqss(jl) = pqss(ii1(jl), ii2(jl), ii3(jl))
524 zqgs(jl) = pqgs(ii1(jl), ii2(jl), ii3(jl))
525 IF (krr == 7) zqhs(jl) = pqhs(ii1(jl), ii2(jl), ii3(jl))
526 !
527 IF (linductive) zefieldw(jl) = xefieldw(ii1(jl), ii2(jl), ii3(jl))
528 !
529 ! microphysical tendencies
530 zrvheni(jl) = prvheni(ii1(jl), ii2(jl), ii3(jl))
531 zrrhong(jl) = prrhong(ii1(jl), ii2(jl), ii3(jl))
532 zrimltc(jl) = primltc(ii1(jl), ii2(jl), ii3(jl))
533 zrchoni(jl) = prchoni(ii1(jl), ii2(jl), ii3(jl))
534 zrvdeps(jl) = prvdeps(ii1(jl), ii2(jl), ii3(jl))
535 zriaggs(jl) = priaggs(ii1(jl), ii2(jl), ii3(jl))
536 zriauts(jl) = priauts(ii1(jl), ii2(jl), ii3(jl))
537 zrvdepg(jl) = prvdepg(ii1(jl), ii2(jl), ii3(jl))
538 zrcautr(jl) = prcautr(ii1(jl), ii2(jl), ii3(jl))
539 zrcaccr(jl) = prcaccr(ii1(jl), ii2(jl), ii3(jl))
540 zrrevav(jl) = prrevav(ii1(jl), ii2(jl), ii3(jl))
541 zrcrimss(jl) = prcrimss(ii1(jl), ii2(jl), ii3(jl))
542 zrcrimsg(jl) = prcrimsg(ii1(jl), ii2(jl), ii3(jl))
543 zrsrimcg(jl) = prsrimcg(ii1(jl), ii2(jl), ii3(jl))
544 zrraccss(jl) = prraccss(ii1(jl), ii2(jl), ii3(jl))
545 zrraccsg(jl) = prraccsg(ii1(jl), ii2(jl), ii3(jl))
546 zrsaccrg(jl) = prsaccrg(ii1(jl), ii2(jl), ii3(jl))
547 zrsmltg(jl) = prsmltg(ii1(jl), ii2(jl), ii3(jl))
548 zricfrrg(jl) = pricfrrg(ii1(jl), ii2(jl), ii3(jl))
549 zrrcfrig(jl) = prrcfrig(ii1(jl), ii2(jl), ii3(jl))
550 zrcwetg(jl) = prcwetg(ii1(jl), ii2(jl), ii3(jl))
551 zriwetg(jl) = priwetg(ii1(jl), ii2(jl), ii3(jl))
552 zrrwetg(jl) = prrwetg(ii1(jl), ii2(jl), ii3(jl))
553 zrswetg(jl) = prswetg(ii1(jl), ii2(jl), ii3(jl))
554 zrcdryg(jl) = prcdryg(ii1(jl), ii2(jl), ii3(jl))
555 zridryg(jl) = pridryg(ii1(jl), ii2(jl), ii3(jl))
556 zrrdryg(jl) = prrdryg(ii1(jl), ii2(jl), ii3(jl))
557 zrsdryg(jl) = prsdryg(ii1(jl), ii2(jl), ii3(jl))
558 zrgmltr(jl) = prgmltr(ii1(jl), ii2(jl), ii3(jl))
559 zrcberi(jl) = prcberi(ii1(jl), ii2(jl), ii3(jl))
560 IF (hcloud(1:3) == 'ICE') THEN
561 zrcmltsr(jl) = prcmltsr(ii1(jl), ii2(jl), ii3(jl))
562 zricfrr(jl) = pricfrr(ii1(jl), ii2(jl), ii3(jl))
563 END IF
564 IF (hcloud == 'LIMA') THEN
565 zcst(jl) = pcst(ii1(jl), ii2(jl), ii3(jl))
566 zcgt(jl) = pcgt(ii1(jl), ii2(jl), ii3(jl))
567 zrvhenc(jl) = prvhenc(ii1(jl), ii2(jl), ii3(jl))
568 zrchinc(jl) = prchinc(ii1(jl), ii2(jl), ii3(jl))
569 zrvhonh(jl) = prvhonh(ii1(jl), ii2(jl), ii3(jl))
570 zrrcvrc(jl) = prrcvrc(ii1(jl), ii2(jl), ii3(jl))
571 zricnvi(jl) = pricnvi(ii1(jl), ii2(jl), ii3(jl))
572 zrvdepi(jl) = prvdepi(ii1(jl), ii2(jl), ii3(jl))
573 zrshmsi(jl) = prshmsi(ii1(jl), ii2(jl), ii3(jl))
574 zrghmgi(jl) = prghmgi(ii1(jl), ii2(jl), ii3(jl))
575 zricibu(jl) = pricibu(ii1(jl), ii2(jl), ii3(jl))
576 zrirdsf(jl) = prirdsf(ii1(jl), ii2(jl), ii3(jl))
577 zrccorr2(jl) = prccorr2(ii1(jl), ii2(jl), ii3(jl))
578 zrrcorr2(jl) = prrcorr2(ii1(jl), ii2(jl), ii3(jl))
579 zricorr2(jl) = pricorr2(ii1(jl), ii2(jl), ii3(jl))
580 END IF
581 IF (krr == 7) THEN
582 zcht(jl) = pcht(ii1(jl), ii2(jl), ii3(jl))
583 zrwetgh(jl) = prwetgh(ii1(jl), ii2(jl), ii3(jl))
584 zrcweth(jl) = prcweth(ii1(jl), ii2(jl), ii3(jl))
585 zriweth(jl) = priweth(ii1(jl), ii2(jl), ii3(jl))
586 zrsweth(jl) = prsweth(ii1(jl), ii2(jl), ii3(jl))
587 zrgweth(jl) = prgweth(ii1(jl), ii2(jl), ii3(jl))
588 zrrweth(jl) = prrweth(ii1(jl), ii2(jl), ii3(jl))
589 zrcdryh(jl) = prcdryh(ii1(jl), ii2(jl), ii3(jl))
590 zrrdryh(jl) = prrdryh(ii1(jl), ii2(jl), ii3(jl))
591 zridryh(jl) = pridryh(ii1(jl), ii2(jl), ii3(jl))
592 zrsdryh(jl) = prsdryh(ii1(jl), ii2(jl), ii3(jl))
593 zrgdryh(jl) = prgdryh(ii1(jl), ii2(jl), ii3(jl))
594 zrhmltr(jl) = prhmltr(ii1(jl), ii2(jl), ii3(jl))
595 zrdryhg(jl) = prdryhg(ii1(jl), ii2(jl), ii3(jl))
596 END IF
597 END DO
598 !
599 zrhocor(:) = (zrho00 / zrhodref(:))**zcexvt
600!
601!
602!* 1.4 allocations for the non-inductive parameterizations
603!
604 IF (cni_charging == 'GARDI') THEN
605 ALLOCATE( zdeltalwc(kmicro) )
606 ALLOCATE( zft(kmicro) )
607 END IF
608!
609 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
610 cni_charging == 'TAKAH' .OR. &
611 cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2' .OR. &
612 cni_charging == 'TEEWC' .OR. cni_charging == 'TERAR') THEN
613 ALLOCATE( zew(kmicro) )
614 END IF
615!
616 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
617 cni_charging == 'TAKAH' .OR. cni_charging == 'TEEWC') THEN
618 ALLOCATE( zdq(kmicro) )
619 END IF
620!
621 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
622 cni_charging == 'TEEWC' ) THEN
623 ALLOCATE( zsaunsk(kmicro) )
624 ALLOCATE( zsaunim(kmicro) )
625 ALLOCATE( zsaunin(kmicro) )
626 ALLOCATE( zsaunsm(kmicro) )
627 ALLOCATE( zsaunsn(kmicro) )
628 END IF
629!
630 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
631 cni_charging == 'SAP98' .OR. &
632 cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2' .OR. &
633 cni_charging == 'TEEWC' .OR. cni_charging == 'TERAR') THEN
634 ALLOCATE( zfqiaggs(kmicro) )
635 ALLOCATE( zfqidrygbs(kmicro) )
636 ALLOCATE( zlbqsdrygb1s(kmicro) )
637 ALLOCATE( zlbqsdrygb2s(kmicro) )
638 ALLOCATE( zlbqsdrygb3s(kmicro) )
639 END IF
640!
641 IF (cni_charging == 'SAP98' .OR. cni_charging == 'TERAR' .OR. &
642 cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2') THEN
643 ALLOCATE( zrar(kmicro) )
644 ALLOCATE( zdq_is(kmicro) )
645 ALLOCATE( zdq_ig(kmicro) )
646 ALLOCATE( zdq_sg(kmicro) )
647 ALLOCATE( zsaunim_is(kmicro) )
648 ALLOCATE( zsaunin_is(kmicro) )
649 ALLOCATE( zsaunim_ig(kmicro) )
650 ALLOCATE( zsaunin_ig(kmicro) )
651 ALLOCATE( zsaunsk_sg(kmicro) )
652 ALLOCATE( zsaunsm_sg(kmicro) )
653 ALLOCATE( zsaunsn_sg(kmicro) )
654 END IF
655!
656!
657!* 1.5 select parameters between ICEx and LIMA
658!
659 ALLOCATE(zrtmin(krr))
660 IF (hcloud(1:3) == 'ICE') THEN
661! in ini_rain_ice, xrtmin is initialized with dimension 6 (hail not activated) or 7 (hail activated)
662 zrtmin(1:krr) = xrtmin_i(1:krr)
663 !
664 zalphai = xalphai_i
665 znui = xnui_i
666 zai = xai_i
667 zbi = xbi_i
668 zds = xds_i
669 zdg = xdg_i
670 zcxs = xcxs_i
671 zcxg = xcxg_i
672 !
673 zcolis = xcolis_i
674 zcolexis = xcolexis_i
675 zcolig = xcolig_i
676 zcolexig = xcolexig_i
677 zcolsg = xcolsg_i
678 zcolexsg = xcolexsg_i
679 !
680 igaminc = ngaminc_i
681 !
682 iacclbdar = nacclbdar_i
683 iacclbdas = nacclbdas_i
684 zaccintp1s = xaccintp1s_i
685 zaccintp2s = xaccintp2s_i
686 zaccintp1r = xaccintp1r_i
687 zaccintp2r = xaccintp2r_i
688 !
689 idrylbdar = ndrylbdar_i
690 idrylbdas = ndrylbdas_i
691 idrylbdag = ndrylbdag_i
692 zdryintp1r = xdryintp1r_i
693 zdryintp2r = xdryintp2r_i
694 zdryintp1s = xdryintp1s_i
695 zdryintp2s = xdryintp2s_i
696 zdryintp1g = xdryintp1g_i
697 zdryintp2g = xdryintp2g_i
698 !
699 zrimintp1 = xrimintp1_i
700 zrimintp2 = xrimintp2_i
701 !
702 ELSE IF (hcloud == 'LIMA') THEN
703! in ini_lima, xrtmin is initialized with dimension 7
704 zrtmin(1:krr) = xrtmin_l(1:krr)
705 !
706 zalphai = xalphai_l
707 znui = xnui_l
708 zai = xai_l
709 zbi = xbi_l
710 zds = xds_l
711 zdg = xdg_l
712 zcxs = xcxs_l
713 zcxg = xcxg_l
714 !
715 zcolis = xcolis_l
716 zcolexis = xcolexis_l
717 zcolig = xcolig_l
718 zcolexig = xcolexig_l
719 zcolsg = xcolsg_l
720 zcolexsg = xcolexsg_l
721 !
722 igaminc = ngaminc_l
723 !
724 iacclbdar = nacclbdar_l
725 iacclbdas = nacclbdas_l
726 zaccintp1s = xaccintp1s_l
727 zaccintp2s = xaccintp2s_l
728 zaccintp1r = xaccintp1r_l
729 zaccintp2r = xaccintp2r_l
730 !
731 idrylbdar = ndrylbdar_l
732 idrylbdas = ndrylbdas_l
733 idrylbdag = ndrylbdag_l
734 zdryintp1r = xdryintp1r_l
735 zdryintp2r = xdryintp2r_l
736 zdryintp1s = xdryintp1s_l
737 zdryintp2s = xdryintp2s_l
738 zdryintp1g = xdryintp1g_l
739 zdryintp2g = xdryintp2g_l
740 !
741 zrimintp1 = xrimintp1_l
742 zrimintp2 = xrimintp2_l
743 END IF
744!
745!
746!* 1.6 update the slope parameter of the distribution
747!* and compute N_x if necessary
748!
749 IF (hcloud(1:3) == 'ICE') zcct(:) = 0.
750 CALL compute_lambda(2, imom_c, kmicro, hcloud, zrhodref, zrtmin(2), zrct, zcct, zlbdac)
751 CALL compute_lambda(3, imom_r, kmicro, hcloud, zrhodref, zrtmin(3), zrrt, zcrt, zlbdar)
752 CALL compute_lambda(4, imom_i, kmicro, hcloud, zrhodref, zrtmin(4), zrit, zcit, zlbdai)
753 CALL compute_lambda(5, imom_s, kmicro, hcloud, zrhodref, zrtmin(5), zrst, zcst, zlbdas)
754 CALL compute_lambda(6, imom_g, kmicro, hcloud, zrhodref, zrtmin(6), zrgt, zcgt, zlbdag)
755 IF (krr == 7) CALL compute_lambda(7, imom_h, kmicro, hcloud, zrhodref, zrtmin(7), zrht, zcht, zlbdah)
756!
757!
758!* 1.7 update the parameter e in the charge-diameter relationship
759!
760! Compute e_x at time t
761 IF (hcloud == 'LIMA') THEN
762 CALL elec_compute_ex(2, imom_c, kmicro, hcloud, 1., zrhodref, zrtmin(2), zrct, zqct, zect, plbdx=zlbdac, pcx=zcct)
763 CALL elec_compute_ex(3, imom_r, kmicro, hcloud, 1., zrhodref, zrtmin(3), zrrt, zqrt, zert, plbdx=zlbdar, pcx=zcrt)
764 CALL elec_compute_ex(4, imom_i, kmicro, hcloud, 1., zrhodref, zrtmin(4), zrit, zqit, zeit, plbdx=zlbdai, pcx=zcit)
765 CALL elec_compute_ex(5, imom_s, kmicro, hcloud, 1., zrhodref, zrtmin(5), zrst, zqst, zest, plbdx=zlbdas, pcx=zcst)
766 CALL elec_compute_ex(6, imom_g, kmicro, hcloud, 1., zrhodref, zrtmin(6), zrgt, zqgt, zegt, plbdx=zlbdag, pcx=zcgt)
767 IF (krr == 7) CALL elec_compute_ex(7, imom_h, kmicro, hcloud, 1., zrhodref, zrtmin(7), zrht, zqht, zeht, plbdx=zlbdah, pcx=zcht)
768 ELSE IF (hcloud(1:3) == 'ICE') THEN
769 CALL elec_compute_ex(2, 1, kmicro, hcloud, 1., zrhodref, zrtmin(2), zrct, zqct, zect)
770 CALL elec_compute_ex(3, 1, kmicro, hcloud, 1., zrhodref, zrtmin(3), zrrt, zqrt, zert, plbdx=zlbdar)
771 CALL elec_compute_ex(4, 1, kmicro, hcloud, 1., zrhodref, zrtmin(4), zrit, zqit, zeit, pcx=zcit)
772 CALL elec_compute_ex(5, 1, kmicro, hcloud, 1., zrhodref, zrtmin(5), zrst, zqst, zest, plbdx=zlbdas)
773 CALL elec_compute_ex(6, 1, kmicro, hcloud, 1., zrhodref, zrtmin(6), zrgt, zqgt, zegt, plbdx=zlbdag)
774 IF (krr == 7) CALL elec_compute_ex(7, 1, kmicro, hcloud, 1., zrhodref, zrtmin(7), zrht, zqht, zeht, plbdx=zlbdah)
775 END IF
776!
777!
778!* 1.8 initialization for the non-inductive charging process
779!
780 SELECT CASE (cni_charging)
781 ! Initialization for the parameterization of Gardiner et al. (1995)
782 CASE ('GARDI')
784 ! Save the effective water content
785 DO jl = 1, kmicro
786 xew(ii1(jl),ii2(jl),ii3(jl)) = zdeltalwc(jl) !
787 END DO
788 !
789 ! Initialization for the parameterizations of Saunders et al. (1991)
790 ! with and without anomalies, and Tsenova and Mitzeva (2009)
791 CASE ('SAUN1', 'SAUN2', 'TEEWC')
792 CALL elec_init_noind_ewc()
793 ! Save the effective water content
794 DO jl = 1, kmicro
795 xew(ii1(jl),ii2(jl),ii3(jl)) = zew(jl) ! g/m3
796 END DO
797 !
798 ! Initialization for the parameterizations of Saunders and Peck (1998),
799 ! Brooks et al. (1997) and Tsenova and Mitzeva (2011)
800 CASE ('SAP98', 'BSMP1', 'BSMP2', 'TERAR')
801 CALL elec_init_noind_rar()
802 ! Save the rime accretion rate (not recorded properly: 3 different RAR are computed !!!)
803 DO jl = 1, kmicro
804 xew(ii1(jl),ii2(jl),ii3(jl)) = zrar(jl) ! g/m3
805 END DO
806 !
807 ! Initialization for the parameterization of Takahashi (1978)
808 CASE ('TAKAH')
809 CALL elec_init_noind_takah()
810 ! Save the effective water content
811 DO jl = 1, kmicro
812 xew(ii1(jl),ii2(jl),ii3(jl)) = zew(jl) ! g/m3
813 END DO
814 END SELECT
815!
816!
817!------------------------------------------------------------------
818!
819!* 2. COMPUTE THE SLOW COLD PROCESS SOURCES
820! -------------------------------------
821!
822!* 2.1 heterogeneous nucleation
823!
824! --> rien n'est fait pour l'elec pour le moment
825! ICE3/4 : rvheni/rvhind
826! LIMA : rvhenc, rchinc, rvhonh
827!
828!
829!* 2.2 spontaneous freezing (rhong)
830!
831 if ( buconf%LBUDGET_SV ) then
832 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%INIT_PHY(d, 'SFR', &
833 unpack( zqrs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
834 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%INIT_PHY(d, 'SFR', &
835 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
836 end if
837!
838 zwq(:) = 0.
839 WHERE (zrrhong(:) > 0. .AND. &
840 zrrt(:) > xrtmin_elec(3) .AND. abs(zqrt(:)) > xqtmin(3))
841 zwq(:) = zqrs(:)
842 !
843 zqgs(:) = zqgs(:) + zqrs(:)
844 zqrs(:) = 0.
845 END WHERE
846!
847 if ( buconf%LBUDGET_SV ) then
848 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%END_PHY(d, 'SFR', &
849 unpack( zqrs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
850 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%END_PHY(d, 'SFR', &
851 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
852 end if
853!
854!
855!* 2.3 cloud ice melting (rimltc)
856!
857 if ( buconf%LBUDGET_SV ) then
858 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%INIT_PHY(d, 'IMLT', &
859 unpack( zqcs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
860 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%INIT_PHY(d, 'IMLT', &
861 unpack( zqis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
862 end if
863!
864 WHERE (zrimltc(:) > 0.)
865 zqcs(:) = zqcs(:) + zqis(:)
866 zqis(:) = 0.
867 END WHERE
868!
869 if ( buconf%LBUDGET_SV ) then
870 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%END_PHY(d, 'IMLT', &
871 unpack( zqcs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
872 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%END_PHY(d, 'IMLT', &
873 unpack( zqis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
874 end if
875!
876!
877!* 2.4 riming-conversion of the large sized aggregates into graupel ???
878! ancienne param => on calcule plutot cette tendance un peu plus loin ?
879!
880!
881!* 2.5 homogeneous nucleation (rchoni)
882!
883! CB : traitement different entre ice3 et lima --> a modifier eventuellement
884!
885 zwq(:) = 0.
886 WHERE (zrchoni(:) > 0. .AND. &
887 zrct(:) > xrtmin_elec(2) .AND. &
888 abs(zqct(:)) > xqtmin(2) .AND. abs(zect(:)) > elecp%XECMIN)
889 zwq(:) = xqhon * zect(:) * zrchoni(:)
890 zwq(:) = sign( min( abs(zqct(:)/ptstep),abs(zwq(:)) ),zqcs(:) )
891 !
892 zqis(:) = zqis(:) + zwq(:)
893 zqcs(:) = zqcs(:) - zwq(:)
894 END WHERE
895!
896 if ( buconf%LBUDGET_SV ) then
897 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'HON', &
898 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
899 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'HON', &
900 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
901 end if
902!
903!
904!* 2.6 deposition on snow/aggregates (rvdeps)
905!
906 if ( buconf%LBUDGET_SV ) then
907 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%INIT_PHY(d, 'DEPS', &
908 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
909 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%INIT_PHY(d, 'DEPS', &
910 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
911 end if
912!
913 zwq(:) = 0.
914 !
915 ! Only the sublimation of snow/aggregates is considered (negative part of PRVDEPS)
916 WHERE (zrvdeps(:) < 0. .AND. &
917 zrst(:) > xrtmin_elec(5) .AND. abs(zqst(:)) > xqtmin(5))
918 zwq(:) = xcoef_rq_s * zqst(:) * zrvdeps(:) / zrst(:)
919 zwq(:) = sign( min( abs(zqst(:)/ptstep),abs(zwq(:)) ),zqss(:) )
920 !
921 zqss(:) = zqss(:) - zwq(:)
922 zqpis(:) = zqpis(:) + max( 0.0,zwq(:)/elecd%XECHARGE )
923 zqnis(:) = zqnis(:) - min( 0.0,zwq(:)/elecd%XECHARGE )
924 END WHERE
925!
926 if ( buconf%LBUDGET_SV ) then
927 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%END_PHY(d, 'DEPS', &
928 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
929 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%END_PHY(d, 'DEPS', &
930 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
931 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'DEPS', &
932 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
933 end if
934!
935!
936!* 2.7 aggregation on snow/aggregates (riaggs)
937!
938 CALL compute_charge_transfer (zriaggs, zrit, zqit, ptstep, &
939 xrtmin_elec(4), xqtmin(4), xcoef_rq_i, &
940 zwq, zqis, zqss)
941!
942 if ( buconf%LBUDGET_SV ) then
943 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'AGGS', &
944 unpack( -zwq(:), mask = odmicro(:, :, :), field = 0. ) )
945 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'AGGS', &
946 unpack( zwq(:), mask = odmicro(:, :, :), field = 0. ) )
947 end if
948!
949!
950!* 2.8 non-inductive charging during ice - snow collisions
951!
952 CALL elec_iaggs_b()
953!
954 if ( buconf%LBUDGET_SV ) then
955 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'NIIS', &
956 unpack( -zwq_ni(:), mask = odmicro(:, :, :), field = 0. ) )
957 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'NIIS', &
958 unpack( zwq_ni(:), mask = odmicro(:, :, :), field = 0. ) )
959 end if
960!
961! Save the NI charging rate
962 DO jl = 1, kmicro
963 xni_iaggs(ii1(jl),ii2(jl),ii3(jl)) = zwq_ni(jl) * zrhodref(jl) ! C/m3/s
964 END DO
965!
966!
967!* 2.9 autoconversion of r_i for r_s production (riauts/ricnvs)
968!
969 CALL compute_charge_transfer (zriauts, zrit, zqit, ptstep, &
970 xrtmin_elec(4), xqtmin(4), xcoef_rq_i, &
971 zwq, zqis, zqss)
972!
973 if ( buconf%LBUDGET_SV ) then
974 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'AUTS', &
975 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
976 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'AUTS', &
977 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
978 end if
979!
980!
981!* 2.10 snow --> ice conversion (rscnvi)
982!
983 IF (hcloud == 'LIMA') THEN
984 CALL compute_charge_transfer (zricnvi, zrst, zqst, ptstep, &
985 xrtmin_elec(5), xqtmin(5), xcoef_rq_s, &
986 zwq, zqss, zqis)
987!
988 if ( buconf%LBUDGET_SV ) then
989 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'CNVI', &
990 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
991 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'CNVI', &
992 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
993 end if
994!
995!* 2.11 water vapor deposition on ice crystals (rvdepi)
996!
997 if ( buconf%LBUDGET_SV ) then
998 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%INIT_PHY(d, 'SUBI', &
999 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1000 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%INIT_PHY(d, 'SUBI', &
1001 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1002 end if
1003 !
1004 zwq(:) = 0.
1005 !
1006 ! Only the sublimation of ice crystals is considered (negative part of PRVDEPI)
1007 WHERE (zrvdepi(:) < 0. .AND. &
1008 zrit(:) > xrtmin_elec(4) .AND. abs(zqit(:)) > xqtmin(4))
1009 zwq(:) = xcoef_rq_i * zqit(:) * zrvdepi(:) / zrit(:)
1010 zwq(:) = sign( min( abs(zqit(:)/ptstep),abs(zwq(:)) ),zqis(:) )
1011 !
1012 zqis(:) = zqis(:) - zwq(:)
1013 zqpis(:) = zqpis(:) + max( 0.0,zwq(:)/elecd%XECHARGE )
1014 zqnis(:) = zqnis(:) - min( 0.0,zwq(:)/elecd%XECHARGE )
1015 END WHERE
1016!
1017 if ( buconf%LBUDGET_SV ) then
1018 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%END_PHY(d, 'SUBI', &
1019 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1020 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%END_PHY(d, 'SUBI', &
1021 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1022 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'SUBI', &
1023 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1024 end if
1025 END IF
1026!
1027!
1028!* 2.12 water vapor deposition on graupel (rvdepg)
1029!
1030 if ( buconf%LBUDGET_SV ) then
1031 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%INIT_PHY(d, 'DEPG', &
1032 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1033 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%INIT_PHY(d, 'DEPG', &
1034 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1035 end if
1036!
1037 zwq(:) = 0.
1038 !
1039 ! Only the sublimation of graupel is considered (negative part of PRVDEPG)
1040 WHERE (zrvdepg(:) < 0. .AND. &
1041 zrgt(:) > xrtmin_elec(6) .AND. abs(zqgt(:)) > xqtmin(6))
1042 zwq(:) = xcoef_rq_g * zqgt(:) * zrvdepg(:) / zrgt(:)
1043 zwq(:) = sign( min( abs(zqgt(:)/ptstep),abs(zwq(:)) ),zqgs(:) )
1044 !
1045 zqgs(:) = zqgs(:) - zwq(:)
1046 zqpis(:) = zqpis(:) + max( 0.0,zwq(:)/elecd%XECHARGE )
1047 zqnis(:) = zqnis(:) - min( 0.0,zwq(:)/elecd%XECHARGE )
1048 END WHERE
1049!
1050 if ( buconf%LBUDGET_SV ) then
1051 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%END_PHY(d, 'DEPG', &
1052 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1053 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%END_PHY(d, 'DEPG', &
1054 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1055 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'DEPG', &
1056 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1057 end if
1058!
1059!
1060!------------------------------------------------------------------
1061!
1062!* 3. COMPUTE THE WARM PROCESS SOURCES
1063! --------------------------------
1064!
1065!* 3.1 autoconversion of r_c for r_r production (rcautr)
1066!
1067 CALL compute_charge_transfer (zrcautr, zrct, zqct, ptstep, &
1068 xrtmin_elec(2), xqtmin(2), xcoef_rq_c, &
1069 zwq, zqcs, zqrs)
1070!
1071 if ( buconf%LBUDGET_SV ) then
1072 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'AUTO', &
1073 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1074 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'AUTO', &
1075 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1076 end if
1077!
1078!
1079!* 3.2 accretion of r_c for r_r production (rcaccr)
1080!
1081 CALL compute_charge_transfer (zrcaccr, zrct, zqct, ptstep, &
1082 xrtmin_elec(2), xqtmin(2), xcoef_rq_c, &
1083 zwq, zqcs, zqrs)
1084!
1085 if ( buconf%LBUDGET_SV ) then
1086 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'ACCR', &
1087 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1088 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'ACCR', &
1089 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1090 end if
1091!
1092!
1093!* 3.3 evaporation of raindrops (rrevav)
1094!
1095 if ( buconf%LBUDGET_SV ) then
1096 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%INIT_PHY(d, 'REVA', &
1097 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1098 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%INIT_PHY(d, 'REVA', &
1099 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1100 end if
1101!
1102 zwq(:) = 0.
1103 WHERE (zrrevav(:) > 0. .AND. &
1104 zrrt(:) > xrtmin_elec(3) .AND. abs(zqrt(:)) > xqtmin(3))
1105 zwq(:) = xcoef_rq_r * zqrt(:) * zrrevav(:) / zrrt(:)
1106 zwq(:) = sign( min( abs(zqrt(:)/ptstep),abs(zwq(:)) ),zqrs(:) )
1107 !
1108 zqrs(:) = zqrs(:) - zwq(:)
1109 zqpis(:) = zqpis(:) + max( 0.0,zwq(:)/elecd%XECHARGE )
1110 zqnis(:) = zqnis(:) - min( 0.0,zwq(:)/elecd%XECHARGE )
1111 END WHERE
1112!
1113 if ( buconf%LBUDGET_SV ) then
1114 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%END_PHY(d, 'REVA', &
1115 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1116 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%END_PHY(d, 'REVA', &
1117 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1118 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'REVA', &
1119 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1120 end if
1121!
1122!
1123!* 3.4 conversion of drops to droplets (rrcvrc)
1124!
1125 IF (hcloud == 'LIMA') THEN
1126 if ( buconf%LBUDGET_SV ) then
1127 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%INIT_PHY(d, 'R2C1', &
1128 unpack( zqcs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1129 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%INIT_PHY(d, 'R2C1', &
1130 unpack( zqrs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1131 end if
1132!
1133 CALL compute_charge_transfer (zrrcvrc, zrrt, zqrt, ptstep, &
1134 xrtmin_elec(3), xqtmin(3), xcoef_rq_r, &
1135 zwq, zqrs, zqcs)
1136!
1137 if ( buconf%LBUDGET_SV ) then
1138 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%END_PHY(d, 'R2C1', &
1139 unpack( zqcs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1140 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%END_PHY(d, 'R2C1', &
1141 unpack( zqrs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1142 end if
1143 END IF
1144!
1145!------------------------------------------------------------------
1146!
1147!* 4. COMPUTE THE FAST COLD PROCESS SOURCES FOR r_s
1148! ---------------------------------------------
1149!
1150!* 4.1 cloud droplet riming of the aggregates
1151!
1152 if ( buconf%LBUDGET_SV ) then
1153 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%INIT_PHY(d, 'RIM', &
1154 unpack( zqcs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1155 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%INIT_PHY(d, 'RIM', &
1156 unpack( zqss(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1157 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%INIT_PHY(d, 'RIM', &
1158 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1159 end if
1160!
1161!* 4.1.1 riming of the small sized aggregates (rcrimss)
1162!
1163 CALL compute_charge_transfer (zrcrimss, zrct, zqct, ptstep, &
1164 xrtmin_elec(2), xqtmin(2), xcoef_rq_c, &
1165 zwq, zqcs, zqss)
1166!
1167!
1168!* 4.1.2 riming conversion of the large sized aggregates into graupel (rcrimsg)
1169!
1170 zwq(:) = 0.
1171 WHERE (zrcrimsg(:) > 0. .AND. &
1172 zrct(:) > xrtmin_elec(2) .AND. zrst(:) > xrtmin_elec(5) .AND. &
1173 abs(zqct(:)) > xqtmin(2))
1174 zwq(:) = xcoef_rq_c * zqct(:) * zrcrimsg(:) / zrct(:) ! QCRIMSG
1175 zwq(:) = sign( min( abs(zqct(:)/ptstep),abs(zwq(:)) ),zqcs(:) )
1176 !
1177 zqgs(:) = zqgs(:) + zwq(:)
1178 zqcs(:) = zqcs(:) - zwq(:)
1179 END WHERE
1180!
1181!
1182!* 4.1.3 riming conversion of the large sized aggregates into graupel (rsrimcg)
1183!
1184 gmask(:) = .false.
1185 igmask = 0
1186 DO jl = 1, SIZE(gmask)
1187 IF (zrsrimcg(jl) > 0. .AND. zzt(jl) < cst%XTT .AND. &
1188 zrct(jl) > xrtmin_elec(2) .AND. zrst(jl) > xrtmin_elec(5) .AND. &
1189 zlbdas(jl) > 0.) THEN !++cb-- 12/07/23 condition ajoutee pour eviter log(0)
1190 igmask = igmask + 1
1191 i1(igmask) = jl
1192 gmask(jl) = .true.
1193 ELSE
1194 gmask(jl) = .false.
1195 END IF
1196 END DO
1197 !
1198 ALLOCATE(zvec1(igmask))
1199 ALLOCATE(zvec2(igmask))
1200 ALLOCATE(ivec2(igmask))
1201 !
1202 ! select the ZLBDAS
1203 DO jl = 1, igmask
1204 zvec1(jl) = zlbdas(i1(jl))
1205 END DO
1206 ! find the next lower indice for the ZLBDAS in the geometrical set of Lbda_s
1207 ! used to tabulate some moments of the incomplete gamma function
1208 zvec2(1:igmask) = max( 1.00001, min( real(igaminc)-0.00001, &
1209 zrimintp1 * log( zvec1(1:igmask) ) + zrimintp2 ) )
1210 ivec2(1:igmask) = int( zvec2(1:igmask) )
1211 zvec2(1:igmask) = zvec2(1:igmask) - real( ivec2(1:igmask) )
1212 !
1213 ! perform the linear interpolation of the normalized "XFS"-moment of
1214 ! the incomplete gamma function
1215 zvec1(1:igmask) = xgaminc_rim3( ivec2(1:igmask)+1 ) * zvec2(1:igmask) &
1216 - xgaminc_rim3( ivec2(1:igmask) ) * (zvec2(1:igmask) - 1.0)
1217 !
1218 zwq(:) = 0.
1219 DO jl = 1, igmask
1220 zwq(i1(jl)) = zvec1(jl)
1221 END DO
1222 !
1223 DEALLOCATE(zvec1)
1224 DEALLOCATE(zvec2)
1225 DEALLOCATE(ivec2)
1226 !
1227 ! riming-conversion of the large sized aggregates into graupeln (rsrimcg)
1228 WHERE (zrsrimcg(:) > 0. .AND. &
1229 zrct(:) > xrtmin_elec(2) .AND. zrst(:) > xrtmin_elec(5) .AND. &
1230 abs(zqct(:)) > xqtmin(2) .AND. abs(zest(:)) > xesmin)
1231 zwq(:) = xqsrimcg * zest(:) * zcst(:) * & ! QSRIMCG
1232 zlbdas(:)**xexqsrimcg * (1. - zwq(:)) / &
1233 (ptstep * zrhodref(:))
1234 zwq(:) = sign( min( abs(zqst(:)/ptstep),abs(zwq(:)) ),zqss(:) )
1235 !
1236 zqgs(:) = zqgs(:) + zwq(:)
1237 zqss(:) = zqss(:) - zwq(:)
1238 END WHERE
1239!
1240 if ( buconf%LBUDGET_SV ) then
1241 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%END_PHY(d, 'RIM', &
1242 unpack( zqcs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1243 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%END_PHY(d, 'RIM', &
1244 unpack( zqss(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1245 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%END_PHY(d, 'RIM', &
1246 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1247 end if
1248!
1249!
1250!* 4.2 Hallett-Mossop ice multiplication process due to snow riming (rhmsi)
1251!
1252 IF (hcloud == 'LIMA') THEN
1253 CALL compute_charge_transfer (zrshmsi, zrst, zqst, ptstep, &
1254 xrtmin_elec(4), xqtmin(4), xcoef_rq_s, &
1255 zwq, zqss, zqis)
1256!
1257 if ( buconf%LBUDGET_SV ) then
1258 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'HMS', &
1259 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1260 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'HMS', &
1261 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1262 end if
1263 END IF
1264!
1265!
1266!* 4.3 Raindrop accretion onto the aggregates
1267!
1268 igmask = 0
1269 DO jl = 1, SIZE(gmask)
1270 IF (zrrt(jl) > zrtmin(3) .AND. zlbdar(jl) > 0. .AND. &
1271 zrst(jl) > zrtmin(5) .AND. zlbdas(jl) > 0.) THEN
1272 igmask = igmask + 1
1273 i1(igmask) = jl
1274 gmask(jl) = .true.
1275 ELSE
1276 gmask(jl) = .false.
1277 END IF
1278 END DO
1279 !
1280 IF (igmask > 0) THEN
1281 ALLOCATE(zvec1(igmask))
1282 ALLOCATE(zvec2(igmask))
1283 ALLOCATE(ivec1(igmask))
1284 ALLOCATE(ivec2(igmask))
1285 ALLOCATE(zvecq1(igmask))
1286 ALLOCATE(zvecq2(igmask))
1287 ALLOCATE(zvecq3(igmask))
1288 !
1289 ! select the (ZLBDAS,ZLBDAR) couplet
1290 DO jl = 1, igmask
1291 zvec1(jl) = zlbdas(i1(jl))
1292 zvec2(jl) = zlbdar(i1(jl))
1293 END DO
1294 !
1295 ! find the next lower indice for the ZLBDAS and for the ZLBDAR in the geometrical
1296 ! set of (Lbda_s,Lbda_r) couplet use to tabulate the kernels
1297 zvec1(1:igmask) = max( 1.00001, min( real(iacclbdas)-0.00001, &
1298 zaccintp1s * log( zvec1(1:igmask) ) + zaccintp2s ) )
1299 ivec1(1:igmask) = int( zvec1(1:igmask) )
1300 zvec1(1:igmask) = zvec1(1:igmask) - real( ivec1(1:igmask) )
1301 !
1302 zvec2(1:igmask) = max( 1.00001, min( real(iacclbdar)-0.00001, &
1303 zaccintp1r * log( zvec2(1:igmask) ) + zaccintp2r ) )
1304 ivec2(1:igmask) = int( zvec2(1:igmask) )
1305 zvec2(1:igmask) = zvec2(1:igmask) - real( ivec2(1:igmask) )
1306 !
1307 ! perform the bilinear interpolation of the normalized kernels
1308 zvecq1(:) = bi_lin_intp_v(xker_q_raccss, ivec1, ivec2, zvec1, zvec2, igmask)
1309 zvecq2(:) = bi_lin_intp_v(xker_q_raccs, ivec1, ivec2, zvec1, zvec2, igmask)
1310 zvecq3(:) = bi_lin_intp_v(xker_q_saccrg, ivec1, ivec2, zvec1, zvec2, igmask)
1311 zwq1(:) = 0.
1312 zwq2(:) = 0.
1313 zwq3(:) = 0.
1314 DO jl = 1, igmask
1315 zwq1(i1(jl)) = zvecq1(jl)
1316 zwq2(i1(jl)) = zvecq2(jl)
1317 zwq3(i1(jl)) = zvecq3(jl)
1318 END DO
1319!
1320 DEALLOCATE(zvec1)
1321 DEALLOCATE(zvec2)
1322 DEALLOCATE(ivec1)
1323 DEALLOCATE(ivec2)
1324 DEALLOCATE(zvecq1)
1325 DEALLOCATE(zvecq2)
1326 DEALLOCATE(zvecq3)
1327!
1328!
1329!* 4.3.1 raindrop accretion onto the small sized aggregates (rraccss)
1330!
1331 zwq4(:) = 0.
1332 zwq5(:,:) = 0.
1333 WHERE (zrraccss(:) > 0. .AND. &
1334 zrrt(:) > xrtmin_elec(3) .AND. zrst(:) > xrtmin_elec(5) .AND. &
1335 zcrt(:) > 0. .AND. zcst(:) > 0. .AND. &
1336 zlbdar(:) > 0. .AND. zlbdas(:) > 0. .AND. &
1337 abs(zert(:)) > elecp%XERMIN) ! and zzt(:) < xtt ?
1338 zwq4(:) = xfqraccs * zert(:) * zrhocor(:) / (zcor00 * zrhodref(:)) * &
1339 zcrt(:) * zcst(:) * &
1340 (xlbqraccs1 * zlbdar(:)**(-2.0 - xfr) + &
1341 xlbqraccs2 * zlbdar(:)**(-1.0 - xfr) * zlbdas(:)**(-1.0) + &
1342 xlbqraccs3 * zlbdar(:)**(-xfr) * zlbdas(:)**(-2.0))
1343 zwq5(:,1) = zwq4(:) * zwq1(:) ! QRACCSS
1344 zwq5(:,1) = sign( min( abs(zqrt(:)/ptstep),abs(zwq5(:,1)) ),zqrs(:) )
1345 !
1346 zqrs(:) = zqrs(:) - zwq5(:,1)
1347 zqss(:) = zqss(:) + zwq5(:,1)
1348 END WHERE
1349!
1350!
1351!* 4.3.2 raindrop accretion-conversion of the large sized aggregates into graupel
1352!* (rsaccrg & rraccsg)
1353!
1354 zwq5(:,2) = zwq2(:) * zwq4(:) ! QRACCS
1355 WHERE (zrraccsg(:) > 0. .AND. &
1356 zrrt(:) > xrtmin_elec(3) .AND. zrst(:) > xrtmin_elec(5) .AND. &
1357 zlbdar(:) > 0. .AND. zlbdas(:) > 0.)
1358 zwq5(:,3) = zwq5(:,2) - zwq5(:,1) ! QRACCSG
1359 zwq5(:,3) = sign( min( abs(zqrt(:)/ptstep),abs(zwq5(:,3)) ),zqrs(:) )
1360 !
1361 zqrs(:) = zqrs(:) - zwq5(:,3)
1362 zqgs(:) = zqgs(:) + zwq5(:,3)
1363 END WHERE
1364!
1365 WHERE (zrsaccrg(:) > 0. .AND. &
1366 zrrt(:) > xrtmin_elec(3) .AND. zrst(:) > xrtmin_elec(5) .AND. &
1367 zcrt(:) > 0. .AND. zcst(:) > 0. .AND. &
1368 zlbdar(:) > 0. .AND. zlbdas(:) > 0. .AND. &
1369 abs(zest(:)) > xesmin)
1370 zwq5(:,4) = zwq3(:) * xfqraccs * zest(:) * &
1371 zrhocor(:) / (zcor00 * zrhodref(:)) * &
1372 zcrt(:) * zcst(:) * &
1373 (xlbqsaccrg1 * zlbdas(:)**(-2.0 - xfs) + &
1374 xlbqsaccrg2 * zlbdas(:)**(-1.0 - xfs) * zlbdar(:)**(-1.0) + &
1375 xlbqsaccrg3 * zlbdas(:)**(-xfs) * zlbdar(:)**(-2.0)) ! QSACCR
1376 zwq5(:,4) = sign( min( abs(zqst(:)/ptstep),abs(zwq5(:,4)) ),zqss(:) )
1377 !
1378 zqss(:) = zqss(:) - zwq5(:,4)
1379 zqgs(:) = zqgs(:) + zwq5(:,4)
1380 END WHERE
1381 !
1382 if ( buconf%LBUDGET_SV ) then
1383 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'ACC', &
1384 unpack( (-zwq5(:,1) - zwq5(:,3)) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1385 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'ACC', &
1386 unpack( ( zwq5(:,1) - zwq5(:,4)) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1387 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'ACC', &
1388 unpack( ( zwq5(:,3) + zwq5(:,4)) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1389 end if
1390 !
1391 END IF ! end if igmask>0
1392!
1393!
1394!* 4.4 conversion-melting of the aggregates (rsmltg)
1395!
1396 CALL compute_charge_transfer (zrsmltg, zrst, zqst, ptstep, &
1397 xrtmin_elec(5), xqtmin(5), xcoef_rq_s, &
1398 zwq, zqss, zqgs)
1399!
1400 if ( buconf%LBUDGET_SV ) then
1401 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'CMEL', &
1402 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1403 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'CMEL', &
1404 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1405 end if
1406!
1407!
1408!* 4.5 cloud droplet collection onto aggregates by positive temperature (rcmltsr)
1409!
1410 IF (hcloud(1:3) == 'ICE') THEN
1411 CALL compute_charge_transfer (zrcmltsr, zrct, zqct, ptstep, &
1412 xrtmin_elec(2), xqtmin(2), xcoef_rq_c, &
1413 zwq, zqcs, zqrs)
1414!
1415 if ( buconf%LBUDGET_SV ) then
1416 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'CMEL', &
1417 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1418 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'CMEL', &
1419 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1420 end if
1421 END IF
1422!
1423!
1424!------------------------------------------------------------------
1425!
1426!* 5. COMPUTE THE FAST COLD PROCESS SOURCES FOR r_g
1427! ---------------------------------------------
1428!
1429!* 5.1 rain contact freezing (ricfrrg, rrcfrig, ricfrr)
1430!
1431 if ( buconf%LBUDGET_SV ) then
1432 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%INIT_PHY(d, 'CFRZ', &
1433 unpack( zqrs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1434 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%INIT_PHY(d, 'CFRZ', &
1435 unpack( zqis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1436 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%INIT_PHY(d, 'CFRZ', &
1437 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1438 end if
1439 !
1440 zwq(:) = 0.
1441 WHERE (zrrcfrig(:) > 0. .AND. &
1442 zrit(:) > xrtmin_elec(4) .AND. zrrt(:) > xrtmin_elec(3) .AND. &
1443 zcrt(:) > 0. .AND. &
1444 abs(zert(:)) > elecp%XERMIN .AND. abs(zqrt(:)) > xqtmin(3))
1445 zwq(:) = xqrcfrig * zlbdar(:)**xexqrcfrig * zcit(:) * zcrt(:) * &
1446 zert(:) * zrhocor(:) / (zcor00 * zrhodref(:)) ! QRCFRIG
1447 zwq(:) = sign( min( abs(zqrt(:)/ptstep),abs(zwq(:)) ),zqrs(:) )
1448 !
1449 zqgs(:) = zqgs(:) + zwq(:)
1450 zqrs(:) = zqrs(:) - zwq(:)
1451 END WHERE
1452 !
1453 zwq(:) = 0.
1454 WHERE (zricfrrg(:) > 0. .AND. &
1455 zrit(:) > xrtmin_elec(4) .AND. zrrt(:) > xrtmin_elec(3) .AND. &
1456 abs(zqit(:)) > xqtmin(4))
1457 zwq(:) = xcoef_rq_i * zqit(:) * zricfrrg(:) / zrit(:) ! QICFRRG
1458 zwq(:) = sign( min( abs(zqit(:)/ptstep),abs(zwq(:)) ),zqis(:) )
1459 !
1460 zqgs(:) = zqgs(:) + zwq(:)
1461 zqis(:) = zqis(:) - zwq(:)
1462 ENDWHERE
1463!
1464!++CB-- 16/06/2022 il manque le traitement de qricfrr
1465!
1466 if ( buconf%LBUDGET_SV ) then
1467 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%END_PHY(d, 'CFRZ', &
1468 unpack( zqrs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1469 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%END_PHY(d, 'CFRZ', &
1470 unpack( zqis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1471 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%END_PHY(d, 'CFRZ', &
1472 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1473 end if
1474!
1475!
1476!* 5.2 graupel dry growth (qcdryg, qrdryg, qidryg & qsdryg)
1477!
1478 zwq5(:,:) = 0.
1479!
1480!* 5.2.1 compute qcdryg
1481!
1482 WHERE (zrcdryg(:) > 0. .AND. &
1483 zrct(:) > xrtmin_elec(2) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
1484 abs(zqct(:)) > xqtmin(2))
1485 zwq5(:,1) = xcoef_rq_c * zqct(:) * zrcdryg(:) / zrct(:)
1486 zwq5(:,1) = sign( min( abs(zqct(:)/ptstep),abs(zwq5(:,1)) ),zqcs(:) )
1487 !
1488 zqcs(:) = zqcs(:) - zwq5(:,1)
1489 zqgs(:) = zqgs(:) + zwq5(:,1)
1490 ENDWHERE
1491!
1492!
1493!* 5.2.2 compute qidryg = qidryg_coal + qidryg_boun
1494!
1495 WHERE (zridryg(:) > 0. .AND. &
1496 zrit(:) > xrtmin_elec(4) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
1497 abs(zqit(:)) > xqtmin(4))
1498 zwq5(:,2) = xcoef_rq_i * zqit(:) * zridryg(:) / zrit(:) ! QIDRYG_coal
1499 zwq5(:,2) = sign( min( abs(zqit(:)/ptstep),abs(zwq5(:,2)) ),zqis(:) )
1500 !
1501 zqis(:) = zqis(:) - zwq5(:,2)
1502 zqgs(:) = zqgs(:) + zwq5(:,2)
1503 END WHERE
1504!
1505!
1506!* 5.2.3 compute non-inductive charging durig ice - graupel collisions
1507!
1508 ! charge separation during collision between ice and graupel
1509 CALL elec_idryg_b() ! QIDRYG_boun
1510 !
1511 if ( buconf%LBUDGET_SV ) then
1512 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'NIIG', &
1513 unpack( -zwq_ni(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1514 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'NIIG', &
1515 unpack( zwq_ni(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1516 end if
1517 !
1518 ! Save the NI charging rate
1519 DO jl = 1, kmicro
1520 xni_idryg(ii1(jl),ii2(jl),ii3(jl)) = zwq_ni(jl) * zrhodref(jl) ! C/m3/s
1521 END DO
1522!
1523!
1524!* 5.2.4 compute qsdryg
1525!
1526 igmask = 0
1527 DO jl = 1, SIZE(gmask)
1528 IF (zrst(jl) > zrtmin(5) .AND. zlbdas(jl) > 0. .AND. &
1529 zrgt(jl) > zrtmin(6) .AND. zlbdag(jl) > 0.) THEN
1530 igmask = igmask + 1
1531 i1(igmask) = jl
1532 gmask(jl) = .true.
1533 ELSE
1534 gmask(jl) = .false.
1535 END IF
1536 END DO
1537 !
1538 IF (igmask > 0) THEN
1539 !
1540 ALLOCATE(zvec1(igmask))
1541 ALLOCATE(zvec2(igmask))
1542 ALLOCATE(ivec1(igmask))
1543 ALLOCATE(ivec2(igmask))
1544 ALLOCATE(zvecq1(igmask))
1545 ALLOCATE(zvecq2(igmask))
1546 ALLOCATE(zvecq3(igmask))
1547 ALLOCATE(zvecq4(igmask))
1548 !
1549 ! select the (ZLBDAG,ZLBDAS) couplet
1550 DO jl = 1, igmask
1551 zvec1(jl) = zlbdag(i1(jl))
1552 zvec2(jl) = zlbdas(i1(jl))
1553 END DO
1554 !
1555 ! find the next lower indice for the ZLBDAG and for the ZLBDAS in the geometrical set
1556 ! of (Lbda_g,Lbda_s) couplet use to tabulate the SDRYG-kernel
1557 zvec1(1:igmask) = max(1.00001, min(real(idrylbdag)-0.00001, &
1558 zdryintp1g*log(zvec1(1:igmask))+zdryintp2g))
1559 ivec1(1:igmask) = int(zvec1(1:igmask) )
1560 zvec1(1:igmask) = zvec1(1:igmask) - real(ivec1(1:igmask))
1561 !
1562 zvec2(1:igmask) = max(1.00001, min( real(idrylbdas)-0.00001, &
1563 zdryintp1s*log(zvec2(1:igmask))+zdryintp2s))
1564 ivec2(1:igmask) = int(zvec2(1:igmask))
1565 zvec2(1:igmask) = zvec2(1:igmask) - real(ivec2(1:igmask))
1566 !
1567 ! perform the bilinear interpolation of the normalized QSDRYG-kernels
1568 ! normalized Q-SDRYG-kernel
1569 zvecq1(:) = bi_lin_intp_v(xker_q_sdryg, ivec1, ivec2, zvec1, zvec2, igmask)
1570 zwq5(:,3) = 0. ! normalement pas utile
1571 DO jl = 1, igmask
1572 zwq5(i1(jl),3) = zvecq1(jl)
1573 END DO
1574 !
1575 ! normalized Q-???-kernel
1576 IF (cni_charging == 'TAKAH' .OR. cni_charging == 'SAUN1' .OR. &
1577 cni_charging == 'SAUN2' .OR. cni_charging == 'SAP98' .OR. &
1578 cni_charging == 'GARDI' .OR. &
1579 cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2' .OR. &
1580 cni_charging == 'TEEWC' .OR. cni_charging == 'TERAR') THEN
1581 zvecq2(:) = bi_lin_intp_v(xker_q_limsg, ivec1, ivec2, zvec1, zvec2, igmask)
1582 zwq5(:,4) = 0. ! normalement pas utile
1583 DO jl = 1, igmask
1584 zwq5(i1(jl),4) = zvecq2(jl)
1585 END DO
1586 END IF
1587 !
1588 ! normalized Q-SDRYG-bouncing kernel
1589 IF (cni_charging == 'TAKAH' .OR. cni_charging == 'HELFA' .OR. &
1590 cni_charging == 'GARDI') THEN
1591 zvecq3(:) = bi_lin_intp_v(xker_q_sdrygb,ivec1,ivec2,zvec1,zvec2,igmask)
1592 zwq5(:,5) = 0. ! normalement pas utile
1593 DO jl = 1, igmask
1594 zwq5(i1(jl),5) = zvecq3(jl)
1595 END DO
1596 ELSE
1597 zvecq3(:) = bi_lin_intp_v(xker_q_sdrygb1,ivec1,ivec2,zvec1,zvec2,igmask)
1598 zvecq4(:) = bi_lin_intp_v(xker_q_sdrygb2,ivec1,ivec2,zvec1,zvec2,igmask)
1599 zwq5(:,6:7) = 0. ! normalement pas utile
1600 DO jl = 1, igmask
1601 zwq5(i1(jl),6) = zvecq3(jl) ! Dvqsgmn if charge>0
1602 zwq5(i1(jl),7) = zvecq4(jl) ! Dvqsgmn if charge<0
1603 END DO
1604 ENDIF
1605 !
1606 DEALLOCATE(zvec1)
1607 DEALLOCATE(zvec2)
1608 DEALLOCATE(ivec1)
1609 DEALLOCATE(ivec2)
1610 DEALLOCATE(zvecq1)
1611 DEALLOCATE(zvecq2)
1612 DEALLOCATE(zvecq3)
1613 DEALLOCATE(zvecq4)
1614!
1615!++CB-- CALCULER E_SG ICI POUR EVITER DES CALCULS REDONDANTS
1616 !
1617 ! compute QSDRYG_coal
1618 WHERE (zrsdryg(:) > 0 .AND. & !GDRY(:) .AND. &
1619 zrst(:) > xrtmin_elec(5) .AND. &
1620 zlbdas(:) > 0. .AND. zlbdag(:) > 0. .AND. &
1621 abs(zqst(:)) > xqtmin(5) .AND. abs(zest(:)) > xesmin)
1622 zwq5(:,3) = zwq5(:,3) * xfqsdryg * &
1623 zcolsg * exp(zcolexsg * (zzt(:) - cst%XTT)) * &
1624 zest(:) * zrhocor(:) / (zcor00 * zrhodref(:)) * &
1625 zcgt(:) * zcst(:) * &
1626 (xlbqsdryg1 * zlbdas(:)**(-2.0-xfs) + &
1627 xlbqsdryg2 * zlbdas(:)**(-1.0-xfs) * zlbdag(:)**(-1.0) + &
1628 xlbqsdryg3 * zlbdas(:)**(-xfs) * zlbdag(:)**(-2.0)) ! QSDRYG_coal
1629 zwq5(:,3) = sign( min( abs(zqst(:)/ptstep),abs(zwq5(:,3)) ),zqss(:) )
1630 !
1631 zqss(:) = zqss(:) - zwq5(:,3)
1632 zqgs(:) = zqgs(:) + zwq5(:,3)
1633 ELSEWHERE
1634 zwq5(:,3) = 0.
1635 END WHERE
1636!
1637!
1638!* 5.2.5 compute non-inductive charging during snow - graupel collisions
1639!
1640 ! compute QSDRYG_boun
1641 CALL elec_sdryg_b()
1642 !
1643 if ( buconf%LBUDGET_SV ) then
1644 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'NISG', &
1645 unpack( -zwq_ni(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1646 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'NISG', &
1647 unpack( zwq_ni(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1648 end if
1649 !
1650 ! Save the NI charging rate
1651 DO jl = 1, kmicro
1652 xni_sdryg(ii1(jl),ii2(jl),ii3(jl)) = zwq_ni(jl) * zrhodref(jl) ! C/m3/s
1653 END DO
1654 END IF ! end if igmask>0
1655!
1656!
1657!* 5.2.6 compute qrdryg
1658!
1659 igmask = 0
1660 gmask(:) = .false.
1661 DO jl = 1, SIZE(gmask)
1662 IF (zrrt(jl) > zrtmin(3) .AND. zlbdar(jl) > 0. .AND. &
1663 zrgt(jl) > zrtmin(6) .AND. zlbdag(jl) > 0.) THEN
1664 igmask = igmask + 1
1665 i1(igmask) = jl
1666 gmask(jl) = .true.
1667 ELSE
1668 gmask(jl) = .false.
1669 END IF
1670 END DO
1671 !
1672 IF (igmask > 0) THEN
1673 !
1674 ALLOCATE(zvec1(igmask))
1675 ALLOCATE(zvec2(igmask))
1676 ALLOCATE(ivec1(igmask))
1677 ALLOCATE(ivec2(igmask))
1678 ALLOCATE(zvecq1(igmask))
1679 !
1680 ! select the (ZLBDAG,ZLBDAR) couplet
1681 DO jl = 1, igmask
1682 zvec1(jl) = zlbdag(i1(jl))
1683 zvec2(jl) = zlbdar(i1(jl))
1684 END DO
1685 !
1686 ! find the next lower indice for the ZLBDAG and for the ZLBDAR in the geometrical set
1687 ! of (Lbda_g,Lbda_r) couplet use to tabulate the QDRYG-kernel
1688 zvec1(1:igmask) = max(1.00001, min( real(idrylbdag)-0.00001, &
1689 zdryintp1g*log(zvec1(1:igmask))+zdryintp2g))
1690 ivec1(1:igmask) = int(zvec1(1:igmask))
1691 zvec1(1:igmask) = zvec1(1:igmask) - real(ivec1(1:igmask))
1692 !
1693 zvec2(1:igmask) = max(1.00001, min( real(idrylbdar)-0.00001, &
1694 zdryintp1r*log(zvec2(1:igmask))+zdryintp2r))
1695 ivec2(1:igmask) = int(zvec2(1:igmask))
1696 zvec2(1:igmask) = zvec2(1:igmask) - real(ivec2(1:igmask))
1697 !
1698 ! perform the bilinear interpolation of the normalized RDRYG-kernel
1699 zvecq1(:) = bi_lin_intp_v(xker_q_rdryg, ivec1, ivec2, zvec1, zvec2, igmask)
1700 zwq5(:,4) = 0.
1701 DO jl = 1, igmask
1702 zwq5(i1(jl),4) = zvecq1(jl)
1703 END DO
1704 !
1705 DEALLOCATE(zvec1)
1706 DEALLOCATE(zvec2)
1707 DEALLOCATE(ivec1)
1708 DEALLOCATE(ivec2)
1709 DEALLOCATE(zvecq1)
1710 !
1711 ! compute QRDRYG
1712 WHERE (zrrdryg(:) > 0. .AND. &
1713 zrrt(:) > xrtmin_elec(3) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
1714 zcrt(:) > 0. .AND. zcgt(:) > 0. .AND. &
1715 zlbdar(:) > 0. .AND. zlbdag(:) > 0. .AND. &
1716 abs(zert(:)) > elecp%XERMIN .AND. abs(zqrt(:)) > xqtmin(3))
1717 zwq5(:,4) = zwq5(:,4) * xfqrdryg * &
1718 zrhodref(:)**(-zcexvt) * &
1719 zert(:) * zcgt(:) * zcrt(:) * &
1720 (xlbqrdryg1 * zlbdar(:)**(-2.0 - xfr) + &
1721 xlbqrdryg2 * zlbdar(:)**(-1.0 - xfr) * zlbdag(:)**(-1.0) + &
1722 xlbqrdryg3 * zlbdar(:)**(-xfr) * zlbdag(:)**(-2.0))
1723 zwq5(:,4) = sign( min( abs(zqrt(:)/ptstep),abs(zwq5(:,4)) ),zqrs(:) )
1724 !
1725 zqrs(:) = zqrs(:) - zwq5(:,4)
1726 zqgs(:) = zqgs(:) + zwq5(:,4)
1727 ELSEWHERE
1728 zwq5(:,4) = 0.
1729 ENDWHERE
1730! ZRDRYG(:) = ZWQ5(:,1) + ZWQ5(:,2) + ZWQ5(:,3) + ZWQ5(:,4)
1731!
1732 if ( buconf%LBUDGET_SV ) then
1733 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'DRYG', &
1734 unpack( -zwq5(:,1) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1735 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'DRYG', &
1736 unpack( -zwq5(:,4) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1737 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'DRYG', &
1738 unpack( -zwq5(:,2) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1739 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'DRYG', &
1740 unpack( -zwq5(:,3) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1741 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'DRYG', &
1742 unpack( (zwq5(:,1) + zwq5(:,2) + zwq5(:,3) + zwq5(:,4)) * zrhodj(:), &
1743 mask = odmicro(:, :, :), field = 0. ) )
1744 end if
1745!
1746 END IF ! end if igmask>0
1747!
1748!
1749!* 5.3 Hallett-Mossop ice multiplication process due to graupel riming (rhmgi)
1750!
1751 IF (hcloud == 'LIMA') THEN
1752 CALL compute_charge_transfer (zrghmgi, zrgt, zqgt, ptstep, &
1753 xrtmin_elec(6), xqtmin(6), xcoef_rq_g, &
1754 zwq, zqgs, zqis)
1755!
1756 if ( buconf%LBUDGET_SV ) then
1757 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'HMG', &
1758 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1759 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'HMG', &
1760 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1761 end if
1762 END IF
1763!
1764!
1765!* 5.4 graupel wet growth (rcwetg, rrwetg, riwetg & rswetg)
1766!
1767!* 5.4.1 compute qcwetg
1768!
1769 zwq5(:,5) = 0.
1770 WHERE (zrcwetg(:) > 0. .AND. zrct(:) > xrtmin_elec(2) .AND. abs(zqct(:)) > xqtmin(2) .AND. &
1771 zrgt(:) > xrtmin_elec(6))
1772 zwq5(:,5) = xcoef_rq_c * zrcwetg(:) * zqct(:) / zrct(:)
1773 zwq5(:,5) = sign( min( abs(zqct(:)/ptstep),abs(zwq5(:,5)) ),zqcs(:) )
1774 END WHERE
1775!
1776!
1777!* 5.4.1 compute qiwetg
1778!
1779 zwq5(:,6) = 0.
1780 WHERE (zriwetg(:) > 0. .AND. zrit(:) > xrtmin_elec(4) .AND. abs(zqit(:)) > xqtmin(4) .AND. &
1781 zrgt(:) > xrtmin_elec(6))
1782 zwq5(:,6) = xcoef_rq_i * zriwetg(:) * zqit(:) / zrit(:)
1783 zwq5(:,6) = sign( min( abs(zqit(:)/ptstep),abs(zwq5(:,6)) ),zqis(:) )
1784 END WHERE
1785!
1786!
1787!* 5.4.2 compute qswetg
1788!
1789 zwq5(:,7) = 0.
1790 WHERE (zrswetg(:) > 0. .AND. zrst(:) > xrtmin_elec(5) .AND. abs(zqst(:)) > xqtmin(5) .AND. &
1791 zrgt(:) > xrtmin_elec(6))
1792 zwq5(:,7) = xcoef_rq_s * zrswetg(:) * zqst(:) / zrst(:)
1793 zwq5(:,7) = sign( min( abs(zqst(:)/ptstep),abs(zwq5(:,7)) ),zqss(:) )
1794 END WHERE
1795!
1796!
1797!* 5.4.3 compute qrwetg
1798!
1799 zwq5(:,8) = 0.
1800 WHERE (zrrwetg(:) > 0. .AND. zrrt(:) > xrtmin_elec(3) .AND. abs(zqrt(:)) > xqtmin(3) .AND. &
1801 zrgt(:) > xrtmin_elec(6))
1802 zwq5(:,8) = xcoef_rq_r * zqrt(:) * zrrwetg(:) / zrrt(:)
1803 zwq5(:,8) = sign( min( abs(zqrt(:)/ptstep),abs(zwq5(:,8)) ),zqrs(:) )
1804 ENDWHERE
1805!
1806!
1807!* 5.4.4 conversion of graupel into hail (rwetgh)
1808!
1809 if ( buconf%LBUDGET_SV ) then
1810 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%INIT_PHY(d, 'WETG', &
1811 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1812 end if
1813!
1814 IF (krr == 7) THEN
1815 zwq5(:,9) = 0.
1816 WHERE (zrwetgh(:) > 0. .AND. zrgt(:) > xrtmin_elec(6) .AND. abs(zqgt(:)) > xqtmin(6))
1817 zwq5(:,9) = xcoef_rq_g * zqgt(:) * zrwetgh(:) / zrgt(:)
1818 zwq5(:,9) = sign( min( abs(zqgt(:)/ptstep),abs(zwq5(:,9)) ),zqgs(:) )
1819 END WHERE
1820 !
1821 WHERE (zrcwetg(:) > 0. .OR. zrrwetg(:) > 0. .OR. zriwetg(:) > 0. .OR. &
1822 zrswetg(:) > 0. .OR. zrwetgh(:) > 0.)
1823 zqcs(:) = zqcs(:) - zwq5(:,5)
1824 zqrs(:) = zqrs(:) - zwq5(:,8)
1825 zqis(:) = zqis(:) - zwq5(:,6)
1826 zqss(:) = zqss(:) - zwq5(:,7)
1827 zqgs(:) = zqgs(:) + zwq5(:,5) + zwq5(:,8) + zwq5(:,6) + zwq5(:,7) - zwq5(:,9)
1828 zqhs(:) = zqhs(:) + zwq5(:,9)
1829 END WHERE
1830 ELSE IF (krr == 6) THEN
1831 WHERE (zrcwetg(:) > 0. .OR. zrrwetg(:) > 0. .OR. zriwetg(:) > 0. .OR. &
1832 zrswetg(:) > 0.)
1833 zqcs(:) = zqcs(:) - zwq5(:,5)
1834 zqrs(:) = zqrs(:) - zwq5(:,8)
1835 zqis(:) = zqis(:) - zwq5(:,6)
1836 zqss(:) = zqss(:) - zwq5(:,7)
1837 zqgs(:) = zqgs(:) + zwq5(:,5) + zwq5(:,8) + zwq5(:,6) + zwq5(:,7)
1838 END WHERE
1839 END IF
1840!
1841 if ( buconf%LBUDGET_SV ) then
1842 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'WETG', &
1843 unpack( -zwq5(:,5) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1844 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'WETG', &
1845 unpack( -zwq5(:,8) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1846 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'WETG', &
1847 unpack( -zwq5(:,6) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1848 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'WETG', &
1849 unpack( -zwq5(:,7) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1850 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%END_PHY(d, 'WETG', &
1851 unpack( zqgs(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1852 if ( krr == 7 ) &
1853 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 6 )%PTR%ADD_PHY(d, 'WETG', &
1854 unpack( zwq5(:,9) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1855 end if
1856!
1857!
1858!* 5.5 compute charge separation by the inductive mechanism
1859!
1860! Computation of the charge transfer rate during inductive mechanism
1861! Only the bouncing droplet-graupel collision when the graupel is in the dry
1862! growth mode is considered
1863! The electric field is limited to 100 kV/m
1864!
1865 IF (linductive) THEN
1866 zwq(:) = 0.
1867 gmask(:) = zrcdryg(:) > 0.
1868 igmask = count(gmask(:))
1869 !
1870 IF (igmask > 0) THEN
1871 zwq(:) = 0.
1872 !
1873 WHERE (gmask(:) .AND. &
1874 zefieldw(:) /= 0. .AND. abs(zegt(:)) > elecp%XEGMIN .AND. &
1875 zlbdag(:) > 0. .AND. zcgt(:) > 0. .AND. &
1876 zrgt(:) > xrtmin_elec(6) .AND. zrct(:) > xrtmin_elec(2))
1877 zwq(:) = xind1 * zcgt(:) * zrhocor(:) * &
1878 (xind2 * sign(min(100.e3, abs(zefieldw(:))), zefieldw(:)) * &
1879 zlbdag(:) **(-2.-zdg) - &
1880 xind3 * zegt(:) * zlbdag(:)**(-xfg-zdg))
1881 zwq(:) = zwq(:) / zrhodref(:)
1882 !
1883 zqgs(:) = zqgs(:) + zwq(:)
1884 zqcs(:) = zqcs(:) - zwq(:)
1885 END WHERE
1886 !
1887 if ( buconf%LBUDGET_SV ) then
1888 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'INCG', &
1889 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1890 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'INCG', &
1891 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1892 end if
1893 !
1894 ! Save the inductive charging rate
1895 DO jl = 1, kmicro
1896 xind_rate(ii1(jl),ii2(jl),ii3(jl)) = zwq(jl) * zrhodref(jl) ! C/m3/s
1897 END DO
1898 END IF
1899 !
1900 ! Save the inductive charging rate
1901 DO jl = 1, kmicro
1902 xind_rate(ii1(jl),ii2(jl),ii3(jl)) = zwq(jl) * zrhodref(jl) ! C/m3/s
1903 END DO
1904 END IF
1905!
1906!
1907!* 5.6 melting of the graupel (rgmltr)
1908!
1909 CALL compute_charge_transfer (zrgmltr, zrgt, zqgt, ptstep, &
1910 xrtmin_elec(6), xqtmin(6), xcoef_rq_g, &
1911 zwq, zqgs, zqrs)
1912!
1913 if ( buconf%LBUDGET_SV ) then
1914 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'GMLT', &
1915 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1916 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'GMLT', &
1917 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1918 end if
1919!
1920!
1921!------------------------------------------------------------------
1922!
1923!* 6. COMPUTE THE OPTIONAL SECONDARY ICE PRODUCTION
1924! ---------------------------------------------
1925!
1926! dans un premier temps, on considere que la charge echangee est proportionnelle
1927! a la masse echangee
1928!
1929!* 6.1 collisional ice breakup (cibu)
1930!
1931 IF (hcloud == 'LIMA' .AND. limap%LCIBU) &
1932 CALL compute_charge_transfer (zricibu, zrst, zqst, ptstep, &
1933 xrtmin_elec(5), xqtmin(5), xcoef_rq_s, &
1934 zwq, zqss, zqis)
1935!
1936!* 6.2 raindrop shattering freezing (rdsf)
1937!
1938 IF (hcloud == 'LIMA' .AND. limap%LRDSF) &
1939 CALL compute_charge_transfer (zrirdsf, zrrt, zqrt, ptstep, &
1940 xrtmin_elec(3), xqtmin(3), xcoef_rq_r, &
1941 zwq, zqrs, zqis)
1942!
1943!
1944!------------------------------------------------------------------
1945!
1946!* 7. COMPUTE THE FAST COLD PROCESS SOURCES FOR r_h
1947! ---------------------------------------------
1948!
1949 IF (krr == 7) THEN
1950!
1951!* 7.1 wet growth of hail (qcweth, qrweth, qiweth, qsweth, qgweth)
1952!
1953 zwq5(:,:) = 0.
1954 !
1955 WHERE (zrcweth(:) > 0. .AND. zrct(:) > xrtmin_elec(2))
1956 zwq5(:,1) = xcoef_rq_c * zqct(:) * zrcweth(:) / zrct(:) ! QCWETH
1957 zwq5(:,1) = sign( min( abs(zqct(:)/ptstep),abs(zwq5(:,1)) ),zqcs(:) )
1958 !
1959 zqcs(:) = zqcs(:) - zwq5(:,1)
1960 zqhs(:) = zqhs(:) + zwq5(:,1)
1961 END WHERE
1962 !
1963 WHERE (zriweth(:) > 0. .AND. zrit(:) > xrtmin_elec(4))
1964 zwq5(:,2) = xcoef_rq_i * zqit(:) * zriweth(:) / zrit(:) ! QIWETH
1965 zwq5(:,2) = sign( min( abs(zqit(:)/ptstep),abs(zwq5(:,2)) ),zqis(:) )
1966 !
1967 zqis(:) = zqis(:) - zwq5(:,2)
1968 zqhs(:) = zqhs(:) + zwq5(:,2)
1969 END WHERE
1970 !
1971 WHERE (zrsweth(:) > 0. .AND. zrst(:) > xrtmin_elec(5))
1972 zwq5(:,3) = xcoef_rq_s * zqst(:) * zrsweth(:) / zrst(:) ! QSWETH
1973 zwq5(:,3) = sign( min( abs(zqst(:)/ptstep),abs(zwq5(:,3)) ),zqss(:) )
1974 !
1975 zqss(:) = zqss(:) - zwq5(:,3)
1976 zqhs(:) = zqhs(:) + zwq5(:,3)
1977 END WHERE
1978 !
1979 WHERE (zrgweth(:) > 0. .AND. zrgt(:) > xrtmin_elec(6))
1980 zwq5(:,5) = xcoef_rq_g * zqgt(:) * zrgweth(:) / zrgt(:) ! QGWETH
1981 zwq5(:,5) = sign( min( abs(zqgt(:)/ptstep),abs(zwq5(:,5)) ),zqgs(:) )
1982 !
1983 zqgs(:) = zqgs(:) - zwq5(:,5)
1984 zqhs(:) = zqhs(:) + zwq5(:,5)
1985 END WHERE
1986 !
1987 WHERE (zrrweth(:) > 0. .AND. zrrt(:) > xrtmin_elec(3))
1988 zwq5(:,4) = xcoef_rq_r * zqrt(:) * zrrweth(:) / zrrt(:) ! QRWETH
1989 zwq5(:,4) = sign( min( abs(zqrt(:)/ptstep),abs(zwq5(:,4)) ),zqrs(:) )
1990 !
1991 zqrs(:) = zqrs(:) - zwq5(:,4)
1992 zqhs(:) = zqhs(:) + zwq5(:,4)
1993 END WHERE
1994!
1995 if ( buconf%LBUDGET_SV ) then
1996 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'WETH', &
1997 unpack( -zwq5(:, 1) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
1998 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'WETH', &
1999 unpack( -zwq5(:, 4) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2000 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'WETH', &
2001 unpack( -zwq5(:, 2) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2002 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'WETH', &
2003 unpack( -zwq5(:, 3) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2004 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'WETH', &
2005 unpack( -zwq5(:, 5) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2006 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 6 )%PTR%ADD_PHY(d, 'WETH', &
2007 unpack( ( zwq5(:, 1) + zwq5(:, 2) + zwq5(:, 3) + zwq5(:, 4) + zwq5(:, 5) ) &
2008 * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2009 end if
2010!
2011!
2012!* 7.2 dry growth of hail (qcdryh, qrdryh, qidryh, qsdryh, qgdryh)
2013!
2014 zwq5(:,:) = 0.
2015 !
2016 WHERE (zrcdryh(:) > 0. .AND. zrct(:) > xrtmin_elec(2))
2017 zwq5(:,1) = xcoef_rq_c * zqct(:) * zrcdryh(:) / zrct(:) ! QCDRYH
2018 zwq5(:,1) = sign( min( abs(zqct(:)/ptstep),abs(zwq5(:,1)) ),zqcs(:) )
2019 !
2020 zqcs(:) = zqcs(:) - zwq5(:,1)
2021 zqhs(:) = zqhs(:) + zwq5(:,1)
2022 END WHERE
2023 !
2024 WHERE (zridryh(:) > 0. .AND. zrit(:) > xrtmin_elec(4))
2025 zwq5(:,2) = xcoef_rq_i * zqit(:) * zridryh(:) / zrit(:) ! QIDRYH
2026 zwq5(:,2) = sign( min( abs(zqit(:)/ptstep),abs(zwq5(:,2)) ),zqis(:) )
2027 !
2028 zqis(:) = zqis(:) - zwq5(:,2)
2029 zqhs(:) = zqhs(:) + zwq5(:,2)
2030 END WHERE
2031 !
2032 WHERE (zrsdryh(:) > 0. .AND. zrst(:) > xrtmin_elec(5))
2033 zwq5(:,3) = xcoef_rq_s * zqst(:) * zrsdryh(:) / zrst(:) ! QSDRYH
2034 zwq5(:,3) = sign( min( abs(zqst(:)/ptstep),abs(zwq5(:,3)) ),zqss(:) )
2035 !
2036 zqss(:) = zqss(:) - zwq5(:,3)
2037 zqhs(:) = zqhs(:) + zwq5(:,3)
2038 END WHERE
2039 !
2040 WHERE (zrgdryh(:) > 0. .AND. zrgt(:) > xrtmin_elec(6))
2041 zwq5(:,5) = xcoef_rq_g * zqgt(:) * zrgdryh(:) / zrgt(:) ! QGDRYH
2042 zwq5(:,5) = sign( min( abs(zqgt(:)/ptstep),abs(zwq5(:,5)) ),zqgs(:) )
2043 !
2044 zqgs(:) = zqgs(:) - zwq5(:,5)
2045 zqhs(:) = zqhs(:) + zwq5(:,5)
2046 END WHERE
2047 !
2048 WHERE (zrrdryh(:) > 0. .AND. zrrt(:) > xrtmin_elec(3))
2049 zwq5(:,4) = xcoef_rq_r * zqrt(:) * zrrdryh(:) / zrrt(:) ! QRDRYH
2050 zwq5(:,4) = sign( min( abs(zqrt(:)/ptstep),abs(zwq5(:,4)) ),zqrs(:) )
2051 !
2052 zqrs(:) = zqrs(:) - zwq5(:,4)
2053 zqhs(:) = zqhs(:) + zwq5(:,4)
2054 END WHERE
2055!
2056!
2057!* 7.3 conversion of hail into graupel (qdryhg)
2058!
2059 CALL compute_charge_transfer (zrdryhg, zrht, zqht, ptstep, &
2060 xrtmin_elec(7), xqtmin(7), xcoef_rq_h, &
2061 zwq, zqhs, zqgs)
2062!
2063 if ( buconf%LBUDGET_SV ) then
2064 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'DRYH', &
2065 unpack( -zwq5(:, 1) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2066 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'DRYH', &
2067 unpack( -zwq5(:, 4) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2068 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'DRYH', &
2069 unpack( -zwq5(:, 2) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2070 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 4 )%PTR%ADD_PHY(d, 'DRYH', &
2071 unpack( -zwq5(:, 3) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2072 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 5 )%PTR%ADD_PHY(d, 'DRYH', &
2073 unpack( (-zwq5(:, 5) - zwq(:)) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2074 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 6 )%PTR%ADD_PHY(d, 'DRYH', &
2075 unpack( ( zwq5(:, 1) + zwq5(:, 2) + zwq5(:, 3) + zwq5(:, 4) + zwq5(:, 5) + zwq(:) ) &
2076 * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2077 end if
2078!
2079!
2080!* 7.4 melting of hail (qhmltr)
2081!
2082 CALL compute_charge_transfer (zrhmltr, zrht, zqht, ptstep, &
2083 xrtmin_elec(7), xqtmin(7), xcoef_rq_h, &
2084 zwq, zqhs, zqrs)
2085!
2086 if ( buconf%LBUDGET_SV ) then
2087 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'HMLT', &
2088 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2089 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 6 )%PTR%ADD_PHY(d, 'HMLT', &
2090 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2091 end if
2092!
2093 END IF ! end if krr==7
2094!
2095!
2096!------------------------------------------------------------------
2097!
2098!* 8. COMPUTE THE FAST COLD PROCESS SOURCES FOR r_i
2099! ---------------------------------------------
2100!
2101!* 8.1 Bergeron-Findeisen effect (qcberi)
2102!
2103 CALL compute_charge_transfer (zrcberi, zrct, zqct, ptstep, &
2104 xrtmin_elec(2), xqtmin(2), xcoef_rq_c, &
2105 zwq, zqcs, zqis)
2106!
2107 if ( buconf%LBUDGET_SV ) then
2108 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'BERFI', &
2109 unpack( -zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2110 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'BERFI', &
2111 unpack( zwq(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2112 end if
2113!
2114!
2115!------------------------------------------------------------------
2116!
2117!* 9. COMPUTE THE CHARGE TRANSFER ASSOCIATED WITH THE CORRECTION TERM
2118! ---------------------------------------------------------------
2119!
2120 IF (hcloud == 'LIMA') THEN
2121!
2122 if ( buconf%LBUDGET_SV ) then
2123 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%INIT_PHY(d, 'CORR2', &
2124 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2125 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%INIT_PHY(d, 'CORR2', &
2126 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2127 end if
2128!
2129 zwq1(:) = 0.
2130 WHERE (zrccorr2(:) .NE. 0. .AND. zrct(:) .GT. xrtmin_elec(2))
2131 zwq1(:) = xcoef_rq_c * zqct(:) * zrccorr2(:) / zrct(:)
2132 zwq1(:) = sign( min( abs(zqct(:)/ptstep),abs(zwq1(:)) ),zqcs(:) )
2133 !
2134 zqcs(:) = zqcs(:) - zwq1(:)
2135 zqpis(:) = zqpis(:) + max( 0.0,zwq1(:)/elecd%XECHARGE )
2136 zqnis(:) = zqnis(:) - min( 0.0,zwq1(:)/elecd%XECHARGE )
2137 END WHERE
2138 !
2139 !
2140 zwq2(:) = 0.
2141 WHERE (zrrcorr2(:) .NE. 0. .AND. zrrt(:) .GT. xrtmin_elec(3))
2142 zwq2(:) = xcoef_rq_r * zqrt(:) * zrrcorr2(:) / zrrt(:)
2143 zwq2(:) = sign( min( abs(zqrt(:)/ptstep),abs(zwq2(:)) ),zqrs(:) )
2144 !
2145 zqrs(:) = zqrs(:) - zwq2(:)
2146 zqpis(:) = zqpis(:) + max( 0.0,zwq2(:)/elecd%XECHARGE )
2147 zqnis(:) = zqnis(:) - min( 0.0,zwq2(:)/elecd%XECHARGE )
2148 END WHERE
2149 !
2150 zwq3(:) = 0.
2151 WHERE (zricorr2(:) .NE. 0. .AND. zrit(:) .GT. xrtmin_elec(4))
2152 zwq3(:) = xcoef_rq_i * zqit(:) * zricorr2(:) / zrit(:)
2153 zwq3(:) = sign( min( abs(zqit(:)/ptstep),abs(zwq3(:)) ),zqis(:) )
2154 !
2155 zqis(:) = zqis(:) - zwq3(:)
2156 zqpis(:) = zqpis(:) + max( 0.0,zwq3(:)/elecd%XECHARGE )
2157 zqnis(:) = zqnis(:) - min( 0.0,zwq3(:)/elecd%XECHARGE )
2158 END WHERE
2159!
2160 if ( buconf%LBUDGET_SV ) then
2161 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg )%PTR%END_PHY(d, 'CORR2', &
2162 unpack( zqpis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2163 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecend )%PTR%END_PHY(d, 'CORR2', &
2164 unpack( zqnis(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2165 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 1 )%PTR%ADD_PHY(d, 'CORR2', &
2166 unpack( zwq1(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2167 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 2 )%PTR%ADD_PHY(d, 'CORR2', &
2168 unpack( zwq2(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2169 CALL tbudgets(nbudget_sv1 - 1 + nsv_elecbeg + 3 )%PTR%ADD_PHY(d, 'CORR2', &
2170 unpack( zwq3(:) * zrhodj(:), mask = odmicro(:, :, :), field = 0. ) )
2171 end if
2172 END IF
2173!
2174!
2175!------------------------------------------------------------------
2176!
2177!* X. COMPUTE THE SEDIMENTATION SOURCE FOR Q_x
2178! ----------------------------------------
2179!
2180! The sedimentation for electric charges is computed directly
2181! in the microphysics scheme
2182!
2183!
2184!------------------------------------------------------------------
2185!
2186!* 10. UPDATE VOLUMETRIC CHARGE CONCENTRATIONS
2187! ---------------------------------------
2188!
2189 DO jl = 1, kmicro
2190 pqpis(ii1(jl),ii2(jl),ii3(jl)) = zqpis(jl)
2191 pqnis(ii1(jl),ii2(jl),ii3(jl)) = zqnis(jl)
2192 pqcs(ii1(jl),ii2(jl),ii3(jl)) = zqcs(jl)
2193 pqrs(ii1(jl),ii2(jl),ii3(jl)) = zqrs(jl)
2194 pqis(ii1(jl),ii2(jl),ii3(jl)) = zqis(jl)
2195 pqss(ii1(jl),ii2(jl),ii3(jl)) = zqss(jl)
2196 pqgs(ii1(jl),ii2(jl),ii3(jl)) = zqgs(jl)
2197 END DO
2198 IF ( krr == 7 ) THEN
2199 DO jl = 1, kmicro
2200 pqhs(ii1(jl),ii2(jl),ii3(jl)) = zqhs(jl)
2201 END DO
2202 END IF
2203END IF ! end if kmicro>0
2204!
2205!
2206!------------------------------------------------------------------
2207!
2208!* 11. DEALLOCATE
2209! ----------
2210!
2211IF (ALLOCATED( zdeltalwc )) DEALLOCATE( zdeltalwc )
2212IF (ALLOCATED( zft )) DEALLOCATE( zft )
2213!
2214IF (ALLOCATED( zew )) DEALLOCATE( zew )
2215IF (ALLOCATED( zsaunsk )) DEALLOCATE( zsaunsk )
2216IF (ALLOCATED( zsaunim )) DEALLOCATE( zsaunim )
2217IF (ALLOCATED( zsaunin )) DEALLOCATE( zsaunin )
2218IF (ALLOCATED( zsaunsm )) DEALLOCATE( zsaunsm )
2219IF (ALLOCATED( zsaunsn )) DEALLOCATE( zsaunsn )
2220IF (ALLOCATED( zfqiaggs )) DEALLOCATE( zfqiaggs )
2221IF (ALLOCATED( zfqidrygbs )) DEALLOCATE( zfqidrygbs )
2222IF (ALLOCATED( zlbqsdrygb1s )) DEALLOCATE( zlbqsdrygb1s )
2223IF (ALLOCATED( zlbqsdrygb2s )) DEALLOCATE( zlbqsdrygb2s )
2224IF (ALLOCATED( zlbqsdrygb3s )) DEALLOCATE( zlbqsdrygb3s )
2225!
2226IF (ALLOCATED( zdq )) DEALLOCATE( zdq )
2227IF (ALLOCATED( zrar )) DEALLOCATE( zrar )
2228IF (ALLOCATED( zdq_is )) DEALLOCATE( zdq_is )
2229IF (ALLOCATED( zsaunim_is )) DEALLOCATE( zsaunim_is )
2230IF (ALLOCATED( zsaunin_is )) DEALLOCATE( zsaunin_is )
2231IF (ALLOCATED( zdq_ig )) DEALLOCATE( zdq_ig )
2232IF (ALLOCATED( zsaunim_ig )) DEALLOCATE( zsaunim_ig )
2233IF (ALLOCATED( zsaunin_ig )) DEALLOCATE( zsaunin_ig )
2234IF (ALLOCATED( zdq_sg )) DEALLOCATE( zdq_sg )
2235IF (ALLOCATED( zsaunsk_sg )) DEALLOCATE( zsaunsk_sg )
2236IF (ALLOCATED( zsaunsm_sg )) DEALLOCATE( zsaunsm_sg )
2237IF (ALLOCATED( zsaunsn_sg )) DEALLOCATE( zsaunsn_sg )
2238!
2239IF (ALLOCATED( zefieldw )) DEALLOCATE( zefieldw )
2240!
2241IF (ALLOCATED(zrcmltsr)) DEALLOCATE(zrcmltsr)
2242IF (ALLOCATED(zricfrr)) DEALLOCATE(zricfrr)
2243IF (ALLOCATED(zrvhenc)) DEALLOCATE(zrvhenc)
2244IF (ALLOCATED(zrchinc)) DEALLOCATE(zrchinc)
2245IF (ALLOCATED(zrvhonh)) DEALLOCATE(zrvhonh)
2246IF (ALLOCATED(zrrcvrc)) DEALLOCATE(zrrcvrc)
2247IF (ALLOCATED(zricnvi)) DEALLOCATE(zricnvi)
2248IF (ALLOCATED(zrvdepi)) DEALLOCATE(zrvdepi)
2249IF (ALLOCATED(zrshmsi)) DEALLOCATE(zrshmsi)
2250IF (ALLOCATED(zrghmgi)) DEALLOCATE(zrghmgi)
2251IF (ALLOCATED(zricibu)) DEALLOCATE(zricibu)
2252IF (ALLOCATED(zrirdsf)) DEALLOCATE(zrirdsf)
2253IF (ALLOCATED(zrccorr2)) DEALLOCATE(zrccorr2)
2254IF (ALLOCATED(zrrcorr2)) DEALLOCATE(zrrcorr2)
2255IF (ALLOCATED(zricorr2)) DEALLOCATE(zricorr2)
2256IF (ALLOCATED(zrwetgh)) DEALLOCATE(zrwetgh)
2257IF (ALLOCATED(zrcweth)) DEALLOCATE(zrcweth)
2258IF (ALLOCATED(zriweth)) DEALLOCATE(zriweth)
2259IF (ALLOCATED(zrsweth)) DEALLOCATE(zrsweth)
2260IF (ALLOCATED(zrgweth)) DEALLOCATE(zrgweth)
2261IF (ALLOCATED(zrrweth)) DEALLOCATE(zrrweth)
2262IF (ALLOCATED(zrcdryh)) DEALLOCATE(zrcdryh)
2263IF (ALLOCATED(zrrdryh)) DEALLOCATE(zrrdryh)
2264IF (ALLOCATED(zridryh)) DEALLOCATE(zridryh)
2265IF (ALLOCATED(zrsdryh)) DEALLOCATE(zrsdryh)
2266IF (ALLOCATED(zrgdryh)) DEALLOCATE(zrgdryh)
2267IF (ALLOCATED(zrhmltr)) DEALLOCATE(zrhmltr)
2268IF (ALLOCATED(zrdryhg)) DEALLOCATE(zrdryhg)
2269!
2270!------------------------------------------------------------------
2271END associate
2272!
2273CONTAINS
2274!
2275! - routines to initialize the non-inductive charging
2276! - routines to compute the non-inductive charging
2277! - various useful routines
2278!
2279!------------------------------------------------------------------
2280!
2281! ##################################
2283! ##################################
2284!
2285!
2286! Purpose : initialization for the non-inductive charging process
2287! following Gardiner et al. (1985)
2288!
2289!
2290!* 0. DECLARATIONS
2291! ------------
2292!
2293IMPLICIT NONE
2294!
2295!
2296!* 1. COMPUTE f(DeltaT) AND (LWC - LWC_crit)
2297! --------------------------------------
2298!
2299gelec(:,:) = .false.
2300!
2301zdeltalwc(:) = 0.
2302zft(:) = 0.
2303!
2304gelec(:,3) = zzt(:) > (cst%XTT - 40.) .AND. zzt(:) < cst%XTT
2305gelec(:,1) = gelec(:,3) .AND. &
2306 zrit(:) > xrtmin_elec(4) .AND. zrst(:) > xrtmin_elec(5) .AND. &
2307 zcit(:) > 0.0 .AND. zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe
2308gelec(:,2) = gelec(:,3) .AND. &
2309 zrit(:) > xrtmin_elec(4) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2310 zcit(:) > 0.0 .AND. zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2311gelec(:,3) = gelec(:,3) .AND. &
2312 zrst(:) > xrtmin_elec(5) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2313 zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe .AND. &
2314 zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2315gelec(:,4) = gelec(:,1) .OR. gelec(:,2) .OR. gelec(:,3)
2316!
2317WHERE (gelec(:,4))
2318 ! f(DeltaT)
2319 zft(:) = - 1.7e-5 * ((-21 / (xqtc - cst%XTT)) * (zzt(:) - cst%XTT))**3 &
2320 - 0.003 * ((-21 / (xqtc - cst%XTT)) * (zzt(:) - cst%XTT))**2 &
2321 - 0.05 * ((-21 / (xqtc - cst%XTT)) * (zzt(:) - cst%XTT)) &
2322 + 0.13
2323 !
2324 ! LWC - LWC_crit
2325 zdeltalwc(:) = (zrct(:) * zrhodref(:) * 1.e3) - xlwcc ! (g m^-3)
2326ENDWHERE
2327!
2328END SUBROUTINE elec_init_noind_gardi
2329!
2330!-----------------------------------------------------------------
2331!
2332! ################################
2333 SUBROUTINE elec_init_noind_ewc()
2334! ################################
2335!
2336!
2337! Purpose : initialization for the non-inductive charging process
2338! following Saunders et al. (1991)
2339!
2340!
2341!* 0. DECLARATIONS
2342! ------------
2343!
2344IMPLICIT NONE
2345!
2346!
2347!* 1. PARAMETERS FOR POSITIVE NI CHARGING
2348! -----------------------------------
2349!
2350gelec(:,:) = .false.
2351zdq(:) = 0.
2352zew(:) = 0.
2353!
2354! positive case is the default value
2355IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2') THEN
2356 zfqiaggs(:) = xfqiaggsp
2357 zfqidrygbs(:) = xfqidrygbsp
2358ELSE IF (cni_charging == 'TEEWC') THEN
2359 zfqiaggs(:) = xfqiaggsp_tak
2360 zfqidrygbs(:) = xfqidrygbsp_tak
2361END IF
2362zlbqsdrygb1s(:) = xlbqsdrygb1sp
2363zlbqsdrygb2s(:) = xlbqsdrygb2sp
2364zlbqsdrygb3s(:) = xlbqsdrygb3sp
2365zsaunim(:) = ximp !3.76
2366zsaunin(:) = xinp !2.5
2367zsaunsk(:) = xskp !52.8
2368zsaunsm(:) = xsmp !0.44
2369zsaunsn(:) = xsnp !2.5
2370!
2371!
2372!* 2. PARAMETERS FOR NEGATIVE NI CHARGING
2373! -----------------------------------
2374!
2375! Mansell et al. (2005, JGR): droplet collection efficiency of the graupel ~ 0.6-1.0
2376WHERE (zlbdag(:) > 0. .AND. zrct(:) > 0.)
2377 zew(:) = 0.8 * zrct(:) * zrhodref(:) * 1.e3 ! (g m^-3)
2378END WHERE
2379!
2380gelec(:,3) = zzt(:) > (cst%XTT - 40.) .AND. zzt(:) <= cst%XTT .AND. &
2381 zew(:) >= 0.01 .AND. zew(:) <= 10.
2382gelec(:,1) = gelec(:,3) .AND. &
2383 zrit(:) > xrtmin_elec(4) .AND. zrst(:) > xrtmin_elec(5) .AND. &
2384 zcit(:) > 0.0 .AND. zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe
2385gelec(:,2) = gelec(:,3) .AND. &
2386 zrit(:) > xrtmin_elec(4) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2387 zcit(:) > 0.0 .AND. zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2388gelec(:,3) = gelec(:,3) .AND. &
2389 zrst(:) > xrtmin_elec(5) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2390 zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe .AND. &
2391 zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2392!
2393gelec(:,4) = gelec(:,1) .OR. gelec(:,2) .OR. gelec(:,3)
2394!
2395IF (count(gelec(:,4)) > 0) THEN
2396 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2') THEN
2397 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2398 zew, zzt, xsaunder, zdq)
2399 !
2400 WHERE (zdq(:) < 0.)
2401 zfqiaggs(:) = xfqiaggsn
2402 zfqidrygbs(:) = xfqidrygbsn
2403 END WHERE
2404 ELSE IF (cni_charging == 'TEEWC') THEN
2405 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2406 zew, zzt, xtaka_tm, zdq)
2407 !
2408 WHERE (zdq(:) < 0.)
2409 zfqiaggs(:) = xfqiaggsn_tak
2410 zfqidrygbs(:) = xfqidrygbsn_tak
2411 END WHERE
2412 END IF
2413!
2414! value of the parameters for the negative case
2415 WHERE (zdq(:) < 0.)
2416 zlbqsdrygb1s(:) = xlbqsdrygb1sn
2417 zlbqsdrygb2s(:) = xlbqsdrygb2sn
2418 zlbqsdrygb3s(:) = xlbqsdrygb3sn
2419 zsaunim(:) = ximn !2.54
2420 zsaunin(:) = xinn !2.8
2421 zsaunsk(:) = xskn !24.
2422 zsaunsm(:) = xsmn !0.5
2423 zsaunsn(:) = xsnn !2.8
2424 ENDWHERE
2425ENDIF
2426!
2427END SUBROUTINE elec_init_noind_ewc
2428!
2429!------------------------------------------------------------------
2430!
2431! ################################
2432 SUBROUTINE elec_init_noind_rar()
2433! ################################
2434!
2435!
2436! Purpose : initialization for the non-inductive charging process
2437! following Saunders and Peck (1998)
2438!
2439!
2440!* 0. DECLARATIONS
2441! ------------
2442!
2443IMPLICIT NONE
2444!
2445! local variables
2446REAL, DIMENSION(KMICRO) :: ZRAR_CRIT ! critical rime accretion rate
2447REAL, DIMENSION(KMICRO) :: ZVGMEAN, & ! mean velocity of graupel
2448 ZVSMEAN ! mean velocity of snow
2449!
2450!
2451!* 1. COMPUTE THE CRITICAL RIME ACCRETION RATE
2452! ----------------------------------------
2453!
2454zrar_crit(:) = 0.
2455!
2456IF (cni_charging == 'SAP98') THEN
2457!
2458 WHERE (zzt(:) <= cst%XTT .AND. zzt(:) >= (cst%XTT - 23.7)) ! Original from SAP98
2459 zrar_crit(:) = 1.0 + 7.93e-2 * (zzt(:) - cst%XTT) + &
2460 4.48e-2 * (zzt(:) - cst%XTT)**2 + &
2461 7.48e-3 * (zzt(:) - cst%XTT)**3 + &
2462 5.47e-4 * (zzt(:) - cst%XTT)**4 + &
2463 1.67e-5 * (zzt(:) - cst%XTT)**5 + &
2464 1.76e-7 * (zzt(:) - cst%XTT)**6
2465 END WHERE
2466 !
2467 WHERE (zzt(:) < (cst%XTT - 23.7) .AND. zzt(:) > (cst%XTT - 40.)) ! Added by Mansell
2468 zrar_crit(:) = 3.4 * (1.0 - (abs(zzt(:) - cst%XTT + 23.7) / & ! et al. (2005)
2469 (-23.7 + 40.))**3.)
2470 END WHERE
2471 !
2472 gelec(:,3) = zzt(:) >= (cst%XTT - 40.) .AND. zzt(:) <= cst%XTT
2473!
2474ELSE IF (cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2') THEN
2475!
2476 WHERE (zzt(:) > (cst%XTT - 10.7))
2477 zrar_crit(:) = 0.66
2478 END WHERE
2479 WHERE (zzt(:) <= (cst%XTT - 10.7) .AND. zzt(:) >= (cst%XTT - 23.7))
2480 zrar_crit(:) = -1.47 - 0.2 * (zzt(:) - cst%XTT)
2481 END WHERE
2482 WHERE (zzt(:) < (cst%XTT - 23.7) .AND. zzt(:) > (cst%XTT - 40.))
2483 zrar_crit(:) = 3.3
2484 END WHERE
2485 !
2486 gelec(:,3) = zzt(:) > (cst%XTT - 40.) .AND. zzt(:) <= cst%XTT .AND. &
2487 zew(:) >= 0.01 .AND. zew(:) <= 10.
2488!
2489ELSE IF (cni_charging == 'TERAR') THEN
2490!
2491 gelec(:,3) = zzt(:) >= (cst%XTT - 40.) .AND. zzt(:) <= cst%XTT
2492END IF
2493!
2494gelec(:,1) = gelec(:,3) .AND. &
2495 zrit(:) > xrtmin_elec(4) .AND. zrst(:) > xrtmin_elec(5) .AND. &
2496 zcit(:) > 0.0 .AND. zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe
2497gelec(:,2) = gelec(:,3) .AND. &
2498 zrit(:) > xrtmin_elec(4) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2499 zcit(:) > 0.0 .AND. zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2500gelec(:,3) = gelec(:,3) .AND. &
2501 zrst(:) > xrtmin_elec(5) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2502 zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe .AND. &
2503 zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2504!
2505!
2506!* 2. INITIALIZATION FOR ICE CRYSTAL - GRAUPEL COLLISIONS
2507! ---------------------------------------------------
2508!
2509zdq_ig(:) = 0.
2510!
2511! positive case is the default value
2512zsaunim_ig(:) = ximp
2513zsaunin_ig(:) = xinp
2514!
2515! Compute the Rime Accretion Rate
2516zrar(:) = 0.
2517zvgmean(:) = 0.
2518WHERE (zlbdag(:) > 0. .AND. zrct(:) > 0.)
2519 zvgmean(:) = xvgcoef * zrhocor(:) * zlbdag(:)**(-zdg)
2520 zrar(:) = 0.8 * zrhodref(:) * zrct(:) * zvgmean(:) * 1.e3
2521END WHERE
2522!
2523IF (cni_charging == 'TERAR') THEN
2524 gelec(:,2) = gelec(:,2) .AND. zrar(:) > 0.01 .AND. zrar(:) <= 80.
2525ELSE
2526 gelec(:,2) = gelec(:,2) .AND. zrar(:) > 0.1
2527END IF
2528gelec(:,4) = gelec(:,2)
2529!
2530IF (count(gelec(:,4)) .GT. 0) THEN
2531! compute the coefficients for I-G collisions
2532 IF (cni_charging == 'SAP98') THEN
2533 CALL elec_ini_ni_sap98 (kmicro, gelec(:,4), zrar, zrar_crit, zdq_ig)
2534 !
2535 ELSE IF (cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2') THEN
2536 zrar(:) = zrar(:) / 3
2537 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2538 zrar, zzt, xsaunder, zdq_ig)
2539 !
2540 ELSE IF (cni_charging == 'TERAR') THEN
2541 zrar(:) = zrar(:) / 8.
2542 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2543 zrar, zzt, xtaka_tm, zdq_ig)
2544 !
2545 END IF
2546 !
2547 WHERE (zdq_ig(:) < 0.)
2548 zsaunim_ig(:) = ximn
2549 zsaunin_ig(:) = xinn
2550 ENDWHERE
2551ENDIF
2552!
2553!
2554!* 3. INITIALIZATION FOR ICE CRYSTAL - SNOW COLLISIONS
2555! ------------------------------------------------
2556!
2557zdq_is(:) = 0.
2558!
2559! positive case is the default value
2560zsaunim_is(:) = ximp
2561zsaunin_is(:) = xinp
2562!
2563! Compute the Rime Accretion Rate
2564zrar(:) = 0.
2565zvsmean(:) = 0.
2566WHERE (zlbdas(:) > 0. .AND. zrct(:) > 0.)
2567 zvsmean(:) = xvscoef * zrhocor(:) * zlbdas(:)**(-zds)
2568 zrar(:) = 0.8 * zrhodref(:) * zrct(:) * zvsmean(:) * 1.e3
2569END WHERE
2570!
2571IF (cni_charging == 'TERAR') THEN
2572 gelec(:,1) = gelec(:,1) .AND. zrar(:) > 0.01 .AND. zrar(:) <= 80.
2573ELSE
2574 gelec(:,1) = gelec(:,1) .AND. zrar(:) > 0.1
2575END IF
2576gelec(:,4) = gelec(:,1)
2577!
2578IF (count(gelec(:,4)) .GT. 0) THEN
2579! compute the coefficients for I-S collisions
2580 IF (cni_charging == 'SAP98') THEN
2581 CALL elec_ini_ni_sap98 (kmicro, gelec(:,4), zrar, zrar_crit, zdq_is)
2582 !
2583 ELSE IF (cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2') THEN
2584 zrar(:) = zrar(:) / 3
2585 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2586 zrar, zzt, xsaunder, zdq_is)
2587 !
2588 ELSE IF (cni_charging == 'TERAR') THEN
2589 zrar(:) = zrar(:) / 8.
2590 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2591 zrar, zzt, xtaka_tm, zdq_is)
2592 !
2593 END IF
2594 !
2595 WHERE (zdq_is(:) < 0.)
2596 zsaunim_is(:) = ximn
2597 zsaunin_is(:) = xinn
2598 ENDWHERE
2599ENDIF
2600!
2601!
2602!* 4. INITIALIZATION FOR GRAUPEL - SNOW COLLISIONS
2603! --------------------------------------------
2604!
2605zdq_sg(:) = 0.
2606!
2607! positive case is the default value
2608zsaunsk_sg(:) = xskp
2609zsaunsm_sg(:) = xsmp
2610zsaunsn_sg(:) = xsnp
2611!
2612! Compute the Rime Accretion Rate
2613zrar(:) = 0.
2614WHERE (zvsmean(:) > 0. .AND. zvgmean(:) > 0.)
2615 zrar(:) = 0.8 * zrhodref(:) * zrct(:) * abs(zvgmean(:) - zvsmean(:)) * 1.e3
2616END WHERE
2617!
2618IF (cni_charging == 'TERAR') THEN
2619 gelec(:,3) = gelec(:,3) .AND. zrar(:) > 0.01 .AND. zrar(:) <= 80.
2620ELSE
2621 gelec(:,3) = gelec(:,3) .AND. zrar(:) > 0.1
2622END IF
2623gelec(:,4) = gelec(:,3)
2624!
2625IF( count(gelec(:,4)) .GT. 0) THEN
2626! compute the coefficients for S-G collisions
2627 IF (cni_charging == 'SAP98') THEN
2628 CALL elec_ini_ni_sap98 (kmicro, gelec(:,4), zrar, zrar_crit, zdq_sg)
2629 !
2630 ELSE IF (cni_charging == 'BSMP1' .OR. cni_charging == 'BSMP2') THEN
2631 zrar(:) = zrar(:) / 3
2632 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2633 zrar, zzt, xsaunder, zdq_sg)
2634 !
2635 ELSE IF (cni_charging == 'TERAR') THEN
2636 zrar(:) = zrar(:) / 8.
2637 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2638 zrar, zzt, xtaka_tm, zdq_sg)
2639 !
2640 END IF
2641 !
2642 WHERE (zdq_sg(:) < 0.)
2643 zsaunsk_sg(:) = xskn
2644 zsaunsm_sg(:) = xsmn
2645 zsaunsn_sg(:) = xsnn
2646 ENDWHERE
2647ENDIF
2648!
2649END SUBROUTINE elec_init_noind_rar
2650!
2651!------------------------------------------------------------------
2652!
2653! ##################################
2654 SUBROUTINE elec_init_noind_takah()
2655! ##################################
2656!
2657! Purpose : initialization for the non-inductive charging process
2658! following Takahashi (1978)
2659!
2660!
2661!* 0. DECLARATIONS
2662! ------------
2663!
2664IMPLICIT NONE
2665!
2666!
2667!* 1. COMPUTE f(T, LWC)
2668! -----------------
2669!
2670zdq(:) = 0.
2671!
2672zew(:) = zrct(:) * zrhodref(:) * 1.e3 ! (g m^-3)
2673!
2674gelec(:,3) = zzt(:) > (cst%XTT - 40.) .AND. zzt(:) <= cst%XTT .AND. &
2675 zew(:) >= 0.01 .AND. zew(:) <= 10.
2676gelec(:,1) = gelec(:,3) .AND. &
2677 zrit(:) > xrtmin_elec(4) .AND. zrst(:) > xrtmin_elec(5) .AND. &
2678 zcit(:) > 0.0 .AND. zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe
2679gelec(:,2) = gelec(:,3) .AND. &
2680 zrit(:) > xrtmin_elec(4) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2681 zcit(:) > 0.0 .AND. zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2682gelec(:,3) = gelec(:,3) .AND. &
2683 zrst(:) > xrtmin_elec(5) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2684 zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe .AND. &
2685 zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2686gelec(:,4) = gelec(:,1) .OR. gelec(:,2) .OR. gelec(:,3)
2687!
2688IF (count(gelec(:,4)) > 0) THEN
2689 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2690 zew, zzt, xmansell, zdq)
2691ENDIF
2692!
2693END SUBROUTINE elec_init_noind_takah
2694!
2695!------------------------------------------------------------------
2696!
2697! ##################################
2698 SUBROUTINE elec_init_noind_teewc()
2699! ##################################
2700!
2701!
2702! Purpose : initialization for the non-inductive charging process
2703! following Tsenova and Mitzeva (2009)
2704!
2705!
2706!* 0. DECLARATIONS
2707! ------------
2708!
2709IMPLICIT NONE
2710!
2711!
2712!* 1. PARAMETERS FOR POSITIVE NI CHARGING
2713! -----------------------------------
2714!
2715gelec(:,:) = .false.
2716zdq(:) = 0.
2717!
2718! positive case is the default value
2719zfqiaggs(:) = xfqiaggsp_tak
2720zfqidrygbs(:) = xfqidrygbsp_tak
2721zlbqsdrygb1s(:) = xlbqsdrygb1sp
2722zlbqsdrygb2s(:) = xlbqsdrygb2sp
2723zlbqsdrygb3s(:) = xlbqsdrygb3sp
2724zsaunim(:) = ximp !3.76
2725zsaunin(:) = xinp !2.5
2726zsaunsk(:) = xskp_tak !6.5
2727zsaunsm(:) = xsmp !0.44
2728zsaunsn(:) = xsnp !2.5
2729!
2730!
2731!* 2. PARAMETERS FOR NEGATIVE NI CHARGING
2732! -----------------------------------
2733!
2734! Compute the effective water content
2735zew(:) = 0.
2736!
2737WHERE (zlbdag(:) > 0. .AND. zrct(:) > 0.)
2738 zew(:) = 0.8 * zrhodref(:) * zrct(:) * 1.e3
2739END WHERE
2740!
2741gelec(:,3) = zzt(:) >= (cst%XTT - 40.) .AND. zzt(:) <= cst%XTT .AND. &
2742 zew(:) >= 0.01 .AND. zew(:) <= 10.
2743gelec(:,1) = gelec(:,3) .AND. &
2744 zrit(:) > xrtmin_elec(4) .AND. zrst(:) > xrtmin_elec(5) .AND. &
2745 zcit(:) > 0.0 .AND. zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe
2746gelec(:,2) = gelec(:,3) .AND. &
2747 zrit(:) > xrtmin_elec(4) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2748 zcit(:) > 0.0 .AND. zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2749gelec(:,3) = gelec(:,3) .AND. &
2750 zrst(:) > xrtmin_elec(5) .AND. zrgt(:) > xrtmin_elec(6) .AND. &
2751 zlbdas(:) > 0. .AND. zlbdas(:) < xlbdas_maxe .AND. &
2752 zlbdag(:) > 0. .AND. zlbdag(:) < xlbdag_maxe
2753!
2754gelec(:,4) = gelec(:,1) .OR. gelec(:,2) .OR. gelec(:,3)
2755!
2756IF (count(gelec(:,4)) > 0) THEN
2757 CALL interp_dq_table (kmicro, nind_temp, nind_lwc, gelec(:,4), &
2758 zew, zzt, xtaka_tm, zdq)
2759!
2760 WHERE (zdq(:) < 0.)
2761 zfqiaggs(:) = xfqiaggsn_tak
2762 zfqidrygbs(:) = xfqidrygbsn_tak
2763 zlbqsdrygb1s(:) = xlbqsdrygb1sn
2764 zlbqsdrygb2s(:) = xlbqsdrygb2sn
2765 zlbqsdrygb3s(:) = xlbqsdrygb3sn
2766 zsaunim(:) = ximn !2.54
2767 zsaunin(:) = xinn !2.8
2768 zsaunsk(:) = xskn_tak !2.0
2769 zsaunsm(:) = xsmn !0.5
2770 zsaunsn(:) = xsnn !2.8
2771 ENDWHERE
2772ENDIF
2773!
2774END SUBROUTINE elec_init_noind_teewc
2775!
2776!------------------------------------------------------------------
2777!
2778! #################################################################
2779 SUBROUTINE elec_ini_ni_sap98(KMICRO, OMASK, PRAR, PRAR_CRIT, PDQ)
2780! #################################################################
2781!
2782!
2783! Purpose : compute dQ(RAR,T) in the parameterization of Saunders and Peck (1998)
2784!
2785!
2786!* 0. DECLARATIONS
2787! ------------
2788!
2789IMPLICIT NONE
2790!
2791INTEGER, INTENT(IN) :: KMICRO
2792LOGICAL, DIMENSION(KMICRO), INTENT(IN) :: OMASK
2793REAL, DIMENSION(KMICRO), INTENT(IN) :: PRAR ! Rime accretion rate
2794REAL, DIMENSION(KMICRO), INTENT(IN) :: PRAR_CRIT ! Critical rime accretion rate
2795REAL, DIMENSION(KMICRO), INTENT(INOUT) :: PDQ ! interpolated dQ
2796!
2797!
2798!* 1. COMPUTE dQ(RAR, T)
2799! ------------------
2800!
2801pdq(:) = 0.
2802!
2803! positive region : Mansell et al., 2005
2804WHERE (omask(:) .AND. prar(:) > prar_crit(:))
2805 pdq(:) = max(0., 6.74 * (prar(:) - prar_crit(:)) * 1.e-15)
2806ENDWHERE
2807!
2808! negative region : Mansell et al. 2005
2809WHERE (omask(:) .AND. prar(:) < prar_crit(:))
2810 pdq(:) = min(0., 3.9 * (prar_crit(:) - 0.1) * &
2811 (4.0 * ((prar(:) - (prar_crit(:) + 0.1) / 2.) / &
2812 (prar_crit(:) - 0.1))**2 - 1.) * 1.e-15)
2813ENDWHERE
2814!
2815END SUBROUTINE elec_ini_ni_sap98
2816!
2817!------------------------------------------------------------------
2818!
2819! #################################################################
2820 SUBROUTINE interp_dq_table (KMICRO, KIND_TEMP, KIND_LWC, OMASK, &
2821 PLIQ, PTEMP, PTABLE, PDQ)
2822! #################################################################
2823!
2824!
2825! Purpose : interpolate dQ from a lookup table at each gridpoint
2826!
2827!
2828!* 0. DECLARATIONS
2829! ------------
2830!
2831IMPLICIT NONE
2832!
2833INTEGER, INTENT(IN) :: KMICRO
2834INTEGER, INTENT(IN) :: KIND_TEMP, KIND_LWC
2835LOGICAL, DIMENSION(KMICRO), INTENT(IN) :: OMASK
2836REAL, DIMENSION(KMICRO), INTENT(IN) :: PLIQ ! effective water content or rime accretion rate
2837REAL, DIMENSION(KMICRO), INTENT(IN) :: PTEMP ! temperature
2838REAL, DIMENSION(KIND_LWC+1,KIND_TEMP+1), INTENT(IN) :: PTABLE ! lookup table
2839REAL, DIMENSION(KMICRO), INTENT(INOUT) :: PDQ ! interpolated dQ
2840!
2841! declaration of local variables
2842INTEGER :: IGAUX
2843REAL, DIMENSION(:), ALLOCATABLE :: ZDQ_INTERP
2844REAL, DIMENSION(:), ALLOCATABLE :: ZVECT1, ZVECT2
2845INTEGER, DIMENSION(:), ALLOCATABLE :: IVECT1, IVECT2
2846!
2847!
2848!* 1. FIND THE INDEXES FOR RAR/EW AND T
2849! ---------------------------------
2850!
2851pdq(:) = 0.
2852!
2853igaux = 0
2854DO ii = 1, kmicro
2855 IF (omask(ii)) THEN
2856 igaux = igaux + 1
2857 i1(igaux) = ii
2858 END IF
2859END DO
2860!
2861IF (igaux > 0) THEN
2862 ALLOCATE(zdq_interp(igaux))
2863 ALLOCATE(zvect1(igaux))
2864 ALLOCATE(zvect2(igaux))
2865 ALLOCATE(ivect1(igaux))
2866 ALLOCATE(ivect2(igaux))
2867 zdq_interp(:) = 0.
2868 ivect1(:) = 0
2869 ivect2(:) = 0
2870!
2871 DO ii = 1, igaux
2872 zvect1(ii) = ptemp(i1(ii))
2873 zvect2(ii) = pliq(i1(ii))
2874 zdq_interp(ii) = pdq(i1(ii))
2875 END DO
2876!
2877! Temperature index (0C --> -40C)
2878 zvect1(1:igaux) = max( 1.00001, min( real(kind_temp)-0.00001, &
2879 (zvect1(1:igaux) - cst%XTT - 1.)/(-1.) ) )
2880 ivect1(1:igaux) = int( zvect1(1:igaux) )
2881 zvect1(1:igaux) = zvect1(1:igaux) - real(ivect1(1:igaux))
2882!
2883! LWC index (0.01 g.m^-3 --> 10 g.m^-3)
2884 WHERE (zvect2(:) >= 0.01 .AND. zvect2(:) < 0.1)
2885 zvect2(:) = max( 1.00001, min( real(10)-0.00001, &
2886 zvect2(:) * 100. ))
2887 ivect2(:) = int(zvect2(:))
2888 zvect2(:) = zvect2(:) - real(ivect2(:))
2889 ENDWHERE
2890!
2891 WHERE (zvect2(:) >= 0.1 .AND. zvect2(:) < 1. .AND. ivect2(:) == 0)
2892 zvect2(:) = max( 10.00001, min( real(19)-0.00001, &
2893 zvect2(:) * 10. + 9. ) )
2894 ivect2(:) = int(zvect2(:))
2895 zvect2(:) = zvect2(:) - real(ivect2(:))
2896 ENDWHERE
2897!
2898 WHERE ((zvect2(:) >= 1.) .AND. zvect2(:) <= 10.)
2899 zvect2(:) = max( 19.00001, min( real(kind_lwc)-0.00001, &
2900 zvect2(:) + 18. ) )
2901 ivect2(:) = int(zvect2(:))
2902 zvect2(:) = zvect2(:) - real(ivect2(:))
2903 ENDWHERE
2904!
2905!
2906!* 2. INTERPOLATE dQ(RAR or EW,T)
2907! ---------------------------
2908!
2909 zdq_interp(:) = bi_lin_intp_v( ptable, ivect2, ivect1, zvect2, zvect1, &
2910 igaux )
2911!
2912 DO ii = 1, igaux
2913 pdq(i1(ii)) = zdq_interp(ii)
2914 END DO
2915END IF
2916!
2917DEALLOCATE(zdq_interp)
2918DEALLOCATE(zvect1)
2919DEALLOCATE(zvect2)
2920DEALLOCATE(ivect1)
2921DEALLOCATE(ivect2)
2922!
2923END SUBROUTINE interp_dq_table
2924!
2925!------------------------------------------------------------------
2926!
2927! #########################
2928 SUBROUTINE elec_iaggs_b()
2929! #########################
2930!
2931!
2932! Purpose : compute charge separation process during the collision
2933! between ice and snow
2934!
2935!
2936!* 0. DECLARATIONS
2937! ------------
2938!
2939IMPLICIT NONE
2940!
2941!
2942!* 1. COMPUTE THE COLLISION EFFICIENCY
2943! --------------------------------
2944!
2945zqcolis(:) = zcolis * exp(zcolexis * (zzt(:) - cst%XTT))
2946!
2947zwq_ni(:) = 0.
2948zlimit(:) = 0.
2949!
2950!* 2. COMPUTE THE RATE OF SEPARATED CHARGE
2951! ------------------------------------
2952!
2953!* 2.1 Charging process following Helsdon and Farley (1987)
2954!
2955IF (cni_charging == 'HELFA') THEN
2956 !
2957 WHERE (zcit(:) > 0.0 .AND. &
2958 zrit(:) > xrtmin_elec(4) .AND. zrst(:) > xrtmin_elec(5))
2959 zwq_ni(:) = xfqiaggsbh * zriaggs(:) * zcit(:) / zrit(:)
2960 zwq_ni(:) = zwq_ni(:) * (1. - zqcolis(:)) / zqcolis(:)
2961!
2962! Temperature dependance of the charge transferred
2963 zwq_ni(:) = zwq_ni(:) * (zzt(:) - xqtc) / abs(zzt(:) - xqtc)
2964 zwq_ni(:) = zwq_ni(:) / zrhodref(:)
2965 END WHERE
2966!
2967ELSE
2968!
2969!
2970!* 2.2 Charging process following Gardiner et al. (1985)
2971!
2972 IF (cni_charging == 'GARDI') THEN
2973 WHERE (gelec(:,1) .AND. zdeltalwc(:) > 0.)
2974 zwq_ni(:) = xfqiaggsbg * (1 - zqcolis(:)) * &
2975 zrhodref(:)**(-4. * zcexvt + 4. / zbi) * &
2976 zcit(:)**(1 - 4. / zbi) * &
2977 zdeltalwc(:) * zft(:) * &
2978 zcst(:) * zlbdas(:)**(-2. - 4. * zds) * &
2979 (zai * momg(zalphai, znui, zbi) / &
2980 zrit(:))**(-4 / zbi)
2981 ENDWHERE
2982 END IF
2983!
2984!
2985!* 2.3 Charging process based on EW: SAUN1/SAUN2, TEEWC
2986!* following Saunders et al. (1991), Takahashi via Tsenova and Mitzeva (2009)
2987!
2988 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
2989 cni_charging == 'TEEWC') THEN
2990 WHERE (gelec(:,1) .AND. zdq(:) /= 0.)
2991 zwq_ni(:) = xfqiaggsbs * (1 - zqcolis(:)) * &
2992 zrhocor(:)**(1 + zsaunin(:)) * &
2993 zfqiaggs(:) * zdq(:) * &
2994 zcit(:)**(1 - zsaunim(:) / zbi) * &
2995 zcst(:) * zlbdas(:)**(-2.- zds * (1. + zsaunin(:))) * &
2996 (zrhodref(:) * zrit(:) / xaigammabi)**(zsaunim(:) / zbi)
2997 ENDWHERE
2998 END IF
2999!
3000!
3001!* 2.4 Charging process based on RAR (=EW*V): SAP98, BSMP1/BSMP2, TERAR
3002!* following Saunders and Peck (1998) or Brooks et al., 1997 (with/out anomalies)
3003!* or Takahashi via Tsenova and Mitzeva (2011)
3004!
3005 IF (cni_charging == 'SAP98' .OR. cni_charging == 'BSMP1' .OR. &
3006 cni_charging == 'BSMP2' .OR. cni_charging == 'TERAR') THEN
3007 IF (cni_charging /= 'TERAR') THEN
3008 zfqiaggs(:) = xfqiaggsp
3009 WHERE (zdq_is(:) < 0.)
3010 zfqiaggs(:) = xfqiaggsn
3011 ENDWHERE
3012 ELSE
3013 zfqiaggs(:) = xfqiaggsp_tak
3014 WHERE (zdq_is(:) < 0.)
3015 zfqiaggs(:) = xfqiaggsn_tak
3016 ENDWHERE
3017 ENDIF
3018!
3019 WHERE (gelec(:,1) .AND. zdq_is(:) /= 0.)
3020 zwq_ni(:) = xfqiaggsbs * (1 - zqcolis(:)) * &
3021 zrhocor(:)**(1 + zsaunin_is(:)) * &
3022 zfqiaggs(:) * zdq_is(:) * &
3023 zcit(:)**(1 - zsaunim_is(:) / zbi) * &
3024 zcst(:) * zlbdas(:)**(-2.- zds * (1. + zsaunin_is(:))) * &
3025 (zrhodref(:) * zrit(:) / xaigammabi)**(zsaunim_is(:) / zbi)
3026 ENDWHERE
3027 END IF
3028!
3029!
3030!* 2.5 Charging process following Takahashi (1978)
3031!
3032 IF (cni_charging == 'TAKAH') THEN
3033 WHERE (gelec(:,1) .AND. zdq(:) /= 0.)
3034 zwq_ni(:) = xfqiaggsbt1 * (1.0 - zqcolis(:)) * zrhocor(:) * &
3035 zcit(:) * zcst(:) * zdq(:) * &
3036 min( xfqiaggsbt2 / (zlbdas(:)**(2. + zds)) , &
3037 xfqiaggsbt3 * zrhocor(:) * zrhodref(:)**(2./zbi) * &
3038 zrit(:)**(2. / zbi) / &
3039 (zcit(:)**(2. / zbi) * zlbdas(:)**(2. + 2. * zds)))
3040 ENDWHERE
3041 END IF
3042!
3043!
3044!* 3. LIMITATION OF THE SEPARATED CHARGE
3045! ----------------------------------
3046!
3047! Dq is limited to XLIM_NI_IS
3048 WHERE (zwq_ni(:) .NE. 0.)
3049 zlimit(:) = xlim_ni_is * zriaggs(:) * zcit(:) * &
3050 (1 - zqcolis(:)) / (zrit(:) * zqcolis(:))
3051 zwq_ni(:) = sign( min( abs(zlimit(:)), abs(zwq_ni(:) ) ), zwq_ni(:) )
3052 zwq_ni(:) = zwq_ni(:) / zrhodref(:)
3053 ENDWHERE
3054!
3055! For temperatures lower than -30C --> linear interpolation
3056 WHERE (zwq_ni(:) /= 0. .AND. zzt(:) < (cst%XTT-30.) .AND. zzt(:) >= (cst%XTT-40.))
3057 zwq_ni(:) = zwq_ni(:) * (zzt(:) - cst%XTT + 40.) / 10.
3058 ENDWHERE
3059!
3060END IF
3061!
3062zqss(:) = zqss(:) + zwq_ni(:)
3063zqis(:) = zqis(:) - zwq_ni(:)
3064!
3065END SUBROUTINE elec_iaggs_b
3066!
3067!------------------------------------------------------------------
3068!
3069! #########################
3070 SUBROUTINE elec_idryg_b()
3071! #########################
3072!
3073!
3074! Purpose : compute charge separation process during the dry collision
3075! between ice and graupeln
3076!
3077!
3078!* 0. DECLARATIONS
3079! ------------
3080!
3081IMPLICIT NONE
3082!
3083!
3084!* 1. COMPUTE THE COLLISION EFFICIENCY
3085! --------------------------------
3086!
3087zqcolig(:) = zcolig * exp(zcolexig * (zzt(:) - cst%XTT))
3088!
3089zwq_ni(:) = 0.
3090zlimit(:) = 0.
3091!
3092!* 2. COMPUTE THE RATE OF SEPARATED CHARGE
3093! ------------------------------------
3094!
3095!* 2.1 Charging process following Helsdon and Farley (1987)
3096!
3097IF (cni_charging == 'HELFA') THEN
3098 !
3099 WHERE (zrit(:) > xrtmin_elec(4) .AND. zcit(:) > 0. .AND. &
3100 zrgt(:) > xrtmin_elec(6))
3101 zwq_ni(:) = xhidryg * zridryg(:) * zcit(:) / zrit(:)
3102 zwq_ni(:) = zwq_ni(:) * (1. - zqcolig(:)) / zqcolig(:) ! QIDRYG_boun
3103!
3104! Temperature dependance of the charge transfered
3105 zwq_ni(:) = zwq_ni(:) * (zzt(:) - xqtc) / abs(zzt(:) - xqtc)
3106 zwq_ni(:) = zwq_ni(:) / zrhodref(:)
3107 END WHERE
3108!
3109ELSE
3110!
3111!
3112!* 2.2 Charging process following Gardiner et al. (1985)
3113!
3114 IF (cni_charging == 'GARDI') THEN
3115 WHERE (gelec(:,2) .AND. zdeltalwc(:) > 0.)
3116 zwq_ni(:) = xfqidrygbg * xlbqidrygbg * (1 - zqcolig(:)) * &
3117 zrhodref(:)**(-4. * zcexvt + 4. / zbi) * &
3118 zcit(:)**(1 - 4. / zbi) * &
3119 zdeltalwc(:) * zft(:) * &
3120 zcgt(:) * zlbdag(:)**(-2. - 4. * zdg) * &
3121 (zai * momg(zalphai, znui, zbi) / &
3122 zrit(:))**(-4 / zbi)
3123 ENDWHERE
3124 END IF
3125!
3126!
3127!* 2.3 Charging process based on EW: SAUN1/SAUN2, TEEWC following
3128!* Saunders et al. (1991), Takahashi via Tsenova and Mitzeva(2009)
3129!
3130 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
3131 cni_charging == 'TEEWC') THEN
3132 WHERE (gelec(:,2) .AND. zdq(:) /= 0.)
3133 zwq_ni(:) = xfqidrygbs * (1. - zqcolig(:)) * &
3134 zrhocor(:)**(1. + zsaunin(:)) * &
3135 zfqidrygbs(:) * zdq(:) * &
3136 zcit(:)**(1. - zsaunim(:) / zbi) * &
3137 zcgt(:) * zlbdag(:)**(-2. - zdg * (1. + zsaunin(:))) * &
3138 (zrhodref(:) * zrit(:) / xaigammabi)**(zsaunim(:) / zbi)
3139 ENDWHERE
3140 END IF
3141!
3142!
3143!* 2.4 Charging process based on RAR (=EW*V): SAP98, BSMP1/BSMP2, TERAR
3144!* following Saunders and Peck (1998) or Brooks et al., 1997 (with/out anomalies)
3145!* or Takahashi via Tsenova and Mitzeva (2011)
3146!
3147 IF (cni_charging == 'SAP98' .OR. cni_charging == 'BSMP1' .OR. &
3148 cni_charging == 'BSMP2' .OR. cni_charging == 'TERAR') THEN
3149 IF (cni_charging /= 'TERAR') THEN
3150 zfqidrygbs(:) = xfqidrygbsp
3151 WHERE (zdq_ig(:) < 0.)
3152 zfqidrygbs(:) = xfqidrygbsn
3153 ENDWHERE
3154 ELSE
3155 zfqidrygbs(:) = xfqidrygbsp_tak
3156 WHERE (zdq_ig(:) <0.)
3157 zfqidrygbs(:) = xfqidrygbsn_tak
3158 ENDWHERE
3159 END IF
3160!
3161 WHERE (gelec(:,2) .AND. zdq_ig(:) /= 0.)
3162 zwq_ni(:) = xfqidrygbs * (1. - zqcolig(:)) * &
3163 zrhocor(:)**(1 + zsaunin_ig(:)) * &
3164 zfqidrygbs(:) * zdq_ig(:) * &
3165 zcit(:)**(1 - zsaunim_ig(:) / zbi) * &
3166 zcgt(:) * zlbdag(:)**(-2. - zdg * (1. + zsaunin_ig(:))) * &
3167 (zrhodref(:) * zrit(:) / xaigammabi)**(zsaunim_ig(:) / zbi)
3168 ENDWHERE
3169 END IF
3170!
3171!
3172!* 2.5 Charging process following Takahashi (1978)
3173!
3174 IF (cni_charging == 'TAKAH') THEN
3175 WHERE (gelec(:,2) .AND. zdq(:) /= 0.)
3176 zwq_ni(:) = xfqidrygbt1 * (1. - zqcolig(:)) * zrhocor(:) * &
3177 zcit(:) * zcgt(:) * zdq(:) * &
3178 min( xfqidrygbt2 / (zlbdag(:)**(2. + zdg)), &
3179 xfqidrygbt3 * zrhocor(:) * zrhodref(:)**(2./zbi) * &
3180 zrit(:)**(2. / zbi) / (zcit(:)**(2. / zbi) * &
3181 zlbdag(:)**(2. + 2. * zdg)) )
3182 ENDWHERE
3183 END IF
3184!
3185!
3186!* 3. LIMITATION OF THE SEPARATED CHARGE
3187! ----------------------------------
3188!
3189! Dq is limited to XLIM_NI_IG
3190 WHERE (zwq_ni(:) .NE. 0. .AND. zrit(:) > 0.)
3191 zlimit(:) = xlim_ni_ig * zridryg(:) * zcit(:) * (1 - zqcolig(:)) / &
3192 (zrit(:) * zqcolig(:))
3193 zwq_ni(:) = sign( min( abs(zlimit(:)), abs(zwq_ni(:) ) ), zwq_ni(:) )
3194 zwq_ni(:) = zwq_ni(:) / zrhodref(:)
3195 ENDWHERE
3196!
3197! For temperatures lower than -30C --> linear interpolation
3198 WHERE (zwq_ni(:) /= 0. .AND. zzt(:) < (cst%XTT-30.) .AND. zzt(:) >= (cst%XTT-40.))
3199 zwq_ni(:) = zwq_ni(:) * (zzt(:) - cst%XTT + 40.) / 10.
3200 ENDWHERE
3201!
3202END IF
3203!
3204WHERE (zridryg(:) > 0.)
3205 zqgs(:) = zqgs(:) + zwq_ni(:)
3206 zqis(:) = zqis(:) - zwq_ni(:)
3207END WHERE
3208!
3209END SUBROUTINE elec_idryg_b
3210!
3211!------------------------------------------------------------------
3212!
3213! #########################
3214 SUBROUTINE elec_sdryg_b()
3215! #########################
3216!
3217!
3218! Purpose : compute the charge separation during the dry collision
3219! between snow and graupel
3220!
3221!
3222!* 0. DECLARATIONS
3223! ------------
3224!
3225IMPLICIT NONE
3226!
3227!
3228!* 1. COMPUTE THE COLLECTION EFFICIENCY
3229! ---------------------------------
3230!
3231zqcolsg(:) = zcolsg * exp(zcolexsg * (zzt(:) - cst%XTT))
3232!
3233zwq_ni(:) = 0.
3234zlimit(:) = 0.
3235!
3236!* 2. COMPUTE THE RATE OF SEPARATED CHARGE
3237! ------------------------------------
3238!
3239!* 2.1 Charge separation following Helsdon and Farley (1987)
3240!
3241IF (cni_charging == 'HELFA') THEN
3242!
3243 WHERE (zrgt(:) > xrtmin_elec(6) .AND. zlbdag(:) > 0. .AND. &
3244 zrst(:) > xrtmin_elec(5) .AND. zlbdas(:) > 0.)
3245 zwq_ni(:) = zwq5(:,5) * xfqsdrygbh * zrhodref(:)**(-zcexvt) * &
3246 (1. - zqcolsg(:)) * &
3247 zcst(:) * zcgt(:) * &
3248 (xlbqsdrygb4h * zlbdas(:)**(-2.) + &
3249 xlbqsdrygb5h * zlbdas(:)**(-1.) * zlbdag(:)**(-1.) + &
3250 xlbqsdrygb6h * zlbdag(:)**(-2.))
3251!
3252! Temperature dependance of the charge transfered
3253 zwq_ni(:) = zwq_ni(:) * (zzt(:) - xqtc) / abs(zzt(:) - xqtc)
3254 zwq_ni(:) = zwq_ni(:) / zrhodref(:)
3255 ENDWHERE
3256!
3257ELSE
3258!
3259!
3260!* 2.2 Charge separation following Gardiner et al. (1985)
3261!
3262 IF (cni_charging == 'GARDI') THEN
3263 WHERE (gelec(:,3) .AND. zdeltalwc(:) > 0.)
3264 zwq_ni(:) = xfqsdrygbg * (1. - zqcolsg(:)) * &
3265 zrhodref(:)**(-4. * zcexvt) * &
3266 zft(:) * zdeltalwc(:) * &
3267 zcst(:) * zcgt(:) * &
3268 (xlbqsdrygb4g * zlbdas(:)**(-4.) * zlbdag(:)**(-2.) + &
3269 xlbqsdrygb5g * zlbdas(:)**(-5.) * zlbdag(:)**(-1.) + &
3270 xlbqsdrygb6g * zlbdas(:)**(-6.)) * &
3271 zwq5(:,5)
3272 ENDWHERE
3273 END IF
3274!
3275!
3276!* 2.3 Charging process based on EW: SAUN1/SAUN2, TEEWC following
3277!* Saunders et al. (1991), Takahashi via Tsenova and Mitzeva(2009)
3278!
3279 IF (cni_charging == 'SAUN1' .OR. cni_charging == 'SAUN2' .OR. &
3280 cni_charging == 'TEEWC') THEN
3281 WHERE (gelec(:,3) .AND. zdq(:) /= 0.)
3282! ZWQ_NI(:) = ZWQ5(:,6) If graupel gains positive charge ZDQ(:) > 0.
3283! ZWQ_NI(:) = ZWQ5(:,7) If graupel gains negative charge ZDQ(:) < 0.
3284 zwq_ni(:) = zwq5(:,6) * (0.5 + sign(0.5,zdq(:))) + &
3285 zwq5(:,7) * (0.5 - sign(0.5,zdq(:)))
3286!
3287 zwq_ni(:) = zwq_ni(:) * xfqsdrygbs * (1. - zqcolsg(:)) * &
3288 zrhocor(:)**(1. + zsaunsn(:)) * zsaunsk(:) * zdq(:) * &
3289 zcst(:) * zcgt(:) * &
3290 ( zlbqsdrygb1s(:) / (zlbdas(:)**zsaunsm(:) * zlbdag(:)**2) + &
3291 zlbqsdrygb2s(:) / (zlbdas(:)**( 1.+zsaunsm(:)) * zlbdag(:)) + &
3292 zlbqsdrygb3s(:) / zlbdas(:)**(2.+zsaunsm(:)) )
3293 ENDWHERE
3294 END IF
3295!
3296!
3297!* 2.4 Charging process based on RAR (=EW*V): SAP98, BSMP1/BSMP2, TERAR
3298!* following Saunders and Peck (1998) or Brooks et al., 1997 (with/out anomalies)
3299!* or Takahashi via Tsenova and Mitzeva (2011)
3300!
3301 IF (cni_charging == 'SAP98' .OR. cni_charging == 'BSMP1' .OR. &
3302 cni_charging == 'BSMP2' .OR. cni_charging == 'TERAR') THEN
3303 zlbqsdrygb1s(:) = xlbqsdrygb1sp
3304 zlbqsdrygb2s(:) = xlbqsdrygb2sp
3305 zlbqsdrygb3s(:) = xlbqsdrygb3sp
3306 WHERE (zdq_sg(:) < 0.)
3307 zlbqsdrygb1s(:) = xlbqsdrygb1sn
3308 zlbqsdrygb2s(:) = xlbqsdrygb2sn
3309 zlbqsdrygb3s(:) = xlbqsdrygb3sn
3310 ENDWHERE
3311!
3312 WHERE (gelec(:,3) .AND. zdq_sg(:) /= 0.)
3313 zwq_ni(:) = zwq5(:,6) * (0.5+sign(0.5,zdq_sg(:))) + &
3314 zwq5(:,7) * (0.5-sign(0.5,zdq_sg(:)))
3315!
3316 zwq_ni(:) = zwq_ni(:) * xfqsdrygbs * (1. - zqcolsg(:)) * &
3317 zrhocor(:)**(1. + zsaunsn_sg(:)) * zsaunsk_sg(:) * zdq_sg(:) * &
3318 zcst(:) * zcgt(:) * &
3319 (zlbqsdrygb1s(:) / (zlbdas(:)**zsaunsm_sg(:) * zlbdag(:)**2) + &
3320 zlbqsdrygb2s(:) / (zlbdas(:)**(1.+zsaunsm_sg(:)) * zlbdag(:)) + &
3321 zlbqsdrygb3s(:) / zlbdas(:)**(2.+zsaunsm_sg(:)) )
3322 ENDWHERE
3323 END IF
3324!
3325!
3326!* 2.5 Charging process following Takahashi (1978)
3327!
3328 IF (cni_charging == 'TAKAH') THEN
3329 WHERE (gelec(:,3) .AND. zdq(:) /= 0.)
3330 zwq_ni(:) = xfqsdrygbt1 * (1. - zqcolsg(:)) * zrhocor(:) * &
3331 zcgt(:) * zcst(:) * zdq(:) * &
3332 min(10. * ( &
3333 abs(xfqsdrygbt2 / (zlbdag(:)**zdg * zlbdas(:)**2.) - &
3334 xfqsdrygbt3 / (zlbdas(:)**(2. + zds))) + &
3335 abs(xfqsdrygbt4 / (zlbdag(:)**(2. + zdg)) - &
3336 xfqsdrygbt5 / (zlbdas(:)**zds * zlbdag(:)**2.)) + &
3337 abs(xfqsdrygbt6 / (zlbdag(:)**(1. + zdg) * zlbdas(:)) - &
3338 xfqsdrygbt7 / (zlbdas(:)**(1. + zds) * zlbdag(:)))), &
3339 xfqsdrygbt8 * zrhocor(:) * zwq5(:,5) * &
3340 (xfqsdrygbt9 / (zlbdas(:)**2. * zlbdag(:)**2.) + &
3341 xfqsdrygbt10 / (zlbdas(:)**4.) + &
3342 xfqsdrygbt11 / (zlbdas(:)**3. * zlbdag(:))))
3343 ENDWHERE
3344 END IF
3345!
3346!
3347!* 3. LIMITATION OF THE SEPARATED CHARGE
3348! ----------------------------------
3349!
3350! Dq is limited to XLIM_NI_SG
3351 WHERE (zwq_ni(:) .NE. 0.)
3352 zlimit(:) = xlim_ni_sg * zwq5(:,4) * xaux_lim * &
3353 zrhocor(:) * (1. - zqcolsg(:)) * &
3354 zcst(:) * zcgt(:) * &
3355 ( xaux_lim1 / zlbdas(:)**2 + &
3356 xaux_lim2 /(zlbdas(:) * zlbdag(:)) + &
3357 xaux_lim3 / zlbdag(:)**2 )
3358!
3359 zwq_ni(:) = sign( min( abs(zlimit(:)), abs(zwq_ni(:) ) ), zwq_ni(:) )
3360 zwq_ni(:) = zwq_ni(:) / zrhodref(:)
3361 ENDWHERE
3362!
3363! For temperatures lower than -30C --> linear interpolation
3364 WHERE (zwq_ni(:) /= 0. .AND. zzt(:) < (cst%XTT-30.) .AND. zzt(:) >= (cst%XTT-40.))
3365 zwq_ni(:) = zwq_ni(:) * (zzt(:) - cst%XTT + 40.) / 10.
3366 ENDWHERE
3367!
3368END IF
3369!
3370WHERE (zrsdryg(:) > 0.)
3371 zqgs(:) = zqgs(:) + zwq_ni(:)
3372 zqss(:) = zqss(:) - zwq_ni(:)
3373END WHERE
3374!
3375END SUBROUTINE elec_sdryg_b
3376!
3377!------------------------------------------------------------------
3378!
3379! #########################################################################
3380 SUBROUTINE compute_charge_transfer (PR_RATE, PRXT, PQXT, PTSTEP, &
3381 PRX_THRESH, PQX_THRESH, PCOEF_RQ_X, &
3382 PQ_RATE, PQXS, PQYS )
3383! #########################################################################
3384!
3385! Purpose : compute the charge transfer rate in proportion of the mass transfer rate
3386! x --> y
3387! q_rate_xy = r_rate_xy * coef_rq_x * qx_t / rx_t
3388!
3389!
3390!* 0. DECLARATIONS
3391! ------------
3392!
3393IMPLICIT NONE
3394!
3395!* 0.1 Declaration of dummy arguments
3396!
3397REAL, INTENT(IN), DIMENSION(:) :: PR_RATE ! Mass exchange rate from x to y
3398REAL, INTENT(IN), DIMENSION(:) :: PRXT ! Mixing ratio of x at t
3399REAL, INTENT(IN), DIMENSION(:) :: PQXT ! Electric charge of x at t
3400REAL, INTENT(IN) :: PRX_THRESH ! Threshold on mixing ratio
3401REAL, INTENT(IN) :: PQX_THRESH ! Threshold on electric charge
3402REAL, INTENT(IN) :: PCOEF_RQ_X ! Coefficient for charge exchange
3403REAL, INTENT(IN) :: PTSTEP ! Time step
3404REAL, INTENT(INOUT), DIMENSION(:) :: PQ_RATE ! Charge exchange rate from x to y
3405REAL, INTENT(INOUT), DIMENSION(:) :: PQXS ! Electric charge of x - source term
3406REAL, INTENT(INOUT), DIMENSION(:) :: PQYS ! Electric charge of y - source term
3407!
3408!
3409!* 0.2 Declaration of local variables
3410!
3411!
3412pq_rate(:) = 0.
3413!
3414WHERE (pr_rate(:) > 0. .AND. &
3415 prxt(:) > prx_thresh .AND. abs(pqxt(:)) > pqx_thresh)
3416! Compute the charge exchanged during the mass tranfer from species x to y
3417 pq_rate(:) = pcoef_rq_x * pr_rate(:) * pqxt(:) / prxt(:)
3418! Limit the charge exchanged to the charge available on x at t
3419 pq_rate(:) = sign( min( abs(pqxt(:)/ptstep),abs(pq_rate(:)) ), pqxt(:)/ptstep )
3420 !
3421! Update the source terms of x and y
3422 pqxs(:) = pqxs(:) - pq_rate(:)
3423 pqys(:) = pqys(:) + pq_rate(:)
3424END WHERE
3425!
3426END SUBROUTINE compute_charge_transfer
3427!
3428!------------------------------------------------------------------
3429!
3430! ###########################################################
3431 FUNCTION bi_lin_intp_v(ZT, KI, KJ, PDX, PDY, KN) RESULT(PY)
3432! ###########################################################
3433!
3434! Purpose :
3435!
3436! | |
3437! ZT(KI(1),KJ(2))-|-------------------|-ZT(KI(2),KJ(2))
3438! | |
3439! | |
3440! x2-|-------|y(x1,x2) |
3441! | | |
3442! PDY| | |
3443! | | |
3444! | | |
3445!ZT( KI(1),KJ(1))-|-------------------|-ZT(KI(2),KJ(1))
3446! | PDX |x1 |
3447! | |
3448!
3449!* 0. DECLARATIONS
3450! ------------
3451!
3452IMPLICIT NONE
3453!
3454!* 0.1 Declaration of dummy arguments
3455!
3456INTEGER, INTENT(IN) :: KN ! Size of the result vector
3457INTEGER, INTENT(IN), DIMENSION(KN) :: KI ! Tabulated coordinate
3458INTEGER, INTENT(IN), DIMENSION(KN) :: KJ ! Tabulated coordinate
3459REAL, INTENT(IN), DIMENSION(:,:) :: ZT ! Tabulated data
3460REAL, INTENT(IN), DIMENSION(KN) :: PDX, PDY !
3461!
3462REAL, DIMENSION(KN) :: PY ! Interpolated value
3463!
3464!* 0.2 Declaration of local variables
3465!
3466INTEGER :: JL ! Loop index
3467!
3468!
3469!* 1. INTERPOLATION
3470! -------------
3471!
3472DO jl = 1, kn
3473 py(jl) = (1.0 - pdx(jl)) * (1.0 - pdy(jl)) * zt(ki(jl), kj(jl)) + &
3474 pdx(jl) * (1.0 - pdy(jl)) * zt(ki(jl)+1,kj(jl)) + &
3475 pdx(jl) * pdy(jl) * zt(ki(jl)+1,kj(jl)+1) + &
3476 (1.0 - pdx(jl)) * pdy(jl) * zt(ki(jl) ,kj(jl)+1)
3477ENDDO
3478!
3479END FUNCTION bi_lin_intp_v
3480!
3481!------------------------------------------------------------------
3482!
3483include "gamma.h"
3484include "momg.h"
3485END SUBROUTINE elec_tendencies
3486END MODULE mode_elec_tendencies
subroutine elec_init_noind_gardi()
elemental real function momg(palpha, pnu, pp)
Definition momg.h:12
integer, parameter nbudget_sv1
character(len=5) cni_charging
real, dimension(:), allocatable, save xqtmin
real, dimension(:), allocatable xrtmin_elec
real, dimension(:,:,:), pointer xind_rate
real, dimension(:,:,:), pointer xni_idryg
real, dimension(:,:,:), pointer xni_iaggs
real, dimension(:,:,:), pointer xefieldw
real, dimension(:,:,:), pointer xew
real, dimension(:,:,:), pointer xni_sdryg
real, dimension(:,:), allocatable xker_q_sdrygb
real, dimension(:,:), allocatable xker_q_raccss
real, dimension(:,:), allocatable xker_q_sdrygb2
real, dimension(:,:), allocatable xker_q_sdrygb1
real, dimension(:,:), allocatable xker_q_saccrg
real, dimension(:,:), allocatable xker_q_raccs
real, dimension(:,:), allocatable xker_q_limsg
real, dimension(:), allocatable xgaminc_rim3
real, dimension(:,:), allocatable xmansell
real, dimension(:,:), allocatable xtaka_tm
real, dimension(:,:), allocatable xker_q_sdryg
real, pointer xesmin
real, dimension(:,:), allocatable xsaunder
real, dimension(:,:), allocatable xker_q_rdryg
integer, pointer nsv_elecend
Definition modd_nsv.F90:368
integer, pointer nsv_elecbeg
Definition modd_nsv.F90:368
subroutine compute_lambda(kid, kmoment, ksize, hcloud, prho, prtmin, prx, pcx, plbdx)
subroutine elec_compute_ex(kid, kmoment, ksize, hcloud, pdum, prho, prtmin, prx, pqx, pex, plbdx, pcx)
subroutine elec_tendencies(d, cst, iced, icep, elecd, elecp, limap, limac, limam, krr, kmicro, ptstep, odmicro, buconf, tbudgets, kbudgets, hcloud, pthvrefzikb, prhodref, prhodj, pzt, pcit, prvt, prct, prrt, prit, prst, prgt, pqpit, pqct, pqrt, pqit, pqst, pqgt, pqnit, pqpis, pqcs, pqrs, pqis, pqss, pqgs, pqnis, prvheni, prrhong, primltc, prchoni, prvdeps, priaggs, priauts, prvdepg, prcautr, prcaccr, prrevav, prcrimss, prcrimsg, prsrimcg, prraccss, prraccsg, prsaccrg, prsmltg, pricfrrg, prrcfrig, prcwetg, priwetg, prrwetg, prswetg, prcdryg, pridryg, prrdryg, prsdryg, prgmltr, prcberi, prcmltsr, pricfrr, pcct, pcrt, pcst, pcgt, prvhenc, prchinc, prvhonh, prrcvrc, pricnvi, prvdepi, prshmsi, prghmgi, pricibu, prirdsf, prccorr2, prrcorr2, pricorr2, prwetgh, prcweth, priweth, prsweth, prgweth, prrweth, prcdryh, pridryh, prsdryh, prrdryh, prgdryh, prhmltr, prdryhg, prht, pcht, pqht, pqhs)