Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 4826)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 4827)
@@ -34,4 +34,5 @@
    USE in_out_manager               ! I/O manager
    USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
+   USE fld_def
 
    IMPLICIT NONE
@@ -46,6 +47,4 @@
 
    LOGICAL, PUBLIC, PARAMETER ::   lk_cpl = .TRUE.   !: coupled flag
-   INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
-   INTEGER, PUBLIC            ::   OASIS_idle = 0    !: return code if nothing done by oasis
    INTEGER                    ::   ncomp_id          ! id returned by prism_init_comp
    INTEGER                    ::   nerror            ! return error code
@@ -62,7 +61,8 @@
    END TYPE FLD_CPL
 
-   TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC ::   srcv, ssnd   !: Coupling fields
+   TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC ::   ssnd   !: Coupling fields
 
    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   exfld   ! Temporary buffer for receiving
+   INTEGER, PUBLIC :: localComm
 
    !!----------------------------------------------------------------------
@@ -106,5 +106,5 @@
 
 
-   SUBROUTINE cpl_prism_define( krcv, ksnd )
+   SUBROUTINE cpl_prism_define( krcv, ksnd, sd )
       !!-------------------------------------------------------------------
       !!             ***  ROUTINE cpl_prism_define  ***
@@ -115,5 +115,6 @@
       !! ** Method  :   OASIS3 MPI communication 
       !!--------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields
+      INTEGER, INTENT(in)                  ::   krcv, ksnd  ! Number of received and sent coupling fields
+      TYPE(FLD), INTENT(in), DIMENSION(:)  ::   sd          ! input field related variables
       !
       INTEGER :: id_part
@@ -187,17 +188,17 @@
       !
       DO ji = 1, krcv
-         IF ( srcv(ji)%laction ) THEN 
-            DO jc = 1, srcv(ji)%nct
-               IF ( srcv(ji)%nct .gt. 1 ) THEN
-                  WRITE(zclname,'( a7, i1)') srcv(ji)%clname,jc
+         IF ( sd(ji)%loasis ) THEN 
+            DO jc = 1, sd(ji)%nct
+               IF ( sd(ji)%nct .gt. 1 ) THEN
+                  WRITE(zclname,'( a7, i1)') sd(ji)%clvar,jc
                ELSE
-                  zclname=srcv(ji)%clname
+                  zclname=sd(ji)%clvar
                ENDIF
                WRITE(numout,*) "Define",ji,jc,zclname," for",PRISM_In
