Newer
Older

WAUTELET Philippe
committed
!MNH_LIC Copyright 2013-2020 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.
!-----------------------------------------------------------------
! #####################
MODULE MODI_LIMA_COLD_SLOW_PROCESSES
! #####################
!
INTERFACE

WAUTELET Philippe
committed
SUBROUTINE LIMA_COLD_SLOW_PROCESSES (PTSTEP, KMI, PZZ, PRHODJ, &
PRHODREF, PEXNREF, PPABST, &

WAUTELET Philippe
committed
PTHS, PRVS, PRIS, PRSS, &
PCIT, PCIS )
!
REAL, INTENT(IN) :: PTSTEP ! Time step
INTEGER, INTENT(IN) :: KMI ! Model index
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PZZ ! Height (z)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODREF! Reference density
REAL, DIMENSION(:,:,:), INTENT(IN) :: PEXNREF ! Reference Exner function
REAL, DIMENSION(:,:,:), INTENT(IN) :: PPABST ! abs. pressure at time t
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PTHT ! Theta at time t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRVT ! Water vapor m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRCT ! Cloud water m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRRT ! Rain water m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRIT ! Cloud ice m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRST ! Snow/aggregate m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRGT ! Graupel m.r. at t
!
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PTHS ! Theta source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRVS ! Water vapor m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRIS ! Pristine ice m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRSS ! Snow/aggregate m.r. source
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PCIT ! Ice crystal C. at t
!
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PCIS ! Ice crystal C. source
!
END SUBROUTINE LIMA_COLD_SLOW_PROCESSES
END INTERFACE
END MODULE MODI_LIMA_COLD_SLOW_PROCESSES
!

WAUTELET Philippe
committed
! ################################################################################
SUBROUTINE LIMA_COLD_SLOW_PROCESSES (PTSTEP, KMI, PZZ, PRHODJ, &
PRHODREF, PEXNREF, PPABST, &

WAUTELET Philippe
committed
PTHS, PRVS, PRIS, PRSS, &
PCIT, PCIS )
! ################################################################################
!
!! PURPOSE
!! -------
!! The purpose of this routine is to compute the microphysical sources
!! for slow cold processes :
!! - conversion of snow to ice
!! - deposition of vapor on snow
!! - conversion of ice to snow (Harrington 1995)
!! - aggregation of ice on snow
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!! J.-M. Cohard * Laboratoire d'Aerologie*
!! J.-P. Pinty * Laboratoire d'Aerologie*
!! S. Berthet * Laboratoire d'Aerologie*
!! B. Vié * Laboratoire d'Aerologie*
!!
!! MODIFICATIONS
!! -------------
!! Original ??/??/13
!! C. Barthe * LACy * jan. 2014 add budgets
! P. Wautelet 05/2016-04/2018: new data structures and calls for I/O
! P. Wautelet 28/05/2019: move COUNTJV function to tools.f90

WAUTELET Philippe
committed
! P. Wautelet 03/2020: use the new data structures and subroutines for budgets

VIE Benoît
committed
! J. Wurtz 03/2022: new snow characteristics
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
use modd_budget, only: lbu_enable, nbumod, &
lbudget_th, lbudget_rv, lbudget_ri, lbudget_rs, lbudget_sv, &
NBUDGET_TH, NBUDGET_RV, NBUDGET_RI, NBUDGET_RS, NBUDGET_SV1, &
tbudgets
USE MODD_CST, ONLY: XP00, XRD, XRV, XMV, XMD, XCPD, XCPV, &
XCL, XCI, XTT, XLSTT, XALPI, XBETAI, XGAMI
USE MODD_NSV, ONLY: NSV_LIMA_NI
USE MODD_PARAMETERS, ONLY: JPHEXT, JPVEXT

