Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crs.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crs.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crs.F90	(revision 7210)
@@ -8,4 +8,5 @@
    !!----------------------------------------------------------------------
    USE par_oce  
+   USE par_trc
    USE dom_oce
    USE in_out_manager
@@ -173,14 +174,15 @@
       ! 
       ! Surface fluxes to pass to TOP
-      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: qsr_crs, fr_i_crs, wndm_crs
+      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: qsr_crs, fr_i_crs, wndm_crs,qsr_mean_crs
       REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: emp_crs, emp_b_crs, sfx_crs
       REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: fmmflx_crs
       REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: utau_crs, vtau_crs, taum_crs
-      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: rnf_crs,rnf_b_crs
+      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: rnf_crs,rnf_b_crs,h_rnf_crs
+      INTEGER , PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: nk_rnf_crs
       REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE :: trc_i_crs,trc_o_crs
-      REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE :: sbc_trc_crs, sbc_trc_b_crs
-
-      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::   uslp_crs, wslpi_crs          !: i_slope at U- and W-points
-      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::   vslp_crs, wslpj_crs          !: j-slope at V- and W-points
+
+      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::  etot3_crs
+      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::  uslp_crs, wslpi_crs          !: i_slope at U- and W-points
+      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::  vslp_crs, wslpj_crs          !: j-slope at V- and W-points
 
       ! Horizontal diffusion
@@ -315,9 +317,11 @@
      ALLOCATE( sshb_crs(jpi_crs,jpj_crs), sshn_crs(jpi_crs,jpj_crs),  ssha_crs(jpi_crs,jpj_crs), &
          &     qsr_crs(jpi_crs ,jpj_crs), wndm_crs(jpi_crs,jpj_crs), utau_crs(jpi_crs,jpj_crs) , &
+         &     qsr_mean_crs(jpi_crs ,jpj_crs) , &
          &     vtau_crs(jpi_crs,jpj_crs), taum_crs(jpi_crs,jpj_crs),  &
          &     rnf_crs (jpi_crs,jpj_crs), rnf_b_crs(jpi_crs ,jpj_crs), &
+         &     h_rnf_crs(jpi_crs,jpj_crs), nk_rnf_crs(jpi_crs ,jpj_crs), &
          &     emp_crs (jpi_crs,jpj_crs), emp_b_crs(jpi_crs,jpj_crs), &
-         &     sbc_trc_crs (jpi_crs,jpj_crs,jpts), sbc_trc_b_crs(jpi_crs,jpj_crs,jpts), &
-         &     trc_i_crs (jpi_crs,jpj_crs,jpts), trc_o_crs(jpi_crs,jpj_crs,jpts), &
+         &     etot3_crs(jpi_crs,jpj_crs,jpk) , &
+         &     trc_i_crs (jpi_crs,jpj_crs,jptra), trc_o_crs(jpi_crs,jpj_crs,jptra), &
          &     fr_i_crs(jpi_crs,jpj_crs), sfx_crs(jpi_crs ,jpj_crs), fmmflx_crs(jpi_crs ,jpj_crs),  STAT=ierr(12)  )
 
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsdom.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsdom.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsdom.F90	(revision 7210)
@@ -101,4 +101,5 @@
 
             fmask_crs(ji,jj,jk) = fmask(ijie,ijje,jk)
+
 
          ENDDO
@@ -1198,21 +1199,22 @@
         ENDDO
 
