Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90	(revision 3458)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90	(revision 3605)
@@ -18,5 +18,5 @@
       INTEGER, SAVE :: radpas  ! radiation is called every "radpas" step
       INTEGER, SAVE :: cvpas   ! convection is called every "cvpas" step
-      INTEGER, SAVE :: cvpas_0 ! reference value for cvpas
+      INTEGER, SAVE :: cvpas_0 = 1 ! reference value for cvpas
       INTEGER, SAVE :: wkpas   ! wake scheme is called every "wkpas" step
       REAL, PARAMETER :: missing_val_nf90=nf90_fill_real
@@ -25,6 +25,6 @@
 !$OMP THREADPRIVATE(cvpas_0)
 !$OMP THREADPRIVATE(wkpas)
-      REAL, SAVE :: dtime, solaire_etat0
-!$OMP THREADPRIVATE(dtime, solaire_etat0)
+      REAL, SAVE :: phys_tstep=0, solaire_etat0
+!$OMP THREADPRIVATE(phys_tstep, solaire_etat0)
 
       REAL, ALLOCATABLE, SAVE :: pctsrf(:,:)
@@ -202,5 +202,7 @@
       REAL,ALLOCATABLE,SAVE :: ema_pcb(:), ema_pct(:)
 !$OMP THREADPRIVATE(ema_pcb,ema_pct)
-      REAL,ALLOCATABLE,SAVE :: Ma(:,:)        ! undilute upward mass flux
+      REAL,ALLOCATABLE,SAVE :: Mipsh(:,:)     ! mass flux shed from  adiab. ascents
+!$OMP THREADPRIVATE(Mipsh)
+      REAL,ALLOCATABLE,SAVE :: Ma(:,:)       ! undilute upward mass flux
 !$OMP THREADPRIVATE(Ma)
       REAL,ALLOCATABLE,SAVE :: qcondc(:,:)    ! in-cld water content from convect
@@ -286,4 +288,6 @@
       REAL,ALLOCATABLE,SAVE :: total_rain(:), nday_rain(:)  
 !$OMP THREADPRIVATE(total_rain,nday_rain)
+      REAL,ALLOCATABLE,SAVE :: paire_ter(:)
+!$OMP THREADPRIVATE(paire_ter)
 ! albsol1: albedo du sol total pour SW visible
 ! albsol2: albedo du sol total pour SW proche IR
@@ -312,4 +316,6 @@
 ! toplwdown : downward CS LW flux at TOA
 ! toplwdownclr : downward CS LW flux at TOA
+! heat_volc : chauffage solaire du au volcanisme
+! cool_volc : refroidissement infrarouge du au volcanisme
       REAL,ALLOCATABLE,SAVE :: clwcon0(:,:),rnebcon0(:,:)
 !$OMP THREADPRIVATE(clwcon0,rnebcon0)
@@ -322,4 +328,8 @@
       REAL,ALLOCATABLE,SAVE :: cool0(:,:)
 !$OMP THREADPRIVATE(cool0)
+      REAL,ALLOCATABLE,SAVE :: heat_volc(:,:)   
+!$OMP THREADPRIVATE(heat_volc)
+      REAL,ALLOCATABLE,SAVE :: cool_volc(:,:)
+!$OMP THREADPRIVATE(cool_volc)
       REAL,ALLOCATABLE,SAVE :: topsw(:), toplw(:)
 !$OMP THREADPRIVATE(topsw,toplw)
@@ -417,4 +427,7 @@
       ! tendencies on wind due to gravity waves
 
+      LOGICAL,SAVE :: is_initialized=.FALSE.
+!$OMP THREADPRIVATE(is_initialized)    
+
       ! Ocean-atmosphere interface, subskin ocean and near-surface ocean:
       
@@ -452,4 +465,6 @@
 include "clesphys.h"
 
+      IF (is_initialized) RETURN
+      is_initialized=.TRUE.
       ALLOCATE(pctsrf(klon,nbsrf))
       ALLOCATE(ftsol(klon,nbsrf))
@@ -467,4 +482,5 @@
       ALLOCATE(snow_fall(klon))
       ALLOCATE(solsw(klon), sollw(klon))
