Index: branches/2014/dev_4707_CNRS04_bgc_ice/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- branches/2014/dev_4707_CNRS04_bgc_ice/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 4710)
+++ branches/2014/dev_4707_CNRS04_bgc_ice/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 4720)
@@ -21,4 +21,8 @@
    USE trdmod_oce
    USE trdtra
+   ! MV 2013
+   USE sbc_oce         ! Required to get access to fmmflx 
+   USE dom_oce         ! Required to get access to r2dtra
+   ! END MV 2013
 
    IMPLICIT NONE
@@ -65,4 +69,14 @@
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zsfx
       REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd
+
+      ! MV 2013
+      REAL(wp) ::   zswitch    ,               &  ! virtual salt flux or vvl
+                    zftra      ,               &
+                    zcd        ,               &
+                    zdtra      ,               &
+                    ztfx       ,               &
+                    ztra       ,               &
+                    zeuler                        ! euler or leapfrog
+      ! END MV 2013
       !!---------------------------------------------------------------------
       !
@@ -72,4 +86,12 @@
                       CALL wrk_alloc( jpi, jpj,      zsfx   )
       IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
+
+      ! MV 2013
+      SELECT CASE( nn_ice_embd )         ! levitating or embedded sea-ice option
+         CASE( 0    )   ;   zswitch = 1  ! (0) standard levitating sea-ice : salt exchange only
+         CASE( 1, 2 )   ;   zswitch = 0  ! (1) levitating sea-ice: salt and volume exchange but no pressure effect                                
+                                         ! (2) embedded sea-ice : salt and volume fluxes and pressure
+      END SELECT
+      ! END MV 2013
 
       IF( kt == nittrc000 ) THEN
@@ -91,8 +113,20 @@
       ! 0. initialization
       zsrau = 1. / rau0
+      IF ( neuler .EQ. 0 ) THEN 
+          zeuler = 0.0
+      ELSE
+          zeuler = 1.0
+      ENDIF
+
+      i_code = 1
+
       DO jn = 1, jptra
          !
          IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
          !                                             ! add the trend to the general tracer trend
+!        MV 2013 sea ice tracers
+!        OLD LOOP
+         IF ( i_code == 0 ) THEN
+
          DO jj = 2, jpj
             DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -101,4 +135,51 @@
             END DO
          END DO
+!        NEW LOOP
+          
+         ELSE ! i_code
+
+         DO jj = 2, jpj
+            DO ji = fs_2, fs_jpim1   ! vector opt.
+
+               zse3t = 1. / fse3t(ji,jj,1)
+               
+               ! tracer flux at the ice/ocean interface (tracer/m2/s)
+               zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice
+               zcd   =   trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting,
+                                                            ! only used in the levitating sea ice case
+               ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux
+               ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux
+               ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange)
+
+               ! tracer change (left member: euler; right member:leapfrog)
+               ztra = ( 1. - zeuler ) * trn(ji,jj,1,jn) + zeuler * trb(ji,jj,1,jn)
+               
+               ! MAX is there to avoid integral ocean uptake in the case of freezing (for iron)
+               zdtra = MAX ( - ztra / r2dtra(1) , zsrau * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) * zse3t ) ! tracer tendency
+               ! r2dtra is time step
+               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zdtra ! new line
+
+!              IF ( ztfx .NE. 0.0 ) THEN
+!                  WRITE(numout,*) ji, jj, jn
+!                  WRITE(numout,*) ' trc_o  : ', trc_o(ji,jj,jn)
+!                  WRITE(numout,*) ' trc_i  : ', trc_i(ji,jj,jn)
+!                  WRITE(numout,*) ' fmmflx : ', fmmflx(ji,jj)
+!                  WRITE(numout,*) ' zswitch: ', zswitch
+!                  WRITE(numout,*) ' zcd   : ', zcd
+!                  WRITE(numout,*) ' zftra : ', zftra
+!                  WRITE(numout,*) ' ztfx  : ', ztfx
+!                  WRITE(numout,*) ' zsrau : ', zsrau
+!                  WRITE(numout,*) ' zsfx  : ', zsfx(ji,jj)
+!                  WRITE(numout,*) ' zse3t : ', zse3t
+!                  WRITE(numout,*) ' ztra  : ', ztra
+!                  WRITE(numout,*) ' zdtra : ', zdtra
+!                  WRITE(numout,*) ' Old tendency : ', zsfx(ji,jj) * zsrau * trn(ji,jj,1,jn) * zse3t
+!              ENDIF
+
+            END DO
+         END DO
+
+         ENDIF ! i_code
+!        END MV 2013 
          
          IF( l_trdtrc ) THEN
