Index: trunk/NEMOGCM/NEMO/SAS_SRC/daymod.F90
===================================================================
--- trunk/NEMOGCM/NEMO/SAS_SRC/daymod.F90	(revision 7646)
+++ trunk/NEMOGCM/NEMO/SAS_SRC/daymod.F90	(revision 7761)
@@ -80,8 +80,8 @@
       IF( MOD( rday , 2.  ) /= 0. )   CALL ctl_stop( 'the number of second of in a day must be an even number'    )
       IF( MOD( rdt  , 2.  ) /= 0. )   CALL ctl_stop( 'the time step (in second) must be an even number'           )
-      nsecd   = NINT(rday         )
-      nsecd05 = NINT(0.5 * rday   )
-      ndt     = NINT(      rdt    )
-      ndt05   = NINT(0.5 * rdt    )
+      nsecd   = NINT(rday       )
+      nsecd05 = NINT(0.5 * rday )
+      ndt     = NINT(      rdt  )
+      ndt05   = NINT(0.5 * rdt  )
 
       ! ==> clem: here we read the ocean restart for the date (only if it exists)
Index: trunk/NEMOGCM/NEMO/SAS_SRC/diawri.F90
===================================================================
--- trunk/NEMOGCM/NEMO/SAS_SRC/diawri.F90	(revision 7646)
+++ trunk/NEMOGCM/NEMO/SAS_SRC/diawri.F90	(revision 7761)
@@ -40,4 +40,6 @@
 #if defined key_lim2
    USE limwri_2 
+#elif defined key_lim3
+   USE limwri
 #endif
    USE lib_mpp         ! MPP library
@@ -80,5 +82,5 @@
    !!   Default option                                   NetCDF output file
    !!----------------------------------------------------------------------
-#if defined key_iomput
+# if defined key_iomput
    !!----------------------------------------------------------------------
    !!   'key_iomput'                                        use IOM library
@@ -95,8 +97,13 @@
       !! ** Method  :  use iom_put
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
+      !!
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
       !!----------------------------------------------------------------------
       ! 
-      !! no relevant 2D arrays to write in iomput case
+      ! Output the initial state and forcings
+      IF( ninist == 1 ) THEN
+         CALL dia_wri_state( 'output.init', kt )
+         ninist = 0
+      ENDIF
       !
    END SUBROUTINE dia_wri
@@ -392,4 +399,6 @@
 #if defined key_lim2
       CALL lim_wri_state_2( kt, id_i, nh_i )
+#elif defined key_lim3
+      CALL lim_wri_state( kt, id_i, nh_i )
 #else
       CALL histend( id_i, snc4chunks=snc4set )
Index: trunk/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90
===================================================================
--- trunk/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 7646)
+++ trunk/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 7761)
@@ -308,5 +308,5 @@
       jpim1 = jpi-1                                            ! inner domain indices
       jpjm1 = jpj-1                                            !   "           "
-      jpkm1 = jpk-1                                            !   "           "
+      jpkm1 = MAX( 1, jpk-1 )                                  !   "           "
       jpij  = jpi*jpj                                          !  jpi x j
 
@@ -370,5 +370,5 @@
       !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules. 
       !           This is not clean and should be changed in the future. 
-                            CALL     bdy_init
+                            CALL bdy_init
       ! ==>
                             CALL icb_init( rdt, nit000)   ! initialise icebergs instance
Index: trunk/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90
===================================================================
--- trunk/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90	(revision 7646)
+++ trunk/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90	(revision 7761)
@@ -88,11 +88,19 @@
          ! 
          IF( ln_3d_uve ) THEN
-            IF( .NOT. ln_linssh )   e3t_m(:,:) = sf_ssm_3d(jf_e3t)%fnow(:,:,1) * tmask(:,:,1)    ! v-velocity 
-                                    ssu_m(:,:) = sf_ssm_3d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity
-                                    ssv_m(:,:) = sf_ssm_3d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity 
+            IF( .NOT. ln_linssh ) THEN
+               e3t_m(:,:) = sf_ssm_3d(jf_e3t)%fnow(:,:,1) * tmask(:,:,1) ! vertical scale factor 
+            ELSE
+               e3t_m(:,:) = e3t_0(:,:,1)                                 ! vertical scale factor
+            ENDIF
+            ssu_m(:,:) = sf_ssm_3d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity
+            ssv_m(:,:) = sf_ssm_3d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity 
          ELSE
-            IF( .NOT. ln_linssh )   e3t_m(:,:) = sf_ssm_2d(jf_e3t)%fnow(:,:,1) * tmask(:,:,1)    ! v-velocity 
-                                    ssu_m(:,:) = sf_ssm_2d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity
-                                    ssv_m(:,:) = sf_ssm_2d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity 
+            IF( .NOT. ln_linssh ) THEN
+               e3t_m(:,:) = sf_ssm_2d(jf_e3t)%fnow(:,:,1) * tmask(:,:,1) ! vertical scale factor 
+            ELSE
+               e3t_m(:,:) = e3t_0(:,:,1)                                 ! vertical scale factor
+            ENDIF
+            ssu_m(:,:) = sf_ssm_2d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity
+            ssv_m(:,:) = sf_ssm_2d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity 
          ENDIF
          !
@@ -111,7 +119,7 @@
          ssv_m(:,:) = 0._wp
          ssh_m(:,:) = 0._wp
-         e3t_m(:,:) = e3t_0(:,:,1) !clem: necessary at least for sas2D
-         frq_m(:,:) = 1._wp        !              - -
-         sshn (:,:) = 0._wp        !              - -
+         IF( .NOT. ln_linssh ) e3t_m(:,:) = e3t_0(:,:,1) !clem: necessary at least for sas2D
+         frq_m(:,:) = 1._wp                              !              - -
+         sshn (:,:) = 0._wp                              !              - -
       ENDIF
       
@@ -173,5 +181,5 @@
       NAMELIST/namsbc_sas/l_sasread, cn_dir, ln_3d_uve, ln_read_frq, sn_tem, sn_sal, sn_usp, sn_vsp, sn_ssh, sn_e3t, sn_frq
       !!----------------------------------------------------------------------
-      
+
       IF( ln_rstart .AND. nn_components == jp_iam_sas ) RETURN
       
@@ -306,5 +314,4 @@
  
       CALL sbc_ssm( nit000 )   ! need to define ss?_m arrays used in limistate
-      IF( .NOT. ln_read_frq )   frq_m(:,:) = 1.
       l_initdone = .TRUE.
       !
Index: trunk/NEMOGCM/NEMO/SAS_SRC/step.F90
===================================================================
--- trunk/NEMOGCM/NEMO/SAS_SRC/step.F90	(revision 7646)
+++ trunk/NEMOGCM/NEMO/SAS_SRC/step.F90	(revision 7761)
@@ -53,5 +53,5 @@
 
 #if defined key_agrif
-   SUBROUTINE stp( )
+   RECURSIVE SUBROUTINE stp( )
       INTEGER             ::   kstp   ! ocean time-step index
 #else
