Index: NEMO/branches/2019/dev_r11943_TOP-01_ENHANCE-11_CEthe/src/TOP/PISCES/P4Z/p4zsed.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_TOP-01_ENHANCE-11_CEthe/src/TOP/PISCES/P4Z/p4zsed.F90	(revision 12089)
+++ NEMO/branches/2019/dev_r11943_TOP-01_ENHANCE-11_CEthe/src/TOP/PISCES/P4Z/p4zsed.F90	(revision 12090)
@@ -15,5 +15,4 @@
    USE sms_pisces      !  PISCES Source Minus Sink variables
    USE p4zlim          !  Co-limitations of differents nutrients
-   USE p4zsbc          !  External source of nutrients 
    USE p4zint          !  interpolation and computation of various fields
    USE sed             !  Sediment module
@@ -25,10 +24,16 @@
 
    PUBLIC   p4z_sed  
+   PUBLIC   p4z_sed_init
    PUBLIC   p4z_sed_alloc
  
+   REAL(wp), PUBLIC ::   nitrfix      !: Nitrogen fixation rate
+   REAL(wp), PUBLIC ::   diazolight   !: Nitrogen fixation sensitivty to light
+   REAL(wp), PUBLIC ::   concfediaz   !: Fe half-saturation Cste for diazotrophs
+
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: nitrpot    !: Nitrogen fixation 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:  ) :: sdenit     !: Nitrate reduction in the sediments
-   REAL(wp) :: r1_rday                  !: inverse of rday
-   LOGICAL, SAVE :: lk_sed
+   !
+   REAL(wp), SAVE :: r1_rday          
+   REAL(wp), SAVE :: sedsilfrac, sedcalfrac
 
    !!----------------------------------------------------------------------
@@ -53,5 +58,5 @@
       INTEGER  ::  ji, jj, jk, ikt
       REAL(wp) ::  zrivalk, zrivsil, zrivno3
-      REAL(wp) ::  zwflux, zlim, zfact, zfactcal
+      REAL(wp) ::  zlim, zfact, zfactcal
       REAL(wp) ::  zo2, zno3, zflx, zpdenit, z1pdenit, zolimit
       REAL(wp) ::  zsiloss, zcaloss, zws3, zws4, zwsc, zdep
@@ -66,20 +71,9 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) :: zsoufer, zlight
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrpo4, ztrdop, zirondep, zpdep
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:  ) :: zsidep, zironice
       !!---------------------------------------------------------------------
       !
       IF( ln_timing )  CALL timing_start('p4z_sed')
       !
-      IF( kt == nittrc000 .AND. knt == 1 )   THEN
-          r1_rday  = 1. / rday
-          IF (ln_sediment .AND. ln_sed_2way) THEN
-             lk_sed = .TRUE.
-          ELSE
-             lk_sed = .FALSE.
-          ENDIF
-      ENDIF
-      !
-      IF( kt == nittrc000 .AND. knt == 1 )   r1_rday  = 1. / rday
-      !
+
       ! Allocate temporary workspace
       ALLOCATE( ztrpo4(jpi,jpj,jpk) )
@@ -93,143 +87,15 @@
       zsedc   (:,:) = 0.e0
 