-               CALL prism_def_var_proto ( srcv(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
+               CALL prism_def_var_proto ( sd(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
                     &                      PRISM_In    , ishape   , PRISM_REAL, nerror)
                IF ( nerror /= PRISM_Ok ) THEN
                   WRITE(numout,*) 'Failed to define transient ', ji, TRIM(zclname)
-                  CALL prism_abort_proto ( srcv(ji)%nid(jc), 'cpl_prism_define', 'Failure in prism_def_var')
+                  CALL prism_abort_proto ( sd(ji)%nid(jc), 'cpl_prism_define', 'Failure in prism_def_var')
                ENDIF
             END DO
@@ -256,5 +257,5 @@
 
 
-   SUBROUTINE cpl_prism_rcv( kid, kstep, pdata, kinfo )
+   SUBROUTINE cpl_prism_rcv( kstep, sd )
       !!---------------------------------------------------------------------
       !!              ***  ROUTINE cpl_prism_rcv  ***
@@ -263,8 +264,6 @@
       !!      like stresses and fluxes from the coupler or remote application.
       !!----------------------------------------------------------------------
-      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
       INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdata     ! IN to keep the value if nothing is done
-      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
+      TYPE(FLD), INTENT(inout)                  ::   sd        ! input field related variables
       !!
       INTEGER                                   ::   jc        ! local loop index
@@ -274,37 +273,37 @@
       ! receive local data from OASIS3 on every process
       !
-      DO jc = 1, srcv(kid)%nct
-
-         CALL prism_get_proto ( srcv(kid)%nid(jc), kstep, exfld, kinfo )         
+      DO jc = 1, sd%nct
+
+         CALL prism_get_proto ( sd%nid(jc), kstep, exfld, sd%ninfo )         
          
          llaction = .false.
-         IF( kinfo == PRISM_Recvd   .OR. kinfo == PRISM_FromRest .OR.   &
-              kinfo == PRISM_RecvOut .OR. kinfo == PRISM_FromRestOut )   llaction = .TRUE.
-         
-         IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc)
+         IF( sd%ninfo == PRISM_Recvd   .OR. sd%ninfo == PRISM_FromRest .OR.   &
+              sd%ninfo == PRISM_RecvOut .OR. sd%ninfo == PRISM_FromRestOut )   llaction = .TRUE.
+         
+         IF ( ln_ctl )   WRITE(numout,*) "llaction, info, kstep, ivarid: " , llaction, sd%ninfo, kstep, sd%nid(jc)
          
          IF ( llaction ) THEN
             
-            kinfo = OASIS_Rcv
-            pdata(nldi:nlei, nldj:nlej,jc) = exfld(:,:)
+            sd%ninfo = OASIS_Rcv
+            sd%fnow(nldi:nlei, nldj:nlej,jc) = exfld(:,:)
             
             !--- Fill the overlap areas and extra hallows (mpp)
             !--- check periodicity conditions (all cases)
-            CALL lbc_lnk( pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )   
+            CALL lbc_lnk( sd%fnow(:,:,jc), sd%clvgrd, sd%nsgn )   
             
             IF ( ln_ctl ) THEN        
                WRITE(numout,*) '****************'
-               WRITE(numout,*) 'prism_get_proto: Incoming ', srcv(kid)%clname
-               WRITE(numout,*) 'prism_get_proto: ivarid '  , srcv(kid)%nid(jc)
+               WRITE(numout,*) 'prism_get_proto: Incoming ', sd%clvar
+               WRITE(numout,*) 'prism_get_proto: ivarid '  , sd%nid(jc)
                WRITE(numout,*) 'prism_get_proto:   kstep', kstep
-               WRITE(numout,*) 'prism_get_proto:   info ', kinfo
-               WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
-               WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
-               WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
+               WRITE(numout,*) 'prism_get_proto:   info ', sd%ninfo
+               WRITE(numout,*) '     - Minimum value is ', MINVAL(sd%fnow(:,:,jc))
+               WRITE(numout,*) '     - Maximum value is ', MAXVAL(sd%fnow(:,:,jc))
+               WRITE(numout,*) '     -     Sum value is ', SUM(sd%fnow(:,:,jc))
                WRITE(numout,*) '****************'
             ENDIF
             
          ELSE
-            kinfo = OASIS_idle     
+            sd%ninfo = OASIS_idle     
          ENDIF
          
@@ -346,6 +345,8 @@
    !!----------------------------------------------------------------------
    USE in_out_manager               ! I/O manager
+   USE fld_def
    LOGICAL, PUBLIC, PARAMETER :: lk_cpl = .FALSE.   !: coupled flag
    PUBLIC cpl_prism_init
+   PUBLIC cpl_prism_rcv
    PUBLIC cpl_prism_finalize
 CONTAINS
@@ -355,4 +356,9 @@
       WRITE(numout,*) 'cpl_prism_init: Error you sould not be there...'
    END SUBROUTINE cpl_prism_init
+   SUBROUTINE cpl_prism_rcv ( kstep, sd )
+      INTEGER, INTENT(in   )   ::   kstep     ! ocean time-step in seconds
+      TYPE(FLD), INTENT(inout) ::   sd        ! input field related variables
+      WRITE(numout,*) 'cpl_prism_rcv: Error you sould not be there...'
+   END SUBROUTINE cpl_prism_rcv
    SUBROUTINE cpl_prism_finalize
       WRITE(numout,*) 'cpl_prism_finalize: Error you sould not be there...'
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/fld_def.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/fld_def.F90	(revision 4827)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/fld_def.F90	(revision 4827)
@@ -0,0 +1,107 @@
+MODULE fld_def
+   !!=====================================================================
+   !!                    ***  MODULE  fld_def ***
+   !! IOM variables definitions
+   !!====================================================================
+   !!--------------------------------------------------------------------
+   !!---------------------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: iom_def.F90 3680 2012-11-27 14:42:24Z rblod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!---------------------------------------------------------------------------------
+
+   USE par_kind
+
+   IMPLICIT NONE
+   PRIVATE
+
+   INTEGER, PUBLIC, PARAMETER ::   jp_wndi   =  1
+   INTEGER, PUBLIC, PARAMETER ::   jp_wndj   =  2
+   INTEGER, PUBLIC, PARAMETER ::   jp_otx1   =  3            ! 3 atmosphere-ocean stress components on grid 1
+   INTEGER, PUBLIC, PARAMETER ::   jp_oty1   =  4            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_otz1   =  5            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_otx2   =  6            ! 3 atmosphere-ocean stress components on grid 2
+   INTEGER, PUBLIC, PARAMETER ::   jp_oty2   =  7            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_otz2   =  8            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_itx1   =  9            ! 3 atmosphere-ice   stress components on grid 1
+   INTEGER, PUBLIC, PARAMETER ::   jp_ity1   = 10            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_itz1   = 11            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_itx2   = 12            ! 3 atmosphere-ice   stress components on grid 2
+   INTEGER, PUBLIC, PARAMETER ::   jp_ity2   = 13            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_itz2   = 14            ! 
+   INTEGER, PUBLIC, PARAMETER ::   jp_qsroce = 15            ! Qsr above the ocean
+   INTEGER, PUBLIC, PARAMETER ::   jp_qsrice = 16            ! Qsr above the ice
+   INTEGER, PUBLIC, PARAMETER ::   jp_qsrmix = 17 
+   INTEGER, PUBLIC, PARAMETER ::   jp_qnsoce = 18            ! Qns above the ocean
+   INTEGER, PUBLIC, PARAMETER ::   jp_qnsice = 19            ! Qns above the ice
+   INTEGER, PUBLIC, PARAMETER ::   jp_qnsmix = 20
+   INTEGER, PUBLIC, PARAMETER ::   jp_qlw    = 21            !
+   INTEGER, PUBLIC, PARAMETER ::   jp_tair   = 22            !
+   INTEGER, PUBLIC, PARAMETER ::   jp_humi   = 23            !
+   INTEGER, PUBLIC, PARAMETER ::   jp_prec   = 24            !
+   INTEGER, PUBLIC, PARAMETER ::   jp_rain   = 25            ! total liquid precipitation (rain)
+   INTEGER, PUBLIC, PARAMETER ::   jp_snow   = 26            ! solid precipitation over the ocean (snow)
+   INTEGER, PUBLIC, PARAMETER ::   jp_tevp   = 27            ! total evaporation
+   INTEGER, PUBLIC, PARAMETER ::   jp_ievp   = 28            ! solid evaporation (sublimation)
+   INTEGER, PUBLIC, PARAMETER ::   jp_tdif   = 29            ! wind stress module
+   INTEGER, PUBLIC, PARAMETER ::   jp_taum   = 30            ! wind stress module
+   INTEGER, PUBLIC, PARAMETER ::   jp_w10m   = 31            ! 10m wind
+   INTEGER, PUBLIC, PARAMETER ::   jp_qtot   = 32   
+   INTEGER, PUBLIC, PARAMETER ::   jp_sbpr   = 33            ! sublimation - liquid precipitation - solid precipitation
+   INTEGER, PUBLIC, PARAMETER ::   jp_semp   = 34            ! solid freshwater budget (sublimation - snow)
+   INTEGER, PUBLIC, PARAMETER ::   jp_oemp   = 35            ! ocean freshwater budget (evap - precip)
+   INTEGER, PUBLIC, PARAMETER ::   jp_rnf    = 36            ! runoffs
+   INTEGER, PUBLIC, PARAMETER ::   jp_cal    = 37            ! calving
+   INTEGER, PUBLIC, PARAMETER ::   jp_topm   = 38            ! topmeltn
+   INTEGER, PUBLIC, PARAMETER ::   jp_botm   = 39            ! botmeltn
+   INTEGER, PUBLIC, PARAMETER ::   jp_dqnsdt = 40            ! d(Q non solar)/d(temperature)
+   INTEGER, PUBLIC, PARAMETER ::   jp_co2    = 41
+   INTEGER, PUBLIC, PARAMETER ::   jpfld     = 41            ! total number of fields received
+
+   INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
+   INTEGER, PUBLIC            ::   OASIS_idle = 0    !: return code if nothing done by oasis **USE FOR FLDREAD TOO?**
+
+   TYPE, PUBLIC ::   FLD_N      !: Namelist field informations
+      CHARACTER(len = 256) ::   clname      ! generic name of the NetCDF flux file
+      CHARACTER(len = 32)  ::   clvgrd      ! grids on which is located the fields
+      CHARACTER(len = 32)  ::   clcat       ! multiple ice categories strategy
+      INTEGER              ::   nfreqh      ! frequency of each flux file
+      CHARACTER(len = 34)  ::   clvar       ! generic name of the variable in the NetCDF flux file
+      LOGICAL              ::   ln_tint     ! time interpolation or not (T/F)
+      LOGICAL              ::   ln_clim     ! climatology or not (T/F)
+      CHARACTER(len = 8)   ::   cltype      ! type of data file 'daily', 'monthly' or yearly'
+      CHARACTER(len = 34)  ::   wname       ! generic name of a NetCDF weights file to be used, blank if not
+      CHARACTER(len = 34)  ::   vcomp       ! symbolic component name if a vector that needs rotation
+      !                                     ! a string starting with "U" or "V" for each component   
+      !                                     ! chars 2 onwards identify which components go together  
+   END TYPE FLD_N
+
+   TYPE, PUBLIC ::   FLD        !: Input field related variables
+      CHARACTER(len = 256)            ::   clrootname   ! generic name of the NetCDF file
+      CHARACTER(len = 256)            ::   clname       ! current name of the NetCDF file
+      LOGICAL                         ::   loasis       ! field from OASIS or not (T/F)
+      LOGICAL                         ::   lfile        ! field from file or not (T/F)
+      CHARACTER(len = 32)             ::   clvgrd       ! grids on which is located the fields
+      INTEGER                         ::   nct          ! number of ice categories
+      INTEGER                         ::   nfreqh       ! frequency of each flux file
+      CHARACTER(len = 34)             ::   clvar        ! generic name of the variable in the NetCDF flux file
+      LOGICAL                         ::   ln_tint      ! time interpolation or not (T/F)
+      LOGICAL                         ::   ln_clim      ! climatology or not (T/F)
+      CHARACTER(len = 8)              ::   cltype       ! type of data file 'daily', 'monthly' or yearly'
+      INTEGER                         ::   num          ! iom id of the jpfld files to be read
+      INTEGER , DIMENSION(2)          ::   nrec_b       ! before record (1: index, 2: second since Jan. 1st 00h of nit000 year)
+      INTEGER , DIMENSION(2)          ::   nrec_a       ! after  record (1: index, 2: second since Jan. 1st 00h of nit000 year)
+      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:  ) ::   fnow       ! input fields interpolated to now time step
+      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:,:) ::   fdta       ! 2 consecutive record of input fields
+      CHARACTER(len = 256)            ::   wgtname      ! current name of the NetCDF weight file acting as a key
+      !                                                 ! into the WGTLIST structure
+      CHARACTER(len = 34)             ::   vcomp        ! symbolic name for a vector component that needs rotation
+      REAL(wp)                        ::   nsgn         ! Control of the sign change
+      LOGICAL, DIMENSION(2)           ::   rotn         ! flag to indicate whether before/after field has been rotated
+      INTEGER                         ::   nreclast     ! last record to be read in the current file
+      INTEGER, DIMENSION(9)           ::   nid          ! OASIS id of the field (no more than 9 categories)
+      INTEGER                         ::   ninfo        ! OASIS recv info
+   END TYPE FLD
+
+   !!=====================================================================
+END MODULE fld_def
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/fldread2.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/fldread2.F90	(revision 4827)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/fldread2.F90	(revision 4827)
@@ -0,0 +1,1272 @@
+MODULE fldread2
+   !!======================================================================
+   !!                       ***  MODULE  fldread  ***
+   !! Ocean forcing:  read input field for surface boundary condition
+   !!=====================================================================
+   !! History :  2.0  !  06-2006  (S. Masson, G. Madec) Original code
+   !!                 !  05-2008  (S. Alderson) Modified for Interpolation in memory
+   !!                 !                         from input grid to model grid
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   fld_read      : read input fields used for the computation of the
+   !!                   surface boundary condition
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! ???
+   USE in_out_manager  ! I/O manager
+   USE iom             ! I/O manager library
+   USE geo2ocean       ! for vector rotation on to model grid
+   USE lib_mpp         ! MPP library
+   USE wrk_nemo        ! work arrays
+   USE ioipsl, ONLY :   ymds2ju, ju2ymds   ! for calendar
+   USE fld_def
+
+   IMPLICIT NONE
+   PRIVATE   
+ 
+   PUBLIC   fld_map2    ! routine called by tides_init
+   PUBLIC   fld_read2, fld_fill2, fld_rot2   ! called by sbc... modules
+
+   TYPE, PUBLIC ::   MAP_POINTER      !: Array of integer pointers to 1D arrays
+      INTEGER, POINTER   ::  ptr(:)
+   END TYPE MAP_POINTER
+
+!$AGRIF_DO_NOT_TREAT
+
+   !! keep list of all weights variables so they're only read in once
+   !! need to add AGRIF directives not to process this structure
+   !! also need to force wgtname to include AGRIF nest number
+   TYPE         ::   WGT        !: Input weights related variables
+      CHARACTER(len = 256)                    ::   wgtname      ! current name of the NetCDF weight file
+      INTEGER , DIMENSION(2)                  ::   ddims        ! shape of input grid
+      INTEGER , DIMENSION(2)                  ::   botleft      ! top left corner of box in input grid containing 
+      !                                                         ! current processor grid
+      INTEGER , DIMENSION(2)                  ::   topright     ! top right corner of box 
+      INTEGER                                 ::   jpiwgt       ! width of box on input grid
+      INTEGER                                 ::   jpjwgt       ! height of box on input grid
+      INTEGER                                 ::   numwgt       ! number of weights (4=bilinear, 16=bicubic)
+      INTEGER                                 ::   nestid       ! for agrif, keep track of nest we're in
+      INTEGER                                 ::   overlap      ! =0 when cyclic grid has no overlapping EW columns
+      !                                                         ! =>1 when they have one or more overlapping columns      
+      !                                                         ! =-1 not cyclic
+      LOGICAL                                 ::   cyclic       ! east-west cyclic or not
+      INTEGER,  DIMENSION(:,:,:), POINTER     ::   data_jpi     ! array of source integers
+      INTEGER,  DIMENSION(:,:,:), POINTER     ::   data_jpj     ! array of source integers
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   data_wgt     ! array of weights on model grid
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   fly_dta      ! array of values on input grid
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   col          ! temporary array for reading in columns
+   END TYPE WGT
+
+   INTEGER,     PARAMETER             ::   tot_wgts = 10
+   TYPE( WGT ), DIMENSION(tot_wgts)   ::   ref_wgts     ! array of wgts
+   INTEGER                            ::   nxt_wgt = 1  ! point to next available space in ref_wgts array
+
+!$AGRIF_END_DO_NOT_TREAT
+
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: fldread.F90 3851 2013-03-27 10:03:54Z smasson $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE fld_read2( kt, kn_fsbc, sd, map, kit, kt_offset )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_read  ***
+      !!                   
+      !! ** Purpose :   provide at each time step the surface ocean fluxes
+      !!                (momentum, heat, freshwater and runoff) 
+      !!
+      !! ** Method  :   READ each input fields in NetCDF files using IOM
+      !!      and intepolate it to the model time-step.
+      !!         Several assumptions are made on the input file:
+      !!      blahblahblah....
+      !!----------------------------------------------------------------------
+      INTEGER  , INTENT(in   )               ::   kt        ! ocean time step
+      INTEGER  , INTENT(in   )               ::   kn_fsbc   ! sbc computation period (in time step) 
+      TYPE(FLD), INTENT(inout), DIMENSION(:) ::   sd        ! input field related variables
+      TYPE(MAP_POINTER),INTENT(in), OPTIONAL, DIMENSION(:) ::   map   ! global-to-local mapping indices
+      INTEGER  , INTENT(in   ), OPTIONAL     ::   kit       ! subcycle timestep for timesplitting option
+      INTEGER  , INTENT(in   ), OPTIONAL     ::   kt_offset ! provide fields at time other than "now"
+                                                            !   kt_offset = -1 => fields at "before" time level
+                                                            !   kt_offset = +1 => fields at "after"  time level
+                                                            !   etc.
+      !!
+      INTEGER  ::   itmp       ! temporary variable
+      INTEGER  ::   imf        ! size of the structure sd
+      INTEGER  ::   jf         ! dummy indices
+      INTEGER  ::   isecend    ! number of second since Jan. 1st 00h of nit000 year at nitend
+      INTEGER  ::   isecsbc    ! number of seconds between Jan. 1st 00h of nit000 year and the middle of sbc time step
+      INTEGER  ::   it_offset  ! local time offset variable
+      LOGICAL  ::   llnxtyr    ! open next year  file?
+      LOGICAL  ::   llnxtmth   ! open next month file?
+      LOGICAL  ::   llstop     ! stop is the file does not exist
+      LOGICAL  ::   ll_firstcall ! true if this is the first call to fld_read for this set of fields
+      REAL(wp) ::   ztinta     ! ratio applied to after  records when doing time interpolation
+      REAL(wp) ::   ztintb     ! ratio applied to before records when doing time interpolation
+      CHARACTER(LEN=1000) ::   clfmt   ! write format
+      TYPE(MAP_POINTER) ::   imap   ! global-to-local mapping indices
+      !!---------------------------------------------------------------------
+      ll_firstcall = kt == nit000
+      IF( PRESENT(kit) )   ll_firstcall = ll_firstcall .and. kit == 1
+
+      it_offset = 0
+      IF( PRESENT(kt_offset) )   it_offset = kt_offset
+
+      imap%ptr => NULL()
+
+      ! Note that shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar 
+      IF( present(kit) ) THEN   ! ignore kn_fsbc in this case
+         isecsbc = nsec_year + nsec1jan000 + (kit+it_offset)*NINT( rdt/REAL(nn_baro,wp) )
+      ELSE                      ! middle of sbc time step
+         isecsbc = nsec_year + nsec1jan000 + NINT(0.5 * REAL(kn_fsbc - 1,wp) * rdttra(1)) + it_offset * NINT(rdttra(1))
+      ENDIF
+      imf = SIZE( sd )
+      !
+      IF( ll_firstcall ) THEN                      ! initialization
+         DO jf = 1, imf 
+            IF( PRESENT(map) ) imap = map(jf)
+            CALL fld_init( kn_fsbc, sd(jf), imap )  ! read each before field (put them in after as they will be swapped)
+         END DO
+         IF( lwp ) CALL wgt_print()                ! control print
+      ENDIF
+      !                                            ! ====================================== !
+      IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN         ! update field at each kn_fsbc time-step !
+         !                                         ! ====================================== !
+         !
+         DO jf = 1, imf                            ! ---   loop over field   --- !
+            
+            IF( isecsbc > sd(jf)%nrec_a(2) .OR. ll_firstcall ) THEN    ! read/update the after data?
+
+               IF( PRESENT(map) )   imap = map(jf)   ! temporary definition of map
+
+               sd(jf)%nrec_b(:) = sd(jf)%nrec_a(:)                                  ! swap before record informations
+               sd(jf)%rotn(1) = sd(jf)%rotn(2)                                      ! swap before rotate informations
+               IF( sd(jf)%ln_tint )   sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2)   ! swap before record field
+
+               CALL fld_rec( kn_fsbc, sd(jf), kt_offset = it_offset, kit = kit )    ! update after record informations
+
+               ! if kn_fsbc*rdttra is larger than nfreqh (which is kind of odd),
+               ! it is possible that the before value is no more the good one... we have to re-read it
+               ! if before is not the last record of the file currently opened and after is the first record to be read
+               ! in a new file which means after = 1 (the file to be opened corresponds to the current time)
+               ! or after = nreclast + 1 (the file to be opened corresponds to a future time step)
+               IF( .NOT. ll_firstcall .AND. sd(jf)%ln_tint .AND. sd(jf)%nrec_b(1) /= sd(jf)%nreclast &
+                  &                   .AND. MOD( sd(jf)%nrec_a(1), sd(jf)%nreclast ) == 1 ) THEN
+                  itmp = sd(jf)%nrec_a(1)                       ! temporary storage
+                  sd(jf)%nrec_a(1) = sd(jf)%nreclast            ! read the last record of the file currently opened
+                  CALL fld_get( sd(jf), imap )                  ! read after data
+                  sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2)   ! re-swap before record field
+                  sd(jf)%nrec_b(1) = sd(jf)%nrec_a(1)           ! update before record informations
+                  sd(jf)%nrec_b(2) = sd(jf)%nrec_a(2) - sd(jf)%nfreqh * 3600  ! assume freq to be in hours in this case
+                  sd(jf)%rotn(1)   = sd(jf)%rotn(2)             ! update before rotate informations
+                  sd(jf)%nrec_a(1) = itmp                       ! move back to after record 
+               ENDIF
+
+               CALL fld_clopn( sd(jf) )   ! Do we need to open a new year/month/week/day file?
+               
+               IF( sd(jf)%ln_tint ) THEN
+                  
+                  ! if kn_fsbc*rdttra is larger than nfreqh (which is kind of odd),
+                  ! it is possible that the before value is no more the good one... we have to re-read it
+                  ! if before record is not just just before the after record...
+                  IF( .NOT. ll_firstcall .AND. MOD( sd(jf)%nrec_a(1), sd(jf)%nreclast ) /= 1 &
+                     &                   .AND. sd(jf)%nrec_b(1) /= sd(jf)%nrec_a(1) - 1 ) THEN   
+                     sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) - 1       ! move back to before record
+                     CALL fld_get( sd(jf), imap )                  ! read after data
+                     sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2)   ! re-swap before record field
+                     sd(jf)%nrec_b(1) = sd(jf)%nrec_a(1)           ! update before record informations
+                     sd(jf)%nrec_b(2) = sd(jf)%nrec_a(2) - sd(jf)%nfreqh * 3600  ! assume freq to be in hours in this case
+                     sd(jf)%rotn(1)   = sd(jf)%rotn(2)             ! update before rotate informations
+                     sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) + 1       ! move back to after record
+                  ENDIF
+
+                  ! do we have to change the year/month/week/day of the forcing field?? 
+                  ! if we do time interpolation we will need to open next year/month/week/day file before the end of the current
+                  ! one. If so, we are still before the end of the year/month/week/day when calling fld_rec so sd(jf)%nrec_a(1)
+                  ! will be larger than the record number that should be read for current year/month/week/day
+                  ! do we need next file data?
+                  IF( sd(jf)%nrec_a(1) > sd(jf)%nreclast ) THEN
+                     
+                     sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) - sd(jf)%nreclast   ! 
+                     
+                     IF( .NOT. ( sd(jf)%ln_clim .AND. sd(jf)%cltype == 'yearly' ) ) THEN   ! close/open the current/new file
+                        
+                        llnxtmth = sd(jf)%cltype == 'monthly' .OR. nday == nmonth_len(nmonth)      ! open next month file?
+                        llnxtyr  = sd(jf)%cltype == 'yearly'  .OR. (nmonth == 12 .AND. llnxtmth)   ! open next year  file?
+
+                        ! if the run finishes at the end of the current year/month/week/day, we will allow next
+                        ! year/month/week/day file to be not present. If the run continue further than the current
+                        ! year/month/week/day, next year/month/week/day file must exist
+                        isecend = nsec_year + nsec1jan000 + (nitend - kt) * NINT(rdttra(1))   ! second at the end of the run 
+                        llstop = isecend > sd(jf)%nrec_a(2)                                   ! read more than 1 record of next year
+                        ! we suppose that the date of next file is next day (should be ok even for weekly files...)
+                        CALL fld_clopn( sd(jf), nyear  + COUNT((/llnxtyr /))                                           ,         &
+                           &                    nmonth + COUNT((/llnxtmth/)) - 12                 * COUNT((/llnxtyr /)),         &
+                           &                    nday   + 1                   - nmonth_len(nmonth) * COUNT((/llnxtmth/)), llstop )
+
+                        IF( sd(jf)%num <= 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist
+                           CALL ctl_warn('next year/month/week/day file: '//TRIM(sd(jf)%clname)//     &
+                              &     ' not present -> back to current year/month/day')
+                           CALL fld_clopn( sd(jf) )       ! back to the current year/month/day
+                           sd(jf)%nrec_a(1) = sd(jf)%nreclast     ! force to read the last record in the current year file
+                        ENDIF
+                        
+                     ENDIF
+                  ENDIF   ! open need next file?
+                  
+               ENDIF   ! temporal interpolation?
+
+               ! read after data
+               CALL fld_get( sd(jf), imap )
+
+            ENDIF   ! read new data?
+         END DO                                    ! --- end loop over field --- !
+
+!         CALL fld_rot( kt, sd )                    ! rotate vector before/now/after fields if needed
+
+         DO jf = 1, imf                            ! ---   loop over field   --- !
+            !
+            IF( sd(jf)%ln_tint ) THEN              ! temporal interpolation
+               IF(lwp .AND. kt - nit000 <= 100 ) THEN 
+                  clfmt = "('fld_read: var ', a, ' kt = ', i8, ' (', f7.2,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   &
+                     &    "', records b/a: ', i4.4, '/', i4.4, ' (days ', f7.2,'/', f7.2, ')')"
+                  WRITE(numout, clfmt)  TRIM( sd(jf)%clvar ), kt, REAL(isecsbc,wp)/rday, nyear, nmonth, nday,   &            
+                     & sd(jf)%nrec_b(1), sd(jf)%nrec_a(1), REAL(sd(jf)%nrec_b(2),wp)/rday, REAL(sd(jf)%nrec_a(2),wp)/rday
+                  WRITE(numout, *) 'it_offset is : ',it_offset
+               ENDIF
+               ! temporal interpolation weights
+               ztinta =  REAL( isecsbc - sd(jf)%nrec_b(2), wp ) / REAL( sd(jf)%nrec_a(2) - sd(jf)%nrec_b(2), wp )
+               ztintb =  1. - ztinta
+!CDIR COLLAPSE
+               sd(jf)%fnow(:,:,:) = ztintb * sd(jf)%fdta(:,:,:,1) + ztinta * sd(jf)%fdta(:,:,:,2)
+            ELSE   ! nothing to do...
+               IF(lwp .AND. kt - nit000 <= 100 ) THEN
+                  clfmt = "('fld_read: var ', a, ' kt = ', i8,' (', f7.2,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   &
+                     &    "', record: ', i4.4, ' (days ', f7.2, ' <-> ', f7.2, ')')"
+                  WRITE(numout, clfmt) TRIM(sd(jf)%clvar), kt, REAL(isecsbc,wp)/rday, nyear, nmonth, nday,    &
+                     &                 sd(jf)%nrec_a(1), REAL(sd(jf)%nrec_b(2),wp)/rday, REAL(sd(jf)%nrec_a(2),wp)/rday
+               ENDIF
+            ENDIF
+            !
+            IF( kt == nitend - kn_fsbc + 1 )   CALL iom_close( sd(jf)%num )   ! Close the input files
+
+         END DO                                    ! --- end loop over field --- !
+         !
+         !                                         ! ====================================== !
+      ENDIF                                        ! update field at each kn_fsbc time-step !
+      !                                            ! ====================================== !
+      !
+   END SUBROUTINE fld_read2
+
+
+   SUBROUTINE fld_init( kn_fsbc, sdjf, map )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_init  ***
+      !!
+      !! ** Purpose :  - if time interpolation, read before data 
+      !!               - open current year file
+      !!----------------------------------------------------------------------
+      INTEGER  , INTENT(in   ) ::   kn_fsbc   ! sbc computation period (in time step) 
+      TYPE(FLD), INTENT(inout) ::   sdjf      ! input field related variables
+      TYPE(MAP_POINTER),INTENT(in) ::   map   ! global-to-local mapping indices
+      !!
+      LOGICAL :: llprevyr              ! are we reading previous year  file?
+      LOGICAL :: llprevmth             ! are we reading previous month file?
+      LOGICAL :: llprevweek            ! are we reading previous week  file?
+      LOGICAL :: llprevday             ! are we reading previous day   file?
+      LOGICAL :: llprev                ! llprevyr .OR. llprevmth .OR. llprevweek .OR. llprevday
+      INTEGER :: idvar                 ! variable id 
+      INTEGER :: inrec                 ! number of record existing for this variable
+      INTEGER :: iyear, imonth, iday   ! first day of the current file in yyyy mm dd
+      INTEGER :: isec_week             ! number of seconds since start of the weekly file
+      CHARACTER(LEN=1000) ::   clfmt   ! write format
+      !!---------------------------------------------------------------------
+      llprevyr   = .FALSE.
+      llprevmth  = .FALSE.
+      llprevweek = .FALSE.
+      llprevday  = .FALSE.
+      isec_week  = 0
+            
+      ! define record informations
+      CALL fld_rec( kn_fsbc, sdjf, ldbefore = .TRUE. )  ! return before values in sdjf%nrec_a (as we will swap it later)
+
+      ! Note that shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar 
+
+      IF( sdjf%ln_tint ) THEN ! we need to read the previous record and we will put it in the current record structure
+
+         IF( sdjf%nrec_a(1) == 0  ) THEN   ! we redefine record sdjf%nrec_a(1) with the last record of previous year file
+            IF    ( sdjf%nfreqh == -12 ) THEN   ! yearly mean
+               IF( sdjf%cltype == 'yearly' ) THEN             ! yearly file
+                  sdjf%nrec_a(1) = 1                                                       ! force to read the unique record
+                  llprevyr  = .NOT. sdjf%ln_clim                                           ! use previous year  file?
+               ELSE
+                  CALL ctl_stop( "fld_init: yearly mean file must be in a yearly type of file: "//TRIM(sdjf%clrootname) )
+               ENDIF
+            ELSEIF( sdjf%nfreqh ==  -1 ) THEN   ! monthly mean
+               IF( sdjf%cltype == 'monthly' ) THEN            ! monthly file
+                  sdjf%nrec_a(1) = 1                                                       ! force to read the unique record
+                  llprevmth = .TRUE.                                                       ! use previous month file?
+                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file?
+               ELSE                                           ! yearly file
+                  sdjf%nrec_a(1) = 12                                                      ! force to read december mean
+                  llprevyr = .NOT. sdjf%ln_clim                                            ! use previous year  file?
+               ENDIF
+            ELSE                                ! higher frequency mean (in hours) 
+               IF    ( sdjf%cltype      == 'monthly' ) THEN   ! monthly file
+                  sdjf%nrec_a(1) = 24 * nmonth_len(nmonth-1) / sdjf%nfreqh                 ! last record of previous month
+                  llprevmth = .TRUE.                                                       ! use previous month file?
+                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file?
+               ELSEIF( sdjf%cltype(1:4) == 'week'    ) THEN   ! weekly file
+                  llprevweek = .TRUE.                                                      ! use previous week  file?
+                  sdjf%nrec_a(1) = 24 * 7 / sdjf%nfreqh                                    ! last record of previous week
+                  isec_week = NINT(rday) * 7                                               ! add a shift toward previous week
+               ELSEIF( sdjf%cltype      == 'daily'   ) THEN   ! daily file
+                  sdjf%nrec_a(1) = 24 / sdjf%nfreqh                                        ! last record of previous day
+                  llprevday = .TRUE.                                                       ! use previous day   file?
+                  llprevmth = llprevday .AND. nday   == 1                                  ! use previous month file?
+                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file?
+               ELSE                                           ! yearly file
+                  sdjf%nrec_a(1) = 24 * nyear_len(0) / sdjf%nfreqh                         ! last record of previous year 
+                  llprevyr = .NOT. sdjf%ln_clim                                            ! use previous year  file?
+               ENDIF
+            ENDIF
+         ENDIF
+         !
+         IF ( sdjf%cltype(1:4) == 'week' ) THEN
+            isec_week = isec_week + ksec_week( sdjf%cltype(6:8) )   ! second since the beginning of the week
+            llprevmth = isec_week > nsec_month                      ! longer time since the beginning of the week than the month
+            llprevyr  = llprevmth .AND. nmonth == 1
+         ENDIF
+         llprev = llprevyr .OR. llprevmth .OR. llprevweek .OR. llprevday
+         !
+         iyear  = nyear  - COUNT((/llprevyr /))
+         imonth = nmonth - COUNT((/llprevmth/)) + 12 * COUNT((/llprevyr /))
+         iday   = nday   - COUNT((/llprevday/)) + nmonth_len(nmonth-1) * COUNT((/llprevmth/)) - isec_week / NINT(rday)
+         !
+         CALL fld_clopn( sdjf, iyear, imonth, iday, .NOT. llprev )
+
+         ! if previous year/month/day file does not exist, we switch to the current year/month/day
+         IF( llprev .AND. sdjf%num <= 0 ) THEN
+            CALL ctl_warn( 'previous year/month/week/day file: '//TRIM(sdjf%clrootname)//   &
+               &           ' not present -> back to current year/month/week/day' )
+            ! we force to read the first record of the current year/month/day instead of last record of previous year/month/day
+            llprev = .FALSE.
+            sdjf%nrec_a(1) = 1
+            CALL fld_clopn( sdjf )
+         ENDIF
+         
+         IF( llprev ) THEN   ! check if the record sdjf%nrec_a(1) exists in the file
+            idvar = iom_varid( sdjf%num, sdjf%clvar )                                        ! id of the variable sdjf%clvar
+            IF( idvar <= 0 )   RETURN
+            inrec = iom_file( sdjf%num )%dimsz( iom_file( sdjf%num )%ndims(idvar), idvar )   ! size of the last dim of idvar
+            sdjf%nrec_a(1) = MIN( sdjf%nrec_a(1), inrec )   ! make sure we select an existing record
+         ENDIF
+
+         ! read before data in after arrays(as we will swap it later)
+         CALL fld_get( sdjf, map )
+
+         clfmt = "('fld_init : time-interpolation for ', a, ' read previous record = ', i4, ' at time = ', f7.2, ' days')"
+         IF(lwp) WRITE(numout, clfmt) TRIM(sdjf%clvar), sdjf%nrec_a(1), REAL(sdjf%nrec_a(2),wp)/rday
+
+      ENDIF
+      !
+   END SUBROUTINE fld_init
+
+
+   SUBROUTINE fld_rec( kn_fsbc, sdjf, ldbefore, kit, kt_offset )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_rec  ***
+      !!
+      !! ** Purpose : Compute
+      !!              if sdjf%ln_tint = .TRUE.
+      !!                  nrec_a: record number and its time (nrec_b is obtained from nrec_a when swapping)
+      !!              if sdjf%ln_tint = .FALSE.
+      !!                  nrec_a(1): record number
+      !!                  nrec_b(2) and nrec_a(2): time of the beginning and end of the record (for print only)
+      !!----------------------------------------------------------------------
+      INTEGER  , INTENT(in   )           ::   kn_fsbc   ! sbc computation period (in time step) 
+      TYPE(FLD), INTENT(inout)           ::   sdjf      ! input field related variables
+      LOGICAL  , INTENT(in   ), OPTIONAL ::   ldbefore  ! sent back before record values (default = .FALSE.)
+      INTEGER  , INTENT(in   ), OPTIONAL ::   kit       ! index of barotropic subcycle
+                                                        ! used only if sdjf%ln_tint = .TRUE.
+      INTEGER  , INTENT(in   ), OPTIONAL ::   kt_offset ! Offset of required time level compared to "now"
+                                                        !   time level in units of time steps.
+      !!
+      LOGICAL  ::   llbefore    ! local definition of ldbefore
+      INTEGER  ::   iendrec     ! end of this record (in seconds)
+      INTEGER  ::   imth        ! month number
+      INTEGER  ::   ifreq_sec   ! frequency mean (in seconds)
+      INTEGER  ::   isec_week   ! number of seconds since the start of the weekly file
+      INTEGER  ::   it_offset   ! local time offset variable
+      REAL(wp) ::   ztmp        ! temporary variable
+      !!----------------------------------------------------------------------
+      !
+      ! Note that shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar 
+      !
+      IF( PRESENT(ldbefore) ) THEN   ;   llbefore = ldbefore .AND. sdjf%ln_tint   ! needed only if sdjf%ln_tint = .TRUE.
+      ELSE                           ;   llbefore = .FALSE.
+      ENDIF
+      !
+      it_offset = 0
+      IF( PRESENT(kt_offset) )   it_offset = kt_offset
+      IF( PRESENT(kit) ) THEN   ;   it_offset = ( kit + it_offset ) * NINT( rdt/REAL(nn_baro,wp) )
+      ELSE                      ;   it_offset =         it_offset   * NINT(       rdttra(1)      )
+      ENDIF
+      !
+      !                                      ! =========== !
+      IF    ( sdjf%nfreqh == -12 ) THEN      ! yearly mean
+         !                                   ! =========== !
+         !
+         IF( sdjf%ln_tint ) THEN                 ! time interpolation, shift by 1/2 record
+            !
+            !                  INT( ztmp )
+            !                     /|\
+            !                    1 |    *----
+            !                    0 |----(              
+            !                      |----+----|--> time
+            !                      0   /|\   1   (nday/nyear_len(1))
+            !                           |   
+            !                           |   
+            !       forcing record :    1 
+            !                            
+            ztmp = REAL( nday, wp ) / REAL( nyear_len(1), wp ) + 0.5 + REAL( it_offset, wp )
+            sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/))
+            ! swap at the middle of the year
+            IF( llbefore ) THEN   ;   sdjf%nrec_a(2) = nsec1jan000 - NINT(0.5 * rday) * nyear_len(0)
+            ELSE                  ;   sdjf%nrec_a(2) = nsec1jan000 + NINT(0.5 * rday) * nyear_len(1)   
+            ENDIF
+         ELSE                                    ! no time interpolation
+            sdjf%nrec_a(1) = 1
+            sdjf%nrec_a(2) = NINT(rday) * nyear_len(1) + nsec1jan000   ! swap at the end    of the year
+            sdjf%nrec_b(2) = nsec1jan000                               ! beginning of the year (only for print)
+         ENDIF
+         !
+         !                                   ! ============ !
+      ELSEIF( sdjf%nfreqh ==  -1 ) THEN      ! monthly mean !
+         !                                   ! ============ !
+         !
+         IF( sdjf%ln_tint ) THEN                 ! time interpolation, shift by 1/2 record
+            !
+            !                  INT( ztmp )
+            !                     /|\
+            !                    1 |    *----
+            !                    0 |----(              
+            !                      |----+----|--> time
+            !                      0   /|\   1   (nday/nmonth_len(nmonth))
+            !                           |   
+            !                           |   
+            !       forcing record :  nmonth 
+            !                            
+            ztmp = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5 + REAL( it_offset, wp )
+            imth = nmonth + INT( ztmp ) - COUNT((/llbefore/))
+            IF( sdjf%cltype == 'monthly' ) THEN   ;   sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/))
+            ELSE                                  ;   sdjf%nrec_a(1) = imth
+            ENDIF
+            sdjf%nrec_a(2) = nmonth_half(   imth ) + nsec1jan000   ! swap at the middle of the month
+         ELSE                                    ! no time interpolation
+            IF( sdjf%cltype == 'monthly' ) THEN   ;   sdjf%nrec_a(1) = 1
+            ELSE                                  ;   sdjf%nrec_a(1) = nmonth
+            ENDIF
+            sdjf%nrec_a(2) =  nmonth_end(nmonth  ) + nsec1jan000   ! swap at the end    of the month
+            sdjf%nrec_b(2) =  nmonth_end(nmonth-1) + nsec1jan000   ! beginning of the month (only for print)
+         ENDIF
+         !
+         !                                   ! ================================ !
+      ELSE                                   ! higher frequency mean (in hours)
+         !                                   ! ================================ !
+         !
+         ifreq_sec = sdjf%nfreqh * 3600                                                 ! frequency mean (in seconds)
+         IF( sdjf%cltype(1:4) == 'week' )   isec_week = ksec_week( sdjf%cltype(6:8) )   ! since the first day of the current week
+         ! number of second since the beginning of the file
+         IF(     sdjf%cltype      == 'monthly' ) THEN   ;   ztmp = REAL(nsec_month,wp)  ! since the first day of the current month
+         ELSEIF( sdjf%cltype(1:4) == 'week'    ) THEN   ;   ztmp = REAL(isec_week ,wp)  ! since the first day of the current week
+         ELSEIF( sdjf%cltype      == 'daily'   ) THEN   ;   ztmp = REAL(nsec_day  ,wp)  ! since 00h of the current day
+         ELSE                                           ;   ztmp = REAL(nsec_year ,wp)  ! since 00h on Jan 1 of the current year
+         ENDIF
+         ztmp = ztmp + 0.5 * REAL(kn_fsbc - 1, wp) * rdttra(1) + REAL( it_offset, wp )  ! centrered in the middle of sbc time step
+         ztmp = ztmp + 0.01 * rdttra(1)                                                 ! avoid truncation error 
+         IF( sdjf%ln_tint ) THEN                ! time interpolation, shift by 1/2 record
+            !
+            !          INT( ztmp/ifreq_sec + 0.5 )
+            !                     /|\
+            !                    2 |        *-----(
+            !                    1 |  *-----(
+            !                    0 |--(              
+            !                      |--+--|--+--|--+--|--> time
+            !                      0 /|\ 1 /|\ 2 /|\ 3    (ztmp/ifreq_sec)
+            !                         |     |     |
+            !                         |     |     |
+            !       forcing record :  1     2     3
+            !                   
+            ztmp= ztmp / REAL(ifreq_sec, wp) + 0.5
+         ELSE                                   ! no time interpolation
+            !
+            !           INT( ztmp/ifreq_sec )
+            !                     /|\
+            !                    2 |           *-----(
+            !                    1 |     *-----(
+            !                    0 |-----(              
+            !                      |--+--|--+--|--+--|--> time
+            !                      0 /|\ 1 /|\ 2 /|\ 3    (ztmp/ifreq_sec)
+            !                         |     |     |
+            !                         |     |     |
+            !       forcing record :  1     2     3
+            !                            
+            ztmp= ztmp / REAL(ifreq_sec, wp)
+         ENDIF
+         sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/))   ! record number to be read
+
+         iendrec = ifreq_sec * sdjf%nrec_a(1) + nsec1jan000       ! end of this record (in second)
+         ! add the number of seconds between 00h Jan 1 and the end of previous month/week/day (ok if nmonth=1)
+         IF( sdjf%cltype      == 'monthly' )   iendrec = iendrec + NINT(rday) * SUM(nmonth_len(1:nmonth -1))
+         IF( sdjf%cltype(1:4) == 'week'    )   iendrec = iendrec + ( nsec_year - isec_week )
+         IF( sdjf%cltype      == 'daily'   )   iendrec = iendrec + NINT(rday) * ( nday_year - 1 )
+         IF( sdjf%ln_tint ) THEN
+             sdjf%nrec_a(2) = iendrec - ifreq_sec / 2        ! swap at the middle of the record
+         ELSE
+             sdjf%nrec_a(2) = iendrec                        ! swap at the end    of the record
+             sdjf%nrec_b(2) = iendrec - ifreq_sec            ! beginning of the record (only for print)
+         ENDIF
+         !
+      ENDIF
+      !
+   END SUBROUTINE fld_rec
+
+
+   SUBROUTINE fld_get( sdjf, map )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_get  ***
+      !!
+      !! ** Purpose :   read the data
+      !!----------------------------------------------------------------------
+      TYPE(FLD), INTENT(inout) ::   sdjf   ! input field related variables
+      TYPE(MAP_POINTER),INTENT(in) ::   map   ! global-to-local mapping indices
+      !!
+      INTEGER                  ::   ipk    ! number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk )
+      INTEGER                  ::   iw     ! index into wgts array
+      INTEGER                  ::   ipdom  ! index of the domain
+      !!---------------------------------------------------------------------
+      !
+      ipk = SIZE( sdjf%fnow, 3 )
+      !
+      IF( ASSOCIATED(map%ptr) ) THEN
+         IF( sdjf%ln_tint ) THEN   ;   CALL fld_map2( sdjf%num, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1), map%ptr )
+         ELSE                      ;   CALL fld_map2( sdjf%num, sdjf%clvar, sdjf%fnow(:,:,:  ), sdjf%nrec_a(1), map%ptr )
+         ENDIF
+      ELSE IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN
+         CALL wgt_list( sdjf, iw )
+         IF( sdjf%ln_tint ) THEN   ;   CALL fld_interp( sdjf%num, sdjf%clvar, iw , ipk  , sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
+         ELSE                      ;   CALL fld_interp( sdjf%num, sdjf%clvar, iw , ipk  , sdjf%fnow(:,:,:  ), sdjf%nrec_a(1) )
+         ENDIF
+      ELSE
+         IF( SIZE(sdjf%fnow, 1) == jpi ) THEN  ;  ipdom = jpdom_data
+         ELSE                                  ;  ipdom = jpdom_unknown
+         ENDIF
+         SELECT CASE( ipk )
+         CASE(1)
+            IF( sdjf%ln_tint ) THEN   ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_a(1) )
+            ELSE                      ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,1  ), sdjf%nrec_a(1) )
+            ENDIF
+         CASE DEFAULT
+            IF( sdjf%ln_tint ) THEN   ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
+            ELSE                      ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,:  ), sdjf%nrec_a(1) )
+            ENDIF
+         END SELECT
+      ENDIF
+      !
+      sdjf%rotn(2) = .false.   ! vector not yet rotated
+
+   END SUBROUTINE fld_get
+
+   SUBROUTINE fld_map2( num, clvar, dta, nrec, map )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_map  ***
+      !!
+      !! ** Purpose :   read global data from file and map onto local data
+      !!                using a general mapping (for open boundaries)
+      !!----------------------------------------------------------------------
+#if defined key_bdy
+      USE bdy_oce, ONLY:  dta_global, dta_global2         ! workspace to read in global data arrays
+#endif 
+      INTEGER                   , INTENT(in ) ::   num     ! stream number
+      CHARACTER(LEN=*)          , INTENT(in ) ::   clvar   ! variable name
+      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   dta   ! output field on model grid (2 dimensional)
+      INTEGER                   , INTENT(in ) ::   nrec    ! record number to read (ie time slice)
+      INTEGER,  DIMENSION(:)    , INTENT(in ) ::   map     ! global-to-local mapping indices
+      !!
+      INTEGER                                 ::   ipi      ! length of boundary data on local process
+      INTEGER                                 ::   ipj      ! length of dummy dimension ( = 1 )
+      INTEGER                                 ::   ipk      ! number of vertical levels of dta ( 2D: ipk=1 ; 3D: ipk=jpk )
+      INTEGER                                 ::   ilendta  ! length of data in file
+      INTEGER                                 ::   idvar    ! variable ID
+      INTEGER                                 ::   ib, ik, ji, jj   ! loop counters
+      INTEGER                                 ::   ierr
+      REAL(wp), POINTER, DIMENSION(:,:,:)     ::   dta_read  ! work space for global data
+      !!---------------------------------------------------------------------
+            
+      ipi = SIZE( dta, 1 )
+      ipj = 1
+      ipk = SIZE( dta, 3 )
+
+      idvar   = iom_varid( num, clvar )
+      ilendta = iom_file(num)%dimsz(1,idvar)
+
+#if defined key_bdy
+      ipj = iom_file(num)%dimsz(2,idvar)
+      IF (ipj == 1) THEN ! we assume that this is a structured open boundary file
+         dta_read => dta_global
+      ELSE
+         dta_read => dta_global2
+      ENDIF
+#endif
+
+      IF(lwp) WRITE(numout,*) 'Dim size for ',TRIM(clvar),' is ', ilendta
+      IF(lwp) WRITE(numout,*) 'Number of levels for ',TRIM(clvar),' is ', ipk
+
+      SELECT CASE( ipk )
+      CASE(1)        ;   CALL iom_get ( num, jpdom_unknown, clvar, dta_read(1:ilendta,1:ipj,1    ), nrec )
+      CASE DEFAULT   ;   CALL iom_get ( num, jpdom_unknown, clvar, dta_read(1:ilendta,1:ipj,1:ipk), nrec )
+      END SELECT
+      !
+      IF (ipj==1) THEN
+         DO ib = 1, ipi
+            DO ik = 1, ipk
+               dta(ib,1,ik) =  dta_read(map(ib),1,ik)
+            END DO
+         END DO
+      ELSE ! we assume that this is a structured open boundary file
+         DO ib = 1, ipi
+            jj=1+floor(REAL(map(ib)-1)/REAL(ilendta))
+            ji=map(ib)-(jj-1)*ilendta
+            DO ik = 1, ipk
+               dta(ib,1,ik) =  dta_read(ji,jj,ik)
+            END DO
+         END DO
+      ENDIF
+
+   END SUBROUTINE fld_map2
+
+
+   SUBROUTINE fld_rot2( kt, sd )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_rot  ***
+      !!
+      !! ** Purpose :   Vector fields may need to be rotated onto the local grid direction
+      !!----------------------------------------------------------------------
+      INTEGER  , INTENT(in   )               ::   kt        ! ocean time step
+      TYPE(FLD), INTENT(inout), DIMENSION(:) ::   sd        ! input field related variables
+      !!
+      INTEGER                           ::   ju,jv,jk,jn  ! loop indices
+      INTEGER                           ::   imf          ! size of the structure sd
+      INTEGER                           ::   ill          ! character length
+      INTEGER                           ::   iv           ! indice of V component
+      REAL(wp), POINTER, DIMENSION(:,:) ::   utmp, vtmp   ! temporary arrays for vector rotation
+      CHARACTER (LEN=100)               ::   clcomp       ! dummy weight name
+      !!---------------------------------------------------------------------
+
+      CALL wrk_alloc( jpi,jpj, utmp, vtmp )
+
+      !! (sga: following code should be modified so that pairs arent searched for each time
+      !
+      imf = SIZE( sd )
+      DO ju = 1, imf
+         ill = LEN_TRIM( sd(ju)%vcomp )
+         DO jn = 2-COUNT((/sd(ju)%ln_tint/)), 2
+            IF( ill > 0 .AND. .NOT. sd(ju)%rotn(jn) ) THEN   ! find vector rotations required             
+               IF( sd(ju)%vcomp(1:1) == 'U' ) THEN      ! east-west component has symbolic name starting with 'U'
+                  ! look for the north-south component which has same symbolic name but with 'U' replaced with 'V'
+                  clcomp = 'V' // sd(ju)%vcomp(2:ill)   ! works even if ill == 1
+                  iv = -1
+                  DO jv = 1, imf
+                     IF( TRIM(sd(jv)%vcomp) == TRIM(clcomp) )   iv = jv
+                  END DO
+                  IF( iv > 0 ) THEN   ! fields ju and iv are two components which need to be rotated together
+                     DO jk = 1, SIZE( sd(ju)%fnow, 3 )
+                        IF( sd(ju)%ln_tint )THEN
+                           CALL rot_rep( sd(ju)%fdta(:,:,jk,jn), sd(iv)%fdta(:,:,jk,jn), 'T', 'en->i', utmp(:,:) )
+                           CALL rot_rep( sd(ju)%fdta(:,:,jk,jn), sd(iv)%fdta(:,:,jk,jn), 'T', 'en->j', vtmp(:,:) )
+                           sd(ju)%fdta(:,:,jk,jn) = utmp(:,:)   ;   sd(iv)%fdta(:,:,jk,jn) = vtmp(:,:)
+                        ELSE 
+                           CALL rot_rep( sd(ju)%fnow(:,:,jk  ), sd(iv)%fnow(:,:,jk  ), 'T', 'en->i', utmp(:,:) )
+                           CALL rot_rep( sd(ju)%fnow(:,:,jk  ), sd(iv)%fnow(:,:,jk  ), 'T', 'en->j', vtmp(:,:) )
+                           sd(ju)%fnow(:,:,jk   ) = utmp(:,:)   ;   sd(iv)%fnow(:,:,jk   ) = vtmp(:,:)
+                        ENDIF
+                     END DO
+                     sd(ju)%rotn(jn) = .TRUE.               ! vector was rotated 
+                     IF( lwp .AND. kt == nit000 )   WRITE(numout,*)   &
+                        &   'fld_read: vector pair ('//TRIM(sd(ju)%clvar)//', '//TRIM(sd(iv)%clvar)//') rotated on to model grid'
+                  ENDIF
+               ENDIF
+            ENDIF
+         END DO
+       END DO
+      !
+      CALL wrk_dealloc( jpi,jpj, utmp, vtmp )
+      !
+   END SUBROUTINE fld_rot2
+
+
+   SUBROUTINE fld_clopn( sdjf, kyear, kmonth, kday, ldstop )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_clopn  ***
+      !!
+      !! ** Purpose :   update the file name and open the file
+      !!----------------------------------------------------------------------
+      TYPE(FLD)        , INTENT(inout) ::   sdjf     ! input field related variables
+      INTEGER, OPTIONAL, INTENT(in   ) ::   kyear    ! year value
+      INTEGER, OPTIONAL, INTENT(in   ) ::   kmonth   ! month value
+      INTEGER, OPTIONAL, INTENT(in   ) ::   kday     ! day value
+      LOGICAL, OPTIONAL, INTENT(in   ) ::   ldstop   ! stop if open to read a non-existing file (default = .TRUE.)
+      !!
+      LOGICAL :: llprevyr              ! are we reading previous year  file?
+      LOGICAL :: llprevmth             ! are we reading previous month file?
+      INTEGER :: iyear, imonth, iday   ! first day of the current file in yyyy mm dd
+      INTEGER :: isec_week             ! number of seconds since start of the weekly file
+      INTEGER :: indexyr               ! year undex (O/1/2: previous/current/next)
+      INTEGER :: iyear_len, imonth_len ! length (days) of iyear and imonth             ! 
+      CHARACTER(len = 256)::   clname  ! temporary file name
+      !!----------------------------------------------------------------------
+      IF( PRESENT(kyear) ) THEN                             ! use given values 
+         iyear = kyear
+         imonth = kmonth
+         iday = kday
+      ELSE                                                  ! use current day values
+         IF ( sdjf%cltype(1:4) == 'week' ) THEN             ! find the day of the beginning of the week
+            isec_week  = ksec_week( sdjf%cltype(6:8) )      ! second since the beginning of the week
+            llprevmth  = isec_week > nsec_month             ! longer time since beginning of the week than the month
+            llprevyr   = llprevmth .AND. nmonth == 1
+         ELSE
+            isec_week  = 0
+            llprevmth  = .FALSE.
+            llprevyr   = .FALSE.
+         ENDIF
+         iyear  = nyear  - COUNT((/llprevyr /))
+         imonth = nmonth - COUNT((/llprevmth/)) + 12 * COUNT((/llprevyr /))
+         iday   = nday   + nmonth_len(nmonth-1) * COUNT((/llprevmth/)) - isec_week / NINT(rday)
+      ENDIF
+
+      ! build the new filename if not climatological data
+      clname=TRIM(sdjf%clrootname)
+      !
+      ! note that sdjf%ln_clim is is only acting on the presence of the year in the file name
+      IF( .NOT. sdjf%ln_clim ) THEN   
+                                         WRITE(clname, '(a,"_y",i4.4)' ) TRIM( sdjf%clrootname ), iyear    ! add year
+         IF( sdjf%cltype /= 'yearly' )   WRITE(clname, '(a,"m" ,i2.2)' ) TRIM( clname          ), imonth   ! add month
+      ELSE
+         ! build the new filename if climatological data
+         IF( sdjf%cltype /= 'yearly' )   WRITE(clname, '(a,"_m",i2.2)' ) TRIM( sdjf%clrootname ), imonth   ! add month
+      ENDIF
+      IF( sdjf%cltype == 'daily' .OR. sdjf%cltype(1:4) == 'week' ) &
+            &                            WRITE(clname, '(a,"d" ,i2.2)' ) TRIM( clname          ), iday     ! add day
+      !
+      IF( TRIM(clname) /= TRIM(sdjf%clname) .OR. sdjf%num == 0 ) THEN   ! new file to be open 
+
+         sdjf%clname = TRIM(clname)
+         IF( sdjf%num /= 0 )   CALL iom_close( sdjf%num )   ! close file if already open
+         CALL iom_open( sdjf%clname, sdjf%num, ldstop = ldstop, ldiof =  LEN(TRIM(sdjf%wgtname)) > 0 )
+
+         ! find the last record to be read -> update sdjf%nreclast
+         indexyr = iyear - nyear + 1
+         iyear_len = nyear_len( indexyr )
+         SELECT CASE ( indexyr )
+         CASE ( 0 )   ;   imonth_len = 31   ! previous year -> imonth = 12
+         CASE ( 1 )   ;   imonth_len = nmonth_len(imonth) 
+         CASE ( 2 )   ;   imonth_len = 31   ! next     year -> imonth = 1
+         END SELECT
+         
+         ! last record to be read in the current file
+         IF    ( sdjf%nfreqh == -12 ) THEN                 ;   sdjf%nreclast = 1    !  yearly mean
+         ELSEIF( sdjf%nfreqh ==  -1 ) THEN                                          ! monthly mean
+            IF(     sdjf%cltype      == 'monthly' ) THEN   ;   sdjf%nreclast = 1
+            ELSE                                           ;   sdjf%nreclast = 12
+            ENDIF
+         ELSE                                                                       ! higher frequency mean (in hours)
+            IF(     sdjf%cltype      == 'monthly' ) THEN   ;   sdjf%nreclast = 24 * imonth_len / sdjf%nfreqh 
+            ELSEIF( sdjf%cltype(1:4) == 'week'    ) THEN   ;   sdjf%nreclast = 24 * 7          / sdjf%nfreqh
+            ELSEIF( sdjf%cltype      == 'daily'   ) THEN   ;   sdjf%nreclast = 24              / sdjf%nfreqh
+            ELSE                                           ;   sdjf%nreclast = 24 * iyear_len  / sdjf%nfreqh 
+            ENDIF
+         ENDIF
+         
+      ENDIF
+      !
+   END SUBROUTINE fld_clopn
+
+
+   SUBROUTINE fld_fill2( sdf, sdf_n, nct, cdir, cdcaller, cdtitle, cdnam )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_fill  ***
+      !!
+      !! ** Purpose :   fill sdf with sdf_n and control print
+      !!----------------------------------------------------------------------
+      TYPE(FLD)  , DIMENSION(:), INTENT(inout) ::   sdf        ! structure of input fields (file informations, fields read)
+      TYPE(FLD_N), DIMENSION(:), INTENT(in   ) ::   sdf_n      ! array of namelist information structures
+      CHARACTER(len=*)         , INTENT(in   ) ::   cdir       ! Root directory for location of flx files
+      CHARACTER(len=*)         , INTENT(in   ) ::   cdcaller   ! 
+      CHARACTER(len=*)         , INTENT(in   ) ::   cdtitle    ! 
+      CHARACTER(len=*)         , INTENT(in   ) ::   cdnam      !
+      INTEGER                  , INTENT(in   ) ::   nct 
+      !
+      INTEGER  ::   jf       ! dummy indices
+      !!---------------------------------------------------------------------
+
+      DO jf = 1, SIZE(sdf)
+         sdf(jf)%clrootname = TRIM( cdir )//TRIM( sdf_n(jf)%clname )
+         IF( TRIM( sdf_n(jf)%clname ) == 'oasis' ) THEN
+              sdf(jf)%loasis=.TRUE.
+              sdf(jf)%lfile=.FALSE.
+         ELSE IF( TRIM( sdf_n(jf)%clname ) == 'file' ) THEN
+              sdf(jf)%loasis=.FALSE.
+              sdf(jf)%lfile=.TRUE.
+         END IF
+         sdf(jf)%clname     = "not yet defined"
+         sdf(jf)%clvgrd     = sdf_n(jf)%clvgrd
+         IF( TRIM( sdf_n(jf)%clcat ) == 'yes' ) THEN
+              sdf(jf)%nct=nct
+         ELSE
+              sdf(jf)%nct=1
+         END IF
+         sdf(jf)%nfreqh     = sdf_n(jf)%nfreqh
+         sdf(jf)%nsgn       = 1
+         sdf(jf)%clvar      = sdf_n(jf)%clvar
+         sdf(jf)%ln_tint    = sdf_n(jf)%ln_tint
+         sdf(jf)%ln_clim    = sdf_n(jf)%ln_clim
+         sdf(jf)%cltype     = sdf_n(jf)%cltype
+         sdf(jf)%num        = -1
+         sdf(jf)%wgtname    = " "
+         sdf(jf)%nid(:)     = 0
+         sdf(jf)%ninfo      = OASIS_idle
+
+         IF( LEN( TRIM(sdf_n(jf)%wname) ) > 0 )   sdf(jf)%wgtname = TRIM( cdir )//TRIM( sdf_n(jf)%wname )
+         sdf(jf)%vcomp      = sdf_n(jf)%vcomp
+         sdf(jf)%rotn(:)    = .TRUE.   ! pretend to be rotated -> won't try to rotate data before the first call to fld_get
+         IF( sdf(jf)%cltype(1:4) == 'week' .AND. nn_leapy == 0  )   &
+            &   CALL ctl_stop('fld_clopn: weekly file ('//TRIM(sdf(jf)%clrootname)//') needs nn_leapy = 1')
+         IF( sdf(jf)%cltype(1:4) == 'week' .AND. sdf(jf)%ln_clim )   &
+            &   CALL ctl_stop('fld_clopn: weekly file ('//TRIM(sdf(jf)%clrootname)//') needs ln_clim = .FALSE.')
+      END DO
+
+      IF(lwp) THEN      ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) TRIM( cdcaller )//' : '//TRIM( cdtitle )
+         WRITE(numout,*) (/ ('~', jf = 1, LEN_TRIM( cdcaller ) ) /)
+         WRITE(numout,*) '          '//TRIM( cdnam )//' Namelist'
+         WRITE(numout,*) '          list of files and frequency (>0: in hours ; <0 in months)'
+         DO jf = 1, SIZE(sdf)
+            WRITE(numout,*) '               root filename: '  , TRIM( sdf(jf)%clrootname ),   &
+               &                          ' variable name: '  , TRIM( sdf(jf)%clvar      )
+            WRITE(numout,*) '               frequency: '      ,       sdf(jf)%nfreqh      ,   &
+               &                          ' time interp: '    ,       sdf(jf)%ln_tint     ,   &
+               &                          ' climatology: '    ,       sdf(jf)%ln_clim     ,   &
+               &                          ' weights    : '    , TRIM( sdf(jf)%wgtname    ),   &
+               &                          ' pairing    : '    , TRIM( sdf(jf)%vcomp      ),   &
+               &                          ' data type: '      ,       sdf(jf)%cltype
+            call flush(numout)
+         END DO
+      ENDIF
+      
+   END SUBROUTINE fld_fill2
+
+
+   SUBROUTINE wgt_list( sd, kwgt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE wgt_list  ***
+      !!
+      !! ** Purpose :   search array of WGTs and find a weights file
+      !!                entry, or return a new one adding it to the end
+      !!                if it is a new entry, the weights data is read in and
+      !!                restructured (fld_weight)
+      !!----------------------------------------------------------------------
+      TYPE( FLD ), INTENT(in   ) ::   sd        ! field with name of weights file
+      INTEGER    , INTENT(inout) ::   kwgt      ! index of weights
+      !!
+      INTEGER ::   kw, nestid   ! local integer
+      LOGICAL ::   found        ! local logical
+      !!----------------------------------------------------------------------
+      !
+      !! search down linked list 
+      !! weights filename is either present or we hit the end of the list
+      found = .FALSE.
+
+      !! because agrif nest part of filenames are now added in iom_open
+      !! to distinguish between weights files on the different grids, need to track
+      !! nest number explicitly
+      nestid = 0
+#if defined key_agrif
+      nestid = Agrif_Fixed()
+#endif
+      DO kw = 1, nxt_wgt-1
+         IF( TRIM(ref_wgts(kw)%wgtname) == TRIM(sd%wgtname) .AND. &
+             ref_wgts(kw)%nestid == nestid) THEN
+            kwgt = kw
+            found = .TRUE.
+            EXIT
+         ENDIF
+      END DO
+      IF( .NOT.found ) THEN
+         kwgt = nxt_wgt
+         CALL fld_weight( sd )
+      ENDIF
+      !
+   END SUBROUTINE wgt_list
+
+
+   SUBROUTINE wgt_print( )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE wgt_print  ***
+      !!
+      !! ** Purpose :   print the list of known weights
+      !!----------------------------------------------------------------------
+      INTEGER ::   kw   !
+      !!----------------------------------------------------------------------
+      !
+      DO kw = 1, nxt_wgt-1
+         WRITE(numout,*) 'weight file:  ',TRIM(ref_wgts(kw)%wgtname)
+         WRITE(numout,*) '      ddims:  ',ref_wgts(kw)%ddims(1),ref_wgts(kw)%ddims(2)
+         WRITE(numout,*) '     numwgt:  ',ref_wgts(kw)%numwgt
+         WRITE(numout,*) '     jpiwgt:  ',ref_wgts(kw)%jpiwgt
+         WRITE(numout,*) '     jpjwgt:  ',ref_wgts(kw)%jpjwgt
+         WRITE(numout,*) '    botleft:  ',ref_wgts(kw)%botleft
+         WRITE(numout,*) '   topright:  ',ref_wgts(kw)%topright
+         IF( ref_wgts(kw)%cyclic ) THEN
+            WRITE(numout,*) '       cyclical'
+            IF( ref_wgts(kw)%overlap > 0 ) WRITE(numout,*) '              with overlap of ', ref_wgts(kw)%overlap
+         ELSE
+            WRITE(numout,*) '       not cyclical'
+         ENDIF
+         IF( ASSOCIATED(ref_wgts(kw)%data_wgt) )  WRITE(numout,*) '       allocated'
+      END DO
+      !
+   END SUBROUTINE wgt_print
+
+
+   SUBROUTINE fld_weight( sd )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_weight  ***
+      !!
+      !! ** Purpose :   create a new WGT structure and fill in data from  
+      !!                file, restructuring as required
+      !!----------------------------------------------------------------------
+      TYPE( FLD ), INTENT(in) ::   sd   ! field with name of weights file
+      !!
+      INTEGER                           ::   jn            ! dummy loop indices
+      INTEGER                           ::   inum          ! temporary logical unit
+      INTEGER                           ::   id            ! temporary variable id
+      INTEGER                           ::   ipk           ! temporary vertical dimension
+      CHARACTER (len=5)                 ::   aname
+      INTEGER , DIMENSION(3)            ::   ddims
+      INTEGER , POINTER, DIMENSION(:,:) ::   data_src
+      REAL(wp), POINTER, DIMENSION(:,:) ::   data_tmp
+      LOGICAL                           ::   cyclical
+      INTEGER                           ::   zwrap      ! local integer
+      !!----------------------------------------------------------------------
+      !
+      CALL wrk_alloc( jpi,jpj, data_src )   ! integer
+      CALL wrk_alloc( jpi,jpj, data_tmp )
+      !
+      IF( nxt_wgt > tot_wgts ) THEN
+        CALL ctl_stop("fld_weight: weights array size exceeded, increase tot_wgts")
+      ENDIF
+      !
+      !! new weights file entry, add in extra information
+      !! a weights file represents a 2D grid of a certain shape, so we assume that the current
+      !! input data file is representative of all other files to be opened and processed with the
+      !! current weights file
+
+      !! open input data file (non-model grid)
+      CALL iom_open( sd%clname, inum, ldiof =  LEN(TRIM(sd%wgtname)) > 0 )
+
+      !! get dimensions
+      id = iom_varid( inum, sd%clvar, ddims )
+
+      !! close it
+      CALL iom_close( inum )
+
+      !! now open the weights file
+
+      CALL iom_open ( sd%wgtname, inum )   ! interpolation weights
+      IF ( inum > 0 ) THEN
+
+         !! determine whether we have an east-west cyclic grid
+         !! from global attribute called "ew_wrap" in the weights file
+         !! note that if not found, iom_getatt returns -999 and cyclic with no overlap is assumed
+         !! since this is the most common forcing configuration
+
+         CALL iom_getatt(inum, 'ew_wrap', zwrap)
+         IF( zwrap >= 0 ) THEN
+            cyclical = .TRUE.
+         ELSE IF( zwrap == -999 ) THEN
+            cyclical = .TRUE.
+            zwrap = 0
+         ELSE
+            cyclical = .FALSE.
+         ENDIF
+
+         ref_wgts(nxt_wgt)%ddims(1) = ddims(1)
+         ref_wgts(nxt_wgt)%ddims(2) = ddims(2)
+         ref_wgts(nxt_wgt)%wgtname = sd%wgtname
+         ref_wgts(nxt_wgt)%overlap = zwrap
+         ref_wgts(nxt_wgt)%cyclic = cyclical
+         ref_wgts(nxt_wgt)%nestid = 0
+#if defined key_agrif
+         ref_wgts(nxt_wgt)%nestid = Agrif_Fixed()
+#endif
+         !! weights file is stored as a set of weights (wgt01->wgt04 or wgt01->wgt16)
+         !! for each weight wgtNN there is an integer array srcNN which gives the point in
+         !! the input data grid which is to be multiplied by the weight
+         !! they are both arrays on the model grid so the result of the multiplication is
+         !! added into an output array on the model grid as a running sum
+
+         !! two possible cases: bilinear (4 weights) or bicubic (16 weights)
+         id = iom_varid(inum, 'src05', ldstop=.FALSE.)
+         IF( id <= 0) THEN
+            ref_wgts(nxt_wgt)%numwgt = 4
+         ELSE
+            ref_wgts(nxt_wgt)%numwgt = 16
+         ENDIF
+
+         ALLOCATE( ref_wgts(nxt_wgt)%data_jpi(jpi,jpj,4) )
+         ALLOCATE( ref_wgts(nxt_wgt)%data_jpj(jpi,jpj,4) )
+         ALLOCATE( ref_wgts(nxt_wgt)%data_wgt(jpi,jpj,ref_wgts(nxt_wgt)%numwgt) )
+
+         DO jn = 1,4
+            aname = ' '
+            WRITE(aname,'(a3,i2.2)') 'src',jn
+            data_tmp(:,:) = 0
+            CALL iom_get ( inum, jpdom_data, aname, data_tmp(:,:) )
+            data_src(:,:) = INT(data_tmp(:,:))
+            ref_wgts(nxt_wgt)%data_jpj(:,:,jn) = 1 + (data_src(:,:)-1) / ref_wgts(nxt_wgt)%ddims(1)
+            ref_wgts(nxt_wgt)%data_jpi(:,:,jn) = data_src(:,:) - ref_wgts(nxt_wgt)%ddims(1)*(ref_wgts(nxt_wgt)%data_jpj(:,:,jn)-1)
+         END DO
+
+         DO jn = 1, ref_wgts(nxt_wgt)%numwgt
+            aname = ' '
+            WRITE(aname,'(a3,i2.2)') 'wgt',jn
+            ref_wgts(nxt_wgt)%data_wgt(:,:,jn) = 0.0
+            CALL iom_get ( inum, jpdom_data, aname, ref_wgts(nxt_wgt)%data_wgt(:,:,jn) )
+         END DO
+         CALL iom_close (inum)
+ 
+         ! find min and max indices in grid
+         ref_wgts(nxt_wgt)%botleft(1) = MINVAL(ref_wgts(nxt_wgt)%data_jpi(:,:,:))
+         ref_wgts(nxt_wgt)%botleft(2) = MINVAL(ref_wgts(nxt_wgt)%data_jpj(:,:,:))
+         ref_wgts(nxt_wgt)%topright(1) = MAXVAL(ref_wgts(nxt_wgt)%data_jpi(:,:,:))
+         ref_wgts(nxt_wgt)%topright(2) = MAXVAL(ref_wgts(nxt_wgt)%data_jpj(:,:,:))
+
+         ! and therefore dimensions of the input box
+         ref_wgts(nxt_wgt)%jpiwgt = ref_wgts(nxt_wgt)%topright(1) - ref_wgts(nxt_wgt)%botleft(1) + 1
+         ref_wgts(nxt_wgt)%jpjwgt = ref_wgts(nxt_wgt)%topright(2) - ref_wgts(nxt_wgt)%botleft(2) + 1
+
+         ! shift indexing of source grid
+         ref_wgts(nxt_wgt)%data_jpi(:,:,:) = ref_wgts(nxt_wgt)%data_jpi(:,:,:) - ref_wgts(nxt_wgt)%botleft(1) + 1
+         ref_wgts(nxt_wgt)%data_jpj(:,:,:) = ref_wgts(nxt_wgt)%data_jpj(:,:,:) - ref_wgts(nxt_wgt)%botleft(2) + 1
+
+         ! create input grid, give it a halo to allow gradient calculations
+         ! SA: +3 stencil is a patch to avoid out-of-bound computation in some configuration. 
+         ! a more robust solution will be given in next release
+         ipk =  SIZE(sd%fnow, 3)
+         ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3 ,ipk) )
+         IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col(1,ref_wgts(nxt_wgt)%jpjwgt+3,ipk) )
+
+         nxt_wgt = nxt_wgt + 1
+
+      ELSE 
+         CALL ctl_stop( '    fld_weight : unable to read the file ' )
+      ENDIF
+
+      CALL wrk_dealloc( jpi,jpj, data_src )   ! integer
+      CALL wrk_dealloc( jpi,jpj, data_tmp )
+      !
+   END SUBROUTINE fld_weight
+
+
+   SUBROUTINE fld_interp( num, clvar, kw, kk, dta, nrec )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_interp  ***
+      !!
+      !! ** Purpose :   apply weights to input gridded data to create data
+      !!                on model grid
+      !!----------------------------------------------------------------------
+      INTEGER                   , INTENT(in   ) ::   num     ! stream number
+      CHARACTER(LEN=*)          , INTENT(in   ) ::   clvar   ! variable name
+      INTEGER                   , INTENT(in   ) ::   kw      ! weights number
+      INTEGER                   , INTENT(in   ) ::   kk      ! vertical dimension of kk
+      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   dta     ! output field on model grid
+      INTEGER                   , INTENT(in   ) ::   nrec    ! record number to read (ie time slice)
+      !! 
+      INTEGER, DIMENSION(3) ::   rec1,recn   ! temporary arrays for start and length
+      INTEGER ::  jk, jn, jm           ! loop counters
+      INTEGER ::  ni, nj               ! lengths
+      INTEGER ::  jpimin,jpiwid        ! temporary indices
+      INTEGER ::  jpjmin,jpjwid        ! temporary indices
+      INTEGER ::  jpi1,jpi2,jpj1,jpj2  ! temporary indices
+      !!----------------------------------------------------------------------
+      !
+      !! for weighted interpolation we have weights at four corners of a box surrounding 
+      !! a model grid point, each weight is multiplied by a grid value (bilinear case)
+      !! or by a grid value and gradients at the corner point (bicubic case) 
+      !! so we need to have a 4 by 4 subgrid surrounding each model point to cover both cases
+
+      !! sub grid from non-model input grid which encloses all grid points in this nemo process
+      jpimin = ref_wgts(kw)%botleft(1)
+      jpjmin = ref_wgts(kw)%botleft(2)
+      jpiwid = ref_wgts(kw)%jpiwgt
+      jpjwid = ref_wgts(kw)%jpjwgt
+
+      !! when reading in, expand this sub-grid by one halo point all the way round for calculating gradients
+      rec1(1) = MAX( jpimin-1, 1 )
+      rec1(2) = MAX( jpjmin-1, 1 )
+      rec1(3) = 1
+      recn(1) = MIN( jpiwid+2, ref_wgts(kw)%ddims(1)-rec1(1)+1 )
+      recn(2) = MIN( jpjwid+2, ref_wgts(kw)%ddims(2)-rec1(2)+1 )
+      recn(3) = kk
+
+      !! where we need to put it in the non-nemo grid fly_dta
+      !! note that jpi1 and jpj1 only differ from 1 when jpimin and jpjmin are 1
+      !! (ie at the extreme west or south of the whole input grid) and similarly for jpi2 and jpj2
+      jpi1 = 2 + rec1(1) - jpimin
+      jpj1 = 2 + rec1(2) - jpjmin
+      jpi2 = jpi1 + recn(1) - 1
+      jpj2 = jpj1 + recn(2) - 1
+
+      ref_wgts(kw)%fly_dta(:,:,:) = 0.0
+      SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) )
+      CASE(1)
+           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn)
+      CASE DEFAULT
+           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn)
+      END SELECT 
+
+      !! first four weights common to both bilinear and bicubic
+      !! data_jpi, data_jpj have already been shifted to (1,1) corresponding to botleft
+      !! note that we have to offset by 1 into fly_dta array because of halo
+      dta(:,:,:) = 0.0
+      DO jk = 1,4
+        DO jn = 1, jpj
+          DO jm = 1,jpi
+            ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
+            nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
+            dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1,:)
+          END DO
+        END DO
+      END DO
+
+      IF (ref_wgts(kw)%numwgt .EQ. 16) THEN
+
+        !! fix up halo points that we couldnt read from file
+        IF( jpi1 == 2 ) THEN
+           ref_wgts(kw)%fly_dta(jpi1-1,:,:) = ref_wgts(kw)%fly_dta(jpi1,:,:)
+        ENDIF
+        IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN
+           ref_wgts(kw)%fly_dta(jpi2+1,:,:) = ref_wgts(kw)%fly_dta(jpi2,:,:)
+        ENDIF
+        IF( jpj1 == 2 ) THEN
+           ref_wgts(kw)%fly_dta(:,jpj1-1,:) = ref_wgts(kw)%fly_dta(:,jpj1,:)
+        ENDIF
+        IF( jpj2 + jpjmin - 1 == ref_wgts(kw)%ddims(2)+1 .AND. jpj2 .lt. jpjwid+2 ) THEN
+           ref_wgts(kw)%fly_dta(:,jpj2+1,:) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2,:) - ref_wgts(kw)%fly_dta(:,jpj2-1,:)
+        ENDIF
+
+        !! if data grid is cyclic we can do better on east-west edges
+        !! but have to allow for whether first and last columns are coincident
+        IF( ref_wgts(kw)%cyclic ) THEN
+           rec1(2) = MAX( jpjmin-1, 1 )
+           recn(1) = 1
+           recn(2) = MIN( jpjwid+2, ref_wgts(kw)%ddims(2)-rec1(2)+1 )
+           jpj1 = 2 + rec1(2) - jpjmin
+           jpj2 = jpj1 + recn(2) - 1
+           IF( jpi1 == 2 ) THEN
+              rec1(1) = ref_wgts(kw)%ddims(1) - ref_wgts(kw)%overlap
+              SELECT CASE( SIZE( ref_wgts(kw)%col(:,jpj1:jpj2,:),3) )
+              CASE(1)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,1), nrec, rec1, recn)
+              CASE DEFAULT
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,:), nrec, rec1, recn)
+              END SELECT      
+              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2,:) = ref_wgts(kw)%col(1,jpj1:jpj2,:)
+           ENDIF
+           IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN
+              rec1(1) = 1 + ref_wgts(kw)%overlap
+              SELECT CASE( SIZE( ref_wgts(kw)%col(:,jpj1:jpj2,:),3) )
+              CASE(1)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,1), nrec, rec1, recn)
+              CASE DEFAULT
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,:), nrec, rec1, recn)
+              END SELECT
+              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2,:) = ref_wgts(kw)%col(1,jpj1:jpj2,:)
+           ENDIF
+        ENDIF
+
+        ! gradient in the i direction
+        DO jk = 1,4
+          DO jn = 1, jpj
+            DO jm = 1,jpi
+              ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
+              nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj+1,:) - ref_wgts(kw)%fly_dta(ni,nj+1,:))
+            END DO
+          END DO
+        END DO
+
+        ! gradient in the j direction
+        DO jk = 1,4
+          DO jn = 1, jpj
+            DO jm = 1,jpi
+              ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
+              nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         &
+                               (ref_wgts(kw)%fly_dta(ni+1,nj+2,:) - ref_wgts(kw)%fly_dta(ni+1,nj,:))
+            END DO
+          END DO
+        END DO
+
+         ! gradient in the ij direction
+         DO jk = 1,4
+            DO jn = 1, jpj
+               DO jm = 1,jpi
+                  ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
+                  nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
+                  dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj+2,:) - ref_wgts(kw)%fly_dta(ni  ,nj+2,:)) -   &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj  ,:) - ref_wgts(kw)%fly_dta(ni  ,nj  ,:)))
+               END DO
+            END DO
+         END DO
+         !
+      END IF
+      !
+   END SUBROUTINE fld_interp
+
+
+   FUNCTION ksec_week( cdday )
+      !!---------------------------------------------------------------------
+      !!                    ***  FUNCTION kshift_week *** 
+      !!
+      !! ** Purpose :  
+      !!---------------------------------------------------------------------
+      CHARACTER(len=*), INTENT(in)   ::   cdday   !3 first letters of the first day of the weekly file
+      !!
+      INTEGER                        ::   ksec_week  ! output variable
+      INTEGER                        ::   ijul       !temp variable
+      INTEGER                        ::   ishift     !temp variable
+      CHARACTER(len=3),DIMENSION(7)  ::   cl_week 
+      !!----------------------------------------------------------------------
+      cl_week = (/"sun","sat","fri","thu","wed","tue","mon"/)
+      DO ijul = 1, 7
+         IF( cl_week(ijul) == TRIM(cdday) ) EXIT
+      END DO
+      IF( ijul .GT. 7 )   CALL ctl_stop( 'ksec_week: wrong day for sdjf%cltype(6:8): '//TRIM(cdday) )
+      !
+      ishift = ijul * NINT(rday)
+      ! 
+      ksec_week = nsec_week + ishift
+      ksec_week = MOD( ksec_week, 7*NINT(rday) )
+      ! 
+   END FUNCTION ksec_week
+
+   !!======================================================================
+END MODULE fldread2
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 4826)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 4827)
@@ -27,5 +27,7 @@
    USE dom_oce         ! ocean space and time domain
    USE phycst          ! physical constants