VIE Benoît
committed
USE MODD_PARAM_LIMA, ONLY: LSNOW, LSNOW_T, XRTMIN, XCTMIN, &
XALPHAI, XALPHAS, XNUI, XNUS
USE MODD_PARAM_LIMA_COLD, ONLY: XLBI, XLBEXI, XLBS, XLBEXS, XBI, XCXS, XCCS, &
XLBDAS_MAX, XDSCNVI_LIM, XLBDASCNVI_MAX, &
XC0DEPSI, XC1DEPSI, XR0DEPSI, XR1DEPSI, &
XSCFAC, X1DEPS, X0DEPS, XEX1DEPS, XEX0DEPS, &
XDICNVS_LIM, XLBDAICNVS_LIM, &
XC0DEPIS, XC1DEPIS, XR0DEPIS, XR1DEPIS, &
XCOLEXIS, XAGGS_CLARGE1, XAGGS_CLARGE2, &
XAGGS_RLARGE1, XAGGS_RLARGE2, XBS, &
XLBDAS_MIN,XFVELOS,XTRANS_MP_GAMMAS

WAUTELET Philippe
committed
use mode_budget, only: Budget_store_init, Budget_store_end
use mode_tools, only: Countjv
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
IMPLICIT NONE
!
!* 0.1 Declarations of dummy arguments :
!
REAL, INTENT(IN) :: PTSTEP ! Time step
INTEGER, INTENT(IN) :: KMI ! Model index
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PZZ ! Height (z)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODJ ! Dry density * Jacobian
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODREF! Reference density
REAL, DIMENSION(:,:,:), INTENT(IN) :: PEXNREF ! Reference Exner function
REAL, DIMENSION(:,:,:), INTENT(IN) :: PPABST ! abs. pressure at time t
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PTHT ! Theta at time t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRVT ! Water vapor m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRCT ! Cloud water m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRRT ! Rain water m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRIT ! Cloud ice m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRST ! Snow/aggregate m.r. at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRGT ! Graupel m.r. at t
!
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PTHS ! Theta source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRVS ! Water vapor m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRIS ! Pristine ice m.r. source
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRSS ! Snow/aggregate m.r. source
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PCIT ! Ice crystal C. at t
!
REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PCIS ! Ice crystal C. source
!
!* 0.2 Declarations of local variables :
!
LOGICAL, DIMENSION(SIZE(PRHODREF,1),SIZE(PRHODREF,2),SIZE(PRHODREF,3)) &
:: GMICRO ! Computations only where necessary
INTEGER :: IMICRO
INTEGER , DIMENSION(SIZE(GMICRO)) :: I1,I2,I3 ! Used to replace PACK
INTEGER :: JL ! and PACK intrinsics
!
REAL, DIMENSION(:), ALLOCATABLE :: ZRVT ! Water vapor m.r. at t
REAL, DIMENSION(:), ALLOCATABLE :: ZRCT ! Cloud water m.r. at t
REAL, DIMENSION(:), ALLOCATABLE :: ZRRT ! Rain water m.r. at t
REAL, DIMENSION(:), ALLOCATABLE :: ZRIT ! Pristine ice m.r. at t
REAL, DIMENSION(:), ALLOCATABLE :: ZRST ! Snow/aggregate m.r. at t
REAL, DIMENSION(:), ALLOCATABLE :: ZRGT ! Graupel/hail m.r. at t
!
REAL, DIMENSION(:), ALLOCATABLE :: ZCIT ! Pristine ice conc. at t
!
REAL, DIMENSION(:), ALLOCATABLE :: ZRVS ! Water vapor m.r. source
REAL, DIMENSION(:), ALLOCATABLE :: ZRIS ! Pristine ice m.r. source
REAL, DIMENSION(:), ALLOCATABLE :: ZRSS ! Snow/aggregate m.r. source
!
REAL, DIMENSION(:), ALLOCATABLE :: ZTHS ! Theta source
!
REAL, DIMENSION(:), ALLOCATABLE :: ZCIS ! Pristine ice conc. source
!
REAL, DIMENSION(:), ALLOCATABLE &
:: ZRHODREF, & ! RHO Dry REFerence
ZRHODJ, & ! RHO times Jacobian
ZZT, & ! Temperature
ZPRES, & ! Pressure
ZEXNREF, & ! EXNer Pressure REFerence
ZZW, & ! Work array
ZZX, & ! Work array
ZLSFACT, & ! L_s/(Pi_ref*C_ph)
ZSSI, & ! Supersaturation over ice
ZLBDAI, & ! Slope parameter of the ice crystal distr.
ZLBDAS, & ! Slope parameter of the aggregate distr.
ZAI, & ! Thermodynamical function
ZCJ, & ! used to compute the ventilation coefficient
ZKA, & ! Thermal conductivity of the air
ZDV, & ! Diffusivity of water vapor in the air
ZVISCA ! Viscosity of air
!
REAL, DIMENSION(:,:), ALLOCATABLE :: ZZW1 ! Work arrays
!
REAL, DIMENSION(SIZE(PRHODREF,1),SIZE(PRHODREF,2),SIZE(PRHODREF,3)) &
:: ZT, ZW ! Temperature
!
INTEGER :: IIB, IIE, IJB, IJE, IKB, IKE ! Physical domain
!
REAL, DIMENSION(:), ALLOCATABLE :: ZRTMIN, ZCTMIN
!
!-------------------------------------------------------------------------------
!
! Physical domain
!
IIB=1+JPHEXT
IIE=SIZE(PZZ,1) - JPHEXT
IJB=1+JPHEXT
IJE=SIZE(PZZ,2) - JPHEXT
IKB=1+JPVEXT
IKE=SIZE(PZZ,3) - JPVEXT
!
! Physical limitations
!
ALLOCATE(ZRTMIN(SIZE(XRTMIN)))
ALLOCATE(ZCTMIN(SIZE(XCTMIN)))
ZRTMIN(:) = XRTMIN(:) / PTSTEP
ZCTMIN(:) = XCTMIN(:) / PTSTEP
!
! Temperature
ZT(:,:,:) = PTHT(:,:,:) * ( PPABST(:,:,:)/XP00 ) ** (XRD/XCPD)
!
! Looking for regions where computations are necessary
!
GMICRO(:,:,:) = .FALSE.
GMICRO(IIB:IIE,IJB:IJE,IKB:IKE) = &
PRIT(IIB:IIE,IJB:IJE,IKB:IKE)>XRTMIN(4) .OR. &
PRST(IIB:IIE,IJB:IJE,IKB:IKE)>XRTMIN(5)
!
IMICRO = COUNTJV( GMICRO(:,:,:),I1(:),I2(:),I3(:))
!
IF( IMICRO >= 1 ) THEN
!
!------------------------------------------------------------------------------
!
!
!* 1. Optimization : packing variables
! --------------------------------
!
!
!
ALLOCATE(ZRVT(IMICRO))
ALLOCATE(ZRCT(IMICRO))
ALLOCATE(ZRRT(IMICRO))
ALLOCATE(ZRIT(IMICRO))
ALLOCATE(ZRST(IMICRO))
ALLOCATE(ZRGT(IMICRO))
!
ALLOCATE(ZCIT(IMICRO))
!
ALLOCATE(ZRVS(IMICRO))
ALLOCATE(ZRIS(IMICRO))
ALLOCATE(ZRSS(IMICRO))
!
ALLOCATE(ZTHS(IMICRO))
!
ALLOCATE(ZCIS(IMICRO))
!
ALLOCATE(ZRHODREF(IMICRO))
ALLOCATE(ZZT(IMICRO))
ALLOCATE(ZPRES(IMICRO))
ALLOCATE(ZEXNREF(IMICRO))
DO JL=1,IMICRO
ZRVT(JL) = PRVT(I1(JL),I2(JL),I3(JL))
ZRCT(JL) = PRCT(I1(JL),I2(JL),I3(JL))
ZRRT(JL) = PRRT(I1(JL),I2(JL),I3(JL))
ZRIT(JL) = PRIT(I1(JL),I2(JL),I3(JL))
ZRST(JL) = PRST(I1(JL),I2(JL),I3(JL))
ZRGT(JL) = PRGT(I1(JL),I2(JL),I3(JL))
!
ZCIT(JL) = PCIT(I1(JL),I2(JL),I3(JL))
!
ZRVS(JL) = PRVS(I1(JL),I2(JL),I3(JL))
ZRIS(JL) = PRIS(I1(JL),I2(JL),I3(JL))
ZRSS(JL) = PRSS(I1(JL),I2(JL),I3(JL))
!
ZTHS(JL) = PTHS(I1(JL),I2(JL),I3(JL))
!
ZCIS(JL) = PCIS(I1(JL),I2(JL),I3(JL))
!
ZRHODREF(JL) = PRHODREF(I1(JL),I2(JL),I3(JL))
ZZT(JL) = ZT(I1(JL),I2(JL),I3(JL))
ZPRES(JL) = PPABST(I1(JL),I2(JL),I3(JL))
ZEXNREF(JL) = PEXNREF(I1(JL),I2(JL),I3(JL))
ENDDO
!
IF (NBUMOD==KMI .AND. LBU_ENABLE) THEN
ALLOCATE(ZRHODJ(IMICRO))
ZRHODJ(:) = PACK( PRHODJ(:,:,:),MASK=GMICRO(:,:,:) )
END IF
!
!
!------------------------------------------------------------------------------
!
!
!* 2. Microphysical computations
! --------------------------
!
!
ALLOCATE(ZZW(IMICRO))
ALLOCATE(ZZX(IMICRO))
ALLOCATE(ZLSFACT(IMICRO))
ALLOCATE(ZSSI(IMICRO))
ALLOCATE(ZLBDAI(IMICRO))
ALLOCATE(ZLBDAS(IMICRO))
ALLOCATE(ZAI(IMICRO))
ALLOCATE(ZCJ(IMICRO))
ALLOCATE(ZKA(IMICRO))
ALLOCATE(ZDV(IMICRO))
ALLOCATE(ZZW1(IMICRO,7))
!
! Preliminary computations
!
ZZW(:) = ZEXNREF(:)*( XCPD+XCPV*ZRVT(:)+XCL*(ZRCT(:)+ZRRT(:)) &
+XCI*(ZRIT(:)+ZRST(:)+ZRGT(:)) )
!
ZLSFACT(:) = (XLSTT+(XCPV-XCI)*(ZZT(:)-XTT))/ZZW(:) ! L_s/(Pi_ref*C_ph)
!
ZZW(:) = EXP( XALPI - XBETAI/ZZT(:) - XGAMI*ALOG(ZZT(:) ) )
ZSSI(:) = ZRVT(:)*( ZPRES(:)-ZZW(:) ) / ( (XMV/XMD) * ZZW(:) ) - 1.0
! Supersaturation over ice
! Distribution parameters for ice and snow
ZLBDAI(:) = 1.E10
WHERE (ZRIT(:)>XRTMIN(4) .AND. ZCIT(:)>XCTMIN(4))
ZLBDAI(:) = ( XLBI*ZCIT(:) / ZRIT(:) )**XLBEXI
END WHERE
ZLBDAS(:) = 1.E10

