source: LMDZ6/branches/blowing_snow/libf/phylmd/phys_state_var_mod.F90 @ 5229

Last change on this file since 5229 was 4485, checked in by evignon, 20 months ago

premier commit pour l'ajout de la neige soufflee sur la nouvelle branche

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