source: LMDZ6/branches/DYNAMICO-conv/libf/phylmd/phys_state_var_mod.F90 @ 4356

Last change on this file since 4356 was 3413, checked in by Laurent Fairhead, 6 years ago

Inclusion of Yann's latest (summer/fall 2018) modifications for
convergence of DYNAMICO/LMDZ physics
YM/LF

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