Newer
Older
!MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
!-----------------------------------------------------------------
!--------------- special set of characters for RCS information
!-----------------------------------------------------------------
! $Source$ $Revision$
! MASDEV4_7 microph 2007/03/23 11:52:41
!-----------------------------------------------------------------
! #######################
MODULE MODI_C2R2_ADJUST
! #######################
!
INTERFACE
!

WAUTELET Philippe
committed
SUBROUTINE C2R2_ADJUST(KRR, TPFILE, HLUOUT, HRAD, &
HTURBDIM, OCLOSE_OUT, OSUBG_COND, PTSTEP, &
PTHS, PRVS, PRCS, PCNUCS, &
PCCS, PSRCS, PCLDFR, PRRS )

WAUTELET Philippe
committed
!
USE MODD_IO_ll, ONLY: TFILEDATA
!
INTEGER, INTENT(IN) :: KRR ! Number of moist variables

WAUTELET Philippe
committed
TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! Output file
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
CHARACTER(LEN=*), INTENT(IN) :: HLUOUT ! Output-listing name for
! model n
CHARACTER*4, INTENT(IN) :: HTURBDIM ! Dimensionality of the
! turbulence scheme
CHARACTER*4, INTENT(IN) :: HRAD ! Radiation scheme name
LOGICAL, INTENT(IN) :: OCLOSE_OUT ! Conditional closure of
! the OUTPUT FM-file
LOGICAL, INTENT(IN) :: OSUBG_COND ! Switch for Subgrid
! Condensation
REAL, INTENT(IN) :: PTSTEP ! Double Time step
! (single if cold start)
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSIGS ! Sigma_s at time t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PPABST ! Absolute Pressure at t
!
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PTHS ! Theta source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRVS ! Water vapor m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRCS ! Cloud water m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PCNUCS ! Nucl. aero. conc. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PCCS ! Cloud water conc. source
!
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PSRCS ! Second-order flux
! s'rc'/2Sigma_s2 at time t+1
! multiplied by Lambda_3
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PCLDFR ! Cloud fraction
REAL, DIMENSION(:,:,:), OPTIONAL, INTENT(IN) :: PRRS ! Rain water m.r. source
!
END SUBROUTINE C2R2_ADJUST
!
END INTERFACE
!
END MODULE MODI_C2R2_ADJUST
! ##########################################################################

