Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynredem.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynredem.F	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynredem.F	(revision 179)
@@ -1,2 +1,4 @@
+c $Header$
+c
       SUBROUTINE dynredem0(fichnom,idayref,anneeref,phis,nq)
       USE IOIPSL
@@ -132,9 +134,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,idim_index,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
      .                       "Parametres de controle")
@@ -147,9 +145,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,idim_rlonu,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23,
      .                       "Longitudes des points U")
@@ -162,9 +156,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,idim_rlatu,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
      .                       "Latitudes des points U")
@@ -177,9 +167,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,idim_rlonv,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23,
      .                       "Longitudes des points V")
@@ -192,9 +178,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,idim_rlatv,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
      .                       "Latitudes des points V")
@@ -207,9 +189,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_s,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28,
      .                       "Numero naturel des couches s")
@@ -222,9 +200,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_sig,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32,
      .                       "Numero naturel des couches sigma")
@@ -237,9 +211,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,idim_sig,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_sig,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26,
      .                       "Coefficient A pour hybride")
@@ -252,9 +222,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,idim_sig,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_sig,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26,
      .                       "Coefficient B pour hybride")
@@ -267,9 +233,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,idim_s,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_s,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -284,9 +246,5 @@
       dims2(1) = idim_rlonu
       dims2(2) = idim_rlatu
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"cu",NF_DOUBLE,2,dims2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"cu",NF_FLOAT,2,dims2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29,
      .                       "Coefficient de passage pour U")
@@ -301,9 +259,5 @@
       dims2(1) = idim_rlonv
       dims2(2) = idim_rlatv
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"cv",NF_DOUBLE,2,dims2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"cv",NF_FLOAT,2,dims2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29,
      .                       "Coefficient de passage pour V")
@@ -320,9 +274,5 @@
       dims2(1) = idim_rlonv
       dims2(2) = idim_rlatu
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"aire",NF_DOUBLE,2,dims2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"aire",NF_FLOAT,2,dims2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
      .                       "Aires de chaque maille")
@@ -339,9 +289,5 @@
       dims2(1) = idim_rlonv
       dims2(2) = idim_rlatu
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"phisinit",NF_DOUBLE,2,dims2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"phisinit",NF_FLOAT,2,dims2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19,
      .                       "Geopotentiel au sol")
@@ -357,9 +303,5 @@
       ierr = NF_REDEF (nid) ! entrer dans le mode de definition
 c
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"temps",NF_DOUBLE,1,idim_tim,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19,
      .                       "Temps de simulation")
@@ -374,9 +316,5 @@
       dims4(3) = idim_s
       dims4(4) = idim_tim
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"ucov",NF_DOUBLE,4,dims4,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"ucov",NF_FLOAT,4,dims4,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9,
      .                       "Vitesse U")
@@ -386,9 +324,5 @@
       dims4(3) = idim_s
       dims4(4) = idim_tim
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"vcov",NF_DOUBLE,4,dims4,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"vcov",NF_FLOAT,4,dims4,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9,
      .                       "Vitesse V")
@@ -398,9 +332,5 @@
       dims4(3) = idim_s
       dims4(4) = idim_tim
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"teta",NF_DOUBLE,4,dims4,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"teta",NF_FLOAT,4,dims4,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 11,
      .                       "Temperature")
@@ -418,9 +348,5 @@
          str3(1:1)='q'
          WRITE(str3(2:3),'(i2.2)') iq
-#ifdef NC_DOUBLE
-         ierr = NF_DEF_VAR (nid,str3,NF_DOUBLE,4,dims4,nvarid)
-#else
          ierr = NF_DEF_VAR (nid,str3,NF_FLOAT,4,dims4,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12,
      .                       "Traceurs "//str3)
@@ -433,9 +359,5 @@
       dims4(3) = idim_s
       dims4(4) = idim_tim
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"masse",NF_DOUBLE,4,dims4,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"masse",NF_FLOAT,4,dims4,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12,
      .                       "C est quoi ?")
