Index: NEMO/branches/2019/ENHANCE-03_domcfg/src/domclo.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-03_domcfg/src/domclo.F90	(revision 11658)
+++ NEMO/branches/2019/ENHANCE-03_domcfg/src/domclo.F90	(revision 11991)
@@ -108,5 +108,5 @@
       CALL dom_ngb(rn_lon_opnsea, rn_lat_opnsea, jiseed, jjseed, zdistseed, 'T')
 
-      !! 1.2 fill select cell to -1
+      !! 1.2 fill connected cell to -1
       CALL fill_pool( jiseed, jjseed, msk_opnsea, -1._wp )
 
@@ -134,5 +134,5 @@
       !! 1.4 Define closed sea mask (all of them, ie defined in the namelist or not)
       !! needed to remove the undefined closed seas at the end
-      msk_closea(:,:) = ( ssmask(:,:) - msk_opnsea(:,:) ) * 99._wp
+      msk_csundef(:,:) = ( ssmask(:,:) - msk_opnsea(:,:) ) * 99._wp
 
       !!----------------------------------------------------------------------
@@ -143,12 +143,12 @@
       jglo = 1 ; jrnf = 1 ; jemp = 1
       !! mask used to group lake by net evap/precip distribution technics
-      msk_glo(:,:) = msk_closea(:,:)
-      msk_rnf(:,:) = msk_closea(:,:)
-      msk_emp(:,:) = msk_closea(:,:)
-
-      !! mask used to group multiple lake with the same river mouth (great lake for example)
-      msk_gloid(:,:) = 0.0_wp
-      msk_rnfid(:,:) = 0.0_wp
-      msk_empid(:,:) = 0.0_wp
+      msk_csglo(:,:) = msk_csundef(:,:)
+      msk_csrnf(:,:) = msk_csundef(:,:)
+      msk_csemp(:,:) = msk_csundef(:,:)
+
+      !! mask used to define group of lake sharing the same river mouth
+      msk_csgrpglo(:,:) = 0.0_wp
+      msk_csgrprnf(:,:) = 0.0_wp
+      msk_csgrpemp(:,:) = 0.0_wp
 
       IF (lwp) WRITE(numout,*)'closed seas: '
@@ -164,14 +164,14 @@
          CASE('glo')
             jsch = jglo
-            zmsksrc(:,:) = msk_glo(:,:)
-            zmsktrg(:,:) = msk_gloid(:,:)
+            zmsksrc(:,:) = msk_csglo(:,:)
+            zmsktrg(:,:) = msk_csgrpglo(:,:)
          CASE('rnf') 
             jsch = jrnf
-            zmsksrc(:,:) = msk_rnf(:,:)
-            zmsktrg(:,:) = msk_rnfid(:,:)
+            zmsksrc(:,:) = msk_csrnf(:,:)
+            zmsktrg(:,:) = msk_csgrprnf(:,:)
          CASE('emp')
             jsch = jemp 
-            zmsksrc(:,:) = msk_emp(:,:)
-            zmsktrg(:,:) = msk_empid(:,:)
+            zmsksrc(:,:) = msk_csemp(:,:)
+            zmsktrg(:,:) = msk_csgrpemp(:,:)
          CASE DEFAULT
             CALL ctl_stop( 'STOP', 'domclo: ',TRIM(csch),' is an unknown target type for lake (should be glo, emp, rnf)' )
@@ -186,7 +186,7 @@
 
          !! sanity check on the msk value (closea mask should be 99 otherwise, lake already processed)
-         !! check if some lake are not connected
+         !! check if seed on land or lake already processed
          zchk = 0._wp
-         IF (mi0(jiseed) == mi1(jiseed) .AND. mj0(jjseed) == mj1(jjseed)) zchk = msk_closea(mi0(jiseed),mj0(jjseed))
+         IF (mi0(jiseed) == mi1(jiseed) .AND. mj0(jjseed) == mj1(jjseed)) zchk = msk_csundef(mi0(jiseed),mj0(jjseed))
          CALL mpp_max('domclo',zchk)
          
@@ -215,7 +215,8 @@
 
             !! fill close sea mask with counter value
+            !! and update undefined closed sea mask
             CALL fill_pool( jiseed, jjseed, zmsksrc, REAL(jsch  ,8))
             WHERE (zmsksrc(:,:) == REAL(jsch,8))
-               msk_closea = 0._wp
+               msk_csundef = 0._wp
                zmsktrg    = sn_lake(jcs)%idtrg
             END WHERE
@@ -224,5 +225,5 @@
             IF (cloc /= 'global') THEN
 
-               !! set a minimum value for radius of the river influence
+               !! set value for radius of the river influence
                zradtrg = 0._wp
                IF (mi0(jiseed) == mi1(jiseed) .AND. mj0(jjseed) == mj1(jjseed)) THEN
@@ -290,16 +291,16 @@
             CASE ('glo')
                jglo = jglo + 1
-               msk_glo(:,:)   = zmsksrc(:,:)
-               msk_gloid(:,:) = zmsktrg(:,:)
+               msk_csglo(:,:)    = zmsksrc(:,:)
+               msk_csgrpglo(:,:) = zmsktrg(:,:)
                IF (lwp) WRITE(numout,*)'        net evap/precip will be spread globally (glo)'
             CASE ('rnf')
                jrnf = jrnf + 1
-               msk_rnf(:,:)   = zmsksrc(:,:)
-               msk_rnfid(:,:) = zmsktrg(:,:)
+               msk_csrnf(:,:)    = zmsksrc(:,:)
+               msk_csgrprnf(:,:) = zmsktrg(:,:)
                IF (lwp) WRITE(numout,*)'        net precip will be spread locally and net evap globally (rnf)'
             CASE ('emp')
                jemp = jemp + 1
-               msk_emp(:,:)   = zmsksrc(:,:)
-               msk_empid(:,:) = zmsktrg(:,:)
+               msk_csemp(:,:)    = zmsksrc(:,:)
+               msk_csgrpemp(:,:) = zmsktrg(:,:)
                IF (lwp) WRITE(numout,*)'        net evap/precip will be spread locally (emp)'
             END SELECT
@@ -314,10 +315,10 @@
 
       !! mask all the cells not defined as closed sea
-      WHERE ( msk_glo(:,:) == 99._wp )  msk_glo = 0._wp
-      WHERE ( msk_rnf(:,:) == 99._wp )  msk_rnf = 0._wp
-      WHERE ( msk_emp(:,:) == 99._wp )  msk_emp = 0._wp
+      WHERE ( msk_csglo(:,:) == 99._wp )  msk_csglo = 0._wp
+      WHERE ( msk_csrnf(:,:) == 99._wp )  msk_csrnf = 0._wp
+      WHERE ( msk_csemp(:,:) == 99._wp )  msk_csemp = 0._wp
 
       !!  non defined closed sea
-      WHERE ( msk_closea(:,:) > 0._wp ) msk_closea = 1._wp
+      WHERE ( msk_csundef(:,:) > 0._wp ) msk_csundef = 1._wp
 
    END SUBROUTINE dom_clo
