source: LMDZ6/trunk/libf/phylmdiso/phys_state_var_mod.F90 @ 4013

Last change on this file since 4013 was 3940, checked in by crisi, 4 years ago

replace files by symbloic liks from phylmdiso towards phylmd.
Many files at once

File size: 32.6 KB
Line 
1!
2! $Id: phys_state_var_mod.F90 3888 2021-05-05 10:50:37Z jyg $
3!
4      MODULE phys_state_var_mod
5! Variables sauvegardees pour le startphy.nc
6!======================================================================
7!
8!
9!======================================================================
10! Declaration des variables
11      USE dimphy
12      USE netcdf, only: nf90_fill_real
13      INTEGER, PARAMETER :: nlevSTD=17
14      INTEGER, PARAMETER :: nlevSTD8=8
15      INTEGER, PARAMETER :: nlevSTD3=3
16      INTEGER, PARAMETER :: nout=3
17      INTEGER, PARAMETER :: napisccp=1
18      INTEGER, SAVE :: radpas  ! radiation is called every "radpas" step
19      INTEGER, SAVE :: cvpas   ! convection is called every "cvpas" step
20      INTEGER, SAVE :: cvpas_0 = 1 ! reference value for cvpas
21      INTEGER, SAVE :: wkpas   ! wake scheme is called every "wkpas" step
22      REAL, PARAMETER :: missing_val_nf90=nf90_fill_real
23!$OMP THREADPRIVATE(radpas)
24!$OMP THREADPRIVATE(cvpas)
25!$OMP THREADPRIVATE(cvpas_0)
26!$OMP THREADPRIVATE(wkpas)
27      REAL, SAVE :: phys_tstep=0, solaire_etat0
28!$OMP THREADPRIVATE(phys_tstep, solaire_etat0)
29
30      REAL, ALLOCATABLE, SAVE :: pctsrf(:,:)
31!$OMP THREADPRIVATE(pctsrf)
32      REAL, ALLOCATABLE, SAVE :: ftsol(:,:)
33!$OMP THREADPRIVATE(ftsol)
34      REAL, ALLOCATABLE, SAVE :: beta_aridity(:,:)
35!$OMP THREADPRIVATE(beta_aridity)
36      REAL,ALLOCATABLE,SAVE :: qsol(:),fevap(:,:),z0m(:,:),z0h(:,:),agesno(:,:)
37!$OMP THREADPRIVATE(qsol,fevap,z0m,z0h,agesno)
38!FC drag des arbres
39      REAL, ALLOCATABLE, SAVE :: treedrg(:,:,:)
40!$OMP THREADPRIVATE(treedrg)
41
42!      character(len=6), SAVE :: ocean
43!!!!!!$OMP THREADPRIVATE(ocean)
44!      logical, SAVE :: ok_veget
45!!!!!!$OMP THREADPRIVATE(ok_veget)
46      REAL, ALLOCATABLE, SAVE :: falb1(:,:), falb2(:,:)
47!$OMP THREADPRIVATE(falb1, falb2)
48
49!albedo SB >>>
50      REAL, ALLOCATABLE, SAVE :: falb_dif(:,:,:), falb_dir(:,:,:)
51      REAL, ALLOCATABLE, SAVE :: chl_con(:)
52!$OMP THREADPRIVATE(falb_dir,falb_dif,chl_con)
53!albedo SB <<<
54
55
56      REAL, ALLOCATABLE, SAVE :: rain_fall(:), snow_fall(:)
57!$OMP THREADPRIVATE( rain_fall, snow_fall)
58      REAL, ALLOCATABLE, SAVE :: solsw(:), solswfdiff(:), sollw(:)
59!$OMP THREADPRIVATE(solsw, solswfdiff, sollw)
60      REAL, ALLOCATABLE, SAVE :: radsol(:)
61!$OMP THREADPRIVATE(radsol)
62      REAL, ALLOCATABLE, SAVE :: swradcorr(:)
63!$OMP THREADPRIVATE(swradcorr)
64#ifdef ISO
65      REAL,ALLOCATABLE,SAVE :: xtsol(:,:),fxtevap(:,:,:)
66!$OMP THREADPRIVATE(xtsol,fxtevap)
67      REAL, ALLOCATABLE, SAVE :: xtrain_fall(:,:), xtsnow_fall(:,:)
68!$OMP THREADPRIVATE(xtrain_fall,xtsnow_fall)
69#endif
70
71!clesphy0 param physiq
72!
73! Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
74!
75      REAL, ALLOCATABLE, SAVE :: zmea(:), zstd(:), zsig(:), zgam(:)
76!$OMP THREADPRIVATE(zmea, zstd, zsig, zgam)
77      REAL, ALLOCATABLE, SAVE :: zthe(:), zpic(:), zval(:)
78!$OMP THREADPRIVATE(zthe, zpic, zval)
79!     REAL tabcntr0(100)
80      REAL, ALLOCATABLE, SAVE :: rugoro(:)
81!$OMP THREADPRIVATE(rugoro)
82      REAL, ALLOCATABLE, SAVE :: t_ancien(:,:), q_ancien(:,:)
83!$OMP THREADPRIVATE(t_ancien, q_ancien)
84      REAL, ALLOCATABLE, SAVE :: ql_ancien(:,:), qs_ancien(:,:)
85!$OMP THREADPRIVATE(ql_ancien, qs_ancien)
86      REAL, ALLOCATABLE, SAVE :: prw_ancien(:), prlw_ancien(:), prsw_ancien(:)
87!$OMP THREADPRIVATE(prw_ancien, prlw_ancien, prsw_ancien)
88#ifdef ISO
89      REAL, ALLOCATABLE, SAVE :: xt_ancien(:,:,:),xtl_ancien(:,:,:),xts_ancien(:,:,:)
90!$OMP THREADPRIVATE(xt_ancien,xtl_ancien,xts_ancien)
91#endif
92      REAL, ALLOCATABLE, SAVE :: u_ancien(:,:), v_ancien(:,:)
93!$OMP THREADPRIVATE(u_ancien, v_ancien)
94!!! RomP >>>
95      REAL, ALLOCATABLE, SAVE :: tr_ancien(:,:,:)
96!$OMP THREADPRIVATE(tr_ancien)
97!!! RomP <<<
98      LOGICAL, SAVE :: ancien_ok
99!$OMP THREADPRIVATE(ancien_ok)
100      REAL, ALLOCATABLE, SAVE :: clwcon(:,:),rnebcon(:,:)
101!$OMP THREADPRIVATE(clwcon,rnebcon)
102      REAL, ALLOCATABLE, SAVE :: qtc_cv(:,:),sigt_cv(:,:)
103!$OMP THREADPRIVATE(qtc_cv,sigt_cv)
104      REAL, ALLOCATABLE, SAVE :: ratqs(:,:)
105!$OMP THREADPRIVATE(ratqs)
106      REAL, ALLOCATABLE, SAVE :: pbl_tke(:,:,:) ! turb kinetic energy
107      REAL, ALLOCATABLE, SAVE :: coefh(:,:,:) ! Kz enthalpie
108      REAL, ALLOCATABLE, SAVE :: coefm(:,:,:) ! Kz momentum
109!$OMP THREADPRIVATE(pbl_tke, coefh,coefm)
110      REAL, ALLOCATABLE, SAVE :: zmax0(:), f0(:) !
111!$OMP THREADPRIVATE(zmax0,f0)
112      REAL, ALLOCATABLE, SAVE :: sig1(:,:), w01(:,:)
113!$OMP THREADPRIVATE(sig1,w01)
114      REAL, ALLOCATABLE, SAVE :: entr_therm(:,:), fm_therm(:,:)
115!$OMP THREADPRIVATE(entr_therm,fm_therm)
116      REAL, ALLOCATABLE, SAVE :: detr_therm(:,:)
117!$OMP THREADPRIVATE(detr_therm)
118!IM 150408
119!     pour phsystoke avec thermiques
120      REAL,ALLOCATABLE,SAVE :: clwcon0th(:,:),rnebcon0th(:,:)
121!$OMP THREADPRIVATE(clwcon0th,rnebcon0th)
122! radiation outputs
123      REAL,ALLOCATABLE,SAVE :: swdnc0(:,:), swdn0(:,:), swdn(:,:)
124!$OMP THREADPRIVATE(swdnc0,swdn0,swdn)
125      REAL,ALLOCATABLE,SAVE :: swupc0(:,:), swup0(:,:), swup(:,:)
126!$OMP THREADPRIVATE(swupc0, swup0,swup)
127      REAL,ALLOCATABLE,SAVE :: SWdn200clr(:), SWdn200(:)
128!$OMP THREADPRIVATE(SWdn200clr,SWdn200)
129      REAL,ALLOCATABLE,SAVE :: SWup200clr(:), SWup200(:)
130!$OMP THREADPRIVATE(SWup200clr,SWup200)
131      REAL,ALLOCATABLE,SAVE :: lwdnc0(:,:), lwdn0(:,:), lwdn(:,:)
132!$OMP THREADPRIVATE(lwdnc0,lwdn0,lwdn)
133      REAL,ALLOCATABLE,SAVE :: lwupc0(:,:), lwup0(:,:), lwup(:,:)
134!$OMP THREADPRIVATE(lwupc0,lwup0,lwup)
135      REAL,ALLOCATABLE,SAVE :: LWdn200clr(:), LWdn200(:)
136!$OMP THREADPRIVATE(LWdn200clr,LWdn200)
137      REAL,ALLOCATABLE,SAVE :: LWup200clr(:), LWup200(:)
138!$OMP THREADPRIVATE(LWup200clr,LWup200)
139      REAL,ALLOCATABLE,SAVE :: LWdnTOA(:), LWdnTOAclr(:)
140!$OMP THREADPRIVATE(LWdnTOA,LWdnTOAclr)
141! pressure level
142      REAL,ALLOCATABLE,SAVE :: tsumSTD(:,:,:)
143!$OMP THREADPRIVATE(tsumSTD)
144      REAL,ALLOCATABLE,SAVE :: usumSTD(:,:,:), vsumSTD(:,:,:)
145!$OMP THREADPRIVATE(usumSTD,vsumSTD)
146      REAL,ALLOCATABLE,SAVE :: wsumSTD(:,:,:), phisumSTD(:,:,:)
147!$OMP THREADPRIVATE(wsumSTD,phisumSTD)
148      REAL,ALLOCATABLE,SAVE :: qsumSTD(:,:,:), rhsumSTD(:,:,:)
149!$OMP THREADPRIVATE(qsumSTD,rhsumSTD)
150      REAL,ALLOCATABLE,SAVE :: tnondef(:,:,:)
151!$OMP THREADPRIVATE(tnondef)
152      REAL,ALLOCATABLE,SAVE :: uvsumSTD(:,:,:)
153!$OMP THREADPRIVATE(uvsumSTD)
154      REAL,ALLOCATABLE,SAVE :: vqsumSTD(:,:,:)
155!$OMP THREADPRIVATE(vqsumSTD)
156      REAL,ALLOCATABLE,SAVE :: vTsumSTD(:,:,:)
157!$OMP THREADPRIVATE(vTsumSTD)
158      REAL,ALLOCATABLE,SAVE :: wqsumSTD(:,:,:)
159!$OMP THREADPRIVATE(wqsumSTD)
160      REAL,ALLOCATABLE,SAVE :: vphisumSTD(:,:,:)
161!$OMP THREADPRIVATE(vphisumSTD)
162      REAL,ALLOCATABLE,SAVE :: wTsumSTD(:,:,:)
163!$OMP THREADPRIVATE(wTsumSTD)
164      REAL,ALLOCATABLE,SAVE :: u2sumSTD(:,:,:)
165!$OMP THREADPRIVATE(u2sumSTD)
166      REAL,ALLOCATABLE,SAVE :: v2sumSTD(:,:,:)
167!$OMP THREADPRIVATE(v2sumSTD)
168      REAL,ALLOCATABLE,SAVE :: T2sumSTD(:,:,:)
169!$OMP THREADPRIVATE(T2sumSTD)
170      REAL,ALLOCATABLE,SAVE :: O3sumSTD(:,:,:), O3daysumSTD(:,:,:)
171!$OMP THREADPRIVATE(O3sumSTD,O3daysumSTD)
172!IM begin
173      REAL,ALLOCATABLE,SAVE :: wlevSTD(:,:), ulevSTD(:,:), vlevSTD(:,:)
174!$OMP THREADPRIVATE(wlevSTD,ulevSTD,vlevSTD)
175      REAL,ALLOCATABLE,SAVE :: tlevSTD(:,:), qlevSTD(:,:), rhlevSTD(:,:)
176!$OMP THREADPRIVATE(tlevSTD,qlevSTD,rhlevSTD)
177      REAL,ALLOCATABLE,SAVE :: philevSTD(:,:)
178!$OMP THREADPRIVATE(philevSTD)
179      REAL,ALLOCATABLE,SAVE :: uvSTD(:,:)
180!$OMP THREADPRIVATE(uvSTD)
181      REAL,ALLOCATABLE,SAVE :: vqSTD(:,:)
182!$OMP THREADPRIVATE(vqSTD)
183      REAL,ALLOCATABLE,SAVE :: vTSTD(:,:)
184!$OMP THREADPRIVATE(vTSTD)
185      REAL,ALLOCATABLE,SAVE :: wqSTD(:,:)
186!$OMP THREADPRIVATE(wqSTD)
187      REAL,ALLOCATABLE,SAVE :: vphiSTD(:,:)
188!$OMP THREADPRIVATE(vphiSTD)
189      REAL,ALLOCATABLE,SAVE :: wTSTD(:,:)
190!$OMP THREADPRIVATE(wTSTD)
191      REAL,ALLOCATABLE,SAVE :: u2STD(:,:)
192!$OMP THREADPRIVATE(u2STD)
193      REAL,ALLOCATABLE,SAVE :: v2STD(:,:)
194!$OMP THREADPRIVATE(v2STD)
195      REAL,ALLOCATABLE,SAVE :: T2STD(:,:)
196!$OMP THREADPRIVATE(T2STD)
197      REAL,ALLOCATABLE,SAVE :: O3STD(:,:), O3daySTD(:,:)
198!$OMP THREADPRIVATE(O3STD,O3daySTD)
199!IM end
200      INTEGER,ALLOCATABLE,SAVE :: seed_old(:,:)
201!$OMP THREADPRIVATE(seed_old)
202      REAL,ALLOCATABLE,SAVE :: zuthe(:),zvthe(:)
203!$OMP THREADPRIVATE(zuthe,zvthe)
204      REAL,ALLOCATABLE,SAVE :: alb_neig(:)
205!$OMP THREADPRIVATE(alb_neig)
206!cloud base mass flux
207      REAL,ALLOCATABLE,SAVE :: ema_cbmf(:)
208!$OMP THREADPRIVATE(ema_cbmf)
209!cloud base pressure & cloud top pressure
210      REAL,ALLOCATABLE,SAVE :: ema_pcb(:), ema_pct(:)
211!$OMP THREADPRIVATE(ema_pcb,ema_pct)
212      REAL,ALLOCATABLE,SAVE :: Mipsh(:,:)     ! mass flux shed from  adiab. ascents
213!$OMP THREADPRIVATE(Mipsh)
214      REAL,ALLOCATABLE,SAVE :: Ma(:,:)       ! undilute upward mass flux
215!$OMP THREADPRIVATE(Ma)
216      REAL,ALLOCATABLE,SAVE :: qcondc(:,:)    ! in-cld water content from convect
217!$OMP THREADPRIVATE(qcondc)
218      REAL,ALLOCATABLE,SAVE :: wd(:) ! sb
219!$OMP THREADPRIVATE(wd)
220      REAL,ALLOCATABLE,SAVE :: sigd(:)
221!$OMP THREADPRIVATE(sigd)
222!
223      REAL,ALLOCATABLE,SAVE :: cin(:)
224!$OMP THREADPRIVATE(cin)
225! ftd : convective heating due to unsaturated downdraughts
226      REAL,ALLOCATABLE,SAVE :: ftd(:,:)
227!$OMP THREADPRIVATE(ftd)
228! fqd : convective moistening due to unsaturated downdraughts
229      REAL,ALLOCATABLE,SAVE :: fqd(:,:)     
230!$OMP THREADPRIVATE(fqd)
231#ifdef ISO
232      REAL, ALLOCATABLE, SAVE :: fxtd(:,:,:)
233!$OMP THREADPRIVATE(fxtd)
234#endif
235!34EK
236! -- Variables de controle de ALE et ALP
237!ALE : Energie disponible pour soulevement : utilisee par la
238!      convection d'Emanuel pour le declenchement et la regulation
239      REAL,ALLOCATABLE,SAVE :: ALE(:)
240!$OMP THREADPRIVATE(ALE)
241!ALP : Puissance  disponible pour soulevement
242      REAL,ALLOCATABLE,SAVE :: ALP(:)
243!$OMP THREADPRIVATE(ALP)
244!
245! nouvelles variables pour le couplage convection-couche limite
246      REAL,ALLOCATABLE,SAVE :: Ale_bl(:)
247!$OMP THREADPRIVATE(Ale_bl)
248      REAL,ALLOCATABLE,SAVE :: Alp_bl(:)
249!$OMP THREADPRIVATE(Alp_bl)
250      INTEGER,ALLOCATABLE,SAVE :: lalim_conv(:)
251!$OMP THREADPRIVATE(lalim_conv)
252      REAL,ALLOCATABLE,SAVE :: wght_th(:,:)
253!$OMP THREADPRIVATE(wght_th)
254      REAL,ALLOCATABLE,SAVE    :: ale_wake(:)
255!$OMP THREADPRIVATE(ale_wake)
256      REAL,ALLOCATABLE,SAVE    :: ale_bl_stat(:)
257!$OMP THREADPRIVATE(ale_bl_stat)
258!
259! variables de la wake
260! wake_deltat : ecart de temperature avec la zone non perturbee
261! wake_deltaq : ecart d'humidite avec la zone non perturbee
262! wake_s      : fraction surfacique occupee par la poche froide
263! awake_dens  : number of active wakes per unit area
264! wake_dens   : number of wakes per unit area
265! wake_occ    : occurence of wakes (= 1 if wakes occur, =0 otherwise)
266! wake_Cstar  : vitesse d'etalement de la poche
267! wake_pe     : wake potential energy - WAPE
268! wake_fip    : Gust Front Impinging power - ALP
269      REAL,ALLOCATABLE,SAVE :: wake_deltat(:,:)
270!$OMP THREADPRIVATE(wake_deltat)
271      REAL,ALLOCATABLE,SAVE :: wake_deltaq(:,:)
272!$OMP THREADPRIVATE(wake_deltaq)
273#ifdef ISO
274      REAL, ALLOCATABLE, SAVE :: wake_deltaxt(:,:,:)
275!$OMP THREADPRIVATE(wake_deltaxt)
276#endif
277      REAL,ALLOCATABLE,SAVE :: wake_s(:)
278!$OMP THREADPRIVATE(wake_s)
279      REAL,ALLOCATABLE,SAVE :: awake_dens(:), wake_dens(:)
280!$OMP THREADPRIVATE(awake_dens, wake_dens)
281      REAL,ALLOCATABLE,SAVE :: wake_Cstar(:)
282!$OMP THREADPRIVATE(wake_Cstar)
283      REAL,ALLOCATABLE,SAVE :: wake_pe(:)
284!$OMP THREADPRIVATE(wake_pe)
285      REAL,ALLOCATABLE,SAVE :: wake_fip(:)
286!$OMP THREADPRIVATE(wake_fip)
287!
288!jyg<
289! variables related to the spitting of the PBL between wake and
290! off-wake regions.
291! wake_delta_pbl_TKE : difference TKE_w - TKE_x
292      REAL,ALLOCATABLE,SAVE :: wake_delta_pbl_TKE(:,:,:)
293!$OMP THREADPRIVATE(wake_delta_pbl_TKE)
294!nrlmd<
295      REAL, ALLOCATABLE, SAVE :: delta_tsurf(:,:) ! Surface temperature difference inside-outside cold pool
296!$OMP THREADPRIVATE(delta_tsurf)
297!>nrlmd
298!>jyg
299!
300! pfrac_impa : Produits des coefs lessivage impaction
301! pfrac_nucl : Produits des coefs lessivage nucleation
302! pfrac_1nucl: Produits des coefs lessi nucl (alpha = 1)
303      REAL,ALLOCATABLE,SAVE :: pfrac_impa(:,:), pfrac_nucl(:,:)
304!$OMP THREADPRIVATE(pfrac_impa,pfrac_nucl)
305      REAL,ALLOCATABLE,SAVE :: pfrac_1nucl(:,:)
306!$OMP THREADPRIVATE(pfrac_1nucl)
307!
308      REAL,ALLOCATABLE,SAVE :: total_rain(:), nday_rain(:) 
309!$OMP THREADPRIVATE(total_rain,nday_rain)
310      REAL,ALLOCATABLE,SAVE :: paire_ter(:)
311!$OMP THREADPRIVATE(paire_ter)
312! albsol1: albedo du sol total pour SW visible
313! albsol2: albedo du sol total pour SW proche IR
314      REAL,ALLOCATABLE,SAVE :: albsol1(:), albsol2(:)
315!$OMP THREADPRIVATE(albsol1,albsol2)
316
317!albedo SB >>>
318      REAL,ALLOCATABLE,SAVE :: albsol_dif(:,:),albsol_dir(:,:)
319!$OMP THREADPRIVATE(albsol_dif,albsol_dir)
320!albedo SB <<<
321
322
323      REAL, ALLOCATABLE, SAVE:: wo(:, :, :)
324      ! column-density of ozone in a layer, in kilo-Dobsons
325      ! Third dimension has size 1 or 2.
326      ! "wo(:, :, 1)" is for the average day-night field,
327      ! "wo(:, :, 2)" is for daylight time.
328      !$OMP THREADPRIVATE(wo)
329
330! heat : chauffage solaire
331! heat0: chauffage solaire ciel clair
332! cool : refroidissement infrarouge
333! cool0 : refroidissement infrarouge ciel clair
334! sollwdown : downward LW flux at surface
335! sollwdownclr : downward CS LW flux at surface
336! toplwdown : downward CS LW flux at TOA
337! toplwdownclr : downward CS LW flux at TOA
338! heat_volc : chauffage solaire du au volcanisme
339! cool_volc : refroidissement infrarouge du au volcanisme
340      REAL,ALLOCATABLE,SAVE :: clwcon0(:,:),rnebcon0(:,:)
341!$OMP THREADPRIVATE(clwcon0,rnebcon0)
342      REAL,ALLOCATABLE,SAVE :: heat(:,:)   
343!$OMP THREADPRIVATE(heat)
344      REAL,ALLOCATABLE,SAVE :: heat0(:,:)
345!$OMP THREADPRIVATE(heat0)
346      REAL,ALLOCATABLE,SAVE :: cool(:,:)
347!$OMP THREADPRIVATE(cool)
348      REAL,ALLOCATABLE,SAVE :: cool0(:,:)
349!$OMP THREADPRIVATE(cool0)
350      REAL,ALLOCATABLE,SAVE :: heat_volc(:,:)   
351!$OMP THREADPRIVATE(heat_volc)
352      REAL,ALLOCATABLE,SAVE :: cool_volc(:,:)
353!$OMP THREADPRIVATE(cool_volc)
354      REAL,ALLOCATABLE,SAVE :: topsw(:), toplw(:)
355!$OMP THREADPRIVATE(topsw,toplw)
356      REAL,ALLOCATABLE,SAVE :: sollwdown(:)
357!$OMP THREADPRIVATE(sollwdown)
358      REAL,ALLOCATABLE,SAVE :: gustiness(:)
359!$OMP THREADPRIVATE(gustiness)
360      REAL,ALLOCATABLE,SAVE :: sollwdownclr(:)
361!$OMP THREADPRIVATE(sollwdownclr)
362      REAL,ALLOCATABLE,SAVE :: toplwdown(:)
363!$OMP THREADPRIVATE(toplwdown)
364      REAL,ALLOCATABLE,SAVE :: toplwdownclr(:)
365!$OMP THREADPRIVATE(toplwdownclr)
366      REAL,ALLOCATABLE,SAVE :: topsw0(:),toplw0(:),solsw0(:),sollw0(:)
367!$OMP THREADPRIVATE(topsw0,toplw0,solsw0,sollw0)
368      REAL,ALLOCATABLE,SAVE :: albpla(:)
369!$OMP THREADPRIVATE(albpla)
370
371!IM ajout variables CFMIP2/CMIP5
372      REAL,ALLOCATABLE,SAVE :: heatp(:,:), coolp(:,:)
373!$OMP THREADPRIVATE(heatp, coolp)
374      REAL,ALLOCATABLE,SAVE :: heat0p(:,:), cool0p(:,:)
375!$OMP THREADPRIVATE(heat0p, cool0p)
376      REAL,ALLOCATABLE,SAVE :: radsolp(:), topswp(:), toplwp(:)
377!$OMP THREADPRIVATE(radsolp, topswp, toplwp)
378      REAL,ALLOCATABLE,SAVE :: albplap(:)
379!$OMP THREADPRIVATE(albplap)
380      REAL,ALLOCATABLE,SAVE :: solswp(:), solswfdiffp(:), sollwp(:)
381!$OMP THREADPRIVATE(solswp, solswfdiffp, sollwp)
382      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
383!$OMP THREADPRIVATE(sollwdownp)
384      REAL,ALLOCATABLE,SAVE :: topsw0p(:),toplw0p(:)
385      REAL,ALLOCATABLE,SAVE :: solsw0p(:),sollw0p(:)
386!$OMP THREADPRIVATE(topsw0p,toplw0p,solsw0p,sollw0p)
387      REAL,ALLOCATABLE,SAVE :: lwdnc0p(:,:), lwdn0p(:,:), lwdnp(:,:)
388      REAL,ALLOCATABLE,SAVE :: lwupc0p(:,:), lwup0p(:,:), lwupp(:,:)
389!$OMP THREADPRIVATE(lwdnc0p, lwdn0p, lwdnp, lwupc0p, lwup0p, lwupp)
390      REAL,ALLOCATABLE,SAVE :: swdnc0p(:,:), swdn0p(:,:), swdnp(:,:)
391      REAL,ALLOCATABLE,SAVE :: swupc0p(:,:), swup0p(:,:), swupp(:,:)
392!$OMP THREADPRIVATE(swdnc0p, swdn0p, swdnp, swupc0p, swup0p, swupp)
393
394! pbase : cloud base pressure
395! bbase : cloud base buoyancy
396      REAL,ALLOCATABLE,SAVE :: cape(:)
397!$OMP THREADPRIVATE(cape)
398      REAL,ALLOCATABLE,SAVE :: pbase(:)
399!$OMP THREADPRIVATE(pbase)
400      REAL,ALLOCATABLE,SAVE :: bbase(:)
401!$OMP THREADPRIVATE(bbase)
402!
403      REAL,SAVE,ALLOCATABLE :: zqasc(:,:)
404!$OMP THREADPRIVATE( zqasc)
405      INTEGER,ALLOCATABLE,SAVE :: ibas_con(:), itop_con(:)
406!$OMP THREADPRIVATE(ibas_con,itop_con)
407      REAL,SAVE,ALLOCATABLE :: rain_con(:)
408!$OMP THREADPRIVATE(rain_con)
409      REAL,SAVE,ALLOCATABLE :: snow_con(:)
410!$OMP THREADPRIVATE(snow_con)
411!
412#ifdef ISO
413      REAL,SAVE,ALLOCATABLE :: xtrain_con(:,:)
414!$OMP THREADPRIVATE(xtrain_con)
415      REAL,SAVE,ALLOCATABLE :: xtsnow_con(:,:)
416!$OMP THREADPRIVATE(xtsnow_con)
417#endif
418      REAL,SAVE,ALLOCATABLE :: rlonPOS(:)
419!$OMP THREADPRIVATE(rlonPOS)
420      REAL,SAVE,ALLOCATABLE :: newsst(:)
421!$OMP THREADPRIVATE(newsst)
422      REAL,SAVE,ALLOCATABLE :: ustar(:,:),u10m(:,:), v10m(:,:),wstar(:,:)
423!$OMP THREADPRIVATE(ustar,u10m,v10m,wstar)
424!
425! ok_ade=T -ADE=topswad-topsw
426! ok_aie=T ->
427!       ok_ade=T -AIE=topswai-topswad
428!       ok_ade=F -AIE=topswai-topsw
429!
430!topswad, solswad : Aerosol direct effect
431      REAL,SAVE,ALLOCATABLE :: topswad(:), solswad(:)
432!$OMP THREADPRIVATE(topswad,solswad)
433!topswai, solswai : Aerosol indirect effect
434      REAL,SAVE,ALLOCATABLE :: topswai(:), solswai(:)
435!$OMP THREADPRIVATE(topswai,solswai)
436
437      REAL,SAVE,ALLOCATABLE :: tau_aero(:,:,:,:), piz_aero(:,:,:,:), cg_aero(:,:,:,:)
438!$OMP THREADPRIVATE(tau_aero, piz_aero, cg_aero)
439      REAL,SAVE,ALLOCATABLE :: tau_aero_sw_rrtm(:,:,:,:), piz_aero_sw_rrtm(:,:,:,:), cg_aero_sw_rrtm(:,:,:,:)
440!$OMP THREADPRIVATE(tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm)
441      REAL,SAVE,ALLOCATABLE :: tau_aero_lw_rrtm(:,:,:,:), piz_aero_lw_rrtm(:,:,:,:), cg_aero_lw_rrtm(:,:,:,:)
442!$OMP THREADPRIVATE(tau_aero_lw_rrtm, piz_aero_lw_rrtm, cg_aero_lw_rrtm)
443      REAL,SAVE,ALLOCATABLE :: ccm(:,:,:)
444!$OMP THREADPRIVATE(ccm)
445
446      REAL,SAVE,ALLOCATABLE :: ale_bl_trig(:)
447!$OMP THREADPRIVATE(ale_bl_trig)
448
449      REAL,SAVE,ALLOCATABLE :: ratqs_inter(:,:)
450!$OMP THREADPRIVATE(ratqs_inter)
451
452#ifdef ISO
453#ifdef ISOTRAC
454      INTEGER,SAVE,ALLOCATABLE :: bassin_map(:)
455!$OMP THREADPRIVATE(bassin_map)
456      INTEGER,SAVE,ALLOCATABLE :: boite_map(:,:)
457!$OMP THREADPRIVATE(boite_map)
458#endif   
459#endif
460      REAL, ALLOCATABLE, SAVE:: du_gwd_rando(:, :), du_gwd_front(:, :)
461      !$OMP THREADPRIVATE(du_gwd_rando, du_gwd_front)
462      ! tendencies on wind due to gravity waves
463
464      LOGICAL,SAVE :: is_initialized=.FALSE.
465!$OMP THREADPRIVATE(is_initialized)   
466
467      ! Ocean-atmosphere interface:
468
469      REAL, ALLOCATABLE, SAVE:: ds_ns(:) ! (klon)
470      ! "delta salinity near surface". Salinity variation in the
471      ! near-surface turbulent layer. That is subskin salinity minus
472      ! foundation salinity. In ppt.
473
474      REAL, ALLOCATABLE, SAVE:: dt_ns(:) ! (klon)
475      ! "delta temperature near surface". Temperature variation in the
476      ! near-surface turbulent layer. That is subskin temperature
477      ! minus foundation temperature. (Can be negative.) In K.
478     
479      REAL, ALLOCATABLE, SAVE:: delta_sst(:) ! (klon)
480      ! Ocean-air interface temperature minus bulk SST, in
481      ! K. Allocated and defined only if activate_ocean_skin >= 1.
482
483      REAL, ALLOCATABLE, SAVE:: delta_sal(:) ! (klon)
484      ! Ocean-air interface salinity minus bulk salinity, in ppt
485     
486      !$OMP THREADPRIVATE(delta_sal, ds_ns, dt_ns, delta_sst)
487
488    CONTAINS
489
490!======================================================================
491SUBROUTINE phys_state_var_init(read_climoz)
492USE dimphy
493USE aero_mod
494USE infotrac_phy, ONLY : nbtr
495#ifdef ISO
496USE infotrac_phy, ONLY : ntraciso,niso
497#endif
498USE indice_sol_mod
499use config_ocean_skin_m, only: activate_ocean_skin
500IMPLICIT NONE
501
502integer, intent(in)::  read_climoz
503! read ozone climatology
504! Allowed values are 0, 1 and 2
505! 0: do not read an ozone climatology
506! 1: read a single ozone climatology that will be used day and night
507! 2: read two ozone climatologies, the average day and night
508! climatology and the daylight climatology
509
510include "clesphys.h"
511
512      print*, 'is_initialized', is_initialized
513      IF (is_initialized) RETURN
514      is_initialized=.TRUE.
515      ALLOCATE(pctsrf(klon,nbsrf))
516      ALLOCATE(ftsol(klon,nbsrf))
517      ALLOCATE(beta_aridity(klon,nbsrf))
518      ALLOCATE(qsol(klon),fevap(klon,nbsrf))
519      ALLOCATE(z0m(klon,nbsrf+1),z0h(klon,nbsrf+1),agesno(klon,nbsrf))
520!FC
521      ALLOCATE(treedrg(klon,klev,nbsrf))
522      ALLOCATE(falb1(klon,nbsrf))
523      ALLOCATE(falb2(klon,nbsrf))
524!albedo SB >>>
525      print*, 'allocate falb'
526      ALLOCATE(falb_dir(klon,nsw,nbsrf),falb_dif(klon,nsw,nbsrf))
527      print*, 'allocate falb good', falb_dir(1,1,1)
528      ALLOCATE(chl_con(klon))
529!albedo SB <<<
530      ALLOCATE(rain_fall(klon))
531      ALLOCATE(snow_fall(klon))
532      ALLOCATE(solsw(klon), solswfdiff(klon), sollw(klon))
533      sollw=0.0
534      ALLOCATE(radsol(klon))
535      ALLOCATE(swradcorr(klon))
536      ALLOCATE(zmea(klon), zstd(klon), zsig(klon), zgam(klon))
537      ALLOCATE(zthe(klon), zpic(klon), zval(klon))
538
539      ALLOCATE(rugoro(klon))
540      ALLOCATE(t_ancien(klon,klev), q_ancien(klon,klev))
541      ALLOCATE(ql_ancien(klon,klev), qs_ancien(klon,klev))
542      ALLOCATE(prw_ancien(klon), prlw_ancien(klon), prsw_ancien(klon))
543      ALLOCATE(u_ancien(klon,klev), v_ancien(klon,klev))
544!!! Rom P >>>
545      ALLOCATE(tr_ancien(klon,klev,nbtr))
546!!! Rom P <<<
547      ALLOCATE(clwcon(klon,klev),rnebcon(klon,klev))
548      ALLOCATE(qtc_cv(klon,klev),sigt_cv(klon,klev))
549      ALLOCATE(ratqs(klon,klev))
550      ALLOCATE(pbl_tke(klon,klev+1,nbsrf+1))
551!nrlmd<
552      ALLOCATE(delta_tsurf(klon,nbsrf))
553!>nrlmd
554      ALLOCATE(coefh(klon,klev+1,nbsrf+1))
555      ALLOCATE(coefm(klon,klev+1,nbsrf+1))
556      ALLOCATE(zmax0(klon), f0(klon))
557      ALLOCATE(sig1(klon,klev), w01(klon,klev))
558      ALLOCATE(entr_therm(klon,klev), fm_therm(klon,klev+1))
559      ALLOCATE(detr_therm(klon,klev))
560!     pour phsystoke avec thermiques
561      ALLOCATE(clwcon0th(klon,klev),rnebcon0th(klon,klev))
562! radiation outputs
563      ALLOCATE(swdnc0(klon,klevp1), swdn0(klon,klevp1), swdn(klon,klevp1))
564      ALLOCATE(swupc0(klon,klevp1), swup0(klon,klevp1), swup(klon,klevp1))
565      ALLOCATE(lwdnc0(klon,klevp1), lwdn0(klon,klevp1), lwdn(klon,klevp1))
566      ALLOCATE(lwupc0(klon,klevp1), lwup0(klon,klevp1), lwup(klon,klevp1))
567      ALLOCATE(SWdn200clr(klon), SWdn200(klon))
568      ALLOCATE(SWup200clr(klon), SWup200(klon))
569      ALLOCATE(LWdn200clr(klon), LWdn200(klon))
570      ALLOCATE(LWup200clr(klon), LWup200(klon))
571      ALLOCATE(LWdnTOA(klon), LWdnTOAclr(klon))
572! pressure level
573      ALLOCATE(tsumSTD(klon,nlevSTD,nout))
574      ALLOCATE(usumSTD(klon,nlevSTD,nout), vsumSTD(klon,nlevSTD,nout))
575      ALLOCATE(wsumSTD(klon,nlevSTD,nout), phisumSTD(klon,nlevSTD,nout))
576      ALLOCATE(qsumSTD(klon,nlevSTD,nout), rhsumSTD(klon,nlevSTD,nout))
577      ALLOCATE(tnondef(klon,nlevSTD,nout))
578      ALLOCATE(uvsumSTD(klon,nlevSTD,nout))
579      ALLOCATE(vqsumSTD(klon,nlevSTD,nout))
580      ALLOCATE(vTsumSTD(klon,nlevSTD,nout))
581      ALLOCATE(wqsumSTD(klon,nlevSTD,nout))
582      ALLOCATE(vphisumSTD(klon,nlevSTD,nout))
583      ALLOCATE(wTsumSTD(klon,nlevSTD,nout))
584      ALLOCATE(u2sumSTD(klon,nlevSTD,nout))
585      ALLOCATE(v2sumSTD(klon,nlevSTD,nout))
586      ALLOCATE(T2sumSTD(klon,nlevSTD,nout))
587      ALLOCATE(O3sumSTD(klon,nlevSTD,nout))
588      ALLOCATE(O3daysumSTD(klon,nlevSTD,nout))
589!IM beg
590      ALLOCATE(wlevSTD(klon,nlevSTD), ulevSTD(klon,nlevSTD), vlevSTD(klon,nlevSTD))
591      ALLOCATE(tlevSTD(klon,nlevSTD), qlevSTD(klon,nlevSTD), rhlevSTD(klon,nlevSTD))
592      ALLOCATE(philevSTD(klon,nlevSTD))
593      ALLOCATE(uvSTD(klon,nlevSTD),vqSTD(klon,nlevSTD))
594      ALLOCATE(vTSTD(klon,nlevSTD),wqSTD(klon,nlevSTD))
595      ALLOCATE(vphiSTD(klon,nlevSTD),wTSTD(klon,nlevSTD))
596      ALLOCATE(u2STD(klon,nlevSTD),v2STD(klon,nlevSTD))
597      ALLOCATE(T2STD(klon,nlevSTD))
598      ALLOCATE(O3STD(klon,nlevSTD))
599      ALLOCATE(O3daySTD(klon,nlevSTD))
600!IM end
601      ALLOCATE(seed_old(klon,napisccp))
602      ALLOCATE(zuthe(klon),zvthe(klon))
603      ALLOCATE(alb_neig(klon))
604!cloud base mass flux
605      ALLOCATE(ema_cbmf(klon))
606!cloud base pressure & cloud top pressure
607      ALLOCATE(ema_pcb(klon), ema_pct(klon))
608!
609      ALLOCATE(Mipsh(klon,klev))
610      ALLOCATE(Ma(klon,klev))
611      ALLOCATE(qcondc(klon,klev))
612      ALLOCATE(wd(klon))
613      ALLOCATE(sigd(klon))
614      ALLOCATE(cin(klon), ALE(klon), ALP(klon))
615      ALLOCATE(ftd(klon,klev), fqd(klon,klev))
616      ALLOCATE(Ale_bl(klon))
617      ALLOCATE(ale_wake(klon))
618      ALLOCATE(ale_bl_stat(klon))
619      ale_bl_stat(:)=0
620      ALLOCATE(Alp_bl(klon))
621      ALLOCATE(lalim_conv(klon))
622      ALLOCATE(wght_th(klon,klev))
623      ALLOCATE(wake_deltat(klon,klev), wake_deltaq(klon,klev))
624      ALLOCATE(wake_s(klon), awake_dens(klon), wake_dens(klon))
625      awake_dens = 0.
626      ALLOCATE(wake_Cstar(klon))
627      ALLOCATE(wake_pe(klon), wake_fip(klon))
628!jyg<
629      ALLOCATE(wake_delta_pbl_TKE(klon,klev+1,nbsrf+1))
630!>jyg
631      ALLOCATE(pfrac_impa(klon,klev), pfrac_nucl(klon,klev))
632      ALLOCATE(pfrac_1nucl(klon,klev))
633      ALLOCATE(total_rain(klon), nday_rain(klon))
634      ALLOCATE(paire_ter(klon))
635      ALLOCATE(albsol1(klon), albsol2(klon))
636!albedo SB >>>
637      ALLOCATE(albsol_dir(klon,nsw),albsol_dif(klon,nsw))
638!albedo SB <<<
639
640      if (read_climoz <= 1) then
641         ALLOCATE(wo(klon,klev, 1))
642      else
643         ! read_climoz == 2
644         ALLOCATE(wo(klon,klev, 2))
645      end if
646     
647      ALLOCATE(clwcon0(klon,klev),rnebcon0(klon,klev))
648      ALLOCATE(heat(klon,klev), heat0(klon,klev))
649      ALLOCATE(cool(klon,klev), cool0(klon,klev))
650      ALLOCATE(heat_volc(klon,klev), cool_volc(klon,klev))
651      ALLOCATE(topsw(klon), toplw(klon))
652      ALLOCATE(sollwdown(klon), sollwdownclr(klon))
653      sollwdown = 0.
654      ALLOCATE(toplwdown(klon), toplwdownclr(klon))
655      ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
656      sollw0 = 0.
657      ALLOCATE(albpla(klon))
658!IM ajout variables CFMIP2/CMIP5
659      ALLOCATE(heatp(klon,klev), coolp(klon,klev))
660      ALLOCATE(heat0p(klon,klev), cool0p(klon,klev))
661      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
662      ALLOCATE(albplap(klon))
663      ALLOCATE(solswp(klon), solswfdiffp(klon), sollwp(klon))
664      ALLOCATE(gustiness(klon))
665      ALLOCATE(sollwdownp(klon))
666      ALLOCATE(topsw0p(klon),toplw0p(klon))
667      ALLOCATE(solsw0p(klon),sollw0p(klon))
668      ALLOCATE(lwdnc0p(klon,klevp1), lwdn0p(klon,klevp1), lwdnp(klon,klevp1))
669      ALLOCATE(lwupc0p(klon,klevp1), lwup0p(klon,klevp1), lwupp(klon,klevp1))
670      ALLOCATE(swdnc0p(klon,klevp1), swdn0p(klon,klevp1), swdnp(klon,klevp1))
671      ALLOCATE(swupc0p(klon,klevp1), swup0p(klon,klevp1), swupp(klon,klevp1))
672
673      ALLOCATE(cape(klon))
674      ALLOCATE(pbase(klon),bbase(klon))
675      ALLOCATE(zqasc(klon,klev))
676      ALLOCATE(ibas_con(klon), itop_con(klon))
677      ALLOCATE(rain_con(klon), snow_con(klon))
678      ALLOCATE(rlonPOS(klon))
679      ALLOCATE(newsst(klon))
680      ALLOCATE(ustar(klon,nbsrf),u10m(klon,nbsrf), v10m(klon,nbsrf),wstar(klon,nbsrf+1))
681      ALLOCATE(topswad(klon), solswad(klon))
682      ALLOCATE(topswai(klon), solswai(klon))
683      ALLOCATE(tau_aero(klon,klev,naero_grp,nbands),piz_aero(klon,klev,naero_grp,nbands),cg_aero(klon,klev,naero_grp,nbands))
684      ALLOCATE(tau_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm),piz_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
685      ALLOCATE(cg_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
686      ALLOCATE(tau_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm),piz_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
687      ALLOCATE(cg_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
688      ALLOCATE(ccm(klon,klev,nbands))
689
690#ifdef ISO
691      ALLOCATE(xtsol(niso,klon),fxtevap(ntraciso,klon,nbsrf))
692      ALLOCATE(fxtd(ntraciso,klon,klev))
693      ALLOCATE(wake_deltaxt(ntraciso,klon,klev))
694      ALLOCATE(xt_ancien(ntraciso,klon,klev))
695      ALLOCATE(xtl_ancien(ntraciso,klon,klev))
696      ALLOCATE(xts_ancien(ntraciso,klon,klev))
697      ALLOCATE(xtrain_fall(ntraciso,klon))
698      ALLOCATE(xtsnow_fall(ntraciso,klon))
699      ALLOCATE(xtrain_con(ntraciso,klon))
700      ALLOCATE(xtsnow_con(ntraciso,klon))
701#ifdef ISOTRAC
702      ALLOCATE(bassin_map(klon))
703      ALLOCATE(boite_map(klon,klev)) 
704#endif     
705#endif
706
707      ALLOCATE(ale_bl_trig(klon))
708      ALLOCATE(ratqs_inter(klon,klev))
709      IF (ok_gwd_rando) THEN
710        ALLOCATE(du_gwd_rando(klon, klev))
711        du_gwd_rando(:,:)=0.
712      ENDIF
713      IF (.not. ok_hines .and. ok_gwd_rando) THEN
714        ALLOCATE(du_gwd_front(klon, klev))
715        du_gwd_front(:,:) = 0 !ym missing init   
716      ENDIF
717      if (activate_ocean_skin >= 1) ALLOCATE(delta_sal(klon), ds_ns(klon), &
718           dt_ns(klon), delta_sst(klon))
719
720    END SUBROUTINE phys_state_var_init
721
722!======================================================================
723    SUBROUTINE phys_state_var_end
724      ! Useful only for lmdz1d.
725!USE dimphy
726USE indice_sol_mod
727use config_ocean_skin_m, only: activate_ocean_skin
728IMPLICIT NONE
729include "clesphys.h"
730
731      DEALLOCATE(pctsrf, ftsol, falb1, falb2)
732      DEALLOCATE(beta_aridity)
733      DEALLOCATE(qsol,fevap,z0m,z0h,agesno)
734!FC
735      DEALLOCATE(treedrg)
736      DEALLOCATE(rain_fall, snow_fall, solsw, solswfdiff, sollw, radsol, swradcorr)
737      DEALLOCATE(zmea, zstd, zsig, zgam)
738      DEALLOCATE(zthe, zpic, zval)
739      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
740      DEALLOCATE(qs_ancien, ql_ancien)
741      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien)
742      DEALLOCATE(qtc_cv,sigt_cv)
743      DEALLOCATE(u_ancien, v_ancien)
744      DEALLOCATE(tr_ancien)                           !RomP
745      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
746      DEALLOCATE(zmax0, f0)
747      DEALLOCATE(sig1, w01)
748      DEALLOCATE(entr_therm, fm_therm)
749      DEALLOCATE(detr_therm)
750      DEALLOCATE(clwcon0th, rnebcon0th)
751! radiation outputs
752      DEALLOCATE(swdnc0, swdn0, swdn)
753      DEALLOCATE(swupc0, swup0, swup)
754      DEALLOCATE(lwdnc0, lwdn0, lwdn)
755      DEALLOCATE(lwupc0, lwup0, lwup)
756      DEALLOCATE(SWdn200clr, SWdn200)
757      DEALLOCATE(SWup200clr, SWup200)
758      DEALLOCATE(LWdn200clr, LWdn200)
759      DEALLOCATE(LWup200clr, LWup200)
760      DEALLOCATE(LWdnTOA, LWdnTOAclr)
761! pressure level
762      DEALLOCATE(tsumSTD)
763      DEALLOCATE(usumSTD, vsumSTD)
764      DEALLOCATE(wsumSTD, phisumSTD)
765      DEALLOCATE(tnondef)
766      DEALLOCATE(qsumSTD, rhsumSTD)
767      DEALLOCATE(uvsumSTD)
768      DEALLOCATE(vqsumSTD)
769      DEALLOCATE(vTsumSTD)
770      DEALLOCATE(wqsumSTD)
771      DEALLOCATE(vphisumSTD)
772      DEALLOCATE(wTsumSTD)
773      DEALLOCATE(u2sumSTD)
774      DEALLOCATE(v2sumSTD)
775      DEALLOCATE(T2sumSTD)
776      DEALLOCATE(O3sumSTD)
777      DEALLOCATE(O3daysumSTD)
778!IM beg
779      DEALLOCATE(wlevSTD,ulevSTD,vlevSTD,tlevSTD,qlevSTD,rhlevSTD,philevSTD)
780      DEALLOCATE(uvSTD,vqSTD,vTSTD,wqSTD,vphiSTD,wTSTD,u2STD,v2STD,T2STD,O3STD,O3daySTD)
781!IM end
782      DEALLOCATE(seed_old)
783      DEALLOCATE(zuthe, zvthe)
784      DEALLOCATE(alb_neig)
785      DEALLOCATE(ema_cbmf)
786      DEALLOCATE(ema_pcb, ema_pct)
787      DEALLOCATE(Mipsh, Ma, qcondc)
788      DEALLOCATE(wd, sigd)
789      DEALLOCATE(cin, ALE, ALP)
790      DEALLOCATE(ftd, fqd)
791      DEALLOCATE(Ale_bl, Alp_bl)
792      DEALLOCATE(ale_wake)
793      DEALLOCATE(ale_bl_stat)
794      DEALLOCATE(lalim_conv, wght_th)
795      DEALLOCATE(wake_deltat, wake_deltaq)
796      DEALLOCATE(wake_s, awake_dens, wake_dens)
797      DEALLOCATE(wake_Cstar, wake_pe, wake_fip)
798!jyg<
799      DEALLOCATE(wake_delta_pbl_TKE)
800!nrlmd<
801      DEALLOCATE(delta_tsurf)
802!>nrlmd
803!>jyg
804      DEALLOCATE(pfrac_impa, pfrac_nucl)
805      DEALLOCATE(pfrac_1nucl)
806      DEALLOCATE(total_rain, nday_rain)
807      DEALLOCATE(paire_ter)
808      DEALLOCATE(albsol1, albsol2)
809!albedo SB >>>
810      DEALLOCATE(albsol_dir,albsol_dif,falb_dir,falb_dif,chl_con)
811!albedo SB <<<
812      DEALLOCATE(wo)
813      DEALLOCATE(clwcon0,rnebcon0)
814      DEALLOCATE(heat, heat0)
815      DEALLOCATE(cool, cool0)
816      DEALLOCATE(heat_volc, cool_volc)
817      DEALLOCATE(topsw, toplw)
818      DEALLOCATE(sollwdown, sollwdownclr)
819      DEALLOCATE(gustiness)
820      DEALLOCATE(toplwdown, toplwdownclr)
821      DEALLOCATE(topsw0,toplw0,solsw0,sollw0)
822      DEALLOCATE(albpla)
823!IM ajout variables CFMIP2/CMIP5
824      DEALLOCATE(heatp, coolp)
825      DEALLOCATE(heat0p, cool0p)
826      DEALLOCATE(radsolp, topswp, toplwp)
827      DEALLOCATE(albplap)
828      DEALLOCATE(solswp, solswfdiffp, sollwp)
829      DEALLOCATE(sollwdownp)
830      DEALLOCATE(topsw0p,toplw0p)
831      DEALLOCATE(solsw0p,sollw0p)
832      DEALLOCATE(lwdnc0p, lwdn0p, lwdnp)
833      DEALLOCATE(lwupc0p, lwup0p, lwupp)
834      DEALLOCATE(swdnc0p, swdn0p, swdnp)
835      DEALLOCATE(swupc0p, swup0p, swupp)
836      DEALLOCATE(cape)
837      DEALLOCATE(pbase,bbase)
838      DEALLOCATE(zqasc)
839      DEALLOCATE(ibas_con, itop_con)
840      DEALLOCATE(rain_con, snow_con)
841      DEALLOCATE(rlonPOS)
842      DEALLOCATE(newsst)
843      DEALLOCATE(ustar,u10m, v10m,wstar)
844      DEALLOCATE(topswad, solswad)
845      DEALLOCATE(topswai, solswai)
846      DEALLOCATE(tau_aero,piz_aero,cg_aero)
847      DEALLOCATE(tau_aero_sw_rrtm,piz_aero_sw_rrtm,cg_aero_sw_rrtm)
848      DEALLOCATE(tau_aero_lw_rrtm,piz_aero_lw_rrtm,cg_aero_lw_rrtm)
849      DEALLOCATE(ccm)
850      if (ok_gwd_rando) DEALLOCATE(du_gwd_rando)
851      if (.not. ok_hines .and. ok_gwd_rando) DEALLOCATE(du_gwd_front)
852      DEALLOCATE(ale_bl_trig)
853      DEALLOCATE(ratqs_inter)
854
855      if (activate_ocean_skin >= 1) deALLOCATE(delta_sal, ds_ns, dt_ns, &
856           delta_sst)
857
858#ifdef ISO   
859      DEALLOCATE(xtsol,fxtevap) 
860      DEALLOCATE(xt_ancien,xtl_ancien,xts_ancien, fxtd, wake_deltaxt)
861      DEALLOCATE(xtrain_fall, xtsnow_fall, xtrain_con, xtsnow_con)
862#ifdef ISOTRAC
863      DEALLOCATE(bassin_map,boite_map)
864#endif       
865#endif
866      is_initialized=.FALSE.
867     
868END SUBROUTINE phys_state_var_end
869
870      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.