@@ -444,9 +366,5 @@
       dims3(2) = idim_rlatu
       dims3(3) = idim_tim
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid,"ps",NF_DOUBLE,3,dims3,nvarid)
-#else
       ierr = NF_DEF_VAR (nid,"ps",NF_FLOAT,3,dims3,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 15,
      .                       "Pression au sol")
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h	(revision 179)
@@ -1,7 +1,8 @@
+! $Header$
+!
 !-----------------------------------------------------------------------
 ! INCLUDE 'temps.h'
 
-      COMMON/temps/itaufin,dt,
-     s  day_ini,day_end,anne_ini
+      COMMON/temps/itaufin,dt, day_ini,day_end,anne_ini
 
       INTEGER  itaufin
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/inc_cpl.h
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/inc_cpl.h	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/inc_cpl.h	(revision 179)
@@ -1,15 +1,17 @@
-C
-C -- inc_cpl.h   1998-04
-C    **********
-C@
-C@  Contents : variables describing pipe and field names
-C@  --------
-C@
-C@ -- cl_write  : for fields to write
-C@
-C@ -- cl_read  : for fields to read
-C@
-C     -------------------------------------------------------------------
-C
+!
+! $Header$
+!
+! -- inc_cpl.h   1998-04
+!    **********
+!@
+!@  Contents : variables describing pipe and field names
+!@  --------
+!@
+!@ -- cl_write  : for fields to write
+!@
+!@ -- cl_read  : for fields to read
+!@
+!     -------------------------------------------------------------------
+!
       INTEGER jpread, jpwrit
       PARAMETER (jpread=0, jpwrit=1)
@@ -17,3 +19,3 @@
       CHARACTER*6 cl_f_writ(jpmaxfld), cl_f_read(jpmaxfld)
       COMMON / comcpl / cl_writ, cl_read, cl_f_writ, cl_f_read
-C     -------------------------------------------------------------------
+!     -------------------------------------------------------------------
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 179)
@@ -178,9 +178,10 @@
 
 ! Local
-  character (len = 20) :: modname = 'interfsurf_hq'
+  character (len = 20),save :: modname = 'interfsurf_hq'
   character (len = 80) :: abort_message 
   logical, save        :: first_call = .true.
-  INTEGER              :: error, ii
-  logical              :: check = .true.
+  integer, save        :: error
+  integer              :: ii
+  logical,save              :: check = .true.
   real, dimension(klon):: cal, beta, dif_grnd, capsol
 !!$PB  real, parameter      :: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5.
@@ -687,5 +688,5 @@
   character (len = 20) :: modname = 'interfsol'
   character (len = 80) :: abort_message
-  logical              :: check = .true.
+  logical,save              :: check = .TRUE.
   real, dimension(klon) :: cal, beta, dif_grnd, capsol
 ! type de couplage dans sechiba
@@ -712,9 +713,9 @@
   real, allocatable, dimension (:,:), save :: lon_scat, lat_scat  
 
-  logical                :: lrestart_read = .true. , lrestart_write = .true.
+  logical, save             :: lrestart_read = .true. , lrestart_write = .true.
 
   real, dimension(klon):: qsurf
   real, dimension(klon):: snow, qsol
-  real                 :: date0 = 0.
+  real, save                 :: date0 = 0.
   real, dimension(knon,2) :: albedo_out
 ! Pb de nomenclature
@@ -997,5 +998,5 @@
   character (len = 20) :: modname = 'interfoce_cpl'
   character (len = 80) :: abort_message
-  logical              :: check = .true.
+  logical,save              :: check = .true.
 ! variables pour moyenner les variables de couplage
   real, allocatable, dimension(:,:),save :: cpl_sols, cpl_nsol, cpl_rain
@@ -1031,10 +1032,18 @@
   real, dimension(iim, jjm+1) :: deno
   integer                     :: idtime
-  integer, allocatable, dimension(:,:) :: isst
-  integer, allocatable,save,dimension(:) :: unity
+  integer, allocatable,dimension(:),save :: unity
 ! 
   logical, save    :: first_appel = .true.
