Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/sms_medusa.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/sms_medusa.F90	(revision 6288)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/sms_medusa.F90	(revision 6466)
@@ -250,5 +250,4 @@
 !!
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   dust      !: dust parameter 1
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   dustmo    !: dust parameter 2
 
 !!----------------------------------------------------------------------
@@ -473,5 +472,5 @@
       !* 2D fields of miscellaneous parameters
       ALLOCATE( ocal_ccd(jpi,jpj)    , dust(jpi,jpj)        ,       &
-         &      dustmo(jpi,jpj,2)    , riv_n(jpi,jpj)       ,       &
+         &      riv_n(jpi,jpj)                              ,       &
          &      riv_si(jpi,jpj)      , riv_c(jpi,jpj)       ,       &
          &      riv_alk(jpi,jpj)     , friver_dep(jpk,jpk)  ,    STAT=ierr(5) )
Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 6288)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 6466)
@@ -1312,6 +1312,4 @@
                if (idf.eq.1.AND.idfval.eq.1.AND.jk.eq.1) then
                   IF (lwp) write (numout,*) '------------------------------'
-                  IF (lwp) write (numout,*) 'dustmo(1) = ', dustmo(ji,jj,1)
-                  IF (lwp) write (numout,*) 'dustmo(2) = ', dustmo(ji,jj,2)
                   IF (lwp) write (numout,*) 'dust      = ', dust(ji,jj)
                endif
Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcsed_medusa.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcsed_medusa.F90	(revision 6288)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcsed_medusa.F90	(revision 6466)
@@ -25,5 +25,5 @@
    !! USE trc_nam_dia         ! JPALM 13-11-2015 -- if iom_use for diag
    !! USE trc_nam_iom_medusa  ! JPALM 13-11-2015 -- if iom_use for diag
-
+   USE fldread         !  time interpolation
    USE lbclnk
    USE prtctl_trc      ! Print control for debbuging
@@ -41,13 +41,20 @@
 
    !! AXY (10/02/09)
-   LOGICAL, PUBLIC ::                  &
-      bdustfer = .TRUE.
+   LOGICAL, PUBLIC  ::   bdustfer  !: boolean for dust input from the atmosphere
    REAL(wp), PUBLIC ::                 &
       sedfeinput = 1.e-9_wp  ,         &
       dustsolub  = 0.014_wp
+
+   INTEGER , PARAMETER :: nbtimes = 365  !: maximum number of times record in a file
+   INTEGER  :: ntimes_dust               ! number of time steps in a file
+
    INTEGER ::                          &
       numdust,                         &
       nflx1,  nflx2,                   &
       nflx11, nflx12
+   
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_dust      ! structure of input dust
+
+   
    !!* Substitution
 #  include "domzgr_substitute.h90"
@@ -132,5 +139,17 @@
 
       !! AXY (10/02/09)
