GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/phys_state_var_mod.F90 Lines: 164 289 56.7 %
Date: 2023-06-30 12:51:15 Branches: 902 2348 38.4 %

Line Branch Exec Source
1
!
2
! $Id: phys_state_var_mod.F90 4556 2023-05-31 15:27:03Z musat $
3
!
4
      MODULE phys_state_var_mod
5
! Variables sauvegardees pour le startphy.nc
6
!======================================================================
7
!
8
!
9
!======================================================================
10
! Declaration des variables
11
      USE dimphy
12
      USE netcdf, only: nf90_fill_real
13
      INTEGER, PARAMETER :: nlevSTD=17
14
      INTEGER, PARAMETER :: nlevSTD8=8
15
      INTEGER, PARAMETER :: nlevSTD3=3
16
      INTEGER, PARAMETER :: nout=3
17
      INTEGER, PARAMETER :: napisccp=1
18
      INTEGER, SAVE :: radpas  ! radiation is called every "radpas" step
19
      INTEGER, SAVE :: cvpas   ! convection is called every "cvpas" step
20
      INTEGER, SAVE :: cvpas_0 = 1 ! reference value for cvpas
21
      INTEGER, SAVE :: wkpas   ! wake scheme is called every "wkpas" step
22
      REAL, PARAMETER :: missing_val_nf90=nf90_fill_real
23
!$OMP THREADPRIVATE(radpas)
24
!$OMP THREADPRIVATE(cvpas)
25
!$OMP THREADPRIVATE(cvpas_0)
26
!$OMP THREADPRIVATE(wkpas)
27
      REAL, SAVE :: phys_tstep=0, solaire_etat0
28
!$OMP THREADPRIVATE(phys_tstep, solaire_etat0)
29
30
      REAL, ALLOCATABLE, SAVE :: pctsrf(:,:)
31
!$OMP THREADPRIVATE(pctsrf)
32
      REAL, ALLOCATABLE, SAVE :: ftsol(:,:)
33
!$OMP THREADPRIVATE(ftsol)
34
      REAL, ALLOCATABLE, SAVE :: beta_aridity(:,:)
35
!$OMP THREADPRIVATE(beta_aridity)
36
      REAL,ALLOCATABLE,SAVE :: qsol(:),fevap(:,:),z0m(:,:),z0h(:,:),agesno(:,:)
37
!$OMP THREADPRIVATE(qsol,fevap,z0m,z0h,agesno)
38
!FC drag des arbres
39
      REAL, ALLOCATABLE, SAVE :: treedrg(:,:,:)
40
!$OMP THREADPRIVATE(treedrg)
41
42
!      character(len=6), SAVE :: ocean
43
!!!!!!$OMP THREADPRIVATE(ocean)
44
!      logical, SAVE :: ok_veget
45
!!!!!!$OMP THREADPRIVATE(ok_veget)
46
      REAL, ALLOCATABLE, SAVE :: falb1(:,:), falb2(:,:)
47
!$OMP THREADPRIVATE(falb1, falb2)
48
49
!albedo SB >>>
50
      REAL, ALLOCATABLE, SAVE :: falb_dif(:,:,:), falb_dir(:,:,:)
51
      REAL, ALLOCATABLE, SAVE :: chl_con(:)
52
!$OMP THREADPRIVATE(falb_dir,falb_dif,chl_con)
53
!albedo SB <<<
54
55
56
      REAL, ALLOCATABLE, SAVE :: rain_fall(:), snow_fall(:), bs_fall(:)
57
!$OMP THREADPRIVATE( rain_fall, snow_fall, bs_fall)
58
      REAL, ALLOCATABLE, SAVE :: solsw(:), solswfdiff(:), sollw(:)
59
!$OMP THREADPRIVATE(solsw, solswfdiff, sollw)
60
      REAL, ALLOCATABLE, SAVE :: radsol(:)
61
!$OMP THREADPRIVATE(radsol)
62
      REAL, ALLOCATABLE, SAVE :: swradcorr(:)
63
!$OMP THREADPRIVATE(swradcorr)
64
#ifdef ISO
65
      REAL,ALLOCATABLE,SAVE :: xtsol(:,:),fxtevap(:,:,:)
66
!$OMP THREADPRIVATE(xtsol,fxtevap)
67
      REAL, ALLOCATABLE, SAVE :: xtrain_fall(:,:), xtsnow_fall(:,:)
68
!$OMP THREADPRIVATE(xtrain_fall,xtsnow_fall)
69
#endif
70
71
!clesphy0 param physiq
72
!
73
! Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
74
!
75
      REAL, ALLOCATABLE, SAVE :: zmea(:), zstd(:), zsig(:), zgam(:)
76
!$OMP THREADPRIVATE(zmea, zstd, zsig, zgam)
77
      REAL, ALLOCATABLE, SAVE :: zthe(:), zpic(:), zval(:)
78
!$OMP THREADPRIVATE(zthe, zpic, zval)
79
!     REAL tabcntr0(100)
80
      REAL, ALLOCATABLE, SAVE :: rugoro(:)
81
!$OMP THREADPRIVATE(rugoro)
82
      REAL, ALLOCATABLE, SAVE :: t_ancien(:,:), q_ancien(:,:)
83
!$OMP THREADPRIVATE(t_ancien, q_ancien)
84
      REAL, ALLOCATABLE, SAVE :: ql_ancien(:,:), qs_ancien(:,:), qbs_ancien(:,:)
85
!$OMP THREADPRIVATE(ql_ancien, qs_ancien, qbs_ancien)
86
      REAL, ALLOCATABLE, SAVE :: prw_ancien(:), prlw_ancien(:), prsw_ancien(:), prbsw_ancien(:)
87
!$OMP THREADPRIVATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
88
#ifdef ISO
89
      REAL, ALLOCATABLE, SAVE :: xt_ancien(:,:,:),xtl_ancien(:,:,:),xts_ancien(:,:,:)
90
!$OMP THREADPRIVATE(xt_ancien,xtl_ancien,xts_ancien)
91
#endif
92
      REAL, ALLOCATABLE, SAVE :: u_ancien(:,:), v_ancien(:,:)
93
!$OMP THREADPRIVATE(u_ancien, v_ancien)
94
!!! RomP >>>
95
      REAL, ALLOCATABLE, SAVE :: tr_ancien(:,:,:)
96
!$OMP THREADPRIVATE(tr_ancien)
97
!!! RomP <<<
98
      LOGICAL, SAVE :: ancien_ok
99
!$OMP THREADPRIVATE(ancien_ok)
100
      REAL, ALLOCATABLE, SAVE :: clwcon(:,:),rnebcon(:,:)
101
!$OMP THREADPRIVATE(clwcon,rnebcon)
102
      REAL, ALLOCATABLE, SAVE :: rneb_ancien(:,:)
103
!$OMP THREADPRIVATE(rneb_ancien)
104
      REAL, ALLOCATABLE, SAVE :: qtc_cv(:,:),sigt_cv(:,:)
105
!$OMP THREADPRIVATE(qtc_cv,sigt_cv)
106
      REAL, ALLOCATABLE, SAVE :: ratqs(:,:)
107
!$OMP THREADPRIVATE(ratqs)
108
      REAL, ALLOCATABLE, SAVE :: pbl_tke(:,:,:) ! turb kinetic energy
109
      REAL, ALLOCATABLE, SAVE :: coefh(:,:,:) ! Kz enthalpie
110
      REAL, ALLOCATABLE, SAVE :: coefm(:,:,:) ! Kz momentum