VIE Benoît
committed
IF (LSNOW_T) THEN
WHERE(ZZT(:)>263.15 .AND. ZRST(:)>XRTMIN(5))
ZLBDAS(:) = MAX(MIN(XLBDAS_MAX, 10**(14.554-0.0423*ZZT(:))),XLBDAS_MIN)
END WHERE
WHERE(ZZT(:)<=263.15 .AND. ZRST(:)>XRTMIN(5))
ZLBDAS(:) = MAX(MIN(XLBDAS_MAX, 10**(6.226-0.0106*ZZT(:))),XLBDAS_MIN)
END WHERE
ZLBDAS(:) = ZLBDAS(:) * XTRANS_MP_GAMMAS
ELSE
WHERE (ZRST(:)>XRTMIN(5) )
ZLBDAS(:) = MAX(MIN(XLBDAS_MAX,XLBS*( ZRHODREF(:)*ZRST(:) )**XLBEXS),XLBDAS_MIN)
END WHERE
END IF
!
ZKA(:) = 2.38E-2 + 0.0071E-2 * ( ZZT(:) - XTT ) ! k_a
ZDV(:) = 0.211E-4 * (ZZT(:)/XTT)**1.94 * (XP00/ZPRES(:)) ! D_v
!
! Thermodynamical function ZAI = A_i(T,P)
ZAI(:) = ( XLSTT + (XCPV-XCI)*(ZZT(:)-XTT) )**2 / (ZKA(:)*XRV*ZZT(:)**2) &
+ ( XRV*ZZT(:) ) / (ZDV(:)*ZZW(:))
! ZCJ = c^prime_j/c_i (in the ventilation factor) ( c_i from v(D)=c_i*D^(d_i) )
ZCJ(:) = XSCFAC * ZRHODREF(:)**0.3 / SQRT( 1.718E-5+0.0049E-5*(ZZT(:)-XTT) )
!
!
!
!
!* 2.1 Conversion of snow to r_i: RSCNVI
! ----------------------------------------
!

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_ri ) call Budget_store_init( tbudgets(NBUDGET_RI), 'CNVI', pris(:, :, :) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_init( tbudgets(NBUDGET_RS), 'CNVI', prss(:, :, :) * prhodj(:, :, :) )
if ( lbudget_sv ) &
call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'CNVI', pcis(:, :, :) * prhodj(:, :, :) )
end if
ZZW(:) = 0.0
WHERE ( ZLBDAS(:)<XLBDASCNVI_MAX .AND. (ZRST(:)>XRTMIN(5)) &
.AND. (ZSSI(:)<0.0) )
ZZW(:) = (ZLBDAS(:)*XDSCNVI_LIM)**(XALPHAS)