-        !WRITE(narea+8000-1,*)"nfipproc(ji,jj),narea :",nfipproc(iproci,iprocj),narea
-        !WRITE(narea+8000-1,*)"proc i,j ",iproci,iprocj
-        !WRITE(narea+8000-1,*)"nowe noea",nowe,noea
-        !WRITE(narea+8000-1,*)"noso nono",noso,nono
-        !WRITE(narea+8000-1,*)"nbondi nbondj ",nbondi,nbondj
-        !WRITE(narea+8000-1,*)"jpiglo jpjglo ",jpiglo,jpjglo
-        !WRITE(narea+8000-1,*)"jpi jpj ",jpi,jpj
-        !WRITE(narea+8000-1,*)"nbondi nbondj",nbondi,nbondj
-        !WRITE(narea+8000-1,*)"nimpp njmpp ",nimpp,njmpp
-        !WRITE(narea+8000-1,*)"loc jpi nldi,nlei,nlci ",jpi, nldi        ,nlei         ,nlci
-        !WRITE(narea+8000-1,*)"glo jpi nldi,nlei      ",jpi, nldi+nimpp-1,nlei+nimpp-1
-        !WRITE(narea+8000-1,*)"loc jpj nldj,nlej,nlcj ",jpj, nldj        ,nlej         ,nlcj
-        !WRITE(narea+8000-1,*)"glo jpj nldj,nlej      ",jpj, nldj+njmpp-1,nlej+njmpp-1
-        !WRITE(narea+8000-1,*)"jpiglo_crs jpjglo_crs ",jpiglo_crs,jpjglo_crs
-        !WRITE(narea+8000-1,*)"jpi_crs jpj_crs ",jpi_crs,jpj_crs
-        !WRITE(narea+8000-1,*)"jpni  jpnj jpnij ",jpni,jpnj,jpnij
-        !WRITE(narea+8000-1,*)"glamt gphit ",glamt(1,1),gphit(jpi,jpj),glamt(jpi,jpj),gphit(jpi,jpj)
+        WRITE(narea+8000-1,*)"nfipproc(ji,jj),narea :",nfipproc(iproci,iprocj),narea
+        WRITE(narea+8000-1,*)"proc i,j ",iproci,iprocj
+        WRITE(narea+8000-1,*)"jpni jpnj ",jpni,jpnj
+        WRITE(narea+8000-1,*)"nowe noea",nowe,noea
+        WRITE(narea+8000-1,*)"noso nono",noso,nono
+        WRITE(narea+8000-1,*)"nbondi nbondj ",nbondi,nbondj
+        WRITE(narea+8000-1,*)"jpiglo jpjglo ",jpiglo,jpjglo
+        WRITE(narea+8000-1,*)"jpi jpj ",jpi,jpj
+        WRITE(narea+8000-1,*)"nbondi nbondj",nbondi,nbondj
+        WRITE(narea+8000-1,*)"nimpp njmpp ",nimpp,njmpp
+        WRITE(narea+8000-1,*)"loc jpi nldi,nlei,nlci ",jpi, nldi        ,nlei         ,nlci
+        WRITE(narea+8000-1,*)"glo jpi nldi,nlei      ",jpi, nldi+nimpp-1,nlei+nimpp-1
+        WRITE(narea+8000-1,*)"loc jpj nldj,nlej,nlcj ",jpj, nldj        ,nlej         ,nlcj
+        WRITE(narea+8000-1,*)"glo jpj nldj,nlej      ",jpj, nldj+njmpp-1,nlej+njmpp-1
+        WRITE(narea+8000-1,*)"jpiglo_crs jpjglo_crs ",jpiglo_crs,jpjglo_crs
+        WRITE(narea+8000-1,*)"jpi_crs jpj_crs ",jpi_crs,jpj_crs
+        WRITE(narea+8000-1,*)"jpni  jpnj jpnij ",jpni,jpnj,jpnij
+        WRITE(narea+8000-1,*)"glamt gphit ",glamt(1,1),gphit(jpi,jpj),glamt(jpi,jpj),gphit(jpi,jpj)
         !==========================================================================
         ! dim along I
@@ -1226,4 +1228,5 @@
               mis2_crs(ji)=ijis
               mie2_crs(ji)=ijie
+              WRITE(narea+8000-1,*)"ji",ji,mis2_crs(ji),mie2_crs(ji),mis2_crs(ji)-nimpp+1,mie2_crs(ji)-nimpp+1
            ENDDO
 
@@ -1240,4 +1243,5 @@
            ii_start = mis2_crs(ijis)-nimpp+1
            nimpp_crs = ijis-1
+           WRITE(narea+8000-1,*)"ii_start = ",ii_start , mis2_crs(ijis), nimpp
 
            nldi_crs = 2