-   USE fldread         ! read input fields
+   USE fldread2        ! read input fields
+   USE fld_def
+   USE sbcget
    USE sbc_oce         ! Surface boundary condition: ocean fields
    USE cyclone         ! Cyclone 10m wind form trac of cyclone centres
@@ -49,17 +51,6 @@
    PUBLIC   blk_ice_core         ! routine called in sbc_ice_lim module
    PUBLIC   turb_core_2z         ! routine calles in sbcblk_mfs module
-
-   INTEGER , PARAMETER ::   jpfld   = 9           ! maximum number of files to read 
-   INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point
-   INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point
-   INTEGER , PARAMETER ::   jp_humi = 3           ! index of specific humidity               ( % )
-   INTEGER , PARAMETER ::   jp_qsr  = 4           ! index of solar heat                      (W/m2)
-   INTEGER , PARAMETER ::   jp_qlw  = 5           ! index of Long wave                       (W/m2)
-   INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
-   INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
-   INTEGER , PARAMETER ::   jp_snow = 8           ! index of snow (solid prcipitation)       (kg/m2/s)
-   INTEGER , PARAMETER ::   jp_tdif = 9           ! index of tau diff associated to HF tau   (N/m2)   at T-point
    
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
+   TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr
          
    !                                             !!! CORE bulk parameters
