source: LMDZ6/branches/Amaury_dev/libf/phylmd/phys_state_var_mod.F90

Last change on this file was 5226, checked in by abarral, 7 weeks ago

Merge r5208 r5209

  • 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.3 KB
Line 
1MODULE phys_state_var_mod
2! Variables sauvegardees pour le startphy.nc
3!======================================================================
4
5
6!======================================================================
7! Declaration des variables
8      USE dimphy
9      USE netcdf, ONLY: nf90_fill_real
10      INTEGER, PARAMETER :: nlevSTD=17
11      INTEGER, PARAMETER :: nlevSTD8=8
12      INTEGER, PARAMETER :: nlevSTD3=3
13      INTEGER, PARAMETER :: nout=3
14      INTEGER, PARAMETER :: napisccp=1
15      INTEGER, SAVE :: radpas  ! radiation is called every "radpas" step
16      INTEGER, SAVE :: cvpas   ! convection is called every "cvpas" step
17      INTEGER, SAVE :: cvpas_0 = 1 ! reference value for cvpas
18      INTEGER, SAVE :: wkpas   ! wake scheme is called every "wkpas" step
19      REAL, PARAMETER :: missing_val_nf90=nf90_fill_real
20!$OMP THREADPRIVATE(radpas)
21!$OMP THREADPRIVATE(cvpas)
22!$OMP THREADPRIVATE(cvpas_0)
23!$OMP THREADPRIVATE(wkpas)
24      REAL, SAVE :: phys_tstep=0, solaire_etat0
25!$OMP THREADPRIVATE(phys_tstep, solaire_etat0)
26
27      REAL, ALLOCATABLE, SAVE :: pctsrf(:,:)
28!$OMP THREADPRIVATE(pctsrf)
29      REAL, ALLOCATABLE, SAVE :: ftsol(:,:)
30!$OMP THREADPRIVATE(ftsol)
31      REAL, ALLOCATABLE, SAVE :: beta_aridity(:,:)
32!$OMP THREADPRIVATE(beta_aridity)
33      REAL,ALLOCATABLE,SAVE :: qsol(:),fevap(:,:),z0m(:,:),z0h(:,:),agesno(:,:)
34!$OMP THREADPRIVATE(qsol,fevap,z0m,z0h,agesno)
35!FC drag des arbres
36      REAL, ALLOCATABLE, SAVE :: treedrg(:,:,:)
37!$OMP THREADPRIVATE(treedrg)
38
39!      CHARACTER(LEN=6), SAVE :: ocean
40!!!!!!$OMP THREADPRIVATE(ocean)
41!      logical, SAVE :: ok_veget
42!!!!!!$OMP THREADPRIVATE(ok_veget)
43      REAL, ALLOCATABLE, SAVE :: falb1(:,:), falb2(:,:)
44!$OMP THREADPRIVATE(falb1, falb2)
45
46!albedo SB >>>
47      REAL, ALLOCATABLE, SAVE :: falb_dif(:,:,:), falb_dir(:,:,:)
48      REAL, ALLOCATABLE, SAVE :: chl_con(:)
49!$OMP THREADPRIVATE(falb_dir,falb_dif,chl_con)
50!albedo SB <<<
51
52
53      REAL, ALLOCATABLE, SAVE :: rain_fall(:), snow_fall(:), bs_fall(:)
54!$OMP THREADPRIVATE( rain_fall, snow_fall, bs_fall)
55      REAL, ALLOCATABLE, SAVE :: solsw(:), solswfdiff(:), sollw(:)
56!$OMP THREADPRIVATE(solsw, solswfdiff, sollw)
57      REAL, ALLOCATABLE, SAVE :: radsol(:)
58!$OMP THREADPRIVATE(radsol)
59      REAL, ALLOCATABLE, SAVE :: swradcorr(:)
60!$OMP THREADPRIVATE(swradcorr)
61#ifdef ISO
62      REAL,ALLOCATABLE,SAVE :: xtsol(:,:),fxtevap(:,:,:)
63!$OMP THREADPRIVATE(xtsol,fxtevap)
64      REAL, ALLOCATABLE, SAVE :: xtrain_fall(:,:), xtsnow_fall(:,:)
65!$OMP THREADPRIVATE(xtrain_fall,xtsnow_fall)
66#endif
67
68!clesphy0 param physiq
69
70! Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
71
72      REAL, ALLOCATABLE, SAVE :: zmea(:), zstd(:), zsig(:), zgam(:)
73!$OMP THREADPRIVATE(zmea, zstd, zsig, zgam)
74      REAL, ALLOCATABLE, SAVE :: zthe(:), zpic(:), zval(:)
75!$OMP THREADPRIVATE(zthe, zpic, zval)
76!     REAL tabcntr0(100)
77      REAL, ALLOCATABLE, SAVE :: rugoro(:)
78!$OMP THREADPRIVATE(rugoro)
79      REAL, ALLOCATABLE, SAVE :: t_ancien(:,:), q_ancien(:,:)
80!$OMP THREADPRIVATE(t_ancien, q_ancien)
81      REAL, ALLOCATABLE, SAVE :: ql_ancien(:,:), qs_ancien(:,:), qbs_ancien(:,:)
82!$OMP THREADPRIVATE(ql_ancien, qs_ancien, qbs_ancien)
83      REAL, ALLOCATABLE, SAVE :: prw_ancien(:), prlw_ancien(:), prsw_ancien(:), prbsw_ancien(:)
84!$OMP THREADPRIVATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
85#ifdef ISO
86      REAL, ALLOCATABLE, SAVE :: xt_ancien(:,:,:),xtl_ancien(:,:,:),xts_ancien(:,:,:), &
87              xtbs_ancien(:,:,:)
88!$OMP THREADPRIVATE(xt_ancien,xtl_ancien,xts_ancien,xtbs_ancien)
89#endif
90      REAL, ALLOCATABLE, SAVE :: u_ancien(:,:), v_ancien(:,:)
91!$OMP THREADPRIVATE(u_ancien, v_ancien)
92      REAL, ALLOCATABLE, SAVE :: cf_ancien(:,:), rvc_ancien(:,:)
93!$OMP THREADPRIVATE(cf_ancien, rvc_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(:,:),detrain_cv(:,:),fm_cv(:,:)
103!$OMP THREADPRIVATE(qtc_cv,sigt_cv,detrain_cv,fm_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(:,:),fqcomp(:,:)     
230!$OMP THREADPRIVATE(fqd,fqcomp)
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_s     : surface fraction covered by active wakes
264! wake_dens   : number of wakes per unit area
265! awake_dens  : number of active wakes per unit area
266! cv_gen      : birth rate of cumulonimbus per unit area.
267! wake_occ    : occurence of wakes (= 1 if wakes occur, =0 otherwise)
268! wake_Cstar  : vitesse d'etalement de la poche
269! wake_pe     : wake potential energy - WAPE
270! wake_fip    : Gust Front Impinging power - ALP
271      REAL,ALLOCATABLE,SAVE :: wake_deltat(:,:)
272!$OMP THREADPRIVATE(wake_deltat)
273      REAL,ALLOCATABLE,SAVE :: wake_deltaq(:,:)
274!$OMP THREADPRIVATE(wake_deltaq)
275#ifdef ISO
276      REAL, ALLOCATABLE, SAVE :: wake_deltaxt(:,:,:)
277!$OMP THREADPRIVATE(wake_deltaxt)
278#endif
279      REAL,ALLOCATABLE,SAVE :: wake_s(:), awake_s(:)
280!$OMP THREADPRIVATE(wake_s, awake_s)
281      REAL,ALLOCATABLE,SAVE :: wake_dens(:), awake_dens(:)
282!$OMP THREADPRIVATE(wake_dens, awake_dens)
283      REAL,ALLOCATABLE,SAVE :: cv_gen(:)
284!$OMP THREADPRIVATE(cv_gen)
285      REAL,ALLOCATABLE,SAVE :: wake_Cstar(:)
286!$OMP THREADPRIVATE(wake_Cstar)
287      REAL,ALLOCATABLE,SAVE :: wake_pe(:)
288!$OMP THREADPRIVATE(wake_pe)
289      REAL,ALLOCATABLE,SAVE :: wake_fip(:)
290!$OMP THREADPRIVATE(wake_fip)
291
292!jyg<
293! variables related to the spitting of the PBL between wake and
294! off-wake regions.
295! wake_delta_pbl_TKE : difference TKE_w - TKE_x
296      REAL,ALLOCATABLE,SAVE :: wake_delta_pbl_TKE(:,:,:)
297!$OMP THREADPRIVATE(wake_delta_pbl_TKE)
298!nrlmd<
299      REAL, ALLOCATABLE, SAVE :: delta_tsurf(:,:) ! Surface temperature difference inside-outside cold pool
300!$OMP THREADPRIVATE(delta_tsurf)
301!>nrlmd
302!>jyg
303
304! pfrac_impa : Produits des coefs lessivage impaction
305! pfrac_nucl : Produits des coefs lessivage nucleation
306! pfrac_1nucl: Produits des coefs lessi nucl (alpha = 1)
307      REAL,ALLOCATABLE,SAVE :: pfrac_impa(:,:), pfrac_nucl(:,:)
308!$OMP THREADPRIVATE(pfrac_impa,pfrac_nucl)
309      REAL,ALLOCATABLE,SAVE :: pfrac_1nucl(:,:)
310!$OMP THREADPRIVATE(pfrac_1nucl)
311
312      REAL,ALLOCATABLE,SAVE :: total_rain(:), nday_rain(:) 
313!$OMP THREADPRIVATE(total_rain,nday_rain)
314      REAL,ALLOCATABLE,SAVE :: ndayrain_mth(:)
315!$OMP THREADPRIVATE(ndayrain_mth)
316      REAL,ALLOCATABLE,SAVE :: paire_ter(:)
317!$OMP THREADPRIVATE(paire_ter)
318! albsol1: albedo du sol total pour SW visible
319! albsol2: albedo du sol total pour SW proche IR
320      REAL,ALLOCATABLE,SAVE :: albsol1(:), albsol2(:)
321!$OMP THREADPRIVATE(albsol1,albsol2)
322
323!albedo SB >>>
324      REAL,ALLOCATABLE,SAVE :: albsol_dif(:,:),albsol_dir(:,:)
325!$OMP THREADPRIVATE(albsol_dif,albsol_dir)
326!albedo SB <<<
327
328
329      REAL, ALLOCATABLE, SAVE:: wo(:, :, :)
330      ! column-density of ozone in a layer, in kilo-Dobsons
331      ! Third dimension has size 1 or 2.
332      ! "wo(:, :, 1)" is for the average day-night field,
333      ! "wo(:, :, 2)" is for daylight time.
334      !$OMP THREADPRIVATE(wo)
335
336! heat : chauffage solaire
337! heat0: chauffage solaire ciel clair
338! cool : refroidissement infrarouge
339! cool0 : refroidissement infrarouge ciel clair
340! sollwdown : downward LW flux at surface
341! sollwdownclr : downward CS LW flux at surface
342! toplwdown : downward CS LW flux at TOA
343! toplwdownclr : downward CS LW flux at TOA
344! heat_volc : chauffage solaire du au volcanisme
345! cool_volc : refroidissement infrarouge du au volcanisme
346      REAL,ALLOCATABLE,SAVE :: clwcon0(:,:),rnebcon0(:,:)
347!$OMP THREADPRIVATE(clwcon0,rnebcon0)
348      REAL,ALLOCATABLE,SAVE :: heat(:,:)   
349!$OMP THREADPRIVATE(heat)
350      REAL,ALLOCATABLE,SAVE :: heat0(:,:)
351!$OMP THREADPRIVATE(heat0)
352      REAL,ALLOCATABLE,SAVE :: cool(:,:)
353!$OMP THREADPRIVATE(cool)
354      REAL,ALLOCATABLE,SAVE :: cool0(:,:)
355!$OMP THREADPRIVATE(cool0)
356      REAL,ALLOCATABLE,SAVE :: heat_volc(:,:)   
357!$OMP THREADPRIVATE(heat_volc)
358      REAL,ALLOCATABLE,SAVE :: cool_volc(:,:)
359!$OMP THREADPRIVATE(cool_volc)
360      REAL,ALLOCATABLE,SAVE :: topsw(:), toplw(:)
361!$OMP THREADPRIVATE(topsw,toplw)
362      REAL,ALLOCATABLE,SAVE :: sollwdown(:)
363!$OMP THREADPRIVATE(sollwdown)
364      REAL,ALLOCATABLE,SAVE :: gustiness(:)
365!$OMP THREADPRIVATE(gustiness)
366      REAL,ALLOCATABLE,SAVE :: sollwdownclr(:)
367!$OMP THREADPRIVATE(sollwdownclr)
368      REAL,ALLOCATABLE,SAVE :: toplwdown(:)
369!$OMP THREADPRIVATE(toplwdown)
370      REAL,ALLOCATABLE,SAVE :: toplwdownclr(:)
371!$OMP THREADPRIVATE(toplwdownclr)
372      REAL,ALLOCATABLE,SAVE :: topsw0(:),toplw0(:),solsw0(:),sollw0(:)
373!$OMP THREADPRIVATE(topsw0,toplw0,solsw0,sollw0)
374      REAL,ALLOCATABLE,SAVE :: albpla(:)
375!$OMP THREADPRIVATE(albpla)
376
377!IM ajout variables CFMIP2/CMIP5
378      REAL,ALLOCATABLE,SAVE :: heatp(:,:), coolp(:,:)
379!$OMP THREADPRIVATE(heatp, coolp)
380      REAL,ALLOCATABLE,SAVE :: heat0p(:,:), cool0p(:,:)
381!$OMP THREADPRIVATE(heat0p, cool0p)
382      REAL,ALLOCATABLE,SAVE :: radsolp(:), topswp(:), toplwp(:)
383!$OMP THREADPRIVATE(radsolp, topswp, toplwp)
384      REAL,ALLOCATABLE,SAVE :: albplap(:)
385!$OMP THREADPRIVATE(albplap)
386      REAL,ALLOCATABLE,SAVE :: solswp(:), solswfdiffp(:), sollwp(:)
387!$OMP THREADPRIVATE(solswp, solswfdiffp, sollwp)
388      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
389!$OMP THREADPRIVATE(sollwdownp)
390      REAL,ALLOCATABLE,SAVE :: topsw0p(:),toplw0p(:)
391      REAL,ALLOCATABLE,SAVE :: solsw0p(:),sollw0p(:)
392!$OMP THREADPRIVATE(topsw0p,toplw0p,solsw0p,sollw0p)
393      REAL,ALLOCATABLE,SAVE :: lwdnc0p(:,:), lwdn0p(:,:), lwdnp(:,:)
394      REAL,ALLOCATABLE,SAVE :: lwupc0p(:,:), lwup0p(:,:), lwupp(:,:)
395!$OMP THREADPRIVATE(lwdnc0p, lwdn0p, lwdnp, lwupc0p, lwup0p, lwupp)
396      REAL,ALLOCATABLE,SAVE :: swdnc0p(:,:), swdn0p(:,:), swdnp(:,:)
397      REAL,ALLOCATABLE,SAVE :: swupc0p(:,:), swup0p(:,:), swupp(:,:)
398!$OMP THREADPRIVATE(swdnc0p, swdn0p, swdnp, swupc0p, swup0p, swupp)
399
400!AI ajout variables double appel Ecrad (3Deffect)
401      REAL,ALLOCATABLE,SAVE :: heat_s2(:,:), cool_s2(:,:)
402!$OMP THREADPRIVATE(heat_s2, cool_s2)
403      REAL,ALLOCATABLE,SAVE :: heat0_s2(:,:), cool0_s2(:,:)
404!$OMP THREADPRIVATE(heat0_s2, cool0_s2)
405      REAL,ALLOCATABLE,SAVE :: radsol_s2(:), topsw_s2(:), toplw_s2(:)
406!$OMP THREADPRIVATE(radsol_s2, topsw_s2, toplw_s2)
407      REAL,ALLOCATABLE,SAVE :: albpla_s2(:)
408!$OMP THREADPRIVATE(albpla_s2)
409      REAL,ALLOCATABLE,SAVE :: solsw_s2(:), solswfdiff_s2(:), sollw_s2(:)
410!$OMP THREADPRIVATE(solsw_s2, solswfdiff_s2, sollw_s2)
411      REAL,ALLOCATABLE,SAVE :: sollwdown_s2(:), sollwdownclr_s2(:)
412!$OMP THREADPRIVATE(sollwdown_s2, sollwdownclr_s2)
413      REAL,ALLOCATABLE,SAVE :: topsw0_s2(:),toplw0_s2(:)
414      REAL,ALLOCATABLE,SAVE :: solsw0_s2(:),sollw0_s2(:)
415!$OMP THREADPRIVATE(topsw0_s2,toplw0_s2,solsw0_s2,sollw0_s2)
416      REAL,ALLOCATABLE,SAVE :: lwdnc0_s2(:,:), lwdn0_s2(:,:), lwdn_s2(:,:)
417      REAL,ALLOCATABLE,SAVE :: lwupc0_s2(:,:), lwup0_s2(:,:), lwup_s2(:,:)
418!$OMP THREADPRIVATE(lwdnc0_s2,lwdn0_s2,lwdn_s2,lwupc0_s2,lwup0_s2,lwup_s2)       
419      REAL,ALLOCATABLE,SAVE :: swdnc0_s2(:,:), swdn0_s2(:,:), swdn_s2(:,:)
420      REAL,ALLOCATABLE,SAVE :: swupc0_s2(:,:), swup0_s2(:,:), swup_s2(:,:)
421!$OMP THREADPRIVATE(swdnc0_s2, swdn0_s2, swdn_s2, swupc0_s2, swup0_s2, swup_s2)
422
423! pbase : cloud base pressure
424! bbase : cloud base buoyancy
425      REAL,ALLOCATABLE,SAVE :: cape(:)
426!$OMP THREADPRIVATE(cape)
427      REAL,ALLOCATABLE,SAVE :: pbase(:)
428!$OMP THREADPRIVATE(pbase)
429      REAL,ALLOCATABLE,SAVE :: bbase(:)
430!$OMP THREADPRIVATE(bbase)
431
432      REAL,SAVE,ALLOCATABLE :: zqasc(:,:)
433!$OMP THREADPRIVATE( zqasc)
434      INTEGER,ALLOCATABLE,SAVE :: ibas_con(:), itop_con(:)
435!$OMP THREADPRIVATE(ibas_con,itop_con)
436      REAL,SAVE,ALLOCATABLE :: rain_con(:)
437!$OMP THREADPRIVATE(rain_con)
438      REAL,SAVE,ALLOCATABLE :: snow_con(:)
439!$OMP THREADPRIVATE(snow_con)
440
441#ifdef ISO
442      REAL,SAVE,ALLOCATABLE :: xtrain_con(:,:)
443!$OMP THREADPRIVATE(xtrain_con)
444      REAL,SAVE,ALLOCATABLE :: xtsnow_con(:,:)
445!$OMP THREADPRIVATE(xtsnow_con)
446#endif
447      REAL,SAVE,ALLOCATABLE :: rlonPOS(:)
448!$OMP THREADPRIVATE(rlonPOS)
449      REAL,SAVE,ALLOCATABLE :: newsst(:)
450!$OMP THREADPRIVATE(newsst)
451      REAL,SAVE,ALLOCATABLE :: ustar(:,:),u10m(:,:), v10m(:,:),wstar(:,:)
452!$OMP THREADPRIVATE(ustar,u10m,v10m,wstar)
453
454! ok_ade=T -ADE=topswad-topsw
455! ok_aie=T ->
456!       ok_ade=T -AIE=topswai-topswad
457!       ok_ade=F -AIE=topswai-topsw
458
459!topswad, solswad : Aerosol direct effect
460      REAL,SAVE,ALLOCATABLE :: topswad(:), solswad(:)
461!$OMP THREADPRIVATE(topswad,solswad)
462!topswai, solswai : Aerosol indirect effect
463      REAL,SAVE,ALLOCATABLE :: topswai(:), solswai(:)
464!$OMP THREADPRIVATE(topswai,solswai)
465
466      REAL,SAVE,ALLOCATABLE :: tau_aero(:,:,:,:), piz_aero(:,:,:,:), cg_aero(:,:,:,:)
467!$OMP THREADPRIVATE(tau_aero, piz_aero, cg_aero)
468      REAL,SAVE,ALLOCATABLE :: tau_aero_sw_rrtm(:,:,:,:), piz_aero_sw_rrtm(:,:,:,:), cg_aero_sw_rrtm(:,:,:,:)
469!$OMP THREADPRIVATE(tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm)
470      REAL,SAVE,ALLOCATABLE :: tau_aero_lw_rrtm(:,:,:,:), piz_aero_lw_rrtm(:,:,:,:), cg_aero_lw_rrtm(:,:,:,:)
471!$OMP THREADPRIVATE(tau_aero_lw_rrtm, piz_aero_lw_rrtm, cg_aero_lw_rrtm)
472      REAL,SAVE,ALLOCATABLE :: ccm(:,:,:)
473!$OMP THREADPRIVATE(ccm)
474
475      REAL,SAVE,ALLOCATABLE :: ale_bl_trig(:)
476!$OMP THREADPRIVATE(ale_bl_trig)
477
478      REAL,SAVE,ALLOCATABLE :: ratqs_inter_(:,:),sigma_qtherm(:,:)
479!$OMP THREADPRIVATE(ratqs_inter_,sigma_qtherm)
480
481#ifdef ISO
482#ifdef ISOTRAC
483      INTEGER,SAVE,ALLOCATABLE :: bassin_map(:)
484!$OMP THREADPRIVATE(bassin_map)
485      INTEGER,SAVE,ALLOCATABLE :: boite_map(:,:)
486!$OMP THREADPRIVATE(boite_map)
487#endif   
488#endif
489      REAL, ALLOCATABLE, SAVE:: du_gwd_rando(:, :), du_gwd_front(:, :)
490      !$OMP THREADPRIVATE(du_gwd_rando, du_gwd_front)
491      ! tendencies on wind due to gravity waves
492
493      LOGICAL,SAVE :: is_initialized=.FALSE.
494!$OMP THREADPRIVATE(is_initialized)   
495
496      ! Ocean-atmosphere interface:
497
498      REAL, ALLOCATABLE, SAVE:: ds_ns(:) ! (klon)
499      ! "delta salinity near surface". Salinity variation in the
500      ! near-surface turbulent layer. That is subskin salinity minus
501      ! foundation salinity. In ppt.
502
503      REAL, ALLOCATABLE, SAVE:: dt_ns(:) ! (klon)
504      ! "delta temperature near surface". Temperature variation in the
505      ! near-surface turbulent layer. That is subskin temperature
506      ! minus foundation temperature. (Can be negative.) In K.
507     
508      REAL, ALLOCATABLE, SAVE:: delta_sst(:) ! (klon)
509      ! Ocean-air interface temperature minus bulk SST, in
510      ! K. Allocated and defined only if activate_ocean_skin >= 1.
511
512      REAL, ALLOCATABLE, SAVE:: delta_sal(:) ! (klon)
513      ! Ocean-air interface salinity minus bulk salinity, in ppt
514     
515      REAL, ALLOCATABLE, SAVE:: dter(:) ! (klon)
516      ! Temperature variation in the diffusive microlayer, that is
517      ! ocean-air interface temperature minus subskin temperature. In K.
518
519      REAL, SAVE, ALLOCATABLE:: dser(:) ! (klon)
520      ! Salinity variation in the diffusive microlayer, that is
521      ! ocean-air interface salinity minus subskin salinity. In ppt.
522
523      REAL, SAVE, ALLOCATABLE:: dt_ds(:) ! (klon)
524      ! (tks / tkt) * dTer, in K
525
526      !$OMP THREADPRIVATE(delta_sal, ds_ns, dt_ns, delta_sst, dter, dser, dt_ds)
527
528    CONTAINS
529
530!======================================================================
531SUBROUTINE phys_state_var_init(read_climoz)
532USE dimphy
533USE aero_mod
534USE infotrac_phy, ONLY: nbtr
535#ifdef ISO
536USE infotrac_phy, ONLY: ntraciso=>ntiso,niso
537#endif
538USE indice_sol_mod
539USE config_ocean_skin_m, ONLY: activate_ocean_skin
540USE surface_data, ONLY: type_ocean
541      USE lmdz_clesphys
542
543IMPLICIT NONE
544
545INTEGER, INTENT(IN)::  read_climoz
546! read ozone climatology
547! Allowed values are 0, 1 and 2
548! 0: do not read an ozone climatology
549! 1: read a single ozone climatology that will be used day and night
550! 2: read two ozone climatologies, the average day and night
551! climatology and the daylight climatology
552
553      PRINT*, 'is_initialized', is_initialized
554      IF (is_initialized) RETURN
555      is_initialized=.TRUE.
556      ALLOCATE(pctsrf(klon,nbsrf))
557      ALLOCATE(ftsol(klon,nbsrf))
558      ALLOCATE(beta_aridity(klon,nbsrf))
559      ALLOCATE(qsol(klon),fevap(klon,nbsrf))
560      ALLOCATE(z0m(klon,nbsrf+1),z0h(klon,nbsrf+1),agesno(klon,nbsrf))
561!FC
562      ALLOCATE(treedrg(klon,klev,nbsrf))
563      ALLOCATE(falb1(klon,nbsrf))
564      ALLOCATE(falb2(klon,nbsrf))
565!albedo SB >>>
566      PRINT*, 'allocate falb'
567      ALLOCATE(falb_dir(klon,nsw,nbsrf),falb_dif(klon,nsw,nbsrf))
568!!      PRINT*, 'allocate falb good', falb_dir(1,1,1)
569      ALLOCATE(chl_con(klon))
570!albedo SB <<<
571      ALLOCATE(rain_fall(klon))
572      ALLOCATE(snow_fall(klon))
573      ALLOCATE(bs_fall(klon))
574      ALLOCATE(solsw(klon), solswfdiff(klon), sollw(klon))
575      sollw=0.0
576      ALLOCATE(radsol(klon))
577      ALLOCATE(swradcorr(klon))
578      ALLOCATE(zmea(klon), zstd(klon), zsig(klon), zgam(klon))
579      ALLOCATE(zthe(klon), zpic(klon), zval(klon))
580
581      ALLOCATE(rugoro(klon))
582      ALLOCATE(t_ancien(klon,klev), q_ancien(klon,klev))
583      ALLOCATE(ql_ancien(klon,klev), qs_ancien(klon,klev), qbs_ancien(klon,klev))
584      ALLOCATE(prw_ancien(klon), prlw_ancien(klon), prsw_ancien(klon), prbsw_ancien(klon))
585      ALLOCATE(u_ancien(klon,klev), v_ancien(klon,klev))
586      ALLOCATE(cf_ancien(klon,klev), rvc_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(qtc_cv(klon,klev),sigt_cv(klon,klev),detrain_cv(klon,klev),fm_cv(klon,klev))
592      ALLOCATE(ratqs(klon,klev))
593      ALLOCATE(pbl_tke(klon,klev+1,nbsrf+1))
594!nrlmd<
595      ALLOCATE(delta_tsurf(klon,nbsrf))
596!>nrlmd
597      ALLOCATE(coefh(klon,klev+1,nbsrf+1))
598      ALLOCATE(coefm(klon,klev+1,nbsrf+1))
599      ! initialize cleanly coefh,coefm
600      ! (most of the time in the code these are assumed to be on klev levels)
601      coefh(:,:,:)=0
602      coefm(:,:,:)=0
603      ALLOCATE(zmax0(klon), f0(klon))
604      ALLOCATE(sig1(klon,klev), w01(klon,klev))
605      ALLOCATE(entr_therm(klon,klev), fm_therm(klon,klev+1))
606      ALLOCATE(detr_therm(klon,klev))
607!     pour phsystoke avec thermiques
608      ALLOCATE(clwcon0th(klon,klev),rnebcon0th(klon,klev))
609! radiation outputs
610      ALLOCATE(swdnc0(klon,klevp1), swdn0(klon,klevp1), swdn(klon,klevp1))
611      ALLOCATE(swupc0(klon,klevp1), swup0(klon,klevp1), swup(klon,klevp1))
612      ALLOCATE(lwdnc0(klon,klevp1), lwdn0(klon,klevp1), lwdn(klon,klevp1))
613      ALLOCATE(lwupc0(klon,klevp1), lwup0(klon,klevp1), lwup(klon,klevp1))
614      ALLOCATE(SWdn200clr(klon), SWdn200(klon))
615      ALLOCATE(SWup200clr(klon), SWup200(klon))
616      ALLOCATE(LWdn200clr(klon), LWdn200(klon))
617      ALLOCATE(LWup200clr(klon), LWup200(klon))
618      ALLOCATE(LWdnTOA(klon), LWdnTOAclr(klon))
619! pressure level
620      ALLOCATE(tsumSTD(klon,nlevSTD,nout))
621      ALLOCATE(usumSTD(klon,nlevSTD,nout), vsumSTD(klon,nlevSTD,nout))
622      ALLOCATE(wsumSTD(klon,nlevSTD,nout), phisumSTD(klon,nlevSTD,nout))
623      ALLOCATE(qsumSTD(klon,nlevSTD,nout), rhsumSTD(klon,nlevSTD,nout))
624      ALLOCATE(tnondef(klon,nlevSTD,nout))
625      ALLOCATE(uvsumSTD(klon,nlevSTD,nout))
626      ALLOCATE(vqsumSTD(klon,nlevSTD,nout))
627      ALLOCATE(vTsumSTD(klon,nlevSTD,nout))
628      ALLOCATE(wqsumSTD(klon,nlevSTD,nout))
629      ALLOCATE(vphisumSTD(klon,nlevSTD,nout))
630      ALLOCATE(wTsumSTD(klon,nlevSTD,nout))
631      ALLOCATE(u2sumSTD(klon,nlevSTD,nout))
632      ALLOCATE(v2sumSTD(klon,nlevSTD,nout))
633      ALLOCATE(T2sumSTD(klon,nlevSTD,nout))
634      ALLOCATE(O3sumSTD(klon,nlevSTD,nout))
635      ALLOCATE(O3daysumSTD(klon,nlevSTD,nout))
636!IM beg
637      ALLOCATE(wlevSTD(klon,nlevSTD), ulevSTD(klon,nlevSTD), vlevSTD(klon,nlevSTD))
638      ALLOCATE(tlevSTD(klon,nlevSTD), qlevSTD(klon,nlevSTD), rhlevSTD(klon,nlevSTD))
639      ALLOCATE(philevSTD(klon,nlevSTD))
640      ALLOCATE(uvSTD(klon,nlevSTD),vqSTD(klon,nlevSTD))
641      ALLOCATE(vTSTD(klon,nlevSTD),wqSTD(klon,nlevSTD))
642      ALLOCATE(vphiSTD(klon,nlevSTD),wTSTD(klon,nlevSTD))
643      ALLOCATE(u2STD(klon,nlevSTD),v2STD(klon,nlevSTD))
644      ALLOCATE(T2STD(klon,nlevSTD))
645      ALLOCATE(O3STD(klon,nlevSTD))
646      ALLOCATE(O3daySTD(klon,nlevSTD))
647!IM end
648      ALLOCATE(seed_old(klon,napisccp))
649      ALLOCATE(zuthe(klon),zvthe(klon))
650      ALLOCATE(alb_neig(klon))
651!cloud base mass flux
652      ALLOCATE(ema_cbmf(klon))
653!cloud base pressure & cloud top pressure
654      ALLOCATE(ema_pcb(klon), ema_pct(klon))
655
656      ALLOCATE(Mipsh(klon,klev))
657      ALLOCATE(Ma(klon,klev))
658      ALLOCATE(qcondc(klon,klev))
659      ALLOCATE(wd(klon))
660      ALLOCATE(sigd(klon))
661      ALLOCATE(cin(klon), ALE(klon), ALP(klon))
662      ALLOCATE(ftd(klon,klev), fqd(klon,klev),fqcomp(klon,klev))
663      ALLOCATE(Ale_bl(klon))
664      ALLOCATE(ale_wake(klon))
665      ALLOCATE(ale_bl_stat(klon))
666      ale_bl_stat(:)=0
667      ALLOCATE(Alp_bl(klon))
668      ALLOCATE(lalim_conv(klon))
669      ALLOCATE(wght_th(klon,klev))
670      ALLOCATE(wake_deltat(klon,klev), wake_deltaq(klon,klev))
671      ALLOCATE(wake_s(klon), awake_s(klon), wake_dens(klon), awake_dens(klon))
672!!      awake_dens = 0.  ! initialized in phyetat0
673      ALLOCATE(cv_gen(klon))
674      ALLOCATE(wake_Cstar(klon))
675      ALLOCATE(wake_pe(klon), wake_fip(klon))
676!jyg<
677      ALLOCATE(wake_delta_pbl_TKE(klon,klev+1,nbsrf+1))
678!>jyg
679      ALLOCATE(pfrac_impa(klon,klev), pfrac_nucl(klon,klev))
680      ALLOCATE(pfrac_1nucl(klon,klev))
681      ALLOCATE(total_rain(klon), nday_rain(klon))
682      ALLOCATE(ndayrain_mth(klon))
683      ALLOCATE(paire_ter(klon))
684      ALLOCATE(albsol1(klon), albsol2(klon))
685!albedo SB >>>
686      ALLOCATE(albsol_dir(klon,nsw),albsol_dif(klon,nsw))
687!albedo SB <<<
688
689      IF (read_climoz <= 1) THEN
690         ALLOCATE(wo(klon,klev, 1))
691      else
692         ! read_climoz == 2
693         ALLOCATE(wo(klon,klev, 2))
694      end if
695     
696      ALLOCATE(clwcon0(klon,klev),rnebcon0(klon,klev))
697      ALLOCATE(heat(klon,klev), heat0(klon,klev))
698      ALLOCATE(cool(klon,klev), cool0(klon,klev))
699      ALLOCATE(heat_volc(klon,klev), cool_volc(klon,klev))
700      ALLOCATE(topsw(klon), toplw(klon))
701      ALLOCATE(sollwdown(klon), sollwdownclr(klon))
702      sollwdown = 0.
703      ALLOCATE(toplwdown(klon), toplwdownclr(klon))
704      ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
705      sollw0 = 0.
706      ALLOCATE(albpla(klon))
707!IM ajout variables CFMIP2/CMIP5
708      ALLOCATE(heatp(klon,klev), coolp(klon,klev))
709      ALLOCATE(heat0p(klon,klev), cool0p(klon,klev))
710      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
711      ALLOCATE(albplap(klon))
712      ALLOCATE(solswp(klon), solswfdiffp(klon), sollwp(klon))
713      ALLOCATE(gustiness(klon))
714      ALLOCATE(sollwdownp(klon))
715      ALLOCATE(topsw0p(klon),toplw0p(klon))
716      ALLOCATE(solsw0p(klon),sollw0p(klon))
717      ALLOCATE(lwdnc0p(klon,klevp1), lwdn0p(klon,klevp1), lwdnp(klon,klevp1))
718      ALLOCATE(lwupc0p(klon,klevp1), lwup0p(klon,klevp1), lwupp(klon,klevp1))
719      ALLOCATE(swdnc0p(klon,klevp1), swdn0p(klon,klevp1), swdnp(klon,klevp1))
720      ALLOCATE(swupc0p(klon,klevp1), swup0p(klon,klevp1), swupp(klon,klevp1))
721
722!AI Ajout pour Ecrad (3Deffect)       
723      ALLOCATE(heat_s2(klon,klev), cool_s2(klon,klev))
724      ALLOCATE(heat0_s2(klon,klev), cool0_s2(klon,klev))
725      ALLOCATE(radsol_s2(klon), topsw_s2(klon), toplw_s2(klon))
726      ALLOCATE(albpla_s2(klon))
727      ALLOCATE(solsw_s2(klon), solswfdiff_s2(klon), sollw_s2(klon))
728      ALLOCATE(sollwdown_s2(klon),sollwdownclr_s2(klon))
729      ALLOCATE(topsw0_s2(klon),toplw0_s2(klon))
730      ALLOCATE(solsw0_s2(klon),sollw0_s2(klon))
731      ALLOCATE(lwdnc0_s2(klon,klevp1), lwdn0_s2(klon,klevp1), lwdn_s2(klon,klevp1))
732      ALLOCATE(lwupc0_s2(klon,klevp1), lwup0_s2(klon,klevp1), lwup_s2(klon,klevp1))
733      ALLOCATE(swdnc0_s2(klon,klevp1), swdn0_s2(klon,klevp1), swdn_s2(klon,klevp1))
734      ALLOCATE(swupc0_s2(klon,klevp1), swup0_s2(klon,klevp1), swup_s2(klon,klevp1))
735
736      ALLOCATE(cape(klon))
737      ALLOCATE(pbase(klon),bbase(klon))
738      ALLOCATE(zqasc(klon,klev))
739      ALLOCATE(ibas_con(klon), itop_con(klon))
740      ALLOCATE(rain_con(klon), snow_con(klon))
741      ALLOCATE(rlonPOS(klon))
742      ALLOCATE(newsst(klon))
743      ALLOCATE(ustar(klon,nbsrf),u10m(klon,nbsrf), v10m(klon,nbsrf),wstar(klon,nbsrf+1))
744      ALLOCATE(topswad(klon), solswad(klon))
745      ALLOCATE(topswai(klon), solswai(klon))
746      ALLOCATE(tau_aero(klon,klev,naero_grp,nbands),piz_aero(klon,klev,naero_grp,nbands),cg_aero(klon,klev,naero_grp,nbands))
747      ALLOCATE(tau_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm),piz_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
748      ALLOCATE(cg_aero_sw_rrtm(klon,klev,2,nbands_sw_rrtm))
749      ALLOCATE(tau_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm),piz_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
750      ALLOCATE(cg_aero_lw_rrtm(klon,klev,2,nbands_lw_rrtm))
751      ALLOCATE(ccm(klon,klev,nbands))
752
753#ifdef ISO
754      ALLOCATE(xtsol(niso,klon),fxtevap(ntraciso,klon,nbsrf))
755      ALLOCATE(fxtd(ntraciso,klon,klev))
756      ALLOCATE(wake_deltaxt(ntraciso,klon,klev))
757      ALLOCATE(xt_ancien(ntraciso,klon,klev))
758      ALLOCATE(xtl_ancien(ntraciso,klon,klev))
759      ALLOCATE(xts_ancien(ntraciso,klon,klev))
760      ALLOCATE(xtbs_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),sigma_qtherm(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
798USE lmdz_clesphys
799
800IMPLICIT NONE
801
802      DEALLOCATE(pctsrf, ftsol, falb1, falb2)
803      DEALLOCATE(beta_aridity)
804      DEALLOCATE(qsol,fevap,z0m,z0h,agesno)
805!FC
806      DEALLOCATE(treedrg)
807      DEALLOCATE(rain_fall, snow_fall, bs_fall,solsw, solswfdiff, sollw, radsol, swradcorr)
808      DEALLOCATE(zmea, zstd, zsig, zgam)
809      DEALLOCATE(zthe, zpic, zval)
810      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
811      DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien)
812      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
813      DEALLOCATE(qtc_cv,sigt_cv,detrain_cv,fm_cv)
814      DEALLOCATE(u_ancien, v_ancien)
815      DEALLOCATE(cf_ancien, rvc_ancien)
816      DEALLOCATE(tr_ancien)                           !RomP
817      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
818      DEALLOCATE(zmax0, f0)
819      DEALLOCATE(sig1, w01)
820      DEALLOCATE(entr_therm, fm_therm)
821      DEALLOCATE(detr_therm)
822      DEALLOCATE(clwcon0th, rnebcon0th)
823! radiation outputs
824      DEALLOCATE(swdnc0, swdn0, swdn)
825      DEALLOCATE(swupc0, swup0, swup)
826      DEALLOCATE(lwdnc0, lwdn0, lwdn)
827      DEALLOCATE(lwupc0, lwup0, lwup)
828      DEALLOCATE(SWdn200clr, SWdn200)
829      DEALLOCATE(SWup200clr, SWup200)
830      DEALLOCATE(LWdn200clr, LWdn200)
831      DEALLOCATE(LWup200clr, LWup200)
832      DEALLOCATE(LWdnTOA, LWdnTOAclr)
833! pressure level
834      DEALLOCATE(tsumSTD)
835      DEALLOCATE(usumSTD, vsumSTD)
836      DEALLOCATE(wsumSTD, phisumSTD)
837      DEALLOCATE(tnondef)
838      DEALLOCATE(qsumSTD, rhsumSTD)
839      DEALLOCATE(uvsumSTD)
840      DEALLOCATE(vqsumSTD)
841      DEALLOCATE(vTsumSTD)
842      DEALLOCATE(wqsumSTD)
843      DEALLOCATE(vphisumSTD)
844      DEALLOCATE(wTsumSTD)
845      DEALLOCATE(u2sumSTD)
846      DEALLOCATE(v2sumSTD)
847      DEALLOCATE(T2sumSTD)
848      DEALLOCATE(O3sumSTD)
849      DEALLOCATE(O3daysumSTD)
850!IM beg
851      DEALLOCATE(wlevSTD,ulevSTD,vlevSTD,tlevSTD,qlevSTD,rhlevSTD,philevSTD)
852      DEALLOCATE(uvSTD,vqSTD,vTSTD,wqSTD,vphiSTD,wTSTD,u2STD,v2STD,T2STD,O3STD,O3daySTD)
853!IM end
854      DEALLOCATE(seed_old)
855      DEALLOCATE(zuthe, zvthe)
856      DEALLOCATE(alb_neig)
857      DEALLOCATE(ema_cbmf)
858      DEALLOCATE(ema_pcb, ema_pct)
859      DEALLOCATE(Mipsh, Ma, qcondc)
860      DEALLOCATE(wd, sigd)
861      DEALLOCATE(cin, ALE, ALP)
862      DEALLOCATE(ftd, fqd, fqcomp)
863      DEALLOCATE(Ale_bl, Alp_bl)
864      DEALLOCATE(ale_wake)
865      DEALLOCATE(ale_bl_stat)
866      DEALLOCATE(lalim_conv, wght_th)
867      DEALLOCATE(wake_deltat, wake_deltaq)
868      DEALLOCATE(wake_s, awake_s, wake_dens, awake_dens)
869      DEALLOCATE(cv_gen)
870      DEALLOCATE(wake_Cstar, wake_pe, wake_fip)
871!jyg<
872      DEALLOCATE(wake_delta_pbl_TKE)
873!nrlmd<
874      DEALLOCATE(delta_tsurf)
875!>nrlmd
876!>jyg
877      DEALLOCATE(pfrac_impa, pfrac_nucl)
878      DEALLOCATE(pfrac_1nucl)
879      DEALLOCATE(total_rain, nday_rain)
880      DEALLOCATE(ndayrain_mth)
881      DEALLOCATE(paire_ter)
882      DEALLOCATE(albsol1, albsol2)
883!albedo SB >>>
884      DEALLOCATE(albsol_dir,albsol_dif,falb_dir,falb_dif,chl_con)
885!albedo SB <<<
886      DEALLOCATE(wo)
887      DEALLOCATE(clwcon0,rnebcon0)
888      DEALLOCATE(heat, heat0)
889      DEALLOCATE(cool, cool0)
890      DEALLOCATE(heat_volc, cool_volc)
891      DEALLOCATE(topsw, toplw)
892      DEALLOCATE(sollwdown, sollwdownclr)
893      DEALLOCATE(gustiness)
894      DEALLOCATE(toplwdown, toplwdownclr)
895      DEALLOCATE(topsw0,toplw0,solsw0,sollw0)
896      DEALLOCATE(albpla)
897
898!AI Ajout pour Ecrad (3Deffect)
899      DEALLOCATE(heat_s2, cool_s2)
900      DEALLOCATE(heat0_s2, cool0_s2)
901      DEALLOCATE(radsol_s2, topsw_s2, toplw_s2)
902      DEALLOCATE(albpla_s2)
903      DEALLOCATE(solsw_s2, solswfdiff_s2, sollw_s2)
904      DEALLOCATE(sollwdown_s2, sollwdownclr_s2)
905      DEALLOCATE(topsw0_s2,toplw0_s2)
906      DEALLOCATE(solsw0_s2,sollw0_s2)
907      DEALLOCATE(lwdnc0_s2, lwdn0_s2, lwdn_s2)
908      DEALLOCATE(lwupc0_s2, lwup0_s2, lwup_s2)
909      DEALLOCATE(swdnc0_s2, swdn0_s2, swdn_s2)
910      DEALLOCATE(swupc0_s2, swup0_s2, swup_s2)
911
912!IM ajout variables CFMIP2/CMIP5
913      DEALLOCATE(heatp, coolp)
914      DEALLOCATE(heat0p, cool0p)
915      DEALLOCATE(radsolp, topswp, toplwp)
916      DEALLOCATE(albplap)
917      DEALLOCATE(solswp, solswfdiffp, sollwp)
918      DEALLOCATE(sollwdownp)
919      DEALLOCATE(topsw0p,toplw0p)
920      DEALLOCATE(solsw0p,sollw0p)
921      DEALLOCATE(lwdnc0p, lwdn0p, lwdnp)
922      DEALLOCATE(lwupc0p, lwup0p, lwupp)
923      DEALLOCATE(swdnc0p, swdn0p, swdnp)
924      DEALLOCATE(swupc0p, swup0p, swupp)
925      DEALLOCATE(cape)
926      DEALLOCATE(pbase,bbase)
927      DEALLOCATE(zqasc)
928      DEALLOCATE(ibas_con, itop_con)
929      DEALLOCATE(rain_con, snow_con)
930      DEALLOCATE(rlonPOS)
931      DEALLOCATE(newsst)
932      DEALLOCATE(ustar,u10m, v10m,wstar)
933      DEALLOCATE(topswad, solswad)
934      DEALLOCATE(topswai, solswai)
935      DEALLOCATE(tau_aero,piz_aero,cg_aero)
936      DEALLOCATE(tau_aero_sw_rrtm,piz_aero_sw_rrtm,cg_aero_sw_rrtm)
937      DEALLOCATE(tau_aero_lw_rrtm,piz_aero_lw_rrtm,cg_aero_lw_rrtm)
938      DEALLOCATE(ccm)
939      IF (ok_gwd_rando) DEALLOCATE(du_gwd_rando)
940      IF (.NOT. ok_hines .AND. ok_gwd_rando) DEALLOCATE(du_gwd_front)
941      DEALLOCATE(ale_bl_trig)
942      DEALLOCATE(ratqs_inter_,sigma_qtherm)
943
944      IF (activate_ocean_skin >= 1) THEN
945         deALLOCATE(delta_sal, ds_ns, dt_ns, delta_sst, dter, dser)
946         IF (activate_ocean_skin == 2 .AND. type_ocean == "couple") &
947              deALLOCATE(dt_ds)
948      end if
949
950#ifdef ISO   
951      DEALLOCATE(xtsol,fxtevap) 
952      DEALLOCATE(xt_ancien,xtl_ancien,xts_ancien,xtbs_ancien, fxtd, wake_deltaxt)
953      DEALLOCATE(xtrain_fall, xtsnow_fall, xtrain_con, xtsnow_con)
954#ifdef ISOTRAC
955      DEALLOCATE(bassin_map,boite_map)
956#endif       
957#endif
958      is_initialized=.FALSE.
959     
960END SUBROUTINE phys_state_var_end
961
962      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.