Index: /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/PISCES/trcice_pisces.F90
===================================================================
--- /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/PISCES/trcice_pisces.F90	(revision 5324)
+++ /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/PISCES/trcice_pisces.F90	(revision 5325)
@@ -20,5 +20,4 @@
    USE phycst          ! Ocean physics parameters
    USE sms_pisces      ! PISCES Source Minus Sink variables
-   USE p4zsbc
    USE in_out_manager
 
@@ -58,17 +57,4 @@
       !!----------------------------------------------------------------------
 
-      ! --- Variable declarations --- !
-      TYPE TRC_I_NML                    !--- Ice tracer namelist structure
-         REAL(wp)         :: trc_ratio  ! ice-ocean trc ratio 
-         REAL(wp)         :: trc_prescr ! prescribed ice trc cc
-         CHARACTER(len=2) :: ctrc_o     ! choice of ocean trc cc
-      END TYPE
-
-                                        !--- Variables extracted from the
-                                        !    namelist
-      REAL(wp), DIMENSION(24)         :: trc_ice_ratio, & ! ice-ocean tracer ratio
-                                         trc_ice_prescr   ! prescribed ice trc cc
-      CHARACTER(len=2), DIMENSION(24) :: cn_trc_o ! choice of ocean tracer cc
-
                                         !--- Dummy variables
       REAL(wp), DIMENSION(jptra,2) &
@@ -83,144 +69,7 @@
       !!----------------------------------------------------------------------
 