111
!$OMP THREADPRIVATE(pbl_tke, coefh,coefm)
112
      REAL, ALLOCATABLE, SAVE :: zmax0(:), f0(:) !
113
!$OMP THREADPRIVATE(zmax0,f0)
114
      REAL, ALLOCATABLE, SAVE :: sig1(:,:), w01(:,:)
115
!$OMP THREADPRIVATE(sig1,w01)
116
      REAL, ALLOCATABLE, SAVE :: entr_therm(:,:), fm_therm(:,:)
117
!$OMP THREADPRIVATE(entr_therm,fm_therm)
118
      REAL, ALLOCATABLE, SAVE :: detr_therm(:,:)
119
!$OMP THREADPRIVATE(detr_therm)
120
!IM 150408
121
!     pour phsystoke avec thermiques
122
      REAL,ALLOCATABLE,SAVE :: clwcon0th(:,:),rnebcon0th(:,:)
123
!$OMP THREADPRIVATE(clwcon0th,rnebcon0th)
124
! radiation outputs
125
      REAL,ALLOCATABLE,SAVE :: swdnc0(:,:), swdn0(:,:), swdn(:,:)
126
!$OMP THREADPRIVATE(swdnc0,swdn0,swdn)
127
      REAL,ALLOCATABLE,SAVE :: swupc0(:,:), swup0(:,:), swup(:,:)
128
!$OMP THREADPRIVATE(swupc0, swup0,swup)
129
      REAL,ALLOCATABLE,SAVE :: SWdn200clr(:), SWdn200(:)
130
!$OMP THREADPRIVATE(SWdn200clr,SWdn200)
131
      REAL,ALLOCATABLE,SAVE :: SWup200clr(:), SWup200(:)
132
!$OMP THREADPRIVATE(SWup200clr,SWup200)
133
      REAL,ALLOCATABLE,SAVE :: lwdnc0(:,:), lwdn0(:,:), lwdn(:,:)
134
!$OMP THREADPRIVATE(lwdnc0,lwdn0,lwdn)
135
      REAL,ALLOCATABLE,SAVE :: lwupc0(:,:), lwup0(:,:), lwup(:,:)
136
!$OMP THREADPRIVATE(lwupc0,lwup0,lwup)
137
      REAL,ALLOCATABLE,SAVE :: LWdn200clr(:), LWdn200(:)
138
!$OMP THREADPRIVATE(LWdn200clr,LWdn200)
139
      REAL,ALLOCATABLE,SAVE :: LWup200clr(:), LWup200(:)
140
!$OMP THREADPRIVATE(LWup200clr,LWup200)
141
      REAL,ALLOCATABLE,SAVE :: LWdnTOA(:), LWdnTOAclr(:)
142
!$OMP THREADPRIVATE(LWdnTOA,LWdnTOAclr)
143
! pressure level
144
      REAL,ALLOCATABLE,SAVE :: tsumSTD(:,:,:)
145
!$OMP THREADPRIVATE(tsumSTD)
146
      REAL,ALLOCATABLE,SAVE :: usumSTD(:,:,:), vsumSTD(:,:,:)
147
!$OMP THREADPRIVATE(usumSTD,vsumSTD)
148
      REAL,ALLOCATABLE,SAVE :: wsumSTD(:,:,:), phisumSTD(:,:,:)
149
!$OMP THREADPRIVATE(wsumSTD,phisumSTD)
150
      REAL,ALLOCATABLE,SAVE :: qsumSTD(:,:,:), rhsumSTD(:,:,:)
151
!$OMP THREADPRIVATE(qsumSTD,rhsumSTD)
152
      REAL,ALLOCATABLE,SAVE :: tnondef(:,:,:)
153
!$OMP THREADPRIVATE(tnondef)
154
      REAL,ALLOCATABLE,SAVE :: uvsumSTD(:,:,:)
155
!$OMP THREADPRIVATE(uvsumSTD)
156
      REAL,ALLOCATABLE,SAVE :: vqsumSTD(:,:,:)
157
!$OMP THREADPRIVATE(vqsumSTD)
158
      REAL,ALLOCATABLE,SAVE :: vTsumSTD(:,:,:)
159
!$OMP THREADPRIVATE(vTsumSTD)
160
      REAL,ALLOCATABLE,SAVE :: wqsumSTD(:,:,:)
161
!$OMP THREADPRIVATE(wqsumSTD)
162
      REAL,ALLOCATABLE,SAVE :: vphisumSTD(:,:,:)
163
!$OMP THREADPRIVATE(vphisumSTD)
164
      REAL,ALLOCATABLE,SAVE :: wTsumSTD(:,:,:)
165
!$OMP THREADPRIVATE(wTsumSTD)
166
      REAL,ALLOCATABLE,SAVE :: u2sumSTD(:,:,:)
167
!$OMP THREADPRIVATE(u2sumSTD)
168
      REAL,ALLOCATABLE,SAVE :: v2sumSTD(:,:,:)
169
!$OMP THREADPRIVATE(v2sumSTD)
170
      REAL,ALLOCATABLE,SAVE :: T2sumSTD(:,:,:)
171
!$OMP THREADPRIVATE(T2sumSTD)
172
      REAL,ALLOCATABLE,SAVE :: O3sumSTD(:,:,:), O3daysumSTD(:,:,:)
173
!$OMP THREADPRIVATE(O3sumSTD,O3daysumSTD)
174
!IM begin
175
      REAL,ALLOCATABLE,SAVE :: wlevSTD(:,:), ulevSTD(:,:), vlevSTD(:,:)
176
!$OMP THREADPRIVATE(wlevSTD,ulevSTD,vlevSTD)
177
      REAL,ALLOCATABLE,SAVE :: tlevSTD(:,:), qlevSTD(:,:), rhlevSTD(:,:)
178
!$OMP THREADPRIVATE(tlevSTD,qlevSTD,rhlevSTD)
179
      REAL,ALLOCATABLE,SAVE :: philevSTD(:,:)
180
!$OMP THREADPRIVATE(philevSTD)
181
      REAL,ALLOCATABLE,SAVE :: uvSTD(:,:)
182
!$OMP THREADPRIVATE(uvSTD)
183
      REAL,ALLOCATABLE,SAVE :: vqSTD(:,:)
184
!$OMP THREADPRIVATE(vqSTD)
185
      REAL,ALLOCATABLE,SAVE :: vTSTD(:,:)
186
!$OMP THREADPRIVATE(vTSTD)
187
      REAL,ALLOCATABLE,SAVE :: wqSTD(:,:)
188
!$OMP THREADPRIVATE(wqSTD)
189
      REAL,ALLOCATABLE,SAVE :: vphiSTD(:,:)
190
!$OMP THREADPRIVATE(vphiSTD)
191
      REAL,ALLOCATABLE,SAVE :: wTSTD(:,:)
192
!$OMP THREADPRIVATE(wTSTD)
193
      REAL,ALLOCATABLE,SAVE :: u2STD(:,:)
194
!$OMP THREADPRIVATE(u2STD)
195
      REAL,ALLOCATABLE,SAVE :: v2STD(:,:)
196
!$OMP THREADPRIVATE(v2STD)
197
      REAL,ALLOCATABLE,SAVE :: T2STD(:,:)
198
!$OMP THREADPRIVATE(T2STD)
199
      REAL,ALLOCATABLE,SAVE :: O3STD(:,:), O3daySTD(:,:)