@@ -1267,10 +1271,16 @@
            IF( nimpp==1 )nimpp_crs=1
 
+           IF( iproci == 1 )THEN
+              nldi_crs=1
+              nimpp_crs=1
+           ENDIF
+
            !----------------------------------------
            ji=jpiglo_crs
-           DO WHILE( mie2_crs(ji) - nimpp + 1 .GT. jpi )
+           DO WHILE( mie2_crs(ji) - nimpp + 1 .GT. nlci )
               ji=ji-1
               IF( ji==1 )EXIT
            END DO
+           WRITE(narea+8000-1,*)"=> mie2_crs ",ji,mie2_crs(ji), mie2_crs(ji) - nimpp + 1
            ijie=ji
            nlei_crs=ijie-nimpp_crs+1
@@ -1290,12 +1300,19 @@
               mis_crs(ji) = mis2_crs(mig_crs(ji)) - nimpp + 1
               mie_crs(ji) = mie2_crs(mig_crs(ji)) - nimpp + 1
-              nfactx(ji)  = mie_crs(ji)-mie_crs(ji)+1
+              nfactx(ji)  = mie_crs(ji)-mis_crs(ji)+1
            ENDDO
 
            IF( iproci == jpni )THEN
               nlei_crs=nlci_crs
-              mis_crs(nlei_crs)=mis_crs(nlei_crs-1)
-              mie_crs(nlei_crs)=mie_crs(nlei_crs-1)
+              ji=nlei_crs
+              mis_crs(ji) = mis2_crs(mig_crs(ji)) - nimpp + 1
+              mie_crs(ji) = nlei
+              mie2_crs(mig_crs(ji)) = nlei + nimpp -1
+              nfactx(ji)  = mie_crs(ji)-mis_crs(ji)+1
            ENDIF
+
+           DO ji = 1, nlei_crs
+              WRITE(narea+8000-1,'(A4,7(1X,I4))')"loc ",ji,mig_crs(ji),mis2_crs(mig_crs(ji)),mie2_crs(mig_crs(ji)),mis_crs(ji),mie_crs(ji),nfactx(ji)
+           ENDDO
 
            !----------------------------------------
@@ -1387,12 +1404,22 @@
               mjs_crs(jj) = mjs2_crs(mjg_crs(jj)) - njmpp + 1
               mje_crs(jj) = mje2_crs(mjg_crs(jj)) - njmpp + 1
-              nfacty(jj)   = mje_crs(jj)-mje_crs(jj)+1
+              nfacty(jj)  = mje_crs(jj)-mjs_crs(jj)+1
            ENDDO
+           IF( nono==-1 )THEn
+              nlej_crs = nlcj_crs
+              mjs_crs(nlej_crs) = mjs2_crs(mjg_crs(nlej_crs)) - njmpp + 1
+              mje_crs(nlej_crs) = nlcj
+              nfacty(jj)  = mje_crs(jj)-mjs_crs(jj)+1
+           ENDIF 
 
            IF( iprocj == jpnj )THEN
-              mjs_crs(nlej_crs)=mjs_crs(nlej_crs-1)
-              mje_crs(nlej_crs)=mje_crs(nlej_crs-1)
+              mjs_crs(nlej_crs) = mjs_crs(nlej_crs-1)
+              mje_crs(nlej_crs) = mje_crs(nlej_crs-1)
+              nfacty(nlej_crs)  = mje_crs(nlej_crs)-mjs_crs(nlej_crs)+1
            ENDIF
 
+           DO jj = 1, nlej_crs
+              WRITE(narea+8000-1,'(A4,7(1X,I4))')"loc ",jj,mjg_crs(jj),mjs2_crs(mjg_crs(jj)),mje2_crs(mjg_crs(jj)),mjs_crs(jj),mje_crs(jj),nfacty(jj)
+           ENDDO
            !----------------------------------------
 
@@ -1439,8 +1466,29 @@
         END DO
 