WAUTELET Philippe
committed
SUBROUTINE C2R2_ADJUST(KRR, TPFILE, HLUOUT, HRAD, &
HTURBDIM, OCLOSE_OUT, OSUBG_COND, PTSTEP, &
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
PTHS, PRVS, PRCS, PCNUCS, &
PCCS, PSRCS, PCLDFR, PRRS )
! ##########################################################################
!
!!**** *C2R2_ADJUST* - compute the fast microphysical sources for C2R2 or KHKO scheme
!!
!! PURPOSE
!! -------
!! The purpose of this routine is to compute the fast microphysical sources
!! through a saturation ajustement procedure.
!!
!!
!!** METHOD
!! ------
!! Langlois, Tellus, 1973 for the cloudless version.
!! When cloud water is taken into account, refer to book 1 of the
!! documentation.
!!
!!
!!
!! EXTERNAL
!! --------
!! None
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_CST
!! XP00 ! Reference pressure
!! XMD,XMV ! Molar mass of dry air and molar mass of vapor
!! XRD,XRV ! Gaz constant for dry air, gaz constant for vapor
!! XCPD,XCPV ! Cpd (dry air), Cpv (vapor)
!! XCL ! Cl (liquid)
!! XTT ! Triple point temperature
!! XLVTT ! Vaporization heat constant
!! XALPW,XBETAW,XGAMW ! Constants for saturation vapor
!! ! pressure function
!! Module MODD_CONF
!! CCONF
!! Module MODD_BUDGET:
!! NBUMOD
!! CBUTYPE
!! NBUPROCCTR
!! LBU_RTH
!! LBU_RRV
!! LBU_RRC
!! Module MODD_LES : NCTR_LES,LTURB_LES,NMODNBR_LES
!! XNA declaration (cloud fraction as global var)
!!
!! REFERENCE
!! ---------
!!
!! Book 1 and Book2 of documentation ( routine FAST_TERMS )
!! Langlois, Tellus, 1973
!! AUTHOR
!! ------
!! E. Richard * Laboratoire d'Aerologie*
!!
!!
!! MODIFICATIONS
!! -------------
!! Original 20/12/94
!! Modifications: March 1, 1995 (J.M. Carriere)
!! Introduction of cloud water with order 1
!! formulation
!! Modifications: June 8, 1995 ( J.Stein )
!! Cleaning
!! Modifications: August 30, 1995 ( J.Stein )
!! add Lambda3 for the subgrid condensation
!!
!! October 16, 1995 (J. Stein) change the budget calls
!! March 16, 1996 (J. Stein) store the cloud fraction
!! April 03, 1996 (J. Stein) displace the nebulosity
!! computation in the all and nothing case
!! April 15, 1996 (J. Stein) displace the lambda 3
!! multiplication and change the nebulosity threshold
!! September 16, 1996 (J. Stein) bug in the SG cond for
!! the M computation
!! October 10, 1996 (J. Stein) reformulate the Subgrid
!! condensation scheme
!! October 8, 1996 (Cuxart,Sanchez) Cloud frac. LES diag (XNA)
!! December 6, 1996 (J.-P. Pinty) correction of Delta_2
!! November 5, 1996 (J. Stein) remove Rnp<0 values
!! November 13 1996 (V. Masson) add prints in test above
!! March 11, 1997 (J.-M. Cohard) C2R2 option
!! March 2006 (O.Geoffroy) Add KHKO scheme
!! October 2009 (G. Tanguy) add ILENCH=LEN(YCOMMENT) after
!! change of YCOMMENT
!!
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
USE MODD_CST
USE MODD_CONF
USE MODD_BUDGET

WAUTELET Philippe
committed
USE MODD_IO_ll, ONLY: TFILEDATA
USE MODD_NSV, ONLY : NSV_C2R2BEG
!
USE MODI_CONDENS
USE MODI_BUDGET
!
USE MODE_FIELD
USE MODE_FM
USE MODE_FMWRIT
USE MODE_IO_ll
!
IMPLICIT NONE
!
!* 0.1 Declarations of dummy arguments :
!
!
INTEGER, INTENT(IN) :: KRR ! Number of moist variables