200
!$OMP THREADPRIVATE(O3STD,O3daySTD)
201
!IM end
202
      INTEGER,ALLOCATABLE,SAVE :: seed_old(:,:)
203
!$OMP THREADPRIVATE(seed_old)
204
      REAL,ALLOCATABLE,SAVE :: zuthe(:),zvthe(:)
205
!$OMP THREADPRIVATE(zuthe,zvthe)
206
      REAL,ALLOCATABLE,SAVE :: alb_neig(:)
207
!$OMP THREADPRIVATE(alb_neig)
208
!cloud base mass flux
209
      REAL,ALLOCATABLE,SAVE :: ema_cbmf(:)
210
!$OMP THREADPRIVATE(ema_cbmf)
211
!cloud base pressure & cloud top pressure
212
      REAL,ALLOCATABLE,SAVE :: ema_pcb(:), ema_pct(:)
213
!$OMP THREADPRIVATE(ema_pcb,ema_pct)
214
      REAL,ALLOCATABLE,SAVE :: Mipsh(:,:)     ! mass flux shed from  adiab. ascents
215
!$OMP THREADPRIVATE(Mipsh)
216
      REAL,ALLOCATABLE,SAVE :: Ma(:,:)       ! undilute upward mass flux
217
!$OMP THREADPRIVATE(Ma)
218
      REAL,ALLOCATABLE,SAVE :: qcondc(:,:)    ! in-cld water content from convect
219
!$OMP THREADPRIVATE(qcondc)
220
      REAL,ALLOCATABLE,SAVE :: wd(:) ! sb
221
!$OMP THREADPRIVATE(wd)
222
      REAL,ALLOCATABLE,SAVE :: sigd(:)
223
!$OMP THREADPRIVATE(sigd)
224
!
225
      REAL,ALLOCATABLE,SAVE :: cin(:)
226
!$OMP THREADPRIVATE(cin)
227
! ftd : convective heating due to unsaturated downdraughts
228
      REAL,ALLOCATABLE,SAVE :: ftd(:,:)
229
!$OMP THREADPRIVATE(ftd)
230
! fqd : convective moistening due to unsaturated downdraughts
231
      REAL,ALLOCATABLE,SAVE :: fqd(:,:)
232
!$OMP THREADPRIVATE(fqd)
233
#ifdef ISO
234
      REAL, ALLOCATABLE, SAVE :: fxtd(:,:,:)
235
!$OMP THREADPRIVATE(fxtd)
236
#endif
237
!34EK
238
! -- Variables de controle de ALE et ALP
239
!ALE : Energie disponible pour soulevement : utilisee par la
240
!      convection d'Emanuel pour le declenchement et la regulation
241
      REAL,ALLOCATABLE,SAVE :: ALE(:)
242
!$OMP THREADPRIVATE(ALE)
243
!ALP : Puissance  disponible pour soulevement
244
      REAL,ALLOCATABLE,SAVE :: ALP(:)
245
!$OMP THREADPRIVATE(ALP)
246
!
247
! nouvelles variables pour le couplage convection-couche limite
248
      REAL,ALLOCATABLE,SAVE :: Ale_bl(:)
249
!$OMP THREADPRIVATE(Ale_bl)
250
      REAL,ALLOCATABLE,SAVE :: Alp_bl(:)
251
!$OMP THREADPRIVATE(Alp_bl)
252
      INTEGER,ALLOCATABLE,SAVE :: lalim_conv(:)
253
!$OMP THREADPRIVATE(lalim_conv)
254
      REAL,ALLOCATABLE,SAVE :: wght_th(:,:)
255
!$OMP THREADPRIVATE(wght_th)
256
      REAL,ALLOCATABLE,SAVE    :: ale_wake(:)
257
!$OMP THREADPRIVATE(ale_wake)
258
      REAL,ALLOCATABLE,SAVE    :: ale_bl_stat(:)
259
!$OMP THREADPRIVATE(ale_bl_stat)
260
!
261
! variables de la wake
262
! wake_deltat : ecart de temperature avec la zone non perturbee
263
! wake_deltaq : ecart d'humidite avec la zone non perturbee
264
! wake_s      : fraction surfacique occupee par la poche froide
265
! awake_dens  : number of active wakes per unit area
266
! wake_dens   : number of wakes per unit area
267
! cv_gen      : birth rate of cumulonimbus per unit area.
268
! wake_occ    : occurence of wakes (= 1 if wakes occur, =0 otherwise)
269
! wake_Cstar  : vitesse d'etalement de la poche
270
! wake_pe     : wake potential energy - WAPE
271
! wake_fip    : Gust Front Impinging power - ALP
272
      REAL,ALLOCATABLE,SAVE :: wake_deltat(:,:)
273
!$OMP THREADPRIVATE(wake_deltat)
274
      REAL,ALLOCATABLE,SAVE :: wake_deltaq(:,:)
275
!$OMP THREADPRIVATE(wake_deltaq)
276
#ifdef ISO
277
      REAL, ALLOCATABLE, SAVE :: wake_deltaxt(:,:,:)
278
!$OMP THREADPRIVATE(wake_deltaxt)
279
#endif
280
      REAL,ALLOCATABLE,SAVE :: wake_s(:)
281
!$OMP THREADPRIVATE(wake_s)
282
      REAL,ALLOCATABLE,SAVE :: awake_dens(:), wake_dens(:)
283
!$OMP THREADPRIVATE(awake_dens, wake_dens)
284
      REAL,ALLOCATABLE,SAVE :: cv_gen(:)
285
!$OMP THREADPRIVATE(cv_gen)
286
      REAL,ALLOCATABLE,SAVE :: wake_Cstar(:)
287
!$OMP THREADPRIVATE(wake_Cstar)
288
      REAL,ALLOCATABLE,SAVE :: wake_pe(:)
289
!$OMP THREADPRIVATE(wake_pe)
290
      REAL,ALLOCATABLE,SAVE :: wake_fip(:)
291
!$OMP THREADPRIVATE(wake_fip)
292
!
293
!jyg<
294
! variables related to the spitting of the PBL between wake and
295
! off-wake regions.
296
! wake_delta_pbl_TKE : difference TKE_w - TKE_x
297
      REAL,ALLOCATABLE,SAVE :: wake_delta_pbl_TKE(:,:,:)
298
!$OMP THREADPRIVATE(wake_delta_pbl_TKE)
299
!nrlmd<
300
      REAL, ALLOCATABLE, SAVE :: delta_tsurf(:,:) ! Surface temperature difference inside-outside cold pool
301
!$OMP THREADPRIVATE(delta_tsurf)
302
!>nrlmd
303
!>jyg
304
!
305
! pfrac_impa : Produits des coefs lessivage impaction
306
! pfrac_nucl : Produits des coefs lessivage nucleation
307
! pfrac_1nucl: Produits des coefs lessi nucl (alpha = 1)
308
      REAL,ALLOCATABLE,SAVE :: pfrac_impa(:,:), pfrac_nucl(:,:)
309
!$OMP THREADPRIVATE(pfrac_impa,pfrac_nucl)
310
      REAL,ALLOCATABLE,SAVE :: pfrac_1nucl(:,:)
311
!$OMP THREADPRIVATE(pfrac_1nucl)
312
!
313
      REAL,ALLOCATABLE,SAVE :: total_rain(:), nday_rain(:)
314
!$OMP THREADPRIVATE(total_rain,nday_rain)
315
      REAL,ALLOCATABLE,SAVE :: ndayrain_mth(:)