+      sollw=0.0
       ALLOCATE(radsol(klon))
       ALLOCATE(swradcorr(klon))
@@ -542,4 +558,5 @@
       ALLOCATE(ema_pcb(klon), ema_pct(klon))
 !
+      ALLOCATE(Mipsh(klon,klev))
       ALLOCATE(Ma(klon,klev))
       ALLOCATE(qcondc(klon,klev))
@@ -551,4 +568,5 @@
       ALLOCATE(ale_wake(klon))
       ALLOCATE(ale_bl_stat(klon))
+      ale_bl_stat(:)=0
       ALLOCATE(Alp_bl(klon))
       ALLOCATE(lalim_conv(klon))
@@ -556,4 +574,5 @@
       ALLOCATE(wake_deltat(klon,klev), wake_deltaq(klon,klev))
       ALLOCATE(wake_s(klon), awake_dens(klon), wake_dens(klon))
+      awake_dens = 0.
       ALLOCATE(wake_Cstar(klon))
       ALLOCATE(wake_pe(klon), wake_fip(klon))
@@ -564,4 +583,5 @@
       ALLOCATE(pfrac_1nucl(klon,klev))
       ALLOCATE(total_rain(klon), nday_rain(klon))
+      ALLOCATE(paire_ter(klon))
       ALLOCATE(albsol1(klon), albsol2(klon))
 !albedo SB >>>
@@ -579,8 +599,11 @@
       ALLOCATE(heat(klon,klev), heat0(klon,klev)) 
       ALLOCATE(cool(klon,klev), cool0(klon,klev))
+      ALLOCATE(heat_volc(klon,klev), cool_volc(klon,klev)) 
       ALLOCATE(topsw(klon), toplw(klon))
       ALLOCATE(sollwdown(klon), sollwdownclr(klon))
+      sollwdown = 0.
       ALLOCATE(toplwdown(klon), toplwdownclr(klon))
       ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
+      sollw0 = 0.
       ALLOCATE(albpla(klon))
 !IM ajout variables CFMIP2/CMIP5
@@ -619,7 +642,12 @@
       ALLOCATE(ale_bl_trig(klon))
 !!! fin nrlmd le 10/04/2012
-      if (ok_gwd_rando) allocate(du_gwd_rando(klon, klev))
-      if (.not. ok_hines .and. ok_gwd_rando) allocate(du_gwd_front(klon, klev))
-
+      IF (ok_gwd_rando) THEN
+        allocate(du_gwd_rando(klon, klev))
+        du_gwd_rando(:,:)=0.
+      ENDIF
+      IF (.not. ok_hines .and. ok_gwd_rando) THEN
+        ALLOCATE(du_gwd_front(klon, klev))
+        du_gwd_front(:,:) = 0 !ym missing init   
+      ENDIF
       if (activate_ocean_skin >= 1) ALLOCATE(ds_ns(klon), dt_ns(klon))
 
@@ -693,5 +721,5 @@
       deallocate(ema_cbmf)
       deallocate(ema_pcb, ema_pct)
-      deallocate(Ma, qcondc)
+      deallocate(Mipsh, Ma, qcondc)
       deallocate(wd, sigd)
       deallocate(cin, ALE, ALP)
@@ -710,4 +738,5 @@
       deallocate(pfrac_1nucl)
       deallocate(total_rain, nday_rain)
+      deallocate(paire_ter)
       deallocate(albsol1, albsol2)
 !albedo SB >>>
@@ -718,4 +747,5 @@
       deallocate(heat, heat0) 
       deallocate(cool, cool0)
+      deallocate(heat_volc, cool_volc) 
       deallocate(topsw, toplw)
       deallocate(sollwdown, sollwdownclr)
@@ -757,6 +787,9 @@
       deallocate(ale_bl_trig)
 !!! fin nrlmd le 10/04/2012
+
       if (activate_ocean_skin >= 1) deALLOCATE(ds_ns, dt_ns)
 
+      is_initialized=.FALSE.
+      
 END SUBROUTINE phys_state_var_end
 
