Index: trunk/LMDZ.COMMON/libf/dyn3d/calfis.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/calfis.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/calfis.F	(revision 841)
@@ -184,4 +184,6 @@
 !      REAL rdayvrai
       REAL, intent(in):: jD_cur, jH_cur
+
+      LOGICAL tracerdyn ! for generic/mars physics call ; possibly to get rid of
 c
 c-----------------------------------------------------------------------
@@ -460,5 +462,5 @@
 c
       if (planet_type=="earth") then
-#ifdef CPP_EARTH
+#ifdef CPP_PHYS
 ! PVtheta calls tetalevel, which is in the (Earth) physics
 cIM calcul PV a teta=350, 380, 405K
@@ -525,4 +527,30 @@
      .             PVteta)
 
+      else if ( planet_type=="generic" ) then
+
+         CALL physiq (ngridmx,     !! ngrid
+     .             llm,            !! nlayer
+     .             nqtot,          !! nq
+     .             tname,          !! tracer names from dynamical core (given in infotrac)
+     .             debut_split,    !! firstcall 
+     .             lafin_split,    !! lastcall
+     .             jD_cur,         !! pday. see leapfrog
+     .             jH_cur_split,   !! ptime "fraction of day"
+     .             zdt_split,      !! ptimestep
+     .             zplev,          !! pplev
+     .             zplay,          !! pplay
+     .             zphi,           !! pphi
+     .             zufi,           !! pu
+     .             zvfi,           !! pv
+     .             ztfi,           !! pt
+     .             zqfi,           !! pq
+     .             flxwfi,         !! pw !! or 0. anyway this is for diagnostic. not used in physiq.
+     .             zdufi,          !! pdu
+     .             zdvfi,          !! pdv
+     .             zdtfi,          !! pdt
+     .             zdqfi,          !! pdq
+     .             zdpsrf,         !! pdpsrf
+     .             tracerdyn)      !! tracerdyn <-- utilite ???
+
       else  ! a moduler pour Mars !!
 
Index: trunk/LMDZ.COMMON/libf/dyn3d/comconst.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/comconst.h	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/comconst.h	(revision 841)
@@ -21,5 +21,6 @@
       REAL dtdiss ! (s) time step for the dissipation
       REAL rad ! (m) radius of the planet
-      REAL r ! Gas constant R=8.31 J.K-1.mol-1
+      REAL r ! Reduced Gas constant r=R/mu
+             ! with R=8.31.. J.K-1.mol-1, mu: mol mass of atmosphere (kg/mol)
       REAL cpp   ! Cp
       REAL kappa ! kappa=R/Cp 
Index: trunk/LMDZ.COMMON/libf/dyn3d/comvert.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/comvert.h	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/comvert.h	(revision 841)
@@ -1,4 +1,4 @@
 !
-! $Id: comvert.h 1625 2012-05-09 13:14:48Z lguez $
+! $Id: comvert.h 1654 2012-09-24 15:07:18Z aslmd $
 !
 !-----------------------------------------------------------------------
@@ -7,5 +7,5 @@
       COMMON/comvertr/ap(llm+1),bp(llm+1),presnivs(llm),dpres(llm),     &
      &               pa,preff,nivsigs(llm),nivsig(llm+1),               &
-     &               aps(llm),bps(llm),scaleheight
+     &               aps(llm),bps(llm),scaleheight,pseudoalt(llm)
 
       common/comverti/disvert_type, pressure_exner
@@ -23,4 +23,5 @@
       real bps    ! hybrid sigma contribution at mid-layers
       real scaleheight ! atmospheric (reference) scale height (km)
+      real pseudoalt ! for planets
 
       integer disvert_type ! type of vertical discretization:
Index: trunk/LMDZ.COMMON/libf/dyn3d/disvert_noterre.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/disvert_noterre.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/disvert_noterre.F	(revision 841)
@@ -46,5 +46,4 @@
       real tt,rr,gg, prevz
       real s(llm),dsig(llm) 
-      real pseudoalt(llm)
 
       integer iz 
Index: trunk/LMDZ.COMMON/libf/dyn3d/dynetat0.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/dynetat0.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/dynetat0.F	(revision 841)
@@ -7,4 +7,7 @@
       USE infotrac
       use netcdf, only: nf90_get_var
