source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/phys_state_var_mod.F90 @ 5233

Last change on this file since 5233 was 4758, checked in by idelkadi, 12 months ago
  • 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: 37.0 KB
Line 
1!
2! $Id: phys_state_var_mod.F90 4758 2023-12-01 21:09:29Z 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(:,:),detrain_cv(:,:),fm_cv(:,:)
105!$OMP THREADPRIVATE(qtc_cv,sigt_cv,detrain_cv,fm_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(:,:),fqcomp(:,:)     
232!$OMP THREADPRIVATE(fqd,fqcomp)
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 :: ndayrain_mth(:)
316!$OMP THREADPRIVATE(ndayrain_mth)
317      REAL,ALLOCATABLE,SAVE :: paire_ter(:)
318!$OMP THREADPRIVATE(paire_ter)
319! albsol1: albedo du sol total pour SW visible
320! albsol2: albedo du sol total pour SW proche IR
321      REAL,ALLOCATABLE,SAVE :: albsol1(:), albsol2(:)
322!$OMP THREADPRIVATE(albsol1,albsol2)
323
324!albedo SB >>>
325      REAL,ALLOCATABLE,SAVE :: albsol_dif(:,:),albsol_dir(:,:)
326!$OMP THREADPRIVATE(albsol_dif,albsol_dir)
327!albedo SB <<<
328
329
330      REAL, ALLOCATABLE, SAVE:: wo(:, :, :)
331      ! column-density of ozone in a layer, in kilo-Dobsons
332      ! Third dimension has size 1 or 2.
333      ! "wo(:, :, 1)" is for the average day-night field,
334      ! "wo(:, :, 2)" is for daylight time.
335      !$OMP THREADPRIVATE(wo)
336
337! heat : chauffage solaire
338! heat0: chauffage solaire ciel clair
339! cool : refroidissement infrarouge
340! cool0 : refroidissement infrarouge ciel clair
341! sollwdown : downward LW flux at surface
342! sollwdownclr : downward CS LW flux at surface
343! toplwdown : downward CS LW flux at TOA
344! toplwdownclr : downward CS LW flux at TOA
345! heat_volc : chauffage solaire du au volcanisme
346! cool_volc : refroidissement infrarouge du au volcanisme
347      REAL,ALLOCATABLE,SAVE :: clwcon0(:,:),rnebcon0(:,:)
348!$OMP THREADPRIVATE(clwcon0,rnebcon0)
349      REAL,ALLOCATABLE,SAVE :: heat(:,:)   
350!$OMP THREADPRIVATE(heat)
351      REAL,ALLOCATABLE,SAVE :: heat0(:,:)
352!$OMP THREADPRIVATE(heat0)
353      REAL,ALLOCATABLE,SAVE :: cool(:,:)
354!$OMP THREADPRIVATE(cool)
355      REAL,ALLOCATABLE,SAVE :: cool0(:,:)
356!$OMP THREADPRIVATE(cool0)
357      REAL,ALLOCATABLE,SAVE :: heat_volc(:,:)   
358!$OMP THREADPRIVATE(heat_volc)
359      REAL,ALLOCATABLE,SAVE :: cool_volc(:,:)
360!$OMP THREADPRIVATE(cool_volc)
361      REAL,ALLOCATABLE,SAVE :: topsw(:), toplw(:)
362!$OMP THREADPRIVATE(topsw,toplw)
363      REAL,ALLOCATABLE,SAVE :: sollwdown(:)
364!$OMP THREADPRIVATE(sollwdown)
365      REAL,ALLOCATABLE,SAVE :: gustiness(:)
366!$OMP THREADPRIVATE(gustiness)
367      REAL,ALLOCATABLE,SAVE :: sollwdownclr(:)
368!$OMP THREADPRIVATE(sollwdownclr)
369      REAL,ALLOCATABLE,SAVE :: toplwdown(:)
370!$OMP THREADPRIVATE(toplwdown)
371      REAL,ALLOCATABLE,SAVE :: toplwdownclr(:)
372!$OMP THREADPRIVATE(toplwdownclr)
373      REAL,ALLOCATABLE,SAVE :: topsw0(:),toplw0(:),solsw0(:),sollw0(:)
374!$OMP THREADPRIVATE(topsw0,toplw0,solsw0,sollw0)
375      REAL,ALLOCATABLE,SAVE :: albpla(:)
376!$OMP THREADPRIVATE(albpla)
377
378!IM ajout variables CFMIP2/CMIP5
379      REAL,ALLOCATABLE,SAVE :: heatp(:,:), coolp(:,:)
380!$OMP THREADPRIVATE(heatp, coolp)
381      REAL,ALLOCATABLE,SAVE :: heat0p(:,:), cool0p(:,:)
382!$OMP THREADPRIVATE(heat0p, cool0p)
383      REAL,ALLOCATABLE,SAVE :: radsolp(:), topswp(:), toplwp(:)
384!$OMP THREADPRIVATE(radsolp, topswp, toplwp)
385      REAL,ALLOCATABLE,SAVE :: albplap(:)
386!$OMP THREADPRIVATE(albplap)
387      REAL,ALLOCATABLE,SAVE :: solswp(:), solswfdiffp(:), sollwp(:)
388!$OMP THREADPRIVATE(solswp, solswfdiffp, sollwp)
389      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
390!$OMP THREADPRIVATE(sollwdownp)
391      REAL,ALLOCATABLE,SAVE :: topsw0p(:),toplw0p(:)
392      REAL,ALLOCATABLE,SAVE :: solsw0p(:),sollw0p(:)
393!$OMP THREADPRIVATE(topsw0p,toplw0p,solsw0p,sollw0p)
394      REAL,ALLOCATABLE,SAVE :: lwdnc0p(:,:), lwdn0p(:,:), lwdnp(:,:)
395      REAL,ALLOCATABLE,SAVE :: lwupc0p(:,:), lwup0p(:,:), lwupp(:,:)
396!$OMP THREADPRIVATE(lwdnc0p, lwdn0p, lwdnp, lwupc0p, lwup0p, lwupp)
397      REAL,ALLOCATABLE,SAVE :: swdnc0p(:,:), swdn0p(:,:), swdnp(:,:)
398      REAL,ALLOCATABLE,SAVE :: swupc0p(:,:), swup0p(:,:), swupp(:,:)
399!$OMP THREADPRIVATE(swdnc0p, swdn0p, swdnp, swupc0p, swup0p, swupp)
400
401!AI ajout variables double appel Ecrad (3Deffect)
402      REAL,ALLOCATABLE,SAVE :: heat_s2(:,:), cool_s2(:,:)
403!$OMP THREADPRIVATE(heat_s2, cool_s2)
404      REAL,ALLOCATABLE,SAVE :: heat0_s2(:,:), cool0_s2(:,:)
405!$OMP THREADPRIVATE(heat0_s2, cool0_s2)
406      REAL,ALLOCATABLE,SAVE :: radsol_s2(:), topsw_s2(:), toplw_s2(:)
407!$OMP THREADPRIVATE(radsol_s2, topsw_s2, toplw_s2)
408      REAL,ALLOCATABLE,SAVE :: albpla_s2(:)
409!$OMP THREADPRIVATE(albpla_s2)
410      REAL,ALLOCATABLE,SAVE :: solsw_s2(:), solswfdiff_s2(:), sollw_s2(:)
411!$OMP THREADPRIVATE(solsw_s2, solswfdiff_s2, sollw_s2)
412      REAL,ALLOCATABLE,SAVE :: sollwdown_s2(:), sollwdownclr_s2(:)
413!$OMP THREADPRIVATE(sollwdown_s2, sollwdownclr_s2)
414      REAL,ALLOCATABLE,SAVE :: topsw0_s2(:),toplw0_s2(:)
415      REAL,ALLOCATABLE,SAVE :: solsw0_s2(:),sollw0_s2(:)
416!$OMP THREADPRIVATE(topsw0_s2,toplw0_s2,solsw0_s2,sollw0_s2)
417      REAL,ALLOCATABLE,SAVE :: lwdnc0_s2(:,:), lwdn0_s2(:,:), lwdn_s2(:,:)
418      REAL,ALLOCATABLE,SAVE :: lwupc0_s2(:,:), lwup0_s2(:,:), lwup_s2(:,:)
419!$OMP THREADPRIVATE(lwdnc0_s2,lwdn0_s2,lwdn_s2,lwupc0_s2,lwup0_s2,lwup_s2)       
420      REAL,ALLOCATABLE,SAVE :: swdnc0_s2(:,:), swdn0_s2(:,:), swdn_s2(:,:)
421      REAL,ALLOCATABLE,SAVE :: swupc0_s2(:,:), swup0_s2(:,:), swup_s2(:,:)
422!$OMP THREADPRIVATE(swdnc0_s2, swdn0_s2, swdn_s2, swupc0_s2, swup0_s2, swup_s2)
423
424! pbase : cloud base pressure
425! bbase : cloud base buoyancy
426      REAL,ALLOCATABLE,SAVE :: cape(:)
427!$OMP THREADPRIVATE(cape)
428      REAL,ALLOCATABLE,SAVE :: pbase(:)
429!$OMP THREADPRIVATE(pbase)
430      REAL,ALLOCATABLE,SAVE :: bbase(:)
431!$OMP THREADPRIVATE(bbase)
432!
433      REAL,SAVE,ALLOCATABLE :: zqasc(:,:)
434!$OMP THREADPRIVATE( zqasc)
435      INTEGER,ALLOCATABLE,SAVE :: ibas_con(:), itop_con(:)
436!$OMP THREADPRIVATE(ibas_con,itop_con)
437      REAL,SAVE,ALLOCATABLE :: rain_con(:)
438!$OMP THREADPRIVATE(rain_con)
439      REAL,SAVE,ALLOCATABLE :: snow_con(:)
440!$OMP THREADPRIVATE(snow_con)
441!
442#ifdef ISO
443      REAL,SAVE,ALLOCATABLE :: xtrain_con(:,:)
444!$OMP THREADPRIVATE(xtrain_con)
445      REAL,SAVE,ALLOCATABLE :: xtsnow_con(:,:)
446!$OMP THREADPRIVATE(xtsnow_con)
447#endif
448      REAL,SAVE,ALLOCATABLE :: rlonPOS(:)
449!$OMP THREADPRIVATE(rlonPOS)
450      REAL,SAVE,ALLOCATABLE :: newsst(:)
451!$OMP THREADPRIVATE(newsst)
452      REAL,SAVE,ALLOCATABLE :: ustar(:,:),u10m(:,:), v10m(:,:),wstar(:,:)
453!$OMP THREADPRIVATE(ustar,u10m,v10m,wstar)
454!
455! ok_ade=T -ADE=topswad-topsw
456! ok_aie=T ->
457!       ok_ade=T -AIE=topswai-topswad
458!       ok_ade=F -AIE=topswai-topsw
459!
460!topswad, solswad : Aerosol direct effect
461      REAL,SAVE,ALLOCATABLE :: topswad(:), solswad(:)
462!$OMP THREADPRIVATE(topswad,solswad)
463!topswai, solswai : Aerosol indirect effect
464      REAL,SAVE,ALLOCATABLE :: topswai(:), solswai(:)
465!$OMP THREADPRIVATE(topswai,solswai)
466
467      REAL,SAVE,ALLOCATABLE :: tau_aero(:,:,:,:), piz_aero(:,:,:,:), cg_aero(:,:,:,:)
468!$OMP THREADPRIVATE(tau_aero, piz_aero, cg_aero)
469      REAL,SAVE,ALLOCATABLE :: tau_aero_sw_rrtm(:,:,:,:), piz_aero_sw_rrtm(:,:,:,:), cg_aero_sw_rrtm(:,:,:,:)
470!$OMP THREADPRIVATE(tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm)
471      REAL,SAVE,ALLOCATABLE :: tau_aero_lw_rrtm(:,:,:,:), piz_aero_lw_rrtm(:,:,:,:), cg_aero_lw_rrtm(:,:,:,:)
472!$OMP THREADPRIVATE(tau_aero_lw_rrtm, piz_aero_lw_rrtm, cg_aero_lw_rrtm)
473      REAL,SAVE,ALLOCATABLE :: ccm(:,:,:)
474!$OMP THREADPRIVATE(ccm)
475
476      REAL,SAVE,ALLOCATABLE :: ale_bl_trig(:)
477!$OMP THREADPRIVATE(ale_bl_trig)
478
479      REAL,SAVE,ALLOCATABLE :: ratqs_inter_(:,:)
480!$OMP THREADPRIVATE(ratqs_inter_)
481
482#ifdef ISO
483#ifdef ISOTRAC
484      INTEGER,SAVE,ALLOCATABLE :: bassin_map(:)
485!$OMP THREADPRIVATE(bassin_map)
486      INTEGER,SAVE,ALLOCATABLE :: boite_map(:,:)
487!$OMP THREADPRIVATE(boite_map)
488#endif   
489#endif
490      REAL, ALLOCATABLE, SAVE:: du_gwd_rando(:, :), du_gwd_front(:, :)
491      !$OMP THREADPRIVATE(du_gwd_rando, du_gwd_front)
492      ! tendencies on wind due to gravity waves
493
494      LOGICAL,SAVE :: is_initialized=.FALSE.
495!$OMP THREADPRIVATE(is_initialized)   
496
497      ! Ocean-atmosphere interface:
498
499      REAL, ALLOCATABLE, SAVE:: ds_ns(:) ! (klon)
500      ! "delta salinity near surface". Salinity variation in the
501      ! near-surface turbulent layer. That is subskin salinity minus
502      ! foundation salinity. In ppt.
503
504      REAL, ALLOCATABLE, SAVE:: dt_ns(:) ! (klon)
505      ! "delta temperature near surface". Temperature variation in the
506      ! near-surface turbulent layer. That is subskin temperature
507      ! minus foundation temperature. (Can be negative.) In K.
508     
509      REAL, ALLOCATABLE, SAVE:: delta_sst(:) ! (klon)
510      ! Ocean-air interface temperature minus bulk SST, in
511      ! K. Allocated and defined only if activate_ocean_skin >= 1.
512
513      REAL, ALLOCATABLE, SAVE:: delta_sal(:) ! (klon)
514      ! Ocean-air interface salinity minus bulk salinity, in ppt
515     
516      REAL, ALLOCATABLE, SAVE:: dter(:) ! (klon)
517      ! Temperature variation in the diffusive microlayer, that is
518      ! ocean-air interface temperature minus subskin temperature. In K.
519
520      REAL, SAVE, ALLOCATABLE:: dser(:) ! (klon)
521      ! Salinity variation in the diffusive microlayer, that is
522      ! ocean-air interface salinity minus subskin salinity. In ppt.
523
524      real, SAVE, ALLOCATABLE:: dt_ds(:) ! (klon)
525      ! (tks / tkt) * dTer, in K
526
527      !$OMP THREADPRIVATE(delta_sal, ds_ns, dt_ns, delta_sst, dter, dser, dt_ds)
528
529    CONTAINS
530
531!======================================================================
532SUBROUTINE phys_state_var_init(read_climoz)
533USE dimphy
534USE aero_mod
535USE infotrac_phy, ONLY : nbtr
536#ifdef ISO
537USE infotrac_phy, ONLY : ntraciso=>ntiso,niso
538#endif
539USE indice_sol_mod
540use config_ocean_skin_m, only: activate_ocean_skin
541use surface_data, only: type_ocean
542IMPLICIT NONE
543
544integer, intent(in)::  read_climoz
545! read ozone climatology
546! Allowed values are 0, 1 and 2
547! 0: do not read an ozone climatology
548! 1: read a single ozone climatology that will be used day and night
549! 2: read two ozone climatologies, the average day and night
550! climatology and the daylight climatology
551
552include "clesphys.h"
553
554      print*, 'is_initialized', is_initialized
555      IF (is_initialized) RETURN
556      is_initialized=.TRUE.
557      ALLOCATE(pctsrf(klon,nbsrf))
558      ALLOCATE(ftsol(klon,nbsrf))
559      ALLOCATE(beta_aridity(klon,nbsrf))
560      ALLOCATE(qsol(klon),fevap(klon,nbsrf))
561      ALLOCATE(z0m(klon,nbsrf+1),z0h(klon,nbsrf+1),agesno(klon,nbsrf))
562!FC
563      ALLOCATE(treedrg(klon,klev,nbsrf))
564      ALLOCATE(falb1(klon,nbsrf))
565      ALLOCATE(falb2(klon,nbsrf))
566!albedo SB >>>
567      print*, 'allocate falb'
568      ALLOCATE(falb_dir(klon,nsw,nbsrf),falb_dif(klon,nsw,nbsrf))
569!!      print*, 'allocate falb good', falb_dir(1,1,1)
570      ALLOCATE(chl_con(klon))
571!albedo SB <<<
572      ALLOCATE(rain_fall(klon))
573      ALLOCATE(snow_fall(klon))
574      ALLOCATE(bs_fall(klon))
575      ALLOCATE(solsw(klon), solswfdiff(klon), sollw(klon))
576      sollw=0.0
577      ALLOCATE(radsol(klon))
578      ALLOCATE(swradcorr(klon))
579      ALLOCATE(zmea(klon), zstd(klon), zsig(klon), zgam(klon))
580      ALLOCATE(zthe(klon), zpic(klon), zval(klon))
581
582      ALLOCATE(rugoro(klon))
583      ALLOCATE(t_ancien(klon,klev), q_ancien(klon,klev))
584      ALLOCATE(ql_ancien(klon,klev), qs_ancien(klon,klev), qbs_ancien(klon,klev))
585      ALLOCATE(prw_ancien(klon), prlw_ancien(klon), prsw_ancien(klon), prbsw_ancien(klon))
586      ALLOCATE(u_ancien(klon,klev), v_ancien(klon,klev))
587!!! Rom P >>>
588      ALLOCATE(tr_ancien(klon,klev,nbtr))
589!!! Rom P <<<
590      ALLOCATE(clwcon(klon,klev),rnebcon(klon,klev))
591      ALLOCATE(rneb_ancien(klon,klev))
592      ALLOCATE(qtc_cv(klon,klev),sigt_cv(klon,klev),detrain_cv(klon,klev),fm_cv(klon,klev))
593      ALLOCATE(ratqs(klon,klev))
594      ALLOCATE(pbl_tke(klon,klev+1,nbsrf+1))
595!nrlmd<
596      ALLOCATE(delta_tsurf(klon,nbsrf))
597!>nrlmd
598      ALLOCATE(coefh(klon,klev+1,nbsrf+1))
599      ALLOCATE(coefm(klon,klev+1,nbsrf+1))
600      ! initialize cleanly coefh,coefm
601      ! (most of the time in the code these are assumed to be on klev levels)
602      coefh(:,:,:)=0
603      coefm(:,:,:)=0
604      ALLOCATE(zmax0(klon), f0(klon))
605      ALLOCATE(sig1(klon,klev), w01(klon,klev))
606      ALLOCATE(entr_therm(klon,klev), fm_therm(klon,klev+1))
607      ALLOCATE(detr_therm(klon,klev))
608!     pour phsystoke avec thermiques
609      ALLOCATE(clwcon0th(klon,klev),rnebcon0th(klon,klev))
610! radiation outputs
611      ALLOCATE(swdnc0(klon,klevp1), swdn0(klon,klevp1), swdn(klon,klevp1))
612      ALLOCATE(swupc0(klon,klevp1), swup0(klon,klevp1), swup(klon,klevp1))
613      ALLOCATE(lwdnc0(klon,klevp1), lwdn0(klon,klevp1), lwdn(klon,klevp1))
614      ALLOCATE(lwupc0(klon,klevp1), lwup0(klon,klevp1), lwup(klon,klevp1))
615      ALLOCATE(SWdn200clr(klon), SWdn200(klon))
616      ALLOCATE(SWup200clr(klon), SWup200(klon))
617      ALLOCATE(LWdn200clr(klon), LWdn200(klon))
618      ALLOCATE(LWup200clr(klon), LWup200(klon))
619      ALLOCATE(LWdnTOA(klon), LWdnTOAclr(klon))
620! pressure level
621      ALLOCATE(tsumSTD(klon,nlevSTD,nout))
622      ALLOCATE(usumSTD(klon,nlevSTD,nout), vsumSTD(klon,nlevSTD,nout))
623      ALLOCATE(wsumSTD(klon,nlevSTD,nout), phisumSTD(klon,nlevSTD,nout))
624      ALLOCATE(qsumSTD(klon,nlevSTD,nout), rhsumSTD(klon,nlevSTD,nout))
625      ALLOCATE(tnondef(klon,nlevSTD,nout))
626      ALLOCATE(uvsumSTD(klon,nlevSTD,nout))
627      ALLOCATE(vqsumSTD(klon,nlevSTD,nout))
628      ALLOCATE(vTsumSTD(klon,nlevSTD,nout))
629      ALLOCATE(wqsumSTD(klon,nlevSTD,nout))
630      ALLOCATE(vphisumSTD(klon,nlevSTD,nout))
631      ALLOCATE(wTsumSTD(klon,nlevSTD,nout))
632      ALLOCATE(u2sumSTD(klon,nlevSTD,nout))
633      ALLOCATE(v2sumSTD(klon,nlevSTD,nout))
634      ALLOCATE(T2sumSTD(klon,nlevSTD,nout))
635      ALLOCATE(O3sumSTD(klon,nlevSTD,nout))
636      ALLOCATE(O3daysumSTD(klon,nlevSTD,nout))
637!IM beg
638      ALLOCATE(wlevSTD(klon,nlevSTD), ulevSTD(klon,nlevSTD), vlevSTD(klon,nlevSTD))
639      ALLOCATE(tlevSTD(klon,nlevSTD), qlevSTD(klon,nlevSTD), rhlevSTD(klon,nlevSTD))
640      ALLOCATE(philevSTD(klon,nlevSTD))
641      ALLOCATE(uvSTD(klon,nlevSTD),vqSTD(klon,nlevSTD))
642      ALLOCATE(vTSTD(klon,nlevSTD),wqSTD(klon,nlevSTD))
643      ALLOCATE(vphiSTD(klon,nlevSTD),wTSTD(klon,nlevSTD))
644      ALLOCATE(u2STD(klon,nlevSTD),v2STD(klon,nlevSTD))
645      ALLOCATE(T2STD(klon,nlevSTD))
646      ALLOCATE(O3STD(klon,nlevSTD))
647      ALLOCATE(O3daySTD(klon,nlevSTD))
648!IM end
649      ALLOCATE(seed_old(klon,napisccp))
650      ALLOCATE(zuthe(klon),zvthe(klon))
651      ALLOCATE(alb_neig(klon))
652!cloud base mass flux
653      ALLOCATE(ema_cbmf(klon))
654!cloud base pressure & cloud top pressure
655      ALLOCATE(ema_pcb(klon), ema_pct(klon))
656!
657      ALLOCATE(Mipsh(klon,klev))
658      ALLOCATE(Ma(klon,klev))
659      ALLOCATE(qcondc(klon,klev))
660      ALLOCATE(wd(klon))
661      ALLOCATE(sigd(klon))
662      ALLOCATE(cin(klon), ALE(klon), ALP(klon))
663      ALLOCATE(ftd(klon,klev), fqd(klon,klev),fqcomp(klon,klev))
664      ALLOCATE(Ale_bl(klon))
665      ALLOCATE(ale_wake(klon))
666      ALLOCATE(ale_bl_stat(klon))
667      ale_bl_stat(:)=0
668      ALLOCATE(Alp_bl(klon))
669      ALLOCATE(lalim_conv(klon))
670      ALLOCATE(wght_th(klon,klev))
671      ALLOCATE(wake_deltat(klon,klev), wake_deltaq(klon,klev))
672      ALLOCATE(wake_s(klon), awake_dens(klon), wake_dens(klon))
673!!      awake_dens = 0.  ! initialized in phyetat0
674      ALLOCATE(cv_gen(klon))
675      ALLOCATE(wake_Cstar(klon))
676      ALLOCATE(wake_pe(klon), wake_fip(klon))
677!jyg<
678      ALLOCATE(wake_delta_pbl_TKE(klon,klev+1,nbsrf+1))
679!>jyg
680      ALLOCATE(pfrac_impa(klon,klev), pfrac_nucl(klon,klev))
681      ALLOCATE(pfrac_1nucl(klon,klev))
682      ALLOCATE(total_rain(klon), nday_rain(klon))
683      ALLOCATE(ndayrain_mth(klon))
684      ALLOCATE(paire_ter(klon))
685      ALLOCATE(albsol1(klon), albsol2(klon))
686!albedo SB >>>
687      ALLOCATE(albsol_dir(klon,nsw),albsol_dif(klon,nsw))
688!albedo SB <<<
689
690      if (read_climoz <= 1) then
691         ALLOCATE(wo(klon,klev, 1))
692      else
693         ! read_climoz == 2
694         ALLOCATE(wo(klon,klev, 2))
695      end if
696     
697      ALLOCATE(clwcon0(klon,klev),rnebcon0(klon,klev))
698      ALLOCATE(heat(klon,klev), heat0(klon,klev))
699      ALLOCATE(cool(klon,klev), cool0(klon,klev))
700      ALLOCATE(heat_volc(klon,klev), cool_volc(klon,klev))
701      ALLOCATE(topsw(klon), toplw(klon))
702      ALLOCATE(sollwdown(klon), sollwdownclr(klon))
703      sollwdown = 0.
704      ALLOCATE(toplwdown(klon), toplwdownclr(klon))
705      ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
706      sollw0 = 0.
707      ALLOCATE(albpla(klon))
708!IM ajout variables CFMIP2/CMIP5
709      ALLOCATE(heatp(klon,klev), coolp(klon,klev))
710      ALLOCATE(heat0p(klon,klev), cool0p(klon,klev))
711      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
712      ALLOCATE(albplap(klon))
713      ALLOCATE(solswp(klon), solswfdiffp(klon), sollwp(klon))
714      ALLOCATE(gustiness(klon))
715      ALLOCATE(sollwdownp(klon))
716      ALLOCATE(topsw0p(klon),toplw0p(klon))
717      ALLOCATE(solsw0p(klon),sollw0p(klon))
718      ALLOCATE(lwdnc0p(klon,klevp1), lwdn0p(klon,klevp1), lwdnp(klon,klevp1))
719      ALLOCATE(lwupc0p(klon,klevp1), lwup0p(klon,klevp1), lwupp(klon,klevp1))
720      ALLOCATE(swdnc0p(klon,klevp1), swdn0p(klon,klevp1), swdnp(klon,klevp1))
721      ALLOCATE(swupc0p(klon,klevp1), swup0p(klon,klevp1), swupp(klon,klevp1))
722
723!AI Ajout pour Ecrad (3Deffect)       
724      ALLOCATE(heat_s2(klon,klev), cool_s2(klon,klev))
725      ALLOCATE(heat0_s2(klon,klev), cool0_s2(klon,klev))
726      ALLOCATE(radsol_s2(klon), topsw_s2(klon), toplw_s2(klon))
727      ALLOCATE(albpla_s2(klon))
728      ALLOCATE(solsw_s2(klon), solswfdiff_s2(klon), sollw_s2(klon))
729      ALLOCATE(sollwdown_s2(klon),sollwdownclr_s2(klon))
730      ALLOCATE(topsw0_s2(klon),toplw0_s2(klon))
731      ALLOCATE(solsw0_s2(klon),sollw0_s2(klon))
732      ALLOCATE(lwdnc0_s2(klon,klevp1), lwdn0_s2(klon,klevp1), lwdn_s2(klon,klevp1))
733      ALLOCATE(lwupc0_s2(klon,klevp1), lwup0_s2(klon,klevp1), lwup_s2(klon,klevp1))
734      ALLOCATE(swdnc0_s2(klon,klevp1), swdn0_s2(klon,klevp1), swdn_s2(klon,klevp1))
735      ALLOCATE(swupc0_s2(klon,klevp1), swup0_s2(klon,klevp1), swup_s2(klon,klevp1))
736
737      ALLOCATE(cape(klon))
738      ALLOCATE(pbase(klon),bbase(klon))
739      ALLOCATE(zqasc(klon,klev))
740      ALLOCATE(ibas_con(klon), itop_con(klon))
741      ALLOCATE(rain_con(klon), snow_con(klon))
742      ALLOCATE(rlonPOS(klon))
743      ALLOCATE(newsst(klon))
744      ALLOCATE(ustar(klon,nbsrf),u10m(klon,nbsrf), v10m(klon,nbsrf),wstar(klon,nbsrf+1))
745      ALLOCATE(topswad(klon), solswad(klon))
746      ALLOCATE(topswai(klon), solswai(klon))
747      ALLOCATE(tau_aero(klon,klev,naero_grp,nbands),piz_aero(klon,klev,naero_grp,nbands),cg_aero(klon,klev,naero_grp,nbands))
748      ALLOCATE(tau_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm),piz_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
749      ALLOCATE(cg_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
750      ALLOCATE(tau_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm),piz_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
751      ALLOCATE(cg_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
752      ALLOCATE(ccm(klon,klev,nbands))
753
754#ifdef ISO
755      ALLOCATE(xtsol(niso,klon),fxtevap(ntraciso,klon,nbsrf))
756      ALLOCATE(fxtd(ntraciso,klon,klev))
757      ALLOCATE(wake_deltaxt(ntraciso,klon,klev))
758      ALLOCATE(xt_ancien(ntraciso,klon,klev))
759      ALLOCATE(xtl_ancien(ntraciso,klon,klev))
760      ALLOCATE(xts_ancien(ntraciso,klon,klev))
761      ALLOCATE(xtrain_fall(ntraciso,klon))
762      ALLOCATE(xtsnow_fall(ntraciso,klon))
763      ALLOCATE(xtrain_con(ntraciso,klon))
764      ALLOCATE(xtsnow_con(ntraciso,klon))
765#ifdef ISOTRAC
766      ALLOCATE(bassin_map(klon))
767      ALLOCATE(boite_map(klon,klev)) 
768#endif     
769#endif
770
771      ALLOCATE(ale_bl_trig(klon))
772      ALLOCATE(ratqs_inter_(klon,klev))
773      IF (ok_gwd_rando) THEN
774        ALLOCATE(du_gwd_rando(klon, klev))
775        du_gwd_rando(:,:)=0.
776      ENDIF
777      IF (.not. ok_hines .and. ok_gwd_rando) THEN
778        ALLOCATE(du_gwd_front(klon, klev))
779        du_gwd_front(:,:) = 0 !ym missing init   
780      ENDIF
781
782      if (activate_ocean_skin >= 1) then
783         ALLOCATE(delta_sal(klon), ds_ns(klon), dt_ns(klon), delta_sst(klon), &
784              dter(klon), dser(klon))
785         if (activate_ocean_skin == 2 .and. type_ocean == "couple") &
786              allocate(dt_ds(klon))
787      end if
788
789    END SUBROUTINE phys_state_var_init
790
791!======================================================================
792    SUBROUTINE phys_state_var_end
793      ! Useful only for lmdz1d.
794!USE dimphy
795USE indice_sol_mod
796use config_ocean_skin_m, only: activate_ocean_skin
797use surface_data, only: type_ocean
798IMPLICIT NONE
799include "clesphys.h"
800
801      DEALLOCATE(pctsrf, ftsol, falb1, falb2)
802      DEALLOCATE(beta_aridity)
803      DEALLOCATE(qsol,fevap,z0m,z0h,agesno)
804!FC
805      DEALLOCATE(treedrg)
806      DEALLOCATE(rain_fall, snow_fall, bs_fall,solsw, solswfdiff, sollw, radsol, swradcorr)
807      DEALLOCATE(zmea, zstd, zsig, zgam)
808      DEALLOCATE(zthe, zpic, zval)
809      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
810      DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien, rneb_ancien)
811      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
812      DEALLOCATE(qtc_cv,sigt_cv,detrain_cv,fm_cv)
813      DEALLOCATE(u_ancien, v_ancien)
814      DEALLOCATE(tr_ancien)                           !RomP
815      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
816      DEALLOCATE(zmax0, f0)
817      DEALLOCATE(sig1, w01)
818      DEALLOCATE(entr_therm, fm_therm)
819      DEALLOCATE(detr_therm)
820      DEALLOCATE(clwcon0th, rnebcon0th)
821! radiation outputs
822      DEALLOCATE(swdnc0, swdn0, swdn)
823      DEALLOCATE(swupc0, swup0, swup)
824      DEALLOCATE(lwdnc0, lwdn0, lwdn)
825      DEALLOCATE(lwupc0, lwup0, lwup)
826      DEALLOCATE(SWdn200clr, SWdn200)
827      DEALLOCATE(SWup200clr, SWup200)
828      DEALLOCATE(LWdn200clr, LWdn200)
829      DEALLOCATE(LWup200clr, LWup200)
830      DEALLOCATE(LWdnTOA, LWdnTOAclr)
831! pressure level
832      DEALLOCATE(tsumSTD)
833      DEALLOCATE(usumSTD, vsumSTD)
834      DEALLOCATE(wsumSTD, phisumSTD)
835      DEALLOCATE(tnondef)
836      DEALLOCATE(qsumSTD, rhsumSTD)
837      DEALLOCATE(uvsumSTD)
838      DEALLOCATE(vqsumSTD)
839      DEALLOCATE(vTsumSTD)
840      DEALLOCATE(wqsumSTD)
841      DEALLOCATE(vphisumSTD)
842      DEALLOCATE(wTsumSTD)
843      DEALLOCATE(u2sumSTD)
844      DEALLOCATE(v2sumSTD)
845      DEALLOCATE(T2sumSTD)
846      DEALLOCATE(O3sumSTD)
847      DEALLOCATE(O3daysumSTD)
848!IM beg
849      DEALLOCATE(wlevSTD,ulevSTD,vlevSTD,tlevSTD,qlevSTD,rhlevSTD,philevSTD)
850      DEALLOCATE(uvSTD,vqSTD,vTSTD,wqSTD,vphiSTD,wTSTD,u2STD,v2STD,T2STD,O3STD,O3daySTD)
851!IM end
852      DEALLOCATE(seed_old)
853      DEALLOCATE(zuthe, zvthe)
854      DEALLOCATE(alb_neig)
855      DEALLOCATE(ema_cbmf)
856      DEALLOCATE(ema_pcb, ema_pct)
857      DEALLOCATE(Mipsh, Ma, qcondc)
858      DEALLOCATE(wd, sigd)
859      DEALLOCATE(cin, ALE, ALP)
860      DEALLOCATE(ftd, fqd, fqcomp)
861      DEALLOCATE(Ale_bl, Alp_bl)
862      DEALLOCATE(ale_wake)
863      DEALLOCATE(ale_bl_stat)
864      DEALLOCATE(lalim_conv, wght_th)
865      DEALLOCATE(wake_deltat, wake_deltaq)
866      DEALLOCATE(wake_s, awake_dens, wake_dens)
867      DEALLOCATE(cv_gen)
868      DEALLOCATE(wake_Cstar, wake_pe, wake_fip)
869!jyg<
870      DEALLOCATE(wake_delta_pbl_TKE)
871!nrlmd<
872      DEALLOCATE(delta_tsurf)
873!>nrlmd
874!>jyg
875      DEALLOCATE(pfrac_impa, pfrac_nucl)
876      DEALLOCATE(pfrac_1nucl)
877      DEALLOCATE(total_rain, nday_rain)
878      DEALLOCATE(ndayrain_mth)
879      DEALLOCATE(paire_ter)
880      DEALLOCATE(albsol1, albsol2)
881!albedo SB >>>
882      DEALLOCATE(albsol_dir,albsol_dif,falb_dir,falb_dif,chl_con)
883!albedo SB <<<
884      DEALLOCATE(wo)
885      DEALLOCATE(clwcon0,rnebcon0)
886      DEALLOCATE(heat, heat0)
887      DEALLOCATE(cool, cool0)
888      DEALLOCATE(heat_volc, cool_volc)
889      DEALLOCATE(topsw, toplw)
890      DEALLOCATE(sollwdown, sollwdownclr)
891      DEALLOCATE(gustiness)
892      DEALLOCATE(toplwdown, toplwdownclr)
893      DEALLOCATE(topsw0,toplw0,solsw0,sollw0)
894      DEALLOCATE(albpla)
895
896!AI Ajout pour Ecrad (3Deffect)
897      DEALLOCATE(heat_s2, cool_s2)
898      DEALLOCATE(heat0_s2, cool0_s2)
899      DEALLOCATE(radsol_s2, topsw_s2, toplw_s2)
900      DEALLOCATE(albpla_s2)
901      DEALLOCATE(solsw_s2, solswfdiff_s2, sollw_s2)
902      DEALLOCATE(sollwdown_s2, sollwdownclr_s2)
903      DEALLOCATE(topsw0_s2,toplw0_s2)
904      DEALLOCATE(solsw0_s2,sollw0_s2)
905      DEALLOCATE(lwdnc0_s2, lwdn0_s2, lwdn_s2)
906      DEALLOCATE(lwupc0_s2, lwup0_s2, lwup_s2)
907      DEALLOCATE(swdnc0_s2, swdn0_s2, swdn_s2)
908      DEALLOCATE(swupc0_s2, swup0_s2, swup_s2)
909
910!IM ajout variables CFMIP2/CMIP5
911      DEALLOCATE(heatp, coolp)
912      DEALLOCATE(heat0p, cool0p)
913      DEALLOCATE(radsolp, topswp, toplwp)
914      DEALLOCATE(albplap)
915      DEALLOCATE(solswp, solswfdiffp, sollwp)
916      DEALLOCATE(sollwdownp)
917      DEALLOCATE(topsw0p,toplw0p)
918      DEALLOCATE(solsw0p,sollw0p)
919      DEALLOCATE(lwdnc0p, lwdn0p, lwdnp)
920      DEALLOCATE(lwupc0p, lwup0p, lwupp)
921      DEALLOCATE(swdnc0p, swdn0p, swdnp)
922      DEALLOCATE(swupc0p, swup0p, swupp)
923      DEALLOCATE(cape)
924      DEALLOCATE(pbase,bbase)
925      DEALLOCATE(zqasc)
926      DEALLOCATE(ibas_con, itop_con)
927      DEALLOCATE(rain_con, snow_con)
928      DEALLOCATE(rlonPOS)
929      DEALLOCATE(newsst)
930      DEALLOCATE(ustar,u10m, v10m,wstar)
931      DEALLOCATE(topswad, solswad)
932      DEALLOCATE(topswai, solswai)
933      DEALLOCATE(tau_aero,piz_aero,cg_aero)
934      DEALLOCATE(tau_aero_sw_rrtm,piz_aero_sw_rrtm,cg_aero_sw_rrtm)
935      DEALLOCATE(tau_aero_lw_rrtm,piz_aero_lw_rrtm,cg_aero_lw_rrtm)
936      DEALLOCATE(ccm)
937      if (ok_gwd_rando) DEALLOCATE(du_gwd_rando)
938      if (.not. ok_hines .and. ok_gwd_rando) DEALLOCATE(du_gwd_front)
939      DEALLOCATE(ale_bl_trig)
940      DEALLOCATE(ratqs_inter_)
941
942      if (activate_ocean_skin >= 1) then
943         deALLOCATE(delta_sal, ds_ns, dt_ns, delta_sst, dter, dser)
944         if (activate_ocean_skin == 2 .and. type_ocean == "couple") &
945              deALLOCATE(dt_ds)
946      end if
947
948#ifdef ISO   
949      DEALLOCATE(xtsol,fxtevap) 
950      DEALLOCATE(xt_ancien,xtl_ancien,xts_ancien, fxtd, wake_deltaxt)
951      DEALLOCATE(xtrain_fall, xtsnow_fall, xtrain_con, xtsnow_con)
952#ifdef ISOTRAC
953      DEALLOCATE(bassin_map,boite_map)
954#endif       
955#endif
956      is_initialized=.FALSE.
957     
958END SUBROUTINE phys_state_var_end
959
960      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.