@@ -119,15 +110,7 @@
       INTEGER, INTENT(in) ::   kt   ! ocean time step
       !!
-      INTEGER  ::   ierror   ! return error code
-      INTEGER  ::   ifpr     ! dummy loop indice
-      INTEGER  ::   jfld     ! dummy loop arguments
-      !!
-      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
-      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read
-      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr             ! informations about the fields to be read
-      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow, sn_tdif   !       -                       -
-      NAMELIST/namsbc_core/ cn_dir , ln_2m  , ln_taudif, rn_pfac,           &
-         &                  sn_wndi, sn_wndj, sn_humi  , sn_qsr ,           &
-         &                  sn_qlw , sn_tair, sn_prec  , sn_snow, sn_tdif
+!      NAMELIST/namsbc_core/ cn_dir , ln_2m  , ln_taudif, rn_pfac,           &
+!         &                  sn_wndi, sn_wndj, sn_humi  , sn_qsr ,           &
+!         &                  sn_qlw , sn_tair, sn_prec  , sn_snow, sn_tdif
       !!---------------------------------------------------------------------
 
@@ -135,55 +118,19 @@
       IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
          !                                      ! ====================== !
-         ! set file information (default values)
-         cn_dir = './'       ! directory in which the model is executed
          !
-         ! (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_wndi = FLD_N( 'uwnd10m',    24     , 'u_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
-         sn_wndj = FLD_N( 'vwnd10m',    24     , 'v_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
-         sn_qsr  = FLD_N( 'qsw'    ,    24     , 'qsw'    ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
-         sn_qlw  = FLD_N( 'qlw'    ,    24     , 'qlw'    ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
-         sn_tair = FLD_N( 'tair10m',    24     , 't_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
-         sn_humi = FLD_N( 'humi10m',    24     , 'q_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
-         sn_prec = FLD_N( 'precip' ,    -1     , 'precip' ,  .true.    , .false. ,   'yearly'  , ''       , ''       )
-         sn_snow = FLD_N( 'snow'   ,    -1     , 'snow'   ,  .true.    , .false. ,   'yearly'  , ''       , ''       )
-         sn_tdif = FLD_N( 'taudif' ,    24     , 'taudif' ,  .true.    , .false. ,   'yearly'  , ''       , ''       )
-         !
-         REWIND( numnam )                          ! read in namlist namsbc_core
-         READ  ( numnam, namsbc_core )
          !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing?
-         IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   & 
+         IF( ln_dm2dc .AND. sf(jp_qsroce)%nfreqh /= 24 )   & 
             &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) 
-         IF( ln_dm2dc .AND. sn_qsr%ln_tint ) THEN
+         IF( ln_dm2dc .AND. sf(jp_qsroce)%ln_tint ) THEN
             CALL ctl_warn( 'sbc_blk_core: ln_dm2dc is taking care of the temporal interpolation of daily qsr',   &
                  &         '              ==> We force time interpolation = .false. for qsr' )
-            sn_qsr%ln_tint = .false.
+            sf(jp_qsroce)%ln_tint = .false.
          ENDIF
-         !                                         ! store namelist information in an array
-         slf_i(jp_wndi) = sn_wndi   ;   slf_i(jp_wndj) = sn_wndj
-         slf_i(jp_qsr ) = sn_qsr    ;   slf_i(jp_qlw ) = sn_qlw
-         slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi
-         slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow
-         slf_i(jp_tdif) = sn_tdif
          !                 
          lhftau = ln_taudif                        ! do we use HF tau information?
-         jfld = jpfld - COUNT( (/.NOT. lhftau/) )
-         !
-         ALLOCATE( sf(jfld), STAT=ierror )         ! set sf structure
-         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_core: unable to allocate sf structure' )
-         DO ifpr= 1, jfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
-            IF( slf_i(ifpr)%ln_tint )   ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
-         END DO
-         !                                         ! fill sf with slf_i and control print
-         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_core', 'flux formulation for ocean surface boundary condition', 'namsbc_core' )
          !
          sfx(:,:) = 0._wp                          ! salt flux; zero unless ice is present (computed in limsbc(_2).F90)
          !
       ENDIF
-
-      CALL fld_read( kt, nn_fsbc, sf )             ! input fields provided at the current time-step
-
       !                                            ! compute the surface ocean fluxes using CORE bulk formulea
       IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( kt, sf, sst_m, ssu_m, ssv_m )
@@ -192,5 +139,5 @@
       IF( MOD( kt - 1, nn_fsbc ) == 0 )   THEN
          qlw_ice(:,:,1)   = sf(jp_qlw)%fnow(:,:,1) 
-         qsr_ice(:,:,1)   = sf(jp_qsr)%fnow(:,:,1)
+         qsr_ice(:,:,1)   = sf(jp_qsroce)%fnow(:,:,1)
          tatm_ice(:,:)    = sf(jp_tair)%fnow(:,:,1)         
          qatm_ice(:,:)    = sf(jp_humi)%fnow(:,:,1)
@@ -298,6 +245,6 @@
       ! ocean albedo assumed to be constant + modify now Qsr to include the diurnal cycle                    ! Short Wave
       zztmp = 1. - albo
-      IF( ln_dm2dc ) THEN   ;   qsr(:,:) = zztmp * sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1)
-      ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1)
+      IF( ln_dm2dc ) THEN   ;   qsr(:,:) = zztmp * sbc_dcy( sf(jp_qsroce)%fnow(:,:,1) ) * tmask(:,:,1)
+      ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsroce)%fnow(:,:,1)   * tmask(:,:,1)
       ENDIF
 !CDIR COLLAPSE
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 4826)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 4827)
@@ -26,4 +26,7 @@
    USE sbcdcy          ! surface boundary condition: diurnal cycle
    USE phycst          ! physical constants
+   USE fldread2, ONLY: fld_fill2           ! read input fields
+   USE fld_def
+   USE sbcget
 #if defined key_lim3
    USE par_ice         ! ice parameters
@@ -53,7 +56,5 @@
 #endif
    USE diaar5, ONLY :   lk_diaar5
-#if defined key_cice
-   USE ice_domain_size, only: ncat
-#endif
+
    IMPLICIT NONE
    PRIVATE
@@ -63,39 +64,4 @@
    PUBLIC   sbc_cpl_ice_tau    ! routine called by sbc_ice_lim(_2).F90
    PUBLIC   sbc_cpl_ice_flx    ! routine called by sbc_ice_lim(_2).F90
-
-   INTEGER, PARAMETER ::   jpr_otx1   =  1            ! 3 atmosphere-ocean stress components on grid 1
-   INTEGER, PARAMETER ::   jpr_oty1   =  2            ! 
-   INTEGER, PARAMETER ::   jpr_otz1   =  3            ! 
-   INTEGER, PARAMETER ::   jpr_otx2   =  4            ! 3 atmosphere-ocean stress components on grid 2
-   INTEGER, PARAMETER ::   jpr_oty2   =  5            ! 
-   INTEGER, PARAMETER ::   jpr_otz2   =  6            ! 
-   INTEGER, PARAMETER ::   jpr_itx1   =  7            ! 3 atmosphere-ice   stress components on grid 1
-   INTEGER, PARAMETER ::   jpr_ity1   =  8            ! 
-   INTEGER, PARAMETER ::   jpr_itz1   =  9            ! 
-   INTEGER, PARAMETER ::   jpr_itx2   = 10            ! 3 atmosphere-ice   stress components on grid 2
-   INTEGER, PARAMETER ::   jpr_ity2   = 11            ! 
-   INTEGER, PARAMETER ::   jpr_itz2   = 12            ! 
-   INTEGER, PARAMETER ::   jpr_qsroce = 13            ! Qsr above the ocean
-   INTEGER, PARAMETER ::   jpr_qsrice = 14            ! Qsr above the ice
-   INTEGER, PARAMETER ::   jpr_qsrmix = 15 
-   INTEGER, PARAMETER ::   jpr_qnsoce = 16            ! Qns above the ocean
-   INTEGER, PARAMETER ::   jpr_qnsice = 17            ! Qns above the ice
-   INTEGER, PARAMETER ::   jpr_qnsmix = 18
-   INTEGER, PARAMETER ::   jpr_rain   = 19            ! total liquid precipitation (rain)
-   INTEGER, PARAMETER ::   jpr_snow   = 20            ! solid precipitation over the ocean (snow)
-   INTEGER, PARAMETER ::   jpr_tevp   = 21            ! total evaporation
-   INTEGER, PARAMETER ::   jpr_ievp   = 22            ! solid evaporation (sublimation)
-   INTEGER, PARAMETER ::   jpr_sbpr   = 23            ! sublimation - liquid precipitation - solid precipitation
-   INTEGER, PARAMETER ::   jpr_semp   = 24            ! solid freshwater budget (sublimation - snow)
-   INTEGER, PARAMETER ::   jpr_oemp   = 25            ! ocean freshwater budget (evap - precip)
-   INTEGER, PARAMETER ::   jpr_w10m   = 26            ! 10m wind
-   INTEGER, PARAMETER ::   jpr_dqnsdt = 27            ! d(Q non solar)/d(temperature)
-   INTEGER, PARAMETER ::   jpr_rnf    = 28            ! runoffs
-   INTEGER, PARAMETER ::   jpr_cal    = 29            ! calving
-   INTEGER, PARAMETER ::   jpr_taum   = 30            ! wind stress module
-   INTEGER, PARAMETER ::   jpr_co2    = 31
-   INTEGER, PARAMETER ::   jpr_topm   = 32            ! topmeltn
-   INTEGER, PARAMETER ::   jpr_botm   = 33            ! botmeltn
-   INTEGER, PARAMETER ::   jprcv      = 33            ! total number of fields received
 
    INTEGER, PARAMETER ::   jps_fice   =  1            ! ice fraction 
@@ -124,4 +90,6 @@
       CHARACTER(len = 32) ::   clvgrd                 ! grids on which is located the vector fields
    END TYPE FLD_C
+
+
    ! Send to the atmosphere                           !
    TYPE(FLD_C) ::   sn_snd_temp, sn_snd_alb, sn_snd_thick, sn_snd_crt, sn_snd_co2                        
@@ -129,14 +97,7 @@
    TYPE(FLD_C) ::   sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau, sn_rcv_dqnsdt, sn_rcv_qsr, sn_rcv_qns, sn_rcv_emp, sn_rcv_rnf
    TYPE(FLD_C) ::   sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2                        
-
-   TYPE ::   DYNARR     
-      REAL(wp), POINTER, DIMENSION(:,:,:)    ::   z3   
-   END TYPE DYNARR
-
-   TYPE( DYNARR ), SAVE, DIMENSION(jprcv) ::   frcv                      ! all fields recieved from the atmosphere
+   TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_otx1, sn_oty1, sn_otz1, sn_otx2, sn_oty2, sn_otz2,  sn_itx1, sn_ity1, sn_itz1, sn_itx2, sn_ity2, sn_itz2
 
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   albedo_oce_mix     ! ocean albedo sent to atmosphere (mix clear/overcast sky)
-
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(    :) ::   nrcvinfo           ! OASIS info argument
 
 #if ! defined key_lim2   &&   ! defined key_lim3
@@ -145,8 +106,5 @@
 #endif
 
-#if defined key_cice
-   INTEGER, PARAMETER ::   jpl = ncat
-#elif ! defined key_lim2   &&   ! defined key_lim3
-   INTEGER, PARAMETER ::   jpl = 1 
+#if ! defined key_cice  && ! defined key_lim2   &&   ! defined key_lim3
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   emp_ice
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qsr_ice
@@ -183,5 +141,5 @@
       ierr(:) = 0
       !
-      ALLOCATE( albedo_oce_mix(jpi,jpj), nrcvinfo(jprcv),  STAT=ierr(1) )
+      ALLOCATE( albedo_oce_mix(jpi,jpj),  STAT=ierr(1) )
       !
 #if ! defined key_lim2 && ! defined key_lim3
@@ -220,5 +178,5 @@
       INTEGER, INTENT(in) ::   k_ice    ! ice management in the sbc (=0/1/2/3)
       !!
-      INTEGER ::   jn   ! dummy loop index
+      INTEGER ::   jn       ! dummy loop index
       REAL(wp), POINTER, DIMENSION(:,:) ::   zacs, zaos
       !!
@@ -297,215 +255,14 @@
       !   Define the receive interface   !
       ! ================================ !
-      nrcvinfo(:) = OASIS_idle   ! needed by nrcvinfo(jpr_otx1) if we do not receive ocean stress 
-
-      ! for each field: define the OASIS name                              (srcv(:)%clname)
-      !                 define receive or not from the namelist parameters (srcv(:)%laction)
-      !                 define the north fold type of lbc                  (srcv(:)%nsgn)
-
-      ! default definitions of srcv
-      srcv(:)%laction = .FALSE.   ;   srcv(:)%clgrid = 'T'   ;   srcv(:)%nsgn = 1.   ;   srcv(:)%nct = 1
-
-      !                                                      ! ------------------------- !
-      !                                                      ! ice and ocean wind stress !   
-      !                                                      ! ------------------------- !
-      !                                                           ! Name 
-      srcv(jpr_otx1)%clname = 'O_OTaux1'      ! 1st ocean component on grid ONE (T or U)
-      srcv(jpr_oty1)%clname = 'O_OTauy1'      ! 2nd   -      -         -     - 
-      srcv(jpr_otz1)%clname = 'O_OTauz1'      ! 3rd   -      -         -     - 
-      srcv(jpr_otx2)%clname = 'O_OTaux2'      ! 1st ocean component on grid TWO (V)
-      srcv(jpr_oty2)%clname = 'O_OTauy2'      ! 2nd   -      -         -     - 
-      srcv(jpr_otz2)%clname = 'O_OTauz2'      ! 3rd   -      -         -     - 
-      !
-      srcv(jpr_itx1)%clname = 'O_ITaux1'      ! 1st  ice  component on grid ONE (T, F, I or U)
-      srcv(jpr_ity1)%clname = 'O_ITauy1'      ! 2nd   -      -         -     - 
-      srcv(jpr_itz1)%clname = 'O_ITauz1'      ! 3rd   -      -         -     - 
-      srcv(jpr_itx2)%clname = 'O_ITaux2'      ! 1st  ice  component on grid TWO (V)
-      srcv(jpr_ity2)%clname = 'O_ITauy2'      ! 2nd   -      -         -     - 
-      srcv(jpr_itz2)%clname = 'O_ITauz2'      ! 3rd   -      -         -     - 
-      ! 
+
       ! Vectors: change of sign at north fold ONLY if on the local grid
-      IF( TRIM( sn_rcv_tau%clvor ) == 'local grid' )   srcv(jpr_otx1:jpr_itz2)%nsgn = -1.
+      IF( TRIM( sn_rcv_tau%clvor ) == 'local grid' )   sf(jp_otx1:jp_itz2)%nsgn = -1.
       
-      !                                                           ! Set grid and action
-      SELECT CASE( TRIM( sn_rcv_tau%clvgrd ) )      !  'T', 'U,V', 'U,V,I', 'U,V,F', 'T,I', 'T,F', or 'T,U,V'
-      CASE( 'T' ) 
-         srcv(jpr_otx1:jpr_itz2)%clgrid  = 'T'        ! oce and ice components given at T-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 
-      CASE( 'U,V' ) 
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'U'        ! ice components given at U-point
-         srcv(jpr_itx2:jpr_itz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_otx1:jpr_itz2)%laction = .TRUE.     ! receive oce and ice components on both grid 1 & 2
-      CASE( 'U,V,T' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'T'        ! ice components given at T-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
-      CASE( 'U,V,I' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'I'        ! ice components given at I-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
-      CASE( 'U,V,F' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'F'        ! ice components given at F-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
-      CASE( 'T,I' ) 
-         srcv(jpr_otx1:jpr_itz2)%clgrid  = 'T'        ! oce and ice components given at T-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'I'        ! ice components given at I-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 
-      CASE( 'T,F' ) 
-         srcv(jpr_otx1:jpr_itz2)%clgrid  = 'T'        ! oce and ice components given at T-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'F'        ! ice components given at F-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 
-      CASE( 'T,U,V' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'T'        ! oce components given at T-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'U'        ! ice components given at U-point
-         srcv(jpr_itx2:jpr_itz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 only
-         srcv(jpr_itx1:jpr_itz2)%laction = .TRUE.     ! receive ice components on grid 1 & 2
-      CASE default   
-         CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_tau%clvgrd' )
-      END SELECT
-      !
-      IF( TRIM( sn_rcv_tau%clvref ) == 'spherical' )   &           ! spherical: 3rd component not received
-         &     srcv( (/jpr_otz1, jpr_otz2, jpr_itz1, jpr_itz2/) )%laction = .FALSE. 
       !
       IF( TRIM( sn_rcv_tau%clvor  ) == 'local grid' ) THEN        ! already on local grid -> no need of the second grid
-            srcv(jpr_otx2:jpr_otz2)%laction = .FALSE. 
-            srcv(jpr_itx2:jpr_itz2)%laction = .FALSE. 
-            srcv(jpr_oty1)%clgrid = srcv(jpr_oty2)%clgrid   ! not needed but cleaner...
-            srcv(jpr_ity1)%clgrid = srcv(jpr_ity2)%clgrid   ! not needed but cleaner...
-      ENDIF
-      !
-      IF( TRIM( sn_rcv_tau%cldes ) /= 'oce and ice' ) THEN        ! 'oce and ice' case ocean stress on ocean mesh used
-         srcv(jpr_itx1:jpr_itz2)%laction = .FALSE.    ! ice components not received
-         srcv(jpr_itx1)%clgrid = 'U'                  ! ocean stress used after its transformation
-         srcv(jpr_ity1)%clgrid = 'V'                  ! i.e. it is always at U- & V-points for i- & j-comp. resp.
-      ENDIF
-       
-      !                                                      ! ------------------------- !
-      !                                                      !    freshwater budget      !   E-P
-      !                                                      ! ------------------------- !
-      ! we suppose that atmosphere modele do not make the difference between precipiration (liquide or solid)
-      ! over ice of free ocean within the same atmospheric cell.cd 
-      srcv(jpr_rain)%clname = 'OTotRain'      ! Rain = liquid precipitation
-      srcv(jpr_snow)%clname = 'OTotSnow'      ! Snow = solid precipitation
-      srcv(jpr_tevp)%clname = 'OTotEvap'      ! total evaporation (over oce + ice sublimation)
-      srcv(jpr_ievp)%clname = 'OIceEvap'      ! evaporation over ice = sublimation
-      srcv(jpr_sbpr)%clname = 'OSubMPre'      ! sublimation - liquid precipitation - solid precipitation 
-      srcv(jpr_semp)%clname = 'OISubMSn'      ! ice solid water budget = sublimation - solid precipitation
-      srcv(jpr_oemp)%clname = 'OOEvaMPr'      ! ocean water budget = ocean Evap - ocean precip
-      SELECT CASE( TRIM( sn_rcv_emp%cldes ) )
-      CASE( 'oce only'      )   ;   srcv(                                 jpr_oemp   )%laction = .TRUE. 
-      CASE( 'conservative'  )   ;   srcv( (/jpr_rain, jpr_snow, jpr_ievp, jpr_tevp/) )%laction = .TRUE.
-      CASE( 'oce and ice'   )   ;   srcv( (/jpr_ievp, jpr_sbpr, jpr_semp, jpr_oemp/) )%laction = .TRUE.
-      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_emp%cldes' )
-      END SELECT
-
-      !                                                      ! ------------------------- !
-      !                                                      !     Runoffs & Calving     !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_rnf   )%clname = 'O_Runoff'   ;   IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' )   srcv(jpr_rnf)%laction = .TRUE.
-! This isn't right - really just want ln_rnf_emp changed
-!                                                 IF( TRIM( sn_rcv_rnf%cldes ) == 'climato' )   THEN   ;   ln_rnf = .TRUE.
-!                                                 ELSE                                                 ;   ln_rnf = .FALSE.
-!                                                 ENDIF
-      srcv(jpr_cal   )%clname = 'OCalving'   ;   IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' )   srcv(jpr_cal)%laction = .TRUE.
-
-      !                                                      ! ------------------------- !
-      !                                                      !    non solar radiation    !   Qns
-      !                                                      ! ------------------------- !
-      srcv(jpr_qnsoce)%clname = 'O_QnsOce'
-      srcv(jpr_qnsice)%clname = 'O_QnsIce'
-      srcv(jpr_qnsmix)%clname = 'O_QnsMix'
-      SELECT CASE( TRIM( sn_rcv_qns%cldes ) )
-      CASE( 'oce only'      )   ;   srcv(               jpr_qnsoce   )%laction = .TRUE.
-      CASE( 'conservative'  )   ;   srcv( (/jpr_qnsice, jpr_qnsmix/) )%laction = .TRUE.
-      CASE( 'oce and ice'   )   ;   srcv( (/jpr_qnsice, jpr_qnsoce/) )%laction = .TRUE.
-      CASE( 'mixed oce-ice' )   ;   srcv(               jpr_qnsmix   )%laction = .TRUE. 
-      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_qns%cldes' )
-      END SELECT
-      IF( TRIM( sn_rcv_qns%cldes ) == 'mixed oce-ice' .AND. jpl > 1 ) &
-         CALL ctl_stop( 'sbc_cpl_init: sn_rcv_qns%cldes not currently allowed to be mixed oce-ice for multi-category ice' )
-      !                                                      ! ------------------------- !
-      !                                                      !    solar radiation        !   Qsr
-      !                                                      ! ------------------------- !
-      srcv(jpr_qsroce)%clname = 'O_QsrOce'
-      srcv(jpr_qsrice)%clname = 'O_QsrIce'
-      srcv(jpr_qsrmix)%clname = 'O_QsrMix'
-      SELECT CASE( TRIM( sn_rcv_qsr%cldes ) )
-      CASE( 'oce only'      )   ;   srcv(               jpr_qsroce   )%laction = .TRUE.
-      CASE( 'conservative'  )   ;   srcv( (/jpr_qsrice, jpr_qsrmix/) )%laction = .TRUE.
-      CASE( 'oce and ice'   )   ;   srcv( (/jpr_qsrice, jpr_qsroce/) )%laction = .TRUE.
-      CASE( 'mixed oce-ice' )   ;   srcv(               jpr_qsrmix   )%laction = .TRUE. 
-      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_qsr%cldes' )
-      END SELECT
-      IF( TRIM( sn_rcv_qsr%cldes ) == 'mixed oce-ice' .AND. jpl > 1 ) &
-         CALL ctl_stop( 'sbc_cpl_init: sn_rcv_qsr%cldes not currently allowed to be mixed oce-ice for multi-category ice' )
-      !                                                      ! ------------------------- !
-      !                                                      !   non solar sensitivity   !   d(Qns)/d(T)
-      !                                                      ! ------------------------- !
-      srcv(jpr_dqnsdt)%clname = 'O_dQnsdT'   
-      IF( TRIM( sn_rcv_dqnsdt%cldes ) == 'coupled' )   srcv(jpr_dqnsdt)%laction = .TRUE.
-      !
-      ! non solar sensitivity mandatory for LIM ice model
-      IF( TRIM( sn_rcv_dqnsdt%cldes ) == 'none' .AND. k_ice /= 0 .AND. k_ice /= 4) &
-         CALL ctl_stop( 'sbc_cpl_init: sn_rcv_dqnsdt%cldes must be coupled in namsbc_cpl namelist' )
-      ! non solar sensitivity mandatory for mixed oce-ice solar radiation coupling technique
-      IF( TRIM( sn_rcv_dqnsdt%cldes ) == 'none' .AND. TRIM( sn_rcv_qns%cldes ) == 'mixed oce-ice' ) &
-         CALL ctl_stop( 'sbc_cpl_init: namsbc_cpl namelist mismatch between sn_rcv_qns%cldes and sn_rcv_dqnsdt%cldes' )
-      !                                                      ! ------------------------- !
-      !                                                      !    Ice Qsr penetration    !   
-      !                                                      ! ------------------------- !
-      ! fraction of net shortwave radiation which is not absorbed in the thin surface layer 
-      ! and penetrates inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-      ! Coupled case: since cloud cover is not received from atmosphere 
-      !               ===> defined as constant value -> definition done in sbc_cpl_init
-      fr1_i0(:,:) = 0.18
-      fr2_i0(:,:) = 0.82
-      !                                                      ! ------------------------- !
-      !                                                      !      10m wind module      !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_w10m)%clname = 'O_Wind10'   ;   IF( TRIM(sn_rcv_w10m%cldes  ) == 'coupled' )   srcv(jpr_w10m)%laction = .TRUE. 
-      !
-      !                                                      ! ------------------------- !
-      !                                                      !   wind stress module      !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_taum)%clname = 'O_TauMod'   ;   IF( TRIM(sn_rcv_taumod%cldes) == 'coupled' )   srcv(jpr_taum)%laction = .TRUE.
-      lhftau = srcv(jpr_taum)%laction
-
-      !                                                      ! ------------------------- !
-      !                                                      !      Atmospheric CO2      !
-      !                                                      ! ------------------------- !
-      srcv(jpr_co2 )%clname = 'O_AtmCO2'   ;   IF( TRIM(sn_rcv_co2%cldes   ) == 'coupled' )    srcv(jpr_co2 )%laction = .TRUE.
-      !                                                      ! ------------------------- !
-      !                                                      !   topmelt and botmelt     !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_topm )%clname = 'OTopMlt'
-      srcv(jpr_botm )%clname = 'OBotMlt'
-      IF( TRIM(sn_rcv_iceflx%cldes) == 'coupled' ) THEN
-         IF ( TRIM( sn_rcv_iceflx%clcat ) == 'yes' ) THEN
-            srcv(jpr_topm:jpr_botm)%nct = jpl
-         ELSE
-            CALL ctl_stop( 'sbc_cpl_init: sn_rcv_iceflx%clcat should always be set to yes currently' )
-         ENDIF
-         srcv(jpr_topm:jpr_botm)%laction = .TRUE.
-      ENDIF
-
-      ! Allocate all parts of frcv used for received fields
-      DO jn = 1, jprcv
-         IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) )
-      END DO
-      ! Allocate taum part of frcv which is used even when not received as coupling field
-      IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jn)%nct) )
+            sf(jp_oty1)%clvgrd = sf(jp_oty2)%clvgrd   ! not needed but cleaner...
+            sf(jp_ity1)%clvgrd = sf(jp_ity2)%clvgrd   ! not needed but cleaner...
+      ENDIF
+      !
 
       ! ================================ !
