Index: LMDZ.3.3/branches/rel-LF/libf/dyn3d/create_limit.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/dyn3d/create_limit.F	(revision 97)
+++ LMDZ.3.3/branches/rel-LF/libf/dyn3d/create_limit.F	(revision 99)
@@ -13,4 +13,5 @@
 c Modifie par L. Fairhead (fairhead@lmd.jussieu.fr) septembre 1999
 c                         pour lecture netcdf dans LMDZ.3.3
+c modifie par P. Braconnot pour utiliser la version sous-surfaces
 c-------------------------------------------------------------
 c
@@ -35,8 +36,18 @@
       REAL phy_rug(klon,360)
       REAL phy_ice(klon,360)
+CPB
+      REAL phy_icet(klon,360)
+      REAL phy_oce(klon,360)
+      REAL verif
 c
       REAL masque(iip1,jjp1)
       REAL mask(iim,jjp1)
-
+CPB
+C newlmt indique l'utilisation de la sous-maille fractionnelle
+C tandis que l'ancien codage utilise l'indicateur du sol (0,1,2,3)
+      LOGICAL newlmt, fracterre
+      PARAMETER(newlmt=.TRUE.)
+      PARAMETER(fracterre = .TRUE.) 
+CPB
 C Declarations pour le champ de depart
       INTEGER imdep, jmdep,lmdep
@@ -52,5 +63,5 @@
       REAL champ_msk(ibid_msk*jbid_msk)
       REAL dlon_msk(ibid_msk), dlat_msk(jbid_msk)
-
+      REAL*4 zbidon(ibid_msk*jbid_msk) 
 C Declarations pour le champ interpole 2D
       REAL champint(iim,jjp1)
@@ -75,4 +86,6 @@
       INTEGER id_tim
       INTEGER id_NAT, id_SST, id_BILS, id_RUG, id_ALB
+CPB
+      INTEGER id_FOCE, id_FSIC, id_FTER, id_FLIC
 
       INTEGER i, j, k, l
@@ -100,4 +113,5 @@
       cpp    = 1004.70885
       dtvr    = daysec/FLOAT(day_step)
+
 c
 ccc      CALL iniconst ( non  indispensable )
@@ -168,8 +182,15 @@
      .             iim, jjp1, rlonv, rlatu, champint)
       CALL gr_int_dyn(champint, masque, iim, jjp1)
-      DO i = 1, iim
-         masque(i,1) = FLOAT(NINT(masque(i,1)))
-         masque(i,jjp1) = FLOAT(NINT(masque(i,jjp1)))
-      ENDDO
+      IF ( fracterre ) THEN
+          DO i = 1, iim
+            masque(i,1) = masque(i,1)
+            masque(i,jjp1) = masque(i,jjp1)
+          END DO
+      ELSE 
+          DO i = 1, iim
+            masque(i,1) = FLOAT(NINT(masque(i,1)))
+            masque(i,jjp1) = FLOAT(NINT(masque(i,jjp1)))
+          END DO
+      ENDIF 
       DO i = 1, iim
       DO j = 1, jjp1
@@ -432,17 +453,113 @@
       ENDDO
 c
+      WRITE(*,*) 'phy_nat'
+      WRITE(*,'(72f4.1)') phy_nat0(1:klon)
+c
       DO k = 1, 360