316
!$OMP THREADPRIVATE(ndayrain_mth)
317
      REAL,ALLOCATABLE,SAVE :: paire_ter(:)
318
!$OMP THREADPRIVATE(paire_ter)
319
! albsol1: albedo du sol total pour SW visible
320
! albsol2: albedo du sol total pour SW proche IR
321
      REAL,ALLOCATABLE,SAVE :: albsol1(:), albsol2(:)
322
!$OMP THREADPRIVATE(albsol1,albsol2)
323
324
!albedo SB >>>
325
      REAL,ALLOCATABLE,SAVE :: albsol_dif(:,:),albsol_dir(:,:)
326
!$OMP THREADPRIVATE(albsol_dif,albsol_dir)
327
!albedo SB <<<
328
329
330
      REAL, ALLOCATABLE, SAVE:: wo(:, :, :)
331
      ! column-density of ozone in a layer, in kilo-Dobsons
332
      ! Third dimension has size 1 or 2.
333
      ! "wo(:, :, 1)" is for the average day-night field,
334
      ! "wo(:, :, 2)" is for daylight time.
335
      !$OMP THREADPRIVATE(wo)
336
337
! heat : chauffage solaire
338
! heat0: chauffage solaire ciel clair
339
! cool : refroidissement infrarouge
340
! cool0 : refroidissement infrarouge ciel clair
341
! sollwdown : downward LW flux at surface
342
! sollwdownclr : downward CS LW flux at surface
343
! toplwdown : downward CS LW flux at TOA
344
! toplwdownclr : downward CS LW flux at TOA
345
! heat_volc : chauffage solaire du au volcanisme
346
! cool_volc : refroidissement infrarouge du au volcanisme
347
      REAL,ALLOCATABLE,SAVE :: clwcon0(:,:),rnebcon0(:,:)
348
!$OMP THREADPRIVATE(clwcon0,rnebcon0)
349
      REAL,ALLOCATABLE,SAVE :: heat(:,:)
350
!$OMP THREADPRIVATE(heat)
351
      REAL,ALLOCATABLE,SAVE :: heat0(:,:)
352
!$OMP THREADPRIVATE(heat0)
353
      REAL,ALLOCATABLE,SAVE :: cool(:,:)
354
!$OMP THREADPRIVATE(cool)
355
      REAL,ALLOCATABLE,SAVE :: cool0(:,:)
356
!$OMP THREADPRIVATE(cool0)
357
      REAL,ALLOCATABLE,SAVE :: heat_volc(:,:)
358
!$OMP THREADPRIVATE(heat_volc)
359
      REAL,ALLOCATABLE,SAVE :: cool_volc(:,:)
360
!$OMP THREADPRIVATE(cool_volc)
361
      REAL,ALLOCATABLE,SAVE :: topsw(:), toplw(:)
362
!$OMP THREADPRIVATE(topsw,toplw)
363
      REAL,ALLOCATABLE,SAVE :: sollwdown(:)
364
!$OMP THREADPRIVATE(sollwdown)
365
      REAL,ALLOCATABLE,SAVE :: gustiness(:)
366
!$OMP THREADPRIVATE(gustiness)
367
      REAL,ALLOCATABLE,SAVE :: sollwdownclr(:)
368
!$OMP THREADPRIVATE(sollwdownclr)
369
      REAL,ALLOCATABLE,SAVE :: toplwdown(:)
370
!$OMP THREADPRIVATE(toplwdown)
371
      REAL,ALLOCATABLE,SAVE :: toplwdownclr(:)
372
!$OMP THREADPRIVATE(toplwdownclr)
373
      REAL,ALLOCATABLE,SAVE :: topsw0(:),toplw0(:),solsw0(:),sollw0(:)
374
!$OMP THREADPRIVATE(topsw0,toplw0,solsw0,sollw0)
375
      REAL,ALLOCATABLE,SAVE :: albpla(:)
376
!$OMP THREADPRIVATE(albpla)
377
378
!IM ajout variables CFMIP2/CMIP5
379
      REAL,ALLOCATABLE,SAVE :: heatp(:,:), coolp(:,:)
380
!$OMP THREADPRIVATE(heatp, coolp)
381
      REAL,ALLOCATABLE,SAVE :: heat0p(:,:), cool0p(:,:)
382
!$OMP THREADPRIVATE(heat0p, cool0p)
383
      REAL,ALLOCATABLE,SAVE :: radsolp(:), topswp(:), toplwp(:)
384
!$OMP THREADPRIVATE(radsolp, topswp, toplwp)
385
      REAL,ALLOCATABLE,SAVE :: albplap(:)
386
!$OMP THREADPRIVATE(albplap)
387
      REAL,ALLOCATABLE,SAVE :: solswp(:), solswfdiffp(:), sollwp(:)
388
!$OMP THREADPRIVATE(solswp, solswfdiffp, sollwp)
389
      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
390
!$OMP THREADPRIVATE(sollwdownp)
391
      REAL,ALLOCATABLE,SAVE :: topsw0p(:),toplw0p(:)
392
      REAL,ALLOCATABLE,SAVE :: solsw0p(:),sollw0p(:)
393
!$OMP THREADPRIVATE(topsw0p,toplw0p,solsw0p,sollw0p)
394
      REAL,ALLOCATABLE,SAVE :: lwdnc0p(:,:), lwdn0p(:,:), lwdnp(:,:)
395
      REAL,ALLOCATABLE,SAVE :: lwupc0p(:,:), lwup0p(:,:), lwupp(:,:)
396
!$OMP THREADPRIVATE(lwdnc0p, lwdn0p, lwdnp, lwupc0p, lwup0p, lwupp)
397
      REAL,ALLOCATABLE,SAVE :: swdnc0p(:,:), swdn0p(:,:), swdnp(:,:)
398
      REAL,ALLOCATABLE,SAVE :: swupc0p(:,:), swup0p(:,:), swupp(:,:)
399
!$OMP THREADPRIVATE(swdnc0p, swdn0p, swdnp, swupc0p, swup0p, swupp)
400
401
! pbase : cloud base pressure
402
! bbase : cloud base buoyancy
403
      REAL,ALLOCATABLE,SAVE :: cape(:)
404
!$OMP THREADPRIVATE(cape)
405
      REAL,ALLOCATABLE,SAVE :: pbase(:)
406
!$OMP THREADPRIVATE(pbase)
407
      REAL,ALLOCATABLE,SAVE :: bbase(:)
408
!$OMP THREADPRIVATE(bbase)
409
!
410
      REAL,SAVE,ALLOCATABLE :: zqasc(:,:)
411
!$OMP THREADPRIVATE( zqasc)
412
      INTEGER,ALLOCATABLE,SAVE :: ibas_con(:), itop_con(:)
413
!$OMP THREADPRIVATE(ibas_con,itop_con)
414
      REAL,SAVE,ALLOCATABLE :: rain_con(:)
415
!$OMP THREADPRIVATE(rain_con)
416
      REAL,SAVE,ALLOCATABLE :: snow_con(:)
417
!$OMP THREADPRIVATE(snow_con)
418
!
419
#ifdef ISO
420
      REAL,SAVE,ALLOCATABLE :: xtrain_con(:,:)
421
!$OMP THREADPRIVATE(xtrain_con)
422
      REAL,SAVE,ALLOCATABLE :: xtsnow_con(:,:)
423
!$OMP THREADPRIVATE(xtsnow_con)
424
#endif
425
      REAL,SAVE,ALLOCATABLE :: rlonPOS(:)