-      IF( (jnt == 1) .and. (bdustfer) )  CALL trc_sed_medusa_sbc( kt )
+      !!IF( (jnt == 1) .and. (bdustfer) )  CALL trc_sed_medusa_sbc( kt )
+      !! JPALM -- 31-03-2016 -- rewrite trc_sed_medusa_sbc.
+      !! IF (kt == nittrc000 ) CALL trc_sed_medusa_sbc 
+      IF( bdustfer ) THEN
+         IF( kt == nittrc000 .OR. ( kt /= nittrc000 .AND. ntimes_dust > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_dust )
+            dust(:,:) = sf_dust(1)%fnow(:,:,1)
+         ENDIF
+      ELSE
+         dust(:,:) = 0.0
+      ENDIF
+      !!
+           
       !!
       zirondep(:,:,:) = 0.e0     !! Initialisation of deposition variables
@@ -262,4 +281,9 @@
 
    !! AXY (10/02/09)
+   !! JPALM -- 31-03-2016 -- Completely change trc_sed_medusa_sbc.
+   !!                     -- We now need to read dust file through a namelist.
+   !!                     To be able to use time varying dust depositions from
+   !!                     -- copy and adapt the PISCES p4z_sbc_ini subroutine
+   !!                     -- Only use the dust related part.      
    SUBROUTINE trc_sed_medusa_sbc(kt)
 
@@ -267,99 +291,91 @@
       !!                  ***  ROUTINE trc_sed_medusa_sbc  ***
       !!
-      !! ** Purpose :   Read and interpolate the external sources of 
-      !!                nutrients
-      !!
-      !! ** Method  :   Read the files and interpolate the appropriate variables
-      !!
-      !! ** input   :   external netcdf files
+      !! ** Purpose :   Read and dust namelist and files.
+      !!                The interpolation is done in trc_sed through 
+      !!                "CALL fld_read( kt, 1, sf_dust )"
+      !!
+      !! ** Method  :   Read the sbc namelist, and the adapted dust file, if required
+      !!                called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   -- namelist sbc ref and cfg
+      !!                -- external netcdf files
       !!
       !!----------------------------------------------------------------------
       !! * arguments
       INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER ::   &
-         imois, imois2,       &  ! temporary integers
-         i15  , iman             !    "          "
-      REAL(wp) ::   &
-         zxy                     !    "         "
+      INTEGER  :: ji, jj, jk, jm, ifpr
+      INTEGER  :: ii0, ii1, ij0, ij1
+      INTEGER  :: numdust
+      INTEGER  :: ierr 
+      INTEGER  :: ios                 ! Local integer output status for namelist read
+      INTEGER  :: isrow             ! index for ORCA1 starting row
+      REAL(wp) :: ztimes_dust
+      REAL(wp), DIMENSION(nbtimes) :: zsteps                 ! times records
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zdust
+      !
+      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N) ::   sn_dust               ! informations about the fields to be read
+      !
+      NAMELIST/nammedsbc/cn_dir, sn_dust, bdustfer 
 
       !!---------------------------------------------------------------------
