source: LMDZ6/branches/LMDZ_ECRad/libf/phylmdiso/phys_local_var_mod.F90 @ 5306

Last change on this file since 5306 was 4727, checked in by idelkadi, 13 months ago

Merged trunk changes -r4488:4726 LMDZ_ECRad branch

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