Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 9208)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 9209)
@@ -101,81 +101,89 @@
       IF(lwp) WRITE(numout,*)'~~~~~~~'
       !
-      ! read the closed seas masks (if they exist) from domain_cfg file
-      ! ---------------------------------------------------------------
-      !
-      CALL iom_open( cn_domcfg, inum )
-
-      id = iom_varid(inum, 'closea_mask', ldstop = .false.)
-      IF( id > 0 ) THEN 
-         l_sbc_clo = .true.
-         ALLOCATE( closea_mask(jpi,jpj) , STAT=ierr )
-         IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'dom_clo: failed to allocate closea_mask array')
-         zdata_in(:,:) = 0.0
-         CALL iom_get ( inum, jpdom_data, 'closea_mask', zdata_in )
-         closea_mask(:,:) = NINT(zdata_in(:,:)) * tmask(:,:,1)
-         ! number of closed seas = global maximum value in closea_mask field
-         jncs = maxval(closea_mask(:,:))
-         IF( lk_mpp ) CALL mpp_max(jncs)
-         IF( jncs > 0 ) THEN
-            IF( lwp ) WRITE(numout,*) 'Number of closed seas : ',jncs
-         ELSE
-            CALL ctl_stop( 'Problem with closea_mask field in domain_cfg file. Has no values > 0 so no closed seas defined.')
-         ENDIF
-      ELSE 
-         IF( lwp ) WRITE(numout,*)
-         IF( lwp ) WRITE(numout,*) '   ==>>>   closea_mask field not found in domain_cfg file.'
-         IF( lwp ) WRITE(numout,*) '           No closed seas defined.'
-         IF( lwp ) WRITE(numout,*)
-         l_sbc_clo = .false.
-         jncs = 0 
-      ENDIF
-
-      l_clo_rnf = .false.
-
-      IF( l_sbc_clo ) THEN ! No point reading in closea_mask_rnf or closea_mask_empmr fields if no closed seas defined.
-
-         id = iom_varid(inum, 'closea_mask_rnf', ldstop = .false.)
+      ! read the closed seas masks (if they exist) from domain_cfg file (if it exists)
+      ! ------------------------------------------------------------------------------
+      !
+      IF( ln_read_cfg) THEN
+         !
+         CALL iom_open( cn_domcfg, inum )
+         !
+         id = iom_varid(inum, 'closea_mask', ldstop = .false.)
          IF( id > 0 ) THEN 
-            l_clo_rnf = .true.            
-            ALLOCATE( closea_mask_rnf(jpi,jpj) , STAT=ierr )
-            IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'dom_clo: failed to allocate closea_mask_rnf array')
-            CALL iom_get ( inum, jpdom_data, 'closea_mask_rnf', zdata_in )
-            closea_mask_rnf(:,:) = NINT(zdata_in(:,:)) * tmask(:,:,1)
-            ! number of closed seas rnf mappings = global maximum in closea_mask_rnf field
-            jncsr = maxval(closea_mask_rnf(:,:))
-            IF( lk_mpp ) CALL mpp_max(jncsr)
-            IF( jncsr > 0 ) THEN
-               IF( lwp ) WRITE(numout,*) 'Number of closed seas rnf mappings : ',jncsr
+            l_sbc_clo = .true.
+            ALLOCATE( closea_mask(jpi,jpj) , STAT=ierr )
+            IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'dom_clo: failed to allocate closea_mask array')
+            zdata_in(:,:) = 0.0
+            CALL iom_get ( inum, jpdom_data, 'closea_mask', zdata_in )
+            closea_mask(:,:) = NINT(zdata_in(:,:)) * tmask(:,:,1)
+            ! number of closed seas = global maximum value in closea_mask field
+            jncs = maxval(closea_mask(:,:))
+            IF( lk_mpp ) CALL mpp_max(jncs)
+            IF( jncs > 0 ) THEN
+               IF( lwp ) WRITE(numout,*) 'Number of closed seas : ',jncs
             ELSE
-               CALL ctl_stop( 'Problem with closea_mask_rnf field in domain_cfg file. Has no values > 0 so no closed seas rnf mappings defined.')
+               CALL ctl_stop( 'Problem with closea_mask field in domain_cfg file. Has no values > 0 so no closed seas defined.')
             ENDIF
          ELSE 