VIE Benoît
committed
ZZX(:) = ( -ZSSI(:)/ZAI(:) ) * (XLBS*ZRST(:)*ZLBDAS(:)**XBS) * (ZZW(:)**XNUI) * EXP(-ZZW(:))
!
ZZW(:) = MIN( ( XR0DEPSI+XR1DEPSI*ZCJ(:) )*ZZX(:),ZRSS(:) )
ZRIS(:) = ZRIS(:) + ZZW(:)
ZRSS(:) = ZRSS(:) - ZZW(:)
!
ZZW(:) = ZZW(:)*( XC0DEPSI+XC1DEPSI*ZCJ(:) )/( XR0DEPSI+XR1DEPSI*ZCJ(:) )
ZCIS(:) = ZCIS(:) + ZZW(:)
END WHERE
!
! Budget storage

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_ri ) call Budget_store_end( tbudgets(NBUDGET_RI), 'CNVI', &
Unpack( zris(:), mask = gmicro(:, :, :), field = pris(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_end( tbudgets(NBUDGET_RS), 'CNVI', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_sv ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'CNVI', &
Unpack( zcis(:), mask = gmicro(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) )
end if
!
!
!* 2.2 Deposition of water vapor on r_s: RVDEPS
! -----------------------------------------------
!

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_th ) call Budget_store_init( tbudgets(NBUDGET_TH), 'DEPS', pths(:, :, :) * prhodj(:, :, :) )
if ( lbudget_rv ) call Budget_store_init( tbudgets(NBUDGET_RV), 'DEPS', prvs(:, :, :) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_init( tbudgets(NBUDGET_RS), 'DEPS', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
end if
WHERE ( (ZRST(:)>XRTMIN(5)) .AND. (ZRSS(:)>ZRTMIN(5)) )

VIE Benoît
committed
ZZW(:) = ( ZRST(:)*ZSSI(:)/(ZAI(:)) ) * &
( X0DEPS*ZLBDAS(:)**XEX0DEPS + &
(X1DEPS*ZCJ(:)*(1+(XFVELOS/(2.*ZLBDAS))**XALPHAS)**(-XNUS+XEX1DEPS/XALPHAS) * &

VIE Benoît
committed
(ZLBDAS(:))**(XEX1DEPS+XBS)))
ZZW(:) = MIN( ZRVS(:),ZZW(:) )*(0.5+SIGN(0.5,ZZW(:))) &
- MIN( ZRSS(:),ABS(ZZW(:)) )*(0.5-SIGN(0.5,ZZW(:)))
ZRSS(:) = ZRSS(:) + ZZW(:)
ZRVS(:) = ZRVS(:) - ZZW(:)
ZTHS(:) = ZTHS(:) + ZZW(:)*ZLSFACT(:)
END WHERE
! Budget storage

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_th ) call Budget_store_end( tbudgets(NBUDGET_TH), 'DEPS', &
Unpack( zths(:), mask = gmicro(:, :, :), field = pths(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rv ) call Budget_store_end( tbudgets(NBUDGET_RV), 'DEPS', &
Unpack( zrvs(:), mask = gmicro(:, :, :), field = prvs(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_end( tbudgets(NBUDGET_RS), 'DEPS', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
end if
!
!* 2.3 Conversion of pristine ice to r_s: RICNVS
! ------------------------------------------------
!

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_ri ) call Budget_store_init( tbudgets(NBUDGET_RI), 'CNVS', &
Unpack( zris(:), mask = gmicro(:, :, :), field = pris(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_init( tbudgets(NBUDGET_RS), 'CNVS', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_sv ) call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'CNVS', &
Unpack( zcis(:), mask = gmicro(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) )
end if
ZZW(:) = 0.0
WHERE ( (ZLBDAI(:)<XLBDAICNVS_LIM) .AND. (ZCIT(:)>XCTMIN(4)) &
.AND. (ZSSI(:)>0.0) )
ZZW(:) = (ZLBDAI(:)*XDICNVS_LIM)**(XALPHAI)
ZZX(:) = ( ZSSI(:)/ZAI(:) )*ZCIT(:) * (ZZW(:)**XNUI) *EXP(-ZZW(:))
!
ZZW(:) = MAX( MIN( ( XR0DEPIS + XR1DEPIS*ZCJ(:) )*ZZX(:) &
,ZRIS(:) ) + ZRTMIN(5), ZRTMIN(5) ) - ZRTMIN(5)
ZRIS(:) = ZRIS(:) - ZZW(:)
ZRSS(:) = ZRSS(:) + ZZW(:)
!
ZZW(:) = MIN( ZZW(:)*(( XC0DEPIS+XC1DEPIS*ZCJ(:) ) &
/( XR0DEPIS+XR1DEPIS*ZCJ(:) )),ZCIS(:) )
ZCIS(:) = ZCIS(:) - ZZW(:)
END WHERE
!
! Budget storage

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_ri ) call Budget_store_end( tbudgets(NBUDGET_RI), 'CNVS', &
Unpack( zris(:), mask = gmicro(:, :, :), field = pris(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_end( tbudgets(NBUDGET_RS), 'CNVS', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_sv ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'CNVS', &
Unpack( zcis(:), mask = gmicro(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) )
end if
!
!
!* 2.4 Aggregation of r_i on r_s: CIAGGS and RIAGGS
! ---------------------------------------------------
!

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_ri ) call Budget_store_init( tbudgets(NBUDGET_RI), 'AGGS', &
Unpack( zris(:), mask = gmicro(:, :, :), field = pris(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_init( tbudgets(NBUDGET_RS), 'AGGS', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_sv ) call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'AGGS', &
Unpack( zcis(:), mask = gmicro(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) )
end if
WHERE ( (ZRIT(:)>XRTMIN(4)) .AND. (ZRST(:)>XRTMIN(5)) .AND. (ZRIS(:)>ZRTMIN(4)) &
.AND. (ZCIS(:)>ZCTMIN(4)) )
ZZW1(:,1) = (ZCIT(:)*(XLBS*ZRST(:)*ZLBDAS(:)**XBS)*EXP(XCOLEXIS*(ZZT(:)-XTT) )) &
/ (ZLBDAI(:)**3)
ZZW1(:,2) = MIN( ZZW1(:,1)*(XAGGS_CLARGE1+XAGGS_CLARGE2*ZZW1(:,3)),ZCIS(:) )
ZCIS(:) = ZCIS(:) - ZZW1(:,2)
!
ZZW1(:,1) = ZZW1(:,1) / ZLBDAI(:)**XBI
ZZW1(:,2) = MIN( ZZW1(:,1)*(XAGGS_RLARGE1+XAGGS_RLARGE2*ZZW1(:,3)),ZRIS(:) )
ZRIS(:) = ZRIS(:) - ZZW1(:,2)
ZRSS(:) = ZRSS(:) + ZZW1(:,2)
END WHERE
! Budget storage

WAUTELET Philippe
committed
if ( nbumod == kmi .and. lbu_enable ) then
if ( lbudget_ri ) call Budget_store_end( tbudgets(NBUDGET_RI), 'AGGS', &
Unpack( zris(:), mask = gmicro(:, :, :), field = pris(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_rs ) call Budget_store_end( tbudgets(NBUDGET_RS), 'AGGS', &
Unpack( zrss(:), mask = gmicro(:, :, :), field = prss(:, :, :) ) * prhodj(:, :, :) )
if ( lbudget_sv ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'AGGS', &
Unpack( zcis(:), mask = gmicro(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) )
end if
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
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
!------------------------------------------------------------------------------
!
!
!* 3. Unpacking & Deallocating
! ------------------------
!
!
ZW(:,:,:) = PRVS(:,:,:)
PRVS(:,:,:) = UNPACK( ZRVS(:),MASK=GMICRO(:,:,:),FIELD=ZW(:,:,:) )
ZW(:,:,:) = PRIS(:,:,:)
PRIS(:,:,:) = UNPACK( ZRIS(:),MASK=GMICRO(:,:,:),FIELD=ZW(:,:,:) )
ZW(:,:,:) = PRSS(:,:,:)
PRSS(:,:,:) = UNPACK( ZRSS(:),MASK=GMICRO(:,:,:),FIELD=ZW(:,:,:) )
!
ZW(:,:,:) = PCIS(:,:,:)
PCIS(:,:,:) = UNPACK( ZCIS(:),MASK=GMICRO(:,:,:),FIELD=ZW(:,:,:) )
!
ZW(:,:,:) = PTHS(:,:,:)
PTHS(:,:,:) = UNPACK( ZTHS(:),MASK=GMICRO(:,:,:),FIELD=ZW(:,:,:) )
!
DEALLOCATE(ZRVT)
DEALLOCATE(ZRCT)
DEALLOCATE(ZRRT)
DEALLOCATE(ZRIT)
DEALLOCATE(ZRST)
DEALLOCATE(ZRGT)
DEALLOCATE(ZCIT)
DEALLOCATE(ZRVS)
DEALLOCATE(ZRIS)
DEALLOCATE(ZRSS)
DEALLOCATE(ZTHS)
DEALLOCATE(ZCIS)
DEALLOCATE(ZRHODREF)
DEALLOCATE(ZZT)
DEALLOCATE(ZPRES)
DEALLOCATE(ZEXNREF)
DEALLOCATE(ZZW)
DEALLOCATE(ZZX)
DEALLOCATE(ZLSFACT)
DEALLOCATE(ZSSI)
DEALLOCATE(ZLBDAI)
DEALLOCATE(ZLBDAS)
DEALLOCATE(ZAI)
DEALLOCATE(ZCJ)
DEALLOCATE(ZKA)
DEALLOCATE(ZDV)
DEALLOCATE(ZZW1)
IF (NBUMOD==KMI .AND. LBU_ENABLE) DEALLOCATE(ZRHODJ)
!
END IF
!
!++cb++
DEALLOCATE(ZRTMIN)
DEALLOCATE(ZCTMIN)
!--cb--
!
END SUBROUTINE LIMA_COLD_SLOW_PROCESSES