-      ! --- Namelist declarations --- !
-
-      ! Tracer structures for individual tracers
-      TYPE(TRC_I_NML) :: sn_tri_dic, sn_tri_doc, sn_tri_tal, sn_tri_oxy, &
-                     sn_tri_cal, sn_tri_po4, sn_tri_poc, sn_tri_goc, &
-                     sn_tri_bfe, &
-                     sn_tri_num, &
-                                 sn_tri_sil, sn_tri_dsi, sn_tri_gsi, &
-                     sn_tri_phy, sn_tri_dia, sn_tri_zoo, sn_tri_mes, &
-                     sn_tri_fer, sn_tri_sfe, sn_tri_dfe, sn_tri_nfe, &
-                     sn_tri_nch, sn_tri_dch, sn_tri_no3, sn_tri_nh4
-
-     
-      NAMELIST/nampisice/ sn_tri_dic, sn_tri_doc, sn_tri_tal, sn_tri_oxy, &
-                          sn_tri_cal, sn_tri_po4, sn_tri_poc, sn_tri_goc, &
-                          sn_tri_bfe, &
-                          sn_tri_num, &
-                                      sn_tri_sil, sn_tri_dsi, sn_tri_gsi, &
-                          sn_tri_phy, sn_tri_dia, sn_tri_zoo, sn_tri_mes, &
-                          sn_tri_fer, sn_tri_sfe, sn_tri_dfe, sn_tri_nfe, &
-                          sn_tri_nch, sn_tri_dch, sn_tri_no3, sn_tri_nh4
-
-      !!----------------------------------------------------------------------
-
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' trc_ice_ini_pisces: Prescribed sea ice biogeochemistry '
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~'
-
-      !--------------------------------------------
-      ! Read namelist
-      !--------------------------------------------
-
-      REWIND( numnatp_ref )
-      READ( numnatp_ref, nampisice )
-
-      REWIND( numnatp_cfg )
-      READ( numnatp_cfg, nampisice )
-
-      ! Assign namelist stuff
-      trc_ice_ratio(jpdic)  = sn_tri_dic%trc_ratio 
-      trc_ice_prescr(jpdic) = sn_tri_dic%trc_prescr
-      cn_trc_o      (jpdic) = sn_tri_dic%ctrc_o
-
-      trc_ice_ratio(jpdoc)  = sn_tri_doc%trc_ratio 
-      trc_ice_prescr(jpdoc) = sn_tri_doc%trc_prescr
-      cn_trc_o      (jpdoc) = sn_tri_doc%ctrc_o
-
-      trc_ice_ratio(jptal)  = sn_tri_tal%trc_ratio 
-      trc_ice_prescr(jptal) = sn_tri_tal%trc_prescr
-      cn_trc_o      (jptal) = sn_tri_tal%ctrc_o
-
-      trc_ice_ratio(jpoxy)  = sn_tri_oxy%trc_ratio 
-      trc_ice_prescr(jpoxy) = sn_tri_oxy%trc_prescr
-      cn_trc_o      (jpoxy) = sn_tri_oxy%ctrc_o
-
-      trc_ice_ratio(jpcal)  = sn_tri_cal%trc_ratio 
-      trc_ice_prescr(jpcal) = sn_tri_cal%trc_prescr
-      cn_trc_o      (jpcal) = sn_tri_cal%ctrc_o
-
-      trc_ice_ratio(jppo4)  = sn_tri_po4%trc_ratio 
-      trc_ice_prescr(jppo4) = sn_tri_po4%trc_prescr
-      cn_trc_o      (jppo4) = sn_tri_po4%ctrc_o
-
-      trc_ice_ratio(jppoc)  = sn_tri_poc%trc_ratio 
-      trc_ice_prescr(jppoc) = sn_tri_poc%trc_prescr
-      cn_trc_o      (jppoc) = sn_tri_poc%ctrc_o
-
-#if ! defined key_kriest
-      trc_ice_ratio(jpgoc)  = sn_tri_goc%trc_ratio 
-      trc_ice_prescr(jpgoc) = sn_tri_goc%trc_prescr
-      cn_trc_o      (jpgoc) = sn_tri_goc%ctrc_o
-
-      trc_ice_ratio(jpbfe)  = sn_tri_bfe%trc_ratio 
-      trc_ice_prescr(jpbfe) = sn_tri_bfe%trc_prescr
-      cn_trc_o      (jpbfe) = sn_tri_bfe%ctrc_o
-#else
-      trc_ice_ratio(jpnum)  = sn_tri_num%trc_ratio 
-      trc_ice_prescr(jpnum) = sn_tri_num%trc_prescr
-      cn_trc_o      (jpnum) = sn_tri_num%ctrc_o
-#endif
-
-      trc_ice_ratio(jpsil)  = sn_tri_sil%trc_ratio 
-      trc_ice_prescr(jpsil) = sn_tri_sil%trc_prescr
-      cn_trc_o      (jpsil) = sn_tri_sil%ctrc_o
-
-      trc_ice_ratio(jpdsi)  = sn_tri_dsi%trc_ratio 
-      trc_ice_prescr(jpdsi) = sn_tri_dsi%trc_prescr
-      cn_trc_o      (jpdsi) = sn_tri_dsi%ctrc_o
-
-      trc_ice_ratio(jpgsi)  = sn_tri_gsi%trc_ratio 
-      trc_ice_prescr(jpgsi) = sn_tri_gsi%trc_prescr
-      cn_trc_o      (jpgsi) = sn_tri_gsi%ctrc_o
-
-      trc_ice_ratio(jpphy)  = sn_tri_phy%trc_ratio 
-      trc_ice_prescr(jpphy) = sn_tri_phy%trc_prescr
-      cn_trc_o      (jpphy) = sn_tri_phy%ctrc_o
-
-      trc_ice_ratio(jpdia)  = sn_tri_dia%trc_ratio 
-      trc_ice_prescr(jpdia) = sn_tri_dia%trc_prescr
-      cn_trc_o      (jpdia) = sn_tri_dia%ctrc_o
-
-      trc_ice_ratio(jpzoo)  = sn_tri_zoo%trc_ratio 
-      trc_ice_prescr(jpzoo) = sn_tri_zoo%trc_prescr
-      cn_trc_o      (jpzoo) = sn_tri_zoo%ctrc_o
-
-      trc_ice_ratio(jpmes)  = sn_tri_mes%trc_ratio 
-      trc_ice_prescr(jpmes) = sn_tri_mes%trc_prescr
-      cn_trc_o      (jpmes) = sn_tri_mes%ctrc_o
-
-      trc_ice_ratio(jpfer)  = sn_tri_fer%trc_ratio 
-      trc_ice_prescr(jpfer) = sn_tri_fer%trc_prescr
-      cn_trc_o      (jpfer) = sn_tri_fer%ctrc_o
-
-      trc_ice_ratio(jpsfe)  = sn_tri_sfe%trc_ratio 
-      trc_ice_prescr(jpsfe) = sn_tri_sfe%trc_prescr
-      cn_trc_o      (jpsfe) = sn_tri_sfe%ctrc_o
-
-      trc_ice_ratio(jpdfe)  = sn_tri_dfe%trc_ratio 
-      trc_ice_prescr(jpdfe) = sn_tri_dfe%trc_prescr
-      cn_trc_o      (jpdfe) = sn_tri_dfe%ctrc_o
-
-      trc_ice_ratio(jpnfe)  = sn_tri_nfe%trc_ratio 
-      trc_ice_prescr(jpnfe) = sn_tri_nfe%trc_prescr
-      cn_trc_o      (jpnfe) = sn_tri_nfe%ctrc_o
-
-      trc_ice_ratio(jpnch)  = sn_tri_nch%trc_ratio 
-      trc_ice_prescr(jpnch) = sn_tri_nch%trc_prescr
-      cn_trc_o      (jpnch) = sn_tri_nch%ctrc_o
-
-      trc_ice_ratio(jpdch)  = sn_tri_dch%trc_ratio 
-      trc_ice_prescr(jpdch) = sn_tri_dch%trc_prescr
-      cn_trc_o      (jpdch) = sn_tri_dch%ctrc_o
-
-      trc_ice_ratio(jpno3)  = sn_tri_no3%trc_ratio 
-      trc_ice_prescr(jpno3) = sn_tri_no3%trc_prescr
-      cn_trc_o      (jpno3) = sn_tri_no3%ctrc_o
-
-      trc_ice_ratio(jpnh4)  = sn_tri_nh4%trc_ratio 
-      trc_ice_prescr(jpnh4) = sn_tri_nh4%trc_prescr
-      cn_trc_o      (jpnh4) = sn_tri_nh4%ctrc_o
 
       !--------------------------------------------