+
+      use control_mod, only : planet_type
+
       IMPLICIT NONE
 
@@ -54,4 +57,6 @@
       INTEGER ierr, nid, nvarid
 
+      INTEGER idecal
+
 c-----------------------------------------------------------------------
 
@@ -77,30 +82,42 @@
       ENDIF
 
+      !!! AS: idecal is a hack to be able to read planeto starts...
+      !!!     .... while keeping everything OK for LMDZ EARTH
+      if ((planet_type.eq."generic").or.(planet_type.eq."mars")) then
+          write(lunout,*)'dynetat0 : Planeto-like start file'
+          idecal = 4
+          annee_ref  = 2000
+      else
+          write(lunout,*)'dynetat0 : Earth-like start file'
+          idecal = 5
+          annee_ref  = tab_cntrl(5)
+      endif
+
+
       im         = tab_cntrl(1)
       jm         = tab_cntrl(2)
       lllm       = tab_cntrl(3)
       day_ref    = tab_cntrl(4)
-      annee_ref  = tab_cntrl(5)
-      rad        = tab_cntrl(6)
-      omeg       = tab_cntrl(7)
-      g          = tab_cntrl(8)
-      cpp        = tab_cntrl(9)
-      kappa      = tab_cntrl(10)
-      daysec     = tab_cntrl(11)
-      dtvr       = tab_cntrl(12)
-      etot0      = tab_cntrl(13)
-      ptot0      = tab_cntrl(14)
-      ztot0      = tab_cntrl(15)
-      stot0      = tab_cntrl(16)
-      ang0       = tab_cntrl(17)
-      pa         = tab_cntrl(18)
-      preff      = tab_cntrl(19)
-c
-      clon       = tab_cntrl(20)
-      clat       = tab_cntrl(21)
-      grossismx  = tab_cntrl(22)
-      grossismy  = tab_cntrl(23)
-c
-      IF ( tab_cntrl(24).EQ.1. )  THEN
+      rad        = tab_cntrl(idecal+1)
+      omeg       = tab_cntrl(idecal+2)
+      g          = tab_cntrl(idecal+3)
+      cpp        = tab_cntrl(idecal+4)
+      kappa      = tab_cntrl(idecal+5)
+      daysec     = tab_cntrl(idecal+6)
+      dtvr       = tab_cntrl(idecal+7)
+      etot0      = tab_cntrl(idecal+8)
+      ptot0      = tab_cntrl(idecal+9)
+      ztot0      = tab_cntrl(idecal+10)
+      stot0      = tab_cntrl(idecal+11)
+      ang0       = tab_cntrl(idecal+12)
+      pa         = tab_cntrl(idecal+13)
+      preff      = tab_cntrl(idecal+14)
+c
+      clon       = tab_cntrl(idecal+15)
+      clat       = tab_cntrl(idecal+16)
+      grossismx  = tab_cntrl(idecal+17)
+      grossismy  = tab_cntrl(idecal+18)
+c
+      IF ( tab_cntrl(idecal+19).EQ.1. )  THEN
         fxyhypb  = . TRUE .
 c        dzoomx   = tab_cntrl(25)
@@ -111,5 +128,5 @@
         fxyhypb = . FALSE .
         ysinus  = . FALSE .
-        IF( tab_cntrl(27).EQ.1. ) ysinus = . TRUE. 
+        IF( tab_cntrl(idecal+22).EQ.1. ) ysinus = . TRUE. 
       ENDIF
 
@@ -225,5 +242,10 @@
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Le champ <temps> est absent"
-         CALL abort
+         write(lunout,*)"dynetat0: J essaie <Time>"
+         ierr = NF_INQ_VARID (nid, "Time", nvarid)
+         IF (ierr .NE. NF_NOERR) THEN
+            write(lunout,*)"dynetat0: Le champ <Time> est absent"
+            CALL abort
+         ENDIF
       ENDIF
       ierr = nf90_get_var(nid, nvarid, time)
Index: trunk/LMDZ.COMMON/libf/dyn3d/fxhyp.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/fxhyp.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/fxhyp.F	(revision 841)
@@ -1,4 +1,4 @@
 !
-! $Id: fxhyp.F 1403 2010-07-01 09:02:53Z fairhead $
+! $Id: fxhyp.F 1674 2012-10-29 16:27:03Z emillour $
 !
 c
