Index: branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/DOM/iscplhsb.F90
===================================================================
--- branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/DOM/iscplhsb.F90	(revision 8185)
+++ branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/DOM/iscplhsb.F90	(revision 8568)
@@ -13,16 +13,16 @@
    !!   iscpl_div      : correction of divergence to keep volume conservation
    !!----------------------------------------------------------------------
+   USE oce             ! global tra/dyn variable
    USE dom_oce         ! ocean space and time domain
    USE domwri          ! ocean space and time domain
+   USE domngb          ! 
    USE phycst          ! physical constants
    USE sbc_oce         ! surface boundary condition variables
-   USE oce             ! global tra/dyn variable
+   USE iscplini        ! 
+   !
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! MPP library
    USE lib_fortran     ! MPP library
-   USE wrk_nemo        ! Memory allocation
    USE lbclnk          !
-   USE domngb          !
-   USE iscplini
 
    IMPLICIT NONE
@@ -56,35 +56,31 @@
       REAL(wp), DIMENSION(:,:,:  ), INTENT(out) :: pvol_flx    !! corrective flux to have volume conservation
       REAL(wp),                     INTENT(in ) :: prdt_iscpl  !! coupling period 
-      !!
-      INTEGER :: ji, jj, jk                                    !! loop index
-      INTEGER :: jip1, jim1, jjp1, jjm1
-      !!
-      REAL(wp):: summsk, zsum, zsum1, zarea, zsumn, zsumb
-      REAL(wp):: r1_rdtiscpl
-      REAL(wp):: zjip1_ratio  , zjim1_ratio  , zjjp1_ratio  , zjjm1_ratio
-      !!
-      REAL(wp):: zde3t, zdtem, zdsal
-      REAL(wp), DIMENSION(:,:), POINTER :: zdssh
-      !!
-      REAL(wp), DIMENSION(:), ALLOCATABLE :: zlon, zlat
-      REAL(wp), DIMENSION(:), ALLOCATABLE :: zcorr_vol, zcorr_tem, zcorr_sal
-      INTEGER , DIMENSION(:), ALLOCATABLE :: ixpts, iypts, izpts, inpts
+      !
+      INTEGER  ::   ji  , jj  , jk           ! loop index
+      INTEGER  ::   jip1, jim1, jjp1, jjm1
+      REAL(wp) ::   summsk, zsum , zsumn, zjip1_ratio  , zjim1_ratio, zdtem, zde3t, z1_rdtiscpl
+      REAL(wp) ::   zarea , zsum1, zsumb, zjjp1_ratio  , zjjm1_ratio, zdsal
+      REAL(wp), DIMENSION(jpi,jpj)        ::   zdssh   ! workspace
+      REAL(wp), DIMENSION(:), ALLOCATABLE ::   zlon, zlat
+      REAL(wp), DIMENSION(:), ALLOCATABLE ::   zcorr_vol, zcorr_tem, zcorr_sal
+      INTEGER , DIMENSION(:), ALLOCATABLE ::   ixpts, iypts, izpts, inpts
       INTEGER :: jpts, npts
-
-      CALL wrk_alloc(jpi,jpj, zdssh )
+      !!----------------------------------------------------------------------
 
       ! get imbalance (volume heat and salt)
       ! initialisation difference
-      zde3t = 0.0_wp; zdsal = 0.0_wp ; zdtem = 0.0_wp
+      zde3t = 0._wp   ;   zdsal = 0._wp   ;   zdtem = 0._wp
 
       ! initialisation correction term
-      pvol_flx(:,:,:  ) = 0.0_wp
-      pts_flx (:,:,:,:) = 0.0_wp
+      pvol_flx(:,:,:  ) = 0._wp
+      pts_flx (:,:,:,:) = 0._wp
       
-      r1_rdtiscpl = 1._wp / prdt_iscpl 
+      z1_rdtiscpl = 1._wp / prdt_iscpl 
 
       ! mask tsn and tsb 
-      tsb(:,:,:,jp_tem)=tsb(:,:,:,jp_tem)*ptmask_b(:,:,:); tsn(:,:,:,jp_tem)=tsn(:,:,:,jp_tem)*tmask(:,:,:);
-      tsb(:,:,:,jp_sal)=tsb(:,:,:,jp_sal)*ptmask_b(:,:,:); tsn(:,:,:,jp_sal)=tsn(:,:,:,jp_sal)*tmask(:,:,:);
+      tsb(:,:,:,jp_tem) = tsb(:,:,:,jp_tem) * ptmask_b(:,:,:)
+      tsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) *  tmask  (:,:,:)
+      tsb(:,:,:,jp_sal) = tsb(:,:,:,jp_sal) * ptmask_b(:,:,:)
+      tsn(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) *  tmask  (:,:,:)
 
       !==============================================================================
@@ -118,7 +114,7 @@
 
                   ! volume, heat and salt differences in each cell 
-                  pvol_flx(ji,jj,jk)       =   pvol_flx(ji,jj,jk)        + zde3t * r1_rdtiscpl
-                  pts_flx (ji,jj,jk,jp_sal)=   pts_flx (ji,jj,jk,jp_sal) + zdsal * r1_rdtiscpl 
-                  pts_flx (ji,jj,jk,jp_tem)=   pts_flx (ji,jj,jk,jp_tem) + zdtem * r1_rdtiscpl
+                  pvol_flx(ji,jj,jk)       =   pvol_flx(ji,jj,jk)        + zde3t * z1_rdtiscpl
+                  pts_flx (ji,jj,jk,jp_sal)=   pts_flx (ji,jj,jk,jp_sal) + zdsal * z1_rdtiscpl 
+                  pts_flx (ji,jj,jk,jp_tem)=   pts_flx (ji,jj,jk,jp_tem) + zdtem * z1_rdtiscpl
 
                   ! case where we close a cell: check if the neighbour cells are wet 
@@ -190,6 +186,6 @@
       ! if no neighbour wet cell in case of 2close a cell", need to find the nearest wet point 
       ! allocation and initialisation of the list of problematic point
-      ALLOCATE(inpts(jpnij))
-      inpts(:)=0
+      ALLOCATE( inpts(jpnij) )
+      inpts(:) = 0
 
       ! fill narea location with the number of problematic point
@@ -287,9 +283,7 @@
       CALL lbc_sum(pts_flx (:,:,:,jp_sal),'T',1._wp)
       CALL lbc_sum(pts_flx (:,:,:,jp_tem),'T',1._wp)
-
-      ! deallocate variables
-      CALL wrk_dealloc(jpi,jpj, zdssh ) 
-
+      !
    END SUBROUTINE iscpl_cons
+
 
    SUBROUTINE iscpl_div( phdivn )