@@ -367,5 +216,5 @@
       zrs(2) = zsice_bal / zsoce_bal      !! ice-ocean salinity ratio, Baltic case
 
-      DO jn = 1, jptra
+      DO jn = jp_pcs0, jp_pcs1
          IF ( trc_ice_ratio(jn) >= 0._wp )  zratio(jn,:) = trc_ice_ratio(jn)
          IF ( trc_ice_ratio(jn) == -1._wp ) zratio(jn,:) = zrs(:)
@@ -376,5 +225,5 @@
       ! Sea ice tracer concentrations
       !-------------------------------
-      DO jn = 1, jptra
+      DO jn = jp_pcs0, jp_pcs1
          !-- Everywhere but in the Baltic
          IF ( trc_ice_ratio(jn) >= -1._wp ) THEN !! no prescribed concentration
@@ -391,10 +240,10 @@
                WHERE( 14._wp <= glamt(:,:) .AND. glamt(:,:) <= 32._wp .AND.    &
                       54._wp <= gphit(:,:) .AND. gphit(:,:) <= 66._wp )
-                  trc_i(:,:,jn) = zratio(jn,2) * trc_o(:,:,jn) 
+                     trc_i(:,:,jn) = zratio(jn,2) * trc_o(:,:,jn) 
                END WHERE
             ELSE                                 !! prescribed tracer concentration in ice
                WHERE( 14._wp <= glamt(:,:) .AND. glamt(:,:) <= 32._wp .AND.    &
                    54._wp <= gphit(:,:) .AND. gphit(:,:) <= 66._wp )
-                  trc_i(:,:,jn) = trc_ice_prescr(jn)
+                     trc_i(:,:,jn) = trc_ice_prescr(jn)
                END WHERE
             ENDIF ! trc_ice_ratio
Index: /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 5324)
+++ /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 5325)
@@ -28,4 +28,6 @@
 
    PUBLIC   trc_sbc   ! routine called by step.F90
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra
 
    !! * Substitutions
@@ -63,5 +65,5 @@
       !
       INTEGER  ::   ji, jj, jn                                     ! dummy loop indices
-      REAL(wp) ::   zse3t                                          ! temporary scalars
+      REAL(wp) ::   zse3t, zrtrn, zratio                           ! temporary scalars
       REAL(wp) ::   zswitch, zftra, zcd, zdtra, ztfx, ztra         ! temporary scalars
       CHARACTER (len=22) :: charout
@@ -76,4 +78,6 @@
                       CALL wrk_alloc( jpi, jpj,      zsfx   )
       IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
+      !
+      zrtrn = 1.e-15_wp
 
       SELECT CASE( nn_ice_embd )         ! levitating or embedded sea-ice option
@@ -82,4 +86,15 @@
                                          ! (2) embedded sea-ice : salt and volume fluxes and pressure
       END SELECT
+
+      IF( ln_top_euler) THEN
+         r2dt(:) =  rdttrc(:)              ! = rdttrc (use Euler time stepping)
+      ELSE
+         IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
+            r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
+         ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1
+            r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
+         ENDIF
+      ENDIF
+
 
       IF( kt == nittrc000 ) THEN
@@ -99,6 +114,4 @@
       ENDIF
 
-      WRITE(numout,*) ' trc_sbc initial values', trn(3,2,1,2), trb(3,2,1,2), tra(3,2,1,2)
-
       ! 0. initialization
       DO jn = 1, jptra
@@ -107,10 +120,10 @@
          !                                             ! add the trend to the general tracer trend
 