@@ -68,4 +68,25 @@
        xzoom    = xzoomdeg * pi/180. 
 c
+       if (iim==1) then
+
+          rlonm025(1)=-pi/2.
+          rlonv(1)=0.
+          rlonu(1)=pi
+          rlonp025(1)=pi/2.
+          rlonm025(2)=rlonm025(1)+depi
+          rlonv(2)=rlonv(1)+depi
+          rlonu(2)=rlonu(1)+depi
+          rlonp025(2)=rlonp025(1)+depi
+
+          xprimm025(:)=1.
+          xprimv(:)=1.
+          xprimu(:)=1.
+          xprimp025(:)=1.
+          champmin=depi
+          champmax=depi
+          return
+
+       endif
+
            decalx   = .75
        IF( grossism.EQ.1..AND.scal180 )  THEN
@@ -286,8 +307,10 @@
 
 
+
        IF(ik.EQ.1.and.grossism.EQ.1.)  THEN
          xvrai(1)    = xvrai(iip1)-depi
          xxprim(1)   = xxprim(iip1)
        ENDIF
+
        DO i = 1 , iim
         xlon(i)     = xvrai(i)
Index: trunk/LMDZ.COMMON/libf/dyn3d/gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/gcm.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/gcm.F	(revision 841)
@@ -457,6 +457,7 @@
 ! Il faut une cle CPP_PHYS
 #ifdef CPP_PHYS
-         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys ,
-     ,                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp     )
+         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys,
+     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp,
+     &                iflag_phys)
 #endif
          call_iniphys=.false.
@@ -490,12 +491,4 @@
 #endif
 
-#ifdef CPP_EARTH
-! Create start file (startphy.nc) and boundary conditions (limit.nc) 
-! for the Earth verstion
-       if (iflag_phys>=100) then
-          call iniaqua(ngridmx,latfi,lonfi,iflag_phys)
-       endif
-#endif
-
       if (planet_type.eq."mars") then
 ! POUR MARS, METTRE UNE FONCTION A PART, genre dynredem0_mars
Index: trunk/LMDZ.COMMON/libf/dyn3d/groupe.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/groupe.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/groupe.F	(revision 841)
@@ -38,13 +38,21 @@
       integer i,j,l
 
-      logical firstcall
-      save firstcall
+      logical firstcall,groupe_ok
+      save firstcall,groupe_ok
 
       data firstcall/.true./
+      data groupe_ok/.true./
+
+      if (iim==1) then
+         groupe_ok=.false.
+      endif
 
       if (firstcall) then
-         if(mod(iim,2**ngroup).ne.0) stop'probleme du nombre ede point'
+         if (groupe_ok) then
+           if(mod(iim,2**ngroup).ne.0) stop'probleme du nombre de point'
+         endif
          firstcall=.false.
       endif
+
 
 c   Champs 1D
@@ -52,14 +60,12 @@
       call convflu(pbaru,pbarv,llm,zconvm)
 
-c
       call scopy(ijp1llm,zconvm,1,zconvmm,1)
       call scopy(ijmllm,pbarv,1,pbarvm,1)
 
-c
+      if (groupe_ok) then
       call groupeun(jjp1,llm,zconvmm)
       call groupeun(jjm,llm,pbarvm)
 
 c   Champs 3D
-
       do l=1,llm
          do j=2,jjm
@@ -74,4 +80,9 @@
          enddo
       enddo
+
+      else
+         pbarum(:,:,:)=pbaru(:,:,:)
+         pbarvm(:,:,:)=pbarv(:,:,:)
+      endif
 
 c    integration de la convergence de masse de haut  en bas ......
Index: trunk/LMDZ.COMMON/libf/dyn3d/leapfrog.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/leapfrog.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/leapfrog.F	(revision 841)
@@ -443,4 +443,10 @@
            jD_cur = jD_ref + day_ini - day_ref +                        &
      &          itau/day_step 
+
+           IF (planet_type .eq."generic") THEN
+              ! AS: we make jD_cur to be pday
+              jD_cur = int(day_ini + itau/day_step)
+           ENDIF
+
            jH_cur = jH_ref + start_time +                               &
      &          mod(itau,day_step)/float(day_step) 
@@ -471,11 +477,12 @@
 c-jld
 #ifdef CPP_IOIPSL