-            IF( lwp ) WRITE(numout,*) 'closea_mask_rnf field not found in domain_cfg file. No closed seas rnf mappings defined.'
-            jncsr = 0
-         ENDIF
+            IF( lwp ) WRITE(numout,*)
+            IF( lwp ) WRITE(numout,*) '   ==>>>   closea_mask field not found in domain_cfg file.'
+            IF( lwp ) WRITE(numout,*) '           No closed seas defined.'
+            IF( lwp ) WRITE(numout,*)
+            l_sbc_clo = .false.
+            jncs = 0 
+         ENDIF
+
+         l_clo_rnf = .false.
+
+         IF( l_sbc_clo ) THEN ! No point reading in closea_mask_rnf or closea_mask_empmr fields if no closed seas defined.
+
+            id = iom_varid(inum, 'closea_mask_rnf', ldstop = .false.)
+            IF( id > 0 ) THEN 
+               l_clo_rnf = .true.            
+               ALLOCATE( closea_mask_rnf(jpi,jpj) , STAT=ierr )
+               IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'dom_clo: failed to allocate closea_mask_rnf array')
+               CALL iom_get ( inum, jpdom_data, 'closea_mask_rnf', zdata_in )
+               closea_mask_rnf(:,:) = NINT(zdata_in(:,:)) * tmask(:,:,1)
+               ! number of closed seas rnf mappings = global maximum in closea_mask_rnf field
+               jncsr = maxval(closea_mask_rnf(:,:))
+               IF( lk_mpp ) CALL mpp_max(jncsr)
+               IF( jncsr > 0 ) THEN
+                  IF( lwp ) WRITE(numout,*) 'Number of closed seas rnf mappings : ',jncsr
+               ELSE
+                  CALL ctl_stop( 'Problem with closea_mask_rnf field in domain_cfg file. Has no values > 0 so no closed seas rnf mappings defined.')
+               ENDIF
+            ELSE 
+               IF( lwp ) WRITE(numout,*) 'closea_mask_rnf field not found in domain_cfg file. No closed seas rnf mappings defined.'
+               jncsr = 0
+            ENDIF
  
-         id = iom_varid(inum, 'closea_mask_empmr', ldstop = .false.)
-         IF( id > 0 ) THEN 
-            l_clo_rnf = .true.            
-            ALLOCATE( closea_mask_empmr(jpi,jpj) , STAT=ierr )
-            IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'dom_clo: failed to allocate closea_mask_empmr array')
-            CALL iom_get ( inum, jpdom_data, 'closea_mask_empmr', zdata_in )
-            closea_mask_empmr(:,:) = NINT(zdata_in(:,:)) * tmask(:,:,1)
-            ! number of closed seas empmr mappings = global maximum value in closea_mask_empmr field
-            jncse = maxval(closea_mask_empmr(:,:))
-            IF( lk_mpp ) CALL mpp_max(jncse)
-            IF( jncse > 0 ) THEN 
-               IF( lwp ) WRITE(numout,*) 'Number of closed seas empmr mappings : ',jncse
-            ELSE
-               CALL ctl_stop( 'Problem with closea_mask_empmr field in domain_cfg file. Has no values > 0 so no closed seas empmr mappings defined.')
+            id = iom_varid(inum, 'closea_mask_empmr', ldstop = .false.)
+            IF( id > 0 ) THEN 
+               l_clo_rnf = .true.            
+               ALLOCATE( closea_mask_empmr(jpi,jpj) , STAT=ierr )
+               IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'dom_clo: failed to allocate closea_mask_empmr array')
+               CALL iom_get ( inum, jpdom_data, 'closea_mask_empmr', zdata_in )
+               closea_mask_empmr(:,:) = NINT(zdata_in(:,:)) * tmask(:,:,1)
+               ! number of closed seas empmr mappings = global maximum value in closea_mask_empmr field
+               jncse = maxval(closea_mask_empmr(:,:))
+               IF( lk_mpp ) CALL mpp_max(jncse)
+               IF( jncse > 0 ) THEN 
+                  IF( lwp ) WRITE(numout,*) 'Number of closed seas empmr mappings : ',jncse
+               ELSE
+                  CALL ctl_stop( 'Problem with closea_mask_empmr field in domain_cfg file. Has no values > 0 so no closed seas empmr mappings defined.')
+               ENDIF
+            ELSE 
+               IF( lwp ) WRITE(numout,*) 'closea_mask_empmr field not found in domain_cfg file. No closed seas empmr mappings defined.'
+               jncse = 0
             ENDIF
