PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
rain_ice_part3.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1995-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!-----------------------------------------------------------------
6! ######spl
7 SUBROUTINE rain_ice_part3 ( D, CST, PARAMI, ICEP, ICED, ELECP, ELECD, BUCONF, &
8 LIMAP, LIMAC, LIMAM, &
9 OELEC, OSEDIM_BEARD, PTHVREFZIKB, &
10 PTSTEP, KRR, &
11 PDZZ, PRHODJ, PRHODREF, PEXNREF, PPABST, PCIT, &
12 PTHT, PRT, PTHS, PRS, &
13 PINPRC, PINPRR, &
14 PINPRS, PINPRG, PINDEP, PRAINFR, &
15 TBUDGETS, KBUDGETS, &
16 PQPIT, PQCT, PQRT, PQIT, PQST, PQGT, PQNIT, &
17 PQPIS, PQCS, PQRS, PQIS, PQSS, PQGS, PQNIS, &
18 PEFIELDW, &
19 PSEA, PTOWN, &
20 PINPRH, PFPR, PQHT, PQHS, &
21 PT, PLVFACT, PLSFACT, PWR, PWTH, PCONC3D, PRVHENI, &
22 ZBUDGETS )
23
24!$ACDC singlecolumn --nocreate-interface
25
26! #############################################################################
27!!!**** * - compute the explicit microphysical sources
28!!
29!! PURPOSE
30!! -------
31!! The purpose of this routine is to compute the slow microphysical sources
32!! which can be computed explicitly
33!!
34!!
35!!** METHOD
36!! ------
37!! The autoconversion computation follows Kessler (1969).
38!! The sedimentation rate is computed with a time spliting technique and
39!! an upstream scheme, written as a difference of non-advective fluxes. This
40!! source term is added to the future instant ( split-implicit process ).
41!! The others microphysical processes are evaluated at the central instant
42!! (split-explicit process ): autoconversion, accretion and rain evaporation.
43!! These last 3 terms are bounded in order not to create negative values
44!! for the water species at the future instant.
45!!
46!! EXTERNAL
47!! --------
48!! None
49!!
50!!
51!! IMPLICIT ARGUMENTS
52!! ------------------
53!! Module MODD_CST
54!! XP00 ! Reference pressure
55!! XRD,XRV ! Gaz constant for dry air, vapor
56!! XMD,XMV ! Molecular weight for dry air, vapor
57!! XCPD ! Cpd (dry air)
58!! XCL ! Cl (liquid)
59!! XCI ! Ci (solid)
60!! XTT ! Triple point temperature
61!! XLVTT ! Vaporization heat constant
62!! XALPW,XBETAW,XGAMW ! Constants for saturation vapor pressure
63!! function over liquid water
64!! XALPI,XBETAI,XGAMI ! Constants for saturation vapor pressure
65!! function over solid ice
66!!
67!! REFERENCE
68!! ---------
69!!
70!! Book1 and Book2 of documentation ( routine RAIN_ICE )
71!!
72!! AUTHOR
73!! ------
74!! J.-P. Pinty * Laboratoire d'Aerologie*
75!!
76!! MODIFICATIONS
77!! -------------
78!! Original 02/11/95
79!! (J.Viviand) 04/02/97 debug accumulated prcipitation & convert
80!! precipitation rate in m/s
81!! (J.-P. Pinty) 17/02/97 add budget calls
82!! (J.-P. Pinty) 17/11/97 set ice sedim. for cirrus ice, reset RCHONI
83!! and RRHONG, reverse order for DEALLOCATE
84!! (J.-P. Pinty) 11/02/98 correction of the air dynamical viscosity and
85!! add advance of the budget calls
86!! (J.-P. Pinty) 18/05/98 correction of the air density in the RIAUTS
87!! process
88!! (J.-P. Pinty) 18/11/98 split the main routine
89!! (V. Masson) 18/11/98 bug in IVEC1 and IVEC2 upper limits
90!! (J. Escobar & J.-P. Pinty)
91!! 11/12/98 contains and rewrite count+pack
92!! (J. Stein & J.-P. Pinty)
93!! 14/10/99 correction for very small RIT
94!! (J. Escobar & J.-P. Pinty)
95!! 24/07/00 correction for very samll m.r. in
96!! the sedimentation subroutine
97!! (M. Tomasini) 11/05/01 Autoconversion of rc into rr modification to take
98!! into account the subgrid variance
99!! (cf Redelsperger & Sommeria JAS 86)
100!! (G. Molinie) 21/05/99 bug in RRCFRIG process, RHODREF**(-1) missing
101!! in RSRIMCG
102!! (G. Molinie & J.-P. Pinty)
103!! 21/06/99 bug in RACCS process
104!! (P. Jabouille) 27/05/04 safety test for case where esw/i(T)> pabs (~Z>40km)
105!! (J-.P. Chaboureau) 12/02/05 temperature depending ice-to-snow autocon-
106!! version threshold (Chaboureau and Pinty GRL 2006)
107!! (J.-P. Pinty) 01/01/O1 add the hail category and correction of the
108!! wet growth rate of the graupeln
109!! (S.Remy & C.Lac) 06/06 Add the cloud sedimentation
110!! (S.Remy & C.Lac) 06/06 Sedimentation becoming the last process
111!! to settle the precipitating species created during the current time step
112!! (S.Remy & C.Lac) 06/06 Modification of the algorithm of sedimentation
113!! to settle n times the precipitating species created during Dt/n instead
114!! of Dt
115!! (C.Lac) 11/06 Optimization of the sedimentation loop for NEC
116!! (J.Escobar) 18/01/2008 Parallel Bug in Budget when IMICRO >= 1
117!! --> Path inhibit this test by IMICRO >= 0 allway true
118!! (Y.Seity) 03/2008 Add Statistic sedimentation
119!! (Y.Seity) 10/2009 Added condition for the raindrop accretion of the aggregates
120!! into graupeln process (5.2.6) to avoid negative graupel mixing ratio
121!! (V.Masson, C.Lac) 09/2010 Correction in split sedimentation for
122!! reproducibility
123!! (S. Riette) Oct 2010 Better vectorisation of RAIN_ICE_SEDIMENTATION_STAT
124!! (Y. Seity), 02-2012 add possibility to run with reversed vertical levels
125!! (L. Bengtsson), 02-2013 Passing in land/sea mask and town fraction in
126!! order to use different cloud droplet number conc. over
127!! land, sea and urban areas in the cloud sedimentation.
128!! (D. Degrauwe), 2013-11: Export upper-air precipitation fluxes PFPR.
129!! (S. Riette) Nov 2013 Protection against null sigma
130!! (C. Lac) FIT temporal scheme : instant M removed
131!! (JP Pinty), 01-2014 : ICE4 : partial reconversion of hail to graupel
132!! July, 2015 (O.Nuissier/F.Duffourg) Add microphysics diagnostic for
133!! aircraft, ballon and profiler
134!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1
135!! C.Lac : 10/2016 : add droplet deposition
136!! C.Lac : 01/2017 : correction on droplet deposition
137!! J.Escobar : 10/2017 : for real*4 , limit exp() in RAIN_ICE_SLOW with XMNH_HUGE_12_LOG
138!! (C. Abiven, Y. Léauté, V. Seigner, S. Riette) Phasing of Turner rain subgrid param
139!! (S. Riette) Source code split into several files
140!! 02/2019 C.Lac add rain fraction as an output field
141!! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
142!! P. Wautelet 28/05/2019: move COUNTJV function to tools.f90
143!! P. Wautelet 29/05/2019: remove PACK/UNPACK intrinsics (to get more performance and better OpenACC support)
144!! P. Wautelet 17/01/2020: move Quicksort to tools.f90
145!! P. Wautelet 02/2020: use the new data structures and subroutines for budgets
146!! P. Wautelet 25/02/2020: bugfix: add missing budget: WETH_BU_RRG
147!! R. El Khatib 24-Aug-2021 Optimizations
148! J. Wurtz 03/2022: New snow characteristics with LSNOW_T
149! C. Barthe 03/2023: Add call to cloud electrification
150! C. Barthe 06/2023: Add retroaction of electric field on IAGGS
151! C. Barthe 07/2023: use new data structures for electricity
152!! S. Riette Sept 23: e from ice4_tendencies
153!-----------------------------------------------------------------
154!
155!* 0. DECLARATIONS
156! ------------
157!
158USE yomhook , ONLY : lhook, dr_hook, jphook
159
160USE modd_dimphyex, ONLY: dimphyex_t
163USE modd_cst, ONLY: cst_t
176
181
186
187IMPLICIT NONE
188!
189!* 0.1 Declarations of dummy arguments :
190!
191!
192!
193TYPE(dimphyex_t), INTENT(IN) :: D
194TYPE(cst_t), INTENT(IN) :: CST
195TYPE(param_ice_t), INTENT(IN) :: PARAMI
196TYPE(rain_ice_param_t), INTENT(IN) :: ICEP
197TYPE(rain_ice_descr_t), INTENT(IN) :: ICED
198TYPE(elec_param_t), INTENT(IN) :: ELECP ! electrical parameters
199TYPE(elec_descr_t), INTENT(IN) :: ELECD ! electrical descriptive csts
200TYPE(param_lima_t), INTENT(IN) :: LIMAP
201TYPE(param_lima_cold_t), INTENT(IN) :: LIMAC
202TYPE(param_lima_mixed_t), INTENT(IN) :: LIMAM
203TYPE(tbudgetconf_t), INTENT(IN) :: BUCONF
204LOGICAL, INTENT(IN) :: OELEC ! Switch for cloud electricity
205LOGICAL, INTENT(IN) :: OSEDIM_BEARD ! Switch for effect of electrical forces on sedim.
206REAL, INTENT(IN) :: PTHVREFZIKB ! Reference thv at IKB for electricity
207REAL, INTENT(IN) :: PTSTEP ! Double Time step (single if cold start)
208INTEGER, INTENT(IN) :: KRR ! Number of moist variable
209!
210REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PDZZ ! Layer thikness (m)
211REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
212REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODREF! Reference density
213REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEXNREF ! Reference Exner function
214REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PPABST ! absolute pressure at t
215!
216REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PCIT ! Pristine ice n.c. at t
217!
218REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTHT ! Theta at time t
219REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(IN) :: PRT ! m.r. at t
220!
221REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PTHS ! Theta source
222REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(INOUT) :: PRS ! m.r. source
223!
224REAL, DIMENSION(D%NIJT), INTENT(INOUT) :: PINPRC! Cloud instant precip
225REAL, DIMENSION(D%NIJT), INTENT(INOUT) :: PINPRR! Rain instant precip
226REAL, DIMENSION(D%NIJT), INTENT(INOUT) :: PINPRS! Snow instant precip
227REAL, DIMENSION(D%NIJT), INTENT(INOUT) :: PINPRG! Graupel instant precip
228REAL, DIMENSION(D%NIJT), INTENT(INOUT) :: PINDEP ! Cloud instant deposition
229REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRAINFR !Precipitation fraction
230!
231TYPE(tbudgetdata_ptr), DIMENSION(KBUDGETS), INTENT(INOUT) :: TBUDGETS
232INTEGER, INTENT(IN) :: KBUDGETS
233!
234! scalar variables for cloud electricity
235REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(IN) :: PQPIT ! Positive ion -
236REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQCT ! Cloud droplet |
237REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQRT ! Rain | electric
238REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQIT ! Ice crystals | charge
239REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQST ! Snow | at t
240REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQGT ! Graupel |
241REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(IN) :: PQNIT ! Negative ion -
242!
243REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQPIS ! Positive ion -
244REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQCS ! Cloud droplet |
245REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQRS ! Rain | electric
246REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQIS ! Ice crystals | charge
247REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQSS ! Snow | source
248REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQGS ! Graupel |
249REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQNIS ! Negative ion -
250!
251REAL, DIMENSION(MERGE(D%NIJT,0,OSEDIM_BEARD),MERGE(D%NKT,0,OSEDIM_BEARD)), OPTIONAL, INTENT(IN) :: PEFIELDW ! vertical elec. field
252!
253! optional variables
254REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PSEA ! Sea Mask
255REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PTOWN ! Fraction that is town
256REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(INOUT) :: PINPRH ! Hail instant precip
257REAL, DIMENSION(D%NIJT,D%NKT,KRR), OPTIONAL, INTENT(INOUT) :: PFPR ! upper-air precipitation fluxes
258REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQHT ! Hail electric charge at t
259REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQHS ! Hail electric charge source
260!
261! Bridge variables from part1/part2
262REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PT
263REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PLVFACT
264REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PLSFACT
265REAL, DIMENSION(D%NIJT,D%NKT,7), INTENT(INOUT) :: PWR
266REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PWTH
267REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PCONC3D
268REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRVHENI
269!
270! Budget array
271REAL, DIMENSION(MERGE(D%NIJT,0,OELEC .OR. BUCONF%LBU_ENABLE), & MERGE(D%NKT,0,OELEC .OR. BUCONF%LBU_ENABLE), & MERGE(IBUNUM-IBUNUM_EXTRA,0,OELEC .OR. BUCONF%LBU_ENABLE)), &
272 INTENT(INOUT) :: ZBUDGETS
273!
274!* 0.2 Local variables
275!
276REAL(KIND=jphook) :: zhook_handle
277INTEGER :: JIJ, JK, JM
278INTEGER :: IKTB, IKTE, IKB, IIJB, IIJE, IIJT
279REAL :: ZINV_TSTEP
280REAL, DIMENSION(D%NIJT,D%NKT) :: ZWKBUD
281LOGICAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)) :: GMASK_ELEC
282INTEGER :: IELEC
283!
284!-------------------------------------------------------------------------------
285IF (lhook) CALL dr_hook('RAIN_ICE_PART3', 0, zhook_handle)
286!
287iktb=d%NKTB
288ikte=d%NKTE
289ikb=d%NKB
290iijb=d%NIJB
291iije=d%NIJE
292iijt=d%NIJT
293zinv_tstep=1./ptstep
294!
295!
296!* 5. TENDENCIES COMPUTATION (budget part)
297! ----------------------
298!
299IF(buconf%LBU_ENABLE .OR. oelec) THEN
300 DO jk = iktb, ikte
301 DO jij = iijb, iije
302 DO jm = 1, ibunum-ibunum_extra
303 zbudgets(jij,jk,jm) = zbudgets(jij,jk,jm) * zinv_tstep
304 ENDDO
305 ENDDO
306 ENDDO
307ENDIF
308!
309IF(buconf%LBU_ENABLE) THEN
310 CALL ice4_budgets(d, parami, buconf, krr, &
311 plvfact, plsfact, prhodj, pexnref, &
312 prvheni, zbudgets, &
313 tbudgets, kbudgets)
314ENDIF
315!
316!-------------------------------------------------------------------------------
317!
318!* 7. CALL TO PHYSICAL PARAMETERIZATIONS CLOSELY LINKED TO MICROPHYSICS
319! -----------------------------------------------------------------
320!
321! Cloud electrification, water isotopes and aqueous chemistry need the mixing ratio tendencies
322! to compute the evolution of electric charges, water isotopes and ...
323!
324!* 7.1 Cloud electrification
325!
326IF (oelec) THEN
327 gmask_elec(:,:)=.false.
328 DO jk = iktb, ikte
329 DO jij = iijb, iije
330 DO jm = 1, ibunum-ibunum_extra
331 ! transfer of electric charges occurs only where transfer of mass is non null
332 gmask_elec(jij,jk) = gmask_elec(jij,jk) .OR. (zbudgets(jij,jk,jm) .NE. 0.)
333 END DO
334 END DO
335 END DO
336 !
337 ielec = count(gmask_elec)
338 !
339 IF (krr == 7) THEN
340 CALL elec_tendencies(d, cst, iced, icep, elecd, elecp, &
341 limap, limac, limam, &
342 krr, ielec, ptstep, gmask_elec, &
343 buconf, tbudgets, kbudgets, &
344 'ICE4', pthvrefzikb, prhodref, prhodj, pt, pcit, &
345 prt(:,:,irv), prt(:,:,irc), prt(:,:,irr), prt(:,:,iri), prt(:,:,irs), prt(:,:,irg), &
346 pqpit, pqct, pqrt, pqit, pqst, pqgt, pqnit, &
347 pqpis, pqcs, pqrs, pqis, pqss, pqgs, pqnis, &
348 zbudgets(:,:,irvheni_mr), zbudgets(:,:,irrhong_mr), &
349 zbudgets(:,:,irimltc_mr), zbudgets(:,:,irchoni), &
350 zbudgets(:,:,irvdeps), zbudgets(:,:,iriaggs), &
351 zbudgets(:,:,iriauts), zbudgets(:,:,irvdepg), &
352 zbudgets(:,:,ircautr), zbudgets(:,:,ircaccr), &
353 zbudgets(:,:,irrevav), zbudgets(:,:,ircrimss), &
354 zbudgets(:,:,ircrimsg), zbudgets(:,:,irsrimcg), &
355 zbudgets(:,:,irraccss), zbudgets(:,:,irraccsg), &
356 zbudgets(:,:,irsaccrg), zbudgets(:,:,irsmltg), &
357 zbudgets(:,:,iricfrrg), zbudgets(:,:,irrcfrig), &
358 zbudgets(:,:,ircwetg), zbudgets(:,:,iriwetg), &
359 zbudgets(:,:,irrwetg), zbudgets(:,:,irswetg), &
360 zbudgets(:,:,ircdryg), zbudgets(:,:,iridryg), &
361 zbudgets(:,:,irrdryg), zbudgets(:,:,irsdryg), &
362 zbudgets(:,:,irgmltr), zbudgets(:,:,ircberi), &
363 prcmltsr=zbudgets(:,:,ircmltsr), pricfrr=zbudgets(:,:,iricfrr),&
364 prwetgh=zbudgets(:,:,irwetgh), &
365 prcweth=zbudgets(:,:,ircweth), priweth=zbudgets(:,:,iriweth), &
366 prsweth=zbudgets(:,:,irsweth), &
367 prgweth=zbudgets(:,:,irgweth), prrweth=zbudgets(:,:,irrweth), &
368 prcdryh=zbudgets(:,:,ircdryh), pridryh=zbudgets(:,:,iridryh), &
369 prsdryh=zbudgets(:,:,irsdryh), &
370 prrdryh=zbudgets(:,:,irrdryh), prgdryh=zbudgets(:,:,irgdryh), &
371 prdryhg=zbudgets(:,:,irdryhg), prhmltr=zbudgets(:,:,irhmltr), &
372 prht=prt(:,:,irh), pqht=pqht, pqhs=pqhs )
373 ELSE
374 CALL elec_tendencies(d, cst, iced, icep, elecd, elecp, &
375 limap, limac, limam, &
376 krr, ielec, ptstep, gmask_elec, &
377 buconf, tbudgets, kbudgets, &
378 'ICE3', pthvrefzikb, prhodref, prhodj, pt, pcit, &
379 prt(:,:,irv), prt(:,:,irc), prt(:,:,irr), prt(:,:,iri), prt(:,:,irs), prt(:,:,irg), &
380 pqpit, pqct, pqrt, pqit, pqst, pqgt, pqnit, &
381 pqpis, pqcs, pqrs, pqis, pqss, pqgs, pqnis, &
382 zbudgets(:,:,irvheni_mr), zbudgets(:,:,irrhong_mr), &
383 zbudgets(:,:,irimltc_mr), zbudgets(:,:,irchoni), &
384 zbudgets(:,:,irvdeps), zbudgets(:,:,iriaggs), &
385 zbudgets(:,:,iriauts), zbudgets(:,:,irvdepg), &
386 zbudgets(:,:,ircautr), zbudgets(:,:,ircaccr), &
387 zbudgets(:,:,irrevav), zbudgets(:,:,ircrimss), &
388 zbudgets(:,:,ircrimsg), zbudgets(:,:,irsrimcg), &
389 zbudgets(:,:,irraccss), zbudgets(:,:,irraccsg), &
390 zbudgets(:,:,irsaccrg), zbudgets(:,:,irsmltg), &
391 zbudgets(:,:,iricfrrg), zbudgets(:,:,irrcfrig), &
392 zbudgets(:,:,ircwetg), zbudgets(:,:,iriwetg), &
393 zbudgets(:,:,irrwetg), zbudgets(:,:,irswetg), &
394 zbudgets(:,:,ircdryg), zbudgets(:,:,iridryg), &
395 zbudgets(:,:,irrdryg), zbudgets(:,:,irsdryg), &
396 zbudgets(:,:,irgmltr), zbudgets(:,:,ircberi), &
397 prcmltsr=zbudgets(:,:,ircmltsr), pricfrr=zbudgets(:,:,iricfrr))
398 END IF
399END IF
400!
401!
402!* 7.2 Water isotopologues
403!
404!
405!* 7.3 Aqueous chemistry
406!
407!
408!-------------------------------------------------------------------------------
409!
410!* 8. TOTAL TENDENCIES
411! ----------------
412!
413!
414!*** 8.1 total tendencies limited by available species
415!
416!$acc kernels
417!$acc loop independent collapse(2)
418DO jk = iktb, ikte
419 DO jij=iijb, iije
420 !LV/LS
421 plsfact(jij,jk)=plsfact(jij,jk)/pexnref(jij,jk)
422 plvfact(jij,jk)=plvfact(jij,jk)/pexnref(jij,jk)
423
424 !Hydrometeor tendencies is the difference between new state and old state (can be negative)
425 pwr(jij,jk,irv)=(pwr(jij,jk,irv)-prt(jij,jk,irv))*zinv_tstep
426 pwr(jij,jk,irc)=(pwr(jij,jk,irc)-prt(jij,jk,irc))*zinv_tstep
427 pwr(jij,jk,irr)=(pwr(jij,jk,irr)-prt(jij,jk,irr))*zinv_tstep
428 pwr(jij,jk,iri)=(pwr(jij,jk,iri)-prt(jij,jk,iri))*zinv_tstep
429 pwr(jij,jk,irs)=(pwr(jij,jk,irs)-prt(jij,jk,irs))*zinv_tstep
430 pwr(jij,jk,irg)=(pwr(jij,jk,irg)-prt(jij,jk,irg))*zinv_tstep
431 IF(krr==7) THEN
432 pwr(jij,jk,irh)=(pwr(jij,jk,irh)-prt(jij,jk,irh))*zinv_tstep
433 ENDIF
434
435 !Theta tendency computed from hydrometeors tendencies
436 pwth(jij,jk) = (pwr(jij,jk,irc)+pwr(jij,jk,irr))*plvfact(jij,jk)+ &
437 & (pwr(jij,jk,iri)+pwr(jij,jk,irs)+pwr(jij,jk,irg)+ &
438 & pwr(jij,jk,irh))*plsfact(jij,jk)
439
440 !We apply these tendencies to the S variables
441 !including the nucleation part
442 pths(jij,jk) = pths(jij,jk) + pwth(jij,jk)+prvheni(jij,jk)*plsfact(jij,jk)
443 prs(jij,jk,irv) = prs(jij,jk,irv) + pwr(jij,jk,irv)-prvheni(jij,jk)
444 prs(jij,jk,irc) = prs(jij,jk,irc) + pwr(jij,jk,irc)
445 prs(jij,jk,irr) = prs(jij,jk,irr) + pwr(jij,jk,irr)
446 prs(jij,jk,iri) = prs(jij,jk,iri) + pwr(jij,jk,iri)+prvheni(jij,jk)
447 prs(jij,jk,irs) = prs(jij,jk,irs) + pwr(jij,jk,irs)
448 prs(jij,jk,irg) = prs(jij,jk,irg) + pwr(jij,jk,irg)
449 IF (krr==7) THEN
450 prs(jij,jk,irh) = prs(jij,jk,irh) + pwr(jij,jk,irh)
451 ENDIF
452 ENDDO
453ENDDO
454!$acc end kernels
455!-------------------------------------------------------------------------------
456!
457!*** 8.2 Negative corrections
458!
459!NOTE:
460! This call cannot be moved before the preeceding budget calls because,
461! with AROME, the BUDGET_STORE_INIT does nothing. The equivalent is done only
462! once before the physics call and copies of the S variables evolve automatically
463! internally to the budget (DDH) machinery at each BUDGET_STORE_ADD and
464! BUDGET_STORE_END calls. Thus, the difference between the DDH internal version
465! of the S variables and the S variables used in the folowing BUDGET_STORE_END
466! call must only be due to the correction of negativities.
467!
468IF(buconf%LBU_ENABLE) THEN
469 IF (buconf%LBUDGET_TH) zwkbud(:, :) = pths(:, :)*prhodj(:, :)
470 IF (buconf%LBUDGET_TH) CALL tbudgets(nbudget_th)%PTR%INIT_PHY(d, 'CORR', zwkbud)
471 IF (buconf%LBUDGET_RV) zwkbud(:, :) = prs(:, :, irv)*prhodj(:, :)
472 IF (buconf%LBUDGET_RV) CALL tbudgets(nbudget_rv)%PTR%INIT_PHY(d, 'CORR', zwkbud)
473 IF (buconf%LBUDGET_RC) zwkbud(:, :) = prs(:, :, irc)*prhodj(:, :)
474 IF (buconf%LBUDGET_RC) CALL tbudgets(nbudget_rc)%PTR%INIT_PHY(d, 'CORR', zwkbud)
475 IF (buconf%LBUDGET_RR) zwkbud(:, :) = prs(:, :, irr)*prhodj(:, :)
476 IF (buconf%LBUDGET_RR) CALL tbudgets(nbudget_rr)%PTR%INIT_PHY(d, 'CORR', zwkbud)
477 IF (buconf%LBUDGET_RI) zwkbud(:, :) = prs(:, :, iri)*prhodj(:, :)
478 IF (buconf%LBUDGET_RI) CALL tbudgets(nbudget_ri)%PTR%INIT_PHY(d, 'CORR', zwkbud)
479 IF (buconf%LBUDGET_RS) zwkbud(:, :) = prs(:, :, irs)*prhodj(:, :)
480 IF (buconf%LBUDGET_RS) CALL tbudgets(nbudget_rs)%PTR%INIT_PHY(d, 'CORR', zwkbud)
481 IF (buconf%LBUDGET_RG) zwkbud(:, :) = prs(:, :, irg)*prhodj(:, :)
482 IF (buconf%LBUDGET_RG) CALL tbudgets(nbudget_rg)%PTR%INIT_PHY(d, 'CORR', zwkbud)
483 IF (buconf%LBUDGET_RH .AND. krr==7) zwkbud(:, :) = prs(:, :, irh)*prhodj(:, :)
484 IF (buconf%LBUDGET_RH .AND. krr==7) CALL tbudgets(nbudget_rh)%PTR%INIT_PHY(d, 'CORR', zwkbud)
485END IF
486!++cb-- ajouter les bilans pour l'elec !!!
487
488!We correct negativities with conservation
489CALL ice4_correct_negativities(d, iced, krr, prs, &
490 &pths, plvfact, plsfact)
491
492IF (buconf%LBU_ENABLE) THEN
493 IF (buconf%LBUDGET_TH) zwkbud(:, :) = pths(:, :)*prhodj(:, :)
494 IF (buconf%LBUDGET_TH) CALL tbudgets(nbudget_th)%PTR%END_PHY(d, 'CORR', zwkbud)
495 IF (buconf%LBUDGET_RV) zwkbud(:, :) = prs(:, :, irv)*prhodj(:, :)
496 IF (buconf%LBUDGET_RV) CALL tbudgets(nbudget_rv)%PTR%END_PHY(d, 'CORR', zwkbud)
497 IF (buconf%LBUDGET_RC) zwkbud(:, :) = prs(:, :, irc)*prhodj(:, :)
498 IF (buconf%LBUDGET_RC) CALL tbudgets(nbudget_rc)%PTR%END_PHY(d, 'CORR', zwkbud)
499 IF (buconf%LBUDGET_RR) zwkbud(:, :) = prs(:, :, irr)*prhodj(:, :)
500 IF (buconf%LBUDGET_RR) CALL tbudgets(nbudget_rr)%PTR%END_PHY(d, 'CORR', zwkbud)
501 IF (buconf%LBUDGET_RI) zwkbud(:, :) = prs(:, :, iri)*prhodj(:, :)
502 IF (buconf%LBUDGET_RI) CALL tbudgets(nbudget_ri)%PTR%END_PHY(d, 'CORR', zwkbud)
503 IF (buconf%LBUDGET_RS) zwkbud(:, :) = prs(:, :, irs)*prhodj(:, :)
504 IF (buconf%LBUDGET_RS) CALL tbudgets(nbudget_rs)%PTR%END_PHY(d, 'CORR', zwkbud)
505 IF (buconf%LBUDGET_RG) zwkbud(:, :) = prs(:, :, irg)*prhodj(:, :)
506 IF (buconf%LBUDGET_RG) CALL tbudgets(nbudget_rg)%PTR%END_PHY(d, 'CORR', zwkbud)
507 IF (buconf%LBUDGET_RH .AND. krr==7) zwkbud(:, :) = prs(:, :, irh)*prhodj(:, :)
508 IF (buconf%LBUDGET_RH .AND. krr==7) CALL tbudgets(nbudget_rh)%PTR%END_PHY(d, 'CORR', zwkbud)
509END IF
510!
511!-------------------------------------------------------------------------------
512!
513!* 9. COMPUTE THE SEDIMENTATION (RS) SOURCE
514! -------------------------------------
515!
516IF(parami%LSEDIM_AFTER) THEN
517 CALL ice4_sedimentation(d, cst, icep, iced, parami, elecp, elecd, buconf, &
518 &oelec, osedim_beard, ptstep, krr, pdzz, pthvrefzikb, &
519 &plvfact, plsfact, prhodref, ppabst, ptht, pt, prhodj, &
520 &pths, prt, prs, pconc3d, &
521 &pinprc, pinprr, pinprs, pinprg, &
522 &pqct, pqrt, pqit, pqst, pqgt, pqcs, pqrs, pqis, pqss, pqgs, pefieldw, &
523 &tbudgets, kbudgets, &
524 &psea=psea, ptown=ptown, &
525 &pinprh=pinprh, pfpr=pfpr, &
526 &pqht=pqht, pqhs=pqhs)
527
528 !"sedimentation" of rain fraction
529!$acc kernels
530!$acc loop independent collapse(2)
531 DO jk = iktb, ikte
532 DO jij=iijb,iije
533 pwr(jij,jk,irr)=prs(jij,jk,irr)*ptstep
534 pwr(jij,jk,irs)=prs(jij,jk,irs)*ptstep
535 pwr(jij,jk,irg)=prs(jij,jk,irg)*ptstep
536 IF(krr==7) THEN
537 pwr(jij,jk,irh)=prs(jij,jk,irh)*ptstep
538 ENDIF
539 ENDDO
540 ENDDO
541!$acc end kernels
542 IF (krr==7) THEN
543 CALL ice4_rainfr_vert(d, iced, prainfr, pwr(:,:,irr), &
544 &pwr(:,:,irs), pwr(:,:,irg), pwr(:,:,irh))
545 ELSE
546 CALL ice4_rainfr_vert(d, iced, prainfr, pwr(:,:,irr), &
547 &pwr(:,:,irs), pwr(:,:,irg))
548 ENDIF
549ENDIF
550!
551!-------------------------------------------------------------------------------
552!
553!* 10. COMPUTE THE FOG DEPOSITION TERM
554! -------------------------------------
555!
556IF (parami%LDEPOSC) THEN !cloud water deposition on vegetation
557 IF (buconf%LBU_ENABLE .AND. buconf%LBUDGET_RC) zwkbud(:, :) = prs(:, :, irc)*prhodj(:, :)
558 IF (buconf%LBU_ENABLE .AND. buconf%LBUDGET_RC) &
559 & CALL tbudgets(nbudget_rc)%PTR%INIT_PHY(d, 'DEPO', zwkbud)
560!$acc kernels
561 pindep(:)=0.
562!DEC$ IVDEP
563!$acc loop independent
564 DO jij = iijb, iije
565 pindep(jij) = parami%XVDEPOSC * prt(jij, ikb, irc) * prhodref(jij, ikb) / cst%XRHOLW
566 prs(jij, ikb,irc) = prs(jij, ikb, irc) - parami%XVDEPOSC * prt(jij, ikb, irc) / pdzz(jij, ikb)
567 pinprc(jij) = pinprc(jij) + pindep(jij)
568 ENDDO
569!$acc end kernels
570
571 IF (buconf%LBU_ENABLE .AND. buconf%LBUDGET_RC) zwkbud(:, :) = prs(:, :, irc)*prhodj(:, :)
572 IF (buconf%LBU_ENABLE .AND. buconf%LBUDGET_RC) &
573 & CALL tbudgets(nbudget_rc)%PTR%END_PHY(d, 'DEPO', zwkbud)
574ENDIF
575!
576IF (lhook) CALL dr_hook('RAIN_ICE_PART3', 1, zhook_handle)
577!
578END SUBROUTINE rain_ice_part3
579
integer, parameter nbudget_rv
integer, parameter nbudget_rh
integer, parameter nbudget_th
integer, parameter nbudget_rs
integer, parameter nbudget_ri
integer, parameter nbudget_rc
integer, parameter nbudget_rr
integer, parameter nbudget_rg
integer, parameter irswetg
integer, parameter ircautr
integer, parameter irrevav
integer, parameter irhmltr
integer, parameter irsdryg
integer, parameter irvdepg
integer, parameter ircdryg
integer, parameter ircrimsg
integer, parameter iridryg
integer, parameter irsweth
integer, parameter irsmltg
integer, parameter iriweth
integer, parameter ircwetg
integer, parameter ircweth
integer, parameter ircmltsr
integer, parameter irimltc_mr
integer, parameter irraccss
integer, parameter irrdryg
integer, parameter ircrimss
integer, parameter irrweth
integer, parameter iriaggs
integer, parameter irrcfrig
integer, parameter irvheni_mr
integer, parameter irraccsg
integer, parameter irsaccrg
integer, parameter irsdryh
integer, parameter irwetgh
integer, parameter irgdryh
integer, parameter irrhong_mr
integer, parameter irdryhg
integer, parameter irchoni
integer, parameter irgmltr
integer, parameter iricfrr
integer, parameter irgweth
integer, parameter ibunum_extra
integer, parameter irrwetg
integer, parameter iriauts
integer, parameter iricfrrg
integer, parameter iriwetg
integer, parameter ibunum
integer, parameter irsrimcg
integer, parameter irrdryh
integer, parameter irvdeps
integer, parameter ircaccr
integer, parameter ircberi
integer, parameter iridryh
integer, parameter ircdryh
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)
subroutine ice4_budgets(d, parami, buconf, krr, plvfact, plsfact, prhodj, pexnref, prvheni, pbudgets, tbudgets, kbudgets)
subroutine ice4_correct_negativities(d, iced, krr, pr, pth, plvfact, plsfact)
subroutine ice4_rainfr_vert(d, iced, pprfr, prr, prs, prg, prh)
subroutine ice4_sedimentation(d, cst, icep, iced, parami, elecp, elecd, buconf, oelec, osedim_beard, ptstep, krr, pdzz, pthvrefzikb, plvfact, plsfact, prhodref, ppabst, ptht, pt, prhodj, pths, prt, prs, pconc3d, pinprc, pinprr, pinprs, pinprg, pqct, pqrt, pqit, pqst, pqgt, pqcs, pqrs, pqis, pqss, pqgs, pefieldw, tbudgets, kbudgets, psea, ptown, pinprh, pfpr, pqht, pqhs)
subroutine rain_ice_part3(d, cst, parami, icep, iced, elecp, elecd, buconf, limap, limac, limam, oelec, osedim_beard, pthvrefzikb, ptstep, krr, pdzz, prhodj, prhodref, pexnref, ppabst, pcit, ptht, prt, pths, prs, pinprc, pinprr, pinprs, pinprg, pindep, prainfr, tbudgets, kbudgets, pqpit, pqct, pqrt, pqit, pqst, pqgt, pqnit, pqpis, pqcs, pqrs, pqis, pqss, pqgs, pqnis, pefieldw, psea, ptown, pinprh, pfpr, pqht, pqhs, pt, plvfact, plsfact, pwr, pwth, pconc3d, prvheni, zbudgets)