-cIM : pour sortir les param. du modele dans un fis. netcdf 110106
-         IF (first) THEN
-#include "ini_paramLMDZ_dyn.h"
-          first=.false.
-         ENDIF
-c
-#include "write_paramLMDZ_dyn.h"
+cIM decommenter les 6 lignes suivantes pour sortir quelques parametres dynamiques de LMDZ 
+cIM uncomment next 6 lines to get some parameters for LMDZ dynamics
+c        IF (first) THEN
+c         first=.false.
+c#include "ini_paramLMDZ_dyn.h"
+c        ENDIF
+c
+c#include "write_paramLMDZ_dyn.h"
 c
 #endif
Index: trunk/LMDZ.COMMON/libf/dyn3d/paramet.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/paramet.h	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3d/paramet.h	(revision 841)
@@ -17,5 +17,5 @@
       INTEGER jcfil,jcfllm
 
-      PARAMETER( iip1= iim+1-1/iim,iip2=iim+2,iip3=iim+3                &
+      PARAMETER( iip1= iim+1,iip2=iim+2,iip3=iim+3                       &
      &    ,jjp1=jjm+1-1/jjm)
       PARAMETER( llmp1 = llm+1,  llmp2 = llm+2, llmm1 = llm-1 )
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F	(revision 841)
@@ -244,4 +244,6 @@
       integer :: k,kstart,kend
       INTEGER :: offset  
+
+      LOGICAL tracerdyn ! for generic/mars physics call ; possibly to get rid of
 c
 c-----------------------------------------------------------------------
@@ -701,4 +703,31 @@
      .             pducov,
      .             PVteta)