-        !WRITE(narea+8000-1,*)"loc crs jpi nldi,nlei,nlci ",jpi_crs, nldi_crs            ,nlei_crs             ,nlci_crs
-        !WRITE(narea+8000-1,*)"glo crs jpi nldi,nlei      ",jpi_crs, nldi_crs+nimpp_crs-1,nlei_crs+nimpp_crs-1
-        !WRITE(narea+8000-1,*)"loc crs jpj nldj,nlej,nlcj ",jpj_crs, nldj_crs            ,nlej_crs             ,nlcj_crs
-        !WRITE(narea+8000-1,*)"glo crs jpj nldj,nlej      ",jpj_crs, nldj_crs+njmpp_crs-1,nlej_crs+njmpp_crs-1
+        WRITE(narea+8000-1,*)"loc crs jpi nldi,nlei,nlci ",jpi_crs, nldi_crs            ,nlei_crs             ,nlci_crs
+        WRITE(narea+8000-1,*)"glo crs jpi nldi,nlei      ",jpi_crs, nldi_crs+nimpp_crs-1,nlei_crs+nimpp_crs-1
+        WRITE(narea+8000-1,*)"loc crs jpj nldj,nlej,nlcj ",jpj_crs, nldj_crs            ,nlej_crs             ,nlcj_crs
+        WRITE(narea+8000-1,*)"glo crs jpj nldj,nlej      ",jpj_crs, nldj_crs+njmpp_crs-1,nlej_crs+njmpp_crs-1
+        WRITE(narea+8000-1,*)"jpi_crs jpj_crs ",jpi_crs,jpj_crs 
+        WRITE(narea+8000-1,*)"nimpp_crs njmpp_crs ",nimpp_crs,njmpp_crs 
+
+        WRITE(narea+8000-1,*)"min max tmask ",MINVAL(tmask),MAXVAL(tmask)
+
+        IF( jpi_crs .LE. 0 ) WRITE(narea+8000-1,*)"BUG jpi_crs"
+        IF( jpj_crs .LE. 0 ) WRITE(narea+8000-1,*)"BUG jpj_crs"
+        IF( nldi_crs .LE. 0 ) WRITE(narea+8000-1,*)"BUG nldi_crs"
+        IF( nldj_crs .LE. 0 ) WRITE(narea+8000-1,*)"BUG nldj_crs"
+        IF( nlei_crs .GT. jpi_crs ) WRITE(narea+8000-1,*)"BUG nlei_crs"
+        IF( nlej_crs .GT. jpj_crs ) WRITE(narea+8000-1,*)"BUG nlej_crs"
+        IF( nimpp_crs .LE. 0 .OR. nimpp_crs .GT. jpiglo_crs) WRITE(narea+8000-1,*)"BUG nimpp_crs",nimpp_crs
+        IF( njmpp_crs .LE. 0 .OR. njmpp_crs .GT. jpjglo_crs) WRITE(narea+8000-1,*)"BUG njmpp_crs",njmpp_crs
+        CALL FLUSh(narea+8000-1)
+
+        DO ji=1,nlei_crs
+           IF( ji+nimpp_crs-1 .GT. jpiglo_crs )WRITE(narea+8000-1,*)"BUG ji+nimpp_crs-1 .GT. jpiglo_crs ",ji,ji+nimpp_crs-1
+        ENDDO
+        DO jj=1,nlej_crs
+           IF( jj+njmpp_crs-1 .GT. jpjglo_crs )WRITE(narea+8000-1,*)"BUG jj+njmpp_crs-1 .GT. jpjglo_crs ",jj,jj+njmpp_crs-1
+        ENDDO
         !==============================================================================================
          IF( jpizoom /= 1 .OR. jpjzoom /= 1)    STOP 
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsfld.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsfld.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsfld.F90	(revision 7210)
@@ -15,4 +15,5 @@
    USE ldftra_oce      ! ocean active tracers: lateral physics
    USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbcrnf
    USE zdf_oce         ! vertical  physics: ocean fields
    USE zdfddm          ! vertical  physics: double diffusion
@@ -33,5 +34,5 @@
    USE zdftke
    USE zdftke_crs
-
+   USE trc, ONLY: qsr_mean
    USE ieee_arithmetic
 