-  logical          :: print
-
+  logical,save          :: print
+!maf
+! variables pour avoir une sortie IOIPSL des champs echanges
+  CHARACTER*80,SAVE :: clintocplnam, clfromcplnam
+  INTEGER, SAVE :: jf,nhoridct,nidct
+  INTEGER, SAVE :: nhoridcs,nidcs
+  INTEGER :: ndexct(iim*(jjm+1)),ndexcs(iim*(jjm+1))
+  REAL :: zx_lon(iim,jjm+1), zx_lat(iim,jjm+1), zjulian
+  include 'param_cou.h'
+  include 'inc_cpl.h'
+  include 'temps.h'
 !
 ! Initialisation
@@ -1098,4 +1107,45 @@
     call inicma(npas , nexca, idtime,(jjm+1)*iim)
 
+!
+! initialisation sorties netcdf
+!
+    CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
+    zjulian = zjulian + day_ini
+    CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon)
+    DO i = 1, iim
+      zx_lon(i,1) = rlon(i+1)
+      zx_lon(i,jjm+1) = rlon(i+1)
+    ENDDO
+    CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat)
+    clintocplnam="cpl_atm_tauflx"
+    CALL histbeg(clintocplnam, iim,zx_lon,jjm+1,zx_lat,1,iim,1,jjm+1, &
+       & 0,zjulian,dtime,nhoridct,nidct) 
+! no vertical axis
+    CALL histdef(nidct, 'tauxe','tauxe', &
+         & "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+    CALL histdef(nidct, 'tauyn','tauyn', &
+         & "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+    CALL histdef(nidct, 'tmp_lon','tmp_lon', &
+         & "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+    CALL histdef(nidct, 'tmp_lat','tmp_lat', &
+         & "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+    DO jf=1,jpflda2o1 + jpflda2o2
+      CALL histdef(nidct, cl_writ(jf),cl_writ(jf), &
+         & "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+    END DO
+    CALL histend(nidct)
+    CALL histsync(nidct)
+
+    clfromcplnam="cpl_atm_sst"
+    CALL histbeg(clfromcplnam, iim,zx_lon,jjm+1,zx_lat,1,iim,1,jjm+1, &
+       & 0,zjulian,dtime,nhoridcs,nidcs) 
+! no vertical axis
+    DO jf=1,jpfldo2a
+      CALL histdef(nidcs, cl_read(jf),cl_read(jf), &
+         & "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+    END DO
+    CALL histend(nidcs)
+    CALL histsync(nidcs)
+
     first_appel = .false.
   endif ! fin if (first_appel)
@@ -1109,6 +1159,6 @@
   if (nisurf == is_sic) cpl_index = 2
   if (cumul) then
+    if (check) write(*,*) modname, 'cumul des champs'
     do ig = 1, knon
-      if (check) write(*,*) modname, 'cumul des champs'
       cpl_sols(ig,cpl_index) = cpl_sols(ig,cpl_index) &
        &                          + swdown(ig)      / FLOAT(nexca)
@@ -1141,5 +1191,5 @@
   if (mod(itime, nexca) == 1) then
 !
-! Passage des champs au coupleur
+! Demande des champs au coupleur
 !
 ! Si le domaine considere est l'ocean, on lit les champs venant du coupleur
@@ -1149,4 +1199,15 @@
       call fromcpl(itime-1,(jjm+1)*iim,                                  &
      &        read_sst, read_sic, read_sit, read_alb_sic)
+!
+! sorties NETCDF des champs recus
+!
+      ndexcs(:)=0
+      CALL histwrite(nidcs,cl_read(1),itime,read_sst,iim*(jjm+1),ndexcs)
+      CALL histwrite(nidcs,cl_read(2),itime,read_sic,iim*(jjm+1),ndexcs)
+      CALL histwrite(nidcs,cl_read(3),itime,read_sit,iim*(jjm+1),ndexcs)
+      CALL histwrite(nidcs,cl_read(4),itime,read_alb_sic,iim*(jjm+1),ndexcs)
+      CALL histsync(nidcs)
+! pas utile      IF (npas-itime.LT.nexca )CALL histclo(nidcs)
+
       do j = 1, jjm + 1
         do ig = 1, iim
@@ -1182,9 +1243,9 @@
 ! Pour rattraper des erreurs d'arrondis
 !
-      where (abs(pctsrf_sav(:,is_sic)) .le. epsilon(pctsrf_sav(1,is_sic)))
+      where (abs(pctsrf_sav(:,is_sic)) .le. 2.*epsilon(pctsrf_sav(1,is_sic)))
         pctsrf_sav(:,is_sic) = 0.
         pctsrf_sav(:,is_oce) = pctsrf(:,is_oce) + pctsrf(:,is_sic)
       endwhere
-      where (abs(pctsrf_sav(:,is_oce)) .le. epsilon(pctsrf_sav(1,is_oce)))
+      where (abs(pctsrf_sav(:,is_oce)) .le. 2.*epsilon(pctsrf_sav(1,is_oce)))
         pctsrf_sav(:,is_sic) = pctsrf(:,is_oce) + pctsrf(:,is_sic)
         pctsrf_sav(:,is_oce) = 0.
@@ -1282,6 +1343,8 @@
 ! on passe les coordonnées de la grille
 !
-      CALL gath2cpl(rlon(1), tmp_lon(1,1), klon, knon,iim,jjm, knindex) 
-      CALL gath2cpl(rlat(1), tmp_lat(1,1), klon, knon,iim,jjm, knindex) 
+
+      CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,tmp_lon)
+      CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,tmp_lat)
+
       DO i = 1, iim
         tmp_lon(i,1) = rlon(i+1)
@@ -1289,8 +1352,40 @@
       ENDDO
 !
+! sortie netcdf des champs pour le changement de repere
+!
+      ndexct(:)=0
+      CALL histwrite(nidct,'tauxe',itime,wri_taux,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tauyn',itime,wri_tauy,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tmp_lon',itime,tmp_lon,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tmp_lat',itime,tmp_lat,iim*(jjm+1),ndexct)
+
+!
 ! calcul 3 coordonnées du vent
 !
       CALL atm2geo (iim , jjm + 1, wri_taux, wri_tauy, tmp_lon, tmp_lat, &
          & wri_tauxx, wri_tauyy, wri_tauzz )
+!
+! sortie netcdf des champs apres changement de repere et juste avant
+! envoi au coupleur
+!
+      CALL histwrite(nidct,cl_writ(1),itime,wri_sol_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(2),itime,wri_sol_sea,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(3),itime,wri_nsol_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(4),itime,wri_nsol_sea,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(5),itime,wri_fder_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(6),itime,wri_evap_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(7),itime,wri_evap_sea,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(8),itime,wri_rain,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(9),itime,wri_snow,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(10),itime,wri_rcoa,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(11),itime,wri_rriv,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(12),itime,wri_tauxx,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(13),itime,wri_tauyy,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(14),itime,wri_tauzz,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(15),itime,wri_tauxx,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(16),itime,wri_tauyy,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(17),itime,wri_tauzz,iim*(jjm+1),ndexct)
+      CALL histsync(nidct)
+! pas utile      IF (lafin) CALL histclo(nidct)
 
       call intocpl(itime, (jjm+1)*iim, wri_sol_ice, wri_sol_sea, wri_nsol_ice,&
@@ -1413,7 +1508,7 @@
   character (len = 20) :: modname = 'interfoce_lim'
   character (len = 80) :: abort_message
-  character (len = 20) :: fich ='limit.nc'
-  LOGICAL     :: newlmt = .TRUE.
-  logical     :: check = .true.
+  character (len = 20),save :: fich ='limit.nc'
+  logical, save     :: newlmt = .TRUE.
+  logical, save     :: check = .true.
 ! Champs lus dans le fichier de CL
   real, allocatable , save, dimension(:) :: sst_lu, rug_lu, nat_lu
@@ -1656,7 +1751,7 @@
   character (len = 20) :: modname = 'interfsur_lim'
   character (len = 80) :: abort_message
-  character (len = 20) :: fich ='limit.nc'
-  logical     :: newlmt = .false.
-  logical     :: check = .true.
+  character (len = 20),save :: fich ='limit.nc'
+  logical,save     :: newlmt = .false.
+  logical,save     :: check = .true.
 ! Champs lus dans le fichier de CL
   real, allocatable , save, dimension(:) :: alb_lu, rug_lu
@@ -1665,6 +1760,6 @@
 !
 #include "netcdf.inc"
-  integer              :: nid, nvarid
-  integer, dimension(2) :: start, epais
+  integer ,save             :: nid, nvarid
+  integer, dimension(2),save :: start, epais
 !
 ! Fin déclaration
@@ -1747,4 +1842,6 @@
 ! Recopie des variables dans les champs de sortie
 !
+  lmt_alb(:) = 0.0
+  lmt_rug(:) = 0.0
   DO ii = 1, knon
     lmt_alb(ii) = alb_lu(knindex(ii))
@@ -1832,10 +1929,10 @@
   REAL, parameter :: chasno = 3.334E+05/(2.3867E+06*0.15)
 !
-  logical         :: check = .true.
+  logical, save         :: check = .true.
   character (len = 20)  :: modname = 'calcul_fluxs'
-  logical         :: fonte_neige = .false.
-  real            :: max_eau_sol = 150.0
+  logical, save         :: fonte_neige = .false.
+  real, save            :: max_eau_sol = 150.0
   character (len = 80) :: abort_message 
-  logical,save         :: first = .t.,second=.f.
+  logical,save         :: first = .true.,second=.false.
 
   if (check) write(*,*)'Entree ', modname,' surface = ',nisurf
@@ -2096,5 +2193,5 @@
   integer                   :: i, ig, j
   real, dimension(klon)     :: tamp
-  logical                   :: check = .false.
+  logical ,save                  :: check = .false.
 
   ig = 1
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.true
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.true	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.true	(revision 179)
@@ -199,4 +199,6 @@
             CALL CLIM_Define (cl_read(jf), clim_in , clim_double, iparal
      $          , info )  
+            WRITE(nuout,*) 'inicma : clim define done for ',jf
+     $          ,cl_read(jf) 
           END DO 
 c
@@ -206,4 +208,6 @@
             CALL CLIM_Define (cl_writ(jf), clim_out , clim_double,
      $          iparal, info )   
+            WRITE(nuout,*) 'inicma : clim define done for ',jf
+     $          ,cl_writ(jf) 
           END DO 
 c
@@ -410,50 +414,50 @@
             IF (jf.eq.1)
      $          CALL locwrite(cl_writ(jf),fsolice, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.2)
      $          CALL locwrite(cl_writ(jf),fsolwat, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.3)
      $          CALL locwrite(cl_writ(jf),fnsolice, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.4)
      $          CALL locwrite(cl_writ(jf),fnsolwat, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.5)
      $          CALL locwrite(cl_writ(jf),fnsicedt, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
 c            IF (jf.eq.6)
 c     $          CALL locwrite(cl_writ(jf),ictemp, imjm,
-c     $          file_unit_field(jf), ierror, nuout) 
+c     $          file_unit_field(jf), ierror) 
             IF (jf.eq.6)
      $          CALL locwrite(cl_writ(jf),evice, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.7)
      $          CALL locwrite(cl_writ(jf),evwat, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.8)
      $          CALL locwrite(cl_writ(jf),lpre, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.9)
      $          CALL locwrite(cl_writ(jf),spre, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.10)
      $          CALL locwrite(cl_writ(jf),dirunoff, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
             IF (jf.eq.11)
      $          CALL locwrite(cl_writ(jf),rivrunoff, imjm,
-     $          file_unit_field(jf), ierror, nuout) 
+     $          file_unit_field(jf), ierror) 
 c$$$            IF (jf.eq.12)
 c$$$     $          CALL locwrite(cl_writ(jf),tauxu, imjm,
-c$$$     $          file_unit_field(jf),ierror, nuout) 
+c$$$     $          file_unit_field(jf),ierror) 
 c$$$            IF (jf.eq.13)
 c$$$     $          CALL locwrite(cl_writ(jf),tauxv, imjm,
-c$$$     $          file_unit_field(jf),ierror, nuout) 
+c$$$     $          file_unit_field(jf),ierror) 
 c$$$            IF (jf.eq.14)
 c$$$     $          CALL locwrite(cl_writ(jf),tauyv, imjm,
-c$$$     $          file_unit_field(jf),ierror, nuout) 
+c$$$     $          file_unit_field(jf),ierror) 
 c$$$            IF (jf.eq.15)
 c$$$     $          CALL locwrite(cl_writ(jf),tauyu, imjm,
-c$$$     $          file_unit_field(jf), ierror, nuout) 
+c$$$     $          file_unit_field(jf), ierror) 
             IF (jf.eq.12)
      $          CALL locwrite(cl_writ(jf),tauxx_u, imjm,
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/param_cou.h
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/param_cou.h	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/param_cou.h	(revision 179)
@@ -1,6 +1,6 @@
-C $Id$
-C
-C -- param_cou.h
-C
+! $Id$
+!
+! -- param_cou.h
+!
 	INTEGER jpmaxfld
 	PARAMETER(jpmaxfld = 40)        ! Maximum number of fields exchanged
@@ -10,9 +10,9 @@
                                          ! atmosphere to ocean via flx.F
 	INTEGER jpflda2o2
-	PARAMETER(jpflda2o2 = 4)         ! Number of fields exchanged from
+	PARAMETER(jpflda2o2 = 6)         ! Number of fields exchanged from
                                          ! atmosphere to ocean via tau.F
-C
+!
 	INTEGER jpfldo2a
 	PARAMETER(jpfldo2a = 4)          ! Number of fields exchanged from
                                          ! ocean to atmosphere
-C
+!
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/phyredem.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/phyredem.F	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/phyredem.F	(revision 179)
@@ -1,2 +1,4 @@
+c $Header$
+c
       SUBROUTINE phyredem (fichnom,dtime,radpas,co2_ppm,solaire,
      .           rlat,rlon, pctsrf,tsol,tsoil,deltat,qsol,snow,
@@ -100,9 +102,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22,
      .                        "Parametres de controle")
@@ -115,9 +113,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32,
      .                        "Longitudes de la grille physique")
