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 6101)
+++ branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90	(revision 6772)
@@ -21,4 +21,5 @@
    USE lib_mpp
    USE ldftra_crs
+   USE ieee_arithmetic
 
    IMPLICIT NONE
@@ -30,5 +31,4 @@
 #  include "domzgr_substitute.h90"
 
-   !! $Id$
 CONTAINS
    
@@ -111,8 +111,11 @@
      rfacty_r = 1. / nn_facty
 
+write(narea+200,*)"crsini0",nstop; call flush(narea+200)
+
      !---------------------------------------------------------
      ! 2. Define Global Dimensions of the coarsened grid
      !---------------------------------------------------------
      CALL crs_dom_def      
+write(narea+200,*)"crsini1",nstop; call flush(narea+200)
 
      !---------------------------------------------------------
@@ -125,5 +128,13 @@
  
      CALL crs_dom_msk
-
+write(narea+200,*)"crsini2",nstop; call flush(narea+200)
+      CALL mppsync()
+
+     !IF( narea==279 )THEN
+     !WRITE(narea+200,*)"tutu1 ",jpi,jpj,nldi,nlei,nldj,nlej
+     !DO jj=1,jpj
+     !   WRITE(narea+200,*)"tutu2 ",jj,MINVAL(tmask(:,jj,:)),MAXVAL(tmask(:,jj,:))
+     !ENDDO
+     !ENDIF
 
      !  3.b. Get the coordinates
@@ -131,26 +142,28 @@
      !      Even-numbered reduction factor, center coordinate on U-,V- faces or f-corner.
      !      
-     IF ( nresty /= 0 .AND. nrestx /= 0 ) THEN
+     !IF ( nresty /= 0 .AND. nrestx /= 0 ) THEN
         CALL crs_dom_coordinates( gphit, glamt, 'T', gphit_crs, glamt_crs ) 
         CALL crs_dom_coordinates( gphiu, glamu, 'U', gphiu_crs, glamu_crs )       
         CALL crs_dom_coordinates( gphiv, glamv, 'V', gphiv_crs, glamv_crs ) 
         CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs ) 