@@ -621,7 +378,7 @@
       ! ================================ !
 
-      CALL cpl_prism_define(jprcv, jpsnd)            
-      !
-      IF( ln_dm2dc .AND. ( cpl_prism_freq( jpr_qsroce ) + cpl_prism_freq( jpr_qsrmix ) /= 86400 ) )   &
+      CALL cpl_prism_define(jpfld, jpsnd, sf)            
+      !
+      IF( ln_dm2dc .AND. ( cpl_prism_freq( jp_qsroce ) + cpl_prism_freq( jp_qsrmix ) /= 86400 ) )   &
          &   CALL ctl_stop( 'sbc_cpl_init: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' )
 
@@ -640,6 +397,6 @@
       !!                provide the ocean heat and freshwater fluxes.
       !!
-      !! ** Method  : - Receive all the atmospheric fields (stored in frcv array). called at each time step.
-      !!                OASIS controls if there is something do receive or not. nrcvinfo contains the info
+      !! ** Method  : - Receive all the atmospheric fields (stored in sf array). called at each time step.
+      !!                OASIS controls if there is something do receive or not. ninfo contains the info
       !!                to know if the field was really received or not
       !!
@@ -683,5 +440,4 @@
       LOGICAL ::    llnewtx, llnewtau      ! update wind stress components and module??
       INTEGER  ::   ji, jj, jn             ! dummy loop indices
