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

Last change on this file since 5136 was 5132, checked in by abarral, 4 months ago

Correct arguments order in abort_gcm
Merge r5085 r5097 r5109 r5124 r5125 r5126 r5127
Replace calls to get_ioipsl* by IOIPSL in phylmdiso/
Symlink inlandsis and lmdz_simu_airs into phylmdiso as it's needed for the compilation
Remove now unused key from makelmdz_fcm

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