@@ -130,9 +124,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31,
      .                        "Latitudes de la grille physique")
@@ -147,9 +137,5 @@
 C
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "masque", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "masque", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 16,
      .                        "masque terre mer")
@@ -165,9 +151,5 @@
 C
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FTER", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "FTER", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
      .                        "fraction de continent")
@@ -182,9 +164,5 @@
 C 
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FLIC", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "FLIC", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24,
      .                        "fraction glace de terre")
@@ -199,9 +177,5 @@
 C
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FOCE", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "FOCE", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14,
      .                        "fraction ocean")
@@ -216,9 +190,5 @@
 C
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FSIC", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "FSIC", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18,
      .                        "fraction glace mer")
@@ -236,9 +206,5 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid, "TS"//str2, NF_DOUBLE, 1, idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid, "TS"//str2, NF_FLOAT, 1, idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Temperature de surface No."//str2)
@@ -260,9 +226,5 @@
         WRITE(str7,'(i2.2,"srf",i2.2)') isoil,nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid, "Tsoil"//str7,NF_DOUBLE,1,idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid, "Tsoil"//str7,NF_FLOAT,1,idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 29,
      .                        "Temperature du sol No."//str7)
@@ -282,9 +244,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "DELTAT", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "DELTAT", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 33,
      .                        "Ecart de la SST (pour slab-ocean)")