-         CALL gr_dyn_fi(1, iip1, jjp1, klon,
-     .                  champan(1,1,k), phy_ice(1,k))
-         DO i = 1, klon
-            phy_nat(i,k) = phy_nat0(i)
-            IF ( (phy_ice(i,k) - 0.5).GE.1.e-5 ) THEN
-               IF (NINT(phy_nat0(i)).EQ.0) THEN
-                  phy_nat(i,k) = 3.0
-               ELSE
-                  phy_nat(i,k) = 2.0
-               ENDIF
-            ENDIF
-         ENDDO
+        CALL gr_dyn_fi(1, iip1, jjp1, klon,
+     .      champan(1,1,k), phy_ice(1,k))
+        IF ( newlmt) THEN
+
+CPB  en attendant de mettre fraction de terre
+c
+            WHERE(phy_ice(1:klon, k) .GT. 1.) phy_ice(1 : klon, k) = 1.
+            WHERE(phy_ice(1:klon, k) .LT. 0.) phy_ice(1 : klon, k) = 0.
+            WRITE(*,*) 'phy_ice : ', k
+            WRITE(*,'(72f4.1)') phy_ice(1 : klon, k)
+c 
+            IF (fracterre ) THEN
+                WRITE(*,*) 'passe dans cas fracterre' 
+                DO i = 1, klon
+                  phy_nat(i,k) = phy_nat0(i)
+                  IF (phy_nat0(i) .GE. 0.5 ) THEN
+                      IF(phy_ice(i,k) .GE. 1.e-5) THEN 
+                          IF ( phy_ice(i,k) .LE. phy_nat(i,k)) THEN
+                              phy_oce(i,k) = 1. - phy_nat(i,k)
+                              phy_icet(i,k) = phy_ice(i,k)
+                              phy_ice(i,k) = 0.
+                              phy_nat(i,k)= phy_nat(i,k)- phy_icet(i,k)
+                          ELSE 
+                              phy_oce(i,k) = 1. - phy_ice(i,k)
+                              phy_icet(i,k) = phy_nat(i,k)
+                              phy_nat(i,k) = 0.
+                              phy_ice(i,k) = phy_ice(i,k) 
+     $                            - phy_icet(i,k)
+                          ENDIF 
+                      ELSE
+                          phy_icet(i,k) = 0.
+                          phy_ice(i,k) = 0.
+                          phy_oce(i,k) = 1. - phy_nat(i,k)
+                      ENDIF 
+                  ELSE
+                      phy_oce(i,k) = 1. - phy_nat(i,k)
+                      IF(phy_ice(i,k) .GE. 1.e-5) THEN 
+                          IF( phy_ice(i,k) .LE. phy_oce(i,k) ) THEN 
+                              phy_icet(i,k) = 0.
+                              phy_oce(i,k) = phy_oce(i,k) - phy_ice(i,k)
+                          ELSE
+                              phy_icet(i,k)=phy_ice(i,k) - phy_oce(i,k)
+                              phy_ice(i,k) = phy_oce(i,k)
+                              phy_oce(i,k) = 0.
+                              phy_nat(i,k) = phy_nat(i,k)-phy_icet(i,k)
+                          ENDIF 
+                      ELSE
+                          phy_icet(i,k) = 0.
+                          phy_ice(i,k) = 0.
+                      ENDIF 
+                  ENDIF
+                  verif = phy_nat(i,k) + phy_icet(i,k)+ phy_ice(i,k) 
+     $                + phy_oce(i,k)
+                  IF ( verif .LT. 1. - 1.e-5 .OR. 
+     $                verif .GT. 1 + 1.e-5) THEN  
+                      WRITE(*,*) 'pb sous maille au point : i,k,verif '
+     $                    , i,k,verif
+                  ENDIF 
+                END DO
+            ELSE 
+                DO i = 1, klon
+                  phy_nat(i,k) = phy_nat0(i)
+                  IF (NINT(phy_nat0(i)).EQ.1 ) THEN
+                      IF(phy_ice(i,k) .GE. 1.e-5) THEN 
+                          phy_icet(i,k) = phy_ice(i,k)
+                          phy_ice(i,k) = 0.
+                          phy_nat(i,k) = phy_nat(i,k) - phy_icet(i,k)
+                          phy_oce(i,k) = 0.
+                      ELSE
+                          phy_icet(i,k) = 0.
+                          phy_ice(i,k) = 0.
+                          phy_oce(i,k) = 0.                      
+                      ENDIF 
+                  ELSE 
+                      IF(phy_ice(i,k) .GE. 1.e-5) THEN 
+                          phy_icet(i,k) = 0.
+                          phy_nat(i,k) = 0.
+                          phy_oce(i,k) = 1. - phy_ice(i,k)
+                      ELSE
+                          phy_icet(i,k) = 0.
+                          phy_ice(i,k) = 0.
+                          phy_oce(i,k) = 1.                      
+                      ENDIF 
+                  ENDIF
+                  verif = phy_nat(i,k) + phy_icet(i,k)+ phy_ice(i,k) 
+     $                + phy_oce(i,k)
+                  IF ( verif .LT. 1. - 1.e-5 .OR. 
+     $                verif .GT. 1 + 1.e-5) THEN  
+                      WRITE(*,*) 'pb sous maille au point : i,k,verif '
+     $                    , i,k,verif
+                  ENDIF 
+                END DO
+            ENDIF 
+        ELSE  
+            DO i = 1, klon
+              phy_nat(i,k) = phy_nat0(i)
+              IF ( (phy_ice(i,k) - 0.5).GE.1.e-5 ) THEN
+                  IF (NINT(phy_nat0(i)).EQ.0) THEN
+                      phy_nat(i,k) = 3.0
+                  ELSE
+                      phy_nat(i,k) = 2.0
+                  ENDIF
+              ENDIF
+            END DO
+        ENDIF 
       ENDDO
 c