-      INTEGER  ::   isec                   ! number of seconds since nit000 (assuming rdttra did not change since nit000)
       REAL(wp) ::   zcumulneg, zcumulpos   ! temporary scalars     
       REAL(wp) ::   zcoef                  ! temporary scalar
@@ -699,29 +455,24 @@
 
       !                                                 ! Receive all the atmos. fields (including ice information)
-      isec = ( kt - nit000 ) * NINT( rdttra(1) )             ! date of exchanges
-      DO jn = 1, jprcv                                       ! received fields sent by the atmosphere
-         IF( srcv(jn)%laction )   CALL cpl_prism_rcv( jn, isec, frcv(jn)%z3, nrcvinfo(jn) )
-      END DO
-
       !                                                      ! ========================= !
-      IF( srcv(jpr_otx1)%laction ) THEN                      !  ocean stress components  !
+      IF( sf(jp_otx1)%loasis ) THEN                      !  ocean stress components  !
          !                                                   ! ========================= !
-         ! define frcv(jpr_otx1)%z3(:,:,1) and frcv(jpr_oty1)%z3(:,:,1): stress at U/V point along model grid
+         ! define sf(jp_otx1)%fnow(:,:,1) and sf(jp_oty1)%fnow(:,:,1): stress at U/V point along model grid
          ! => need to be done only when we receive the field
-         IF(  nrcvinfo(jpr_otx1) == OASIS_Rcv ) THEN
+         IF(  sf(jp_otx1)%ninfo == OASIS_Rcv ) THEN
             !
             IF( TRIM( sn_rcv_tau%clvref ) == 'cartesian' ) THEN            ! 2 components on the sphere
                !                                                       ! (cartesian to spherical -> 3 to 2 components)
                !
-               CALL geo2oce( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), frcv(jpr_otz1)%z3(:,:,1),   &
-                  &          srcv(jpr_otx1)%clgrid, ztx, zty )
-               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 1st grid
-               frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 1st grid
+               CALL geo2oce( sf(jp_otx1)%fnow(:,:,1), sf(jp_oty1)%fnow(:,:,1), sf(jp_otz1)%fnow(:,:,1),   &
+                  &          sf(jp_otx1)%clvgrd, ztx, zty )
+               sf(jp_otx1)%fnow(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 1st grid
+               sf(jp_oty1)%fnow(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 1st grid
                !
-               IF( srcv(jpr_otx2)%laction ) THEN
-                  CALL geo2oce( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), frcv(jpr_otz2)%z3(:,:,1),   &
-                     &          srcv(jpr_otx2)%clgrid, ztx, zty )
-                  frcv(jpr_otx2)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 2nd grid
-                  frcv(jpr_oty2)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 2nd grid
+               IF( sf(jp_otx2)%loasis ) THEN
+                  CALL geo2oce( sf(jp_otx2)%fnow(:,:,1), sf(jp_oty2)%fnow(:,:,1), sf(jp_otz2)%fnow(:,:,1),   &
+                     &          sf(jp_otx2)%clvgrd, ztx, zty )
+                  sf(jp_otx2)%fnow(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 2nd grid
+                  sf(jp_oty2)%fnow(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 2nd grid
                ENDIF
                !
@@ -730,22 +481,22 @@
             IF( TRIM( sn_rcv_tau%clvor ) == 'eastward-northward' ) THEN   ! 2 components oriented along the local grid
                !                                                       ! (geographical to local grid -> rotate the components)
-               CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx )   
-               IF( srcv(jpr_otx2)%laction ) THEN
-                  CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty )   
+               CALL rot_rep( sf(jp_otx1)%fnow(:,:,1), sf(jp_oty1)%fnow(:,:,1), sf(jp_otx1)%clvgrd, 'en->i', ztx )   
+               IF( sf(jp_otx2)%loasis ) THEN
+                  CALL rot_rep( sf(jp_otx2)%fnow(:,:,1), sf(jp_oty2)%fnow(:,:,1), sf(jp_otx2)%clvgrd, 'en->j', zty )   
                ELSE	
-                  CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty )  
+                  CALL rot_rep( sf(jp_otx1)%fnow(:,:,1), sf(jp_oty1)%fnow(:,:,1), sf(jp_otx1)%clvgrd, 'en->j', zty )  
                ENDIF
-               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
-               frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 2nd grid
+               sf(jp_otx1)%fnow(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
+               sf(jp_oty1)%fnow(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 2nd grid
             ENDIF
             !                              
-            IF( srcv(jpr_otx1)%clgrid == 'T' ) THEN
+            IF( sf(jp_otx1)%clvgrd == 'T' ) THEN
                DO jj = 2, jpjm1                                          ! T ==> (U,V)
                   DO ji = fs_2, fs_jpim1   ! vector opt.
-                     frcv(jpr_otx1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_otx1)%z3(ji+1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1) )
-                     frcv(jpr_oty1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_oty1)%z3(ji  ,jj+1,1) + frcv(jpr_oty1)%z3(ji,jj,1) )
-                  END DO
-               END DO
-               CALL lbc_lnk( frcv(jpr_otx1)%z3(:,:,1), 'U',  -1. )   ;   CALL lbc_lnk( frcv(jpr_oty1)%z3(:,:,1), 'V',  -1. )
+                     sf(jp_otx1)%fnow(ji,jj,1) = 0.5 * ( sf(jp_otx1)%fnow(ji+1,jj  ,1) + sf(jp_otx1)%fnow(ji,jj,1) )
+                     sf(jp_oty1)%fnow(ji,jj,1) = 0.5 * ( sf(jp_oty1)%fnow(ji  ,jj+1,1) + sf(jp_oty1)%fnow(ji,jj,1) )
+                  END DO
+               END DO
+               CALL lbc_lnk( sf(jp_otx1)%fnow(:,:,1), 'U',  -1. )   ;   CALL lbc_lnk( sf(jp_oty1)%fnow(:,:,1), 'V',  -1. )
             ENDIF
             llnewtx = .TRUE.
@@ -756,6 +507,6 @@
       ELSE                                                   !   No dynamical coupling   !
          !                                                   ! ========================= !
-         frcv(jpr_otx1)%z3(:,:,1) = 0.e0                               ! here simply set to zero 
-         frcv(jpr_oty1)%z3(:,:,1) = 0.e0                               ! an external read in a file can be added instead
+         sf(jp_otx1)%fnow(:,:,1) = 0.e0                               ! here simply set to zero 
+         sf(jp_oty1)%fnow(:,:,1) = 0.e0                               ! an external read in a file can be added instead
          llnewtx = .TRUE.
          !
@@ -766,5 +517,5 @@
       !                                                      ! ========================= !
       !
-      IF( .NOT. srcv(jpr_taum)%laction ) THEN                    ! compute wind stress module from its components if not received 
+      IF( .NOT. sf(jp_taum)%loasis ) THEN                    ! compute wind stress module from its components if not received 
          ! => need to be done only when otx1 was changed
          IF( llnewtx ) THEN
@@ -773,10 +524,10 @@
 !CDIR NOVERRCHK
                DO ji = fs_2, fs_jpim1   ! vect. opt.
-                  zzx = frcv(jpr_otx1)%z3(ji-1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1)
-                  zzy = frcv(jpr_oty1)%z3(ji  ,jj-1,1) + frcv(jpr_oty1)%z3(ji,jj,1)
-                  frcv(jpr_taum)%z3(ji,jj,1) = 0.5 * SQRT( zzx * zzx + zzy * zzy )
+                  zzx = sf(jp_otx1)%fnow(ji-1,jj  ,1) + sf(jp_otx1)%fnow(ji,jj,1)
+                  zzy = sf(jp_oty1)%fnow(ji  ,jj-1,1) + sf(jp_oty1)%fnow(ji,jj,1)
+                  sf(jp_taum)%fnow(ji,jj,1) = 0.5 * SQRT( zzx * zzx + zzy * zzy )
                END DO
             END DO
-            CALL lbc_lnk( frcv(jpr_taum)%z3(:,:,1), 'T', 1. )
+            CALL lbc_lnk( sf(jp_taum)%fnow(:,:,1), 'T', 1. )
             llnewtau = .TRUE.
          ELSE
@@ -784,8 +535,8 @@
          ENDIF
       ELSE
-         llnewtau = nrcvinfo(jpr_taum) == OASIS_Rcv
+         llnewtau = sf(jp_taum)%ninfo == OASIS_Rcv
          ! Stress module can be negative when received (interpolation problem)
          IF( llnewtau ) THEN 
-            frcv(jpr_taum)%z3(:,:,1) = MAX( 0._wp, frcv(jpr_taum)%z3(:,:,1) )
+            sf(jp_taum)%fnow(:,:,1) = MAX( 0._wp, sf(jp_taum)%fnow(:,:,1) )
          ENDIF
       ENDIF
@@ -795,5 +546,5 @@
       !                                                      ! ========================= !
       !
-      IF( .NOT. srcv(jpr_w10m)%laction ) THEN                    ! compute wind spreed from wind stress module if not received  
+      IF( .NOT. sf(jp_w10m)%loasis ) THEN                    ! compute wind spreed from wind stress module if not received  
          ! => need to be done only when taumod was changed
          IF( llnewtau ) THEN 
@@ -803,10 +554,10 @@
 !CDIR NOVERRCHK
                DO ji = 1, jpi 
-                  wndm(ji,jj) = SQRT( frcv(jpr_taum)%z3(ji,jj,1) * zcoef )
+                  wndm(ji,jj) = SQRT( sf(jp_taum)%fnow(ji,jj,1) * zcoef )
                END DO
             END DO
          ENDIF
       ELSE
-         IF ( nrcvinfo(jpr_w10m) == OASIS_Rcv ) wndm(:,:) = frcv(jpr_w10m)%z3(:,:,1)
+         IF ( sf(jp_w10m)%ninfo == OASIS_Rcv ) wndm(:,:) = sf(jp_w10m)%fnow(:,:,1)
       ENDIF
 
@@ -815,7 +566,7 @@
       IF( MOD( kt-1, k_fsbc ) == 0 ) THEN
          !
-         utau(:,:) = frcv(jpr_otx1)%z3(:,:,1)
-         vtau(:,:) = frcv(jpr_oty1)%z3(:,:,1)
-         taum(:,:) = frcv(jpr_taum)%z3(:,:,1)
+         utau(:,:) = sf(jp_otx1)%fnow(:,:,1)
+         vtau(:,:) = sf(jp_oty1)%fnow(:,:,1)
+         taum(:,:) = sf(jp_taum)%fnow(:,:,1)
          CALL iom_put( "taum_oce", taum )   ! output wind stress module
          !  
@@ -824,5 +575,5 @@
 #if defined key_cpl_carbon_cycle
       !                                                              ! atmosph. CO2 (ppm)
-      IF( srcv(jpr_co2)%laction )   atm_co2(:,:) = frcv(jpr_co2)%z3(:,:,1)
+      IF( sf(jp_co2)%loasis )   atm_co2(:,:) = sf(jp_co2)%fnow(:,:,1)
 #endif
 
@@ -834,7 +585,7 @@
          SELECT CASE( TRIM( sn_rcv_emp%cldes ) )                                    ! evaporation - precipitation
          CASE( 'conservative' )
-            emp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - ( frcv(jpr_rain)%z3(:,:,1) + frcv(jpr_snow)%z3(:,:,1) )
+            emp(:,:) = sf(jp_tevp)%fnow(:,:,1) - ( sf(jp_rain)%fnow(:,:,1) + sf(jp_snow)%fnow(:,:,1) )
          CASE( 'oce only', 'oce and ice' )
-            emp(:,:) = frcv(jpr_oemp)%z3(:,:,1)
+            emp(:,:) = sf(jp_oemp)%fnow(:,:,1)
          CASE default
             CALL ctl_stop( 'sbc_cpl_rcv: wrong definition of sn_rcv_emp%cldes' )
@@ -842,6 +593,6 @@
          !
          !                                                        ! runoffs and calving (added in emp)
-         IF( srcv(jpr_rnf)%laction )   emp(:,:) = emp(:,:) - frcv(jpr_rnf)%z3(:,:,1)
-         IF( srcv(jpr_cal)%laction )   emp(:,:) = emp(:,:) - frcv(jpr_cal)%z3(:,:,1)
+         IF( sf(jp_rnf)%loasis )   emp(:,:) = emp(:,:) - sf(jp_rnf)%fnow(:,:,1)
+         IF( sf(jp_cal)%loasis )   emp(:,:) = emp(:,:) - sf(jp_cal)%fnow(:,:,1)
          !
 !!gm :  this seems to be internal cooking, not sure to need that in a generic interface 
@@ -849,29 +600,29 @@
 !!         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) THEN     ! add to the total freshwater budget
 !!            ! remove negative runoff
-!!            zcumulpos = SUM( MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 
-!!            zcumulneg = SUM( MIN( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
+!!            zcumulpos = SUM( MAX( sf(jp_rnf)%fnow(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 
+!!            zcumulneg = SUM( MIN( sf(jp_rnf)%fnow(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
 !!            IF( lk_mpp )   CALL mpp_sum( zcumulpos )   ! sum over the global domain
 !!            IF( lk_mpp )   CALL mpp_sum( zcumulneg ) 
 !!            IF( zcumulpos /= 0. ) THEN                 ! distribute negative runoff on positive runoff grid points
 !!               zcumulneg = 1.e0 + zcumulneg / zcumulpos
-!!               frcv(jpr_rnf)%z3(:,:,1) = MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * zcumulneg
+!!               sf(jp_rnf)%fnow(:,:,1) = MAX( sf(jp_rnf)%fnow(:,:,1), 0.e0 ) * zcumulneg
 !!            ENDIF     
 !!            ! add runoff to e-p 
-!!            emp(:,:) = emp(:,:) - frcv(jpr_rnf)%z3(:,:,1)
+!!            emp(:,:) = emp(:,:) - sf(jp_rnf)%fnow(:,:,1)
 !!         ENDIF
 !!gm  end of internal cooking
          !
          !                                                       ! non solar heat flux over the ocean (qns)
-         IF( srcv(jpr_qnsoce)%laction )   qns(:,:) = frcv(jpr_qnsoce)%z3(:,:,1)
-         IF( srcv(jpr_qnsmix)%laction )   qns(:,:) = frcv(jpr_qnsmix)%z3(:,:,1)
+         IF( sf(jp_qnsoce)%loasis )   qns(:,:) = sf(jp_qnsoce)%fnow(:,:,1)
+         IF( sf(jp_qnsmix)%loasis )   qns(:,:) = sf(jp_qnsmix)%fnow(:,:,1)
          ! add the latent heat of solid precip. melting
-         IF( srcv(jpr_snow  )%laction )   THEN                         ! update qns over the free ocean with:
-              qns(:,:) = qns(:,:) - frcv(jpr_snow)%z3(:,:,1) * lfus  & ! energy for melting solid precipitation over the free ocean
+         IF( sf(jp_snow  )%loasis )   THEN                         ! update qns over the free ocean with:
+              qns(:,:) = qns(:,:) - sf(jp_snow)%fnow(:,:,1) * lfus  & ! energy for melting solid precipitation over the free ocean
            &           - emp(:,:) * sst_m(:,:) * rcp                   ! remove heat content due to mass flux (assumed to be at SST)
          ENDIF
 
          !                                                       ! solar flux over the ocean          (qsr)
-         IF( srcv(jpr_qsroce)%laction )   qsr(:,:) = frcv(jpr_qsroce)%z3(:,:,1)
-         IF( srcv(jpr_qsrmix)%laction )   qsr(:,:) = frcv(jpr_qsrmix)%z3(:,:,1)
+         IF( sf(jp_qsroce)%loasis )   qsr(:,:) = sf(jp_qsroce)%fnow(:,:,1)
+         IF( sf(jp_qsrmix)%loasis )   qsr(:,:) = sf(jp_qsrmix)%fnow(:,:,1)
          IF( ln_dm2dc )   qsr(:,:) = sbc_dcy( qsr )                           ! modify qsr to include the diurnal cycle
          !
@@ -931,27 +682,27 @@
       CALL wrk_alloc( jpi,jpj, ztx, zty )
 
-      IF( srcv(jpr_itx1)%laction ) THEN   ;   itx =  jpr_itx1   
-      ELSE                                ;   itx =  jpr_otx1
+      IF( sf(jp_itx1)%loasis ) THEN   ;   itx =  jp_itx1   
+      ELSE                                ;   itx =  jp_otx1
       ENDIF
 
       ! do something only if we just received the stress from atmosphere
-      IF(  nrcvinfo(itx) == OASIS_Rcv ) THEN
+      IF(  sf(itx)%ninfo == OASIS_Rcv ) THEN
 
          !                                                      ! ======================= !
-         IF( srcv(jpr_itx1)%laction ) THEN                      !   ice stress received   !
+         IF( sf(jp_itx1)%loasis ) THEN                      !   ice stress received   !
             !                                                   ! ======================= !
             !  
             IF( TRIM( sn_rcv_tau%clvref ) == 'cartesian' ) THEN            ! 2 components on the sphere
                !                                                       ! (cartesian to spherical -> 3 to 2 components)
-               CALL geo2oce(  frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), frcv(jpr_itz1)%z3(:,:,1),   &
-                  &          srcv(jpr_itx1)%clgrid, ztx, zty )
-               frcv(jpr_itx1)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 1st grid
-               frcv(jpr_ity1)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 1st grid
+               CALL geo2oce(  sf(jp_itx1)%fnow(:,:,1), sf(jp_ity1)%fnow(:,:,1), sf(jp_itz1)%fnow(:,:,1),   &
+                  &          sf(jp_itx1)%clvgrd, ztx, zty )
+               sf(jp_itx1)%fnow(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 1st grid
+               sf(jp_ity1)%fnow(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 1st grid
                !
-               IF( srcv(jpr_itx2)%laction ) THEN
-                  CALL geo2oce( frcv(jpr_itx2)%z3(:,:,1), frcv(jpr_ity2)%z3(:,:,1), frcv(jpr_itz2)%z3(:,:,1),   &
-                     &          srcv(jpr_itx2)%clgrid, ztx, zty )
-                  frcv(jpr_itx2)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 2nd grid
-                  frcv(jpr_ity2)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 2nd grid
+               IF( sf(jp_itx2)%loasis ) THEN
+                  CALL geo2oce( sf(jp_itx2)%fnow(:,:,1), sf(jp_ity2)%fnow(:,:,1), sf(jp_itz2)%fnow(:,:,1),   &
+                     &          sf(jp_itx2)%clvgrd, ztx, zty )
+                  sf(jp_itx2)%fnow(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 2nd grid
+                  sf(jp_ity2)%fnow(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 2nd grid
                ENDIF
                !
@@ -960,18 +711,18 @@
             IF( TRIM( sn_rcv_tau%clvor ) == 'eastward-northward' ) THEN   ! 2 components oriented along the local grid
                !                                                       ! (geographical to local grid -> rotate the components)
-               CALL rot_rep( frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), srcv(jpr_itx1)%clgrid, 'en->i', ztx )   
-               IF( srcv(jpr_itx2)%laction ) THEN
-                  CALL rot_rep( frcv(jpr_itx2)%z3(:,:,1), frcv(jpr_ity2)%z3(:,:,1), srcv(jpr_itx2)%clgrid, 'en->j', zty )   
+               CALL rot_rep( sf(jp_itx1)%fnow(:,:,1), sf(jp_ity1)%fnow(:,:,1), sf(jp_itx1)%clvgrd, 'en->i', ztx )   
+               IF( sf(jp_itx2)%loasis ) THEN
+                  CALL rot_rep( sf(jp_itx2)%fnow(:,:,1), sf(jp_ity2)%fnow(:,:,1), sf(jp_itx2)%clvgrd, 'en->j', zty )   
                ELSE
-                  CALL rot_rep( frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), srcv(jpr_itx1)%clgrid, 'en->j', zty )  
+                  CALL rot_rep( sf(jp_itx1)%fnow(:,:,1), sf(jp_ity1)%fnow(:,:,1), sf(jp_itx1)%clvgrd, 'en->j', zty )  
                ENDIF
-               frcv(jpr_itx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
-               frcv(jpr_ity1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 1st grid
+               sf(jp_itx1)%fnow(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
+               sf(jp_ity1)%fnow(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 1st grid
             ENDIF
             !                                                   ! ======================= !
          ELSE                                                   !     use ocean stress    !
             !                                                   ! ======================= !
-            frcv(jpr_itx1)%z3(:,:,1) = frcv(jpr_otx1)%z3(:,:,1)
-            frcv(jpr_ity1)%z3(:,:,1) = frcv(jpr_oty1)%z3(:,:,1)
+            sf(jp_itx1)%fnow(:,:,1) = sf(jp_otx1)%fnow(:,:,1)
+            sf(jp_ity1)%fnow(:,:,1) = sf(jp_oty1)%fnow(:,:,1)
             !
          ENDIF
@@ -992,10 +743,10 @@
             !
          CASE( 'I' )                                         ! B-grid ==> I
-            SELECT CASE ( srcv(jpr_itx1)%clgrid )
+            SELECT CASE ( sf(jp_itx1)%clvgrd )
             CASE( 'U' )
                DO jj = 2, jpjm1                                   ! (U,V) ==> I
                   DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji-1,jj  ,1) + frcv(jpr_itx1)%z3(ji-1,jj-1,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji  ,jj-1,1) + frcv(jpr_ity1)%z3(ji-1,jj-1,1) )
+                     p_taui(ji,jj) = 0.5 * ( sf(jp_itx1)%fnow(ji-1,jj  ,1) + sf(jp_itx1)%fnow(ji-1,jj-1,1) )
+                     p_tauj(ji,jj) = 0.5 * ( sf(jp_ity1)%fnow(ji  ,jj-1,1) + sf(jp_ity1)%fnow(ji-1,jj-1,1) )
                   END DO
                END DO
@@ -1003,6 +754,6 @@
                DO jj = 2, jpjm1                                   ! F ==> I
                   DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = frcv(jpr_itx1)%z3(ji-1,jj-1,1)
-                     p_tauj(ji,jj) = frcv(jpr_ity1)%z3(ji-1,jj-1,1)
+                     p_taui(ji,jj) = sf(jp_itx1)%fnow(ji-1,jj-1,1)
+                     p_tauj(ji,jj) = sf(jp_ity1)%fnow(ji-1,jj-1,1)
                   END DO
                END DO
@@ -1010,25 +761,25 @@
                DO jj = 2, jpjm1                                   ! T ==> I
                   DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.25 * ( frcv(jpr_itx1)%z3(ji,jj  ,1) + frcv(jpr_itx1)%z3(ji-1,jj  ,1)   &
-                        &                   + frcv(jpr_itx1)%z3(ji,jj-1,1) + frcv(jpr_itx1)%z3(ji-1,jj-1,1) ) 
-                     p_tauj(ji,jj) = 0.25 * ( frcv(jpr_ity1)%z3(ji,jj  ,1) + frcv(jpr_ity1)%z3(ji-1,jj  ,1)   &
-                        &                   + frcv(jpr_oty1)%z3(ji,jj-1,1) + frcv(jpr_ity1)%z3(ji-1,jj-1,1) )
+                     p_taui(ji,jj) = 0.25 * ( sf(jp_itx1)%fnow(ji,jj  ,1) + sf(jp_itx1)%fnow(ji-1,jj  ,1)   &
+                        &                   + sf(jp_itx1)%fnow(ji,jj-1,1) + sf(jp_itx1)%fnow(ji-1,jj-1,1) ) 
+                     p_tauj(ji,jj) = 0.25 * ( sf(jp_ity1)%fnow(ji,jj  ,1) + sf(jp_ity1)%fnow(ji-1,jj  ,1)   &
+                        &                   + sf(jp_oty1)%fnow(ji,jj-1,1) + sf(jp_ity1)%fnow(ji-1,jj-1,1) )
                   END DO
                END DO
             CASE( 'I' )
-               p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! I ==> I
-               p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1)
+               p_taui(:,:) = sf(jp_itx1)%fnow(:,:,1)                   ! I ==> I
+               p_tauj(:,:) = sf(jp_ity1)%fnow(:,:,1)
             END SELECT
-            IF( srcv(jpr_itx1)%clgrid /= 'I' ) THEN 
+            IF( sf(jp_itx1)%clvgrd /= 'I' ) THEN 
                CALL lbc_lnk( p_taui, 'I',  -1. )   ;   CALL lbc_lnk( p_tauj, 'I',  -1. )
             ENDIF
             !
          CASE( 'F' )                                         ! B-grid ==> F
-            SELECT CASE ( srcv(jpr_itx1)%clgrid )
+            SELECT CASE ( sf(jp_itx1)%clvgrd )
             CASE( 'U' )
                DO jj = 2, jpjm1                                   ! (U,V) ==> F
                   DO ji = fs_2, fs_jpim1   ! vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji,jj,1) + frcv(jpr_itx1)%z3(ji  ,jj+1,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji,jj,1) + frcv(jpr_ity1)%z3(ji+1,jj  ,1) )
+                     p_taui(ji,jj) = 0.5 * ( sf(jp_itx1)%fnow(ji,jj,1) + sf(jp_itx1)%fnow(ji  ,jj+1,1) )
+                     p_tauj(ji,jj) = 0.5 * ( sf(jp_ity1)%fnow(ji,jj,1) + sf(jp_ity1)%fnow(ji+1,jj  ,1) )
                   END DO
                END DO
@@ -1036,6 +787,6 @@
                DO jj = 2, jpjm1                                   ! I ==> F
                   DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = frcv(jpr_itx1)%z3(ji+1,jj+1,1)
-                     p_tauj(ji,jj) = frcv(jpr_ity1)%z3(ji+1,jj+1,1)
+                     p_taui(ji,jj) = sf(jp_itx1)%fnow(ji+1,jj+1,1)
+                     p_tauj(ji,jj) = sf(jp_ity1)%fnow(ji+1,jj+1,1)
                   END DO
                END DO
@@ -1043,28 +794,28 @@
                DO jj = 2, jpjm1                                   ! T ==> F
                   DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.25 * ( frcv(jpr_itx1)%z3(ji,jj  ,1) + frcv(jpr_itx1)%z3(ji+1,jj  ,1)   &
-                        &                   + frcv(jpr_itx1)%z3(ji,jj+1,1) + frcv(jpr_itx1)%z3(ji+1,jj+1,1) ) 
-                     p_tauj(ji,jj) = 0.25 * ( frcv(jpr_ity1)%z3(ji,jj  ,1) + frcv(jpr_ity1)%z3(ji+1,jj  ,1)   &
-                        &                   + frcv(jpr_ity1)%z3(ji,jj+1,1) + frcv(jpr_ity1)%z3(ji+1,jj+1,1) )
+                     p_taui(ji,jj) = 0.25 * ( sf(jp_itx1)%fnow(ji,jj  ,1) + sf(jp_itx1)%fnow(ji+1,jj  ,1)   &
+                        &                   + sf(jp_itx1)%fnow(ji,jj+1,1) + sf(jp_itx1)%fnow(ji+1,jj+1,1) ) 
+                     p_tauj(ji,jj) = 0.25 * ( sf(jp_ity1)%fnow(ji,jj  ,1) + sf(jp_ity1)%fnow(ji+1,jj  ,1)   &
+                        &                   + sf(jp_ity1)%fnow(ji,jj+1,1) + sf(jp_ity1)%fnow(ji+1,jj+1,1) )
                   END DO
                END DO
             CASE( 'F' )
-               p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! F ==> F
-               p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1)
+               p_taui(:,:) = sf(jp_itx1)%fnow(:,:,1)                   ! F ==> F
+               p_tauj(:,:) = sf(jp_ity1)%fnow(:,:,1)
             END SELECT
-            IF( srcv(jpr_itx1)%clgrid /= 'F' ) THEN 
+            IF( sf(jp_itx1)%clvgrd /= 'F' ) THEN 
                CALL lbc_lnk( p_taui, 'F',  -1. )   ;   CALL lbc_lnk( p_tauj, 'F',  -1. )
             ENDIF
             !
          CASE( 'C' )                                         ! C-grid ==> U,V
-            SELECT CASE ( srcv(jpr_itx1)%clgrid )
+            SELECT CASE ( sf(jp_itx1)%clvgrd )
             CASE( 'U' )
-               p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! (U,V) ==> (U,V)
-               p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1)
+               p_taui(:,:) = sf(jp_itx1)%fnow(:,:,1)                   ! (U,V) ==> (U,V)
+               p_tauj(:,:) = sf(jp_ity1)%fnow(:,:,1)
             CASE( 'F' )
                DO jj = 2, jpjm1                                   ! F ==> (U,V)
                   DO ji = fs_2, fs_jpim1   ! vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji,jj,1) + frcv(jpr_itx1)%z3(ji  ,jj-1,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(jj,jj,1) + frcv(jpr_ity1)%z3(ji-1,jj  ,1) )
+                     p_taui(ji,jj) = 0.5 * ( sf(jp_itx1)%fnow(ji,jj,1) + sf(jp_itx1)%fnow(ji  ,jj-1,1) )
+                     p_tauj(ji,jj) = 0.5 * ( sf(jp_ity1)%fnow(jj,jj,1) + sf(jp_ity1)%fnow(ji-1,jj  ,1) )
                   END DO
                END DO
@@ -1072,6 +823,6 @@
                DO jj = 2, jpjm1                                   ! T ==> (U,V)
                   DO ji = fs_2, fs_jpim1   ! vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj  ,1) + frcv(jpr_itx1)%z3(ji,jj,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji  ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) )
+                     p_taui(ji,jj) = 0.5 * ( sf(jp_itx1)%fnow(ji+1,jj  ,1) + sf(jp_itx1)%fnow(ji,jj,1) )
+                     p_tauj(ji,jj) = 0.5 * ( sf(jp_ity1)%fnow(ji  ,jj+1,1) + sf(jp_ity1)%fnow(ji,jj,1) )
                   END DO
                END DO
@@ -1079,10 +830,10 @@
                DO jj = 2, jpjm1                                   ! I ==> (U,V)
                   DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj+1,1) + frcv(jpr_itx1)%z3(ji+1,jj  ,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji+1,jj+1,1) + frcv(jpr_ity1)%z3(ji  ,jj+1,1) )
+                     p_taui(ji,jj) = 0.5 * ( sf(jp_itx1)%fnow(ji+1,jj+1,1) + sf(jp_itx1)%fnow(ji+1,jj  ,1) )
+                     p_tauj(ji,jj) = 0.5 * ( sf(jp_ity1)%fnow(ji+1,jj+1,1) + sf(jp_ity1)%fnow(ji  ,jj+1,1) )
                   END DO
                END DO
             END SELECT
-            IF( srcv(jpr_itx1)%clgrid /= 'U' ) THEN 
+            IF( sf(jp_itx1)%clvgrd /= 'U' ) THEN 
                CALL lbc_lnk( p_taui, 'U',  -1. )   ;   CALL lbc_lnk( p_tauj, 'V',  -1. )
             ENDIF
@@ -1163,18 +914,18 @@
       !                                                           ! solid Precipitation                      (sprecip)
       SELECT CASE( TRIM( sn_rcv_emp%cldes ) )
-      CASE( 'conservative'  )   ! received fields: jpr_rain, jpr_snow, jpr_ievp, jpr_tevp
-         sprecip(:,:) = frcv(jpr_snow)%z3(:,:,1)                 ! May need to ensure positive here
-         tprecip(:,:) = frcv(jpr_rain)%z3(:,:,1) + sprecip (:,:) ! May need to ensure positive here
-         emp_tot(:,:) = frcv(jpr_tevp)%z3(:,:,1) - tprecip(:,:)
-         emp_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1)
-                           CALL iom_put( 'rain'         , frcv(jpr_rain)%z3(:,:,1)              )   ! liquid precipitation 
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_rain_cea', frcv(jpr_rain)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from liq. precip. 
-         ztmp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:)
+      CASE( 'conservative'  )   ! received fields: jp_rain, jp_snow, jp_ievp, jp_tevp
+         sprecip(:,:) = sf(jp_snow)%fnow(:,:,1)                 ! May need to ensure positive here
+         tprecip(:,:) = sf(jp_rain)%fnow(:,:,1) + sprecip (:,:) ! May need to ensure positive here
+         emp_tot(:,:) = sf(jp_tevp)%fnow(:,:,1) - tprecip(:,:)
+         emp_ice(:,:) = sf(jp_ievp)%fnow(:,:,1) - sf(jp_snow)%fnow(:,:,1)
+                           CALL iom_put( 'rain'         , sf(jp_rain)%fnow(:,:,1)              )   ! liquid precipitation 
+         IF( lk_diaar5 )   CALL iom_put( 'hflx_rain_cea', sf(jp_rain)%fnow(:,:,1) * zcptn(:,:) )   ! heat flux from liq. precip. 
+         ztmp(:,:) = sf(jp_tevp)%fnow(:,:,1) - sf(jp_ievp)%fnow(:,:,1) * zicefr(:,:)
                            CALL iom_put( 'evap_ao_cea'  , ztmp                            )   ! ice-free oce evap (cell average)
          IF( lk_diaar5 )   CALL iom_put( 'hflx_evap_cea', ztmp(:,:         ) * zcptn(:,:) )   ! heat flux from from evap (cell ave)