-      ! Iron input/uptake due to sea ice : Crude parameterization based on Lancelot et al.
-      ! ----------------------------------------------------
-      IF( ln_ironice ) THEN  
-         !                                              
-         ALLOCATE( zironice(jpi,jpj) )
-         !                                              
+      IF( .NOT.lk_sed ) THEN
+         ! OA: Warning, the following part is necessary to avoid CFL problems above the sediments
+         ! --------------------------------------------------------------------
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zdep    = rfact2 / e3t_n(ji,jj,1)
-               zwflux  = fmmflx(ji,jj) / 1000._wp
-               zironice(ji,jj) =  MAX( -0.99 * trb(ji,jj,1,jpfer), -zwflux * icefeinput * zdep )
-            END DO
-         END DO
-         !
-         tra(:,:,1,jpfer) = tra(:,:,1,jpfer) + zironice(:,:) 
-         ! 
-         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironice" ) )   &
-            &   CALL iom_put( "Ironice", zironice(:,:) * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1) ) ! iron flux from ice
-         !
-         DEALLOCATE( zironice )
-         !                                              
-      ENDIF
-
-      ! Add the external input of nutrients from dust deposition
-      ! ----------------------------------------------------------
-      IF( ln_dust ) THEN
-         !                                              
-         ALLOCATE( zsidep(jpi,jpj), zpdep(jpi,jpj,jpk), zirondep(jpi,jpj,jpk) )
-         !                                              ! Iron and Si deposition at the surface
-         IF( ln_solub ) THEN
-            zirondep(:,:,1) = solub(:,:) * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 55.85 + 3.e-10 * r1_ryyss 
-         ELSE
-            zirondep(:,:,1) = dustsolub  * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 55.85 + 3.e-10 * r1_ryyss 
-         ENDIF
-         zsidep(:,:)   = 8.8 * 0.075 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 28.1 
-         zpdep (:,:,1) = 0.1 * 0.021 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 31. / po4r 
-         !                                              ! Iron solubilization of particles in the water column
-         !                                              ! dust in kg/m2/s ---> 1/55.85 to put in mol/Fe ;  wdust in m/j
-         zwdust = 0.03 * rday / ( wdust * 55.85 ) / ( 270. * rday )
-         DO jk = 2, jpkm1
-            zirondep(:,:,jk) = dust(:,:) * mfrac * zwdust * rfact2 * EXP( -gdept_n(:,:,jk) / 540. )
-            zpdep   (:,:,jk) = zirondep(:,:,jk) * 0.023
-         END DO
-         !                                              ! Iron solubilization of particles in the water column
-         tra(:,:,1,jpsil) = tra(:,:,1,jpsil) + zsidep  (:,:)
-         DO jk = 1, jpkm1
-            tra(:,:,jk,jppo4) = tra(:,:,jk,jppo4) + zpdep   (:,:,jk)
-            tra(:,:,jk,jpfer) = tra(:,:,jk,jpfer) + zirondep(:,:,jk) 
-         ENDDO
-         ! 
-         IF( lk_iomput ) THEN
-            IF( knt == nrdttrc ) THEN
-                IF( iom_use( "Irondep" ) )   &
-                &  CALL iom_put( "Irondep", zirondep(:,:,1) * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1) ) ! surface downward dust depo of iron
-                IF( iom_use( "pdust" ) )   &
-                &  CALL iom_put( "pdust"  , dust(:,:) / ( wdust * rday )  * tmask(:,:,1) ) ! dust concentration at surface
-            ENDIF
-         ENDIF
-         DEALLOCATE( zsidep, zpdep, zirondep )
-         !                                              
-      ENDIF
-     
-      ! Add the external input of nutrients from river
-      ! ----------------------------------------------------------
-      IF( ln_river ) THEN
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               DO jk = 1, nk_rnf(ji,jj)
-                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) +  rivdip(ji,jj) * rfact2
-                  tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) +  rivdin(ji,jj) * rfact2
-                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) +  rivdic(ji,jj) * 5.e-5 * rfact2
-                  tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) +  rivdsi(ji,jj) * rfact2
-                  tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +  rivdic(ji,jj) * rfact2
-                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) +  ( rivalk(ji,jj) - rno3 * rivdin(ji,jj) ) * rfact2
-                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) +  rivdoc(ji,jj) * rfact2
-               ENDDO
-            ENDDO
-         ENDDO
-         IF (ln_ligand) THEN
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  DO jk = 1, nk_rnf(ji,jj)
-                     tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) +  rivdic(ji,jj) * 5.e-5 * rfact2
-                  ENDDO
-               ENDDO
-            ENDDO
-         ENDIF
-         IF( ln_p5z ) THEN
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  DO jk = 1, nk_rnf(ji,jj)
-                     tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + rivdop(ji,jj) * rfact2
-                     tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + rivdon(ji,jj) * rfact2
-                  ENDDO
-               ENDDO
-            ENDDO
-         ENDIF
-      ENDIF
-      
-      ! Add the external input of nutrients from nitrogen deposition
-      ! ----------------------------------------------------------
-      IF( ln_ndepo ) THEN
-         tra(:,:,1,jpno3) = tra(:,:,1,jpno3) + nitdep(:,:) * rfact2
-         tra(:,:,1,jptal) = tra(:,:,1,jptal) - rno3 * nitdep(:,:) * rfact2
-      ENDIF
-
-      ! Add the external input of iron from hydrothermal vents
-      ! ------------------------------------------------------
-      IF( ln_hydrofe ) THEN
-            tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2
-         IF( ln_ligand ) THEN
-            tra(:,:,:,jplgw) = tra(:,:,:,jplgw) + ( hydrofe(:,:,:) * lgw_rath ) * rfact2
-         ENDIF
-         !
-         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "HYDR" ) )   &
-            &   CALL iom_put( "HYDR", hydrofe(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! hydrothermal iron input
-      ENDIF
-
-      ! OA: Warning, the following part is necessary to avoid CFL problems above the sediments
-      ! --------------------------------------------------------------------
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ikt  = mbkt(ji,jj)
-            zdep = e3t_n(ji,jj,ikt) / xstep
-            zwsbio4(ji,jj) = MIN( 0.99 * zdep, wsbio4(ji,jj,ikt) )
-            zwsbio3(ji,jj) = MIN( 0.99 * zdep, wsbio3(ji,jj,ikt) )
-         END DO
-      END DO
-      !
-      IF( .NOT.lk_sed ) THEN
-!
-         ! Add the external input of iron from sediment mobilization
-         ! ------------------------------------------------------
-         IF( ln_ironsed ) THEN
-                            tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + ironsed(:,:,:) * rfact2
-            !
-            IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironsed" ) )   &
-               &   CALL iom_put( "Ironsed", ironsed(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! iron inputs from sediments
-         ENDIF
+               ikt  = mbkt(ji,jj)
+               zdep = e3t_n(ji,jj,ikt) / xstep
+               zwsbio4(ji,jj) = MIN( 0.99 * zdep, wsbio4(ji,jj,ikt) )
+               zwsbio3(ji,jj) = MIN( 0.99 * zdep, wsbio3(ji,jj,ikt) )
+            END DO
+         END DO
 
          ! Computation of the sediment denitrification proportion: The metamodel from midlleburg (2006) is being used
@@ -494,4 +360,48 @@
    END SUBROUTINE p4z_sed
 
+   SUBROUTINE p4z_sed_init
+      !!----------------------------------------------------------------------
+      !!                  ***  routine p4z_sed_init  ***
+      !!
+      !! ** purpose :   initialization of some parameters
+      !!
+      !!----------------------------------------------------------------------
+      !!----------------------------------------------------------------------
+      INTEGER  :: ji, jj, jk, jm
+      INTEGER  :: ios                 ! Local integer output status for namelist read
+      !
+      !!
+      NAMELIST/nampissed/ nitrfix, diazolight, concfediaz
+      !!----------------------------------------------------------------------
+      !
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'p4z_sed_init : initialization of sediment mobilisation '
+         WRITE(numout,*) '~~~~~~~~~~~~ '
+      ENDIF
+      !                            !* set file information
+      REWIND( numnatp_ref )              ! Namelist nampissed in reference namelist : PISCES sediment
+      READ  ( numnatp_ref, nampissed, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampissed in reference namelist', lwp )
+      REWIND( numnatp_cfg )              ! Namelist nampissbc in configuration namelist : PISCES sediment
+      READ  ( numnatp_cfg, nampissed, IOSTAT = ios, ERR = 902 )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampissed in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, nampissed )
+
+      IF(lwp) THEN
+         WRITE(numout,*) '   Namelist : nampissed '
+         WRITE(numout,*) '      nitrogen fixation rate                       nitrfix = ', nitrfix
+         WRITE(numout,*) '      nitrogen fixation sensitivty to light    diazolight  = ', diazolight
+         WRITE(numout,*) '      Fe half-saturation cste for diazotrophs  concfediaz  = ', concfediaz
+      ENDIF
+      !
+      r1_rday  = 1. / rday
+      !
+      sedsilfrac = 0.03     ! percentage of silica loss in the sediments
+      sedcalfrac = 0.6      ! percentage of calcite loss in the sediments
+      !
+      lk_sed = ln_sediment .AND. ln_sed_2way 
+      !
+   END SUBROUTINE p4z_sed_init
 
    INTEGER FUNCTION p4z_sed_alloc()