426
!$OMP THREADPRIVATE(rlonPOS)
427
      REAL,SAVE,ALLOCATABLE :: newsst(:)
428
!$OMP THREADPRIVATE(newsst)
429
      REAL,SAVE,ALLOCATABLE :: ustar(:,:),u10m(:,:), v10m(:,:),wstar(:,:)
430
!$OMP THREADPRIVATE(ustar,u10m,v10m,wstar)
431
!
432
! ok_ade=T -ADE=topswad-topsw
433
! ok_aie=T ->
434
!       ok_ade=T -AIE=topswai-topswad
435
!       ok_ade=F -AIE=topswai-topsw
436
!
437
!topswad, solswad : Aerosol direct effect
438
      REAL,SAVE,ALLOCATABLE :: topswad(:), solswad(:)
439
!$OMP THREADPRIVATE(topswad,solswad)
440
!topswai, solswai : Aerosol indirect effect
441
      REAL,SAVE,ALLOCATABLE :: topswai(:), solswai(:)
442
!$OMP THREADPRIVATE(topswai,solswai)
443
444
      REAL,SAVE,ALLOCATABLE :: tau_aero(:,:,:,:), piz_aero(:,:,:,:), cg_aero(:,:,:,:)
445
!$OMP THREADPRIVATE(tau_aero, piz_aero, cg_aero)
446
      REAL,SAVE,ALLOCATABLE :: tau_aero_sw_rrtm(:,:,:,:), piz_aero_sw_rrtm(:,:,:,:), cg_aero_sw_rrtm(:,:,:,:)
447
!$OMP THREADPRIVATE(tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm)
448
      REAL,SAVE,ALLOCATABLE :: tau_aero_lw_rrtm(:,:,:,:), piz_aero_lw_rrtm(:,:,:,:), cg_aero_lw_rrtm(:,:,:,:)
449
!$OMP THREADPRIVATE(tau_aero_lw_rrtm, piz_aero_lw_rrtm, cg_aero_lw_rrtm)
450
      REAL,SAVE,ALLOCATABLE :: ccm(:,:,:)
451
!$OMP THREADPRIVATE(ccm)
452
453
      REAL,SAVE,ALLOCATABLE :: ale_bl_trig(:)
454
!$OMP THREADPRIVATE(ale_bl_trig)
455
456
      REAL,SAVE,ALLOCATABLE :: ratqs_inter(:,:)
457
!$OMP THREADPRIVATE(ratqs_inter)
458
459
#ifdef ISO
460
#ifdef ISOTRAC
461
      INTEGER,SAVE,ALLOCATABLE :: bassin_map(:)
462
!$OMP THREADPRIVATE(bassin_map)
463
      INTEGER,SAVE,ALLOCATABLE :: boite_map(:,:)
464
!$OMP THREADPRIVATE(boite_map)
465
#endif
466
#endif
467
      REAL, ALLOCATABLE, SAVE:: du_gwd_rando(:, :), du_gwd_front(:, :)
468
      !$OMP THREADPRIVATE(du_gwd_rando, du_gwd_front)
469
      ! tendencies on wind due to gravity waves
470
471
      LOGICAL,SAVE :: is_initialized=.FALSE.
472
!$OMP THREADPRIVATE(is_initialized)
473
474
      ! Ocean-atmosphere interface:
475
476
      REAL, ALLOCATABLE, SAVE:: ds_ns(:) ! (klon)
477
      ! "delta salinity near surface". Salinity variation in the
478
      ! near-surface turbulent layer. That is subskin salinity minus
479
      ! foundation salinity. In ppt.
480
481
      REAL, ALLOCATABLE, SAVE:: dt_ns(:) ! (klon)
482
      ! "delta temperature near surface". Temperature variation in the
483
      ! near-surface turbulent layer. That is subskin temperature
484
      ! minus foundation temperature. (Can be negative.) In K.
485
486
      REAL, ALLOCATABLE, SAVE:: delta_sst(:) ! (klon)
487
      ! Ocean-air interface temperature minus bulk SST, in
488
      ! K. Allocated and defined only if activate_ocean_skin >= 1.
489
490
      REAL, ALLOCATABLE, SAVE:: delta_sal(:) ! (klon)
491
      ! Ocean-air interface salinity minus bulk salinity, in ppt
492
493
      REAL, ALLOCATABLE, SAVE:: dter(:) ! (klon)
494
      ! Temperature variation in the diffusive microlayer, that is
495
      ! ocean-air interface temperature minus subskin temperature. In K.
496
497
      REAL, SAVE, ALLOCATABLE:: dser(:) ! (klon)
498
      ! Salinity variation in the diffusive microlayer, that is
499
      ! ocean-air interface salinity minus subskin salinity. In ppt.
500
501
      real, SAVE, ALLOCATABLE:: dt_ds(:) ! (klon)
502
      ! (tks / tkt) * dTer, in K
503
504
      !$OMP THREADPRIVATE(delta_sal, ds_ns, dt_ns, delta_sst, dter, dser, dt_ds)
505
506
    CONTAINS
507
508
!======================================================================
509
1
SUBROUTINE phys_state_var_init(read_climoz)
510
USE dimphy
511
USE aero_mod
512
USE infotrac_phy, ONLY : nbtr
513
#ifdef ISO
514
USE infotrac_phy, ONLY : ntraciso=>ntiso,niso
515
#endif
516
USE indice_sol_mod
517
use config_ocean_skin_m, only: activate_ocean_skin
518
use surface_data, only: type_ocean
519
IMPLICIT NONE
520
521
integer, intent(in)::  read_climoz
522
! read ozone climatology
523
! Allowed values are 0, 1 and 2
524
! 0: do not read an ozone climatology
525
! 1: read a single ozone climatology that will be used day and night
526
! 2: read two ozone climatologies, the average day and night
527
! climatology and the daylight climatology
528
529
include "clesphys.h"
530
531
1
      print*, 'is_initialized', is_initialized
532
1
      IF (is_initialized) RETURN
533
1
      is_initialized=.TRUE.
534

1
      ALLOCATE(pctsrf(klon,nbsrf))
535

1
      ALLOCATE(ftsol(klon,nbsrf))
536

1
      ALLOCATE(beta_aridity(klon,nbsrf))
537


1
      ALLOCATE(qsol(klon),fevap(klon,nbsrf))
538



1
      ALLOCATE(z0m(klon,nbsrf+1),z0h(klon,nbsrf+1),agesno(klon,nbsrf))
539
!FC
540



3
      ALLOCATE(treedrg(klon,klev,nbsrf))
541

1
      ALLOCATE(falb1(klon,nbsrf))
542

1
      ALLOCATE(falb2(klon,nbsrf))
543
!albedo SB >>>
544
1
      print*, 'allocate falb'
545





4
      ALLOCATE(falb_dir(klon,nsw,nbsrf),falb_dif(klon,nsw,nbsrf))
546
!!      print*, 'allocate falb good', falb_dir(1,1,1)
547

1
      ALLOCATE(chl_con(klon))
548
!albedo SB <<<
549

1
      ALLOCATE(rain_fall(klon))
550

1
      ALLOCATE(snow_fall(klon))
551

1
      ALLOCATE(bs_fall(klon))
552



1
      ALLOCATE(solsw(klon), solswfdiff(klon), sollw(klon))
553
995
      sollw=0.0
554

1
      ALLOCATE(radsol(klon))
555

1
      ALLOCATE(swradcorr(klon))
556




1
      ALLOCATE(zmea(klon), zstd(klon), zsig(klon), zgam(klon))