+
+      else if ( planet_type=="generic" ) then
+
+      CALL physiq (klon,     !! ngrid
+     .             llm,            !! nlayer
+     .             nqtot,          !! nq
+     .             tname,          !! tracer names from dynamical core (given in infotrac)
+     .             debut_split,    !! firstcall 
+     .             lafin_split,    !! lastcall
+     .             jD_cur,         !! pday. see leapfrog_p 
+     .             jH_cur_split,   !! ptime "fraction of day"
+     .             zdt_split,      !! ptimestep
+     .             zplev_omp,  !! pplev
+     .             zplay_omp,  !! pplay
+     .             zphi_omp,   !! pphi
+     .             zufi_omp,   !! pu
+     .             zvfi_omp,   !! pv
+     .             ztfi_omp,   !! pt
+     .             zqfi_omp,   !! pq
+     .             flxwfi_omp, !! pw !! or 0. anyway this is for diagnostic. not used in physiq.
+     .             zdufi_omp,  !! pdu
+     .             zdvfi_omp,  !! pdv
+     .             zdtfi_omp,  !! pdt
+     .             zdqfi_omp,  !! pdq
+     .             zdpsrf_omp, !! pdpsrf
+     .             tracerdyn)      !! tracerdyn <-- utilite ???
+
       else ! a moduler pour Mars
         CALL physiq (klon,
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/comconst.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/comconst.h	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/comconst.h	(revision 841)
@@ -21,5 +21,6 @@
       REAL dtdiss ! (s) time step for the dissipation
       REAL rad ! (m) radius of the planet
-      REAL r ! Gas constant R=8.31 J.K-1.mol-1
+      REAL r ! Reduced Gas constant r=R/mu
+             ! with R=8.31.. J.K-1.mol-1, mu: mol mass of atmosphere (kg/mol)
       REAL cpp   ! Cp
       REAL kappa ! kappa=R/Cp 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/comvert.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/comvert.h	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/comvert.h	(revision 841)
@@ -1,4 +1,4 @@
 !
-! $Id: comvert.h 1625 2012-05-09 13:14:48Z lguez $
+! $Id: comvert.h 1654 2012-09-24 15:07:18Z aslmd $
 !
 !-----------------------------------------------------------------------
@@ -7,5 +7,5 @@
       COMMON/comvertr/ap(llm+1),bp(llm+1),presnivs(llm),dpres(llm),     &
      &               pa,preff,nivsigs(llm),nivsig(llm+1),               &
-     &               aps(llm),bps(llm),scaleheight
+     &               aps(llm),bps(llm),scaleheight,pseudoalt(llm)
 
       common/comverti/disvert_type, pressure_exner
@@ -23,4 +23,5 @@
       real bps    ! hybrid sigma contribution at mid-layers
       real scaleheight ! atmospheric (reference) scale height (km)
+      real pseudoalt ! for planets
 
       integer disvert_type ! type of vertical discretization:
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/disvert_noterre.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/disvert_noterre.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/disvert_noterre.F	(revision 841)
@@ -1,2 +1,3 @@
+! $Id: $
       SUBROUTINE disvert_noterre
 
@@ -22,5 +23,5 @@
 c
 c=======================================================================
-c    Discretisation verticale en coordonnée hybride 
+c    Discretisation verticale en coordonnée hybride (ou sigma)
 c
 c=======================================================================
@@ -45,8 +46,8 @@
       real tt,rr,gg, prevz
       real s(llm),dsig(llm) 
-      real pseudoalt(llm)
 
       integer iz 
       real z, ps,p
+      character(len=*),parameter :: modname="disvert_noterre"
 
 c
@@ -54,9 +55,9 @@
 c
 ! Initializations:
-      pi=2.*ASIN(1.)
+!      pi=2.*ASIN(1.) ! already done in iniconst
       
       hybrid=.true. ! default value for hybrid (ie: use hybrid coordinates)
       CALL getin('hybrid',hybrid)
-      write(lunout,*)'disvert_noterre: hybrid=',hybrid
+      write(lunout,*) trim(modname),': hybrid=',hybrid
 
 ! Ouverture possible de fichiers typiquement E.T.
@@ -156,9 +157,9 @@
 
       DO l=1,llm
-        nivsigs(l) = FLOAT(l)
+        nivsigs(l) = REAL(l)
       ENDDO
 
       DO l=1,llmp1
-        nivsig(l)= FLOAT(l)
+        nivsig(l)= REAL(l)
       ENDDO
 
@@ -199,7 +200,7 @@
       bp(llmp1) =   0.
 
-      write(lunout,*)' BP '
+      write(lunout,*) trim(modname),': BP '
       write(lunout,*)  bp
-      write(lunout,*)' AP '
+      write(lunout,*) trim(modname),': AP '
       write(lunout,*)  ap
 
@@ -225,7 +226,7 @@
       end if
 
-      write(lunout,*)' BPs '
+      write(lunout,*) trim(modname),': BPs '
       write(lunout,*)  bps
-      write(lunout,*)' APs'
+      write(lunout,*) trim(modname),': APs'
       write(lunout,*)  aps
 
@@ -235,5 +236,5 @@
       ENDDO
 
-      write(lunout,*)' PRESNIVS' 
+      write(lunout,*)trim(modname),' : PRESNIVS' 
       write(lunout,*)presnivs 
       write(lunout,*)'Pseudo altitude of Presnivs : (for a scale ',
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/dynetat0.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/dynetat0.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/dynetat0.F	(revision 841)
@@ -7,4 +7,7 @@
       USE infotrac
       use netcdf, only: nf90_get_var
+
+      use control_mod, only : planet_type
+
       IMPLICIT NONE
 
@@ -54,4 +57,6 @@
       INTEGER ierr, nid, nvarid
 
+      INTEGER idecal
+
 c-----------------------------------------------------------------------
 
@@ -77,30 +82,42 @@
       ENDIF
 
+      !!! AS: idecal is a hack to be able to read planeto starts...
+      !!!     .... while keeping everything OK for LMDZ EARTH
+      if ((planet_type.eq."generic").or.(planet_type.eq."mars")) then
+          write(lunout,*)'dynetat0 : Planeto-like start file'
+          idecal = 4
+          annee_ref  = 2000
+      else
+          write(lunout,*)'dynetat0 : Earth-like start file'
+          idecal = 5
+          annee_ref  = tab_cntrl(5)
+      endif
+
+
       im         = tab_cntrl(1)
       jm         = tab_cntrl(2)
       lllm       = tab_cntrl(3)
       day_ref    = tab_cntrl(4)
-      annee_ref  = tab_cntrl(5)
-      rad        = tab_cntrl(6)
-      omeg       = tab_cntrl(7)
-      g          = tab_cntrl(8)
-      cpp        = tab_cntrl(9)
-      kappa      = tab_cntrl(10)
-      daysec     = tab_cntrl(11)
-      dtvr       = tab_cntrl(12)
-      etot0      = tab_cntrl(13)
-      ptot0      = tab_cntrl(14)
-      ztot0      = tab_cntrl(15)
-      stot0      = tab_cntrl(16)
-      ang0       = tab_cntrl(17)
-      pa         = tab_cntrl(18)
-      preff      = tab_cntrl(19)
-c
-      clon       = tab_cntrl(20)
-      clat       = tab_cntrl(21)
-      grossismx  = tab_cntrl(22)
-      grossismy  = tab_cntrl(23)
-c
-      IF ( tab_cntrl(24).EQ.1. )  THEN
+      rad        = tab_cntrl(idecal+1)
+      omeg       = tab_cntrl(idecal+2)
+      g          = tab_cntrl(idecal+3)
+      cpp        = tab_cntrl(idecal+4)
+      kappa      = tab_cntrl(idecal+5)
+      daysec     = tab_cntrl(idecal+6)
+      dtvr       = tab_cntrl(idecal+7)
+      etot0      = tab_cntrl(idecal+8)
+      ptot0      = tab_cntrl(idecal+9)
+      ztot0      = tab_cntrl(idecal+10)
+      stot0      = tab_cntrl(idecal+11)
+      ang0       = tab_cntrl(idecal+12)
+      pa         = tab_cntrl(idecal+13)
+      preff      = tab_cntrl(idecal+14)
+c
+      clon       = tab_cntrl(idecal+15)
+      clat       = tab_cntrl(idecal+16)
+      grossismx  = tab_cntrl(idecal+17)
+      grossismy  = tab_cntrl(idecal+18)
+c
+      IF ( tab_cntrl(idecal+19).EQ.1. )  THEN
         fxyhypb  = . TRUE .
 c        dzoomx   = tab_cntrl(25)
@@ -111,5 +128,5 @@
         fxyhypb = . FALSE .
         ysinus  = . FALSE .
-        IF( tab_cntrl(27).EQ.1. ) ysinus = . TRUE. 
+        IF( tab_cntrl(idecal+22).EQ.1. ) ysinus = . TRUE. 
       ENDIF
 
@@ -225,5 +242,10 @@
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Le champ <temps> est absent"
-         CALL abort
+         write(lunout,*)"dynetat0: J essaie <Time>"
+         ierr = NF_INQ_VARID (nid, "Time", nvarid)
+         IF (ierr .NE. NF_NOERR) THEN
+            write(lunout,*)"dynetat0: Le champ <Time> est absent"
+            CALL abort
+         ENDIF
       ENDIF
       ierr = nf90_get_var(nid, nvarid, time)
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/fxhyp.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/fxhyp.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/fxhyp.F	(revision 841)
@@ -1,4 +1,4 @@
 !
-! $Id: fxhyp.F 1403 2010-07-01 09:02:53Z fairhead $
+! $Id: fxhyp.F 1674 2012-10-29 16:27:03Z emillour $
 !
 c
@@ -48,18 +48,18 @@
 c
        REAL   dzoom
-       REAL*8 xlon(iip1),xprimm(iip1),xuv
-       REAL*8 xtild(0:nmax2)
-       REAL*8 fhyp(0:nmax2),ffdx,beta,Xprimt(0:nmax2)
-       REAL*8 Xf(0:nmax2),xxpr(0:nmax2)
-       REAL*8 xvrai(iip1),xxprim(iip1) 
-       REAL*8 pi,depi,epsilon,xzoom,fa,fb
-       REAL*8 Xf1, Xfi , a0,a1,a2,a3,xi2
+       REAL(KIND=8) xlon(iip1),xprimm(iip1),xuv
+       REAL(KIND=8) xtild(0:nmax2)
+       REAL(KIND=8) fhyp(0:nmax2),ffdx,beta,Xprimt(0:nmax2)
+       REAL(KIND=8) Xf(0:nmax2),xxpr(0:nmax2)
+       REAL(KIND=8) xvrai(iip1),xxprim(iip1) 
+       REAL(KIND=8) pi,depi,epsilon,xzoom,fa,fb
+       REAL(KIND=8) Xf1, Xfi , a0,a1,a2,a3,xi2
        INTEGER i,it,ik,iter,ii,idif,ii1,ii2
-       REAL*8 xi,xo1,xmoy,xlon2,fxm,Xprimin
-       REAL*8 champmin,champmax,decalx
+       REAL(KIND=8) xi,xo1,xmoy,xlon2,fxm,Xprimin
+       REAL(KIND=8) champmin,champmax,decalx
        INTEGER is2
        SAVE is2
 
-       REAL*8 heavyside
+       REAL(KIND=8) heavyside
 
        pi       = 2. * ASIN(1.)
@@ -68,4 +68,25 @@
        xzoom    = xzoomdeg * pi/180. 
 c
+       if (iim==1) then
+
+          rlonm025(1)=-pi/2.
+          rlonv(1)=0.
+          rlonu(1)=pi
+          rlonp025(1)=pi/2.
+          rlonm025(2)=rlonm025(1)+depi
+          rlonv(2)=rlonv(1)+depi
+          rlonu(2)=rlonu(1)+depi
+          rlonp025(2)=rlonp025(1)+depi
+
+          xprimm025(:)=1.
+          xprimv(:)=1.
+          xprimu(:)=1.
+          xprimp025(:)=1.
+          champmin=depi
+          champmax=depi
+          return
+
+       endif
+
            decalx   = .75
        IF( grossism.EQ.1..AND.scal180 )  THEN
@@ -286,8 +307,10 @@
 
 
+
        IF(ik.EQ.1.and.grossism.EQ.1.)  THEN
          xvrai(1)    = xvrai(iip1)-depi
          xxprim(1)   = xxprim(iip1)
        ENDIF
+
        DO i = 1 , iim
         xlon(i)     = xvrai(i)
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 841)
@@ -449,5 +449,5 @@
 c   -------------------------------
 