WAUTELET Philippe
committed
TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! Output file
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
CHARACTER(LEN=*), INTENT(IN) :: HLUOUT ! Output-listing name for
! model n
CHARACTER*4, INTENT(IN) :: HTURBDIM ! Dimensionality of the
! turbulence scheme
CHARACTER*4, INTENT(IN) :: HRAD ! Radiation scheme name
LOGICAL, INTENT(IN) :: OCLOSE_OUT ! Conditional closure of
! the OUTPUT FM-file
LOGICAL, INTENT(IN) :: OSUBG_COND ! Switch for Subgrid
! Condensation
REAL, INTENT(IN) :: PTSTEP ! Double Time step
! (single if cold start)
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSIGS ! Sigma_s at time t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PPABST ! Absolute Pressure at t
!
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PTHS ! Theta source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRVS ! Water vapor m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRCS ! Cloud water m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PCNUCS ! Nucl. aero. conc. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PCCS ! Cloud water conc. source
!
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PSRCS ! Second-order flux
! s'rc'/2Sigma_s2 at time t+1
! multiplied by Lambda_3
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PCLDFR ! Cloud fraction
REAL, DIMENSION(:,:,:), OPTIONAL, INTENT(IN) :: PRRS ! Rain water m.r. source
!
!
!
!* 0.2 Declarations of local variables :
!
!
REAL :: ZEPS ! Mv/Md
REAL, DIMENSION(SIZE(PRHODJ,1),SIZE(PRHODJ,2),SIZE(PRHODJ,3)) &
:: ZEXNS,& ! guess of the Exner function at t+1
ZT, & ! guess of the temperature at t+1
ZCPH, & ! guess of the CPh for the mixing
ZLV, & ! guess of the Lv at t+1
ZW1,ZW2,ZW3 ! Work arrays for intermediate
! fields
!
INTEGER :: IRESP ! Return code of FM routines
INTEGER :: JITER,ITERMAX ! iterative loop for first order adjustment
INTEGER :: ILUOUT ! Logical unit of output listing
TYPE(TFIELDDATA) :: TZFIELD
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
!-------------------------------------------------------------------------------
!
!* 1. PRELIMINARIES
! -------------
!
CALL FMLOOK_ll(HLUOUT,HLUOUT,ILUOUT,IRESP)
ZEPS= XMV / XMD
!
IF (OSUBG_COND) THEN
ITERMAX=2
ELSE
ITERMAX=1
END IF
!
!
!-------------------------------------------------------------------------------
!
!* 2. COMPUTE QUANTITIES WITH THE GUESS OF THE FUTURE INSTANT
! -------------------------------------------------------
!
!* 2.1 remove negative non-precipitating negative water
! ------------------------------------------------
!
IF (ANY(PRCS(:,:,:) < 0. .OR. PCCS(:,:,:) < 0.)) THEN
WRITE(ILUOUT,*) 'C2R2_ADJUST beginning: negative values of PRCS or PCCS'
WRITE(ILUOUT,*) ' location of minimum of PRCS:', MINLOC(PRCS(:,:,:))
WRITE(ILUOUT,*) ' value of minimum :', MINVAL(PRCS(:,:,:))
WRITE(ILUOUT,*) ' location of minimum of PCCS:', MINLOC(PCCS(:,:,:))
WRITE(ILUOUT,*) ' value of minimum :', MINVAL(PCCS(:,:,:))
END IF
!
IF (ANY(PRCS(:,:,:)+PRVS(:,:,:) < 0.) .AND. NVERB>5) THEN
WRITE(ILUOUT,*) 'C2R2_ADJUST: negative values of total water (reset to zero)'
WRITE(ILUOUT,*) ' location of minimum:', MINLOC(PRCS(:,:,:)+PRVS(:,:,:))
WRITE(ILUOUT,*) ' value of minimum :', MINVAL(PRCS(:,:,:)+PRVS(:,:,:))
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
END IF
!
WHERE ( PRCS(:,:,:)+PRVS(:,:,:) < 0.)
PRVS(:,:,:) = - PRCS(:,:,:)
END WHERE
!
!* 2.2 estimate the Exner function at t+1
!
ZEXNS(:,:,:) = ( PPABST(:,:,:) / XP00 ) ** (XRD/XCPD)
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
!
! beginning of the iterative loop
!
DO JITER =1,ITERMAX
!
!* 2.3 compute the intermediate temperature at t+1, T*
!
ZT(:,:,:) = ( PTHS(:,:,:) * PTSTEP ) * ZEXNS(:,:,:)
!
!* 2.4 compute the latent heat of vaporization Lv(T*) at t+1
!
ZLV(:,:,:) = XLVTT + ( XCPV - XCL ) * ( ZT(:,:,:) -XTT )
!
!* 2.5 compute the specific heat for moist air (Cph) at t+1
!
IF ( KRR == 3 ) THEN
ZCPH(:,:,:) = XCPD + XCPV *PTSTEP* PRVS(:,:,:) &
+ XCL *PTSTEP* ( PRCS(:,:,:) + PRRS(:,:,:) )
ELSE IF( KRR == 2 ) THEN
ZCPH(:,:,:) = XCPD + XCPV *PTSTEP* PRVS(:,:,:) &
+ XCL *PTSTEP* PRCS(:,:,:)
END IF
!
!* 2.6 compute the saturation vapor pressure at t+1
!
ZW1(:,:,:) = EXP( XALPW - XBETAW/ZT(:,:,:) - XGAMW*ALOG( ZT(:,:,:) ) )
!
!* 2.7 compute the saturation mixing ratio at t+1
!
ZW2(:,:,:) = ZW1(:,:,:) * ZEPS / &
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
!
!* 2.8 compute the saturation mixing ratio derivative (rvs')
!
ZW1(:,:,:) = ( XBETAW / ZT(:,:,:) - XGAMW ) / ZT(:,:,:) &
* ZW2(:,:,:) * ( 1. + ZW2(:,:,:) / ZEPS )
!
!* 2.9 compute Cph + Lv * rvs'
!
ZW3(:,:,:) = ZCPH(:,:,:) + ZLV(:,:,:) * ZW1(:,:,:)
!
!
!-------------------------------------------------------------------------------
!
!* 3. FIRST ORDER SUBGRID CONDENSATION SCHEME
! ---------------------------------------
!
IF ( OSUBG_COND ) THEN
!
!* 3.1 compute Q1
!
ZW2(:,:,:) = ( ( PRVS(:,:,:)*PTSTEP - ZW2(:,:,:) ) * ZCPH(:,:,:) / ZW3(:,:,:) &
+ PRCS(:,:,:)*PTSTEP &
) / ( 2. * PSIGS(:,:,:) )
!
!* 3.2 compute s'rc'/2Sigma_s2, Rc and the nebolisity
!
CALL CONDENS(HTURBDIM, ZW2,ZW1,ZW3,PSRCS) ! ZW1 = Cloud fraction
! PSRC = s'rc'/(2 Sigma_s**2)
! ZW3 = Rc / (2 Sigma_s)
ZW3(:,:,:) = 2. * PSIGS(:,:,:) * ZW3(:,:,:) ! Rc
!
! multiply PSRCS by the lambda3 coefficient
!
IF ( HTURBDIM == '1DIM'.AND.JITER==ITERMAX ) THEN
PSRCS(:,:,:) = PSRCS(:,:,:) * MIN( 3. , MAX(1.,1.-ZW2(:,:,:)) )
END IF ! in the 3D case lamda_3 = 1.
!
!* 3.3 compute the variation of mixing ratio
!
! Rc - Rc*
ZW3(:,:,:) = (ZW3(:,:,:)/PTSTEP) - PRCS(:,:,:) ! Pcon = ----------
! 2 Delta t
ELSE
!
!
!* 4. SECOND ORDER ALL OR NOTHING CONDENSATION SCHEME
! -----------------------------------------------
!
!* 4.1 compute Delta 2
!
ZW1(:,:,:) = (ZW1(:,:,:) * ZLV(:,:,:) / ZW3(:,:,:) ) * &
( ((-2.*XBETAW+XGAMW*ZT(:,:,:)) / (XBETAW-XGAMW*ZT(:,:,:)) &
+ (XBETAW/ZT(:,:,:)-XGAMW)*(1.0+2.0*ZW2(:,:,:)/ZEPS))/ZT(:,:,:) )
!
!* 4.2 compute Delta 1
!
ZW2(:,:,:) = ZLV(:,:,:) / ZW3(:,:,:) * ( ZW2(:,:,:) - PRVS(:,:,:)*PTSTEP )
!
!* 4.3 compute the variation of mixing ratio
!
ZW3(:,:,:) = - ZW2(:,:,:) * ( 1 + 0.5 * ZW2(:,:,:) * ZW1(:,:,:) ) &
* ZCPH(:,:,:) / ZLV(:,:,:) / PTSTEP
!
! end of the IF structure on the all or nothing or statistical condensation
! scheme
!
END IF
!
!
!* 5. COMPUTE THE SOURCES AND STORES THE CLOUD FRACTION
! -------------------------------------------------
!
!
!* 5.1 compute the sources
!
ZW3(:,:,:) = MAX ( ZW3(:,:,:), -PRCS(:,:,:) )
WHERE (ZW3(:,:,:) > 0.0)
ZW3(:,:,:) = MIN ( ZW3(:,:,:), PRVS(:,:,:) )
END WHERE
WHERE (PCCS(:,:,:) > 0.0)
PRCS(:,:,:) = PRCS(:,:,:) + ZW3(:,:,:)
PRVS(:,:,:) = PRVS(:,:,:) - ZW3(:,:,:)
PTHS(:,:,:) = PTHS(:,:,:) + ZW3(:,:,:) * ZLV(:,:,:) / ZCPH(:,:,:) &
/ ZEXNS(:,:,:)
END WHERE
!
! WHERE (PRCS(:,:,:) <= 0.0) ! full evaporation of the cloud droplets
! PCNUCS(:,:,:) = 0.0
! PCCS(:,:,:) = 0.0
! END WHERE
WHERE (PRCS(:,:,:) <= 1.E-7/ PTSTEP ) ! full evaporation of the cloud droplets (PRCS >=0)
PRVS(:,:,:) = PRVS(:,:,:) + PRCS(:,:,:)
PTHS(:,:,:) = PTHS(:,:,:) - PRCS(:,:,:) * ZLV(:,:,:) / ZCPH(:,:,:) &
/ ZEXNS(:,:,:)
PRCS(:,:,:) = 0.0
PCNUCS(:,:,:) = 0.0
PCCS(:,:,:) = 0.0
END WHERE
! end of the iterative loop
!
END DO
!
!* 5.2 compute the cloud fraction PCLDFR
!
IF ( .NOT. OSUBG_COND ) THEN
WHERE (PRCS(:,:,:) > 1.E-12 / PTSTEP)
ZW1(:,:,:) = 1.
ELSEWHERE
ZW1(:,:,:) = 0.
ENDWHERE
IF ( SIZE(PSRCS,3) /= 0 ) THEN
PSRCS(:,:,:) = ZW1(:,:,:)
END IF
END IF
!
IF ( HRAD /= 'NONE' ) THEN
PCLDFR(:,:,:) = ZW1(:,:,:)
END IF
!
IF ( OCLOSE_OUT ) THEN
TZFIELD%CMNHNAME = 'NEB'
TZFIELD%CSTDNAME = ''
TZFIELD%CLONGNAME = 'MesoNH: NEB'
TZFIELD%CUNITS = '1'
TZFIELD%CDIR = 'XY'
TZFIELD%CCOMMENT = 'X_Y_Z_NEB'
TZFIELD%NGRID = 1
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 3

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TPFILE,TZFIELD,ZW1)
END IF
!
!
! 6. Horizontal mean Cloud fraction (for LES uses)
! ---------------------------------------------
!
!
!* 7. STORE THE BUDGET TERMS
! ----------------------
!
!
IF (LBUDGET_RV) CALL BUDGET (PRVS(:,:,:) * PRHODJ(:,:,:),6,'COND_BU_RRV')
IF (LBUDGET_RC) CALL BUDGET (PRCS(:,:,:) * PRHODJ(:,:,:),7,'COND_BU_RRC')
IF (LBUDGET_TH) CALL BUDGET (PTHS(:,:,:) * PRHODJ(:,:,:),4,'COND_BU_RTH')
IF (LBUDGET_SV) THEN
CALL BUDGET (PCNUCS(:,:,:) * PRHODJ(:,:,:),13+(NSV_C2R2BEG-1),'CEVA_BU_RSV') ! RCN
CALL BUDGET (PCCS(:,:,:) * PRHODJ(:,:,:),14+(NSV_C2R2BEG-1),'CEVA_BU_RSV') ! RCC
END IF
!
!------------------------------------------------------------------------------
!
!
END SUBROUTINE C2R2_ADJUST