@@ -226,11 +227,31 @@
       CALL crs_dom_e3( e1v, e2v, zfse3v, p_sfc_2d_crs=e1v_crs  , cd_type='V', p_mask=vmask, p_e3_crs=zs_crs, p_e3_max_crs=e3v_max_n_crs)
 
-     WHERE(e3t_max_n_crs == 0._wp) e3t_max_n_crs=r_inf
-     WHERE(e3u_max_n_crs == 0._wp) e3u_max_n_crs=r_inf
-     WHERE(e3v_max_n_crs == 0._wp) e3v_max_n_crs=r_inf
-     WHERE(e3w_max_n_crs == 0._wp) e3w_max_n_crs=r_inf
+      DO jk = 1, jpk
+         DO ji = 1, jpi_crs
+            DO jj = 1, jpj_crs
+               IF( e3t_n_crs(ji,jj,jk) == 0._wp ) e3t_n_crs(ji,jj,jk) = e3t_1d(jk)
+               IF( e3w_n_crs(ji,jj,jk) == 0._wp ) e3w_n_crs(ji,jj,jk) = e3w_1d(jk)
+               IF( e3u_n_crs(ji,jj,jk) == 0._wp ) e3u_n_crs(ji,jj,jk) = e3t_1d(jk)
+               IF( e3v_n_crs(ji,jj,jk) == 0._wp ) e3v_n_crs(ji,jj,jk) = e3t_1d(jk)
+               IF( e3t_max_n_crs(ji,jj,jk) == 0._wp ) e3t_max_n_crs(ji,jj,jk) = e3t_1d(jk)
+               IF( e3w_max_n_crs(ji,jj,jk) == 0._wp ) e3w_max_n_crs(ji,jj,jk) = e3w_1d(jk)
+               IF( e3u_max_n_crs(ji,jj,jk) == 0._wp ) e3u_max_n_crs(ji,jj,jk) = e3t_1d(jk)
+               IF( e3v_max_n_crs(ji,jj,jk) == 0._wp ) e3v_max_n_crs(ji,jj,jk) = e3t_1d(jk)
+            ENDDO
+         ENDDO
+      ENDDO
 
       CALL crs_dom_ope( gdepw_n, 'MAX', 'T', tmask, gdept_n_crs, p_e3=zfse3t, psgn=1.0 )
       CALL crs_dom_ope( gdepw_n, 'MAX', 'W', tmask, gdepw_n_crs, p_e3=zfse3w, psgn=1.0 )
+      DO jk = 1, jpk
+         DO ji = 1, jpi_crs
+            DO jj = 1, jpj_crs
+               IF( gdept_n_crs(ji,jj,jk) .LE. 0._wp ) gdept_n_crs(ji,jj,jk) = gdept_1d(jk)
+               IF( gdepw_n_crs(ji,jj,jk) .LE. 0._wp ) gdepw_n_crs(ji,jj,jk) = gdepw_1d(jk)
+            ENDDO
+         ENDDO
+      ENDDO
+      zmin=MINVAL(gdept_n_crs);zmax=MAXVAL(gdept_n_crs);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld gdept_n_crs",zmin,zmax
+      zmin=MINVAL(gdepw_n_crs);zmax=MAXVAL(gdepw_n_crs);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld gdepw_n_crs",zmin,zmax
 
       CALL crs_dom_facvol( tmask, 'T', e1t, e2t, zfse3t, ocean_volume_crs_t, facvol_t )
@@ -325,10 +346,15 @@
       CALL crs_dom_ope( wndm , 'SUM', 'T', tmask, wndm_crs , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0 )
       CALL crs_dom_ope( rnf  , 'MAX', 'T', tmask, rnf_crs                                     , psgn=1.0 )
+      CALL crs_dom_ope( h_rnf, 'MAX', 'T', tmask, h_rnf_crs                                   , psgn=1.0 )
+      z2d=REAL(nk_rnf,wp)
+      CALL crs_dom_ope( z2d  , 'MAX', 'T', tmask, z2d_crs  , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0 )
+      nk_rnf_crs=INT(z2d_crs) 
       CALL crs_dom_ope( qsr  , 'SUM', 'T', tmask, qsr_crs  , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0 )