-         IF ( nn_ice_tr == -1 ) THEN  ! identical concentrations in ice and ocean (old code)
+         IF ( nn_ice_tr == -1 ) THEN  ! No tracers in sea ice (null concentration in sea ice)
 
             DO jj = 2, jpj
                DO ji = fs_2, fs_jpim1   ! vector opt.
                   zse3t = 1. / fse3t(ji,jj,1)
-                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) * zse3t
+                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) * r1_rau0 * trb(ji,jj,1,jn) * zse3t
                END DO
             END DO
@@ -131,6 +144,11 @@
                   ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange)
    
-                  zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) * zse3t
-                  tra(ji,jj,1,jn) = MAX( tra(ji,jj,1,jn) + zdtra, 0.) ! avoid integral ocean uptake if freezing (for iron)
+                  zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trb(ji,jj,1,jn) ) * zse3t
+                  IF ( zdtra < 0. ) THEN
+                     zratio = -zdtra * r2dt(1) / ( trb(ji,jj,1,jn) + zrtrn )
+                     zdtra = MIN(1.0, zratio) * zdtra ! avoid negative concentrations to arise
+                  ENDIF
+                      
+                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zdtra 
    
                END DO
Index: /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 5324)
+++ /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 5325)
@@ -65,4 +65,16 @@
    INTEGER             , PUBLIC                                    ::  nittrc000       !: first time step of passive tracers model
 
+   !! Information for the ice module for tracers
+   !! ------------------------------------------
+   TYPE TRC_I_NML                    !--- Ice tracer namelist structure
+         REAL(wp)         :: trc_ratio  ! ice-ocean trc ratio
+         REAL(wp)         :: trc_prescr ! prescribed ice trc cc
+         CHARACTER(len=2) :: ctrc_o     ! choice of ocean trc cc
+   END TYPE
+
+   REAL(wp), DIMENSION(jptra), PUBLIC         :: trc_ice_ratio, & ! ice-ocean tracer ratio
+                                                 trc_ice_prescr   ! prescribed ice trc cc
+   CHARACTER(len=2), DIMENSION(jptra), PUBLIC :: cn_trc_o ! choice of ocean tracer cc
+
    !! information for outputs
    !! --------------------------------------------------
Index: /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trcice.F90
===================================================================
--- /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trcice.F90	(revision 5324)
+++ /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trcice.F90	(revision 5325)
@@ -16,5 +16,4 @@
    USE trc             ! passive tracers common variables
 !  USE trcrst          ! passive tracers restart
-   USE trcnam          ! Namelist read
 !  USE trcice_cfc      ! CFC      initialisation
    USE trcice_pisces   ! PISCES   initialisation
@@ -31,5 +30,5 @@
    PRIVATE
    
-   PUBLIC   trc_ice_ini ! called by trc_init
+   PUBLIC   trc_ice_ini ! called by trc_nam
 
 CONTAINS
@@ -39,14 +38,11 @@
       !!                     ***  ROUTINE trc_ice_ini ***
       !!
-      !! ** Purpose :   Communication between TOP and sea ice
+      !! ** Purpose :   Initialization of the ice module for tracers
       !!
       !! ** Method  : - 
       !!            
       !!---------------------------------------------------------------------
-      INTEGER ::   jk, jn, jl    ! dummy loop indices
-      INTEGER :: ios                              ! Local integer output status for namelist read
+      ! --- Variable declarations --- !
 
-      NAMELIST/namtrc_ice/ nn_ice_tr
-      !
       IF(lwp) THEN
          WRITE(numout,*)
@@ -58,16 +54,4 @@
 
       !
-      REWIND( numnat_ref )              ! Namelist namtrc_dta in reference namelist : Passive tracer input data
-      READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
- 901  IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp )
-
-      REWIND( numnat_cfg )              ! Namelist nampissbc in configuration namelist : Pisces external sources of nutrients
-      READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
- 902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp )
-
-      WRITE(numout,*) ' '
-      WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr
-      WRITE(numout,*) ' '
-
       trc_i(:,:,:) = 0.0d0 ! by default
       trc_o(:,:,:) = 0.0d0 ! by default
Index: /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 5324)
+++ /branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 5325)
@@ -27,4 +27,5 @@
    USE trd_oce       
    USE trdtrc_oce
+   USE trcnam_ice            ! Ice module for tracers
    USE iom               ! I/O manager
 
@@ -147,4 +148,8 @@
 
 
+      ! Call the ice module for tracers
+      ! -------------------------------
+      CALL trc_nam_ice
+
       ! namelist of SMS
       ! ---------------      