@@ -721,25 +838,40 @@
       dims(2) = ntim
 c
-ccc      ierr = NF_DEF_VAR (nid, "TEMPS", NF_DOUBLE, 1,ntim, id_tim)
       ierr = NF_DEF_VAR (nid, "TEMPS", NF_FLOAT, 1,ntim, id_tim)
       ierr = NF_PUT_ATT_TEXT (nid, id_tim, "title", 17,
      .                        "Jour dans l annee")
-ccc      ierr = NF_DEF_VAR (nid, "NAT", NF_DOUBLE, 2,dims, id_NAT)
-      ierr = NF_DEF_VAR (nid, "NAT", NF_FLOAT, 2,dims, id_NAT)
-      ierr = NF_PUT_ATT_TEXT (nid, id_NAT, "title", 23,
+      IF (newlmt) THEN
+c
+          ierr = NF_DEF_VAR (nid, "FOCE", NF_FLOAT, 2,dims, id_FOCE)
+          ierr = NF_PUT_ATT_TEXT (nid, id_FOCE, "title", 14,
+     .                        "Fraction ocean")
+c
+          ierr = NF_DEF_VAR (nid, "FSIC", NF_FLOAT, 2,dims, id_FSIC)
+          ierr = NF_PUT_ATT_TEXT (nid, id_FSIC, "title", 21,
+     .                        "Fraction glace de mer")
+c
+          ierr = NF_DEF_VAR (nid, "FTER", NF_FLOAT, 2,dims, id_FTER)
+          ierr = NF_PUT_ATT_TEXT (nid, id_FTER, "title", 14,
+     .                        "Fraction terre")
+c
+          ierr = NF_DEF_VAR (nid, "FLIC", NF_FLOAT, 2,dims, id_FLIC)
+          ierr = NF_PUT_ATT_TEXT (nid, id_FLIC, "title", 17,
+     .                        "Fraction land ice")
+c
+      ELSE 
+          ierr = NF_DEF_VAR (nid, "NAT", NF_FLOAT, 2,dims, id_NAT)
+          ierr = NF_PUT_ATT_TEXT (nid, id_NAT, "title", 23,
      .                        "Nature du sol (0,1,2,3)")
-ccc      ierr = NF_DEF_VAR (nid, "SST", NF_DOUBLE, 2,dims, id_SST)
+      ENDIF 
+C 
       ierr = NF_DEF_VAR (nid, "SST", NF_FLOAT, 2,dims, id_SST)
       ierr = NF_PUT_ATT_TEXT (nid, id_SST, "title", 35,
      .                        "Temperature superficielle de la mer")
-ccc      ierr = NF_DEF_VAR (nid, "BILS", NF_DOUBLE, 2,dims, id_BILS)
       ierr = NF_DEF_VAR (nid, "BILS", NF_FLOAT, 2,dims, id_BILS)
       ierr = NF_PUT_ATT_TEXT (nid, id_BILS, "title", 32,
      .                        "Reference flux de chaleur au sol")
-ccc      ierr = NF_DEF_VAR (nid, "ALB", NF_DOUBLE, 2,dims, id_ALB)
       ierr = NF_DEF_VAR (nid, "ALB", NF_FLOAT, 2,dims, id_ALB)
       ierr = NF_PUT_ATT_TEXT (nid, id_ALB, "title", 19,
      .                        "Albedo a la surface")
-ccc      ierr = NF_DEF_VAR (nid, "RUG", NF_DOUBLE, 2,dims, id_RUG)
       ierr = NF_DEF_VAR (nid, "RUG", NF_FLOAT, 2,dims, id_RUG)
       ierr = NF_PUT_ATT_TEXT (nid, id_RUG, "title", 8,
@@ -757,5 +889,19 @@
 #ifdef NC_DOUBLE
       ierr = NF_PUT_VAR1_DOUBLE (nid,id_tim,k,DBLE(k))
-      ierr = NF_PUT_VARA_DOUBLE (nid,id_NAT,debut,epais,phy_nat(1,k))
+c
+      IF (newlmt ) THEN
+          ierr = NF_PUT_VARA_DOUBLE (nid,id_FOCE,debut,epais
+     $        ,phy_oce(1,k))
+          ierr = NF_PUT_VARA_DOUBLE (nid,id_FSIC,debut,epais
+     $        ,phy_ice(1,k))
+          ierr = NF_PUT_VARA_DOUBLE (nid,id_FTER,debut,epais
+     $        ,phy_nat(1,k))
+          ierr = NF_PUT_VARA_DOUBLE (nid,id_FLIC,debut,epais
+     $        ,phy_icet(1,k))
+      ELSE 
+          ierr = NF_PUT_VARA_DOUBLE (nid,id_NAT,debut,epais
+     $        ,phy_nat(1,k))
+      ENDIF 
+c
       ierr = NF_PUT_VARA_DOUBLE (nid,id_SST,debut,epais,phy_sst(1,k))
       ierr = NF_PUT_VARA_DOUBLE (nid,id_BILS,debut,epais,phy_bil(1,k))
@@ -764,5 +910,17 @@
 #else
       ierr = NF_PUT_VAR1_REAL (nid,id_tim,k,FLOAT(k))
-      ierr = NF_PUT_VARA_REAL (nid,id_NAT,debut,epais,phy_nat(1,k))
+      IF (newlmt ) THEN
+          ierr = NF_PUT_VARA_REAL (nid,id_FOCE,debut,epais
+     $        ,phy_oce(1,k))
+          ierr = NF_PUT_VARA_REAL (nid,id_FSIC,debut,epais
+     $        ,phy_ice(1,k))
+          ierr = NF_PUT_VARA_REAL (nid,id_FTER,debut,epais
+     $        ,phy_nat(1,k))
+          ierr = NF_PUT_VARA_REAL (nid,id_FLIC,debut,epais
+     $        ,phy_icet(1,k))
+      ELSE 
+          ierr = NF_PUT_VARA_REAL (nid,id_NAT,debut,epais
+     $        ,phy_nat(1,k))
+      ENDIF 
       ierr = NF_PUT_VARA_REAL (nid,id_SST,debut,epais,phy_sst(1,k))
       ierr = NF_PUT_VARA_REAL (nid,id_BILS,debut,epais,phy_bil(1,k))
@@ -777,2 +935,3 @@
       STOP
       END
+
Index: LMDZ.3.3/branches/rel-LF/libf/dyn3d/etat0_netcdf.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/dyn3d/etat0_netcdf.F	(revision 97)
+++ LMDZ.3.3/branches/rel-LF/libf/dyn3d/etat0_netcdf.F	(revision 99)
@@ -216,4 +216,5 @@
       !
       varname = 'q'
+      q3d(:,:,:,:) = 0.0
       qd(:,:,:) = 0.0
       WRITE(*,*) 'QSAT min,max:',minval(qsat(:,:,:)),
Index: LMDZ.3.3/branches/rel-LF/libf/dyn3d/gcm.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/dyn3d/gcm.F	(revision 97)
+++ LMDZ.3.3/branches/rel-LF/libf/dyn3d/gcm.F	(revision 99)
@@ -126,5 +126,5 @@
 
       LOGICAL offline  ! Controle du stockage ds "fluxmass"
-      PARAMETER (offline=.true.)
+      PARAMETER (offline=.false.)
 
       character*80 dynhist_file, dynhistave_file
@@ -140,4 +140,5 @@
 c   ----------------
 
+      abort_message = 'last timestep reached'
       modname = 'gcm'
       descript = 'Run GCM LMDZ'
@@ -434,4 +435,8 @@
            ENDIF
 c
+
+c rajout debug
+c        lafin = .true.
+
         CALL calfis( nqmx, lafin ,rdayvrai,rday_ecri,time  ,
      $                 ucov,vcov,teta,q,masse,ps,p,pk,phis,phi ,
@@ -496,4 +501,10 @@
 
       END IF
+
+c ajout debug
+c               IF( lafin ) then  
+c                 abort_message = 'Simulation finished'
+c                 call abort_gcm(modname,abort_message,0)
+c               ENDIF
         
 c   ********************************************************************
Index: LMDZ.3.3/branches/rel-LF/libf/dyn3d/grid_noro.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/dyn3d/grid_noro.F	(revision 97)
+++ LMDZ.3.3/branches/rel-LF/libf/dyn3d/grid_noro.F	(revision 99)
@@ -77,5 +77,6 @@
       REAL zsig(imar+1,jmar),zgam(imar+1,jmar),zthe(imar+1,jmar)
       REAL zpic(imar+1,jmar),zval(imar+1,jmar)
-      integer mask(imar+1,jmar)
+c$$$ PB     integer mask(imar+1,jmar)
+      real mask(imar+1,jmar)
       real num_tot(2200,1100),num_lan(2200,1100)
 c
@@ -257,9 +258,10 @@
          IF (weight(ii,jj) .NE. 0.0) THEN
 c  Mask
-           if(num_lan(ii,jj)/num_tot(ii,jj).ge.0.5)then
-             mask(ii,jj)=1
-           else
-             mask(ii,jj)=0
-           endif
+c$$$           if(num_lan(ii,jj)/num_tot(ii,jj).ge.0.5)then
+c$$$             mask(ii,jj)=1
+c$$$           else
+c$$$             mask(ii,jj)=0
+c$$$           ENDIF
+             mask(ii,jj) = num_lan(ii,jj)/num_tot(ii,jj)
 c  Mean Orography:
            zmea (ii,jj)=zmea (ii,jj)/weight(ii,jj)
@@ -296,6 +298,6 @@
        CALL MVA9(zval,iim+1,jjm+1)
        CALL MVA9(zxtzx,iim+1,jjm+1)
-       CALL MVA9(zxtzy,iim+1,jjm+1)
-       CALL MVA9(zytzy,iim+1,jjm+1)
+       CALL MVA9(zxtzy,iim+1,jjm+1) 
+c$$$       CALL MVA9(zytzy,iim+1,jjm+1)
 
        DO ii = 1, imar
@@ -312,16 +314,27 @@
            if(xq.le.xw) xq=xw
            if(abs(xm).le.xw) xm=xw*sign(1.,xm)
+c$$$c slope: 
+c$$$           zsig(ii,jj)=sqrt(xq)*mask(ii,jj)
+c$$$c isotropy:
+c$$$           zgam(ii,jj)=xp/xq*mask(ii,jj)
+c$$$c angle theta:
+c$$$           zthe(ii,jj)=57.29577951*atan2(xm,xl)/2.*mask(ii,jj)
+c$$$           zphi(ii,jj)=zmea(ii,jj)*mask(ii,jj)
+c$$$           zmea(ii,jj)=zmea(ii,jj)*mask(ii,jj)
+c$$$           zpic(ii,jj)=zpic(ii,jj)*mask(ii,jj)
+c$$$           zval(ii,jj)=zval(ii,jj)*mask(ii,jj)
+c$$$           zstd(ii,jj)=zstd(ii,jj)*mask(ii,jj)
+C$$* PB modif pour maque de terre fractionnaire
 c slope: 
-           zsig(ii,jj)=sqrt(xq)*mask(ii,jj)
+           zsig(ii,jj)=sqrt(xq)
 c isotropy:
-           zgam(ii,jj)=xp/xq*mask(ii,jj)
+           zgam(ii,jj)=xp/xq
 c angle theta:
-           zthe(ii,jj)=57.29577951*atan2(xm,xl)/2.*mask(ii,jj)
-           zphi(ii,jj)=zmea(ii,jj)*mask(ii,jj)
-           zmea(ii,jj)=zmea(ii,jj)*mask(ii,jj)
-           zpic(ii,jj)=zpic(ii,jj)*mask(ii,jj)
-           zval(ii,jj)=zval(ii,jj)*mask(ii,jj)
-           zstd(ii,jj)=zstd(ii,jj)*mask(ii,jj)
-
+           zthe(ii,jj)=57.29577951*atan2(xm,xl)/2.
+c$$$           zphi(ii,jj)=zmea(ii,jj)
+c$$$           zmea(ii,jj)=zmea(ii,jj)
+c$$$           zpic(ii,jj)=zpic(ii,jj)
+c$$$           zval(ii,jj)=zval(ii,jj)
+c$$$           zstd(ii,jj)=zstd(ii,jj)
 c          print 101,ii,jj,
 c    *           zmea(ii,jj),zstd(ii,jj),zsig(ii,jj),zgam(ii,jj),
@@ -421,5 +434,5 @@
       PARAMETER (ISMo=300,JSMo=200)
       REAL X(IMAR,JMAR),XF(ISMo,JSMo)
-      real weight(-1:1,-1:1)
+      real WEIGHTpb(-1:1,-1:1)
 
       if(imar.gt.ismo) stop'surdimensionner ismo dans mva9 (grid_noro)'
@@ -428,50 +441,53 @@
       SUM=0.
       DO IS=-1,1
-      DO JS=-1,1
-      WEIGHT(IS,JS)=1./FLOAT((1+IS**2)*(1+JS**2))
-      SUM=SUM+WEIGHT(IS,JS)
-      ENDDO
-      ENDDO
-
+        DO JS=-1,1
+          WEIGHTpb(IS,JS)=1./FLOAT((1+IS**2)*(1+JS**2))
+          SUM=SUM+WEIGHTpb(IS,JS)
+        ENDDO
+      ENDDO
+      
+      WRITE(*,*) 'MVA9 ', IMAR, JMAR
+      WRITE(*,*) 'MVA9 ', WEIGHTpb
+      WRITE(*,*) 'MVA9 SUM ', SUM
       DO IS=-1,1
-      DO JS=-1,1
-      WEIGHT(IS,JS)=WEIGHT(IS,JS)/SUM
-      ENDDO
+        DO JS=-1,1
+          WEIGHTpb(IS,JS)=WEIGHTpb(IS,JS)/SUM
+        ENDDO
       ENDDO
 
       DO J=2,JMAR-1
-      DO I=2,IMAR-1
-      XF(I,J)=0.
-      DO IS=-1,1
-      DO JS=-1,1
-         XF(I,J)=XF(I,J)+X(I+IS,J+JS)*WEIGHT(IS,JS)
-      ENDDO
-      ENDDO
-      ENDDO
+        DO I=2,IMAR-1
+          XF(I,J)=0.
+          DO IS=-1,1
+            DO JS=-1,1
+              XF(I,J)=XF(I,J)+X(I+IS,J+JS)*WEIGHTpb(IS,JS)
+            ENDDO
+          ENDDO
+        ENDDO
       ENDDO
 
       DO J=2,JMAR-1
-         XF(1,J)=0.
-      IS=IMAR-1
-      DO JS=-1,1 
-         XF(1,J)=XF(1,J)+X(IS,J+JS)*WEIGHT(-1,JS)
-      ENDDO
-      DO IS=0,1 
-      DO JS=-1,1 
-         XF(1,J)=XF(1,J)+X(1+IS,J+JS)*WEIGHT(IS,JS)
-      ENDDO
-      ENDDO
-         XF(IMAR,J)=XF(1,J)
+        XF(1,J)=0.
+        IS=IMAR-1
+        DO JS=-1,1 
+          XF(1,J)=XF(1,J)+X(IS,J+JS)*WEIGHTpb(-1,JS)
+        ENDDO
+        DO IS=0,1 
+          DO JS=-1,1 
+            XF(1,J)=XF(1,J)+X(1+IS,J+JS)*WEIGHTpb(IS,JS)
+          ENDDO
+        ENDDO
+        XF(IMAR,J)=XF(1,J)
       ENDDO
 
       DO I=1,IMAR
-      XF(I,1)=XF(I,2)
-      XF(I,JMAR)=XF(I,JMAR-1)
+        XF(I,1)=XF(I,2)
+        XF(I,JMAR)=XF(I,JMAR-1)
       ENDDO
 
       DO I=1,IMAR
-      DO J=1,JMAR
-         X(I,J)=XF(I,J)
-      ENDDO
+        DO J=1,JMAR
+          X(I,J)=XF(I,J)
+        ENDDO
       ENDDO
 
Index: LMDZ.3.3/branches/rel-LF/libf/dyn3d/startvar.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/dyn3d/startvar.F	(revision 97)
+++ LMDZ.3.3/branches/rel-LF/libf/dyn3d/startvar.F	(revision 99)
@@ -314,9 +314,12 @@
     !
       CALL grid_noro(iml_rel, jml_rel, lon_rad, lat_rad, relief_hi,
-     . iml-1, jml, lon_in, lat_in, 
-     . phis, relief, zstd, zsig, zgam, zthe, zpic, zval, tmp_int)
+     $    iml-1, jml, lon_in, lat_in, 
+    !     . phis, relief, zstd, zsig, zgam, zthe, zpic, zval, tmp_int)
+    ! PB masque avec % terre mai 2000
+     $    phis, relief, zstd, zsig, zgam, zthe, zpic, zval, masque)
       phis = phis * 9.81
     !
-      masque(:,:) = FLOAT(tmp_int(:,:))
+    !PB supression ligne suivant pour masque avec % terre
+    !     masque(:,:) = FLOAT(tmp_int(:,:))
     !
     !  Compute surface roughness
@@ -392,4 +395,15 @@
               ENDIF
               CALL gr_dyn_fi(1, iml, jml, nbindex, psol_dyn, champ)
+    ! PB ajout pour masque terre mer fractionneiare    
+          CASE ('zmasq')
+              IF (.NOT. ALLOCATED(masque) ) THEN
+                  CALL start_init_orog ( iml, jml,lon_in, lat_in)
+              ENDIF
+              IF ( SIZE(masque) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
+                WRITE(*,*)
+     . 'STARTVAR module has been initialized to the wrong size'
+                 STOP
+             ENDIF
+             CALL gr_dyn_fi(1, iml, jml, nbindex, masque, champ)
             CASE ('zmea')
               IF ( .NOT.ALLOCATED(relief)) THEN
Index: LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h	(revision 97)
+++ LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h	(revision 99)
@@ -1,4 +1,4 @@
-c-----------------------------------------------------------------------
-c INCLUDE 'temps.h'
+!-----------------------------------------------------------------------
+! INCLUDE 'temps.h'
 
       COMMON/temps/itaufin,dt,
@@ -9,3 +9,3 @@
       REAL     dt
 
-c-----------------------------------------------------------------------
+!-----------------------------------------------------------------------