-#if defined key_vvl
-      CALL crs_dom_ope( gdepw_n, 'MAX', 'W', tmask, gdepw_n_crs, p_e3=zfse3w, psgn=1.0 )
-#else
-      CALL crs_dom_ope( gdepw_0, 'MAX', 'W', tmask, gdepw_0_crs, p_e3=zfse3w, psgn=1.0 )
-#endif
+
+!???#if defined key_vvl
+!      CALL crs_dom_ope( gdepw_n, 'MAX', 'W', tmask, gdepw_n_crs, p_e3=zfse3w, psgn=1.0 )
+!#else
+!      CALL crs_dom_ope( gdepw_0, 'MAX', 'W', tmask, gdepw_0_crs, p_e3=zfse3w, psgn=1.0 )
+!#endif
       CALL crs_dom_ope( emp   ,'SUM', 'T', tmask, emp_crs   , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0 )
       CALL crs_dom_ope( fmmflx,'SUM', 'T', tmask, fmmflx_crs, p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0 )
@@ -412,4 +438,6 @@
       zmin=MINVAL(e3t_n_crs);zmax=MAXVAL(e3t_n_crs);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld e3t_n_crs",zmin,zmax 
       zmin=MINVAL(e3t_a_crs);zmax=MAXVAL(e3t_a_crs);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld e3t_a_crs",zmin,zmax 
+      zmin=MINVAL(e3t_max_n_crs);zmax=MAXVAL(e3t_max_n_crs);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld e3t_max_n_crs",zmin,zmax 
+      zmin=MINVAL(e3w_max_n_crs);zmax=MAXVAL(e3w_max_n_crs);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld e3w_max_n_crs",zmin,zmax 
       zmin=MINVAL(sshb);zmax=MAXVAL(sshb);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld sshb",zmin,zmax 
       zmin=MINVAL(sshn);zmax=MAXVAL(sshn);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crsfld sshn",zmin,zmax 
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90	(revision 7210)
@@ -223,8 +223,14 @@
      CALL crs_dom_e3( e1v, e2v, zfse3v, p_sfc_2d_crs=e1v_crs  , cd_type='V', p_mask=vmask, p_e3_crs=e3v_0_crs, p_e3_max_crs=e3v_max_0_crs)
 
-     WHERE(e3t_max_0_crs == 0._wp) e3t_max_0_crs=r_inf
-     WHERE(e3u_max_0_crs == 0._wp) e3u_max_0_crs=r_inf
-     WHERE(e3v_max_0_crs == 0._wp) e3v_max_0_crs=r_inf
-     WHERE(e3w_max_0_crs == 0._wp) e3w_max_0_crs=r_inf
+     DO jk = 1, jpk
+        DO ji = 1, jpi_crs
+           DO jj = 1, jpj_crs
+              IF( e3t_max_0_crs(ji,jj,jk) == 0._wp ) e3t_max_0_crs(ji,jj,jk) = e3t_1d(jk)
+              IF( e3w_max_0_crs(ji,jj,jk) == 0._wp ) e3w_max_0_crs(ji,jj,jk) = e3w_1d(jk)
+              IF( e3u_max_0_crs(ji,jj,jk) == 0._wp ) e3u_max_0_crs(ji,jj,jk) = e3t_1d(jk)
+              IF( e3v_max_0_crs(ji,jj,jk) == 0._wp ) e3v_max_0_crs(ji,jj,jk) = e3t_1d(jk)
+           ENDDO
+        ENDDO
+     ENDDO
 
 #if defined key_vvl
@@ -281,4 +287,14 @@
      CALL crs_dom_ope( gdept_0, 'MAX', 'T', tmask, gdept_0_crs, p_e3=zfse3t, psgn=1.0 ) 
      CALL crs_dom_ope( gdepw_0, 'MAX', 'W', tmask, gdepw_0_crs, p_e3=zfse3w, psgn=1.0 )