@@ -300,9 +258,5 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"QS"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid,"QS"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 25,
      .                        "Humidite de surface No."//str2)
@@ -323,9 +277,5 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"ALBE"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid,"ALBE"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 23,
      .                        "albedo de surface No."//str2)
@@ -346,9 +296,5 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"EVAP"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid,"EVAP"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Evaporation de surface No."//str2)
@@ -370,9 +316,5 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"SNOW"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid,"SNOW"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22,
      .                        "Neige de surface No."//str2)
@@ -391,9 +333,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Rayonnement net a la surface")
@@ -406,9 +344,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32,
      .                        "Rayonnement solaire a la surface")
@@ -421,9 +355,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27,
      .                        "Rayonnement IF a la surface")
@@ -436,9 +366,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "fder", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "fder", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14,
      .                        "Derive de flux")
@@ -451,9 +377,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "rain_f", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "rain_f", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
      .                        "precipitation liquide")
@@ -466,9 +388,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "snow_f", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "snow_f", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,
      .                        "precipitation solide")
@@ -484,9 +402,5 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"RUG"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
         ierr = NF_DEF_VAR (nid,"RUG"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 23,
      .                        "rugosite de surface No."//str2)
@@ -504,9 +418,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "AGESNO", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "AGESNO", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 15,
      .                        "Age de la neige")