557



1
      ALLOCATE(zthe(klon), zpic(klon), zval(klon))
558
559

1
      ALLOCATE(rugoro(klon))
560




3
      ALLOCATE(t_ancien(klon,klev), q_ancien(klon,klev))
561






4
      ALLOCATE(ql_ancien(klon,klev), qs_ancien(klon,klev), qbs_ancien(klon,klev))
562




1
      ALLOCATE(prw_ancien(klon), prlw_ancien(klon), prsw_ancien(klon), prbsw_ancien(klon))
563




3
      ALLOCATE(u_ancien(klon,klev), v_ancien(klon,klev))
564
!!! Rom P >>>
565



3
      ALLOCATE(tr_ancien(klon,klev,nbtr))
566
!!! Rom P <<<
567




3
      ALLOCATE(clwcon(klon,klev),rnebcon(klon,klev))
568


2
      ALLOCATE(rneb_ancien(klon,klev))
569




3
      ALLOCATE(qtc_cv(klon,klev),sigt_cv(klon,klev))
570


2
      ALLOCATE(ratqs(klon,klev))
571



3
      ALLOCATE(pbl_tke(klon,klev+1,nbsrf+1))
572
!nrlmd<
573

1
      ALLOCATE(delta_tsurf(klon,nbsrf))
574
!>nrlmd
575


3
      ALLOCATE(coefh(klon,klev+1,nbsrf+1))
576


3
      ALLOCATE(coefm(klon,klev+1,nbsrf+1))
577
      ! initialize cleanly coefh,coefm
578
      ! (most of the time in the code these are assumed to be on klev levels)
579

199006
      coefh(:,:,:)=0
580

199006
      coefm(:,:,:)=0
581


1
      ALLOCATE(zmax0(klon), f0(klon))
582




3
      ALLOCATE(sig1(klon,klev), w01(klon,klev))
583




3
      ALLOCATE(entr_therm(klon,klev), fm_therm(klon,klev+1))
584


2
      ALLOCATE(detr_therm(klon,klev))
585
!     pour phsystoke avec thermiques
586




3
      ALLOCATE(clwcon0th(klon,klev),rnebcon0th(klon,klev))
587
! radiation outputs
588






4
      ALLOCATE(swdnc0(klon,klevp1), swdn0(klon,klevp1), swdn(klon,klevp1))
589






4
      ALLOCATE(swupc0(klon,klevp1), swup0(klon,klevp1), swup(klon,klevp1))
590






4
      ALLOCATE(lwdnc0(klon,klevp1), lwdn0(klon,klevp1), lwdn(klon,klevp1))
591






4
      ALLOCATE(lwupc0(klon,klevp1), lwup0(klon,klevp1), lwup(klon,klevp1))
592


1
      ALLOCATE(SWdn200clr(klon), SWdn200(klon))
593


1
      ALLOCATE(SWup200clr(klon), SWup200(klon))
594


1
      ALLOCATE(LWdn200clr(klon), LWdn200(klon))
595


1
      ALLOCATE(LWup200clr(klon), LWup200(klon))
596


1
      ALLOCATE(LWdnTOA(klon), LWdnTOAclr(klon))
597
! pressure level
598

1
      ALLOCATE(tsumSTD(klon,nlevSTD,nout))
599


1
      ALLOCATE(usumSTD(klon,nlevSTD,nout), vsumSTD(klon,nlevSTD,nout))
600


1
      ALLOCATE(wsumSTD(klon,nlevSTD,nout), phisumSTD(klon,nlevSTD,nout))
601



1
      ALLOCATE(qsumSTD(klon,nlevSTD,nout), rhsumSTD(klon,nlevSTD,nout))
602

1
      ALLOCATE(tnondef(klon,nlevSTD,nout))
603

1
      ALLOCATE(uvsumSTD(klon,nlevSTD,nout))
604

1
      ALLOCATE(vqsumSTD(klon,nlevSTD,nout))
605

1
      ALLOCATE(vTsumSTD(klon,nlevSTD,nout))
606

1
      ALLOCATE(wqsumSTD(klon,nlevSTD,nout))
607

1
      ALLOCATE(vphisumSTD(klon,nlevSTD,nout))
608

1
      ALLOCATE(wTsumSTD(klon,nlevSTD,nout))
609

1
      ALLOCATE(u2sumSTD(klon,nlevSTD,nout))
610

1
      ALLOCATE(v2sumSTD(klon,nlevSTD,nout))
611

1
      ALLOCATE(T2sumSTD(klon,nlevSTD,nout))
612

1
      ALLOCATE(O3sumSTD(klon,nlevSTD,nout))
613

1
      ALLOCATE(O3daysumSTD(klon,nlevSTD,nout))
614
!IM beg
615




1
      ALLOCATE(wlevSTD(klon,nlevSTD), ulevSTD(klon,nlevSTD), vlevSTD(klon,nlevSTD))
616




1
      ALLOCATE(tlevSTD(klon,nlevSTD), qlevSTD(klon,nlevSTD), rhlevSTD(klon,nlevSTD))
617

1
      ALLOCATE(philevSTD(klon,nlevSTD))
618



1
      ALLOCATE(uvSTD(klon,nlevSTD),vqSTD(klon,nlevSTD))
619



1
      ALLOCATE(vTSTD(klon,nlevSTD),wqSTD(klon,nlevSTD))
620



1
      ALLOCATE(vphiSTD(klon,nlevSTD),wTSTD(klon,nlevSTD))
621



1
      ALLOCATE(u2STD(klon,nlevSTD),v2STD(klon,nlevSTD))
622

1
      ALLOCATE(T2STD(klon,nlevSTD))
623

1
      ALLOCATE(O3STD(klon,nlevSTD))
624

1
      ALLOCATE(O3daySTD(klon,nlevSTD))
625
!IM end
626

1
      ALLOCATE(seed_old(klon,napisccp))
627



1
      ALLOCATE(zuthe(klon),zvthe(klon))
628

1
      ALLOCATE(alb_neig(klon))
629
!cloud base mass flux
630

1
      ALLOCATE(ema_cbmf(klon))
631
!cloud base pressure & cloud top pressure
632



1
      ALLOCATE(ema_pcb(klon), ema_pct(klon))
633
!
634


2
      ALLOCATE(Mipsh(klon,klev))
635


2
      ALLOCATE(Ma(klon,klev))
636


2
      ALLOCATE(qcondc(klon,klev))
637

1
      ALLOCATE(wd(klon))
638

1
      ALLOCATE(sigd(klon))
639




1
      ALLOCATE(cin(klon), ALE(klon), ALP(klon))
640





3
      ALLOCATE(ftd(klon,klev), fqd(klon,klev))
641

1
      ALLOCATE(Ale_bl(klon))
642

1
      ALLOCATE(ale_wake(klon))
643

1
      ALLOCATE(ale_bl_stat(klon))
644
995
      ale_bl_stat(:)=0
645

1
      ALLOCATE(Alp_bl(klon))
646

1
      ALLOCATE(lalim_conv(klon))
647


2
      ALLOCATE(wght_th(klon,klev))
648





3
      ALLOCATE(wake_deltat(klon,klev), wake_deltaq(klon,klev))
649




1
      ALLOCATE(wake_s(klon), awake_dens(klon), wake_dens(klon))
650
!!      awake_dens = 0.  ! initialized in phyetat0
651

1
      ALLOCATE(cv_gen(klon))
652

1
      ALLOCATE(wake_Cstar(klon))