-      IF (call_iniphys.and.(iflag_phys.eq.1)) THEN
+      IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100)) THEN
          latfi(1)=rlatu(1)
          lonfi(1)=0.
@@ -469,9 +469,10 @@
 ! Physics
 #ifdef CPP_PHYS
-         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys ,
-     ,                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp     )
-#endif ! CPP_PHYS
+         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys,
+     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp,
+     &                iflag_phys)
+#endif
          call_iniphys=.false.
-      ENDIF ! of IF (call_iniphys.and.(iflag_phys.eq.1))
+      ENDIF ! of IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100))
 
 
@@ -513,12 +514,4 @@
 #endif
 
-#ifdef CPP_PHYS
-! Create start file (startphy.nc) and boundary conditions (limit.nc) 
-! for the Earth verstion
-       if (iflag_phys>=100) then
-          call iniaqua(ngridmx,latfi,lonfi,iflag_phys)
-       endif
-#endif
-
       if (planet_type.eq."mars") then
 ! POUR MARS, METTRE UNE FONCTION A PART, genre dynredem0_mars
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F	(revision 841)
@@ -37,13 +37,21 @@
       integer i,j,l
 
-      logical firstcall
-      save firstcall
-c$OMP THREADPRIVATE(firstcall)
+      logical firstcall,groupe_ok
+      save firstcall,groupe_ok
+c$OMP THREADPRIVATE(firstcall,groupe_ok)
 
       data firstcall/.true./
