source: LMDZ6/branches/Amaury_dev/libf/phylmd/phys_local_var_mod.F90 @ 5411

Last change on this file since 5411 was 5230, checked in by abarral, 3 months ago

Merge r5215 r5216

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 68.8 KB
Line 
1MODULE phys_local_var_mod
2  USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_STRATAER
3  ! Variables locales pour effectuer les appels en serie
4  !======================================================================
5
6
7  !======================================================================
8  ! Declaration des variables
9
10  REAL, SAVE, ALLOCATABLE :: t_seri(:, :), q_seri(:, :)
11  !$OMP THREADPRIVATE(t_seri, q_seri)
12  REAL, SAVE, ALLOCATABLE :: ql_seri(:, :), qs_seri(:, :)
13  !$OMP THREADPRIVATE(ql_seri,qs_seri)
14  ! SN 15/07/2024 ISO 4D
15  REAL, SAVE, ALLOCATABLE :: qx_seri(:, :, :)
16  !$OMP THREADPRIVATE(qx_seri)
17  ! SN
18  REAL, SAVE, ALLOCATABLE :: qbs_seri(:, :)
19  !$OMP THREADPRIVATE(qbs_seri)
20  REAL, SAVE, ALLOCATABLE :: u_seri(:, :), v_seri(:, :)
21  !$OMP THREADPRIVATE(u_seri, v_seri)
22  REAL, SAVE, ALLOCATABLE :: cf_seri(:,:), rvc_seri(:,:)
23  !$OMP THREADPRIVATE(cf_seri, rvc_seri)
24  REAL, SAVE, ALLOCATABLE :: l_mixmin(:, :, :), l_mix(:, :, :), wprime(:, :, :)
25  !$OMP THREADPRIVATE(l_mixmin, l_mix, wprime)
26  REAL, SAVE, ALLOCATABLE :: pbl_eps(:, :, :)
27  !$OMP THREADPRIVATE(pbl_eps)
28  REAL, SAVE, ALLOCATABLE :: tke_shear(:, :, :), tke_buoy(:, :, :), tke_trans(:, :, :)
29  !$OMP THREADPRIVATE(tke_shear,tke_buoy,tke_trans)
30  REAL, SAVE, ALLOCATABLE :: tr_seri(:, :, :)
31  !$OMP THREADPRIVATE(tr_seri)
32  REAL, SAVE, ALLOCATABLE :: rhcl(:, :)
33  !$OMP THREADPRIVATE(rhcl)
34  REAL, SAVE, ALLOCATABLE :: d_t_dyn(:, :), d_q_dyn(:, :)
35  !$OMP THREADPRIVATE(d_t_dyn, d_q_dyn)
36  REAL, SAVE, ALLOCATABLE :: d_ql_dyn(:, :), d_qs_dyn(:, :), d_qbs_dyn(:, :)
37  !$OMP THREADPRIVATE(d_ql_dyn, d_qs_dyn, d_qbs_dyn)
38  REAL, SAVE, ALLOCATABLE :: d_q_dyn2d(:), d_ql_dyn2d(:), d_qs_dyn2d(:), d_qbs_dyn2d(:)
39  !$OMP THREADPRIVATE(d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d)
40  REAL, SAVE, ALLOCATABLE :: d_u_dyn(:, :), d_v_dyn(:, :)
41  !$OMP THREADPRIVATE(d_u_dyn, d_v_dyn)
42  REAL, SAVE, ALLOCATABLE :: d_cf_dyn(:, :), d_rvc_dyn(:, :)
43  !$OMP THREADPRIVATE(d_cf_dyn, d_rvc_dyn)
44  REAL, SAVE, ALLOCATABLE :: d_tr_dyn(:, :, :)
45  !$OMP THREADPRIVATE(d_tr_dyn)
46  REAL, SAVE, ALLOCATABLE :: d_t_con(:, :), d_q_con(:, :), d_q_con_zmasse(:, :)
47  !$OMP THREADPRIVATE(d_t_con,d_q_con,d_q_con_zmasse)
48  REAL, SAVE, ALLOCATABLE :: d_u_con(:, :), d_v_con(:, :)
49  !$OMP THREADPRIVATE(d_u_con,d_v_con)
50  REAL, SAVE, ALLOCATABLE :: d_t_wake(:, :), d_q_wake(:, :)
51  !$OMP THREADPRIVATE( d_t_wake,d_q_wake)
52  REAL, SAVE, ALLOCATABLE :: d_t_lsc(:, :), d_q_lsc(:, :), d_ql_lsc(:, :), d_qi_lsc(:, :)
53  !$OMP THREADPRIVATE(d_t_lsc,d_q_lsc,d_ql_lsc,d_qi_lsc)
54  REAL, SAVE, ALLOCATABLE :: d_t_lwr(:, :), d_t_lw0(:, :), d_t_swr(:, :), d_t_sw0(:, :)
55  !$OMP THREADPRIVATE(d_t_lwr,d_t_lw0,d_t_swr,d_t_sw0)
56  REAL, SAVE, ALLOCATABLE :: d_t_ajsb(:, :), d_q_ajsb(:, :)
57  !$OMP THREADPRIVATE(d_t_ajsb, d_q_ajsb)
58  REAL, SAVE, ALLOCATABLE :: d_t_ajs(:, :), d_q_ajs(:, :)
59  !$OMP THREADPRIVATE(d_t_ajs, d_q_ajs)
60  REAL, SAVE, ALLOCATABLE :: d_u_ajs(:, :), d_v_ajs(:, :)
61  !$OMP THREADPRIVATE(d_u_ajs, d_v_ajs)
62  !nrlmd<
63  REAL, SAVE, ALLOCATABLE :: d_t_ajs_w(:, :), d_q_ajs_w(:, :)
64  !$OMP THREADPRIVATE(d_t_ajs_w, d_q_ajs_w)
65  REAL, SAVE, ALLOCATABLE :: d_t_ajs_x(:, :), d_q_ajs_x(:, :)
66  !$OMP THREADPRIVATE(d_t_ajs_x, d_q_ajs_x)
67  !>nrlmd
68  REAL, SAVE, ALLOCATABLE :: d_t_eva(:, :), d_q_eva(:, :), d_ql_eva(:, :), d_qi_eva(:, :)
69  !$OMP THREADPRIVATE(d_t_eva,d_q_eva,d_ql_eva,d_qi_eva)
70  ! SN 15/07/2024 ISO 4D
71  REAL, SAVE, ALLOCATABLE :: d_qx_eva(:, :, :)
72  !$OMP THREADPRIVATE(d_qx_eva)
73  ! SN
74  REAL, SAVE, ALLOCATABLE :: d_t_lscst(:, :), d_q_lscst(:, :)
75  !$OMP THREADPRIVATE(d_t_lscst,d_q_lscst)
76  REAL, SAVE, ALLOCATABLE :: d_t_lscth(:, :), d_q_lscth(:, :)
77  !$OMP THREADPRIVATE(d_t_lscth,d_q_lscth)
78  REAL, SAVE, ALLOCATABLE :: plul_th(:), plul_st(:)
79  !$OMP THREADPRIVATE(plul_th,plul_st)
80  !tendances dues a oro et lif
81  REAL, SAVE, ALLOCATABLE :: d_t_oli(:, :)
82  !$OMP THREADPRIVATE(d_t_oli)
83  REAL, SAVE, ALLOCATABLE :: d_u_oli(:, :), d_v_oli(:, :)
84  !$OMP THREADPRIVATE(d_u_oli, d_v_oli)
85  REAL, SAVE, ALLOCATABLE :: d_t_vdf(:, :), d_q_vdf(:, :), d_qbs_vdf(:, :), d_t_diss(:, :)
86  !$OMP THREADPRIVATE( d_t_vdf, d_q_vdf, d_qbs_vdf, d_t_diss)
87  REAL, SAVE, ALLOCATABLE :: d_u_vdf(:, :), d_v_vdf(:, :)
88  !$OMP THREADPRIVATE(d_u_vdf, d_v_vdf)
89  !nrlmd+jyg<
90  REAL, SAVE, ALLOCATABLE :: d_t_vdf_w(:, :), d_q_vdf_w(:, :)
91  !$OMP THREADPRIVATE( d_t_vdf_w, d_q_vdf_w)
92  REAL, SAVE, ALLOCATABLE :: d_t_vdf_x(:, :), d_q_vdf_x(:, :)
93  !$OMP THREADPRIVATE( d_t_vdf_x, d_q_vdf_x)
94  REAL, SAVE, ALLOCATABLE :: d_t_bsss(:, :), d_q_bsss(:, :), d_qbs_bsss(:, :)
95  !$OMP THREADPRIVATE( d_t_bsss,d_q_bsss, d_qbs_bsss)
96  !>nrlmd+jyg
97  REAL, SAVE, ALLOCATABLE :: d_t_oro(:, :)
98  !$OMP THREADPRIVATE(d_t_oro)
99  REAL, SAVE, ALLOCATABLE :: d_u_oro(:, :), d_v_oro(:, :)
100  !$OMP THREADPRIVATE(d_u_oro, d_v_oro)
101  REAL, SAVE, ALLOCATABLE :: d_t_oro_gw(:, :)
102  !$OMP THREADPRIVATE(d_t_oro_gw)
103  REAL, SAVE, ALLOCATABLE :: d_u_oro_gw(:, :), d_v_oro_gw(:, :)
104  !$OMP THREADPRIVATE(d_u_oro_gw, d_v_oro_gw)
105  REAL, SAVE, ALLOCATABLE :: d_t_lif(:, :)
106  !$OMP THREADPRIVATE(d_t_lif)
107  REAL, SAVE, ALLOCATABLE :: d_u_lif(:, :), d_v_lif(:, :)
108  !$OMP THREADPRIVATE(d_u_lif, d_v_lif)
109  ! Tendances Ondes de G non oro (runs strato).
110  REAL, SAVE, ALLOCATABLE :: du_gwd_hines(:, :)
111  !$OMP THREADPRIVATE(du_gwd_hines)
112  REAL, SAVE, ALLOCATABLE :: dv_gwd_hines(:, :)
113  !$OMP THREADPRIVATE(dv_gwd_hines)
114  REAL, SAVE, ALLOCATABLE :: dv_gwd_rando(:, :)
115  !$OMP THREADPRIVATE(dv_gwd_rando)
116  REAL, SAVE, ALLOCATABLE :: dv_gwd_front(:, :)
117  !$OMP THREADPRIVATE(dv_gwd_front)
118  REAL, SAVE, ALLOCATABLE :: east_gwstress(:, :)
119  !$OMP THREADPRIVATE(east_gwstress)
120  REAL, SAVE, ALLOCATABLE :: west_gwstress(:, :)
121  !$OMP THREADPRIVATE(west_gwstress)
122  REAL, SAVE, ALLOCATABLE :: d_t_hin(:, :)
123  !$OMP THREADPRIVATE(d_t_hin)
124  ! tendance due a l'oxydation du methane
125  REAL, SAVE, ALLOCATABLE :: d_q_ch4(:, :)
126  !$OMP THREADPRIVATE(d_q_ch4)
127#ifdef ISO
128      REAL, SAVE, ALLOCATABLE :: xt_seri(:,:,:)
129      !$OMP THREADPRIVATE( xt_seri)
130      REAL, SAVE, ALLOCATABLE :: xtl_seri(:,:,:)
131      !$OMP THREADPRIVATE( xtl_seri)
132      REAL, SAVE, ALLOCATABLE :: xts_seri(:,:,:)
133      !$OMP THREADPRIVATE( xts_seri)
134      REAL, SAVE, ALLOCATABLE :: xtbs_seri(:,:,:)
135      !$OMP THREADPRIVATE( xtbs_seri)
136      REAL, SAVE, ALLOCATABLE :: d_xt_eva(:,:,:)
137      !$OMP THREADPRIVATE( d_xt_eva)
138      REAL, SAVE, ALLOCATABLE :: d_xtl_eva(:,:,:)
139      !$OMP THREADPRIVATE( d_xtl_eva)
140      REAL, SAVE, ALLOCATABLE :: d_xti_eva(:,:,:)
141      !$OMP THREADPRIVATE( d_xti_eva)
142      REAL, SAVE, ALLOCATABLE :: d_xt_vdf(:,:,:)
143      !$OMP THREADPRIVATE( d_xt_vdf)
144      REAL, SAVE, ALLOCATABLE :: d_xt_dyn(:,:,:)
145      !$OMP THREADPRIVATE( d_xt_dyn)
146      REAL, SAVE, ALLOCATABLE :: d_xtl_dyn(:,:,:), d_xts_dyn(:,:,:), d_xtbs_dyn(:,:,:)
147      !$OMP THREADPRIVATE(d_xtl_dyn, d_xts_dyn, d_xtbs_dyn)
148      REAL, SAVE, ALLOCATABLE :: d_xt_con(:,:,:)
149      !$OMP THREADPRIVATE( d_xt_con)
150      REAL, SAVE, ALLOCATABLE :: d_xt_wake(:,:,:)
151      !$OMP THREADPRIVATE( d_xt_wake)
152      REAL, SAVE, ALLOCATABLE :: d_xt_lsc(:,:,:),d_xtl_lsc(:,:,:),d_xti_lsc(:,:,:)
153      !$OMP THREADPRIVATE( d_xt_lsc,d_xtl_lsc,d_xti_lsc)
154      REAL, SAVE, ALLOCATABLE :: d_xt_ajsb(:,:,:)
155      !$OMP THREADPRIVATE( d_xt_ajsb)
156      REAL, SAVE, ALLOCATABLE :: d_xt_ajs(:,:,:)
157      !$OMP THREADPRIVATE( d_xt_ajs)
158      REAL, SAVE, ALLOCATABLE :: d_xt_ajs_w(:,:,:), d_xt_ajs_x(:,:,:)
159      !$OMP THREADPRIVATE(d_xt_ajs_w, d_xt_ajs_x)
160      REAL, SAVE, ALLOCATABLE :: d_xt_vdf_w(:,:,:), d_xt_vdf_x(:,:,:)
161      !$OMP THREADPRIVATE(d_xt_vdf_w, d_xt_vdf_x)
162      REAL, SAVE, ALLOCATABLE :: d_xt_ch4(:,:,:)
163      !$OMP THREADPRIVATE( d_xt_ch4)
164      REAL, SAVE, ALLOCATABLE :: d_xt_prod_nucl(:,:,:)
165      !$OMP THREADPRIVATE( d_xt_prod_nucl)
166      REAL, SAVE, ALLOCATABLE :: d_xt_cosmo(:,:,:)
167      !$OMP THREADPRIVATE( d_xt_cosmo)
168      REAL, SAVE, ALLOCATABLE :: d_xt_decroiss(:,:,:)
169      !$OMP THREADPRIVATE( d_xt_decroiss)
170#endif
171
172  ! tendance du a la conersion Ec -> E thermique
173  REAL, SAVE, ALLOCATABLE :: d_t_ec(:, :)
174  !$OMP THREADPRIVATE(d_t_ec)
175  REAL, SAVE, ALLOCATABLE :: d_ts(:, :), d_tr(:, :, :)
176  !$OMP THREADPRIVATE(d_ts, d_tr)
177
178  ! diagnostique pour le rayonnement
179  REAL, SAVE, ALLOCATABLE :: topswad_aero(:), solswad_aero(:)      ! diag
180  !$OMP THREADPRIVATE(topswad_aero,solswad_aero)
181  REAL, SAVE, ALLOCATABLE :: topswai_aero(:), solswai_aero(:)      ! diag
182  !$OMP THREADPRIVATE(topswai_aero,solswai_aero)
183  REAL, SAVE, ALLOCATABLE :: topswad0_aero(:), solswad0_aero(:)     ! diag
184  !$OMP THREADPRIVATE(topswad0_aero,solswad0_aero)
185  REAL, SAVE, ALLOCATABLE :: topsw_aero(:, :), solsw_aero(:, :)      ! diag
186  !$OMP THREADPRIVATE(topsw_aero,solsw_aero)
187  REAL, SAVE, ALLOCATABLE :: topsw0_aero(:, :), solsw0_aero(:, :)     ! diag
188  !$OMP THREADPRIVATE(topsw0_aero,solsw0_aero)
189  REAL, SAVE, ALLOCATABLE :: topswcf_aero(:, :), solswcf_aero(:, :)  ! diag
190  !$OMP THREADPRIVATE(topswcf_aero,solswcf_aero)
191  ! LW radiation diagnostics CK
192  REAL, SAVE, ALLOCATABLE :: toplwad_aero(:), sollwad_aero(:)      ! diag
193  !$OMP THREADPRIVATE(toplwad_aero,sollwad_aero)
194  REAL, SAVE, ALLOCATABLE :: toplwai_aero(:), sollwai_aero(:)      ! diag
195  !$OMP THREADPRIVATE(toplwai_aero,sollwai_aero)
196  REAL, SAVE, ALLOCATABLE :: toplwad0_aero(:), sollwad0_aero(:)     ! diag
197  !$OMP THREADPRIVATE(toplwad0_aero,sollwad0_aero)
198  ! Special RRTM
199  REAL, SAVE, ALLOCATABLE :: ZLWFT0_i(:, :), ZSWFT0_i(:, :)      ! diag
200  !$OMP THREADPRIVATE(ZLWFT0_i,ZSWFT0_i)
201  REAL, SAVE, ALLOCATABLE :: ZFLDN0(:, :), ZFLUP0(:, :)      ! diag
202  !$OMP THREADPRIVATE(ZFLDN0,ZFLUP0)
203  REAL, SAVE, ALLOCATABLE :: ZFSDN0(:, :), ZFSUP0(:, :)      ! diag
204  !$OMP THREADPRIVATE(ZFSDN0,ZFSUP0)
205
206  REAL, SAVE, ALLOCATABLE :: stratomask(:, :)
207  !$OMP THREADPRIVATE(stratomask)
208  REAL, SAVE, ALLOCATABLE :: tausum_aero(:, :, :)
209  !$OMP THREADPRIVATE(tausum_aero)
210  REAL, SAVE, ALLOCATABLE :: drytausum_aero(:, :)
211  !$OMP THREADPRIVATE(drytausum_aero)
212  REAL, SAVE, ALLOCATABLE :: tau3d_aero(:, :, :, :)
213  !$OMP THREADPRIVATE(tau3d_aero)
214  REAL, SAVE, ALLOCATABLE :: dNovrN(:)
215  !$OMP THREADPRIVATE(dNovrN)
216  REAL, SAVE, ALLOCATABLE :: zfice(:, :)
217  !$OMP THREADPRIVATE(zfice)
218  REAL, SAVE, ALLOCATABLE :: od443aer(:)
219  !$OMP THREADPRIVATE(od443aer)
220  REAL, SAVE, ALLOCATABLE :: od550aer(:)
221  !$OMP THREADPRIVATE(od550aer)
222  REAL, SAVE, ALLOCATABLE :: dryod550aer(:)
223  !$OMP THREADPRIVATE(dryod550aer)
224  REAL, SAVE, ALLOCATABLE :: abs550aer(:)
225  !$OMP THREADPRIVATE(abs550aer)
226  REAL, SAVE, ALLOCATABLE :: od865aer(:)
227  !$OMP THREADPRIVATE(od865aer)
228  REAL, SAVE, ALLOCATABLE :: ec550aer(:, :)
229  !$OMP THREADPRIVATE(ec550aer)
230  REAL, SAVE, ALLOCATABLE :: od550lt1aer(:)
231  !$OMP THREADPRIVATE(od550lt1aer)
232  REAL, SAVE, ALLOCATABLE :: sconcso4(:)
233  !$OMP THREADPRIVATE(sconcso4)
234  REAL, SAVE, ALLOCATABLE :: sconcno3(:)
235  !$OMP THREADPRIVATE(sconcno3)
236  REAL, SAVE, ALLOCATABLE :: sconcoa(:)
237  !$OMP THREADPRIVATE(sconcoa)
238  REAL, SAVE, ALLOCATABLE :: sconcbc(:)
239  !$OMP THREADPRIVATE(sconcbc)
240  REAL, SAVE, ALLOCATABLE :: sconcss(:)
241  !$OMP THREADPRIVATE(sconcss)
242  REAL, SAVE, ALLOCATABLE :: sconcdust(:)
243  !$OMP THREADPRIVATE(sconcdust)
244  REAL, SAVE, ALLOCATABLE :: concso4(:, :)
245  !$OMP THREADPRIVATE(concso4)
246  REAL, SAVE, ALLOCATABLE :: concno3(:, :)
247  !$OMP THREADPRIVATE(concno3)
248  REAL, SAVE, ALLOCATABLE :: concoa(:, :)
249  !$OMP THREADPRIVATE(concoa)
250  REAL, SAVE, ALLOCATABLE :: concbc(:, :)
251  !$OMP THREADPRIVATE(concbc)
252  REAL, SAVE, ALLOCATABLE :: concss(:, :)
253  !$OMP THREADPRIVATE(concss)
254  REAL, SAVE, ALLOCATABLE :: concdust(:, :)
255  !$OMP THREADPRIVATE(concdust)
256  REAL, SAVE, ALLOCATABLE :: loadso4(:)
257  !$OMP THREADPRIVATE(loadso4)
258  REAL, SAVE, ALLOCATABLE :: loadoa(:)
259  !$OMP THREADPRIVATE(loadoa)
260  REAL, SAVE, ALLOCATABLE :: loadbc(:)
261  !$OMP THREADPRIVATE(loadbc)
262  REAL, SAVE, ALLOCATABLE :: loadss(:)
263  !$OMP THREADPRIVATE(loadss)
264  REAL, SAVE, ALLOCATABLE :: loaddust(:)
265  !$OMP THREADPRIVATE(loaddust)
266  REAL, SAVE, ALLOCATABLE :: loadno3(:)
267  !$OMP THREADPRIVATE(loadno3)
268  REAL, SAVE, ALLOCATABLE :: load_tmp1(:), load_tmp2(:)
269  !$OMP THREADPRIVATE(load_tmp1, load_tmp2)
270  REAL, SAVE, ALLOCATABLE :: load_tmp3(:), load_tmp4(:)
271  !$OMP THREADPRIVATE(load_tmp3, load_tmp4)
272  REAL, SAVE, ALLOCATABLE :: load_tmp5(:), load_tmp6(:)
273  !$OMP THREADPRIVATE(load_tmp5, load_tmp6)
274  REAL, SAVE, ALLOCATABLE :: load_tmp7(:), load_tmp8(:)
275  !$OMP THREADPRIVATE(load_tmp7, load_tmp8)
276  REAL, SAVE, ALLOCATABLE :: load_tmp9(:), load_tmp10(:)
277  !$OMP THREADPRIVATE(load_tmp9, load_tmp10)
278
279  !IM ajout variables CFMIP2/CMIP5
280  REAL, ALLOCATABLE, SAVE :: topswad_aerop(:), solswad_aerop(:)
281  !$OMP THREADPRIVATE(topswad_aerop, solswad_aerop)
282  REAL, ALLOCATABLE, SAVE :: topswai_aerop(:), solswai_aerop(:)
283  !$OMP THREADPRIVATE(topswai_aerop, solswai_aerop)
284  REAL, ALLOCATABLE, SAVE :: topswad0_aerop(:), solswad0_aerop(:)
285  !$OMP THREADPRIVATE(topswad0_aerop, solswad0_aerop)
286  REAL, ALLOCATABLE, SAVE :: topsw_aerop(:, :), topsw0_aerop(:, :)
287  !$OMP THREADPRIVATE(topsw_aerop, topsw0_aerop)
288  REAL, ALLOCATABLE, SAVE :: solsw_aerop(:, :), solsw0_aerop(:, :)
289  !$OMP THREADPRIVATE(solsw_aerop, solsw0_aerop)
290  REAL, ALLOCATABLE, SAVE :: topswcf_aerop(:, :), solswcf_aerop(:, :)
291  !$OMP THREADPRIVATE(topswcf_aerop, solswcf_aerop)
292
293  ! additional LW variables CK
294  REAL, ALLOCATABLE, SAVE :: toplwad_aerop(:), sollwad_aerop(:)
295  !$OMP THREADPRIVATE(toplwad_aerop, sollwad_aerop)
296  REAL, ALLOCATABLE, SAVE :: toplwai_aerop(:), sollwai_aerop(:)
297  !$OMP THREADPRIVATE(toplwai_aerop, sollwai_aerop)
298  REAL, ALLOCATABLE, SAVE :: toplwad0_aerop(:), sollwad0_aerop(:)
299  !$OMP THREADPRIVATE(toplwad0_aerop, sollwad0_aerop)
300
301  !AI 08 2023 ajout pour Ecrad
302  REAL, ALLOCATABLE, SAVE :: topswad_aero_s2(:), solswad_aero_s2(:)
303  !$OMP THREADPRIVATE(topswad_aero_s2, solswad_aero_s2)
304  REAL, ALLOCATABLE, SAVE :: topswai_aero_s2(:), solswai_aero_s2(:)
305  !$OMP THREADPRIVATE(topswai_aero_s2, solswai_aero_s2)
306  REAL, ALLOCATABLE, SAVE :: topswad0_aero_s2(:), solswad0_aero_s2(:)
307  !$OMP THREADPRIVATE(topswad0_aero_s2, solswad0_aero_s2)
308  REAL, ALLOCATABLE, SAVE :: topsw_aero_s2(:, :), topsw0_aero_s2(:, :)
309  !$OMP THREADPRIVATE(topsw_aero_s2, topsw0_aero_s2)
310  REAL, ALLOCATABLE, SAVE :: solsw_aero_s2(:, :), solsw0_aero_s2(:, :)
311  !$OMP THREADPRIVATE(solsw_aero_s2, solsw0_aero_s2)
312  REAL, ALLOCATABLE, SAVE :: topswcf_aero_s2(:, :), solswcf_aero_s2(:, :)
313  !$OMP THREADPRIVATE(topswcf_aero_s2, solswcf_aero_s2)
314  ! additional LW variables CK
315  REAL, ALLOCATABLE, SAVE :: toplwad_aero_s2(:), sollwad_aero_s2(:)
316  !$OMP THREADPRIVATE(toplwad_aero_s2, sollwad_aero_s2)
317  REAL, ALLOCATABLE, SAVE :: toplwai_aero_s2(:), sollwai_aero_s2(:)
318  !$OMP THREADPRIVATE(toplwai_aero_s2, sollwai_aero_s2)
319  REAL, ALLOCATABLE, SAVE :: toplwad0_aero_s2(:), sollwad0_aero_s2(:)
320  !$OMP THREADPRIVATE(toplwad0_aero_s2, sollwad0_aero_s2)
321
322  !Ajout de celles n??cessaires au phys_output_write_mod
323  REAL, SAVE, ALLOCATABLE :: tal1(:), pal1(:), pab1(:), pab2(:)
324  !$OMP THREADPRIVATE(tal1, pal1, pab1, pab2)
325  REAL, SAVE, ALLOCATABLE :: ptstar(:), pt0(:), slp(:)
326  !$OMP THREADPRIVATE(ptstar, pt0, slp)
327  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sens, flwp, fiwp
328  !$OMP THREADPRIVATE(sens, flwp, fiwp)
329  !!
330  !FC
331  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: zxfluxt, zxfluxq
332  !$OMP THREADPRIVATE(zxfluxt, zxfluxq)
333  !FC
334  !!         Wake variables
335  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_wake
336  !$OMP THREADPRIVATE(alp_wake)
337  !!jyg!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)            :: wake_h,wake_k
338  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: wake_h
339  INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: wake_k
340  !$OMP THREADPRIVATE(wake_h,wake_k)
341  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wake_omg
342  !$OMP THREADPRIVATE(wake_omg)
343  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_wk, d_deltaq_wk
344  !$OMP THREADPRIVATE(d_deltat_wk, d_deltaq_wk)
345  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: d_s_wk, d_s_a_wk, d_dens_wk, d_dens_a_wk
346  !$OMP THREADPRIVATE(d_s_wk, d_s_a_wk, d_dens_wk, d_dens_a_wk)
347  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_wk_gw, d_deltaq_wk_gw
348  !$OMP THREADPRIVATE(d_deltat_wk_gw, d_deltaq_wk_gw)
349  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_vdf, d_deltaq_vdf
350  !$OMP THREADPRIVATE(d_deltat_vdf, d_deltaq_vdf)
351  !!!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)          :: d_s_vdf, d_dens_vdf
352  !!!$OMP THREADPRIVATE(d_s_vdf, d_dens_vdf)
353  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_the, d_deltaq_the
354  !$OMP THREADPRIVATE(d_deltat_the, d_deltaq_the)
355  !!!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)          :: d_s_the, d_dens_the
356  !!!$OMP THREADPRIVATE(d_s_the, d_dens_the)
357  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: d_deltat_ajs_cv, d_deltaq_ajs_cv
358  !$OMP THREADPRIVATE(d_deltat_ajs_cv, d_deltaq_ajs_cv)
359#ifdef ISO
360    REAL, SAVE, ALLOCATABLE,DIMENSION(:,:,:)          :: d_deltaxt_wk
361!$OMP THREADPRIVATE(d_deltaxt_wk)
362    REAL, SAVE, ALLOCATABLE,DIMENSION(:,:,:)          :: d_deltaxt_wk_gw
363!$OMP THREADPRIVATE(d_deltaxt_wk_gw)
364    REAL, SAVE, ALLOCATABLE,DIMENSION(:,:,:)          ::  d_deltaxt_the
365!$OMP THREADPRIVATE(d_deltaxt_the)
366    REAL, SAVE, ALLOCATABLE,DIMENSION(:,:,:)          ::  d_deltaxt_vdf
367!$OMP THREADPRIVATE(d_deltaxt_vdf)
368      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)           ::  d_deltaxt_ajs_cv
369!$OMP THREADPRIVATE(d_deltaxt_ajs_cv)
370#endif                       
371  !!         End of Wake variables
372  !!
373  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: bils
374  !$OMP THREADPRIVATE(bils)
375  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cdragm, cdragh
376  !$OMP THREADPRIVATE(cdragm, cdragh)
377  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cldh, cldl, cldm, cldq, cldt, qsat2m
378  !$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m)
379  !AS: cldhjn, cldljn, cldmjn,cldtjn pas utilisés en tant que variables, juste noms de diagnostics
380  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: JrNt
381  !$OMP THREADPRIVATE(JrNt)
382  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget
383  !$OMP THREADPRIVATE(dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget)
384  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zustar, zu10m, zv10m, rh2m
385  !$OMP THREADPRIVATE(zustar, zu10m, zv10m, rh2m)
386  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: s_lcl, s_pblh, s_pblt, s_therm
387  !$OMP THREADPRIVATE(s_lcl, s_pblh, s_pblt, s_therm)
388
389  !nrlmd+jyg<
390  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: s_pblh_x, s_pblh_w
391  !$OMP THREADPRIVATE(s_pblh_x, s_pblh_w)
392  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: s_lcl_x, s_lcl_w
393  !$OMP THREADPRIVATE(s_lcl_x, s_lcl_w)
394  !>nrlmd+jyg
395
396  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: slab_wfbils
397  !$OMP THREADPRIVATE(slab_wfbils)
398  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte
399  !$OMP THREADPRIVATE(tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte)
400  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic
401  !$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic)
402  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxfqcalving
403  !$OMP THREADPRIVATE(zxfqcalving)
404  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxfluxlat, zxtsol, snow_lsc, zxfqfonte
405  !$OMP THREADPRIVATE(zxfluxlat, zxtsol, snow_lsc, zxfqfonte)
406!SN runoffdiag
407  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxrunofflic, runoff_diag
408  !$OMP THREADPRIVATE(zxrunofflic, runoff_diag)
409  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxqsurf, rain_lsc, rain_num
410  !$OMP THREADPRIVATE(zxqsurf, rain_lsc, rain_num)
411#ifdef ISO
412      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: xtevap,xtprw
413!$OMP THREADPRIVATE(xtevap,xtprw)
414      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: h1_diag
415      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: xtrunoff_diag
416!$OMP THREADPRIVATE(h1_diag,xtrunoff_diag)
417      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zxfxtcalving
418!$OMP THREADPRIVATE(zxfxtcalving)
419      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: xtsnow_lsc, zxfxtfonte
420!$OMP THREADPRIVATE(xtsnow_lsc, zxfxtfonte)
421      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zxxtrunofflic
422!$OMP THREADPRIVATE(zxxtrunofflic)
423      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: xtrain_lsc
424!$OMP THREADPRIVATE(xtrain_lsc)
425#endif
426
427  !jyg+nrlmd<
428  !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
429  !                                                                          c
430  !       Declarations liees a la couche limite differentiee w-x             c
431  !                                                                          c
432  !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
433  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sens_x, sens_w
434  !$OMP THREADPRIVATE(sens_x, sens_w)
435  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxfluxlat_x, zxfluxlat_w
436  !$OMP THREADPRIVATE(zxfluxlat_x, zxfluxlat_w)
437  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: delta_qsurf
438  !$OMP THREADPRIVATE(delta_qsurf)
439  !jyg<
440  !!! Entrees supplementaires couche-limite
441  !!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: t_x, t_w
442  !!!$OMP THREADPRIVATE(t_x, t_w)
443  !!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: q_x, q_w
444  !!!$OMP THREADPRIVATE(q_x, q_w)
445  !>jyg
446  !!! Sorties ferret
447  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dtvdf_x, dtvdf_w
448  !$OMP THREADPRIVATE(dtvdf_x, dtvdf_w)
449  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dqvdf_x, dqvdf_w
450  !$OMP THREADPRIVATE(dqvdf_x, dqvdf_w)
451  ! Variables supplementaires dans physiq.F relative au splitting de la surface
452  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: pbl_tke_input
453  !$OMP THREADPRIVATE(pbl_tke_input)
454  ! Entree supplementaire Thermiques :
455  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: t_therm, q_therm, u_therm, v_therm
456  !$OMP THREADPRIVATE(t_therm, q_therm, u_therm, v_therm)
457  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cdragh_x, cdragh_w
458  !$OMP THREADPRIVATE(cdragh_x, cdragh_w)
459  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cdragm_x, cdragm_w
460  !$OMP THREADPRIVATE(cdragm_x, cdragm_w)
461  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: kh, kh_x, kh_w
462  !$OMP THREADPRIVATE(kh, kh_x, kh_w)
463#ifdef ISO
464      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: dxtvdf_x, dxtvdf_w
465!$OMP THREADPRIVATE(dxtvdf_x, dxtvdf_w)
466      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: xt_therm
467!$OMP THREADPRIVATE(xt_therm)
468#endif
469  !!!
470  !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
471  LOGICAL, SAVE, ALLOCATABLE :: ptconv(:, :)
472  !$OMP THREADPRIVATE(ptconv)
473  REAL, SAVE, ALLOCATABLE :: ratqsc(:, :)
474  !$OMP THREADPRIVATE(ratqsc)
475  !>jyg+nrlmd
476
477  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: wbeff, convoccur, zmax_th, zq2m, zt2m
478  !$OMP THREADPRIVATE(wbeff, convoccur, zmax_th, zq2m, zt2m)
479  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zt2m_min_mon, zt2m_max_mon
480  !$OMP THREADPRIVATE(zt2m_min_mon, zt2m_max_mon)
481  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: t2m_min_mon, t2m_max_mon
482  !$OMP THREADPRIVATE(t2m_min_mon, t2m_max_mon)
483  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: weak_inversion
484  !$OMP THREADPRIVATE(weak_inversion)
485  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_bl_conv, alp_bl_det
486  !$OMP THREADPRIVATE(alp_bl_conv,alp_bl_det)
487  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_bl_fluct_m, alp_bl_fluct_tke
488  !$OMP THREADPRIVATE(alp_bl_fluct_m,alp_bl_fluct_tke)
489  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_bl_stat, n2, s2, strig, zcong, zlcl_th
490  !$OMP THREADPRIVATE(alp_bl_stat, n2, s2, strig, zcong, zlcl_th)
491  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: proba_notrig, random_notrig
492  !$OMP THREADPRIVATE(proba_notrig, random_notrig)
493  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: fsolsw, wfbils
494  !$OMP THREADPRIVATE(fsolsw, wfbils)
495  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wfevap
496  !$OMP THREADPRIVATE(wfevap)
497  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: t2m, fluxlat, fsollw, evap_pot
498  !$OMP THREADPRIVATE(t2m, fluxlat, fsollw,evap_pot)
499  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dnwd0, omega
500  !$OMP THREADPRIVATE(dnwd0, omega)
501  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: epmax_diag ! epmax_cape
502  !$OMP THREADPRIVATE(epmax_diag)
503
504  !  Deep convective variables used in phytrac
505  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ep ! epmax_cape
506  !$OMP THREADPRIVATE(ep)
507  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dnwd, upwd
508  !$OMP THREADPRIVATE(dnwd, upwd)
509  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: pmflxr, pmflxs
510  !$OMP THREADPRIVATE(pmflxr, pmflxs)
511  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wdtrainA, wdtrainS, wdtrainM
512  !$OMP THREADPRIVATE(wdtrainA, wdtrainS, wdtrainM)
513  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: da, mp
514  !$OMP THREADPRIVATE(da, mp)
515  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wght_cvfd
516  !$OMP THREADPRIVATE(wght_cvfd)
517  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: phi, phi2, elij, epmlmMm
518  !$OMP THREADPRIVATE(phi, phi2, elij, epmlmMm)
519  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: d1a, dam
520  !$OMP THREADPRIVATE(d1a, dam)
521  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ev
522  !$OMP THREADPRIVATE(ev)
523  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: qtaa
524  !$OMP THREADPRIVATE(qtaa)
525  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: clw
526  !$OMP THREADPRIVATE(clw)
527  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: eplaMm
528  !$OMP THREADPRIVATE(eplaMm)
529  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: sij
530  !$OMP THREADPRIVATE(sij)
531#ifdef ISO
532      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xtwdtrainA
533!$OMP THREADPRIVATE(xtwdtrainA)
534      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xtev
535!$OMP THREADPRIVATE(xtev)
536      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xttaa
537!$OMP THREADPRIVATE(xttaa)
538      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xtclw
539!$OMP THREADPRIVATE(xtclw)
540#ifdef DIAGISO
541      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: qlp
542!$OMP THREADPRIVATE(qlp)
543      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: qvp
544!$OMP THREADPRIVATE(qvp)
545      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: fq_detrainement
546!$OMP THREADPRIVATE(fq_detrainement)
547      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: fq_ddft
548!$OMP THREADPRIVATE(fq_ddft)
549      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: fq_fluxmasse
550!$OMP THREADPRIVATE(fq_fluxmasse)
551      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: fq_evapprecip
552!$OMP THREADPRIVATE(fq_evapprecip)
553      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: f_detrainement
554!$OMP THREADPRIVATE(f_detrainement)
555      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: q_detrainement
556!$OMP THREADPRIVATE(q_detrainement)
557      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xt_detrainement
558!$OMP THREADPRIVATE(xt_detrainement)
559      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xtlp
560!$OMP THREADPRIVATE(xtlp)
561      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xtvp
562!$OMP THREADPRIVATE(xtvp)
563      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: q_the
564!$OMP THREADPRIVATE(q_the)
565      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xt_the
566!$OMP THREADPRIVATE(xt_the)
567      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: fxt_detrainement
568!$OMP THREADPRIVATE(fxt_detrainement)
569      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: fxt_ddft
570!$OMP THREADPRIVATE(fxt_ddft)
571      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: fxt_fluxmasse
572!$OMP THREADPRIVATE(fxt_fluxmasse)
573      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: fxt_evapprecip
574!$OMP THREADPRIVATE(fxt_evapprecip)
575#endif
576#endif
577
578  !      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: coefh, coefm, lambda_th
579  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: lambda_th
580  !$OMP THREADPRIVATE(lambda_th)
581  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: cldemi, cldfra, cldtau, fiwc, fl, re, flwc
582  !$OMP THREADPRIVATE(cldemi, cldfra, cldtau, fiwc, fl, re, flwc)
583  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: qlth, qith, qsith, wiceth
584  !$OMP THREADPRIVATE(qlth, qith, qsith, wiceth)
585  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ref_liq, ref_ice, theta, zphi
586  !$OMP THREADPRIVATE(ref_liq, ref_ice, theta, zphi)
587  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ref_liq_pi, ref_ice_pi
588  !$OMP THREADPRIVATE(ref_liq_pi, ref_ice_pi)
589  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: zx_rh, zx_rhl, zx_rhi
590  !$OMP THREADPRIVATE(zx_rh, zx_rhl, zx_rhi)
591  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: prfl, psfl, fraca, bsfl
592  !$OMP THREADPRIVATE(prfl, psfl, fraca, bsfl)
593  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: Vprecip, zw2
594  !$OMP THREADPRIVATE(Vprecip, zw2)
595  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: pmfd, pmfu
596  !$OMP THREADPRIVATE(pmfd, pmfu)
597  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: fluxt, fluxu, fluxv
598  !$OMP THREADPRIVATE(fluxt, fluxu, fluxv)
599  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: uwriteSTD, vwriteSTD, wwriteSTD
600  !$OMP THREADPRIVATE(uwriteSTD, vwriteSTD, wwriteSTD)
601  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD
602  !$OMP THREADPRIVATE(phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD)
603
604
605  ! ug et d'autres encore:
606  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: beta_prec
607  !$OMP THREADPRIVATE(beta_prec)
608  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: rneb, rnebjn, rneblsvol
609  !$OMP THREADPRIVATE(rneb,rnebjn,rneblsvol)
610  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: pfraclr, pfracld
611  !$OMP THREADPRIVATE(pfraclr,pfracld)
612  REAL, SAVE, ALLOCATABLE :: cldfraliq(:, :)
613  !$OMP THREADPRIVATE(cldfraliq)
614  REAL, SAVE, ALLOCATABLE :: mean_icefracturb(:, :)
615  !$OMP THREADPRIVATE(mean_icefracturb)
616  REAL, SAVE, ALLOCATABLE :: sigma2_icefracturb(:, :)
617  !$OMP THREADPRIVATE(sigma2_icefracturb)
618
619  ! variables de sorties MM
620  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxsnow, snowhgt, qsnow, to_ice
621  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sissnow, runoff, albsol3_lic
622  !$OMP THREADPRIVATE(zxsnow,snowhgt,qsnow,to_ice)
623  !$OMP THREADPRIVATE(sissnow,runoff,albsol3_lic)
624#ifdef ISO
625      REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: zxxtsnow
626!$OMP THREADPRIVATE(zxxtsnow)     
627      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: xtVprecip,xtVprecipi
628!$OMP THREADPRIVATE(xtVprecip,xtVprecipi)
629      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: pxtrfl, pxtsfl
630!$OMP THREADPRIVATE(pxtrfl, pxtsfl)
631#endif
632
633  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: p_tropopause, z_tropopause, t_tropopause
634  !$OMP THREADPRIVATE(p_tropopause, z_tropopause, t_tropopause)
635
636  INTEGER, ALLOCATABLE, SAVE, DIMENSION(:, :) :: zn2mout
637  !$OMP THREADPRIVATE(zn2mout)
638
639  !-- LSCP - condensation and ice supersaturation variables
640  REAL, SAVE, ALLOCATABLE :: qsub(:,:), qissr(:,:), qcld(:,:)
641  !$OMP THREADPRIVATE(qsub, qissr, qcld)
642  REAL, SAVE, ALLOCATABLE :: subfra(:,:), issrfra(:,:)
643  !$OMP THREADPRIVATE(subfra, issrfra)
644  REAL, SAVE, ALLOCATABLE :: gamma_cond(:,:)
645  !$OMP THREADPRIVATE(gamma_cond)
646  REAL, SAVE, ALLOCATABLE :: ratio_qi_qtot(:,:)
647  !$OMP THREADPRIVATE(ratio_qi_qtot)
648  REAL, SAVE, ALLOCATABLE :: dcf_sub(:,:), dcf_con(:,:), dcf_mix(:,:)
649  !$OMP THREADPRIVATE(dcf_sub, dcf_con, dcf_mix)
650  REAL, SAVE, ALLOCATABLE :: dqi_adj(:,:), dqi_sub(:,:), dqi_con(:,:), dqi_mix(:,:)
651  !$OMP THREADPRIVATE(dqi_adj, dqi_sub, dqi_con, dqi_mix)
652  REAL, SAVE, ALLOCATABLE :: dqvc_adj(:,:), dqvc_sub(:,:), dqvc_con(:,:), dqvc_mix(:,:)
653  !$OMP THREADPRIVATE(dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix)
654  REAL, SAVE, ALLOCATABLE :: qsatliq(:,:), qsatice(:,:)
655  !$OMP THREADPRIVATE(qsatliq, qsatice)
656
657  !-- LSCP - aviation and contrails variables
658  REAL, SAVE, ALLOCATABLE :: Tcontr(:,:), qcontr(:,:), qcontr2(:,:)
659  !$OMP THREADPRIVATE(Tcontr, qcontr, qcontr2)
660  REAL, SAVE, ALLOCATABLE :: fcontrN(:,:), fcontrP(:,:)
661  !$OMP THREADPRIVATE(fcontrN, fcontrP)
662  REAL, SAVE, ALLOCATABLE :: dcf_avi(:,:), dqi_avi(:,:), dqvc_avi(:,:)
663  !$OMP THREADPRIVATE(dcf_avi, dqi_avi, dqvc_avi)
664  REAL, SAVE, ALLOCATABLE :: flight_dist(:,:), flight_h2o(:,:)
665  !$OMP THREADPRIVATE(flight_dist, flight_h2o)
666
667  !-- LSCP - mixed phase clouds variables
668  REAL, SAVE, ALLOCATABLE :: distcltop(:, :)
669  !$OMP THREADPRIVATE(distcltop)
670  REAL, SAVE, ALLOCATABLE :: temp_cltop(:, :)
671  !$OMP THREADPRIVATE(temp_cltop)
672
673
674  !-- LSCP - POPRECIP variables
675  REAL, SAVE, ALLOCATABLE :: qraindiag(:, :)
676  !$OMP THREADPRIVATE(qraindiag)
677  REAL, SAVE, ALLOCATABLE :: qsnowdiag(:, :)
678  !$OMP THREADPRIVATE(qsnowdiag)
679  REAL, SAVE, ALLOCATABLE :: dqreva(:, :)
680  !$OMP THREADPRIVATE(dqreva)
681  REAL, SAVE, ALLOCATABLE :: dqrauto(:, :)
682  !$OMP THREADPRIVATE(dqrauto)
683  REAL, SAVE, ALLOCATABLE :: dqrcol(:, :)
684  !$OMP THREADPRIVATE(dqrcol)
685  REAL, SAVE, ALLOCATABLE :: dqrmelt(:, :)
686  !$OMP THREADPRIVATE(dqrmelt)
687  REAL, SAVE, ALLOCATABLE :: dqrfreez(:, :)
688  !$OMP THREADPRIVATE(dqrfreez)
689  REAL, SAVE, ALLOCATABLE :: dqssub(:, :)
690  !$OMP THREADPRIVATE(dqssub)
691  REAL, SAVE, ALLOCATABLE :: dqsauto(:, :)
692  !$OMP THREADPRIVATE(dqsauto)
693  REAL, SAVE, ALLOCATABLE :: dqsagg(:, :)
694  !$OMP THREADPRIVATE(dqsagg)
695  REAL, SAVE, ALLOCATABLE :: dqsrim(:, :)
696  !$OMP THREADPRIVATE(dqsrim)
697  REAL, SAVE, ALLOCATABLE :: dqsmelt(:, :)
698  !$OMP THREADPRIVATE(dqsmelt)
699  REAL, SAVE, ALLOCATABLE :: dqsfreez(:, :)
700  !$OMP THREADPRIVATE(dqsfreez)
701
702  ! variables for stratospheric aerosol
703  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: d_q_emiss
704  !$OMP THREADPRIVATE(d_q_emiss)
705  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: R2SO4
706  !$OMP THREADPRIVATE(R2SO4)
707  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: R2SO4B
708  !$OMP THREADPRIVATE(R2SO4B)
709  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: DENSO4
710  !$OMP THREADPRIVATE(DENSO4)
711  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: DENSO4B
712  !$OMP THREADPRIVATE(DENSO4B)
713  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: f_r_wet
714  !$OMP THREADPRIVATE(f_r_wet)
715  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: f_r_wetB
716  !$OMP THREADPRIVATE(f_r_wetB)
717  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: decfluxaer
718  !$OMP THREADPRIVATE(decfluxaer)
719  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: mdw
720  !$OMP THREADPRIVATE(mdw)
721  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: OCS_lifetime
722  !$OMP THREADPRIVATE(OCS_lifetime)
723  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: SO2_lifetime
724  !$OMP THREADPRIVATE(SO2_lifetime)
725  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: H2SO4_lifetime
726  !$OMP THREADPRIVATE(H2SO4_lifetime)
727  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: O3_clim
728  !$OMP THREADPRIVATE(O3_clim)
729  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: alpha_bin
730  !$OMP THREADPRIVATE(alpha_bin)
731  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: piz_bin
732  !$OMP THREADPRIVATE(piz_bin)
733  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: cg_bin
734  !$OMP THREADPRIVATE(cg_bin)
735  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: tau_strat_550
736  !$OMP THREADPRIVATE(tau_strat_550)
737  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: tau_strat_1020
738  !$OMP THREADPRIVATE(tau_strat_1020)
739  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: tausum_strat
740  !$OMP THREADPRIVATE(tausum_strat)
741  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: surf_PM25_sulf
742  !$OMP THREADPRIVATE(surf_PM25_sulf)
743  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: vsed_aer
744  !$OMP THREADPRIVATE(vsed_aer)
745  !     Sulfate aerosol concentration (dry mixing ratio) (condensed H2SO4 mmr)
746  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: sulfmmr
747  !$OMP THREADPRIVATE(sulfmmr)
748  !     SAD all aerosols (cm2/cm3)
749  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: SAD_sulfate
750  !$OMP THREADPRIVATE(SAD_sulfate)
751  !     Effective radius of wet surface aerosols (cm)
752      REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: reff_sulfate
753!$OMP THREADPRIVATE(reff_sulfate)
754!     sulfate MMR in different modes (based on sulfmmr, it must be dry mmr)
755  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: sulfmmr_mode
756  !$OMP THREADPRIVATE(sulfmmr_mode)
757  !     particle concentration in different modes (part/m3)
758  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: nd_mode
759  !$OMP THREADPRIVATE(nd_mode)
760
761  !---3D budget variables
762  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_nucl
763  !$OMP THREADPRIVATE(budg_3D_nucl)
764  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_cond_evap
765  !$OMP THREADPRIVATE(budg_3D_cond_evap)
766  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_ocs_to_so2
767  !$OMP THREADPRIVATE(budg_3D_ocs_to_so2)
768  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_so2_to_h2so4
769  !$OMP THREADPRIVATE(budg_3D_so2_to_h2so4)
770  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_backgr_ocs
771  !$OMP THREADPRIVATE(budg_3D_backgr_ocs)
772  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_backgr_so2
773  !$OMP THREADPRIVATE(budg_3D_backgr_so2)
774
775  !---2D budget variables
776  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_ocs
777  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_so2
778  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_h2so4
779  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_part
780  !$OMP THREADPRIVATE(budg_dep_dry_ocs,budg_dep_dry_so2,budg_dep_dry_h2so4,budg_dep_dry_part)
781  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_ocs
782  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_so2
783  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_h2so4
784  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_part
785  !$OMP THREADPRIVATE(budg_dep_wet_ocs,budg_dep_wet_so2,budg_dep_wet_h2so4,budg_dep_wet_part)
786  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_ocs
787  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_so2
788  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_h2so4
789  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_part
790  !$OMP THREADPRIVATE(budg_emi_ocs,budg_emi_so2,budg_emi_h2so4,budg_emi_part)
791  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_ocs_to_so2
792  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_so2_to_h2so4
793  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_h2so4_to_part
794  !$OMP THREADPRIVATE(budg_ocs_to_so2,budg_so2_to_h2so4,budg_h2so4_to_part)
795  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_sed_part
796  !$OMP THREADPRIVATE(budg_sed_part)
797
798CONTAINS
799
800  !======================================================================
801  SUBROUTINE phys_local_var_init
802    USE dimphy
803    USE infotrac_phy, ONLY: nbtr, nqtot
804#ifdef ISO
805USE infotrac_phy, ONLY: ntraciso=>ntiso,niso
806#endif
807    USE aero_mod
808    USE indice_sol_mod
809    USE phys_output_var_mod
810    USE phys_state_var_mod
811    USE infotrac_phy, ONLY: nbtr_bin
812
813    IMPLICIT NONE
814    ALLOCATE(t_seri(klon, klev), q_seri(klon, klev), ql_seri(klon, klev), qs_seri(klon, klev), qbs_seri(klon, klev))
815    ! SN 4D ISO
816    ALLOCATE(qx_seri(klon, klev, nqtot))
817    ! SN
818    ALLOCATE(u_seri(klon, klev), v_seri(klon, klev))
819    ALLOCATE(cf_seri(klon, klev), rvc_seri(klon, klev))
820    ALLOCATE(l_mixmin(klon, klev + 1, nbsrf), l_mix(klon, klev + 1, nbsrf), wprime(klon, klev + 1, nbsrf))
821    ALLOCATE(pbl_eps(klon, klev + 1, nbsrf + 1))
822    ALLOCATE(tke_shear(klon, klev + 1, nbsrf), tke_buoy(klon, klev + 1, nbsrf), tke_trans(klon, klev + 1, nbsrf))
823    pbl_eps(:, :, :) = 0.
824    tke_shear(:, :, :) = 0.; tke_buoy(:, :, :) = 0.; tke_trans(:, :, :) = 0.
825    l_mix(:, :, :) = 0.;l_mixmin(:, :, :) = 0.;wprime(:, :, :) = 0. ! doit etre initialse car pas toujours remplis
826    ALLOCATE(rhcl(klon, klev))
827    ALLOCATE(tr_seri(klon, klev, nbtr))
828    ALLOCATE(d_t_dyn(klon, klev), d_q_dyn(klon, klev))
829    ALLOCATE(d_ql_dyn(klon, klev), d_qs_dyn(klon, klev), d_qbs_dyn(klon, klev))
830    ALLOCATE(d_q_dyn2d(klon), d_ql_dyn2d(klon), d_qs_dyn2d(klon), d_qbs_dyn2d(klon))
831    ALLOCATE(d_u_dyn(klon, klev), d_v_dyn(klon, klev))
832    ALLOCATE(d_cf_dyn(klon,klev),d_rvc_dyn(klon,klev))
833    ALLOCATE(d_tr_dyn(klon, klev, nbtr))                   !RomP
834    ALLOCATE(d_t_con(klon, klev), d_q_con(klon, klev), d_q_con_zmasse(klon, klev))
835    ALLOCATE(d_u_con(klon, klev), d_v_con(klon, klev))
836    ALLOCATE(d_t_wake(klon, klev), d_q_wake(klon, klev))
837    ALLOCATE(d_t_lsc(klon, klev), d_q_lsc(klon, klev))
838    ALLOCATE(d_t_lwr(klon, klev), d_t_lw0(klon, klev))
839    ALLOCATE(d_t_swr(klon, klev), d_t_sw0(klon, klev))
840    ALLOCATE(d_ql_lsc(klon, klev), d_qi_lsc(klon, klev))
841    ALLOCATE(d_t_ajsb(klon, klev), d_q_ajsb(klon, klev))
842    ALLOCATE(d_t_ajs(klon, klev), d_q_ajs(klon, klev))
843    !nrlmd<
844    ALLOCATE(d_t_ajs_w(klon, klev), d_q_ajs_w(klon, klev))
845    ALLOCATE(d_t_ajs_x(klon, klev), d_q_ajs_x(klon, klev))
846    !>nrlmd
847    ALLOCATE(d_u_ajs(klon, klev), d_v_ajs(klon, klev))
848    ALLOCATE(d_t_eva(klon, klev), d_q_eva(klon, klev))
849    ! SN 4D ISO
850    ALLOCATE(d_qx_eva(klon, klev, nqtot))
851    ! SN
852    ALLOCATE(d_ql_eva(klon, klev), d_qi_eva(klon, klev))
853    ALLOCATE(d_t_lscst(klon, klev), d_q_lscst(klon, klev))
854    ALLOCATE(d_t_lscth(klon, klev), d_q_lscth(klon, klev))
855    ALLOCATE(plul_st(klon), plul_th(klon))
856    ALLOCATE(d_t_vdf(klon, klev), d_q_vdf(klon, klev), d_t_diss(klon, klev))
857    ALLOCATE (d_qbs_vdf(klon, klev))
858    ALLOCATE(d_t_bsss(klon, klev), d_q_bsss(klon, klev), d_qbs_bsss(klon, klev))
859    ALLOCATE(d_t_vdf_w(klon, klev), d_q_vdf_w(klon, klev))
860    ALLOCATE(d_t_vdf_x(klon, klev), d_q_vdf_x(klon, klev))
861#ifdef ISO
862      allocate(xt_seri(ntraciso,klon,klev))
863      allocate(xtl_seri(ntraciso,klon,klev))
864      allocate(xts_seri(ntraciso,klon,klev))
865      allocate(xtbs_seri(ntraciso,klon,klev))
866      allocate(d_xt_dyn(ntraciso,klon,klev))
867      allocate(d_xtl_dyn(ntraciso,klon,klev))
868      allocate(d_xts_dyn(ntraciso,klon,klev))
869      allocate(d_xtbs_dyn(ntraciso,klon,klev))
870      allocate(d_xt_con(ntraciso,klon,klev))
871      allocate(d_xt_wake(ntraciso,klon,klev))
872      allocate(d_xt_lsc(ntraciso,klon,klev))
873      allocate(d_xtl_lsc(ntraciso,klon,klev))
874      allocate(d_xti_lsc(ntraciso,klon,klev))
875      allocate(d_xt_ajsb(ntraciso,klon,klev))
876      allocate(d_xt_ajs(ntraciso,klon,klev))
877      allocate(d_xt_ajs_w(ntraciso,klon,klev))
878      allocate(d_xt_ajs_x(ntraciso,klon,klev))
879      allocate(d_xt_eva(ntraciso,klon,klev))
880      allocate(d_xtl_eva(ntraciso,klon,klev))
881      allocate(d_xti_eva(ntraciso,klon,klev))
882      allocate(d_xt_vdf(ntraciso,klon,klev)) 
883      allocate(d_xt_vdf_w(ntraciso,klon,klev))
884      allocate(d_xt_vdf_x(ntraciso,klon,klev))
885      allocate(d_xt_ch4(ntraciso,klon,klev))
886      allocate(d_xt_prod_nucl(ntraciso,klon,klev))
887      allocate(d_xt_cosmo(ntraciso,klon,klev))
888      allocate(d_xt_decroiss(ntraciso,klon,klev))
889#endif
890
891    ALLOCATE(d_u_vdf(klon, klev), d_v_vdf(klon, klev))
892    ALLOCATE(d_t_oli(klon, klev), d_t_oro(klon, klev))
893    ALLOCATE(d_u_oli(klon, klev), d_v_oli(klon, klev))
894    ALLOCATE(d_u_oro(klon, klev), d_v_oro(klon, klev))
895    ALLOCATE(d_u_oro_gw(klon, klev), d_v_oro_gw(klon, klev))
896    ALLOCATE(d_t_oro_gw(klon, klev))
897    ALLOCATE(d_t_lif(klon, klev), d_t_ec(klon, klev))
898    ALLOCATE(d_u_lif(klon, klev), d_v_lif(klon, klev))
899    ALLOCATE(d_ts(klon, nbsrf), d_tr(klon, klev, nbtr))
900
901    ! Special RRTM
902    ALLOCATE(ZLWFT0_i(klon, klev + 1), ZSWFT0_i(klon, klev + 1), ZFLDN0(klon, klev + 1))
903    ZFLDN0 = 0.
904    ALLOCATE(ZFLUP0(klon, klev + 1), ZFSDN0(klon, klev + 1), ZFSUP0(klon, klev + 1))
905
906    ALLOCATE(topswad_aero(klon), solswad_aero(klon))
907    ALLOCATE(topswai_aero(klon), solswai_aero(klon))
908    ALLOCATE(topswad0_aero(klon), solswad0_aero(klon))
909    ALLOCATE(toplwad_aero(klon), sollwad_aero(klon))
910    ALLOCATE(toplwai_aero(klon), sollwai_aero(klon))
911    ALLOCATE(toplwad0_aero(klon), sollwad0_aero(klon))
912    ALLOCATE(topsw_aero(klon, naero_grp), solsw_aero(klon, naero_grp))
913    ALLOCATE(topsw0_aero(klon, naero_grp), solsw0_aero(klon, naero_grp))
914    ALLOCATE(topswcf_aero(klon, 3), solswcf_aero(klon, 3))
915    ALLOCATE(du_gwd_hines(klon, klev), dv_gwd_hines(klon, klev))
916    ALLOCATE(dv_gwd_rando(klon, klev), dv_gwd_front(klon, klev))
917    ALLOCATE(east_gwstress(klon, klev), west_gwstress(klon, klev))
918    east_gwstress(:, :) = 0 !ym missing init
919    west_gwstress(:, :) = 0 !ym missing init
920    ALLOCATE(d_t_hin(klon, klev))
921    ALLOCATE(d_q_ch4(klon, klev))
922    ALLOCATE(stratomask(klon, klev))
923    ALLOCATE(tausum_aero(klon, nwave, naero_tot))
924    ALLOCATE(drytausum_aero(klon, naero_tot))
925    ALLOCATE(tau3d_aero(klon, klev, nwave, naero_tot))
926    ALLOCATE(dNovrN(klon))
927    ALLOCATE(zfice(klon, klev))
928    ALLOCATE(od443aer(klon))
929    ALLOCATE(od550aer(klon))
930    ALLOCATE(od865aer(klon))
931    ALLOCATE(dryod550aer(klon))
932    dryod550aer(:) = 0.
933    ALLOCATE(abs550aer(klon))
934    abs550aer(:) = 0.
935    ALLOCATE(ec550aer(klon, klev))
936    ALLOCATE(od550lt1aer(klon))
937    ALLOCATE(sconcso4(klon))
938    ALLOCATE(sconcno3(klon))
939    ALLOCATE(sconcoa(klon))
940    ALLOCATE(sconcbc(klon))
941    ALLOCATE(sconcss(klon))
942    ALLOCATE(sconcdust(klon))
943    ALLOCATE(concso4(klon, klev))
944    ALLOCATE(concno3(klon, klev))
945    ALLOCATE(concoa(klon, klev))
946    ALLOCATE(concbc(klon, klev))
947    ALLOCATE(concss(klon, klev))
948    ALLOCATE(concdust(klon, klev))
949    ALLOCATE(loadso4(klon))
950    ALLOCATE(loadoa(klon))
951    ALLOCATE(loadbc(klon))
952    ALLOCATE(loadss(klon))
953    ALLOCATE(loaddust(klon))
954    ALLOCATE(loadno3(klon))
955    ALLOCATE(load_tmp1(klon))
956    ALLOCATE(load_tmp2(klon))
957    ALLOCATE(load_tmp3(klon))
958    ALLOCATE(load_tmp4(klon))
959    ALLOCATE(load_tmp5(klon))
960    ALLOCATE(load_tmp6(klon))
961    ALLOCATE(load_tmp7(klon))
962    ALLOCATE(load_tmp8(klon))
963    ALLOCATE(load_tmp9(klon))
964    ALLOCATE(load_tmp10(klon))
965
966    !IM ajout variables CFMIP2/CMIP5
967    ALLOCATE(topswad_aerop(klon), solswad_aerop(klon))
968    ALLOCATE(topswai_aerop(klon), solswai_aerop(klon))
969    ALLOCATE(topswad0_aerop(klon), solswad0_aerop(klon))
970    ALLOCATE(topsw_aerop(klon, naero_grp), topsw0_aerop(klon, naero_grp))
971    ALLOCATE(solsw_aerop(klon, naero_grp), solsw0_aerop(klon, naero_grp))
972    ALLOCATE(topswcf_aerop(klon, naero_grp), solswcf_aerop(klon, naero_grp))
973
974    ! additional LW variables CK
975    ALLOCATE(toplwad_aerop(klon), sollwad_aerop(klon))
976    ALLOCATE(toplwai_aerop(klon), sollwai_aerop(klon))
977    ALLOCATE(toplwad0_aerop(klon), sollwad0_aerop(klon))
978
979    !AI Ajout Ecrad (3Deffect)
980    ALLOCATE(topswad_aero_s2(klon), solswad_aero_s2(klon))
981    ALLOCATE(topswai_aero_s2(klon), solswai_aero_s2(klon))
982    ALLOCATE(topswad0_aero_s2(klon), solswad0_aero_s2(klon))
983    ALLOCATE(topsw_aero_s2(klon, naero_grp), topsw0_aero_s2(klon, naero_grp))
984    ALLOCATE(solsw_aero_s2(klon, naero_grp), solsw0_aero_s2(klon, naero_grp))
985    ALLOCATE(topswcf_aero_s2(klon, naero_grp), solswcf_aero_s2(klon, naero_grp))
986    ! additional LW variables CK
987    ALLOCATE(toplwad_aero_s2(klon), sollwad_aero_s2(klon))
988    ALLOCATE(toplwai_aero_s2(klon), sollwai_aero_s2(klon))
989    ALLOCATE(toplwad0_aero_s2(klon), sollwad0_aero_s2(klon))
990
991    ! FH Ajout de celles necessaires au phys_output_write_mod
992
993    ALLOCATE(tal1(klon), pal1(klon), pab1(klon), pab2(klon))
994    ALLOCATE(ptstar(klon), pt0(klon), slp(klon))
995    !!
996    !!          Wake variables
997    ALLOCATE(alp_wake(klon))
998    ALLOCATE(wake_h(klon), wake_k(klon))
999    ALLOCATE(wake_omg(klon, klev))
1000    ALLOCATE(d_deltat_wk(klon, klev), d_deltaq_wk(klon, klev))
1001    ALLOCATE(d_s_wk(klon), d_s_a_wk(klon), d_dens_wk(klon), d_dens_a_wk(klon))
1002    ALLOCATE(d_deltat_wk_gw(klon, klev), d_deltaq_wk_gw(klon, klev))
1003    ALLOCATE(d_deltat_vdf(klon, klev), d_deltaq_vdf(klon, klev))
1004    !!      ALLOCATE( d_s_vdf(klon), d_dens_vdf(klon))
1005    ALLOCATE(d_deltat_the(klon, klev), d_deltaq_the(klon, klev))
1006    !!      ALLOCATE( d_s_the(klon), d_dens_the(klon))
1007    ALLOCATE(d_deltat_ajs_cv(klon, klev), d_deltaq_ajs_cv(klon, klev))
1008#ifdef ISO
1009      ALLOCATE(d_deltaxt_wk(ntraciso,klon, klev))
1010      ALLOCATE(d_deltaxt_wk_gw(ntraciso,klon, klev))
1011      ALLOCATE(d_deltaxt_the(ntraciso,klon, klev))
1012      ALLOCATE(d_deltaxt_vdf(ntraciso,klon, klev))
1013      ALLOCATE(d_deltaxt_ajs_cv(ntraciso,klon, klev))
1014#endif
1015    !!         End of wake variables
1016    !!
1017    ALLOCATE(bils(klon))
1018    ALLOCATE(cdragm(klon), cdragh(klon), cldh(klon), cldl(klon))
1019    ALLOCATE(cldm(klon), cldq(klon), cldt(klon), qsat2m(klon))
1020    ALLOCATE(JrNt(klon))
1021    ALLOCATE(dthmin(klon), evap(klon), snowerosion(klon), fder(klon), plcl(klon), plfc(klon))
1022    ALLOCATE(prw(klon), prlw(klon), prsw(klon), prbsw(klon), water_budget(klon), zustar(klon), zu10m(klon), zv10m(klon), rh2m(klon))
1023    ALLOCATE(s_lcl(klon))
1024    ALLOCATE(s_pblh(klon), s_pblt(klon), s_therm(klon))
1025
1026    !nrlmd+jyg<
1027    ALLOCATE(s_pblh_x(klon), s_pblh_w(klon))
1028    ALLOCATE(s_lcl_x(klon), s_lcl_w(klon))
1029    !>nrlmd+jyg
1030
1031    ALLOCATE(slab_wfbils(klon), tpot(klon), tpote(klon), ue(klon))
1032    ALLOCATE(uq(klon), ve(klon), vq(klon), zxffonte(klon))
1033    ALLOCATE(uwat(klon), vwat(klon))
1034    ALLOCATE(zxfqcalving(klon), zxfluxlat(klon))
1035    ALLOCATE(zxtsol(klon), snow_lsc(klon), zxfqfonte(klon), zxqsurf(klon))
1036! SN add runoff_diag
1037      ALLOCATE(zxrunofflic(klon), runoff_diag(klon))
1038      runoff_diag(:)=0.
1039    ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon), tempsmoothlic(klon))
1040    zxustartlic(:) = 0. ; zxrhoslic(:) = 0. ; zxqsaltlic(:) = 0. ; tempsmoothlic(:)=0.
1041    ALLOCATE(rain_lsc(klon))
1042    ALLOCATE(rain_num(klon))
1043    ALLOCATE(qlth(klon, klev), qith(klon, klev), qsith(klon, klev), wiceth(klon, klev))
1044#ifdef ISO
1045      ALLOCATE(xtevap(ntraciso,klon))
1046      ALLOCATE(xtprw(ntraciso,klon))
1047      ALLOCATE(zxfxtcalving(niso,klon))
1048      ALLOCATE(xtsnow_lsc(ntraciso,klon), zxfxtfonte(niso,klon))
1049      ALLOCATE(zxxtrunofflic(niso,klon))
1050      ALLOCATE(xtrain_lsc(ntraciso,klon))
1051      ALLOCATE(xtrunoff_diag(niso,klon))
1052      ALLOCATE(h1_diag(klon))
1053!SN
1054      xtrunoff_diag(:,:)=0. ! because variables are only given values on knon grid points
1055#endif
1056
1057    ALLOCATE(sens_x(klon), sens_w(klon))
1058    ALLOCATE(zxfluxlat_x(klon), zxfluxlat_w(klon))
1059    ALLOCATE(delta_qsurf(klon))
1060    !jyg<
1061    !!      ALLOCATE(t_x(klon,klev), t_w(klon,klev))
1062    !!      ALLOCATE(q_x(klon,klev), q_w(klon,klev))
1063    !>jyg
1064    ALLOCATE(dtvdf_x(klon, klev), dtvdf_w(klon, klev))
1065    dtvdf_x = 0 ; dtvdf_w = 0 ;
1066    !ym missing init
1067    ALLOCATE(dqvdf_x(klon, klev), dqvdf_w(klon, klev))
1068    dqvdf_x = 0 ; dqvdf_w = 0 ;
1069    !ym missing init
1070    ALLOCATE(pbl_tke_input(klon, klev + 1, nbsrf))
1071    ALLOCATE(t_therm(klon, klev), q_therm(klon, klev), u_therm(klon, klev), v_therm(klon, klev))
1072    ALLOCATE(cdragh_x(klon), cdragh_w(klon))
1073    ALLOCATE(cdragm_x(klon), cdragm_w(klon))
1074    ALLOCATE(kh(klon), kh_x(klon), kh_w(klon))
1075#ifdef ISO
1076      ALLOCATE(dxtvdf_x(ntraciso,klon,klev), dxtvdf_w(ntraciso,klon,klev))
1077      ALLOCATE(xt_therm(ntraciso,klon,klev))
1078#endif
1079
1080    ALLOCATE(ptconv(klon, klev))
1081    ALLOCATE(ratqsc(klon, klev))
1082
1083    ALLOCATE(wbeff(klon), convoccur(klon), zmax_th(klon))
1084    ALLOCATE(zq2m(klon), zt2m(klon), weak_inversion(klon))
1085    ALLOCATE(zt2m_min_mon(klon), zt2m_max_mon(klon))
1086    ALLOCATE(t2m_min_mon(klon), t2m_max_mon(klon))
1087    ALLOCATE(sens(klon), flwp(klon), fiwp(klon))
1088    ALLOCATE(alp_bl_conv(klon), alp_bl_det(klon))
1089    alp_bl_conv(:) = 0 ;  alp_bl_det(:) = 0
1090    ALLOCATE(alp_bl_fluct_m(klon), alp_bl_fluct_tke(klon))
1091    alp_bl_fluct_m(:) = 0 ; alp_bl_fluct_tke(:) = 0.
1092    ALLOCATE(alp_bl_stat(klon), n2(klon), s2(klon), strig(klon), zcong(klon), zlcl_th(klon))
1093    alp_bl_stat(:) = 0
1094    ALLOCATE(proba_notrig(klon), random_notrig(klon))
1095
1096    ALLOCATE(dnwd0(klon, klev))
1097    !      ALLOCATE(upwd(klon, klev), omega(klon, klev), coefh(klon, klev))
1098    ALLOCATE(omega(klon, klev))
1099    ALLOCATE(epmax_diag(klon)) ! epmax_cape
1100    !      ALLOCATE(coefm(klon, klev), lambda_th(klon, klev), cldemi(klon, klev))
1101    ALLOCATE(lambda_th(klon, klev), cldemi(klon, klev))
1102    ALLOCATE(cldfra(klon, klev), cldtau(klon, klev), fiwc(klon, klev))
1103    ALLOCATE(fl(klon, klev), re(klon, klev), flwc(klon, klev))
1104    ALLOCATE(ref_liq(klon, klev), ref_ice(klon, klev), theta(klon, klev))
1105    ALLOCATE(ref_liq_pi(klon, klev), ref_ice_pi(klon, klev))
1106    ALLOCATE(zphi(klon, klev), zx_rh(klon, klev), zx_rhl(klon, klev), zx_rhi(klon, klev))
1107    zx_rhl(:, :) = 0.; zx_rhi(:, :) = 0. ! because not always defined
1108    ALLOCATE(pmfd(klon, klev), pmfu(klon, klev))
1109
1110    ALLOCATE(t2m(klon, nbsrf), fluxlat(klon, nbsrf))
1111    ALLOCATE(fsollw(klon, nbsrf))
1112    ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf))
1113    ALLOCATE(wfevap(klon, nbsrf))
1114    ALLOCATE(evap_pot(klon, nbsrf))
1115    ! FC
1116    ALLOCATE(zxfluxq(klon, klev), zxfluxt(klon, klev))
1117
1118    !  Deep convective variables used in phytrac
1119    ALLOCATE(pmflxr(klon, klev + 1), pmflxs(klon, klev + 1))
1120    ALLOCATE(wdtrainA(klon, klev), wdtrainS(klon, klev), wdtrainM(klon, klev))
1121    ALLOCATE(dnwd(klon, klev), upwd(klon, klev))
1122    ALLOCATE(ep(klon, klev))                          ! epmax_cape
1123    ALLOCATE(da(klon, klev), mp(klon, klev))
1124    ALLOCATE(phi(klon, klev, klev))
1125    ALLOCATE(wght_cvfd(klon, klev))
1126    ALLOCATE(phi2(klon, klev, klev))
1127    ALLOCATE(d1a(klon, klev), dam(klon, klev))
1128    ALLOCATE(ev(klon, klev))
1129    ALLOCATE(elij(klon, klev, klev))
1130    ALLOCATE(qtaa(klon, klev))
1131    ALLOCATE(clw(klon, klev))
1132    ALLOCATE(epmlmMm(klon, klev, klev), eplaMm(klon, klev))
1133    ALLOCATE(sij(klon, klev, klev))
1134#ifdef ISO
1135      ALLOCATE(xtwdtrainA(ntraciso,klon,klev))
1136      ALLOCATE(xtev(ntraciso,klon,klev) )
1137      ALLOCATE(xttaa(ntraciso,klon,klev) )
1138      ALLOCATE(xtclw(ntraciso,klon,klev) )
1139#ifdef DIAGISO
1140      ALLOCATE(qlp(klon,klev))
1141      ALLOCATE(qvp(klon,klev))
1142      ALLOCATE(fq_detrainement(klon,klev))
1143      ALLOCATE(fq_ddft(klon,klev))
1144      ALLOCATE(fq_fluxmasse(klon,klev))
1145      ALLOCATE(fq_evapprecip(klon,klev))
1146      ALLOCATE(f_detrainement(klon,klev), q_detrainement(klon,klev))
1147      ALLOCATE(xtlp(ntraciso,klon,klev))
1148      ALLOCATE(xtvp(ntraciso,klon,klev))
1149      ALLOCATE(q_the(klon,klev), xt_the(ntraciso,klon,klev))
1150      ALLOCATE(fxt_detrainement(ntraciso,klon,klev))
1151      ALLOCATE(fxt_ddft(ntraciso,klon,klev))
1152      ALLOCATE(fxt_fluxmasse(ntraciso,klon,klev))
1153      ALLOCATE(fxt_evapprecip(ntraciso,klon,klev))
1154      ALLOCATE(xt_detrainement(ntraciso,klon,klev))
1155#endif
1156#endif
1157
1158    ALLOCATE(prfl(klon, klev + 1))
1159    ALLOCATE(psfl(klon, klev + 1), fraca(klon, klev + 1), Vprecip(klon, klev + 1))
1160    ALLOCATE(bsfl(klon, klev + 1))
1161    ALLOCATE(zw2(klon, klev + 1))
1162
1163    ALLOCATE(fluxu(klon, klev, nbsrf), fluxv(klon, klev, nbsrf))
1164    ALLOCATE(fluxt(klon, klev, nbsrf))
1165
1166    ALLOCATE(uwriteSTD(klon, nlevSTD, nfiles), vwriteSTD(klon, nlevSTD, nfiles))
1167    ALLOCATE(wwriteSTD(klon, nlevSTD, nfiles), phiwriteSTD(klon, nlevSTD, nfiles))
1168    ALLOCATE(qwriteSTD(klon, nlevSTD, nfiles), twriteSTD(klon, nlevSTD, nfiles))
1169    ALLOCATE(rhwriteSTD(klon, nlevSTD, nfiles))
1170
1171    ! ug et d'autres encore:
1172    ALLOCATE(beta_prec(klon, klev))
1173    ALLOCATE(rneb(klon, klev), rnebjn(klon, klev), rneblsvol(klon, klev))
1174    ALLOCATE(pfraclr(klon, klev), pfracld(klon, klev))
1175    pfraclr(:, :) = 0. ; pfracld(:, :) = 0. ! because not always defined
1176    ALLOCATE(cldfraliq(klon, klev))
1177    ALLOCATE(sigma2_icefracturb(klon, klev))
1178    ALLOCATE(mean_icefracturb(klon, klev))
1179    ALLOCATE(distcltop(klon, klev))
1180    ALLOCATE(temp_cltop(klon, klev))
1181
1182    ALLOCATE (zxsnow(klon), snowhgt(klon), qsnow(klon), to_ice(klon))
1183    ALLOCATE (sissnow(klon), runoff(klon), albsol3_lic(klon))
1184#ifdef ISO
1185      ALLOCATE (zxxtsnow(niso,klon))
1186      ALLOCATE(xtVprecip(ntraciso,klon, klev+1),xtVprecipi(ntraciso,klon, klev+1))
1187      ALLOCATE(pxtsfl(ntraciso,klon, klev+1),pxtrfl(ntraciso,klon, klev+1))
1188#endif
1189
1190    ALLOCATE (p_tropopause(klon))
1191    ALLOCATE (z_tropopause(klon))
1192    ALLOCATE (t_tropopause(klon))
1193
1194    ALLOCATE(zn2mout(klon, 6))
1195
1196    !-- LSCP - condensation and ice supersaturation variables
1197    ALLOCATE(qsub(klon,klev), qissr(klon,klev), qcld(klon,klev))
1198    ALLOCATE(subfra(klon,klev), issrfra(klon,klev))
1199    ALLOCATE(gamma_cond(klon,klev), ratio_qi_qtot(klon,klev))
1200    ALLOCATE(dcf_sub(klon,klev), dcf_con(klon,klev), dcf_mix(klon,klev))
1201    ALLOCATE(dqi_adj(klon,klev), dqi_sub(klon,klev), dqi_con(klon,klev), dqi_mix(klon,klev))
1202    ALLOCATE(dqvc_adj(klon,klev), dqvc_sub(klon,klev), dqvc_con(klon,klev), dqvc_mix(klon,klev))
1203    ALLOCATE(qsatliq(klon,klev), qsatice(klon,klev))
1204
1205    !-- LSCP - aviation and contrails variables
1206    ALLOCATE(Tcontr(klon,klev), qcontr(klon,klev), qcontr2(klon,klev))
1207    ALLOCATE(fcontrN(klon,klev), fcontrP(klon,klev))
1208    ALLOCATE(dcf_avi(klon,klev), dqi_avi(klon,klev), dqvc_avi(klon,klev))
1209    ALLOCATE(flight_dist(klon,klev), flight_h2o(klon,klev))
1210
1211    !-- LSCP - POPRECIP variables
1212    ALLOCATE(qraindiag(klon, klev), qsnowdiag(klon, klev))
1213    ALLOCATE(dqreva(klon, klev), dqssub(klon, klev))
1214    ALLOCATE(dqrauto(klon, klev), dqrcol(klon, klev), dqrmelt(klon, klev), dqrfreez(klon, klev))
1215    ALLOCATE(dqsauto(klon, klev), dqsagg(klon, klev), dqsrim(klon, klev), dqsmelt(klon, klev), dqsfreez(klon, klev))
1216
1217    IF (CPPKEY_STRATAER) THEN
1218      ALLOCATE (d_q_emiss(klon, klev))
1219      ALLOCATE (R2SO4(klon, klev))
1220      ALLOCATE (R2SO4B(klon, klev, nbtr_bin))
1221      ALLOCATE (DENSO4(klon, klev))
1222      ALLOCATE (DENSO4B(klon, klev, nbtr_bin))
1223      ALLOCATE (f_r_wet(klon, klev))
1224      ALLOCATE (f_r_wetB(klon, klev, nbtr_bin))
1225      ALLOCATE (decfluxaer(klon, nbtr))
1226      ALLOCATE (mdw(nbtr))
1227      ALLOCATE (budg_3D_nucl(klon, klev))
1228      ALLOCATE (budg_3D_cond_evap(klon, klev))
1229      ALLOCATE (budg_3D_ocs_to_so2(klon, klev))
1230      ALLOCATE (budg_3D_so2_to_h2so4(klon, klev))
1231      ALLOCATE (budg_3D_backgr_ocs(klon, klev))
1232      ALLOCATE (budg_3D_backgr_so2(klon, klev))
1233      ALLOCATE (OCS_lifetime(klon, klev))
1234      ALLOCATE (SO2_lifetime(klon, klev))
1235      ALLOCATE (H2SO4_lifetime(klon, klev))
1236      ALLOCATE (O3_clim(klon, klev))
1237      ALLOCATE (alpha_bin(nbands_sw_rrtm + nbands_lw_rrtm + nwave, nbtr))
1238      ALLOCATE (piz_bin(nbands_sw_rrtm + nbands_lw_rrtm + nwave, nbtr))
1239      ALLOCATE (cg_bin(nbands_sw_rrtm + nbands_lw_rrtm + nwave, nbtr))
1240      ALLOCATE (tau_strat_550(klon, klev))
1241      ALLOCATE (tau_strat_1020(klon, klev))
1242      ALLOCATE (tausum_strat(klon, 3))
1243      ALLOCATE (budg_dep_dry_ocs(klon))
1244      ALLOCATE (budg_dep_wet_ocs(klon))
1245      ALLOCATE (budg_dep_dry_so2(klon))
1246      ALLOCATE (budg_dep_wet_so2(klon))
1247      ALLOCATE (budg_dep_dry_h2so4(klon))
1248      ALLOCATE (budg_dep_wet_h2so4(klon))
1249      ALLOCATE (budg_dep_dry_part(klon))
1250      ALLOCATE (budg_dep_wet_part(klon))
1251      ALLOCATE (budg_emi_ocs(klon))
1252      ALLOCATE (budg_emi_so2(klon))
1253      ALLOCATE (budg_emi_h2so4(klon))
1254      ALLOCATE (budg_emi_part(klon))
1255      ALLOCATE (budg_ocs_to_so2(klon))
1256      ALLOCATE (budg_so2_to_h2so4(klon))
1257      ALLOCATE (budg_h2so4_to_part(klon))
1258      ALLOCATE (budg_sed_part(klon))
1259      ALLOCATE (surf_PM25_sulf(klon))
1260      ALLOCATE (vsed_aer(klon, klev))
1261      ALLOCATE (sulfmmr(klon, klev))
1262      ALLOCATE (SAD_sulfate(klon, klev))
1263      ALLOCATE (reff_sulfate(klon,klev))
1264      ALLOCATE (sulfmmr_mode(klon, klev, nbtr_bin))
1265      ALLOCATE (nd_mode(klon, klev, nbtr_bin))
1266    END IF
1267
1268  END SUBROUTINE phys_local_var_init
1269
1270  !======================================================================
1271  SUBROUTINE phys_local_var_end
1272    USE dimphy
1273    USE indice_sol_mod
1274    IMPLICIT NONE
1275    DEALLOCATE(t_seri, q_seri, ql_seri, qs_seri, qbs_seri)
1276    ! SN 4D ISO
1277    DEALLOCATE(qx_seri)
1278    ! SN
1279    DEALLOCATE(u_seri, v_seri)
1280    DEALLOCATE(cf_seri,rvc_seri)
1281    DEALLOCATE(l_mixmin, l_mix, wprime)
1282    DEALLOCATE(tke_shear, tke_buoy, tke_trans)
1283    DEALLOCATE(pbl_eps)
1284    DEALLOCATE(rhcl)
1285    DEALLOCATE(tr_seri)
1286    DEALLOCATE(d_t_dyn, d_q_dyn)
1287    DEALLOCATE(d_ql_dyn, d_qs_dyn, d_qbs_dyn)
1288    DEALLOCATE(d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d)
1289    DEALLOCATE(d_u_dyn, d_v_dyn)
1290    DEALLOCATE(d_cf_dyn,d_rvc_dyn)
1291    DEALLOCATE(d_tr_dyn)                      !RomP
1292    DEALLOCATE(d_t_con, d_q_con, d_q_con_zmasse)
1293    DEALLOCATE(d_u_con, d_v_con)
1294    DEALLOCATE(d_t_wake, d_q_wake)
1295    DEALLOCATE(d_t_lsc, d_q_lsc)
1296    DEALLOCATE(d_t_lwr, d_t_lw0)
1297    DEALLOCATE(d_t_swr, d_t_sw0)
1298    DEALLOCATE(d_ql_lsc, d_qi_lsc)
1299    DEALLOCATE(d_t_ajsb, d_q_ajsb)
1300    DEALLOCATE(d_t_ajs, d_q_ajs)
1301    !nrlmd<
1302    DEALLOCATE(d_t_ajs_w, d_q_ajs_w)
1303    DEALLOCATE(d_t_ajs_x, d_q_ajs_x)
1304    !>nrlmd
1305    DEALLOCATE(d_u_ajs, d_v_ajs)
1306    DEALLOCATE(d_t_eva, d_q_eva)
1307    ! SN 4D ISO
1308    DEALLOCATE(d_qx_eva)
1309    ! SN
1310    DEALLOCATE(d_ql_eva, d_qi_eva)
1311    DEALLOCATE(d_t_lscst, d_q_lscst)
1312    DEALLOCATE(d_t_lscth, d_q_lscth)
1313    DEALLOCATE(plul_st, plul_th)
1314    DEALLOCATE(d_t_vdf, d_q_vdf, d_t_diss)
1315    DEALLOCATE(d_qbs_vdf)
1316    DEALLOCATE(d_t_bsss, d_q_bsss, d_qbs_bsss)
1317#ifdef ISO
1318      deallocate(xt_seri,xtl_seri,xts_seri,xtbs_seri)
1319      DEALLOCATE(d_xtl_eva,d_xti_eva)
1320      deallocate(d_xt_dyn,d_xtl_dyn,d_xts_dyn,d_xtbs_dyn)
1321      deallocate(d_xt_con)
1322      deallocate(d_xt_wake)
1323      deallocate(d_xt_lsc)
1324      deallocate(d_xtl_lsc,d_xti_lsc)
1325      deallocate(d_xt_ajsb)
1326      deallocate(d_xt_ajs)
1327      deallocate(d_xt_ajs_w,d_xt_ajs_x)
1328      deallocate(d_xt_eva)
1329      deallocate(d_xtl_eva)
1330      deallocate(d_xti_eva)
1331      deallocate(d_xt_vdf)
1332      deallocate(d_xt_vdf_w,d_xt_vdf_x)
1333      deallocate(d_xt_ch4)
1334      deallocate(d_xt_prod_nucl)
1335      deallocate(d_xt_cosmo)
1336      deallocate(d_xt_decroiss)
1337#endif
1338
1339    DEALLOCATE(d_u_vdf, d_v_vdf)
1340    DEALLOCATE(d_t_oli, d_t_oro)
1341    DEALLOCATE(d_u_oli, d_v_oli)
1342    DEALLOCATE(d_u_oro, d_v_oro)
1343    DEALLOCATE(d_t_oro_gw)
1344    DEALLOCATE(d_u_oro_gw, d_v_oro_gw)
1345    DEALLOCATE(d_t_lif, d_t_ec)
1346    DEALLOCATE(d_u_lif, d_v_lif)
1347    DEALLOCATE(d_ts, d_tr)
1348    DEALLOCATE(topswad_aero, solswad_aero)
1349    DEALLOCATE(topswai_aero, solswai_aero)
1350    DEALLOCATE(topswad0_aero, solswad0_aero)
1351    DEALLOCATE(toplwad_aero, sollwad_aero)
1352    DEALLOCATE(toplwai_aero, sollwai_aero)
1353    DEALLOCATE(toplwad0_aero, sollwad0_aero)
1354    DEALLOCATE(topsw_aero, solsw_aero)
1355    DEALLOCATE(topsw0_aero, solsw0_aero)
1356    DEALLOCATE(topswcf_aero, solswcf_aero)
1357    DEALLOCATE(stratomask)
1358    DEALLOCATE(tausum_aero)
1359    DEALLOCATE(drytausum_aero)
1360    DEALLOCATE(tau3d_aero)
1361    DEALLOCATE(dNovrN)
1362    DEALLOCATE(zfice)
1363    DEALLOCATE(od443aer)
1364    DEALLOCATE(od550aer)
1365    DEALLOCATE(od865aer)
1366    DEALLOCATE(dryod550aer)
1367    DEALLOCATE(abs550aer)
1368    DEALLOCATE(ec550aer)
1369    DEALLOCATE(od550lt1aer)
1370    DEALLOCATE(sconcso4)
1371    DEALLOCATE(sconcno3)
1372    DEALLOCATE(sconcoa)
1373    DEALLOCATE(sconcbc)
1374    DEALLOCATE(sconcss)
1375    DEALLOCATE(sconcdust)
1376    DEALLOCATE(concso4)
1377    DEALLOCATE(concno3)
1378    DEALLOCATE(concoa)
1379    DEALLOCATE(concbc)
1380    DEALLOCATE(concss)
1381    DEALLOCATE(concdust)
1382    DEALLOCATE(loadso4)
1383    DEALLOCATE(loadoa)
1384    DEALLOCATE(loadbc)
1385    DEALLOCATE(loadss)
1386    DEALLOCATE(loaddust)
1387    DEALLOCATE(loadno3)
1388    DEALLOCATE(load_tmp1)
1389    DEALLOCATE(load_tmp2)
1390    DEALLOCATE(load_tmp3)
1391    DEALLOCATE(load_tmp4)
1392    DEALLOCATE(load_tmp5)
1393    DEALLOCATE(load_tmp6)
1394    DEALLOCATE(load_tmp7)
1395    DEALLOCATE(load_tmp8)
1396    DEALLOCATE(load_tmp9)
1397    DEALLOCATE(load_tmp10)
1398    DEALLOCATE(du_gwd_hines, dv_gwd_hines, d_t_hin)
1399    DEALLOCATE(d_q_ch4)
1400    DEALLOCATE(dv_gwd_rando, dv_gwd_front)
1401    DEALLOCATE(east_gwstress, west_gwstress)
1402
1403    !IM ajout variables CFMIP2/CMIP5
1404    DEALLOCATE(topswad_aerop, solswad_aerop)
1405    DEALLOCATE(topswai_aerop, solswai_aerop)
1406    DEALLOCATE(topswad0_aerop, solswad0_aerop)
1407    DEALLOCATE(topsw_aerop, topsw0_aerop)
1408    DEALLOCATE(solsw_aerop, solsw0_aerop)
1409    DEALLOCATE(topswcf_aerop, solswcf_aerop)
1410    !CK LW diagnostics
1411    DEALLOCATE(toplwad_aerop, sollwad_aerop)
1412    DEALLOCATE(toplwai_aerop, sollwai_aerop)
1413    DEALLOCATE(toplwad0_aerop, sollwad0_aerop)
1414
1415    !AI Ajout pour Ecrad (3Deffect)
1416    DEALLOCATE(topswad_aero_s2, solswad_aero_s2)
1417    DEALLOCATE(topswai_aero_s2, solswai_aero_s2)
1418    DEALLOCATE(topswad0_aero_s2, solswad0_aero_s2)
1419    DEALLOCATE(topsw_aero_s2, topsw0_aero_s2)
1420    DEALLOCATE(solsw_aero_s2, solsw0_aero_s2)
1421    DEALLOCATE(topswcf_aero_s2, solswcf_aero_s2)
1422    !CK LW diagnostics
1423    DEALLOCATE(toplwad_aero_s2, sollwad_aero_s2)
1424    DEALLOCATE(toplwai_aero_s2, sollwai_aero_s2)
1425    DEALLOCATE(toplwad0_aero_s2, sollwad0_aero_s2)
1426
1427    ! FH Ajout de celles necessaires au phys_output_write_mod
1428    DEALLOCATE(tal1, pal1, pab1, pab2)
1429    DEALLOCATE(ptstar, pt0, slp)
1430
1431    DEALLOCATE(alp_wake)
1432    DEALLOCATE(wake_h, wake_k)
1433    DEALLOCATE(wake_omg)
1434    DEALLOCATE(d_deltat_wk, d_deltaq_wk)
1435    DEALLOCATE(d_s_wk, d_s_a_wk, d_dens_wk, d_dens_a_wk)
1436    DEALLOCATE(d_deltat_wk_gw, d_deltaq_wk_gw)
1437    DEALLOCATE(d_deltat_vdf, d_deltaq_vdf)
1438    !!      DEALLOCATE( d_s_vdf, d_dens_vdf)
1439    DEALLOCATE(d_deltat_the, d_deltaq_the)
1440    !!      DEALLOCATE( d_s_the, d_dens_the)
1441    DEALLOCATE(d_deltat_ajs_cv, d_deltaq_ajs_cv)
1442#ifdef ISO
1443      DEALLOCATE(d_deltaxt_wk)
1444      DEALLOCATE(d_deltaxt_wk_gw)
1445      DEALLOCATE(d_deltaxt_ajs_cv)
1446      DEALLOCATE(d_deltaxt_vdf)
1447#endif
1448
1449    DEALLOCATE(bils)
1450    DEALLOCATE(cdragm, cdragh, cldh, cldl)
1451    DEALLOCATE(cldm, cldq, cldt, qsat2m)
1452    DEALLOCATE(JrNt)
1453    DEALLOCATE(dthmin, evap, snowerosion, fder, plcl, plfc)
1454    DEALLOCATE(prw, prlw, prsw, prbsw, water_budget, zustar, zu10m, zv10m, rh2m, s_lcl)
1455    DEALLOCATE(s_pblh, s_pblt, s_therm)
1456
1457    !nrlmd+jyg<
1458    DEALLOCATE(s_pblh_x, s_pblh_w)
1459    DEALLOCATE(s_lcl_x, s_lcl_w)
1460    !>nrlmd+jyg
1461
1462    DEALLOCATE(slab_wfbils, tpot, tpote, ue)
1463    DEALLOCATE(uq, ve, vq, zxffonte)
1464    DEALLOCATE(uwat, vwat)
1465    DEALLOCATE(zxfqcalving, zxfluxlat)
1466! SN runoff_diag
1467      DEALLOCATE(zxrunofflic, runoff_diag)
1468    DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic)
1469    DEALLOCATE(zxtsol, snow_lsc, zxfqfonte, zxqsurf)
1470    DEALLOCATE(rain_lsc)
1471    DEALLOCATE(rain_num)
1472    DEALLOCATE(qlth, qith, qsith, wiceth)
1473
1474    DEALLOCATE(sens_x, sens_w)
1475    DEALLOCATE(zxfluxlat_x, zxfluxlat_w)
1476    DEALLOCATE(delta_qsurf)
1477    !jyg<
1478    !!      DEALLOCATE(t_x, t_w)
1479    !!      DEALLOCATE(q_x, q_w)
1480    !>jyg
1481    DEALLOCATE(d_t_vdf_x, d_t_vdf_w)
1482    DEALLOCATE(d_q_vdf_x, d_q_vdf_w)
1483    DEALLOCATE(pbl_tke_input)
1484    DEALLOCATE(t_therm, q_therm, u_therm, v_therm)
1485    DEALLOCATE(cdragh_x, cdragh_w)
1486    DEALLOCATE(cdragm_x, cdragm_w)
1487    DEALLOCATE(kh, kh_x, kh_w)
1488#ifdef ISO
1489      DEALLOCATE(xtevap,xtprw)
1490      DEALLOCATE(zxfxtcalving)
1491      DEALLOCATE(zxxtrunofflic)
1492      DEALLOCATE(xtsnow_lsc, zxfxtfonte)
1493      DEALLOCATE(xtrain_lsc)
1494      DEALLOCATE(dxtvdf_x, dxtvdf_w)
1495      DEALLOCATE(xt_therm)
1496      DEALLOCATE(h1_diag,xtrunoff_diag)
1497#endif
1498
1499    DEALLOCATE(ptconv)
1500    DEALLOCATE(ratqsc)
1501
1502    DEALLOCATE(wbeff, convoccur, zmax_th)
1503    DEALLOCATE(zq2m, zt2m, weak_inversion)
1504    DEALLOCATE(zt2m_min_mon, zt2m_max_mon)
1505    DEALLOCATE(t2m_min_mon, t2m_max_mon)
1506    DEALLOCATE(sens, flwp, fiwp)
1507    DEALLOCATE(alp_bl_conv, alp_bl_det)
1508    DEALLOCATE(alp_bl_fluct_m, alp_bl_fluct_tke)
1509    DEALLOCATE(alp_bl_stat, n2, s2, strig, zcong, zlcl_th)
1510    DEALLOCATE(proba_notrig, random_notrig)
1511    !FC
1512    DEALLOCATE(zxfluxq, zxfluxt)
1513
1514    DEALLOCATE(dnwd0)
1515    !      DEALLOCATE(upwd, omega, coefh)
1516    DEALLOCATE(omega)
1517    DEALLOCATE(epmax_diag)
1518    !      DEALLOCATE(coefm, lambda_th, cldemi)
1519    DEALLOCATE(lambda_th, cldemi)
1520    DEALLOCATE(cldfra, cldtau, fiwc)
1521    DEALLOCATE(fl, re, flwc)
1522    DEALLOCATE(ref_liq, ref_ice, theta)
1523    DEALLOCATE(ref_liq_pi, ref_ice_pi)
1524    DEALLOCATE(zphi, zx_rh, zx_rhl, zx_rhi)
1525    DEALLOCATE(pmfd, pmfu)
1526
1527    DEALLOCATE(t2m, fluxlat)
1528    DEALLOCATE(fsollw, evap_pot)
1529    DEALLOCATE(fsolsw, wfbils)
1530    DEALLOCATE(wfevap)
1531
1532    DEALLOCATE(pmflxr, pmflxs)
1533    DEALLOCATE(wdtrainA, wdtrainS, wdtrainM)
1534    DEALLOCATE(upwd, dnwd)
1535    DEALLOCATE(ep)
1536    DEALLOCATE(da, mp)
1537    DEALLOCATE(phi)
1538    DEALLOCATE(wght_cvfd)
1539    DEALLOCATE(phi2)
1540    DEALLOCATE(d1a, dam)
1541    DEALLOCATE(ev)
1542    DEALLOCATE(elij)
1543    DEALLOCATE(qtaa)
1544    DEALLOCATE(clw)
1545    DEALLOCATE(epmlmMm, eplaMm)
1546    DEALLOCATE(sij)
1547#ifdef ISO
1548      DEALLOCATE(xtwdtrainA)
1549      DEALLOCATE(xttaa )
1550      DEALLOCATE(xtclw )
1551      DEALLOCATE(xtev )
1552#ifdef DIAGISO
1553      DEALLOCATE(qlp)
1554      DEALLOCATE(qvp)
1555      DEALLOCATE(fq_detrainement)
1556      DEALLOCATE(fq_ddft)
1557      DEALLOCATE(fq_fluxmasse)
1558      DEALLOCATE(fq_evapprecip)
1559      DEALLOCATE(f_detrainement,q_detrainement)
1560      DEALLOCATE(xtlp)
1561      DEALLOCATE(xtvp)
1562      DEALLOCATE(q_the,xt_the)
1563      DEALLOCATE(fxt_detrainement)
1564      DEALLOCATE(fxt_ddft)
1565      DEALLOCATE(fxt_fluxmasse)
1566      DEALLOCATE(fxt_evapprecip)
1567      DEALLOCATE(xt_detrainement)
1568#endif
1569#endif
1570
1571
1572    DEALLOCATE(prfl, psfl, bsfl, fraca, Vprecip)
1573    DEALLOCATE(zw2)
1574
1575    DEALLOCATE(fluxu, fluxv)
1576    DEALLOCATE(fluxt)
1577
1578    DEALLOCATE(uwriteSTD, vwriteSTD)
1579    DEALLOCATE(wwriteSTD, phiwriteSTD)
1580    DEALLOCATE(qwriteSTD, twriteSTD, rhwriteSTD)
1581
1582    ! ug et d'autres encore:
1583    DEALLOCATE(beta_prec)
1584    DEALLOCATE(rneb)
1585    DEALLOCATE(pfraclr, pfracld)
1586    DEALLOCATE(cldfraliq)
1587    DEALLOCATE(sigma2_icefracturb)
1588    DEALLOCATE(mean_icefracturb)
1589    DEALLOCATE (zxsnow, snowhgt, qsnow, to_ice, sissnow, runoff, albsol3_lic)
1590    DEALLOCATE(distcltop)
1591    DEALLOCATE(temp_cltop)
1592#ifdef ISO
1593      DEALLOCATE (zxxtsnow,xtVprecip,xtVprecipi,pxtrfl,pxtsfl)
1594#endif
1595
1596    DEALLOCATE (p_tropopause)
1597    DEALLOCATE (z_tropopause)
1598    DEALLOCATE (t_tropopause)
1599    DEALLOCATE(zn2mout)
1600
1601    !-- LSCP - condensation and ice supersaturation variables
1602    DEALLOCATE(qsub, qissr, qcld)
1603    DEALLOCATE(subfra, issrfra)
1604    DEALLOCATE(gamma_cond, ratio_qi_qtot)
1605    DEALLOCATE(dcf_sub, dcf_con, dcf_mix)
1606    DEALLOCATE(dqi_adj, dqi_sub, dqi_con, dqi_mix)
1607    DEALLOCATE(dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix)
1608    DEALLOCATE(qsatliq, qsatice)
1609
1610    !-- LSCP - aviation and contrails variables
1611    DEALLOCATE(Tcontr, qcontr, qcontr2)
1612    DEALLOCATE(fcontrN, fcontrP)
1613    DEALLOCATE(dcf_avi, dqi_avi, dqvc_avi)
1614    DEALLOCATE(flight_dist, flight_h2o)
1615
1616    !-- LSCP - POPRECIP variables
1617    DEALLOCATE(qraindiag, qsnowdiag)
1618    DEALLOCATE(dqreva, dqssub)
1619    DEALLOCATE(dqrauto, dqrcol, dqrmelt, dqrfreez)
1620    DEALLOCATE(dqsauto, dqsagg, dqsrim, dqsmelt, dqsfreez)
1621
1622    IF (CPPKEY_STRATAER) THEN
1623      ! variables for strat. aerosol CK
1624      DEALLOCATE (d_q_emiss)
1625      DEALLOCATE (R2SO4, R2SO4B)
1626      DEALLOCATE (DENSO4, DENSO4B)
1627      DEALLOCATE (f_r_wet, f_r_wetB)
1628      DEALLOCATE (decfluxaer)
1629      DEALLOCATE (mdw)
1630      DEALLOCATE (SO2_lifetime)
1631      DEALLOCATE (OCS_lifetime)
1632      DEALLOCATE (H2SO4_lifetime)
1633      DEALLOCATE (O3_clim)
1634      DEALLOCATE (alpha_bin)
1635      DEALLOCATE (piz_bin)
1636      DEALLOCATE (cg_bin)
1637      DEALLOCATE (tau_strat_550)
1638      DEALLOCATE (tau_strat_1020)
1639      DEALLOCATE (tausum_strat)
1640      DEALLOCATE (surf_PM25_sulf)
1641      DEALLOCATE (vsed_aer)
1642      DEALLOCATE (sulfmmr)
1643      DEALLOCATE (SAD_sulfate)
1644      DEALLOCATE (reff_sulfate)
1645      DEALLOCATE (sulfmmr_mode)
1646      DEALLOCATE (nd_mode)
1647      DEALLOCATE (budg_3D_ocs_to_so2)
1648      DEALLOCATE (budg_3D_so2_to_h2so4)
1649      DEALLOCATE (budg_3D_backgr_ocs)
1650      DEALLOCATE (budg_3D_backgr_so2)
1651      DEALLOCATE (budg_3D_nucl)
1652      DEALLOCATE (budg_3D_cond_evap)
1653      DEALLOCATE (budg_dep_dry_ocs)
1654      DEALLOCATE (budg_dep_wet_ocs)
1655      DEALLOCATE (budg_dep_dry_so2)
1656      DEALLOCATE (budg_dep_wet_so2)
1657      DEALLOCATE (budg_dep_dry_h2so4)
1658      DEALLOCATE (budg_dep_wet_h2so4)
1659      DEALLOCATE (budg_dep_dry_part)
1660      DEALLOCATE (budg_dep_wet_part)
1661      DEALLOCATE (budg_emi_ocs)
1662      DEALLOCATE (budg_emi_so2)
1663      DEALLOCATE (budg_emi_h2so4)
1664      DEALLOCATE (budg_emi_part)
1665      DEALLOCATE (budg_ocs_to_so2)
1666      DEALLOCATE (budg_so2_to_h2so4)
1667      DEALLOCATE (budg_h2so4_to_part)
1668      DEALLOCATE (budg_sed_part)
1669    END IF
1670
1671  END SUBROUTINE phys_local_var_end
1672
1673END MODULE phys_local_var_mod
Note: See TracBrowser for help on using the repository browser.