Index: /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/namelist
===================================================================
--- /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/namelist	(revision 3361)
+++ /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/namelist	(revision 3362)
@@ -152,9 +152,11 @@
 !              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_tem      = 'sas_grid_T' ,    120    , 'votemper' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_sal      = 'sas_grid_T' ,    120    , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_uwd      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_vwd      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-
+   sn_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+
+   ln_3d_uv    = .true.    !  specify whether we are supplying a 3D u,v field
    cn_dir      = './'      !  root directory for the location of the bulk files are
 /
Index: /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90
===================================================================
--- /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 3361)
+++ /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 3362)
@@ -53,5 +53,5 @@
    USE mod_ioclient
 #endif
-   USE sbcsas
+   USE sbcssm
 
    IMPLICIT NONE
@@ -256,5 +256,5 @@
                             CALL day_init   ! model calendar (using both namelist and restart infos)
 
-                            CALL sbc_sas_init   ! initialise standalone scheme
+                            CALL sbc_ssm_sas_init   ! initialise standalone scheme
                             CALL sbc_init   ! Forcings : surface module 
       
Index: anches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcmod.F90
===================================================================
--- /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcmod.F90	(revision 3361)
+++ 	(revision )
@@ -1,358 +1,0 @@
-MODULE sbcmod
-   !!======================================================================
-   !!                       ***  MODULE  sbcmod  ***
-   !! Surface module :  provide to the ocean its surface boundary condition
-   !!======================================================================
-   !! History :  3.0  ! 2006-07  (G. Madec)  Original code
-   !!            3.1  ! 2008-08  (S. Masson, A. Caubel, E. Maisonnave, G. Madec) coupled interface
-   !!            3.3  ! 2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps
-   !!            3.3  ! 2010-10  (S. Masson)  add diurnal cycle
-   !!            3.3  ! 2010-09  (D. Storkey) add ice boundary conditions (BDY)
-   !!             -   ! 2010-11  (G. Madec) ice-ocean stress always computed at each ocean time-step
-   !!             -   ! 2010-10  (J. Chanut, C. Bricaud, G. Madec)  add the surface pressure forcing
-   !!            3.4  ! 2011-11  (C. Harris) CICE added as an option
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   sbc_init       : read namsbc namelist
-   !!   sbc            : surface ocean momentum, heat and freshwater boundary conditions
-   !!----------------------------------------------------------------------
-   USE oce              ! ocean dynamics and tracers
-   USE dom_oce          ! ocean space and time domain
-   USE phycst           ! physical constants
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice fields
-   USE sbcdcy           ! surface boundary condition: diurnal cycle
-   USE sbcssm           ! surface boundary condition: sea-surface mean variables
-   USE sbcapr           ! surface boundary condition: atmospheric pressure
-   USE sbcana           ! surface boundary condition: analytical formulation
-   USE sbcflx           ! surface boundary condition: flux formulation
-   USE sbcblk_clio      ! surface boundary condition: bulk formulation : CLIO
-   USE sbcblk_core      ! surface boundary condition: bulk formulation : CORE
-   USE sbcblk_mfs       ! surface boundary condition: bulk formulation : MFS
-   USE sbcice_if        ! surface boundary condition: ice-if sea-ice model
-   USE sbcice_lim       ! surface boundary condition: LIM 3.0 sea-ice model
-   USE sbcice_lim_2     ! surface boundary condition: LIM 2.0 sea-ice model
-   USE sbcice_cice      ! surface boundary condition: CICE    sea-ice model
-   USE sbccpl           ! surface boundary condition: coupled florulation
-   USE cpl_oasis3, ONLY:lk_cpl      ! are we in coupled mode?
-   USE sbcssr           ! surface boundary condition: sea surface restoring
-   USE sbcrnf           ! surface boundary condition: runoffs
-   USE sbcfwb           ! surface boundary condition: freshwater budget
-   USE closea           ! closed sea
-
-   USE prtctl           ! Print control                    (prt_ctl routine)
-   USE restart          ! ocean restart
-   USE iom              ! IOM library
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE timing           ! Timing
-   USE sbcwave          ! Wave module
-   USE sbcsas
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   sbc        ! routine called by step.F90
-   PUBLIC   sbc_init   ! routine called by opa.F90
-   
-   INTEGER ::   nsbc   ! type of surface boundary condition (deduced from namsbc informations)
-      
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 4.0 , NEMO-consortium (2011) 
-   !! $Id: sbcmod.F90 3294 2012-01-28 16:44:18Z rblod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE sbc_init
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE sbc_init ***
-      !!
-      !! ** Purpose :   Initialisation of the ocean surface boundary computation
-      !!
-      !! ** Method  :   Read the namsbc namelist and set derived parameters
-      !!
-      !! ** Action  : - read namsbc parameters
-      !!              - nsbc: type of sbc
-      !!----------------------------------------------------------------------
-      INTEGER ::   icpt   ! local integer
-      !!
-      NAMELIST/namsbc/ nn_fsbc   , ln_ana , ln_flx  , ln_blk_clio, ln_blk_core, ln_cpl,   &
-         &             ln_blk_mfs, ln_apr_dyn, nn_ice , ln_dm2dc, ln_rnf, ln_ssr     , nn_fwb, ln_cdgw
-      !!----------------------------------------------------------------------
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'sbc_init : surface boundary condition setting'
-         WRITE(numout,*) '~~~~~~~~ '
-      ENDIF
-
-      REWIND( numnam )           ! Read Namelist namsbc
-      READ  ( numnam, namsbc )
-
-      !                          ! overwrite namelist parameter using CPP key information
-      IF( Agrif_Root() ) THEN                ! AGRIF zoom
-        IF( lk_lim2 )   nn_ice      = 2
-        IF( lk_lim3 )   nn_ice      = 3
-        IF( lk_cice )   nn_ice      = 4
-      ENDIF
-      IF( cp_cfg == 'gyre' ) THEN            ! GYRE configuration
-          ln_ana      = .TRUE.   
-          nn_ice      =   0
-      ENDIF
-      IF( ln_cpl ) THEN
-         IF( lwp ) WRITE(numout,*) 'Coupled mode not sensible with StandAlone Surface scheme'
-         ln_cpl = .FALSE.
-      ENDIF
-      IF( ln_apr_dyn ) THEN
-         IF( lwp ) WRITE(numout,*) 'No atmospheric gradient needed with StandAlone Surface scheme'
-         ln_apr_dyn = .FALSE.
-      ENDIF
-      IF( ln_dm2dc ) THEN
-         IF( lwp ) WRITE(numout,*) 'No diurnal cycle needed with StandAlone Surface scheme'
-         ln_dm2dc = .FALSE.
-      ENDIF
-      IF( ln_rnf ) THEN
-         IF( lwp ) WRITE(numout,*) 'No runoff needed with StandAlone Surface scheme'
-         ln_rnf = .FALSE.
-      ENDIF
-      IF( ln_ssr ) THEN
-         IF( lwp ) WRITE(numout,*) 'No surface relaxation needed with StandAlone Surface scheme'
-         ln_ssr = .FALSE.
-      ENDIF
-      IF( nn_fwb > 0 ) THEN
-         IF( lwp ) WRITE(numout,*) 'No freshwater budget adjustment needed with StandAlone Surface scheme'
-         nn_fwb = 0
-      ENDIF
-      IF( nn_closea > 0 ) THEN
-         IF( lwp ) WRITE(numout,*) 'No closed seas adjustment needed with StandAlone Surface scheme'
-         nn_closea = 0
-      ENDIF
-      
-      IF(lwp) THEN               ! Control print
-         WRITE(numout,*) '        Namelist namsbc (partly overwritten with CPP key setting)'
-         WRITE(numout,*) '           frequency update of sbc (and ice)             nn_fsbc     = ', nn_fsbc
-         WRITE(numout,*) '           Type of sbc : '
-         WRITE(numout,*) '              analytical formulation                     ln_ana      = ', ln_ana
-         WRITE(numout,*) '              flux       formulation                     ln_flx      = ', ln_flx
-         WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_clio = ', ln_blk_clio
-         WRITE(numout,*) '              CORE bulk  formulation                     ln_blk_core = ', ln_blk_core
-         WRITE(numout,*) '              MFS  bulk  formulation                     ln_blk_mfs  = ', ln_blk_mfs
-         WRITE(numout,*) '              coupled    formulation (T if key_sbc_cpl)  ln_cpl      = ', ln_cpl
-         WRITE(numout,*) '           Misc. options of sbc : '
-         WRITE(numout,*) '              Patm gradient added in ocean & ice Eqs.    ln_apr_dyn  = ', ln_apr_dyn
-         WRITE(numout,*) '              ice management in the sbc (=0/1/2/3)       nn_ice      = ', nn_ice 
-         WRITE(numout,*) '              daily mean to diurnal cycle qsr            ln_dm2dc    = ', ln_dm2dc 
-         WRITE(numout,*) '              runoff / runoff mouths                     ln_rnf      = ', ln_rnf
-         WRITE(numout,*) '              Sea Surface Restoring on SST and/or SSS    ln_ssr      = ', ln_ssr
-         WRITE(numout,*) '              FreshWater Budget control  (=0/1/2)        nn_fwb      = ', nn_fwb
-         WRITE(numout,*) '              closed sea (=0/1) (set in namdom)          nn_closea   = ', nn_closea
-      ENDIF
-
-      !                              ! allocate sbc arrays
-      IF( sbc_oce_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_oce arrays' )
-
-      !                          ! Checks:
-      IF( .NOT. ln_rnf ) THEN                      ! no specific treatment in vicinity of river mouths 
-         ln_rnf_mouth  = .false.                      
-         IF( sbc_rnf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_rnf arrays' )
-         nkrnf         = 0
-         rnf     (:,:) = 0.e0
-         rnfmsk  (:,:) = 0.e0
-         rnfmsk_z(:)   = 0.e0
-      ENDIF
-      IF( nn_ice == 0  )   fr_i(:,:) = 0.e0        ! no ice in the domain, ice fraction is always zero
-
-      !                                            ! restartability   
-      IF( MOD( rday, REAL(nn_fsbc, wp) * rdt ) /= 0 )   &
-         &  CALL ctl_warn( 'nn_fsbc is NOT a multiple of the number of time steps in a day' )
-      !
-      IF( ( nn_ice == 2 .OR. nn_ice ==3 ) .AND. .NOT.( ln_blk_clio .OR. ln_blk_core .OR. lk_cpl ) )   &
-         &   CALL ctl_stop( 'LIM sea-ice model requires a bulk formulation or coupled configuration' )
-      IF( nn_ice == 4 .AND. .NOT.( ln_blk_core .OR. lk_cpl ) )   &
-         &   CALL ctl_stop( 'CICE sea-ice model requires ln_blk_core or lk_cpl' )
-      IF( nn_ice == 4 .AND. ( .NOT. ( cp_cfg == 'orca' ) .OR. lk_agrif ) )   &
-         &   CALL ctl_stop( 'CICE sea-ice model currently only available in a global ORCA configuration without AGRIF' )
-      
-       !drag coefficient read from wave model definable only with mfs bulk formulae and core 
-       IF(ln_cdgw .AND. .NOT.(ln_blk_mfs .OR. ln_blk_core) )              &
-          &   CALL ctl_stop( 'drag coefficient read from wave model definable only with mfs bulk formulae and core')
-      
-      !                          ! Choice of the Surface Boudary Condition (set nsbc)
-      icpt = 0
-      IF( ln_ana          ) THEN   ;   nsbc =  1   ; icpt = icpt + 1   ;   ENDIF       ! analytical      formulation
-      IF( ln_flx          ) THEN   ;   nsbc =  2   ; icpt = icpt + 1   ;   ENDIF       ! flux            formulation
-      IF( ln_blk_clio     ) THEN   ;   nsbc =  3   ; icpt = icpt + 1   ;   ENDIF       ! CLIO bulk       formulation
-      IF( ln_blk_core     ) THEN   ;   nsbc =  4   ; icpt = icpt + 1   ;   ENDIF       ! CORE bulk       formulation
-      IF( ln_blk_mfs      ) THEN   ;   nsbc =  6   ; icpt = icpt + 1   ;   ENDIF       ! MFS  bulk       formulation
-      IF( ln_cpl          ) THEN   ;   nsbc =  5   ; icpt = icpt + 1   ;   ENDIF       ! Coupled         formulation
-      IF( cp_cfg == 'gyre') THEN   ;   nsbc =  0                       ;   ENDIF       ! GYRE analytical formulation
-      IF( lk_esopa        )            nsbc = -1                                       ! esopa test, ALL formulations
-      !
-      IF( icpt /= 1 .AND. .NOT.lk_esopa ) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) '           E R R O R in setting the sbc, one and only one namelist/CPP key option '
-         WRITE(numout,*) '                     must be choosen. You choose ', icpt, ' option(s)'
-         WRITE(numout,*) '                     We stop'
-         nstop = nstop + 1
-      ENDIF
-      IF(lwp) THEN
-         WRITE(numout,*)
-         IF( nsbc == -1 )   WRITE(numout,*) '              ESOPA test All surface boundary conditions'
-         IF( nsbc ==  0 )   WRITE(numout,*) '              GYRE analytical formulation'
-         IF( nsbc ==  1 )   WRITE(numout,*) '              analytical formulation'
-         IF( nsbc ==  2 )   WRITE(numout,*) '              flux formulation'
-         IF( nsbc ==  3 )   WRITE(numout,*) '              CLIO bulk formulation'
-         IF( nsbc ==  4 )   WRITE(numout,*) '              CORE bulk formulation'
-         IF( nsbc ==  5 )   WRITE(numout,*) '              coupled formulation'
-         IF( nsbc ==  6 )   WRITE(numout,*) '              MFS Bulk formulation'
-      ENDIF
-
-      IF( nn_ice == 4 )   CALL cice_sbc_init (nsbc)
-      !
-   END SUBROUTINE sbc_init
-
-
-   SUBROUTINE sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE sbc  ***
-      !!              
-      !! ** Purpose :   provide at each time-step the ocean surface boundary
-      !!                condition (momentum, heat and freshwater fluxes)
-      !!
-      !! ** Method  :   blah blah  to be written ????????? 
-      !!                CAUTION : never mask the surface stress field (tke sbc)
-      !!
-      !! ** Action  : - set the ocean surface boundary condition at before and now 
-      !!                time step, i.e.  
-      !!                utau_b, vtau_b, qns_b, qsr_b, emp_n, emps_b, qrp_b, erp_b
-      !!                utau  , vtau  , qns  , qsr  , emp  , emps  , qrp  , erp
-      !!              - updte the ice fraction : fr_i
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt       ! ocean time step
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc')
-      !
-      !                                            ! ---------------------------------------- !
-      IF( kt /= nit000 ) THEN                      !          Swap of forcing fields          !
-         !                                         ! ---------------------------------------- !
-         utau_b(:,:) = utau(:,:)                         ! Swap the ocean forcing fields
-         vtau_b(:,:) = vtau(:,:)                         ! (except at nit000 where before fields
-         qns_b (:,:) = qns (:,:)                         !  are set at the end of the routine)
-         ! The 3D heat content due to qsr forcing is treated in traqsr
-         ! qsr_b (:,:) = qsr (:,:)
-         emp_b (:,:) = emp (:,:)
-         emps_b(:,:) = emps(:,:)
-      ENDIF
-      !                                            ! ---------------------------------------- !
-      !                                            !        forcing field computation         !
-      !                                            ! ---------------------------------------- !
-
-      CALL iom_setkt( kt + nn_fsbc - 1 )                 ! in sbc, iom_put is called every nn_fsbc time step
-      !
-      CALL sbc_sas( kt )                                 ! ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m)
-      !                                                  ! averaged over nf_sbc time-step
-
-      IF (ln_cdgw) CALL sbc_wave( kt )
-                                                   !==  sbc formulation  ==!
-                                                            
-      SELECT CASE( nsbc )                                ! Compute ocean surface boundary condition
-      !                                                  ! (i.e. utau,vtau, qns, qsr, emp, emps)
-      CASE(  0 )   ;   CALL sbc_gyre    ( kt )                    ! analytical formulation : GYRE configuration
-      CASE(  1 )   ;   CALL sbc_ana     ( kt )                    ! analytical formulation : uniform sbc
-      CASE(  2 )   ;   CALL sbc_flx     ( kt )                    ! flux formulation
-      CASE(  3 )   ;   CALL sbc_blk_clio( kt )                    ! bulk formulation : CLIO for the ocean
-      CASE(  4 )   ;   CALL sbc_blk_core( kt )                    ! bulk formulation : CORE for the ocean
-      CASE(  5 )   ;   CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! coupled formulation
-      CASE(  6 )   ;   CALL sbc_blk_mfs ( kt )                    ! bulk formulation : MFS for the ocean
-      CASE( -1 )                                
-                       CALL sbc_ana     ( kt )                    ! ESOPA, test ALL the formulations
-                       CALL sbc_gyre    ( kt )                    !
-                       CALL sbc_flx     ( kt )                    !
-                       CALL sbc_blk_clio( kt )                    !
-                       CALL sbc_blk_core( kt )                    !
-                       CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   !
-      END SELECT
-
-      !                                            !==  Misc. Options  ==!
-      
-      SELECT CASE( nn_ice )                                     ! Update heat and freshwater fluxes over sea-ice areas
-      CASE(  1 )   ;       CALL sbc_ice_if   ( kt )                  ! Ice-cover climatology ("Ice-if" model)
-         !                                                      
-      CASE(  2 )   ;       CALL sbc_ice_lim_2( kt, nsbc )            ! LIM-2 ice model
-         !                                                     
-      CASE(  3 )   ;       CALL sbc_ice_lim  ( kt, nsbc )            ! LIM-3 ice model
-         !
-      CASE(  4 )   ;       CALL sbc_ice_cice ( kt, nsbc )            ! CICE ice model
-      END SELECT                                              
-
-!RBbug do not understand why see ticket 667
-      CALL lbc_lnk( emp, 'T', 1. )
-      !
-      IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
-         !                                             ! ---------------------------------------- !
-         IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields set to nit000'
-         utau_b(:,:) = utau(:,:) 
-         vtau_b(:,:) = vtau(:,:)
-         qns_b (:,:) = qns (:,:)
-         ! qsr_b (:,:) = qsr (:,:)
-         emp_b (:,:) = emp (:,:)
-         emps_b(:,:) = emps(:,:)
-      ENDIF
-      !                                                ! ---------------------------------------- !
-      !                                                !        Outputs and control print         !
-      !                                                ! ---------------------------------------- !
-      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
-         CALL iom_put( "empmr" , emp  - rnf )                   ! upward water flux
-         CALL iom_put( "empsmr", emps - rnf )                   ! c/d water flux
-         CALL iom_put( "qt"    , qns  + qsr )                   ! total heat flux 
-         CALL iom_put( "qns"   , qns        )                   ! solar heat flux
-         CALL iom_put( "qsr"   ,       qsr  )                   ! solar heat flux
-         IF( nn_ice > 0 )   CALL iom_put( "ice_cover", fr_i )   ! ice fraction 
-      ENDIF
-      !
-      CALL iom_setkt( kt )           ! iom_put outside of sbc is called at every time step
-      !
-      CALL iom_put( "utau", utau )   ! i-wind stress   (stress can be updated at 
-      CALL iom_put( "vtau", vtau )   ! j-wind stress    each time step in sea-ice)
-      CALL iom_put( "taum", taum )   ! wind stress module 
-      CALL iom_put( "wspd", wndm )   ! wind speed  module 
-      !
-      IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-         CALL prt_ctl(tab2d_1=fr_i             , clinfo1=' fr_i     - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=(emp-rnf)        , clinfo1=' emp-rnf  - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=(emps-rnf)       , clinfo1=' emps-rnf - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=qns              , clinfo1=' qns      - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr      - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab3d_1=tmask            , clinfo1=' tmask    - : ', mask1=tmask, ovlap=1, kdim=jpk )
-         CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_tem), clinfo1=' sst      - : ', mask1=tmask, ovlap=1, kdim=1   )
-         CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_sal), clinfo1=' sss      - : ', mask1=tmask, ovlap=1, kdim=1   )
-         CALL prt_ctl(tab2d_1=utau             , clinfo1=' utau     - : ', mask1=umask,                      &
-            &         tab2d_2=vtau             , clinfo2=' vtau     - : ', mask2=vmask, ovlap=1 )
-      ENDIF
-
-      IF( kt == nitend )   CALL sbc_final         ! Close down surface module if necessary
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc')
-      !
-   END SUBROUTINE sbc
-
-   SUBROUTINE sbc_final
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE sbc_final  ***
-      !!---------------------------------------------------------------------
-
-      !-----------------------------------------------------------------
-      ! Finalize CICE (if used)
-      !-----------------------------------------------------------------
-
-      IF( nn_ice == 4 )   CALL cice_sbc_final
-      !
-   END SUBROUTINE sbc_final
-
-   !!======================================================================
-END MODULE sbcmod
Index: anches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcsas.F90
===================================================================
--- /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcsas.F90	(revision 3361)
+++ 	(revision )
@@ -1,186 +1,0 @@
-MODULE sbcsas
-   !!======================================================================
-   !!                       ***  MODULE  sbcsas  ***
-   !! Off-line : interpolation of the physical fields
-   !!======================================================================
-   !! History : 
-   !!   NEMO         3.4  ! 2012-03 First version by S. Alderson 
-   !!                     !         Heavily derived from Christian's dtadyn routine
-   !!                     !         in OFF_SRC
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   sbc_sas_init : initialization, namelist read, and SAVEs control
-   !!   sbc_sas      : Interpolation of the fields
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers variables
-   USE c1d             ! 1D configuration: lk_c1d
-   USE dom_oce         ! ocean domain: variables
-   USE zdf_oce         ! ocean vertical physics: variables
-   USE sbc_oce         ! surface module: variables
-   USE phycst          ! physical constants
-   USE eosbn2          ! equation of state - Brunt Vaisala frequency
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE zpshde          ! z-coord. with partial steps: horizontal derivatives
-   USE in_out_manager  ! I/O manager
-   USE iom             ! I/O library
-   USE lib_mpp         ! distributed memory computing library
-   USE prtctl          ! print control
-   USE fldread         ! read input fields 
-   USE timing          ! Timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   sbc_sas_init   ! called by opa.F90
-   PUBLIC   sbc_sas        ! called by step.F90
-
-   CHARACTER(len=100) ::   cn_dir     = './'    !: Root directory for location of sas files
-
-   INTEGER  , PARAMETER ::   jpfld = 4      ! maximum number of files to read
-   INTEGER  , SAVE      ::   jf_tem         ! index of temperature
-   INTEGER  , SAVE      ::   jf_sal         ! index of salinity
-   INTEGER  , SAVE      ::   jf_uwd         ! index of u-wind
-   INTEGER  , SAVE      ::   jf_vwd         ! index of v-wind
-
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_sas  ! structure of input fields (file information, fields read)
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OFF 3.3 , NEMO Consortium (2010)
-   !! $Id: sbcsas.F90 3294 2012-01-28 16:44:18Z rblod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE sbc_sas( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_sas  ***
-      !!
-      !! ** Purpose :  Prepares dynamics and physics fields from a NEMO run
-      !!               for an off-line simulation using surface processes only
-      !!
-      !! ** Method : calculates the position of data 
-      !!             - interpolates data if needed
-      !!----------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      !
-      INTEGER  ::   ji, jj     ! dummy loop indices
-      REAL(wp) ::   ztinta     ! ratio applied to after  records when doing time interpolation
-      REAL(wp) ::   ztintb     ! ratio applied to before records when doing time interpolation
-      !!----------------------------------------------------------------------
-      
-      !
-      IF( nn_timing == 1 )  CALL timing_start( 'sbc_sas')
-      !
-      CALL fld_read( kt, 1, sf_sas )      !==   read data at kt time step   ==!
-      ! 
-      sst_m(:,:) = sf_sas(jf_tem)%fnow(:,:,1) * tmask(:,:,1)    ! temperature
-      sss_m(:,:) = sf_sas(jf_sal)%fnow(:,:,1) * tmask(:,:,1)    ! salinity
-      !
-      ssu_m(:,:) = sf_sas(jf_uwd)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity
-      ssv_m(:,:) = sf_sas(jf_vwd)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity 
-      !
-      tsn(:,:,1,jp_tem) = sst_m(:,:)
-      tsn(:,:,1,jp_sal) = sss_m(:,:)
-      ub (:,:,1       ) = ssu_m(:,:)
-      vb (:,:,1       ) = ssv_m(:,:)
-
-      IF(ln_ctl) THEN                  ! print control
-         CALL prt_ctl(tab2d_1=sst_m, clinfo1=' sst_m   - : ', mask1=tmask, ovlap=1   )
-         CALL prt_ctl(tab2d_1=sss_m, clinfo1=' sss_m   - : ', mask1=tmask, ovlap=1   )
-         CALL prt_ctl(tab2d_1=ssu_m, clinfo1=' ssu_m   - : ', mask1=umask, ovlap=1   )
-         CALL prt_ctl(tab2d_1=ssv_m, clinfo1=' ssv_m   - : ', mask1=vmask, ovlap=1   )
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop( 'sbc_sas')
-      !
-   END SUBROUTINE sbc_sas
-
-
-   SUBROUTINE sbc_sas_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_sas_init  ***
-      !!
-      !! ** Purpose :   Initialisation of the dynamical data     
-      !! ** Method  : - read the data namsbc_sas namelist
-      !!
-      !! ** Action  : - read parameters
-      !!----------------------------------------------------------------------
-      INTEGER  :: ierr, ierr0, ierr1, ierr2, ierr3   ! return error code
-      INTEGER  :: ifpr                               ! dummy loop indice
-      INTEGER  :: jfld                               ! dummy loop arguments
-      INTEGER  :: inum, idv, idimv, jpm              ! local integer
-      !!
-      CHARACTER(len=100)            ::  cn_dir   !   Root directory for location of core files
-      TYPE(FLD_N), DIMENSION(jpfld) ::  slf_d    ! array of namelist information on the fields to read
-      TYPE(FLD_N) :: sn_tem, sn_sal, sn_emp, sn_ice, sn_qsr, sn_qns  ! information about the fields to be read
-      TYPE(FLD_N) :: sn_wnd, sn_uwd, sn_vwd
-      !
-      NAMELIST/namsbc_sas/cn_dir, sn_tem, sn_sal, sn_emp, sn_ice, sn_qsr, sn_qns, &
-         &                sn_wnd, sn_uwd, sn_vwd
-
-      !!----------------------------------------------------------------------
-      !                                   ! ============
-      !                                   !   Namelist
-      !                                   ! ============
-      ! (NB: frequency positive => hours, negative => months)
-      !                !   file      ! frequency !  variable  ! time intep !  clim  ! 'yearly' or ! weights  ! rotation   !
-      !                !   name      !  (hours)  !   name     !   (T/F)    !  (T/F) !  'monthly'  ! filename ! pairs      !
-      sn_tem  = FLD_N( 'sas_grid_T' ,    120    , 'votemper' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
-      sn_sal  = FLD_N( 'sas_grid_T' ,    120    , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
-      sn_uwd  = FLD_N( 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
-      sn_vwd  = FLD_N( 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
-      !
-      REWIND( numnam )                          ! read in namlist namsbc_sas
-      READ  ( numnam, namsbc_sas )
-      !                                         ! store namelist information in an array
-      !                                         ! Control print
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'sbc_sas : offline dynamics '
-         WRITE(numout,*) '~~~~~~~ '
-         WRITE(numout,*) '   Namelist namsbc_sas'
-         WRITE(numout,*)
-      ENDIF
-      ! 
-      jf_tem = 1   ;   jf_sal = 2   ;  jf_uwd = 3   ;  jf_vwd = 4 
-      jfld  = 4
-      !
-      slf_d(jf_tem) = sn_tem   ;   slf_d(jf_sal) = sn_sal   
-      slf_d(jf_uwd) = sn_uwd   ;   slf_d(jf_vwd) = sn_vwd
-      !
-      ALLOCATE( sf_sas(jfld), STAT=ierr )         ! set sf structure
-      IF( ierr > 0 ) THEN
-         CALL ctl_stop( 'sbc_sas: unable to allocate sf structure' )   ;   RETURN
-      ENDIF
-      DO ifpr = 1, jfld
-                                   ALLOCATE( sf_sas(ifpr)%fnow(jpi,jpj,jpk)    , STAT=ierr0 )
-         IF( slf_d(ifpr)%ln_tint ) ALLOCATE( sf_sas(ifpr)%fdta(jpi,jpj,jpk,2)  , STAT=ierr1 )
-         IF( ierr0 + ierr1 > 0 ) THEN
-            CALL ctl_stop( 'sbc_sas_init : unable to allocate sf_sas array structure' )   ;   RETURN
-         ENDIF
-      END DO
-      !                                         ! fill sf with slf_i and control print
-      CALL fld_fill( sf_sas, slf_d, cn_dir, 'sbc_sas_init', 'Data in file', 'namsbc_sas' )
-      !
-      ! lim code currently uses surface temperature and salinity in tsn array for initialisation
-      ! and ub, vb arrays in ice dynamics
-      ! so allocate enough of arrays to use
-      !
-      jpm = MAX(jp_tem, jp_sal)
-      ALLOCATE( tsn(jpi,jpj,1,jpm), STAT=ierr0 )
-      ALLOCATE( ub(jpi,jpj,1)     , STAT=ierr1 )
-      ALLOCATE( vb(jpi,jpj,1)     , STAT=ierr2 )
-      ierr = ierr0 + ierr1 + ierr2
-      IF( ierr > 0 ) THEN
-         CALL ctl_stop('sbc_sas_init: unable to allocate surface arrays')
-      ENDIF
-      !
-   END SUBROUTINE sbc_sas_init
-
-   !!======================================================================
-END MODULE sbcsas
Index: /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90
===================================================================
--- /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90	(revision 3362)
+++ /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90	(revision 3362)
@@ -0,0 +1,264 @@
+MODULE sbcssm
+   !!======================================================================
+   !!                       ***  MODULE  sbcssm  ***
+   !! Off-line : interpolation of the physical fields
+   !!======================================================================
+   !! History : 
+   !!   NEMO         3.4  ! 2012-03 First version by S. Alderson 
+   !!                     !         Heavily derived from Christian's dtadyn routine
+   !!                     !         in OFF_SRC
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_ssm_init : initialization, namelist read, and SAVEs control
+   !!   sbc_ssm      : Interpolation of the fields
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers variables
+   USE c1d             ! 1D configuration: lk_c1d
+   USE dom_oce         ! ocean domain: variables
+   USE zdf_oce         ! ocean vertical physics: variables
+   USE sbc_oce         ! surface module: variables
+   USE phycst          ! physical constants
+   USE eosbn2          ! equation of state - Brunt Vaisala frequency
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE zpshde          ! z-coord. with partial steps: horizontal derivatives
+   USE in_out_manager  ! I/O manager
+   USE iom             ! I/O library
+   USE lib_mpp         ! distributed memory computing library
+   USE prtctl          ! print control
+   USE fldread         ! read input fields 
+   USE timing          ! Timing
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_ssm_init   ! called by opa.F90
+   PUBLIC   sbc_ssm        ! called by step.F90
+
+   CHARACTER(len=100) ::   cn_dir     = './'    !: Root directory for location of ssm files
+   LOGICAL            ::   ln_3d_uv   = .true.  !: specify whether input velocity data is 3D
+
+   INTEGER  , PARAMETER ::   jpfld_3d = 4   ! maximum number of files to read
+   INTEGER  , PARAMETER ::   jpfld_2d = 1   ! maximum number of files to read
+   INTEGER  , SAVE      ::   jf_tem         ! index of temperature
+   INTEGER  , SAVE      ::   jf_sal         ! index of salinity
+   INTEGER  , SAVE      ::   jf_usp         ! index of u velocity component
+   INTEGER  , SAVE      ::   jf_vsp         ! index of v velocity component
+   INTEGER  , SAVE      ::   jf_ssh         ! index of sea surface height
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_ssm_3d  ! structure of input fields (file information, fields read)
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_ssm_2d  ! structure of input fields (file information, fields read)
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OFF 3.3 , NEMO Consortium (2010)
+   !! $Id: sbcssm.F90 3294 2012-01-28 16:44:18Z rblod $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE sbc_ssm( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_ssm  ***
+      !!
+      !! ** Purpose :  Prepares dynamics and physics fields from a NEMO run
+      !!               for an off-line simulation using surface processes only
+      !!
+      !! ** Method : calculates the position of data 
+      !!             - interpolates data if needed
+      !!----------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
+      !
+      INTEGER  ::   ji, jj     ! dummy loop indices
+      REAL(wp) ::   ztinta     ! ratio applied to after  records when doing time interpolation
+      REAL(wp) ::   ztintb     ! ratio applied to before records when doing time interpolation
+      !!----------------------------------------------------------------------
+      
+      !
+      IF( nn_timing == 1 )  CALL timing_start( 'sbc_ssm')
+      !
+      IF( kt == nit000 ) THEN
+         !
+         !! switch off stuff that isn't sensible with a standalone module
+         !! do it here rather than in sbc_ssm_init so that we don't have to rely on the order
+         !! init routines are called in nemogcm
+         !! note that we still need sbc_ssm called first in sbc
+         !
+         IF( ln_cpl ) THEN 
+            IF( lwp ) WRITE(numout,*) 'Coupled mode not sensible with StandAlone Surface scheme'
+            ln_cpl = .FALSE.
+         ENDIF
+         IF( ln_apr_dyn ) THEN
+            IF( lwp ) WRITE(numout,*) 'No atmospheric gradient needed with StandAlone Surface scheme'
+            ln_apr_dyn = .FALSE.
+         ENDIF
+         IF( ln_dm2dc ) THEN
+            IF( lwp ) WRITE(numout,*) 'No diurnal cycle needed with StandAlone Surface scheme'
+            ln_dm2dc = .FALSE.
+         ENDIF
+         IF( ln_rnf ) THEN
+            IF( lwp ) WRITE(numout,*) 'No runoff needed with StandAlone Surface scheme'
+            ln_rnf = .FALSE.
+         ENDIF
+         IF( ln_ssr ) THEN
+            IF( lwp ) WRITE(numout,*) 'No surface relaxation needed with StandAlone Surface scheme'
+            ln_ssr = .FALSE.
+         ENDIF
+         IF( nn_fwb > 0 ) THEN
+            IF( lwp ) WRITE(numout,*) 'No freshwater budget adjustment needed with StandAlone Surface scheme'
+            nn_fwb = 0
+         ENDIF
+         IF( nn_closea > 0 ) THEN      
+            IF( lwp ) WRITE(numout,*) 'No closed seas adjustment needed with StandAlone Surface scheme'
+            nn_closea = 0  
+         ENDIF
+      ENDIF
+
+      IF( jfld_3d > 0 ) CALL fld_read( kt, 1, sf_ssm_3d )      !==   read data at kt time step   ==!
+      IF( jfld_2d > 0 ) CALL fld_read( kt, 1, sf_ssm_2d )      !==   read data at kt time step   ==!
+      ! 
+      IF( ln_3d_uv ) THEN
+         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
+         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
+      !
+      sst_m(:,:) = sf_ssm_2d(jf_tem)%fnow(:,:,1) * tmask(:,:,1)    ! temperature
+      sss_m(:,:) = sf_ssm_2d(jf_sal)%fnow(:,:,1) * tmask(:,:,1)    ! salinity
+      ssh_m(:,:) = sf_ssm_2d(jf_ssh)%fnow(:,:,1) * tmask(:,:,1)    ! sea surface height
+      !
+      tsn(:,:,1,jp_tem) = sst_m(:,:)
+      tsn(:,:,1,jp_sal) = sss_m(:,:)
+      ub (:,:,1       ) = ssu_m(:,:)
+      vb (:,:,1       ) = ssv_m(:,:)
+
+      IF(ln_ctl) THEN                  ! print control
+         CALL prt_ctl(tab2d_1=sst_m, clinfo1=' sst_m   - : ', mask1=tmask, ovlap=1   )
+         CALL prt_ctl(tab2d_1=sss_m, clinfo1=' sss_m   - : ', mask1=tmask, ovlap=1   )
+         CALL prt_ctl(tab2d_1=ssu_m, clinfo1=' ssu_m   - : ', mask1=umask, ovlap=1   )
+         CALL prt_ctl(tab2d_1=ssv_m, clinfo1=' ssv_m   - : ', mask1=vmask, ovlap=1   )
+         CALL prt_ctl(tab2d_1=ssh_m, clinfo1=' ssh_m   - : ', mask1=tmask, ovlap=1   )
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop( 'sbc_ssm')
+      !
+   END SUBROUTINE sbc_ssm
+
+
+   SUBROUTINE sbc_ssm_sas_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_ssm_init  ***
+      !!
+      !! ** Purpose :   Initialisation of the dynamical data     
+      !! ** Method  : - read the data namsbc_ssm namelist
+      !!
+      !! ** Action  : - read parameters
+      !!----------------------------------------------------------------------
+      INTEGER  :: ierr, ierr0, ierr1, ierr2, ierr3   ! return error code
+      INTEGER  :: ifpr                               ! dummy loop indice
+      INTEGER  :: jfld_3d, jfld_2d                   ! dummy loop arguments
+      INTEGER  :: inum, idv, idimv, jpm              ! local integer
+      !!
+      CHARACTER(len=100)               ::  cn_dir       ! Root directory for location of core files
+      TYPE(FLD_N), DIMENSION(jpfld_3d) ::  slf_3d       ! array of namelist information on the fields to read
+      TYPE(FLD_N), DIMENSION(jpfld_2d) ::  slf_2d       ! array of namelist information on the fields to read
+      TYPE(FLD_N) :: sn_tem, sn_sal                     ! information about the fields to be read
+      TYPE(FLD_N) :: sn_usp, sn_vsp, sn_ssh
+      !
+      NAMELIST/namsbc_ssm_sas/cn_dir, ln_3d_uv, sn_tem, sn_sal, sn_usp, sn_vsp, sn_ssh
+
+      !!----------------------------------------------------------------------
+      !                                   ! ============
+      !                                   !   Namelist
+      !                                   ! ============
+      ! (NB: frequency positive => hours, negative => months)
+      !                !   file      ! frequency !  variable  ! time intep !  clim  ! 'yearly' or ! weights  ! rotation   !
+      !                !   name      !  (hours)  !   name     !   (T/F)    !  (T/F) !  'monthly'  ! filename ! pairs      !
+      sn_usp  = FLD_N( 'ssm_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      sn_vsp  = FLD_N( 'ssm_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      sn_tem  = FLD_N( 'ssm_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      sn_sal  = FLD_N( 'ssm_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      sn_ssh  = FLD_N( 'ssm_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      !
+      REWIND( numnam )                          ! read in namlist namsbc_ssm
+      READ  ( numnam, namsbc_ssm_sas )
+      !                                         ! store namelist information in an array
+      !                                         ! Control print
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'sbc_ssm_sas : standalone surface scheme '
+         WRITE(numout,*) '~~~~~~~~~~~ '
+         WRITE(numout,*) '   Namelist namsbc_ssm_sas'
+         WRITE(numout,*)
+      ENDIF
+      ! 
+      jf_tem = 1 ; jf_sal = 2 ; jf_ssh = 3
+      !
+      IF( ln_3d_uv ) THEN
+         jf_usp = 1 ; jf_vsp = 2
+         jfld_3d  = 2
+         jfld_2d  = 3
+         slf_3d(jf_usp) = sn_usp ; slf_3d(jf_vsp) = sn_vsp
+      ELSE
+         jf_usp = 4 ; jf_vsp = 5
+         jfld_3d  = 0
+         jfld_2d  = 5
+         slf_2d(jf_usp) = sn_usp ; slf_2d(jf_vsp) = sn_vsp
+      ENDIF
+
+      slf_2d(jf_tem) = sn_tem ; slf_2d(jf_sal) = sn_sal ; slf_2d(jf_ssh) = sn_ssh
+      !
+      IF( jfld_3d > 0 ) THEN
+         ALLOCATE( sf_ssm_3d(jfld_3d), STAT=ierr )         ! set sf structure
+         IF( ierr > 0 ) THEN
+            CALL ctl_stop( 'sbc_ssm: unable to allocate sf structure' )   ;   RETURN
+         ENDIF
+         DO ifpr = 1, jfld_3d
+                                       ALLOCATE( sf_ssm_3d(ifpr)%fnow(jpi,jpj,jpk)    , STAT=ierr0 )
+            IF( slf_3d(ifpr)%ln_tint ) ALLOCATE( sf_ssm_3d(ifpr)%fdta(jpi,jpj,jpk,2)  , STAT=ierr1 )
+            IF( ierr0 + ierr1 > 0 ) THEN
+               CALL ctl_stop( 'sbc_ssm_init : unable to allocate sf_ssm_3d array structure' )   ;   RETURN
+            ENDIF
+         END DO
+         !                                         ! fill sf with slf_i and control print
+         CALL fld_fill( sf_ssm_3d, slf_3d, cn_dir, 'sbc_ssm_init', '3D Data in file', 'namsbc_ssm' )
+      ENDIF
+
+      IF( jfld_2d > 0 ) THEN
+         ALLOCATE( sf_ssm_2d(jfld_2d), STAT=ierr )         ! set sf structure
+         IF( ierr > 0 ) THEN
+            CALL ctl_stop( 'sbc_ssm: unable to allocate sf 2d structure' )   ;   RETURN
+         ENDIF
+         DO ifpr = 1, jfld_2d
+                                       ALLOCATE( sf_ssm_2d(ifpr)%fnow(jpi,jpj,1)    , STAT=ierr0 )
+            IF( slf_2d(ifpr)%ln_tint ) ALLOCATE( sf_ssm_2d(ifpr)%fdta(jpi,jpj,1,2)  , STAT=ierr1 )
+            IF( ierr0 + ierr1 > 0 ) THEN
+               CALL ctl_stop( 'sbc_ssm_init : unable to allocate sf_ssm_2d array structure' )   ;   RETURN
+            ENDIF
+         END DO
+         !
+         CALL fld_fill( sf_ssm_2d, slf_2d, cn_dir, 'sbc_ssm_init', '2D Data in file', 'namsbc_ssm' )
+      ENDIF
+      !
+      ! lim code currently uses surface temperature and salinity in tsn array for initialisation
+      ! and ub, vb arrays in ice dynamics
+      ! so allocate enough of arrays to use
+      !
+      jpm = MAX(jp_tem, jp_sal)
+      ALLOCATE( tsn(jpi,jpj,1,jpm), STAT=ierr0 )
+      ALLOCATE( ub(jpi,jpj,1)     , STAT=ierr1 )
+      ALLOCATE( vb(jpi,jpj,1)     , STAT=ierr2 )
+      ierr = ierr0 + ierr1 + ierr2
+      IF( ierr > 0 ) THEN
+         CALL ctl_stop('sbc_ssm_init: unable to allocate surface arrays')
+      ENDIF
+      !
+   END SUBROUTINE sbc_ssm_init
+
+   !!======================================================================
+END MODULE sbcssm
Index: /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/step.F90
===================================================================
--- /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/step.F90	(revision 3361)
+++ /branches/2012/dev_r3322_NOCS09_SAS/NEMOGCM/NEMO/SAS_SRC/step.F90	(revision 3362)
@@ -6,24 +6,7 @@
    !!======================================================================
    !! History :  OPA  !  1991-03  (G. Madec)  Original code
-   !!             -   !  1991-11  (G. Madec)
-   !!             -   !  1992-06  (M. Imbard)  add a first output record
-   !!             -   !  1996-04  (G. Madec)  introduction of dynspg
-   !!             -   !  1996-04  (M.A. Foujols)  introduction of passive tracer
-   !!            8.0  !  1997-06  (G. Madec)  new architecture of call
-   !!            8.2  !  1997-06  (G. Madec, M. Imbard, G. Roullet)  free surface
-   !!             -   !  1999-02  (G. Madec, N. Grima)  hpg implicit
-   !!             -   !  2000-07  (J-M Molines, M. Imbard)  Open Bondary Conditions
-   !!   NEMO     1.0  !  2002-06  (G. Madec)  free form, suppress macro-tasking
-   !!             -   !  2004-08  (C. Talandier) New trends organization
-   !!             -   !  2005-01  (C. Ethe) Add the KPP closure scheme
-   !!             -   !  2005-11  (G. Madec)  Reorganisation of tra and dyn calls
-   !!             -   !  2006-01  (L. Debreu, C. Mazauric)  Agrif implementation
-   !!             -   !  2006-07  (S. Masson)  restart using iom
-   !!            3.2  !  2009-02  (G. Madec, R. Benshila)  reintroduicing z*-coordinate
-   !!             -   !  2009-06  (S. Masson, G. Madec)  TKE restart compatible with key_cpl
-   !!            3.3  !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface
-   !!             -   !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase + merge TRC-TRA
-   !!            3.4  !  2011-04  (G. Madec, C. Ethe) Merge of dtatem and dtasal
-   !!            3.5  !  2012-03  (S. Alderson)
+   !!             .   !    .                                                     
+   !!             .   !    .                                                     
+   !!   NEMO     3.5  !  2012-03  (S. Alderson)
    !!----------------------------------------------------------------------
 
@@ -89,5 +72,4 @@
 # endif   
 #endif   
-                             indic = 0                    ! reset to no error condition
       IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init)
                              CALL iom_setkt( kstp )       ! say to iom that we are at time step kstp
@@ -97,10 +79,7 @@
                              CALL dia_wri( kstp )         ! ocean model: outputs
 
-                             indic = 0
+                             indic = 0                    ! although indic is not changed in stp_ctl
+                                                          ! need to keep the same interface 
                              CALL stp_ctl( kstp, indic )
-      IF( indic < 0      )   THEN
-                             CALL ctl_stop( 'step: indic < 0' )
-                             CALL dia_wri_state( 'output.abort', kstp )
-      ENDIF
       !
       IF( nn_timing == 1 .AND.  kstp == nit000  )   CALL timing_reset
