PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
rain_ice_part1.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_part1 ( D, CST, PARAMI, ICEP, ICED, ELECP, ELECD, BUCONF, &
8 OELEC, OSEDIM_BEARD, PTHVREFZIKB, &
9 PTSTEP, KRR, PEXN, &
10 PDZZ, PRHODJ, PRHODREF, PPABST, PCIT, PCLDFR, &
11 PICLDFR, PSSIO, &
12 PHLC_HRC, PHLC_HCF, PHLI_HRI, PHLI_HCF, &
13 PTHT, PRT, PTHS, PRS, &
14 PINPRC, PINPRR, PEVAP3D, &
15 PINPRS, PINPRG, PRAINFR, PSIGS, &
16 PRCRIAUTI, PRCRIAUTC, &
17 TBUDGETS, KBUDGETS, &
18 PQCT, PQRT, PQIT, PQST, PQGT, &
19 PQCS, PQRS, PQIS, PQSS, PQGS, &
20 PEFIELDW, &
21 PSEA, PTOWN, PCONC3D, &
22 PINPRH, PFPR, PQHT, PQHS, &
23 PT, PLVFACT, PLSFACT, PWR, PWTH, PZCONC3D, OMICRO, &
24 PRVHENI, PZZZZ )
25
26!$ACDC singlecolumn --nocreate-interface
27
28! #############################################################################
29!
30!!**** * - compute the explicit microphysical sources
31!!
32!! PURPOSE
33!! -------
34!! The purpose of this routine is to compute the slow microphysical sources
35!! which can be computed explicitly
36!!
37!!
38!!** METHOD
39!! ------
40!! The autoconversion computation follows Kessler (1969).
41!! The sedimentation rate is computed with a time spliting technique and
42!! an upstream scheme, written as a difference of non-advective fluxes. This
43!! source term is added to the future instant ( split-implicit process ).
44!! The others microphysical processes are evaluated at the central instant
45!! (split-explicit process ): autoconversion, accretion and rain evaporation.
46!! These last 3 terms are bounded in order not to create negative values
47!! for the water species at the future instant.
48!!
49!! EXTERNAL
50!! --------
51!! None
52!!
53!!
54!! IMPLICIT ARGUMENTS
55!! ------------------
56!! Module MODD_CST
57!! XP00 ! Reference pressure
58!! XRD,XRV ! Gaz constant for dry air, vapor
59!! XMD,XMV ! Molecular weight for dry air, vapor
60!! XCPD ! Cpd (dry air)
61!! XCL ! Cl (liquid)
62!! XCI ! Ci (solid)
63!! XTT ! Triple point temperature
64!! XLVTT ! Vaporization heat constant
65!! XALPW,XBETAW,XGAMW ! Constants for saturation vapor pressure
66!! function over liquid water
67!! XALPI,XBETAI,XGAMI ! Constants for saturation vapor pressure
68!! function over solid ice
69!!
70!! REFERENCE
71!! ---------
72!!
73!! Book1 and Book2 of documentation ( routine RAIN_ICE )
74!!
75!! AUTHOR
76!! ------
77!! J.-P. Pinty * Laboratoire d'Aerologie*
78!!
79!! MODIFICATIONS
80!! -------------
81!! Original 02/11/95
82!! (J.Viviand) 04/02/97 debug accumulated prcipitation & convert
83!! precipitation rate in m/s
84!! (J.-P. Pinty) 17/02/97 add budget calls
85!! (J.-P. Pinty) 17/11/97 set ice sedim. for cirrus ice, reset RCHONI
86!! and RRHONG, reverse order for DEALLOCATE
87!! (J.-P. Pinty) 11/02/98 correction of the air dynamical viscosity and
88!! add advance of the budget calls
89!! (J.-P. Pinty) 18/05/98 correction of the air density in the RIAUTS
90!! process
91!! (J.-P. Pinty) 18/11/98 split the main routine
92!! (V. Masson) 18/11/98 bug in IVEC1 and IVEC2 upper limits
93!! (J. Escobar & J.-P. Pinty)
94!! 11/12/98 contains and rewrite count+pack
95!! (J. Stein & J.-P. Pinty)
96!! 14/10/99 correction for very small RIT
97!! (J. Escobar & J.-P. Pinty)
98!! 24/07/00 correction for very samll m.r. in
99!! the sedimentation subroutine
100!! (M. Tomasini) 11/05/01 Autoconversion of rc into rr modification to take
101!! into account the subgrid variance
102!! (cf Redelsperger & Sommeria JAS 86)
103!! (G. Molinie) 21/05/99 bug in RRCFRIG process, RHODREF**(-1) missing
104!! in RSRIMCG
105!! (G. Molinie & J.-P. Pinty)
106!! 21/06/99 bug in RACCS process
107!! (P. Jabouille) 27/05/04 safety test for case where esw/i(T)> pabs (~Z>40km)
108!! (J-.P. Chaboureau) 12/02/05 temperature depending ice-to-snow autocon-
109!! version threshold (Chaboureau and Pinty GRL 2006)
110!! (J.-P. Pinty) 01/01/O1 add the hail category and correction of the
111!! wet growth rate of the graupeln
112!! (S.Remy & C.Lac) 06/06 Add the cloud sedimentation
113!! (S.Remy & C.Lac) 06/06 Sedimentation becoming the last process
114!! to settle the precipitating species created during the current time step
115!! (S.Remy & C.Lac) 06/06 Modification of the algorithm of sedimentation
116!! to settle n times the precipitating species created during Dt/n instead
117!! of Dt
118!! (C.Lac) 11/06 Optimization of the sedimentation loop for NEC
119!! (J.Escobar) 18/01/2008 Parallel Bug in Budget when IMICRO >= 1
120!! --> Path inhibit this test by IMICRO >= 0 allway true
121!! (Y.Seity) 03/2008 Add Statistic sedimentation
122!! (Y.Seity) 10/2009 Added condition for the raindrop accretion of the aggregates
123!! into graupeln process (5.2.6) to avoid negative graupel mixing ratio
124!! (V.Masson, C.Lac) 09/2010 Correction in split sedimentation for
125!! reproducibility
126!! (S. Riette) Oct 2010 Better vectorisation of RAIN_ICE_SEDIMENTATION_STAT
127!! (Y. Seity), 02-2012 add possibility to run with reversed vertical levels
128!! (L. Bengtsson), 02-2013 Passing in land/sea mask and town fraction in
129!! order to use different cloud droplet number conc. over
130!! land, sea and urban areas in the cloud sedimentation.
131!! (D. Degrauwe), 2013-11: Export upper-air precipitation fluxes PFPR.
132!! (S. Riette) Nov 2013 Protection against null sigma
133!! (C. Lac) FIT temporal scheme : instant M removed
134!! (JP Pinty), 01-2014 : ICE4 : partial reconversion of hail to graupel
135!! July, 2015 (O.Nuissier/F.Duffourg) Add microphysics diagnostic for
136!! aircraft, ballon and profiler
137!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1
138!! C.Lac : 10/2016 : add droplet deposition
139!! C.Lac : 01/2017 : correction on droplet deposition
140!! J.Escobar : 10/2017 : for real*4 , limit exp() in RAIN_ICE_SLOW with XMNH_HUGE_12_LOG
141!! (C. Abiven, Y. Léauté, V. Seigner, S. Riette) Phasing of Turner rain subgrid param
142!! (S. Riette) Source code split into several files
143!! 02/2019 C.Lac add rain fraction as an output field
144!! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
145!! P. Wautelet 28/05/2019: move COUNTJV function to tools.f90
146!! P. Wautelet 29/05/2019: remove PACK/UNPACK intrinsics (to get more performance and better OpenACC support)
147!! P. Wautelet 17/01/2020: move Quicksort to tools.f90
148!! P. Wautelet 02/2020: use the new data structures and subroutines for budgets
149!! P. Wautelet 25/02/2020: bugfix: add missing budget: WETH_BU_RRG
150!! R. El Khatib 24-Aug-2021 Optimizations
151! J. Wurtz 03/2022: New snow characteristics with LSNOW_T
152! C. Barthe 03/2023: Add call to cloud electrification
153! C. Barthe 06/2023: Add retroaction of electric field on IAGGS
154! C. Barthe 07/2023: use new data structures for electricity
155!! S. Riette Sept 23: e from ice4_tendencies
156!-----------------------------------------------------------------
157!
158!* 0. DECLARATIONS
159! ------------
160!
161USE yomhook , ONLY : lhook, dr_hook, jphook
162
163USE modd_dimphyex, ONLY: dimphyex_t
165USE modd_cst, ONLY: cst_t
171USE modd_fields_address, ONLY: irc, irg, irh, iri, irr, irs, irv
172
173USE mode_msg, ONLY: print_msg
174
177USE modd_io, ONLY:nverb_fatal
178
179IMPLICIT NONE
180!
181!* 0.1 Declarations of dummy arguments :
182!
183!
184!
185TYPE(dimphyex_t), INTENT(IN) :: D
186TYPE(cst_t), INTENT(IN) :: CST
187TYPE(param_ice_t), INTENT(IN) :: PARAMI
188TYPE(rain_ice_param_t), INTENT(IN) :: ICEP
189TYPE(rain_ice_descr_t), INTENT(IN) :: ICED
190TYPE(elec_param_t), INTENT(IN) :: ELECP ! electrical parameters
191TYPE(elec_descr_t), INTENT(IN) :: ELECD ! electrical descriptive csts
192TYPE(tbudgetconf_t), INTENT(IN) :: BUCONF
193LOGICAL, INTENT(IN) :: OELEC ! Switch for cloud electricity
194LOGICAL, INTENT(IN) :: OSEDIM_BEARD ! Switch for effect of electrical forces on sedim.
195REAL, INTENT(IN) :: PTHVREFZIKB ! Reference thv at IKB for electricity
196REAL, INTENT(IN) :: PTSTEP ! Double Time step (single if cold start)
197INTEGER, INTENT(IN) :: KRR ! Number of moist variable
198!
199REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEXN ! Exner function
200REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PDZZ ! Layer thikness (m)
201REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
202REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODREF! Reference density
203REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PPABST ! absolute pressure at t
204!
205REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PCIT ! Pristine ice n.c. at t
206REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PCLDFR ! Cloud fraction
207REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PICLDFR ! Ice cloud fraction
208REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PSSIO ! Super-saturation with respect to ice in the supersaturated fraction
209!
210REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PHLC_HRC
211REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PHLC_HCF
212REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PHLI_HRI
213REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PHLI_HCF
214!
215REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTHT ! Theta at time t
216REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(IN) :: PRT ! m.r. at t
217!
218REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PTHS ! Theta source
219REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(INOUT) :: PRS ! m.r. source
220!
221REAL, DIMENSION(D%NIJT), INTENT(OUT) :: PINPRC! Cloud instant precip
222REAL, DIMENSION(D%NIJT), INTENT(OUT) :: PINPRR! Rain instant precip
223REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PEVAP3D! Rain evap profile
224REAL, DIMENSION(D%NIJT), INTENT(OUT) :: PINPRS! Snow instant precip
225REAL, DIMENSION(D%NIJT), INTENT(OUT) :: PINPRG! Graupel instant precip
226REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRAINFR !Precipitation fraction
227REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PSIGS ! Sigma_s at t
228REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PRCRIAUTI
229REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PRCRIAUTC
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(INOUT) :: PQCT ! Cloud droplet |
236REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQRT ! Rain | electric
237REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQIT ! Ice crystals | charge
238REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQST ! Snow | at t
239REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQGT ! Graupel |
240!
241REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQCS ! Cloud droplet |
242REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQRS ! Rain | electric
243REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQIS ! Ice crystals | charge
244REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQSS ! Snow | source
245REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQGS ! Graupel |
246!
247REAL, DIMENSION(MERGE(D%NIJT,0,OSEDIM_BEARD),MERGE(D%NKT,0,OSEDIM_BEARD)), OPTIONAL, INTENT(IN) :: PEFIELDW ! vertical elec. field
248!
249! optional variables
250REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PSEA ! Sea Mask
251REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PTOWN ! Fraction that is town
252REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PCONC3D ! Cloud droplet number concentration
253REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(OUT) :: PINPRH ! Hail instant precip
254REAL, DIMENSION(D%NIJT,D%NKT,KRR), OPTIONAL, INTENT(OUT) :: PFPR ! upper-air precipitation fluxes
255REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQHT ! Hail electric charge at t
256REAL, DIMENSION(MERGE(D%NIJT,0,OELEC),MERGE(D%NKT,0,OELEC)), OPTIONAL, INTENT(INOUT) :: PQHS ! Hail electric charge source
257REAL, DIMENSION(D%NIJT) :: ZRCRIAUTI, ZRCRIAUTC ! SPP perturbations (actual values used, even if optional arguments are absent)
258!
259! Bridge variables
260REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PT
261REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PLVFACT
262REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PLSFACT
263REAL, DIMENSION(D%NIJT,D%NKT,7), INTENT(OUT) :: PWR
264REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWTH
265REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PZCONC3D
266LOGICAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: OMICRO
267REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRVHENI
268REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PZZZZ
269!
270!
271!* 0.2 Declarations of local variables :
272!
273REAL(KIND=jphook) :: zhook_handle
274!
275LOGICAL :: LLSEA_AND_TOWN, LLCONC
276INTEGER :: JIJ, JK
277INTEGER :: IKTB, IKTE, IKB, IIJB, IIJE
278!
279!Arrays for nucleation call outside of LLMICRO points
280REAL, DIMENSION(D%NIJT, D%NKT) :: ZSIGMA_RC
281REAL, DIMENSION(D%NIJT, D%NKT) :: ZHLC_LCF
282REAL, DIMENSION(D%NIJT, D%NKT) :: ZHLC_LRC
283REAL, DIMENSION(D%NIJT, D%NKT) :: ZHLI_LCF
284REAL, DIMENSION(D%NIJT, D%NKT) :: ZHLI_LRI
285!
286REAL :: ZINV_TSTEP ! Inverse ov PTSTEP
287REAL, DIMENSION(KRR) :: ZICEDRTMIN
288!
289REAL :: ZDEVIDE, ZRICE, ZZSUM
290!
291REAL, DIMENSION(D%NIJT,D%NKT) :: ZW3D
292REAL, DIMENSION(D%NIJT) :: ZCONC_TMP
293
294LOGICAL, DIMENSION(D%NIJT,D%NKT) :: LLW3D
295REAL :: ZICENU
296!
297!-------------------------------------------------------------------------------
298IF (lhook) CALL dr_hook('RAIN_ICE_PART1', 0, zhook_handle)
299!
300!* 1. GENERALITIES
301! ------------
302!
303iktb=d%NKTB
304ikte=d%NKTE
305ikb=d%NKB
306iijb=d%NIJB
307iije=d%NIJE
308zicenu=1.0
309zicedrtmin(1:krr)=iced%XRTMIN(1:krr)
310!-------------------------------------------------------------------------------
311!
312!$acc kernels
313zinv_tstep=1./ptstep
314!
315llsea_and_town=PRESENT(psea).AND.PRESENT(ptown)
316llconc=PRESENT(pconc3d)
317
318!SPP perturbations (default values if absent)
319IF (PRESENT(prcriauti)) THEN
320!$acc kernels
321 !$mnh_expand_array(JIJ=D%NIJB:D%NIJE)
322 zrcriauti(d%NIJB:d%NIJE) = prcriauti(d%NIJB:d%NIJE)
323 !$mnh_end_expand_array(JIJ=D%NIJB:D%NIJE)
324!$acc end kernels
325ELSE
326!$acc kernels
327 zrcriauti(d%NIJB:d%NIJE) = icep%XCRIAUTI
328!$acc end kernels
329ENDIF
330IF (PRESENT(prcriautc)) THEN
331!$acc kernels
332 !$mnh_expand_array(JIJ=D%NIJB:D%NIJE)
333 zrcriautc(d%NIJB:d%NIJE) = prcriautc(d%NIJB:d%NIJE)
334 !$mnh_end_expand_array(JIJ=D%NIJB:D%NIJE)
335!$acc end kernels
336ELSE
337!$acc kernels
338 zrcriautc(d%NIJB:d%NIJE) = icep%XCRIAUTC
339!$acc end kernels
340ENDIF
341!
342! LSFACT and LVFACT without exner, and LLMICRO
343! LLMICRO is a mask with a True value on points where microphysics is active
344omicro(:,:)=.false.
345!$acc end kernels
346!$acc kernels
347!$acc loop independent collapse(2)
348DO jk = iktb,ikte
349 DO jij = iijb,iije
350 !LSFACT and LVFACT
351 IF (krr==7) THEN
352 zrice=prt(jij,jk,iri)+prt(jij,jk,irs)+prt(jij,jk,irg)+prt(jij,jk,irh)
353 ELSE
354 zrice=prt(jij,jk,iri)+prt(jij,jk,irs)+prt(jij,jk,irg)
355 ENDIF
356 zdevide = cst%XCPD + cst%XCPV*prt(jij,jk,irv) + cst%XCL*(prt(jij,jk,irc)+prt(jij,jk,irr)) + cst%XCI*zrice
357 pt(jij,jk) = ptht(jij,jk) * pexn(jij,jk)
358 plsfact(jij,jk)=(cst%XLSTT+(cst%XCPV-cst%XCI)*(pt(jij,jk)-cst%XTT)) / zdevide
359 plvfact(jij,jk)=(cst%XLVTT+(cst%XCPV-cst%XCL)*(pt(jij,jk)-cst%XTT)) / zdevide
360
361 !OMICRO
362 IF ( parami%LOCND2 ) THEN
363 IF (krr==7) THEN
364 omicro(jij,jk)=pssio(jij,jk)>icep%XFRMIN(12) .OR. &
365 prt(jij,jk,irc)>icep%XFRMIN(13) .OR. &
366 prt(jij,jk,irr)>icep%XFRMIN(13) .OR. &
367 prt(jij,jk,iri)>icep%XFRMIN(13) .OR. &
368 prt(jij,jk,irs)>icep%XFRMIN(13) .OR. &
369 prt(jij,jk,irg)>icep%XFRMIN(13) .OR. &
370 prt(jij,jk,irh)>icep%XFRMIN(13)
371 ELSE
372 omicro(jij,jk)=pssio(jij,jk)>icep%XFRMIN(12) .OR. &
373 prt(jij,jk,irc)>icep%XFRMIN(13) .OR. &
374 prt(jij,jk,irr)>icep%XFRMIN(13) .OR. &
375 prt(jij,jk,iri)>icep%XFRMIN(13) .OR. &
376 prt(jij,jk,irs)>icep%XFRMIN(13) .OR. &
377 prt(jij,jk,irg)>icep%XFRMIN(13)
378 ENDIF
379 ELSE
380 IF (krr==7) THEN
381 omicro(jij,jk)=prt(jij,jk,irc)>iced%XRTMIN(irc) .OR. &
382 prt(jij,jk,irr)>iced%XRTMIN(irr) .OR. &
383 prt(jij,jk,iri)>iced%XRTMIN(iri) .OR. &
384 prt(jij,jk,irs)>iced%XRTMIN(irs) .OR. &
385 prt(jij,jk,irg)>iced%XRTMIN(irg) .OR. &
386 prt(jij,jk,irh)>iced%XRTMIN(irh)
387 ELSE
388 omicro(jij,jk)=prt(jij,jk,irc)>iced%XRTMIN(irc) .OR. &
389 prt(jij,jk,irr)>iced%XRTMIN(irr) .OR. &
390 prt(jij,jk,iri)>iced%XRTMIN(iri) .OR. &
391 prt(jij,jk,irs)>iced%XRTMIN(irs) .OR. &
392 prt(jij,jk,irg)>iced%XRTMIN(irg)
393 ENDIF
394 ENDIF
395 ENDDO
396ENDDO
397!$acc end kernels
398!
399! 1.1 Compute cloud liquid number concentration
400! -----------------------------------------
401! Model level height
402!$acc kernels
403!$acc loop independent
404DO jij=iijb,iije
405 zzsum = 0.
406!$acc loop seq
407 DO jk=ikte,iktb, -1
408 zzsum = zzsum + pdzz(jij,jk)
409 pzzzz(jij,jk) = zzsum - pdzz(jij,jk)*0.5
410 ENDDO
411ENDDO
412!$acc end kernels
413
414!$acc kernels
415pzconc3d(:,:) = iced%XCONC_LAND
416!$acc end kernels
417IF( llconc .AND. parami%LEXCLDROP) THEN
418!$acc kernels
419!$acc loop independent collapse(2)
420 DO jk=iktb,ikte
421 DO jij=iijb,iije
422 pzconc3d(jij,jk)=pconc3d(jij,jk)
423 ENDDO
424 ENDDO
425!$acc end kernels
426ELSE
427 IF (parami%LEXCLDROP) THEN
428 CALL print_msg(nverb_fatal, 'GEN', 'RAIN_ICE_PART1', 'WITH LEXCLDROP=TRUE CLOUD DROPLET FIELDS MUST BE PRESENT IN RAIN_ICE')
429 END IF
430 IF(llsea_and_town .AND. icep%XFRMIN(26)<0.001) THEN
431 !$acc kernels
432 !$acc loop independent collapse(2)
433 DO jk=iktb,ikte
434 DO jij=iijb,iije
435 zconc_tmp(jij) = psea(jij)*iced%XCONC_SEA+(1.-psea(jij))*iced%XCONC_LAND
436 pzconc3d(jij,jk)= (1.-ptown(jij))*zconc_tmp(jij) +ptown(jij)*iced%XCONC_URBAN
437 ENDDO
438 ENDDO
439 !$acc end kernels
440 ENDIF
441 IF(icep%XFRMIN(26)>0.001)THEN
442 !$acc kernels
443 !$acc loop independent collapse(2)
444 DO jk=iktb,ikte
445 DO jij=iijb,iije
446 pzconc3d(jij,jk) = icep%XFRMIN(26)*ppabst(jij,jk)/cst%XP00
447 IF(icep%XFRMIN(22)>0.001 .AND. llsea_and_town)THEN
448 zconc_tmp(jij) = max(0., min(1.,(pzzzz(jij,jk)- pzzzz(jij,ikte))/&
449 &(max(0.01,icep%XFRMIN(29)-pzzzz(jij,ikte)))))
450 pzconc3d(jij,jk) = pzconc3d(jij,jk)*(icep%XFRMIN(22)*(psea(jij)*icep%XFRMIN(30)+&
451 &(1.-psea(jij)))*(1.-zconc_tmp(jij)) + zconc_tmp(jij))
452 ENDIF
453 ENDDO
454 ENDDO
455 !$acc end kernels
456 ENDIF
457ENDIF
458!
459!
460!-------------------------------------------------------------------------------
461!
462!* 2. COMPUTE THE SEDIMENTATION (RS) SOURCE
463! -------------------------------------
464!
465IF(.NOT. parami%LSEDIM_AFTER) THEN
466 CALL ice4_sedimentation(d, cst, icep, iced, parami, elecp, elecd, buconf, &
467 &oelec, osedim_beard, ptstep, krr, pdzz, pthvrefzikb, &
468 &plvfact, plsfact, prhodref, ppabst, ptht, pt, prhodj, &
469 &pths, prt, prs, pzconc3d,&
470 &pinprc, pinprr, pinprs, pinprg, &
471 &pqct, pqrt, pqit, pqst, pqgt, pqcs, pqrs, pqis, pqss, pqgs, pefieldw, &
472 &tbudgets, kbudgets, &
473 &psea=psea, ptown=ptown, &
474 &pinprh=pinprh, pfpr=pfpr, &
475 &pqht=pqht, pqhs=pqhs)
476ENDIF
477!
478!
479!-------------------------------------------------------------------------------
480!
481!* 3. INITIAL VALUES SAVING
482! ---------------------
483!
484!$acc kernels
485DO jk = iktb,ikte
486!$mnh_expand_array(JIJ=1:D%NIJT)
487 !Copy of T variables to keep untouched the prognostic variables
488 pwth(:,jk)=ptht(:,jk)
489 pwr(:,jk,irv)=prt(:,jk,irv)
490 pwr(:,jk,irc)=prt(:,jk,irc)
491 pwr(:,jk,irr)=prt(:,jk,irr)
492 pwr(:,jk,iri)=prt(:,jk,iri)
493 pwr(:,jk,irs)=prt(:,jk,irs)
494 pwr(:,jk,irg)=prt(:,jk,irg)
495 IF (krr==7) THEN
496 pwr(:,jk,irh)=prt(:,jk,irh)
497 ELSE
498 pwr(:,jk,irh)=0.
499 ENDIF
500
501 !Preset for output 3D variables
502 IF(parami%LWARM) THEN
503 pevap3d(:,jk)=0.
504 ENDIF
505 prainfr(:,jk)=0.
506!$mnh_end_expand_array(JIJ=1:D%NIJT)
507ENDDO
508!$acc end kernels
509!
510!
511!* 4.1 COMPUTES THE SLOW COLD PROCESS SOURCES OUTSIDE OF LLMICRO POINTS
512! -----------------------------------------------------------------
513!
514!The nucleation must be called everywhere
515!This call is for points outside of the OMICRO mask, another call is coded in ice4_tendencies
516!$acc kernels
517llw3d(:,:)=.false.
518!$acc loop independent collapse(2)
519DO jk=iktb,ikte
520 DO jij=iijb,iije
521 IF (.NOT. omicro(jij, jk)) THEN
522 llw3d(jij, jk)=.true.
523 zw3d(jij, jk)=plsfact(jij, jk)/pexn(jij, jk)
524 pcit(jij,jk)=0. !ri=0 because where are in the not odmicro case
525 ELSE
526 llw3d(jij, jk)=.false.
527 ENDIF
528 ENDDO
529ENDDO
530!$acc end kernels
531
532!$acc kernels
533!$acc loop independent collapse(2)
534DO jk=iktb,ikte
535 DO jij=iijb,iije
536!NEC$ noinline
537 CALL ice4_nucleation(cst, parami, icep, iced, llw3d(jij, jk), &
538 ptht(jij, jk), ppabst(jij, jk), prhodref(jij, jk), &
539 pexn(jij, jk), zw3d(jij, jk), pt(jij, jk), &
540 prt(jij, jk, irv), picldfr(jij, jk), pzzzz(jij, jk), zicenu, &
541 pcit(jij, jk), prvheni(jij, jk))
542 ENDDO
543ENDDO
544!$acc end kernels
545
546!$acc kernels
547!$acc loop independent collapse(2)
548DO jk = iktb, ikte
549 DO jij=iijb, iije
550 prvheni(jij,jk) = min(prs(jij,jk,irv), prvheni(jij,jk)/ptstep)
551 ENDDO
552ENDDO
553!$acc end kernels
554!
555!
556!* 4.2 COMPUTES PRECIPITATION FRACTION
557! -------------------------------
558!
559!The ICE4_RAINFR_VERT call was previously in ice4_tendencies to be computed again at each iteration.
560!The computation has been moved here to separate (for GPUs) the part of the code
561!where column computation can occur (here, alongside with the sedimentation) and
562!other routines where computation are only 0D (point by point).
563!This is not completly exact but we can think that the precipitation fraction
564!diagnostic does not evolve too much during a time-step.
565!ICE4_RAINFR_VERT needs the output of ICE4_COMPUTE_PDF; thus this routine
566!is called here but it's still called from within ice4_tendencies.
567IF (parami%CSUBG_RC_RR_ACCR=='PRFR' .OR. parami%CSUBG_RR_EVAP=='PRFR') THEN
568
569!$ACDC ABORT {
570
571 IF (parami%CSUBG_AUCV_RC=='PDF ' .AND. parami%CSUBG_PR_PDF=='SIGM') THEN
572 DO jk = iktb, ikte
573 DO jij=iijb, iije
574 zsigma_rc(jij, jk)=psigs(jij, jk)**2
575 ENDDO
576 ENDDO
577 ENDIF
578 IF (parami%CSUBG_AUCV_RC=='ADJU' .OR. parami%CSUBG_AUCV_RI=='ADJU') THEN
579 DO jk = iktb, ikte
580 DO jij=iijb, iije
581 zhlc_lrc(jij, jk) = pwr(jij, jk, irc) - phlc_hrc(jij, jk)
582 zhli_lri(jij, jk) = pwr(jij, jk, iri) - phli_hri(jij, jk)
583 IF(pwr(jij, jk, irc)>0.) THEN
584 zhlc_lcf(jij, jk) = pcldfr(jij, jk)- phlc_hcf(jij, jk)
585 ELSE
586 zhlc_lcf(jij, jk)=0.
587 ENDIF
588 IF(pwr(jij, jk, iri)>0.) THEN
589 zhli_lcf(jij, jk) = pcldfr(jij, jk)- phli_hcf(jij, jk)
590 ELSE
591 zhli_lcf(jij, jk)=0.
592 ENDIF
593 ENDDO
594 ENDDO
595 ENDIF
596!$acc kernels
597!$acc loop independent collapse(2)
598 DO jk=iktb,ikte
599 DO jij=iijb,iije
600!NEC$ noinline
601 CALL ice4_compute_pdf(cst, icep, iced, parami%CSUBG_AUCV_RC, parami%CSUBG_AUCV_RI, parami%CSUBG_PR_PDF,&
602 omicro(jij,jk), prhodref(jij,jk), prt(jij,jk,irc), prt(jij,jk,iri), &
603 pcldfr(jij,jk), pt(jij,jk), zsigma_rc(jij,jk), &
604 phlc_hcf(jij,jk), zhlc_lcf(jij,jk), phlc_hrc(jij,jk), zhlc_lrc(jij,jk), &
605 phli_hcf(jij,jk), zhli_lcf(jij,jk), phli_hri(jij,jk), zhli_lri(jij,jk), &
606 prainfr(jij,jk), parami, zrcriauti(jij), zrcriautc(jij))
607 ENDDO
608 ENDDO
609!$acc end kernels
610 IF (krr==7) THEN
611 CALL ice4_rainfr_vert(d, iced, prainfr, pwr(:,:,irr), &
612 &pwr(:,:,irs), pwr(:,:,irg), pwr(:,:,irh))
613 ELSE
614 CALL ice4_rainfr_vert(d, iced, prainfr, pwr(:,:,irr), &
615 &pwr(:,:,irs), pwr(:,:,irg))
616 ENDIF
617
618!$ACDC }
619
620ELSE
621 prainfr(:,:)=1.
622ENDIF
623!
624IF (lhook) CALL dr_hook('RAIN_ICE_PART1', 1, zhook_handle)
625!
626CONTAINS
627include "ice4_nucleation.func.h"
628include "tiwmx.func.h"
629include "ice4_compute_pdf.func.h"
630include "criauti.func.h"
631END SUBROUTINE rain_ice_part1
elemental subroutine ice4_compute_pdf(cst, icep, iced, hsubg_aucv_rc, hsubg_aucv_ri, hsubg_pr_pdf, ldmicro, prhodref, prct, prit, pcf, pt, psigma_rc, phlc_hcf, phlc_lcf, phlc_hrc, phlc_lrc, phli_hcf, phli_lcf, phli_hri, phli_lri, prf, parami, prcriauti, prcriautc)
elemental subroutine ice4_nucleation(cst, parami, icep, iced, odcompute, ptht, ppabst, prhodref, pexn, plsfact, pt, prvt, picldfr, pzzz, picenu, pcit, prvheni_mr)
integer, parameter nverb_fatal
Definition modd_io.F90:6
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_part1(d, cst, parami, icep, iced, elecp, elecd, buconf, oelec, osedim_beard, pthvrefzikb, ptstep, krr, pexn, pdzz, prhodj, prhodref, ppabst, pcit, pcldfr, picldfr, pssio, phlc_hrc, phlc_hcf, phli_hri, phli_hcf, ptht, prt, pths, prs, pinprc, pinprr, pevap3d, pinprs, pinprg, prainfr, psigs, prcriauti, prcriautc, tbudgets, kbudgets, pqct, pqrt, pqit, pqst, pqgt, pqcs, pqrs, pqis, pqss, pqgs, pefieldw, psea, ptown, pconc3d, pinprh, pfpr, pqht, pqhs, pt, plvfact, plsfact, pwr, pwth, pzconc3d, omicro, prvheni, pzzzz)