+      data groupe_ok/.true./
+
       integer ijb,ije,jjb,jje
       
+      if (iim==1) then
+         groupe_ok=.false.
+      endif
+
       if (firstcall) then
-         if(mod(iim,2**ngroup).ne.0) stop'probleme du nombre ede point'
+         if (groupe_ok) then
+           if(mod(iim,2**ngroup).ne.0) stop'probleme du nombre de point'
+         endif
          firstcall=.false.
       endif
@@ -66,5 +74,7 @@
 c$OMP END DO NOWAIT
 
-      call groupeun_p(jjp1,llm,jjb,jje,zconvmm)
+      if (groupe_ok) then
+         call groupeun_p(jjp1,llm,jjb,jje,zconvmm)
+      endif
       
       jjb=jj_begin-1
@@ -78,5 +88,7 @@
 c$OMP END DO NOWAIT
 
-      call groupeun_p(jjm,llm,jjb,jje,pbarvm)
+      if (groupe_ok) then
+         call groupeun_p(jjm,llm,jjb,jje,pbarvm)
+      endif
 
 c   Champs 3D
@@ -101,4 +113,5 @@
       enddo
 c$OMP END DO NOWAIT
+
 c    integration de la convergence de masse de haut  en bas ......
    
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F	(revision 841)
@@ -147,5 +147,5 @@
       REAL :: secondes
       real :: rdaym_ini