-         ELSE 
-            IF( lwp ) WRITE(numout,*) 'closea_mask_empmr field not found in domain_cfg file. No closed seas empmr mappings defined.'
-            jncse = 0
-         ENDIF
-
-      ENDIF ! l_sbc_clo
-      !
-      CALL iom_close( inum )
+
+         ENDIF ! l_sbc_clo
+         !
+         CALL iom_close( inum )
+         !
+      ELSE ! ln_read_cfg = .false. so no domain_cfg file
+         IF( lwp ) WRITE(numout,*) 'No domain_cfg file so no closed seas defined.'
+         l_sbc_clo = .false.
+         l_clo_rnf = .false.
+      ENDIF
       !
    END SUBROUTINE dom_clo
@@ -447,17 +455,25 @@
       ENDIF
       !
-      CALL iom_open( cn_domcfg, inum )
-      !
-      id = iom_varid(inum, 'closea_mask', ldstop = .false.)      
-      IF( id > 0 ) THEN
-         IF( lwp ) WRITE(numout,*) 'Suppressing closed seas in bathymetry based on closea_mask field,'
-         CALL iom_get ( inum, jpdom_data, 'closea_mask', zdata_in )
-         closea_mask(:,:) = NINT(zdata_in(:,:))
-         WHERE( closea_mask(:,:) > 0 )
-            k_top(:,:) = 0   
-            k_bot(:,:) = 0   
-         ENDWHERE
+      IF( ln_read_cfg ) THEN
+         !
+         CALL iom_open( cn_domcfg, inum )
+         !
+         id = iom_varid(inum, 'closea_mask', ldstop = .false.)      
+         IF( id > 0 ) THEN
+            IF( lwp ) WRITE(numout,*) 'Suppressing closed seas in bathymetry based on closea_mask field,'
+            CALL iom_get ( inum, jpdom_data, 'closea_mask', zdata_in )
+            closea_mask(:,:) = NINT(zdata_in(:,:))
+            WHERE( closea_mask(:,:) > 0 )
+               k_top(:,:) = 0   
+               k_bot(:,:) = 0   
+            ENDWHERE
+         ELSE
+            IF( lwp ) WRITE(numout,*) 'No closea_mask field found in domain_cfg file. No suppression of closed seas.'
+         ENDIF
+         !
+         CALL iom_close(inum)
+         !
       ELSE
-         IF( lwp ) WRITE(numout,*) 'No closea_mask field found in domain_cfg file. No suppression of closed seas.'
+         IF( lwp ) WRITE(numout,*) 'No domain_cfg file => no suppression of closed seas.'
       ENDIF
       !
@@ -466,6 +482,4 @@
       l_clo_rnf = .false.
       !
-      CALL iom_close(inum)
-      !
    END SUBROUTINE clo_bat
 
Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 9208)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 9209)
@@ -120,5 +120,5 @@
       CALL dom_zgr( ik_top, ik_bot )   ! Vertical mesh and bathymetry
       CALL dom_msk( ik_top, ik_bot )   ! Masks
-      IF( ln_closea .AND. ln_read_cfg )   CALL dom_clo   ! ln_closea=T : closed seas included in the simulation
+      IF( ln_closea )   CALL dom_clo   ! ln_closea=T : closed seas included in the simulation
                                        ! Read in masks to define closed seas and lakes 
       !
Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 9208)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 9209)
@@ -96,8 +96,4 @@
             &              k_top   , k_bot            )                  ! 1st & last ocean level
             !
-         ! Any closed seas (defined by closea_mask > 0 in domain_cfg file) to be filled 
-         ! in at runtime if ln_closea=.false.
-         IF( .NOT.ln_closea )   CALL clo_bat( k_top, k_bot )
-         !
       ELSE                          !==  User defined configuration  ==!
          IF(lwp) WRITE(numout,*)
@@ -119,4 +115,8 @@
          gde3w_0(:,:,jk) = gde3w_0(:,:,jk-1) + e3w_0(:,:,jk)
       END DO
+      !
+      ! Any closed seas (defined by closea_mask > 0 in domain_cfg file) to be filled 
+      ! in at runtime if ln_closea=.false.
+      IF( .NOT.ln_closea )   CALL clo_bat( k_top, k_bot )
       !
       IF(lwp) THEN                     ! Control print
Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90	(revision 9208)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90	(revision 9209)
@@ -249,5 +249,5 @@
          cl_namcfg  = 'namdrg_bot  in configuration namelist'
          cl_file    = 'bfr_coef.nc'
-         cl_varname = 'tfr_coef'
+         cl_varname = 'bfr_coef'
       CASE DEFAULT
          CALL ctl_stop( 'drg_init: bad value for cd_topbot ' )