-     ELSEIF ( nresty /= 0 .AND. nrestx == 0 ) THEN
-        CALL crs_dom_coordinates( gphiu, glamu, 'T', gphit_crs, glamt_crs )
-        CALL crs_dom_coordinates( gphiu, glamu, 'U', gphiu_crs, glamu_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'V', gphiv_crs, glamv_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
-     ELSEIF ( nresty == 0 .AND. nrestx /= 0 ) THEN
-        CALL crs_dom_coordinates( gphiv, glamv, 'T', gphit_crs, glamt_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'U', gphiu_crs, glamu_crs )
-        CALL crs_dom_coordinates( gphiv, glamv, 'V', gphiv_crs, glamv_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
-     ELSE 
-        CALL crs_dom_coordinates( gphif, glamf, 'T', gphit_crs, glamt_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'U', gphiu_crs, glamu_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'V', gphiv_crs, glamv_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
-     ENDIF
-
+     !ELSEIF ( nresty /= 0 .AND. nrestx == 0 ) THEN
+     !   CALL crs_dom_coordinates( gphiu, glamu, 'T', gphit_crs, glamt_crs )
+     !   CALL crs_dom_coordinates( gphiu, glamu, 'U', gphiu_crs, glamu_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'V', gphiv_crs, glamv_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
+     !ELSEIF ( nresty == 0 .AND. nrestx /= 0 ) THEN
+     !   CALL crs_dom_coordinates( gphiv, glamv, 'T', gphit_crs, glamt_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'U', gphiu_crs, glamu_crs )
+     !   CALL crs_dom_coordinates( gphiv, glamv, 'V', gphiv_crs, glamv_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
+     !ELSE 
+     !   CALL crs_dom_coordinates( gphif, glamf, 'T', gphit_crs, glamt_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'U', gphiu_crs, glamu_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'V', gphiv_crs, glamv_crs )
+     !   CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
+     !ENDIF
+      CALL mppsync()
+
+write(narea+200,*)"crsini3",nstop; call flush(narea+200)
 
      !  3.c. Get the horizontal mesh
@@ -162,4 +175,18 @@
      CALL crs_dom_hgr( e1v, e2v, 'V', e1v_crs, e2v_crs )
      CALL crs_dom_hgr( e1f, e2f, 'F', e1f_crs, e2f_crs )
+
+     DO ji=nldi_crs,nlei_crs
+     DO jj=nldj_crs,nlej_crs
+        IF( e1t_crs(ji,jj)==0._wp .AND. tmask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e1t_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e1u_crs(ji,jj)==0._wp .AND. umask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e1u_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e1v_crs(ji,jj)==0._wp .AND. vmask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e1v_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e1f_crs(ji,jj)==0._wp .AND. fmask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e1f_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e2t_crs(ji,jj)==0._wp .AND. tmask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e2t_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e2u_crs(ji,jj)==0._wp .AND. umask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e2u_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e2v_crs(ji,jj)==0._wp .AND. vmask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e2v_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+        IF( e2f_crs(ji,jj)==0._wp .AND. fmask_crs(ji,jj,1) .NE. 0._wp )WRITE(narea+8000-1,*)"e2f_crs=0",ji,jj;CALL FLUSH(narea+8000-1) 
+     ENDDO
+     ENDDO
+
 
      WHERE(e1t_crs == 0._wp) e1t_crs=r_inf
@@ -172,6 +199,17 @@
      WHERE(e2f_crs == 0._wp) e2f_crs=r_inf
 
+     zmin=MINVAL(e1t_crs,mask=(tmask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1t_crs,mask=(tmask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1t_crs ",zmin,zmax
+     zmin=MINVAL(e1u_crs,mask=(umask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1u_crs,mask=(umask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1u_crs ",zmin,zmax
+     zmin=MINVAL(e1v_crs,mask=(vmask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1v_crs,mask=(vmask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1v_crs ",zmin,zmax
+     zmin=MINVAL(e1f_crs,mask=(fmask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1f_crs,mask=(fmask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1f_crs ",zmin,zmax
+     zmin=MINVAL(e2t_crs,mask=(tmask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e2t_crs,mask=(tmask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e2t_crs ",zmin,zmax
+     zmin=MINVAL(e2u_crs,mask=(umask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e2u_crs,mask=(umask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e2u_crs ",zmin,zmax
+     zmin=MINVAL(e2v_crs,mask=(vmask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e2v_crs,mask=(vmask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e2v_crs ",zmin,zmax
+     zmin=MINVAL(e2f_crs,mask=(fmask_crs(:,:,1)==1));CALL mpp_min(zmin);zmax=MAXVAL(e2f_crs,mask=(fmask_crs(:,:,1)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e2f_crs ",zmin,zmax
+
+
      e1e2t_crs(:,:) = e1t_crs(:,:) * e2t_crs(:,:)
      
+write(narea+200,*)"crsini4",nstop; call flush(narea+200)
      
      !      3.c.2 Coriolis factor  
@@ -196,8 +234,8 @@
      CALL wrk_alloc(jpi, jpj, jpk, zfse3t, zfse3u, zfse3v, zfse3w )
      !
-     zfse3t(:,:,:) = fse3t(:,:,:)
-     zfse3u(:,:,:) = fse3u(:,:,:)
-     zfse3v(:,:,:) = fse3v(:,:,:)
-     zfse3w(:,:,:) = fse3w(:,:,:)
+     zfse3t(:,:,:) = e3t_0(:,:,:) !fse3t(:,:,:)
+     zfse3u(:,:,:) = e3u_0(:,:,:) !fse3u(:,:,:)
+     zfse3v(:,:,:) = e3v_0(:,:,:) !fse3v(:,:,:)
+     zfse3w(:,:,:) = e3w_0(:,:,:) !fse3w(:,:,:)
 
      !    3.d.2   Surfaces 
@@ -209,4 +247,31 @@
      CALL crs_dom_sfc( umask, 'U', e2e3u_crs, e2e3u_msk, p_e2=e2u, p_e3=zfse3u )
      CALL crs_dom_sfc( vmask, 'V', e1e3v_crs, e1e3v_msk, p_e1=e1v, p_e3=zfse3v )
+
+     DO ji=nldi_crs,nlei_crs
+     DO jj=nldj_crs,nlej_crs
+     DO jk=1,jpk   
+        IF( e1e2w_crs(ji,jj,jk)==0._wp .AND. tmask_crs(ji,jj,jk)==1._wp )WRITE(narea+8000-1,*)"e1e2w_crs=0",ji,jj,jk;CALL FLUSH(narea+8000-1)
+        IF( e1e2w_msk(ji,jj,jk)==0._wp .AND. tmask_crs(ji,jj,jk)==1._wp )WRITE(narea+8000-1,*)"e1e2w_msk=0",ji,jj,jk;CALL FLUSH(narea+8000-1)
+        IF( e2e3u_crs(ji,jj,jk)==0._wp .AND. umask_crs(ji,jj,jk)==1._wp )WRITE(narea+8000-1,*)"e2e3u_crs=0",ji,jj,jk;CALL FLUSH(narea+8000-1)
+        IF( e2e3u_msk(ji,jj,jk)==0._wp .AND. umask_crs(ji,jj,jk)==1._wp )WRITE(narea+8000-1,*)"e2e3u_msk=0",ji,jj,jk;CALL FLUSH(narea+8000-1)
+        IF( e1e3v_crs(ji,jj,jk)==0._wp .AND. vmask_crs(ji,jj,jk)==1._wp )WRITE(narea+8000-1,*)"e1e3v_crs=0",ji,jj,jk;CALL FLUSH(narea+8000-1)
+        IF( e1e3v_msk(ji,jj,jk)==0._wp .AND. vmask_crs(ji,jj,jk)==1._wp )WRITE(narea+8000-1,*)"e1e3v_msk=0",ji,jj,jk;CALL FLUSH(narea+8000-1)
+     ENDDO
+     ENDDO
+     ENDDO
+write(narea+200,*)"crsini5",nstop; call flush(narea+200)
+
+!     WHERE(e1e2w_crs == 0._wp) e1e2w_crs=r_inf
+!     WHERE(e2e3u_crs == 0._wp) e2e3u_crs=r_inf
+!     WHERE(e1e3v_crs == 0._wp) e1e3v_crs=r_inf
+!     WHERE(e1e2w_msk == 0._wp) e1e2w_msk=r_inf
+!     WHERE(e2e3u_msk == 0._wp) e2e3u_msk=r_inf
+!     WHERE(e1e3v_msk == 0._wp) e1e3v_msk=r_inf
+     zmin=MINVAL(e1e2w_crs,mask=(tmask_crs(:,:,:)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1e2w_crs,mask=(tmask_crs(:,:,:)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1e2w_crs ",zmin,zmax
+     zmin=MINVAL(e2e3u_crs,mask=(umask_crs(:,:,:)==1));CALL mpp_min(zmin);zmax=MAXVAL(e2e3u_crs,mask=(umask_crs(:,:,:)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e2e3u_crs ",zmin,zmax
+     zmin=MINVAL(e1e3v_crs,mask=(vmask_crs(:,:,:)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1e3v_crs,mask=(vmask_crs(:,:,:)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1e3v_crs ",zmin,zmax
+     zmin=MINVAL(e1e2w_msk,mask=(tmask_crs(:,:,:)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1e2w_msk,mask=(tmask_crs(:,:,:)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1e2w_msk ",zmin,zmax
+     zmin=MINVAL(e2e3u_msk,mask=(umask_crs(:,:,:)==1));CALL mpp_min(zmin);zmax=MAXVAL(e2e3u_msk,mask=(umask_crs(:,:,:)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e2e3u_msk ",zmin,zmax
+     zmin=MINVAL(e1e3v_msk,mask=(vmask_crs(:,:,:)==1));CALL mpp_min(zmin);zmax=MAXVAL(e1e3v_msk,mask=(vmask_crs(:,:,:)==1));CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"crs e1e3v_msk ",zmin,zmax
    
      !cbr facsurfu(:,:,:) = umask_crs(:,:,:) * e2e3u_msk(:,:,:) / e2e3u_crs(:,:,:)
@@ -226,33 +291,89 @@
      ENDDO
 
+        DO ji=nldi_crs,nlei_crs
+           DO jj=nldj_crs,nlej_crs
+        IF( ABS(e2u_crs(ji,jj)) .LE. 1.e-5 )WRITE(narea+8000-1,*)"UNDERFLOW e2u_crs",ji,jj,e2u_crs(ji,jj),umask_crs(ji,jj,1) ; CALL FLUSH(narea+8000-1)
+        IF( ABS(e1v_crs(ji,jj)) .LE. 1.e-5 )WRITE(narea+8000-1,*)"UNDERFLOW e1v_crs",ji,jj,e1v_crs(ji,jj),vmask_crs(ji,jj,1) ; CALL FLUSH(narea+8000-1)
+           ENDDO
+        ENDDO
+
+
      !    3.d.3   Vertical scale factors
      !
-   
-  
-     CALL crs_dom_e3( e1t, e2t, zfse3t, e1e2w_crs, 'T', tmask, e3t_crs, e3t_max_crs)
-     CALL crs_dom_e3( e1u, e2u, zfse3u, e2e3u_crs, 'U', umask, e3u_crs, e3u_max_crs)
-     CALL crs_dom_e3( e1v, e2v, zfse3v, e1e3v_crs, 'V', vmask, e3v_crs, e3v_max_crs)
-     CALL crs_dom_e3( e1t, e2t, zfse3w, e1e2w_crs, 'W', tmask, e3w_crs, e3w_max_crs)
-     WHERE(e3t_max_crs == 0._wp) e3t_max_crs=r_inf
-     WHERE(e3u_max_crs == 0._wp) e3u_max_crs=r_inf
-     WHERE(e3v_max_crs == 0._wp) e3v_max_crs=r_inf
-     WHERE(e3w_max_crs == 0._wp) e3w_max_crs=r_inf
-
+     zmin=MINVAL(e2u_crs(nldi_crs:nlei_crs,nldj_crs:nlej_crs));zmax=MAXVAL(e2u_crs(nldi_crs:nlei_crs,nldj_crs:nlej_crs));CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"e2u_crs",zmin,zmax;CALL FLUSH(numout)  
+     zmin=MINVAL(e1v_crs(nldi_crs:nlei_crs,nldj_crs:nlej_crs));zmax=MAXVAL(e1v_crs(nldi_crs:nlei_crs,nldj_crs:nlej_crs));CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"e1v_crs",zmin,zmax;CALL FLUSH(numout)  
+     zmin=MINVAL(e1e2w_crs(nldi_crs:nlei_crs,nldj_crs:nlej_crs,:));zmax=MAXVAL(e1e2w_crs(nldi_crs:nlei_crs,nldj_crs:nlej_crs,:));CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"e1e2w_crs",zmin,zmax;CALL FLUSH(numout)  
+     zmin=MINVAL(zfse3u);zmax=MAXVAL(zfse3u);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"zfse3u",zmin,zmax;CALL FLUSH(numout)  
+     zmin=MINVAL(zfse3v);zmax=MAXVAL(zfse3v);CALL mpp_min(zmin);CALL mpp_max(zmax);IF(lwp)WRITE(numout,*)"zfse3v",zmin,zmax;CALL FLUSH(numout)  
+
+     CALL crs_dom_e3( e1t, e2t, zfse3t, p_sfc_3d_crs=e1e2w_crs, cd_type='T', p_mask=tmask, p_e3_crs=e3t_0_crs, p_e3_max_crs=e3t_max_0_crs)
+     CALL crs_dom_e3( e1t, e2t, zfse3w, p_sfc_3d_crs=e1e2w_crs, cd_type='W', p_mask=tmask, p_e3_crs=e3w_0_crs, p_e3_max_crs=e3w_max_0_crs)
+     CALL crs_dom_e3( e1u, e2u, zfse3u, p_sfc_2d_crs=e2u_crs  , cd_type='U', p_mask=umask, p_e3_crs=e3u_0_crs, p_e3_max_crs=e3u_max_0_crs)
+     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
+
+write(narea+200,*)"crsini6",nstop; call flush(narea+200)
+#if defined key_vvl
+     e3t_max_n_crs=e3t_max_0_crs
+     e3u_max_n_crs=e3u_max_0_crs
+     e3v_max_n_crs=e3v_max_0_crs
+     e3w_max_n_crs=e3w_max_0_crs
+#endif
+
+     ht_0_crs(:,:)=0._wp
+     DO jk = 1, jpk
+        ht_0_crs(:,:)=ht_0_crs(:,:)+e3t_0_crs(:,:,jk)*tmask_crs(:,:,jk)
+     ENDDO
+
+#if defined key_vvl
+     e3t_0_crs(:,:,:) = e3t_0_crs(:,:,:) * tmask_crs(:,:,:)
+     e3u_0_crs(:,:,:) = e3u_0_crs(:,:,:) * umask_crs(:,:,:)
+     e3v_0_crs(:,:,:) = e3v_0_crs(:,:,:) * vmask_crs(:,:,:)
+     e3w_0_crs(:,:,:) = e3w_0_crs(:,:,:) * tmask_crs(:,:,:)
+#endif
+
+write(narea+200,*)"crsini7",nstop; call flush(narea+200)
      ! Reset 0 to e3t_0 or e3w_0
      DO jk = 1, jpk
         DO ji = 1, jpi_crs
            DO jj = 1, jpj_crs
-              IF( e3t_crs(ji,jj,jk) == 0._wp ) e3t_crs(ji,jj,jk) = e3t_1d(jk)
-              IF( e3w_crs(ji,jj,jk) == 0._wp ) e3w_crs(ji,jj,jk) = e3w_1d(jk)
-              IF( e3u_crs(ji,jj,jk) == 0._wp ) e3u_crs(ji,jj,jk) = e3t_1d(jk)
-              IF( e3v_crs(ji,jj,jk) == 0._wp ) e3v_crs(ji,jj,jk) = e3t_1d(jk)
+              IF( e3t_0_crs(ji,jj,jk) == 0._wp ) e3t_0_crs(ji,jj,jk) = e3t_1d(jk)
+              IF( e3w_0_crs(ji,jj,jk) == 0._wp ) e3w_0_crs(ji,jj,jk) = e3w_1d(jk)
+              IF( e3u_0_crs(ji,jj,jk) == 0._wp ) e3u_0_crs(ji,jj,jk) = e3t_1d(jk)
+              IF( e3v_0_crs(ji,jj,jk) == 0._wp ) e3v_0_crs(ji,jj,jk) = e3t_1d(jk)
            ENDDO
         ENDDO
      ENDDO
 
+#if defined key_vvl
+     e3t_b_crs(:,:,:) = e3t_0_crs(:,:,:)
+     e3u_b_crs(:,:,:) = e3u_0_crs(:,:,:)
+     e3v_b_crs(:,:,:) = e3v_0_crs(:,:,:)
+     e3w_b_crs(:,:,:) = e3w_0_crs(:,:,:)
+
+     e3t_n_crs(:,:,:) = e3t_0_crs(:,:,:)
+     e3u_n_crs(:,:,:) = e3u_0_crs(:,:,:)
+     e3v_n_crs(:,:,:) = e3v_0_crs(:,:,:)
+     e3w_n_crs(:,:,:) = e3w_0_crs(:,:,:)
+
+     e3t_a_crs(:,:,:) = e3t_0_crs(:,:,:)
+     e3u_a_crs(:,:,:) = e3u_0_crs(:,:,:)
+     e3v_a_crs(:,:,:) = e3v_0_crs(:,:,:)
+     e3w_a_crs(:,:,:) = e3w_0_crs(:,:,:)
+#endif
+
      !    3.d.3   Vertical depth (meters)
      !cbr: il semblerait que p_e3=... ne soit pas utile ici !!!!!!!!!
-     CALL crs_dom_ope( gdept_0, 'MAX', 'T', tmask, gdept_crs, p_e3=zfse3t, psgn=1.0 ) 
-     CALL crs_dom_ope( gdepw_0, 'MAX', 'W', tmask, gdepw_crs, p_e3=zfse3w, psgn=1.0 )
+     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 )
+#if defined key_vvl
+     gdept_n_crs(:,:,:) = gdept_0_crs(:,:,:)
+     gdepw_n_crs(:,:,:) = gdepw_0_crs(:,:,:)
+#endif
+
+write(narea+200,*)"crsini8",nstop; call flush(narea+200)
 
      !---------------------------------------------------------
@@ -276,4 +397,5 @@
      !CALL dom_grid_glo   ! Return to parent grid domain
 
+write(narea+200,*)"crsini9",nstop; call flush(narea+200)
 
      !
@@ -291,4 +413,5 @@
       rhop_crs(:,:,:)=0._wp ; rhd_crs(:,:,:)=0._wp ; rb2_crs(:,:,:)=0._wp
 
+write(narea+200,*)"crsini10",nstop; call flush(narea+200)
  
      !---------------------------------------------------------