653



1
      ALLOCATE(wake_pe(klon), wake_fip(klon))
654
!jyg<
655



3
      ALLOCATE(wake_delta_pbl_TKE(klon,klev+1,nbsrf+1))
656
!>jyg
657





3
      ALLOCATE(pfrac_impa(klon,klev), pfrac_nucl(klon,klev))
658


2
      ALLOCATE(pfrac_1nucl(klon,klev))
659



1
      ALLOCATE(total_rain(klon), nday_rain(klon))
660

1
      ALLOCATE(ndayrain_mth(klon))
661

1
      ALLOCATE(paire_ter(klon))
662



1
      ALLOCATE(albsol1(klon), albsol2(klon))
663
!albedo SB >>>
664




2
      ALLOCATE(albsol_dir(klon,nsw),albsol_dif(klon,nsw))
665
!albedo SB <<<
666
667
1
      if (read_climoz <= 1) then
668


2
         ALLOCATE(wo(klon,klev, 1))
669
      else
670
         ! read_climoz == 2
671
         ALLOCATE(wo(klon,klev, 2))
672
      end if
673
674





3
      ALLOCATE(clwcon0(klon,klev),rnebcon0(klon,klev))
675





3
      ALLOCATE(heat(klon,klev), heat0(klon,klev))
676





3
      ALLOCATE(cool(klon,klev), cool0(klon,klev))
677





3
      ALLOCATE(heat_volc(klon,klev), cool_volc(klon,klev))
678



1
      ALLOCATE(topsw(klon), toplw(klon))
679



1
      ALLOCATE(sollwdown(klon), sollwdownclr(klon))
680
995
      sollwdown = 0.
681



1
      ALLOCATE(toplwdown(klon), toplwdownclr(klon))
682






1
      ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
683
995
      sollw0 = 0.
684

1
      ALLOCATE(albpla(klon))
685
!IM ajout variables CFMIP2/CMIP5
686





3
      ALLOCATE(heatp(klon,klev), coolp(klon,klev))
687





3
      ALLOCATE(heat0p(klon,klev), cool0p(klon,klev))
688




1
      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
689

1
      ALLOCATE(albplap(klon))
690




1
      ALLOCATE(solswp(klon), solswfdiffp(klon), sollwp(klon))
691

1
      ALLOCATE(gustiness(klon))
692

1
      ALLOCATE(sollwdownp(klon))
693



1
      ALLOCATE(topsw0p(klon),toplw0p(klon))
694



1
      ALLOCATE(solsw0p(klon),sollw0p(klon))
695







4
      ALLOCATE(lwdnc0p(klon,klevp1), lwdn0p(klon,klevp1), lwdnp(klon,klevp1))
696







4
      ALLOCATE(lwupc0p(klon,klevp1), lwup0p(klon,klevp1), lwupp(klon,klevp1))
697







4
      ALLOCATE(swdnc0p(klon,klevp1), swdn0p(klon,klevp1), swdnp(klon,klevp1))
698







4
      ALLOCATE(swupc0p(klon,klevp1), swup0p(klon,klevp1), swupp(klon,klevp1))
699
700

1
      ALLOCATE(cape(klon))
701



1
      ALLOCATE(pbase(klon),bbase(klon))
702


2
      ALLOCATE(zqasc(klon,klev))
703



1
      ALLOCATE(ibas_con(klon), itop_con(klon))
704



1
      ALLOCATE(rain_con(klon), snow_con(klon))
705

1
      ALLOCATE(rlonPOS(klon))
706

1
      ALLOCATE(newsst(klon))
707






1
      ALLOCATE(ustar(klon,nbsrf),u10m(klon,nbsrf), v10m(klon,nbsrf),wstar(klon,nbsrf+1))
708



1
      ALLOCATE(topswad(klon), solswad(klon))
709



1
      ALLOCATE(topswai(klon), solswai(klon))
710










10
      ALLOCATE(tau_aero(klon,klev,naero_grp,nbands),piz_aero(klon,klev,naero_grp,nbands),cg_aero(klon,klev,naero_grp,nbands))
711






5
      ALLOCATE(tau_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm),piz_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
712