-      IF (bdustfer) THEN
-         !! Initialization
-         !! --------------
-         !!
-         i15 = nday / 16
-         iman  = INT( raamo )
-         imois = nmonth + i15 - 1
-         IF( imois == 0 ) imois = iman
-         imois2 = nmonth
-
-         !! 1. first call kt=nittrc000
-         !! -----------------------
-         !!
-         IF (kt == nittrc000) THEN
-            ! initializations
-            nflx1  = 0
-            nflx11 = 0
-            ! open the file
-            IF(lwp) THEN
-               WRITE(numout,*) ' '
-               WRITE(numout,*) ' **** Routine trc_sed_medusa_sbc'
-            ENDIF
-            CALL iom_open ( 'dust.orca.nc', numdust )
-            IF(lwp) WRITE(numout,*) 'trc_sed_medusa_sbc: dust.orca.nc opened'
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_sed_medusa_sbc')
+      !
+      !                            !* set file information
+      REWIND( numnatp_ref )        ! Namelist nammedsbc in reference namelist : MEDUSA external sources of Dust
+      READ  ( numnatp_ref, nammedsbc, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nammedsbc in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )        ! Namelist nammedsbc in configuration namelist : MEDUSA external sources of Dust
+      READ  ( numnatp_cfg, nammedsbc, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nammedsbc in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, nammedsbc )
+
+      IF(lwp) THEN
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' namelist : nammedsbc '
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~ '
+         WRITE(numout,*) '    dust input from the atmosphere           bdustfer     = ', bdustfer
+      END IF
+
+      ! dust input from the atmosphere
+      ! ------------------------------
+      IF( bdustfer ) THEN
+         !
+         IF(lwp) WRITE(numout,*) '    initialize dust input from atmosphere '
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
+         !
+         !! already allocated in sms_medusa
+         !!ALLOCATE( dust(jpi,jpj) )    ! allocation
+         !
+         ALLOCATE( sf_dust(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trc_sed_medusa_sbc: unable to allocate sf_dust structure' )
+         !
+         CALL fld_fill( sf_dust, (/ sn_dust /), cn_dir, 'trc_sed_medusa_sbc', 'Atmospheric dust deposition', 'nammedsed' )
+                                   ALLOCATE( sf_dust(1)%fnow(jpi,jpj,1)   )
+         IF( sn_dust%ln_tint )     ALLOCATE( sf_dust(1)%fdta(jpi,jpj,1,2) )
+         !
+         IF( Agrif_Root() ) THEN   !  Only on the master grid
+            ! Get total input dust ; need to compute total atmospheric supply of Si in a year
+            CALL iom_open (  TRIM( sn_dust%clname ) , numdust )
+            CALL iom_gettime( numdust, zsteps, kntime=ntimes_dust)  ! get number of record in file
+            ALLOCATE( zdust(jpi,jpj,ntimes_dust) )
+            DO jm = 1, ntimes_dust
+               CALL iom_get( numdust, jpdom_data, TRIM( sn_dust%clvar ), zdust(:,:,jm), jm )
+            END DO
+            CALL iom_close( numdust )
+            DEALLOCATE( zdust)
          ENDIF
-   
-         !! Read monthly file
-         !! ----------------
-         !!
-         IF( kt == nittrc000 .OR. imois /= nflx1 ) THEN
-
-            !! Calendar computation
-            !!
-            !! nflx1 number of the first file record used in the simulation
-            !! nflx2 number of the last  file record
-            !!
-            nflx1 = imois
-            nflx2 = nflx1+1
-            nflx1 = MOD( nflx1, iman )
-            nflx2 = MOD( nflx2, iman )
-            IF( nflx1 == 0 )   nflx1 = iman
-            IF( nflx2 == 0 )   nflx2 = iman
-            IF(lwp) WRITE(numout,*) 'trc_sed_medusa_sbc: first record file used nflx1 ',nflx1
-            IF(lwp) WRITE(numout,*) 'trc_sed_medusa_sbc: last  record file used nflx2 ',nflx2
-
-            !! Read monthly fluxes data
-            !!
-            !! humidity
-            !!
-            CALL iom_get ( numdust, jpdom_data, 'dust', dustmo(:,:,1), nflx1 )
-            CALL iom_get ( numdust, jpdom_data, 'dust', dustmo(:,:,2), nflx2 )
-
-            IF(lwp .AND. nitend-nit000 <= 100 ) THEN
-               WRITE(numout,*)
-               WRITE(numout,*) ' read clio flx ok'
-               WRITE(numout,*)
-               WRITE(numout,*)
-               WRITE(numout,*) 'Clio month: ',nflx1,'  field: dust'
-               CALL prihre( dustmo(:,:,1),jpi,jpj,1,jpi,20,1,jpj,10,1e9,numout )
-            ENDIF
-
-         ENDIF
-
-         !! 3. at every time step interpolation of fluxes
-         !! ---------------------------------------------
-         !!
-         zxy = FLOAT( nday + 15 - 30 * i15 ) / 30
-         dust(:,:) = ( (1.-zxy) * dustmo(:,:,1) + zxy * dustmo(:,:,2) )
-
-         IF( kt == nitend ) THEN
-            CALL iom_close (numdust)
-            IF(lwp) WRITE(numout,*) 'trc_sed_medusa_sbc: dust.orca.nc closed'
-         ENDIF
-      ELSE 
+         !
+         CALL fld_read( kt, 1, sf_dust )
+         dust(:,:) = sf_dust(1)%fnow(:,:,1)
+         !
+      ELSE
          dust(:,:) = 0.0
-      ENDIF
+      END IF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_sed_medusa_sbc')
+      !
    END SUBROUTINE trc_sed_medusa_sbc
 