+
+     DO jk = 1, jpk
+        DO ji = 1, jpi_crs
+           DO jj = 1, jpj_crs
+              IF( gdept_0_crs(ji,jj,jk) .LE. 0._wp ) gdept_0_crs(ji,jj,jk) = gdept_1d(jk)
+              IF( gdepw_0_crs(ji,jj,jk) .LE. 0._wp ) gdepw_0_crs(ji,jj,jk) = gdepw_1d(jk)
+           ENDDO
+        ENDDO
+     ENDDO
+
 #if defined key_vvl
      gdept_n_crs(:,:,:) = gdept_0_crs(:,:,:)
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 7210)
@@ -27,5 +27,5 @@
    !!----------------------------------------------------------------------
    USE oce_trc         ! ocean dynamics and tracers variables
-   USE trc, ONLY : nittrc000, tra, jptra,rdttrc,trb, trn,tra,ctrcnm            ! ocean passive tracers variables
+   USE trc, ONLY : nittrc000, tra, jptra,rdttrc,trb, trn,tra,ctrcnm,sbc_trc,sbc_trc_b ! ocean passive tracers variables
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE prtctl_trc      ! Print control for debbuging
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 7210)
@@ -17,5 +17,5 @@
    !!----------------------------------------------------------------------
    USE oce_trc         ! ocean dynamics and active tracers variables
-   USE trc , ONLY  : trn,tra,ln_top_euler,rdttrc,nittrc000,ln_rsttr,numrtr,ctrcnm,jptra,numrtw,nn_ice_tr,lrst_trc
+   USE trc , ONLY  : trn,tra,ln_top_euler,rdttrc,nittrc000,ln_rsttr,numrtr,ctrcnm,jptra,numrtw,nn_ice_tr,lrst_trc,sbc_trc_b,sbc_trc
    USE prtctl_trc      ! Print control for debbuging
    USE iom  , ONLY : iom_varid, iom_get, iom_rstput,jpdom_autoglo
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90	(revision 7210)
@@ -35,5 +35,5 @@
    USE zpshde_crs      ! partial step: hor. derivative       (zps_hde routine)
    USE dom_oce , ONLY : ln_crs, ln_isfcav
-   USE crs     , ONLY : jpi_crs,jpj_crs,wn_crs,ln_crs_top,sbc_trc_crs,sbc_trc_b_crs
+   USE crs     , ONLY : jpi_crs,jpj_crs,wn_crs,ln_crs_top
    USE ldfslp_crs
 #if defined key_agrif
Index: /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 7209)
+++ /branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 7210)
@@ -211,6 +211,4 @@
    USE crs , ONLY :   emp_b      =>    emp_b_crs      !: freshwater budget: volume flux               [Kg/m2/s]
    USE crs , ONLY :   sfx        =>    sfx_crs        !: freshwater budget: concentration/dillution   [Kg/m2/s]
-   USE crs , ONLY :   sbc_trc_b  =>    sbc_trc_b_crs      !: freshwater budget: volume flux               [Kg/m2/s]
-   USE crs , ONLY :   sbc_trc    =>    sbc_trc_crs      !: freshwater budget: volume flux               [Kg/m2/s]
    USE crs , ONLY :   fmmflx     =>    fmmflx_crs     !: freshwater budget: volume flux               [Kg/m2/s]
    USE crs , ONLY :   rnf        =>    rnf_crs        !: river runoff   [Kg/m2/s]
@@ -442,6 +440,4 @@
    USE sbcrnf  , ONLY :   h_rnf      =>    h_rnf      !: river runoff   [Kg/m2/s]
    USE sbcrnf  , ONLY :   nk_rnf     =>    nk_rnf     !: depth of runoff in model level
-   USE trc     , ONLY :   sbc_trc_b  =>    sbc_trc_b  !: freshwater budget: volume flux               [Kg/m2/s]
-   USE trc     , ONLY :   sbc_trc    =>    sbc_trc    !: freshwater budget: volume flux               [Kg/m2/s]
    USE trc , ONLY :  trc_i => trc_i
    USE trc , ONLY :  trc_o => trc_o