3
      ALLOCATE(cg_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
713






5
      ALLOCATE(tau_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm),piz_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
714



3
      ALLOCATE(cg_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
715


2
      ALLOCATE(ccm(klon,klev,nbands))
716
717
#ifdef ISO
718
      ALLOCATE(xtsol(niso,klon),fxtevap(ntraciso,klon,nbsrf))
719
      ALLOCATE(fxtd(ntraciso,klon,klev))
720
      ALLOCATE(wake_deltaxt(ntraciso,klon,klev))
721
      ALLOCATE(xt_ancien(ntraciso,klon,klev))
722
      ALLOCATE(xtl_ancien(ntraciso,klon,klev))
723
      ALLOCATE(xts_ancien(ntraciso,klon,klev))
724
      ALLOCATE(xtrain_fall(ntraciso,klon))
725
      ALLOCATE(xtsnow_fall(ntraciso,klon))
726
      ALLOCATE(xtrain_con(ntraciso,klon))
727
      ALLOCATE(xtsnow_con(ntraciso,klon))
728
#ifdef ISOTRAC
729
      ALLOCATE(bassin_map(klon))
730
      ALLOCATE(boite_map(klon,klev))
731
#endif
732
#endif
733
734

1
      ALLOCATE(ale_bl_trig(klon))
735


2
      ALLOCATE(ratqs_inter(klon,klev))
736
1
      IF (ok_gwd_rando) THEN
737


2
        ALLOCATE(du_gwd_rando(klon, klev))
738

38806
        du_gwd_rando(:,:)=0.
739
      ENDIF
740
2
      IF (.not. ok_hines .and. ok_gwd_rando) THEN
741


2
        ALLOCATE(du_gwd_front(klon, klev))
742

38806
        du_gwd_front(:,:) = 0 !ym missing init
743
      ENDIF
744
745
1
      if (activate_ocean_skin >= 1) then
746
         ALLOCATE(delta_sal(klon), ds_ns(klon), dt_ns(klon), delta_sst(klon), &
747
              dter(klon), dser(klon))
748
         if (activate_ocean_skin == 2 .and. type_ocean == "couple") &
749
              allocate(dt_ds(klon))
750
      end if
751
752
    END SUBROUTINE phys_state_var_init
753
754
!======================================================================
755
    SUBROUTINE phys_state_var_end
756
      ! Useful only for lmdz1d.
757
!USE dimphy
758



6
USE indice_sol_mod
759
use config_ocean_skin_m, only: activate_ocean_skin
760
use surface_data, only: type_ocean
761
IMPLICIT NONE
762
include "clesphys.h"
763
764
      DEALLOCATE(pctsrf, ftsol, falb1, falb2)
765
      DEALLOCATE(beta_aridity)
766
      DEALLOCATE(qsol,fevap,z0m,z0h,agesno)
767
!FC
768
      DEALLOCATE(treedrg)
769
      DEALLOCATE(rain_fall, snow_fall, bs_fall,solsw, solswfdiff, sollw, radsol, swradcorr)
770
      DEALLOCATE(zmea, zstd, zsig, zgam)
771
      DEALLOCATE(zthe, zpic, zval)
772
      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
773
      DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien, rneb_ancien)
774
      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
775
      DEALLOCATE(qtc_cv,sigt_cv)
776
      DEALLOCATE(u_ancien, v_ancien)
777
      DEALLOCATE(tr_ancien)                           !RomP
778
      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
779
      DEALLOCATE(zmax0, f0)
780
      DEALLOCATE(sig1, w01)
781
      DEALLOCATE(entr_therm, fm_therm)
782
      DEALLOCATE(detr_therm)
783
      DEALLOCATE(clwcon0th, rnebcon0th)
784
! radiation outputs
785
      DEALLOCATE(swdnc0, swdn0, swdn)
786
      DEALLOCATE(swupc0, swup0, swup)
787
      DEALLOCATE(lwdnc0, lwdn0, lwdn)
788
      DEALLOCATE(lwupc0, lwup0, lwup)
789
      DEALLOCATE(SWdn200clr, SWdn200)
790
      DEALLOCATE(SWup200clr, SWup200)
791
      DEALLOCATE(LWdn200clr, LWdn200)
792
      DEALLOCATE(LWup200clr, LWup200)
793
      DEALLOCATE(LWdnTOA, LWdnTOAclr)
794
! pressure level
795
      DEALLOCATE(tsumSTD)
796
      DEALLOCATE(usumSTD, vsumSTD)
797
      DEALLOCATE(wsumSTD, phisumSTD)
798
      DEALLOCATE(tnondef)
799
      DEALLOCATE(qsumSTD, rhsumSTD)
800
      DEALLOCATE(uvsumSTD)
801
      DEALLOCATE(vqsumSTD)
802
      DEALLOCATE(vTsumSTD)
803
      DEALLOCATE(wqsumSTD)
804
      DEALLOCATE(vphisumSTD)
805
      DEALLOCATE(wTsumSTD)
806
      DEALLOCATE(u2sumSTD)
807
      DEALLOCATE(v2sumSTD)
808
      DEALLOCATE(T2sumSTD)
809
      DEALLOCATE(O3sumSTD)
810
      DEALLOCATE(O3daysumSTD)
811
!IM beg
812
      DEALLOCATE(wlevSTD,ulevSTD,vlevSTD,tlevSTD,qlevSTD,rhlevSTD,philevSTD)
813
      DEALLOCATE(uvSTD,vqSTD,vTSTD,wqSTD,vphiSTD,wTSTD,u2STD,v2STD,T2STD,O3STD,O3daySTD)
814
!IM end
815
      DEALLOCATE(seed_old)
816
      DEALLOCATE(zuthe, zvthe)
817
      DEALLOCATE(alb_neig)
818
      DEALLOCATE(ema_cbmf)
819
      DEALLOCATE(ema_pcb, ema_pct)
820
      DEALLOCATE(Mipsh, Ma, qcondc)
821
      DEALLOCATE(wd, sigd)
822
      DEALLOCATE(cin, ALE, ALP)
823
      DEALLOCATE(ftd, fqd)
824
      DEALLOCATE(Ale_bl, Alp_bl)
825
      DEALLOCATE(ale_wake)
826
      DEALLOCATE(ale_bl_stat)
827
      DEALLOCATE(lalim_conv, wght_th)
828
      DEALLOCATE(wake_deltat, wake_deltaq)
829
      DEALLOCATE(wake_s, awake_dens, wake_dens)
830
      DEALLOCATE(cv_gen)
831
      DEALLOCATE(wake_Cstar, wake_pe, wake_fip)
832
!jyg<
833
      DEALLOCATE(wake_delta_pbl_TKE)
834
!nrlmd<
835
      DEALLOCATE(delta_tsurf)
836
!>nrlmd
837
!>jyg
838
      DEALLOCATE(pfrac_impa, pfrac_nucl)
839
      DEALLOCATE(pfrac_1nucl)
840
      DEALLOCATE(total_rain, nday_rain)
841
      DEALLOCATE(ndayrain_mth)
842
      DEALLOCATE(paire_ter)
843
      DEALLOCATE(albsol1, albsol2)
844
!albedo SB >>>
845
      DEALLOCATE(albsol_dir,albsol_dif,falb_dir,falb_dif,chl_con)
846
!albedo SB <<<
847
      DEALLOCATE(wo)
848
      DEALLOCATE(clwcon0,rnebcon0)
849
      DEALLOCATE(heat, heat0)
850
      DEALLOCATE(cool, cool0)
851
      DEALLOCATE(heat_volc, cool_volc)
852
      DEALLOCATE(topsw, toplw)
853
      DEALLOCATE(sollwdown, sollwdownclr)
854
      DEALLOCATE(gustiness)
855
      DEALLOCATE(toplwdown, toplwdownclr)
856
      DEALLOCATE(topsw0,toplw0,solsw0,sollw0)
857
      DEALLOCATE(albpla)
858
!IM ajout variables CFMIP2/CMIP5
859
      DEALLOCATE(heatp, coolp)
860
      DEALLOCATE(heat0p, cool0p)
861
      DEALLOCATE(radsolp, topswp, toplwp)
862
      DEALLOCATE(albplap)
863
      DEALLOCATE(solswp, solswfdiffp, sollwp)
864
      DEALLOCATE(sollwdownp)
865
      DEALLOCATE(topsw0p,toplw0p)
866
      DEALLOCATE(solsw0p,sollw0p)
867
      DEALLOCATE(lwdnc0p, lwdn0p, lwdnp)
868
      DEALLOCATE(lwupc0p, lwup0p, lwupp)
869
      DEALLOCATE(swdnc0p, swdn0p, swdnp)
870
      DEALLOCATE(swupc0p, swup0p, swupp)
871
      DEALLOCATE(cape)
872
      DEALLOCATE(pbase,bbase)
873
      DEALLOCATE(zqasc)
874
      DEALLOCATE(ibas_con, itop_con)
875
      DEALLOCATE(rain_con, snow_con)
876
      DEALLOCATE(rlonPOS)
877
      DEALLOCATE(newsst)
878
      DEALLOCATE(ustar,u10m, v10m,wstar)
879
      DEALLOCATE(topswad, solswad)
880
      DEALLOCATE(topswai, solswai)
881
      DEALLOCATE(tau_aero,piz_aero,cg_aero)
882
      DEALLOCATE(tau_aero_sw_rrtm,piz_aero_sw_rrtm,cg_aero_sw_rrtm)
883
      DEALLOCATE(tau_aero_lw_rrtm,piz_aero_lw_rrtm,cg_aero_lw_rrtm)
884
      DEALLOCATE(ccm)
885
      if (ok_gwd_rando) DEALLOCATE(du_gwd_rando)
886
      if (.not. ok_hines .and. ok_gwd_rando) DEALLOCATE(du_gwd_front)
887
      DEALLOCATE(ale_bl_trig)
888
      DEALLOCATE(ratqs_inter)
889
890
      if (activate_ocean_skin >= 1) then
891
         deALLOCATE(delta_sal, ds_ns, dt_ns, delta_sst, dter, dser)
892
         if (activate_ocean_skin == 2 .and. type_ocean == "couple") &
893
              deALLOCATE(dt_ds)
894
      end if
895
896
#ifdef ISO
897
      DEALLOCATE(xtsol,fxtevap)
898
      DEALLOCATE(xt_ancien,xtl_ancien,xts_ancien, fxtd, wake_deltaxt)
899
      DEALLOCATE(xtrain_fall, xtsnow_fall, xtrain_con, xtsnow_con)
900
#ifdef ISOTRAC
901
      DEALLOCATE(bassin_map,boite_map)
902
#endif
903
#endif
904
      is_initialized=.FALSE.
905
906
END SUBROUTINE phys_state_var_end
907
908
      END MODULE phys_state_var_mod