-
+      logical :: physic
       LOGICAL first,callinigrads
 
@@ -231,4 +231,6 @@
 
       itau = 0
+      physic=.true.
+      if (iflag_phys==0.or.iflag_phys==2) physic=.false.
 !      iday = day_ini+itau/day_step
 !      time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0
@@ -404,5 +406,5 @@
      s        apdiss = .TRUE.
          IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward 
-     s          .and. iflag_phys.EQ.1                 ) apphys = .TRUE.
+     s          .and. physic                        ) apphys = .TRUE.
       ELSE
       ! Leapfrog/Matsuno time stepping 
@@ -410,5 +412,5 @@
          IF( MOD(itau+1,dissip_period).EQ.0 .AND. .NOT. forward )
      s        apdiss = .TRUE.
-         IF( MOD(itau+1,iphysiq).EQ.0.AND.iflag_phys.EQ.1) apphys=.TRUE.
+         IF( MOD(itau+1,iphysiq).EQ.0.AND.physic) apphys=.TRUE.
       END IF
 
@@ -539,5 +541,5 @@
       endif
 c$OMP END MASTER  
-      endif       
+      endif ! of if (Adjust)
      
       
@@ -546,4 +548,23 @@
 c   calcul des tendances dynamiques:
 c   --------------------------------
+! ADAPTATION GCM POUR CP(T)
+      call tpot2t_p(ip1jmp1,llm,teta,temp,pk)
+      ijb=ij_begin
+      ije=ij_end
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+      do l=1,llm
+        tsurpk(ijb:ije,l)=cpp*temp(ijb:ije,l)/pk(ijb:ije,l)
+      enddo
+!$OMP END DO
+
+      if (debug) then
+!$OMP BARRIER
+!$OMP MASTER
+	call WriteField_p('temp',reshape(temp,(/iip1,jmp1,llm/)))
+	call WriteField_p('tsurpk',reshape(tsurpk,(/iip1,jmp1,llm/)))
+!$OMP END MASTER        
+!$OMP BARRIER     
+      endif ! of if (debug)
+      
 c$OMP BARRIER
 c$OMP MASTER
@@ -600,14 +621,4 @@
       True_itau=True_itau+1
 
-! ADAPTATION GCM POUR CP(T)
-      call tpot2t_p(ip1jmp1,llm,teta,temp,pk)
-      ijb=ij_begin
-      ije=ij_end
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-      do l=1,llm
-        tsurpk(ijb:ije,l)=cpp*temp(ijb:ije,l)/pk(ijb:ije,l)
-      enddo
-!$OMP END DO
-
 c$OMP MASTER
       IF (prt_level>9) THEN
@@ -784,4 +795,10 @@
            jD_cur = jD_ref + day_ini - day_ref
      $        + itau/day_step
+
+           IF (planet_type .eq."generic") THEN
+              ! AS: we make jD_cur to be pday
+              jD_cur = int(day_ini + itau/day_step)
+           ENDIF
+
            jH_cur = jH_ref + start_time +                                &
      &              mod(itau,day_step)/float(day_step) 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/parallel.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/parallel.F90	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/parallel.F90	(revision 841)
@@ -489,5 +489,10 @@
           enddo
           
-        endif
+        else
+          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
+          !          below) about Buffer_Recv() being not allocated.
+          !          So make a dummy allocation.
+          allocate(Buffer_Recv(1))
+        endif ! of if (MPI_Rank==rank)
   
 !$OMP CRITICAL (MPI)
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/paramet.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/paramet.h	(revision 819)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/paramet.h	(revision 841)
@@ -17,5 +17,5 @@
       INTEGER jcfil,jcfllm
 
-      PARAMETER( iip1= iim+1-1/iim,iip2=iim+2,iip3=iim+3                &
+      PARAMETER( iip1= iim+1,iip2=iim+2,iip3=iim+3                       &
      &    ,jjp1=jjm+1-1/jjm)
       PARAMETER( llmp1 = llm+1,  llmp2 = llm+2, llmm1 = llm-1 )