@@ -519,9 +429,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZMEA", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZMEA", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -532,9 +438,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZSTD", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZSTD", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -545,9 +447,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZSIG", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZSIG", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -558,9 +456,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZGAM", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZGAM", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -571,9 +465,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZTHE", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZTHE", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -584,9 +474,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZPIC", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZPIC", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -597,9 +483,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZVAL", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "ZVAL", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -610,9 +492,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "RUGSREL", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "RUGSREL", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -623,9 +501,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -636,9 +510,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "QANCIEN", NF_DOUBLE, 1, idim3,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "QANCIEN", NF_FLOAT, 1, idim3,nvarid)
-#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -649,9 +519,5 @@
 c
       ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "RUGMER", NF_DOUBLE, 1, idim2,nvarid)
-#else
       ierr = NF_DEF_VAR (nid, "RUGMER", NF_FLOAT, 1, idim2,nvarid)
-#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Longueur de rugosite sur mer")
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 179)
@@ -1,2 +1,5 @@
+c
+c $Header$
+c
       SUBROUTINE physiq (nlon,nlev,nqmax  ,
      .            debut,lafin,rjourvrai,rjour_ecri,gmtime,pdtphys,
@@ -71,5 +74,5 @@
 c Parametres lies au coupleur OASIS:
 #include "oasis.h"
-      INTEGER npas, nexca
+      INTEGER,SAVE :: npas, nexca
       logical rnpb
       parameter(rnpb=.true.)
Index: /LMDZ.3.3/branches/rel-LF/makegcm
===================================================================
--- /LMDZ.3.3/branches/rel-LF/makegcm	(revision 178)
+++ /LMDZ.3.3/branches/rel-LF/makegcm	(revision 179)
@@ -29,4 +29,5 @@
   setenv LIBOGCM "`pwd`/lib"
   setenv IOIPSLDIR $LIBOGCM
+  setenv MODIPSLDIR $LIBOGCM
   cd $localdir
   if ( `hostname` == rhodes ) then
@@ -41,6 +42,7 @@
     endif 
   endif 
-  \cp libf/phylmd/oasis.F libf/phylmd/oasis.dummy
-  \cp libf/phylmd/oasis.true libf/phylmd/oasis.F
+# si modipsl c'est couple??? et LMDZ+SECHIBA alors
+  \cp -p libf/phylmd/oasis.F libf/phylmd/oasis.dummy
+  \cp -p libf/phylmd/oasis.true libf/phylmd/oasis.F
 else
   if ( ! $?LMDGCM ) then
@@ -56,4 +58,6 @@
     echo for instance: "setenv IOIPSLDIR /usr/myself/ioipsl" in .cshrc
     exit
+  else
+      setenv MODIPSLDIR $IOIPSLDIR
   endif
   if ( ! $?NCDFLIB ) then
@@ -172,5 +176,5 @@
    set optim90=" -fast -fixed "
    set optimtru90=" -fast -free "
-   set opt_link="-lf77compat -L$modipsl/lib -lsechiba -lparameters -lstomate -L$IOIPSLDIR -lioipsl -L$NCDFLIB -lnetcdf "
+   set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -lioipsl -L$NCDFLIB -lnetcdf "
    set mod_loc_dir=$localdir
    set mod_suffix=mod
@@ -187,11 +191,11 @@
    set optim90="$optim $optimbis -X9 -w"
    if $COUPLE then
-     set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
+     set opt_link="-Wg,-c $MODIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$MODIPSLDIR -lioipsl"
      set oplink="-Wl,-t,-P,-dy "
    else
-     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
+     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$MODIPSLDIR -lioipsl"
      set oplink="-Wl,-t,-dy "
    endif
-   set mod_loc_dir=$IOIPSLDIR
+   set mod_loc_dir=$MODIPSLDIR
    set mod_suffix=mod
 else if $DEC then
@@ -201,7 +205,7 @@
    set optim="-fast "
    set optim90=" -fast "
-   set optimtru90=" -fast -c -Mfree -module $IOIPSLDIR "
-   set opt_link=" -Mfree -L /usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$modipsl/lib -lsechiba -lparameters -lstomate -L$NCDFLIB -lnetcdf -L$IOIPSLDIR -lioipsl -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/"
-   set mod_loc_dir=$IOIPSLDIR
+   set optimtru90=" -fast -c -Mfree -module $MODIPSLDIR "
+   set opt_link=" -Mfree -L /usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$MODIPSLDIR -lsechiba -lparameters -lstomate -L$NCDFLIB -lnetcdf -lioipsl -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/"
+   set mod_loc_dir=$MODIPSLDIR
    set mod_suffix=mod
 else if $NEC then
@@ -210,5 +214,5 @@
    set optim="$optim90"
    set optimbis=" "
-   set opt_link=" -C hopt -float0 -ew -P stack -L$IOIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
+   set opt_link=" -C hopt -float0 -ew -P stack -L$MODIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
    set mod_loc_dir="."
    set mod_suffix="mod"
@@ -225,13 +229,13 @@
    if $MODIPSL then
      if $COUPLE then
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -Wl,-f nan, -float0 -ew -P stack -I$NCDFINC $NCDFLIB "
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P stack -I$NCDFINC $NCDFLIB "
+       set opt_link="-L$MODIPSLDIR -lsxioipsl -loasis2.4_mpi2 -Wl,-f nan, -float0 -ew -P stack -I$NCDFINC $NCDFLIB "
+       set opt_link="-L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P stack -I$NCDFINC $NCDFLIB "
 #       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -eC -P stack -I$NCDFINC $NCDFLIB "
      else
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P stack -I$NCDFINC $NCDFLIB "
+       set opt_link="-L$MODIPSLDIR -lsxioipsl -float0 -ew -P stack -I$NCDFINC $NCDFLIB "
      endif
      set mod_loc_dir="./"
    else
-     set opt_link=" -C hopt -float0 -ew -P stack -L$IOIPSLDIR -lioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC "
+     set opt_link=" -C hopt -float0 -ew -P stack -L$MODIPSLDIR -lioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC "
      set mod_loc_dir="."
    endif
@@ -719,6 +723,6 @@
  \cp $IOIPSLDIR/*.mod $libo
 else if $SUN then
- set optim90=" $optim90 -M$libo -M$modipsl/lib "
- set optimtru90=" $optimtru90 -M$libo -M$modipsl/lib "
+ set optim90=" $optim90 -M$libo -M$MODIPSLDIR "
+ set optimtru90=" $optimtru90 -M$libo -M$MODIPSLDIR "
  set optim="$optim90"
  \cp $IOIPSLDIR/*.mod $libo
@@ -797,5 +801,5 @@
 \rm $libf/grid/dimensions.h
 if $MODIPSL then
-  \cp libf/phylmd/oasis.F libf/phylmd/oasis.true
-  \cp libf/phylmd/oasis.dummy libf/phylmd/oasis.F
-endif
+  \cp -p libf/phylmd/oasis.F libf/phylmd/oasis.true
+  \cp -p libf/phylmd/oasis.dummy libf/phylmd/oasis.F
+endif
