-
Notifications
You must be signed in to change notification settings - Fork 0
/
aro_adjust.F90.xxx
520 lines (493 loc) · 18.5 KB
/
aro_adjust.F90.xxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
! ######spl
SUBROUTINE ARO_ADJUST(KLON,KIDIA,KFDIA,KLEV, KRR, &
NGFL_EZDIAG, &
HFRAC_ICE, HCONDENS, HLAMBDA3, OSUBG_COND, &
OSIGMAS, CMICRO, OCND2, HSUBG_MF_PDF, &
PTSTEP, PSIGQSAT, &
PZZF, PRHODJ, PEXNREF, PRHODREF,&
PPABSM, PTHT, PRT, PSIGS, &
PMFCONV, PRC_MF, PRI_MF, PCF_MF, &
PTHS, PRS, PSRCS, PCLDFR,&
PHLC_HRC, PHLC_HCF, PHLI_HRI, PHLI_HCF,&
PGP2DSPP,PEZDIAG, &
YDDDH,YDLDDH,YDMDDH)
USE PARKIND1, ONLY : JPRB
USE YOMHOOK , ONLY : LHOOK, DR_HOOK
! ##########################################################################
!
!!**** * - compute the resolved clouds and precipitation
!!
!! PURPOSE
!! -------
!! The purpose of this routine is to compute the microphysical sources
!! related to the resolved clouds and precipitation
!!
!!
!!** METHOD
!! ------
!! The main actions of this routine is to call the routines computing the
!! microphysical sources. Before that:
!! - it computes the real absolute pressure,
!! - negative values of the current guess of all mixing ratio are removed.
!! This is done by a global filling algorithm based on a multiplicative
!! method (Rood, 1987), in order to conserved the total mass in the
!! simulation domain.
!! - Sources are transformed in physical tendencies, by removing the
!! multiplicative term Rhod*J.
!! - External points values are filled owing to the use of cyclic
!! l.b.c., in order to performe computations on the full domain.
!! After calling to microphysical routines, the physical tendencies are
!! switched back to prognostic variables.
!!
!!
!! EXTERNAL
!! --------
!! Subroutine FMLOOK: to recover the logical unit number linked to a FMfile
!! Subroutine SLOW_TERMS: Computes the explicit microphysical sources
!! Subroutine FAST_TERMS: Performs the saturation adjustment for l
!! Subroutine RAIN_ICE : Computes the explicit microphysical sources for i
!! Subroutine ICE_ADJUST: Performs the saturation adjustment for i+l
!! MIN_ll,SUM3D_ll : distributed functions equivalent to MIN and SUM
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS : contains declarations of parameter variables
!! JPHEXT : Horizontal external points number
!! JPVEXT : Vertical external points number
!! Module MODD_CST
!! XP00 ! Reference pressure
!! XRD ! Gaz constant for dry air
!! XCPD ! Cpd (dry air)
!!
!! REFERENCE
!! ---------
!!
!! Documentation AROME
!!
!! AUTHOR
!! ------
!! S.Malardel and Y.Seity
!!
!! MODIFICATIONS
!! -------------
!! Original 10/03/03
!! T. Kovacic 11-05-05, Call to budgets for NEGA1_
!! S. Riette ice for EDKF
!! 2012-02 Y. Seity, add possibility to run with reversed vertical levels
!! 2016-11 S. Riette: new ice_adjust interface, add OLD3/OLD4 schemes
!! 2020-12 U. Andrae : Introduce SPP for HARMONIE-AROME
!! R. El Khatib 24-Aug-2021 Optimizations
!!
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_CST, ONLY: CST
USE MODD_RAIN_ICE_PARAM, ONLY: RAIN_ICE_PARAM
USE MODD_NEB, ONLY: NEB
USE MODD_BUDGET, ONLY: TBUDGETDATA, NBUDGET_RI, TBUCONF
USE MODD_SPP_TYPE
USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
!
USE MODI_ICE_ADJUST
USE MODE_FILL_DIMPHYEX, ONLY: FILL_DIMPHYEX
!
USE SPP_MOD, ONLY : YSPP_CONFIG,YSPP
!
USE DDH_MIX , ONLY : TYP_DDH
USE YOMLDDH , ONLY : TLDDH
USE YOMMDDH , ONLY : TMDDH
!
IMPLICIT NONE
!
!* 0.1 Declarations of dummy arguments :
!
!
!
INTEGER, INTENT(IN) :: KLON ! array length (NPROMA)
INTEGER, INTENT(IN) :: KIDIA !start index (=1)
INTEGER, INTENT(IN) :: KFDIA !end index (=KLON only if block is full)
INTEGER, INTENT(IN) :: KLEV !Number of vertical levels
INTEGER, INTENT(IN) :: KRR ! Number of moist variables
INTEGER, INTENT(IN) :: NGFL_EZDIAG ! Diagnostic array dimension
CHARACTER*1, INTENT(IN) :: HFRAC_ICE
CHARACTER*80, INTENT(IN) :: HCONDENS
CHARACTER*4, INTENT(IN) :: HLAMBDA3 ! formulation for lambda3 coeff
LOGICAL, INTENT(IN) :: OSUBG_COND ! Switch for Subgrid Cond.
LOGICAL, INTENT(IN) :: OSIGMAS ! Switch for Sigma_s:
! use values computed in CONDENSATION
! or that from turbulence scheme
CHARACTER (LEN=4), INTENT(IN) :: CMICRO ! Microphysics scheme
LOGICAL, INTENT(IN) :: OCND2
CHARACTER*80, INTENT(IN) :: HSUBG_MF_PDF
REAL, INTENT(IN) :: PTSTEP ! Time step
REAL, INTENT(IN) :: PSIGQSAT ! coeff applied to qsat variance contribution
!
!
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PZZF ! Height (z)
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PRHODJ !Dry density * Jacobian
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PEXNREF ! Reference Exner function
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PRHODREF
!
!
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PPABSM ! abs. pressure at time t-dt
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PTHT ! Theta at time t
REAL, DIMENSION(KLON,1,KLEV,KRR), INTENT(INOUT) :: PRT ! Moist variables at time t
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PSIGS ! Sigma_s at time t
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PMFCONV ! convective mass flux
REAL, DIMENSION(KLON,1,KLEV), INTENT(IN) :: PRC_MF, PRI_MF, PCF_MF
!
!
REAL, DIMENSION(KLON,1,KLEV), INTENT(INOUT) :: PTHS ! Theta source
REAL, DIMENSION(KLON,1,KLEV,KRR), INTENT(INOUT) :: PRS ! Moist variable sources
!
!
REAL, DIMENSION(KLON,1,KLEV), INTENT(OUT) :: PSRCS ! Second-order flux
! s'rc'/2Sigma_s2 at time t+1
! multiplied by Lambda_3
REAL, DIMENSION(KLON,1,KLEV), INTENT(INOUT) :: PCLDFR! Cloud fraction
!
REAL, DIMENSION(KLON,1,KLEV), INTENT(OUT) :: PHLC_HRC
REAL, DIMENSION(KLON,1,KLEV), INTENT(OUT) :: PHLC_HCF
REAL, DIMENSION(KLON,1,KLEV), INTENT(OUT) :: PHLI_HRI
REAL, DIMENSION(KLON,1,KLEV), INTENT(OUT) :: PHLI_HCF
!
REAL, DIMENSION(KLON,YSPP%N2D), TARGET, INTENT(INOUT) :: PGP2DSPP
REAL, DIMENSION(KLON,KLEV,NGFL_EZDIAG), INTENT(INOUT) :: PEZDIAG
!
TYPE(TYP_DDH), INTENT(INOUT), TARGET :: YDDDH
TYPE(TLDDH), INTENT(IN), TARGET :: YDLDDH
TYPE(TMDDH), INTENT(IN), TARGET :: YDMDDH
!
!* 0.2 Declarations of local variables :
CHARACTER*4 :: HBUNAME ! Name of the budget
!
INTEGER :: JRR ! Loop index for the moist and scalar variables
INTEGER :: JLON, JLEV
REAL :: ZT, ZTWOTSTEP
REAL, DIMENSION(KLON) :: ZLV,ZLS,ZCPH
LOGICAL :: LL(KLON)
REAL, DIMENSION(KLON,1,KLEV,0:KRR) :: ZRS
REAL, DIMENSION(KLON,1,KLEV) :: ZZZ
! model layer height
REAL :: ZMASSTOT ! total mass for one water category
! including the negative values
REAL :: ZMASSPOS ! total mass for one water category
! after removing the negative values
REAL :: ZRATIO ! ZMASSTOT / ZMASSCOR
REAL :: ZCOR(KLON) ! for the correction of negative rv
!
TYPE(TSPP_CONFIG_MPA) :: YSPP_PSIGQSAT,YSPP_ICE_CLD_WGT
REAL :: ZMU, ZVAL
REAL, DIMENSION(KLON,1) :: ZSIGQSAT, ZICE_CLD_WGT
INTEGER :: JI
TYPE(TBUDGETDATA), DIMENSION(NBUDGET_RI) :: YLBUDGET !NBUDGET_RI is the one with the highest number
TYPE(DIMPHYEX_t) :: YLDIMPHYEX
!
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
CHARACTER(LEN=10) :: CLOFILE
INTEGER :: IFILE
LOGICAL :: LFILEEXISTS
!------------------------------------------------------------------------------
!
!* 1. PRELIMINARY COMPUTATIONS
! ------------------------
!
IF (LHOOK) CALL DR_HOOK('ARO_ADJUST',0,ZHOOK_HANDLE)
!Dimensions
CALL FILL_DIMPHYEX(YLDIMPHYEX, KLON, 1, KLEV, 0, KFDIA)
! Copy SPP settings
IF ( YSPP_CONFIG%LSPP ) THEN
IF ( YSPP_CONFIG%LPERT_PSIGQSAT ) &
CALL SET_SPP_TYPE(YSPP_PSIGQSAT, &
YSPP_CONFIG%LLNN_MEAN1, YSPP_CONFIG%LLNN_MEAN1_PSIGQSAT, &
YSPP_CONFIG%CMPERT_PSIGQSAT, YSPP_CONFIG%SDEV, &
YSPP_CONFIG%CLIP_PSIGQSAT, &
YSPP%MP_PSIGQSAT, &
KLON,KLEV,YSPP%N2D,NGFL_EZDIAG, &
YSPP_CONFIG%IEZDIAG_POS, &
PGP2DSPP,PSIGQSAT,PEZDIAG)
IF ( YSPP_CONFIG%LPERT_ICE_CLD_WGT ) &
CALL SET_SPP_TYPE(YSPP_ICE_CLD_WGT, &
YSPP_CONFIG%LLNN_MEAN1, YSPP_CONFIG%LLNN_MEAN1_ICE_CLD_WGT, &
YSPP_CONFIG%CMPERT_ICE_CLD_WGT, YSPP_CONFIG%SDEV, &
YSPP_CONFIG%CLIP_ICE_CLD_WGT, &
YSPP%MP_ICE_CLD_WGT, &
KLON,KLEV,YSPP%N2D,NGFL_EZDIAG, &
YSPP_CONFIG%IEZDIAG_POS, &
PGP2DSPP,1.0_JPRB,PEZDIAG)
! Awaiting merge of HARMONIE-AROME physics
!PGP2DSPP,XFRMIN(21),PEZDIAG)
ENDIF
! Compute perturbations
! Perturb PSIGQSAT
IF (YSPP_PSIGQSAT%LPERT) THEN
IF (YSPP_PSIGQSAT%LLNN_MEAN1.OR.YSPP_PSIGQSAT%LLNN_MEAN1_SELF) THEN
ZMU = -0.5 * (YSPP_PSIGQSAT%CMPERT * YSPP_PSIGQSAT%SDEV)**2
ELSE
ZMU = 0.
ENDIF
DO JI=KIDIA,KFDIA
ZVAL = &
PSIGQSAT*EXP(ZMU+YSPP_PSIGQSAT%CMPERT*YSPP_PSIGQSAT%PGP2DSPP(JI))
ZSIGQSAT(JI,1) = MAX(YSPP_PSIGQSAT%CLIP(1),MIN(ZVAL,YSPP_PSIGQSAT%CLIP(2)))
ENDDO
ELSE
ZSIGQSAT(KIDIA:KFDIA,1) = PSIGQSAT
ENDIF
! Perturb ICE_CLD_WGT
IF (YSPP_ICE_CLD_WGT%LPERT) THEN
IF (YSPP_ICE_CLD_WGT%LLNN_MEAN1.OR.YSPP_ICE_CLD_WGT%LLNN_MEAN1_SELF) THEN
ZMU = -0.5 * (YSPP_ICE_CLD_WGT%CMPERT * YSPP_ICE_CLD_WGT%SDEV)**2
ELSE
ZMU = 0.
ENDIF
DO JI=KIDIA,KFDIA
! Awaiting HARMONIE-AROME physics changes
! ZVAL = &
! XFRMIN(21)* EXP(ZMU+YSPP_ICE_CLD_WGT%CMPERT*YSPP_ICE_CLD_WGT%PGP2DSPP(JI))
ZVAL = &
1.5* EXP(ZMU+YSPP_ICE_CLD_WGT%CMPERT*YSPP_ICE_CLD_WGT%PGP2DSPP(JI))
ZICE_CLD_WGT(JI,1) = &
MAX(YSPP_ICE_CLD_WGT%CLIP(1),MIN(ZVAL,YSPP_ICE_CLD_WGT%CLIP(2)))
ENDDO
ELSE
! ZICE_CLD_WGT(:) = XFRMIN(21)
ZICE_CLD_WGT(KIDIA:KFDIA,1) = 1.5
ENDIF
HBUNAME='DEPI'
!
!* 2. TRANSFORMATION INTO PHYSICAL TENDENCIES
! ---------------------------------------
!
!
! personal comment: tranfering these variables to the
! microphysical routines would save
! computing time
! Well, getting rid of array syntax already saves a lot ;-) .REK.
!
!
!
!* 3. REMOVE NEGATIVE VALUES
! ----------------------
!
!* 3.1 Non local correction for precipitating species (Rood 87)
!
IF (CMICRO == 'KESS' .OR. CMICRO == 'ICE3' .OR. CMICRO == 'ICE2' &
.OR. CMICRO == 'C2R2' .OR. CMICRO == 'C3R5'.OR. CMICRO == 'ICE4' &
.OR. CMICRO == 'OLD3' .OR. CMICRO == 'OLD4') THEN
DO JRR = 3,KRR
SELECT CASE (JRR)
CASE(3,5,6,7) ! rain, snow, graupel and hail
IF ( MINVAL( PRS(KIDIA:KFDIA,:,:,JRR)) < 0.0 ) THEN
! For AROME, we cannot use MAX_ll so that according to JPP's advises
! we only correct negative values but not the total mass
! compute the total water mass computation
!
! ZMASSTOT = MAX( 0. , SUM( PRS(:,:,:,JRR) ))
!
! remove the negative values
!
PRS(KIDIA:KFDIA,:,:,JRR) = MAX( 0., PRS(KIDIA:KFDIA,:,:,JRR) )
!
! compute the new total mass
!
! ZMASSPOS = MAX(1.E-60,SUM( PRS(:,:,:,JRR) ))
!
! correct again in such a way to conserve the total mass
!
! ZRATIO = ZMASSTOT / ZMASSPOS
! PRS(:,:,:,JRR) = PRS(:,:,:,JRR) * ZRATIO
END IF
END SELECT
END DO
END IF
!
!* 3.2 Adjustement for liquid and solid cloud
!
ZTWOTSTEP=2.*PTSTEP
SELECT CASE ( CMICRO )
!
!
CASE('ICE2','ICE3','ICE4', 'OLD3', 'OLD4')
DO JLEV=1,KLEV
DO JLON=KIDIA,KFDIA
ZT = PTHT(JLON,1,JLEV)*PEXNREF(JLON,1,JLEV)
ZLV(JLON)=CST%XLVTT +(CST%XCPV-CST%XCL) *(ZT-CST%XTT)
ZLS(JLON)=CST%XLSTT +(CST%XCPV-CST%XCI) *(ZT-CST%XTT)
ZCPH(JLON)=CST%XCPD +CST%XCPV*2.*PTSTEP*PRS(JLON,1,JLEV,1)
ENDDO
DO JLON=KIDIA,KFDIA
IF (PRS(JLON,1,JLEV,4) < 0.) THEN
PRS(JLON,1,JLEV,1) = PRS(JLON,1,JLEV,1) + PRS(JLON,1,JLEV,4)
PTHS(JLON,1,JLEV) = PTHS(JLON,1,JLEV) - PRS(JLON,1,JLEV,4) * ZLS(JLON) / ZCPH(JLON) / PEXNREF(JLON,1,JLEV)
PRS(JLON,1,JLEV,4) = 0.
ENDIF
ENDDO
!
! cloud
DO JLON=KIDIA,KFDIA
IF (PRS(JLON,1,JLEV,2) < 0.) THEN
PRS(JLON,1,JLEV,1) = PRS(JLON,1,JLEV,1) + PRS(JLON,1,JLEV,2)
PTHS(JLON,1,JLEV) = PTHS(JLON,1,JLEV) - PRS(JLON,1,JLEV,2) * ZLV(JLON) / ZCPH(JLON) / PEXNREF(JLON,1,JLEV)
PRS(JLON,1,JLEV,2) = 0.
ENDIF
ENDDO
!
! if rc or ri are positive, we can correct negative rv
! cloud
DO JLON=KIDIA,KFDIA
LL(JLON) = (PRS(JLON,1,JLEV,1) <0.) .AND. (PRS(JLON,1,JLEV,2)> 0.)
IF (LL(JLON)) THEN
#ifdef REPRO48
ZCOR(JLON)=PRS(JLON,1,JLEV,2)
#else
ZCOR(JLON)=MIN(-PRS(JLON,1,JLEV,1),PRS(JLON,1,JLEV,2))
#endif
ENDIF
ENDDO
DO JLON=KIDIA,KFDIA
IF (LL(JLON)) THEN
PRS(JLON,1,JLEV,1) = PRS(JLON,1,JLEV,1) + ZCOR(JLON)
PTHS(JLON,1,JLEV) = PTHS(JLON,1,JLEV) - ZCOR(JLON) * ZLV(JLON) / ZCPH(JLON) / PEXNREF(JLON,1,JLEV)
PRS(JLON,1,JLEV,2) = PRS(JLON,1,JLEV,2) - ZCOR(JLON)
ENDIF
ENDDO
! ice
IF (KRR > 3) THEN
DO JLON=KIDIA,KFDIA
LL(JLON) = (PRS(JLON,1,JLEV,1) < 0.).AND.(PRS(JLON,1,JLEV,4) > 0.)
IF (LL(JLON)) THEN
ZCOR(JLON)=MIN(-PRS(JLON,1,JLEV,1),PRS(JLON,1,JLEV,4))
ENDIF
ENDDO
DO JLON=KIDIA,KFDIA
IF (LL(JLON)) THEN
PRS(JLON,1,JLEV,1) = PRS(JLON,1,JLEV,1) + ZCOR(JLON)
PTHS(JLON,1,JLEV) = PTHS(JLON,1,JLEV) - ZCOR(JLON) * ZLS(JLON) / ZCPH(JLON) / PEXNREF(JLON,1,JLEV)
PRS(JLON,1,JLEV,4) = PRS(JLON,1,JLEV,4) - ZCOR(JLON)
ENDIF
ENDDO
ENDIF
ENDDO ! JLEV
!
END SELECT
!
!
!* 3.3 STORE THE BUDGET TERMS
! ----------------------
!
!IF (LBUDGET_RV) CALL BUDGET (PRS(:,:,:,1) * PRHODJ(:,:,:), 6,'NEGA_BU_RRV',YDDDH)
!IF (LBUDGET_RC) CALL BUDGET (PRS(:,:,:,2) * PRHODJ(:,:,:), 7,'NEGA_BU_RRC',YDDDH)
!IF (LBUDGET_RR) CALL BUDGET (PRS(:,:,:,3) * PRHODJ(:,:,:), 8,'NEGA_BU_RRR',YDDDH)
!IF (LBUDGET_RI) CALL BUDGET (PRS(:,:,:,4) * PRHODJ(:,:,:) ,9,'NEGA_BU_RRI',YDDDH)
!IF (LBUDGET_RS) CALL BUDGET (PRS(:,:,:,5) * PRHODJ(:,:,:),10,'NEGA_BU_RRS',YDDDH)
!IF (LBUDGET_RG) CALL BUDGET (PRS(:,:,:,6) * PRHODJ(:,:,:),11,'NEGA_BU_RRG',YDDDH)
!IF (LBUDGET_RH) CALL BUDGET (PRS(:,:,:,7) * PRHODJ(:,:,:),12,'NEGA_BU_RRH',YDDDH)
!IF (LBUDGET_TH) CALL BUDGET (PTHS(:,:,:) * PRHODJ(:,:,:),4,'NEGA_BU_RTH',YDDDH)
DO JRR=1, NBUDGET_RI
YLBUDGET(JRR)%NBUDGET=JRR
YLBUDGET(JRR)%YDDDH=>YDDDH
YLBUDGET(JRR)%YDLDDH=>YDLDDH
YLBUDGET(JRR)%YDMDDH=>YDMDDH
ENDDO
!
!-------------------------------------------------------------------------------
!
!* 9. MIXED-PHASE MICROPHYSICAL SCHEME (WITH 3 ICE SPECIES)
! -----------------------------------------------------
!
DO JRR = 0,KRR
IF (JRR==0) THEN
ZRS(KIDIA:KFDIA,:,:,0)=PTHS(KIDIA:KFDIA,:,:)*2.*PTSTEP
ELSE
ZRS(KIDIA:KFDIA,:,:,JRR)=PRS(KIDIA:KFDIA,:,:,JRR)*2.*PTSTEP
ENDIF
ENDDO
ZZZ(KIDIA:KFDIA,:,:) = PZZF(KIDIA:KFDIA,:,:)
!
!* 9.2 Perform the saturation adjustment over cloud ice and cloud water
!
IF (KRR==6) THEN
IFILE=0
LFILEEXISTS=.TRUE.
DO WHILE(LFILEEXISTS)
IFILE=IFILE+1
WRITE(CLOFILE, '(I10)') IFILE
INQUIRE(FILE=CLOFILE, EXIST=LFILEEXISTS)
ENDDO
IFILE=7
OPEN(IFILE, FILE=CLOFILE, FORM='unformatted') !,access='stream')
WRITE(IFILE) SIZE(PRHODJ, 1), SIZE(PRHODJ, 2), SIZE(PRHODJ, 3)
WRITE(IFILE) PRHODJ
WRITE(IFILE) PEXNREF
WRITE(IFILE) PRHODREF
WRITE(IFILE) PSIGS
WRITE(IFILE) PMFCONV
WRITE(IFILE) PPABSM
WRITE(IFILE) ZZZ
WRITE(IFILE) PCF_MF
WRITE(IFILE) PRC_MF
WRITE(IFILE) PRI_MF
WRITE(IFILE) ZRS(:,:,:,:)
WRITE(IFILE) PRS(:,:,:,:)
WRITE(IFILE) PTHS
CALL ICE_ADJUST ( YLDIMPHYEX, CST=CST, ICEP=RAIN_ICE_PARAM, NEB=NEB, BUCONF=TBUCONF, KRR=KRR,&
& HFRAC_ICE=HFRAC_ICE, HCONDENS=HCONDENS, HLAMBDA3=HLAMBDA3, HBUNAME=HBUNAME, &
& OSUBG_COND=OSUBG_COND, OSIGMAS=OSIGMAS, &
& OCND2=OCND2, HSUBG_MF_PDF=HSUBG_MF_PDF, &
& PTSTEP=ZTWOTSTEP,PSIGQSAT=ZSIGQSAT, &
& PRHODJ=PRHODJ ,PEXNREF=PEXNREF, PRHODREF=PRHODREF, &
& PSIGS=PSIGS, LMFCONV=.TRUE., PMFCONV=PMFCONV, PPABST=PPABSM, PZZ=ZZZ, &
& PEXN=PEXNREF, PCF_MF=PCF_MF,PRC_MF=PRC_MF,PRI_MF=PRI_MF, &
& PRV=ZRS(:,:,:,1), PRC=ZRS(:,:,:,2), &
& PRVS=PRS(:,:,:,1), PRCS=PRS(:,:,:,2), &
& PTH=ZRS(:,:,:,0), PTHS=PTHS,PSRCS=PSRCS, PCLDFR=PCLDFR, &
& PRR=ZRS(:,:,:,3), &
& PRI=ZRS(:,:,:,4), PRIS=PRS(:,:,:,4), &
& PRS=ZRS(:,:,:,5), &
& PRG=ZRS(:,:,:,6), &
& PHLC_HRC=PHLC_HRC(:,:,:), PHLC_HCF=PHLC_HCF(:,:,:), &
& PHLI_HRI=PHLI_HRI(:,:,:), PHLI_HCF=PHLI_HCF(:,:,:), &
& PICE_CLD_WGT=ZICE_CLD_WGT(:,:), &
& TBUDGETS=YLBUDGET, KBUDGETS=SIZE(YLBUDGET))
WRITE(IFILE) PRS(:,:,:,:)
WRITE(IFILE) PSRCS
WRITE(IFILE) PCLDFR
WRITE(IFILE) PHLC_HRC
WRITE(IFILE) PHLC_HCF
WRITE(IFILE) PHLI_HRI
WRITE(IFILE) PHLI_HCF
CLOSE(IFILE)
ELSE
CALL ICE_ADJUST ( YLDIMPHYEX, CST=CST, ICEP=RAIN_ICE_PARAM, NEB=NEB, BUCONF=TBUCONF, KRR=KRR,&
& HFRAC_ICE=HFRAC_ICE, HCONDENS=HCONDENS, HLAMBDA3=HLAMBDA3, HBUNAME=HBUNAME, &
& OSUBG_COND=OSUBG_COND, OSIGMAS=OSIGMAS, &
& OCND2=OCND2, HSUBG_MF_PDF=HSUBG_MF_PDF, &
& PTSTEP=ZTWOTSTEP,PSIGQSAT=ZSIGQSAT, &
& PRHODJ=PRHODJ ,PEXNREF=PEXNREF, PRHODREF=PRHODREF, &
& PSIGS=PSIGS, LMFCONV=.TRUE., PMFCONV=PMFCONV, PPABST=PPABSM, PZZ=ZZZ, &
& PEXN=PEXNREF, PCF_MF=PCF_MF,PRC_MF=PRC_MF,PRI_MF=PRI_MF, &
& PRV=ZRS(:,:,:,1), PRC=ZRS(:,:,:,2), &
& PRVS=PRS(:,:,:,1), PRCS=PRS(:,:,:,2), &
& PTH=ZRS(:,:,:,0), PTHS=PTHS,PSRCS=PSRCS, PCLDFR=PCLDFR, &
& PRR=ZRS(:,:,:,3), &
& PRI=ZRS(:,:,:,4), PRIS=PRS(:,:,:,4), &
& PRS=ZRS(:,:,:,5), &
& PRG=ZRS(:,:,:,6), &
& PRH=ZRS(:,:,:,7), &
& PHLC_HRC=PHLC_HRC(:,:,:), PHLC_HCF=PHLC_HCF(:,:,:), &
& PHLI_HRI=PHLI_HRI(:,:,:), PHLI_HCF=PHLI_HCF(:,:,:), &
& PICE_CLD_WGT=ZICE_CLD_WGT(:,:), &
& TBUDGETS=YLBUDGET, KBUDGETS=SIZE(YLBUDGET))
ENDIF
CALL CLEAR_SPP_TYPE(YSPP_PSIGQSAT)
CALL CLEAR_SPP_TYPE(YSPP_ICE_CLD_WGT)
!
!-------------------------------------------------------------------------------
!
IF (LHOOK) CALL DR_HOOK('ARO_ADJUST',1,ZHOOK_HANDLE)
END SUBROUTINE ARO_ADJUST