-      CASE( 'oce and ice'   )   ! received fields: jpr_sbpr, jpr_semp, jpr_oemp, jpr_ievp
-         emp_tot(:,:) = p_frld(:,:) * frcv(jpr_oemp)%z3(:,:,1) + zicefr(:,:) * frcv(jpr_sbpr)%z3(:,:,1)
-         emp_ice(:,:) = frcv(jpr_semp)%z3(:,:,1)
-         sprecip(:,:) = - frcv(jpr_semp)%z3(:,:,1) + frcv(jpr_ievp)%z3(:,:,1)
+      CASE( 'oce and ice'   )   ! received fields: jp_sbpr, jp_semp, jp_oemp, jp_ievp
+         emp_tot(:,:) = p_frld(:,:) * sf(jp_oemp)%fnow(:,:,1) + zicefr(:,:) * sf(jp_sbpr)%fnow(:,:,1)
+         emp_ice(:,:) = sf(jp_semp)%fnow(:,:,1)
+         sprecip(:,:) = - sf(jp_semp)%fnow(:,:,1) + sf(jp_ievp)%fnow(:,:,1)
       END SELECT
 
@@ -1182,15 +933,15 @@
       CALL iom_put( 'snow_ao_cea', sprecip(:,:         ) * p_frld(:,:)    )   ! Snow        over ice-free ocean  (cell average)
       CALL iom_put( 'snow_ai_cea', sprecip(:,:         ) * zicefr(:,:)    )   ! Snow        over sea-ice         (cell average)
-      CALL iom_put( 'subl_ai_cea', frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) )   ! Sublimation over sea-ice         (cell average)
+      CALL iom_put( 'subl_ai_cea', sf(jp_ievp)%fnow(:,:,1) * zicefr(:,:) )   ! Sublimation over sea-ice         (cell average)
       !   
       !                                                           ! runoffs and calving (put in emp_tot)
-      IF( srcv(jpr_rnf)%laction ) THEN 
-         emp_tot(:,:) = emp_tot(:,:) - frcv(jpr_rnf)%z3(:,:,1)
-                           CALL iom_put( 'runoffs'      , frcv(jpr_rnf)%z3(:,:,1)              )   ! rivers
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_rnf_cea' , frcv(jpr_rnf)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from rivers
-      ENDIF
-      IF( srcv(jpr_cal)%laction ) THEN 
-         emp_tot(:,:) = emp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1)
-         CALL iom_put( 'calving', frcv(jpr_cal)%z3(:,:,1) )
+      IF( sf(jp_rnf)%loasis ) THEN 
+         emp_tot(:,:) = emp_tot(:,:) - sf(jp_rnf)%fnow(:,:,1)
+                           CALL iom_put( 'runoffs'      , sf(jp_rnf)%fnow(:,:,1)              )   ! rivers
+         IF( lk_diaar5 )   CALL iom_put( 'hflx_rnf_cea' , sf(jp_rnf)%fnow(:,:,1) * zcptn(:,:) )   ! heat flux from rivers
+      ENDIF
+      IF( sf(jp_cal)%loasis ) THEN 
+         emp_tot(:,:) = emp_tot(:,:) - sf(jp_cal)%fnow(:,:,1)
+         CALL iom_put( 'calving', sf(jp_cal)%fnow(:,:,1) )
       ENDIF
       !
@@ -1198,13 +949,13 @@
 !!gm                                       at least should be optional...
 !!       ! remove negative runoff                            ! sum over the global domain
-!!       zcumulpos = SUM( MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 
-!!       zcumulneg = SUM( MIN( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
+!!       zcumulpos = SUM( MAX( sf(jp_rnf)%fnow(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 
+!!       zcumulneg = SUM( MIN( sf(jp_rnf)%fnow(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
 !!       IF( lk_mpp )   CALL mpp_sum( zcumulpos )
 !!       IF( lk_mpp )   CALL mpp_sum( zcumulneg ) 
 !!       IF( zcumulpos /= 0. ) THEN                          ! distribute negative runoff on positive runoff grid points
 !!          zcumulneg = 1.e0 + zcumulneg / zcumulpos
-!!          frcv(jpr_rnf)%z3(:,:,1) = MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * zcumulneg
+!!          sf(jp_rnf)%fnow(:,:,1) = MAX( sf(jp_rnf)%fnow(:,:,1), 0.e0 ) * zcumulneg
 !!       ENDIF     
-!!       emp_tot(:,:) = emp_tot(:,:) - frcv(jpr_rnf)%z3(:,:,1)   ! add runoff to e-p 
+!!       emp_tot(:,:) = emp_tot(:,:) - sf(jp_rnf)%fnow(:,:,1)   ! add runoff to e-p 
 !!
 !!gm  end of internal cooking
@@ -1214,33 +965,33 @@
       !                                                      ! ========================= !
       CASE( 'oce only' )                                     ! the required field is directly provided
-         qns_tot(:,:  ) = frcv(jpr_qnsoce)%z3(:,:,1)
+         qns_tot(:,:  ) = sf(jp_qnsoce)%fnow(:,:,1)
       CASE( 'conservative' )                                      ! the required fields are directly provided
-         qns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1)
+         qns_tot(:,:  ) = sf(jp_qnsmix)%fnow(:,:,1)
          IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN
-            qns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl)
+            qns_ice(:,:,1:jpl) = sf(jp_qnsice)%fnow(:,:,1:jpl)
          ELSE
             ! Set all category values equal for the moment
             DO jl=1,jpl
-               qns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1)
+               qns_ice(:,:,jl) = sf(jp_qnsice)%fnow(:,:,1)
             ENDDO
          ENDIF
       CASE( 'oce and ice' )       ! the total flux is computed from ocean and ice fluxes
-         qns_tot(:,:  ) =  p_frld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1)
+         qns_tot(:,:  ) =  p_frld(:,:) * sf(jp_qnsoce)%fnow(:,:,1)
          IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN
             DO jl=1,jpl
-               qns_tot(:,:   ) = qns_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qnsice)%z3(:,:,jl)   
-               qns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,jl)
+               qns_tot(:,:   ) = qns_tot(:,:) + a_i(:,:,jl) * sf(jp_qnsice)%fnow(:,:,jl)   
+               qns_ice(:,:,jl) = sf(jp_qnsice)%fnow(:,:,jl)
             ENDDO
          ELSE
             DO jl=1,jpl
-               qns_tot(:,:   ) = qns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1)
-               qns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1)
+               qns_tot(:,:   ) = qns_tot(:,:) + zicefr(:,:) * sf(jp_qnsice)%fnow(:,:,1)
+               qns_ice(:,:,jl) = sf(jp_qnsice)%fnow(:,:,1)
             ENDDO
          ENDIF
       CASE( 'mixed oce-ice' )     ! the ice flux is cumputed from the total flux, the SST and ice informations
 ! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED **
-         qns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1)
-         qns_ice(:,:,1) = frcv(jpr_qnsmix)%z3(:,:,1)    &
-            &            + frcv(jpr_dqnsdt)%z3(:,:,1) * ( pist(:,:,1) - ( (rt0 + psst(:,:  ) ) * p_frld(:,:)   &
+         qns_tot(:,:  ) = sf(jp_qnsmix)%fnow(:,:,1)
+         qns_ice(:,:,1) = sf(jp_qnsmix)%fnow(:,:,1)    &
+            &            + sf(jp_dqnsdt)%fnow(:,:,1) * ( pist(:,:,1) - ( (rt0 + psst(:,:  ) ) * p_frld(:,:)   &
             &                                                   +          pist(:,:,1)   * zicefr(:,:) ) )
       END SELECT
@@ -1259,8 +1010,8 @@
 !! similar job should be done for snow and precipitation temperature
       !                                     
-      IF( srcv(jpr_cal)%laction ) THEN                            ! Iceberg melting 
-         ztmp(:,:) = frcv(jpr_cal)%z3(:,:,1) * lfus               ! add the latent heat of iceberg melting 
+      IF( sf(jp_cal)%loasis ) THEN                            ! Iceberg melting 
+         ztmp(:,:) = sf(jp_cal)%fnow(:,:,1) * lfus               ! add the latent heat of iceberg melting 
          qns_tot(:,:) = qns_tot(:,:) - ztmp(:,:)
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_cal_cea', ztmp + frcv(jpr_cal)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from calving
+         IF( lk_diaar5 )   CALL iom_put( 'hflx_cal_cea', ztmp + sf(jp_cal)%fnow(:,:,1) * zcptn(:,:) )   ! heat flux from calving
       ENDIF
 
@@ -1269,36 +1020,36 @@
       !                                                      ! ========================= !
       CASE( 'oce only' )
-         qsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) )
+         qsr_tot(:,:  ) = MAX( 0._wp , sf(jp_qsroce)%fnow(:,:,1) )
       CASE( 'conservative' )
-         qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
+         qsr_tot(:,:  ) = sf(jp_qsrmix)%fnow(:,:,1)
          IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN
-            qsr_ice(:,:,1:jpl) = frcv(jpr_qsrice)%z3(:,:,1:jpl)
+            qsr_ice(:,:,1:jpl) = sf(jp_qsrice)%fnow(:,:,1:jpl)
          ELSE
             ! Set all category values equal for the moment
             DO jl=1,jpl
-               qsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1)
+               qsr_ice(:,:,jl) = sf(jp_qsrice)%fnow(:,:,1)
             ENDDO
          ENDIF
-         qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
-         qsr_ice(:,:,1) = frcv(jpr_qsrice)%z3(:,:,1)
+         qsr_tot(:,:  ) = sf(jp_qsrmix)%fnow(:,:,1)
+         qsr_ice(:,:,1) = sf(jp_qsrice)%fnow(:,:,1)
       CASE( 'oce and ice' )
-         qsr_tot(:,:  ) =  p_frld(:,:) * frcv(jpr_qsroce)%z3(:,:,1)
+         qsr_tot(:,:  ) =  p_frld(:,:) * sf(jp_qsroce)%fnow(:,:,1)
          IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN
             DO jl=1,jpl
-               qsr_tot(:,:   ) = qsr_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qsrice)%z3(:,:,jl)   
-               qsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,jl)
+               qsr_tot(:,:   ) = qsr_tot(:,:) + a_i(:,:,jl) * sf(jp_qsrice)%fnow(:,:,jl)   
+               qsr_ice(:,:,jl) = sf(jp_qsrice)%fnow(:,:,jl)
             ENDDO
          ELSE
             DO jl=1,jpl
-               qsr_tot(:,:   ) = qsr_tot(:,:) + zicefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1)
-               qsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1)
+               qsr_tot(:,:   ) = qsr_tot(:,:) + zicefr(:,:) * sf(jp_qsrice)%fnow(:,:,1)
+               qsr_ice(:,:,jl) = sf(jp_qsrice)%fnow(:,:,1)
             ENDDO
          ENDIF
       CASE( 'mixed oce-ice' )
-         qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
+         qsr_tot(:,:  ) = sf(jp_qsrmix)%fnow(:,:,1)
 ! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED **
 !       Create solar heat flux over ice using incoming solar heat flux and albedos
 !       ( see OASIS3 user guide, 5th edition, p39 )
-         qsr_ice(:,:,1) = frcv(jpr_qsrmix)%z3(:,:,1) * ( 1.- palbi(:,:,1) )   &
+         qsr_ice(:,:,1) = sf(jp_qsrmix)%fnow(:,:,1) * ( 1.- palbi(:,:,1) )   &
             &            / (  1.- ( albedo_oce_mix(:,:  ) * p_frld(:,:)       &
             &                     + palbi         (:,:,1) * zicefr(:,:) ) )
@@ -1314,9 +1065,9 @@
       CASE ('coupled')
          IF ( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN
-            dqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl)
+            dqns_ice(:,:,1:jpl) = sf(jp_dqnsdt)%fnow(:,:,1:jpl)
          ELSE
             ! Set all category values equal for the moment
             DO jl=1,jpl
-               dqns_ice(:,:,jl) = frcv(jpr_dqnsdt)%z3(:,:,1)
+               dqns_ice(:,:,jl) = sf(jp_dqnsdt)%fnow(:,:,1)
             ENDDO
          ENDIF
@@ -1325,6 +1076,6 @@
       SELECT CASE( TRIM( sn_rcv_iceflx%cldes ) )
       CASE ('coupled')
-         topmelt(:,:,:)=frcv(jpr_topm)%z3(:,:,:)
-         botmelt(:,:,:)=frcv(jpr_botm)%z3(:,:,:)
+         topmelt(:,:,:)=sf(jp_topm)%fnow(:,:,:)
+         botmelt(:,:,:)=sf(jp_botm)%fnow(:,:,:)
       END SELECT
 
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 4826)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 4827)
@@ -17,5 +17,7 @@
    USE sbcdcy          ! surface boundary condition: diurnal cycle on qsr
    USE phycst          ! physical constants
-   USE fldread         ! read input fields
+   USE fldread2        ! read input fields
+   USE fld_def
+   USE sbcget
    USE iom             ! IOM library
    USE in_out_manager  ! I/O manager
@@ -27,12 +29,4 @@
 
    PUBLIC sbc_flx       ! routine called by step.F90
-
-   INTEGER , PARAMETER ::   jpfld   = 5   ! maximum number of files to read 
-   INTEGER , PARAMETER ::   jp_utau = 1   ! index of wind stress (i-component) file
-   INTEGER , PARAMETER ::   jp_vtau = 2   ! index of wind stress (j-component) file
-   INTEGER , PARAMETER ::   jp_qtot = 3   ! index of total (non solar+solar) heat file
-   INTEGER , PARAMETER ::   jp_qsr  = 4   ! index of solar heat file
-   INTEGER , PARAMETER ::   jp_emp  = 5   ! index of evaporation-precipation file
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf    ! structure of input fields (file informations, fields read)
 
    !! * Substitutions
@@ -76,5 +70,4 @@
       !!
       INTEGER  ::   ji, jj, jf            ! dummy indices
-      INTEGER  ::   ierror                ! return error code
       REAL(wp) ::   zfact                 ! temporary scalar
       REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3
@@ -82,44 +75,13 @@
       REAL(wp) ::   ztx, zty, zmod, zcoef ! temporary variables
       !!
-      CHARACTER(len=100) ::  cn_dir                               ! Root directory for location of flx files
-      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                    ! array of namelist information structures
-      TYPE(FLD_N) ::   sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp  ! informations about the fields to be read
-      NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp
+!      CHARACTER(len=100) ::  cn_dir                               ! Root directory for location of flx files
+!      NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp
       !!---------------------------------------------------------------------
       !
       IF( kt == nit000 ) THEN                ! First call kt=nit000  
-         ! set file information
-         cn_dir = './'        ! directory in which the model is executed
-         ! ... default values (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_utau = FLD_N(  'utau' ,    24     ,  'utau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        )
-         sn_vtau = FLD_N(  'vtau' ,    24     ,  'vtau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        )
-         sn_qtot = FLD_N(  'qtot' ,    24     ,  'qtot'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        )
-         sn_qsr  = FLD_N(  'qsr'  ,    24     ,  'qsr'     ,  .false.   , .false. ,   'yearly'  , ''       , ''        )
-         sn_emp  = FLD_N(  'emp'  ,    24     ,  'emp'     ,  .false.   , .false. ,   'yearly'  , ''       , ''        )
-         !
-         REWIND ( numnam )                         ! read in namlist namflx
-         READ   ( numnam, namsbc_flx ) 
          !
          !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing?
-         IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   &
+         IF( ln_dm2dc .AND. sf(jp_qsroce)%nfreqh /= 24 )   &
             &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) 
-         !
-         !                                         ! store namelist information in an array
-         slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau
-         slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr 
-         slf_i(jp_emp ) = sn_emp
-         !
-         ALLOCATE( sf(jpfld), STAT=ierror )        ! set sf structure
-         IF( ierror > 0 ) THEN   
-            CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN  
-         ENDIF
-         DO ji= 1, jpfld
-            ALLOCATE( sf(ji)%fnow(jpi,jpj,1) )
-            IF( slf_i(ji)%ln_tint ) ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) )
-         END DO
-         !                                         ! fill sf with slf_i and control print
-         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' )
          !
          sfx(:,:) = 0.0_wp                         ! salt flux due to freezing/melting (non-zero only if ice is present; set in limsbc(_2).F90)
@@ -127,18 +89,16 @@
       ENDIF
 
-      CALL fld_read( kt, nn_fsbc, sf )                            ! input fields provided at the current time-step
-     
       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN                        ! update ocean fluxes at each SBC frequency
 
-         IF( ln_dm2dc ) THEN   ;   qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) )   ! modify now Qsr to include the diurnal cycle
-         ELSE                  ;   qsr(:,:) =          sf(jp_qsr)%fnow(:,:,1)
+         IF( ln_dm2dc ) THEN   ;   qsr(:,:) = sbc_dcy( sf(jp_qsroce)%fnow(:,:,1) )   ! modify now Qsr to include the diurnal cycle
+         ELSE                  ;   qsr(:,:) =          sf(jp_qsroce)%fnow(:,:,1)
          ENDIF
 !CDIR COLLAPSE
          DO jj = 1, jpj                                           ! set the ocean fluxes from read fields
             DO ji = 1, jpi
-               utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1)
-               vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1)
-               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1)
-               emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1)
+               utau(ji,jj) = sf(jp_otx1)%fnow(ji,jj,1)
+               vtau(ji,jj) = sf(jp_oty1)%fnow(ji,jj,1)
+               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsroce)%fnow(ji,jj,1)
+               emp (ji,jj) = sf(jp_oemp )%fnow(ji,jj,1)
             END DO
          END DO
@@ -165,7 +125,7 @@
             WRITE(numout,*) '        read daily momentum, heat and freshwater fluxes OK'
             DO jf = 1, jpfld
-               IF( jf == jp_utau .OR. jf == jp_vtau )   zfact =     1.
-               IF( jf == jp_qtot .OR. jf == jp_qsr  )   zfact =     0.1
-               IF( jf == jp_emp                     )   zfact = 86400.
+               IF( jf == jp_otx1 .OR. jf == jp_oty1   )   zfact =     1.
+               IF( jf == jp_qtot .OR. jf == jp_qsroce )   zfact =     0.1
+               IF( jf == jp_oemp                       )   zfact = 86400.
                WRITE(numout,*) 
                WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcget.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcget.F90	(revision 4827)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcget.F90	(revision 4827)
@@ -0,0 +1,128 @@
+MODULE sbcget
+   !!======================================================================
+   !!                       ***  MODULE  sbcget  ***
+   !! Ocean forcing:  get input field for surface boundary condition
+   !!=====================================================================
+
+   !!----------------------------------------------------------------------
+   !!   fld_read      : read input fields used for the computation of the
+   !!                   surface boundary condition
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! ???
+   USE in_out_manager  ! I/O manager
+   USE iom             ! I/O manager library
+   USE lib_mpp         ! MPP library
+   USE wrk_nemo        ! work arrays
+   USE timing
+   USE fldread2
+   USE fld_def
+   USE sbc_ice
+#if defined key_cice
+   USE ice_domain_size, only: ncat
+#endif
+   USE cpl_oasis3      ! OASIS3 coupling
+
+   IMPLICIT NONE
+   PRIVATE   
+
+   PUBLIC  sbc_get_init, sbc_get
+
+#if defined key_cice
+   INTEGER, PUBLIC, PARAMETER ::   jpl = ncat 
+#elif ! defined key_lim2   &&   ! defined key_lim3
+   INTEGER, PUBLIC, PARAMETER ::   jpl = 1 
+#endif
+
+   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
+
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: fldread.F90 3851 2013-03-27 10:03:54Z smasson $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE sbc_get_init(  )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_get_init  ***
+      !!
+      !! ** Purpose :  - read namelists, initialise stuff
+      !!----------------------------------------------------------------------
+      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_otx1, sn_oty1, sn_otz1, sn_otx2, sn_oty2, sn_otz2,  sn_itx1, sn_ity1, sn_itz1, sn_itx2, sn_ity2, sn_itz2
+      TYPE(FLD_N) ::   sn_qsroce, sn_qnsoce, sn_qlw, sn_tair, sn_humi, sn_prec, sn_rain, sn_snow, sn_tevp, sn_ievp, sn_tdif, sn_w10m, sn_qtot
+      TYPE(FLD_N) ::   sn_oemp, sn_rnf, sn_cal, sn_topm, sn_botm, sn_qsrice, sn_qsrmix, sn_qnsice, sn_qnsmix, sn_taum, sn_sbpr, sn_semp, sn_dqnsdt, sn_co2
+      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i
+      INTEGER ::   jn       ! dummy loop index
+      INTEGER ::   ierror   ! return error code
+      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
+      NAMELIST/namsbc_get/ cn_dir , sn_wndi, sn_wndj, sn_otx1, sn_oty1, sn_otz1, sn_otx2, sn_oty2, sn_otz2,  sn_itx1, sn_ity1, sn_itz1, sn_itx2, sn_ity2, sn_itz2, sn_qsroce, sn_qnsoce, sn_qlw, sn_tair, sn_humi, sn_prec, sn_rain, sn_snow, sn_tevp, sn_ievp, sn_tdif, sn_w10m, sn_qtot, sn_oemp, sn_rnf, sn_cal, sn_topm, sn_botm, sn_qsrice, sn_qsrmix, sn_qnsice, sn_qnsmix, sn_taum, sn_sbpr, sn_semp, sn_dqnsdt, sn_co2
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('sbc_get_init')
+
+      ! set file information (default values)
+      cn_dir = './'       ! directory in which the model is executed
+
+      REWIND( numnam )                    ! ... read namlist namsbc_get
+      READ  ( numnam, namsbc_get )
+
+      slf_i(jp_wndi) = sn_wndi     ;   slf_i(jp_wndj) = sn_wndj
+      slf_i(jp_otx1) = sn_otx1     ;   slf_i(jp_oty1) = sn_oty1     ;  slf_i(jp_otz1) = sn_otz1
+      slf_i(jp_otx2) = sn_otx2     ;   slf_i(jp_oty2) = sn_oty2     ;  slf_i(jp_otz2) = sn_otz2
+      slf_i(jp_itx1) = sn_itx1     ;   slf_i(jp_ity1) = sn_ity1     ;  slf_i(jp_itz1) = sn_itz1
+      slf_i(jp_itx1) = sn_itx2     ;   slf_i(jp_ity2) = sn_ity2     ;  slf_i(jp_itz2) = sn_itz2
+      slf_i(jp_qsroce) = sn_qsroce ;   slf_i(jp_qsrice) = sn_qsrice ;  slf_i(jp_qsrmix) = sn_qsrmix 
+      slf_i(jp_qnsoce) = sn_qnsoce ;   slf_i(jp_qnsice) = sn_qnsice ;  slf_i(jp_qnsmix) = sn_qnsmix 
+      slf_i(jp_qlw)  = sn_qlw      ;   slf_i(jp_tair) = sn_tair     ;  slf_i(jp_humi) = sn_humi 
+      slf_i(jp_prec) = sn_prec     ;   slf_i(jp_rain) = sn_rain     ;  slf_i(jp_snow) = sn_snow      
+      slf_i(jp_tevp) = sn_tevp     ;   slf_i(jp_ievp) = sn_ievp     ;  slf_i(jp_tdif) = sn_tdif
+      slf_i(jp_taum) = sn_taum     ;   slf_i(jp_w10m) = sn_w10m     ;  slf_i(jp_qtot) = sn_qtot
+      slf_i(jp_sbpr) = sn_sbpr     ;   slf_i(jp_semp) = sn_semp     ;  slf_i(jp_oemp) = sn_oemp     
+      slf_i(jp_rnf)  = sn_rnf      ;   slf_i(jp_cal)  = sn_cal      ;  slf_i(jp_topm) = sn_topm
+      slf_i(jp_botm) = sn_botm     ;   slf_i(jp_dqnsdt) = sn_dqnsdt ;  slf_i(jp_co2) = sn_co2
+
+      ALLOCATE( sf(jpfld), STAT=ierror )         ! set sf structure
+      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl: unable to allocate sf structure' )
+
+      CALL fld_fill2( sf, slf_i, jpl, cn_dir, 'sbc_get', 'coupled formulation for ocean surface boundary condition', 'namsbc_get' )
+
+      ! Allocate all parts of sf used for received fields
+      DO jn = 1, jpfld
+         IF ( sf(jn)%loasis .OR. sf(jn)%lfile ) ALLOCATE( sf(jn)%fnow(jpi,jpj,sf(jn)%nct) )
+         IF ( sf(jn)%lfile .AND. sf(jn)%ln_tint ) ALLOCATE( sf(jn)%fdta(jpi,jpj,sf(jn)%nct,2) )
+      END DO
+
+      ! Allocate taum part of sf which is used even when not received as coupling field
+      IF ( .NOT. sf(jp_taum)%loasis ) ALLOCATE( sf(jp_taum)%fnow(jpi,jpj,sf(jn)%nct) )
+
+! **WE REALLY NEED A WHOLE LOAD OF CHECKS THAT NAMSBC_GET IS CONSISTENT WITH OTHER CHOICES RE COUPLED / BULK ETC  BUT DO THIS LATER** ! **MAY REQUIRE CHANGES TO OTHER NAME-LIST STRUCTURES** !
+
+      IF( nn_timing == 1 )  CALL timing_stop('sbc_get_init')
+
+   END SUBROUTINE sbc_get_init
+
+   SUBROUTINE sbc_get( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_get  ***
+      !!
+      !! ** Purpose :   get the data
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt       ! ocean model time step index
+      INTEGER ::   jn       ! dummy loop index
+      INTEGER  ::   isec                   ! number of seconds since nit000 (assuming rdttra did not change since nit000)
+
+      isec = ( kt - nit000 ) * NINT( rdttra(1) )             ! date of exchanges
+
+      DO jn= 1, jpfld
+         IF( sf(jn)%lfile )  CALL fld_read2( kt, nn_fsbc, sf(jn:jn) )  ! input fields provided at the current time-step
+         IF( sf(jn)%loasis )  CALL cpl_prism_rcv( isec, sf(jn) )        ! input fields provided at the current time-step
+      END DO
+
+! Need to sort out where / how rotation should work....
+      CALL fld_rot2( kt, sf )                    ! rotate vector before/now/after fields if needed
+
+   END SUBROUTINE sbc_get
+
+END MODULE sbcget
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 4826)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 4827)
@@ -22,5 +22,5 @@
    USE timing          ! Timing
    USE daymod          ! calendar
-   USE fldread         ! read input fields
+   USE fld_def
 
    USE sbc_oce         ! Surface boundary condition: ocean fields
@@ -28,4 +28,5 @@
    USE sbcblk_core     ! Surface boundary condition: CORE bulk
    USE sbccpl
+   USE sbcget
 
    USE ice_kinds_mod
@@ -62,20 +63,4 @@
    INTEGER , PARAMETER ::   ji_off = INT ( (jpiglo - nx_global) / 2 )
    INTEGER , PARAMETER ::   jj_off = INT ( (jpjglo - ny_global) / 2 )
-
-   INTEGER , PARAMETER ::   jpfld   = 13   ! maximum number of files to read 
-   INTEGER , PARAMETER ::   jp_snow = 1    ! index of snow file
-   INTEGER , PARAMETER ::   jp_rain = 2    ! index of rain file
-   INTEGER , PARAMETER ::   jp_sblm = 3    ! index of sublimation file
-   INTEGER , PARAMETER ::   jp_top1 = 4    ! index of category 1 topmelt file
-   INTEGER , PARAMETER ::   jp_top2 = 5    ! index of category 2 topmelt file
-   INTEGER , PARAMETER ::   jp_top3 = 6    ! index of category 3 topmelt file
-   INTEGER , PARAMETER ::   jp_top4 = 7    ! index of category 4 topmelt file
-   INTEGER , PARAMETER ::   jp_top5 = 8    ! index of category 5 topmelt file
-   INTEGER , PARAMETER ::   jp_bot1 = 9    ! index of category 1 botmelt file
-   INTEGER , PARAMETER ::   jp_bot2 = 10   ! index of category 2 botmelt file
-   INTEGER , PARAMETER ::   jp_bot3 = 11   ! index of category 3 botmelt file
-   INTEGER , PARAMETER ::   jp_bot4 = 12   ! index of category 4 botmelt file
-   INTEGER , PARAMETER ::   jp_bot5 = 13   ! index of category 5 botmelt file
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf    ! structure of input fields (file informations, fields read)
 
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:), PRIVATE ::   png     ! local array used in sbc_cice_ice
@@ -655,5 +640,5 @@
       IF( kt == nit000 )  THEN
          IF(lwp) WRITE(numout,*)'cice_sbc_hadgam'
-         IF( sbc_cpl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' )
+!         IF( sbc_cpl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' )
       ENDIF
 
@@ -705,5 +690,5 @@
       !!
       !!---------------------------------------------------------------------
-      !! ** Method  :   READ monthly flux file in NetCDF files
+      !! ** Method  :   Set forcing fields
       !!      
       !!  snowfall    
@@ -716,75 +701,8 @@
       !!----------------------------------------------------------------------
       !! * Modules used
-      USE iom
-
-      !! * arguments
+
       INTEGER, INTENT( in  ) ::   kt ! ocean time step
 
-      INTEGER  ::   ierror             ! return error code
-      INTEGER  ::   ifpr               ! dummy loop index
-      !!
-      CHARACTER(len=100) ::  cn_dir                            !   Root directory for location of CICE forcing files
-      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                 ! array of namelist informations on the fields to read
-      TYPE(FLD_N) ::   sn_snow, sn_rain, sn_sblm               ! informations about the fields to be read
-      TYPE(FLD_N) ::   sn_top1, sn_top2, sn_top3, sn_top4, sn_top5
-      TYPE(FLD_N) ::   sn_bot1, sn_bot2, sn_bot3, sn_bot4, sn_bot5 
-
-      !!
-      NAMELIST/namsbc_cice/ cn_dir, sn_snow, sn_rain, sn_sblm,   &
-         &                          sn_top1, sn_top2, sn_top3, sn_top4, sn_top5,  &
-         &                          sn_bot1, sn_bot2, sn_bot3, sn_bot4, sn_bot5
-      !!---------------------------------------------------------------------
-
-      !                                         ! ====================== !
-      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
-         !                                      ! ====================== !
-         ! set file information (default values)
-         cn_dir = './'       ! directory in which the model is executed
-
-         ! (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_snow = FLD_N( 'snowfall_1m'  ,    -1.    ,  'snowfall'  ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         ) 
-         sn_rain = FLD_N( 'rainfall_1m'  ,    -1.    ,  'rainfall'  ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         ) 
-         sn_sblm = FLD_N( 'sublim_1m'    ,    -1.    ,  'sublim'    ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top1 = FLD_N( 'topmeltn1_1m' ,    -1.    ,  'topmeltn1' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top2 = FLD_N( 'topmeltn2_1m' ,    -1.    ,  'topmeltn2' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top3 = FLD_N( 'topmeltn3_1m' ,    -1.    ,  'topmeltn3' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top4 = FLD_N( 'topmeltn4_1m' ,    -1.    ,  'topmeltn4' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top5 = FLD_N( 'topmeltn5_1m' ,    -1.    ,  'topmeltn5' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot1 = FLD_N( 'botmeltn1_1m' ,    -1.    ,  'botmeltn1' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot2 = FLD_N( 'botmeltn2_1m' ,    -1.    ,  'botmeltn2' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot3 = FLD_N( 'botmeltn3_1m' ,    -1.    ,  'botmeltn3' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot4 = FLD_N( 'botmeltn4_1m' ,    -1.    ,  'botmeltn4' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot5 = FLD_N( 'botmeltn5_1m' ,    -1.    ,  'botmeltn5' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-
-!         REWIND ( numnam )               ! ... at some point might read in from NEMO namelist?
-!         READ   ( numnam, namsbc_cice ) 
-
-         ! store namelist information in an array
-         slf_i(jp_snow) = sn_snow   ;   slf_i(jp_rain) = sn_rain   ;   slf_i(jp_sblm) = sn_sblm
-         slf_i(jp_top1) = sn_top1   ;   slf_i(jp_top2) = sn_top2   ;   slf_i(jp_top3) = sn_top3
-         slf_i(jp_top4) = sn_top4   ;   slf_i(jp_top5) = sn_top5   ;   slf_i(jp_bot1) = sn_bot1
-         slf_i(jp_bot2) = sn_bot2   ;   slf_i(jp_bot3) = sn_bot3   ;   slf_i(jp_bot4) = sn_bot4
-         slf_i(jp_bot5) = sn_bot5
-         
-         ! set sf structure
-         ALLOCATE( sf(jpfld), STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'cice_sbc_force: unable to allocate sf structure' )   ;   RETURN
-         ENDIF
-
-         DO ifpr= 1, jpfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
-            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
-         END DO
-
-         ! fill sf with slf_i and control print
-         CALL fld_fill( sf, slf_i, cn_dir, 'cice_sbc_force', 'flux formulation for CICE', 'namsbc_cice' )
-         !
-      ENDIF
-
-      CALL fld_read( kt, nn_fsbc, sf )           ! Read input fields and provides the
-      !                                          ! input fields at the current time-step
+      ! Assume the fluxes have already been obtained somewhere....
 
       ! set the fluxes from read fields
@@ -792,22 +710,7 @@
       tprecip(:,:) = sf(jp_snow)%fnow(:,:,1)+sf(jp_rain)%fnow(:,:,1)
 ! May be better to do this conversion somewhere else
-      qla_ice(:,:,1) = -Lsub*sf(jp_sblm)%fnow(:,:,1)
-      topmelt(:,:,1) = sf(jp_top1)%fnow(:,:,1)
-      topmelt(:,:,2) = sf(jp_top2)%fnow(:,:,1)
-      topmelt(:,:,3) = sf(jp_top3)%fnow(:,:,1)
-      topmelt(:,:,4) = sf(jp_top4)%fnow(:,:,1)
-      topmelt(:,:,5) = sf(jp_top5)%fnow(:,:,1)
-      botmelt(:,:,1) = sf(jp_bot1)%fnow(:,:,1)
-      botmelt(:,:,2) = sf(jp_bot2)%fnow(:,:,1)
-      botmelt(:,:,3) = sf(jp_bot3)%fnow(:,:,1)
-      botmelt(:,:,4) = sf(jp_bot4)%fnow(:,:,1)
-      botmelt(:,:,5) = sf(jp_bot5)%fnow(:,:,1)
-
-      ! control print (if less than 100 time-step asked)
-      IF( nitend-nit000 <= 100 .AND. lwp ) THEN
-         WRITE(numout,*) 
-         WRITE(numout,*) '        read forcing fluxes for CICE OK'
-         CALL FLUSH(numout)
-      ENDIF
+      qla_ice(:,:,1) = -Lsub*sf(jp_ievp)%fnow(:,:,1)
+      topmelt(:,:,:) = sf(jp_topm)%fnow(:,:,:)
+      botmelt(:,:,:) = sf(jp_botm)%fnow(:,:,:)
 
    END SUBROUTINE cice_sbc_force
Index: /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 4826)
+++ /branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 4827)
@@ -37,4 +37,5 @@
    USE sbcice_cice      ! surface boundary condition: CICE    sea-ice model
    USE sbccpl           ! surface boundary condition: coupled florulation
+   USE sbcget
    USE cpl_oasis3, ONLY:lk_cpl      ! are we in coupled mode?
    USE sbcssr           ! surface boundary condition: sea surface restoring
@@ -221,4 +222,6 @@
       IF( ln_ssr      )   CALL sbc_ssr_init               ! Sea-Surface Restoring initialisation
       !
+      CALL sbc_get_init
+      !
       IF( nn_ice == 4 )   CALL cice_sbc_init( nsbc )      ! CICE initialisation
       !
@@ -258,4 +261,7 @@
          sfx_b(:,:) = sfx(:,:)
       ENDIF
+      !
+      CALL sbc_get( kt )
+      !
       !                                            ! ---------------------------------------- !
       !                                            !        forcing field computation         !
