Index: NEMO/branches/2019/dev_r11943_MERGE_2019/CHANGES.rst
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/CHANGES.rst	(revision 11960)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/CHANGES.rst	(revision 11960)
@@ -0,0 +1,7 @@
+*******
+Changes
+*******
+
+.. todo::
+
+   List the main additions of the the new release
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/RELEASE_NOTES.rst
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/RELEASE_NOTES.rst	(revision 11959)
+++ 	(revision )
@@ -1,129 +1,0 @@
-*************
-Release Notes
-*************
-
-New sea-ice component SI3 (in place of LIMx)
-============================================
-
-- Physics
-
-  - Lateral melting
-  - Melt ponds: constant or :doi:`Holland et al. 2012<10.1175/JCLI-D-11-00078.1>` formulation (and soon topographic melt ponds)
-  - Ice-atm. drags from :doi:`Lupkes et al. 2012<10.1029/2012JD017630>` (depending on ice concentration) or :doi:`Lupkes et al. 2015<10.1002/2014JD022418>` (depending on sea ice concentration and atm. stability)
-  - Landfast ice (:doi:`Lemieux et al. 2016<10.1002/2016JC012006>`)
-
-- Numerics
-
-  - Advection: Ultimate-Macho scheme
-  - Rheology: adaptive EVP (:doi:`Kimmritz et al. 2017<10.1016/j.ocemod.2016.03.004>`)
-  - Coupling interface: conductivity as surface forcing instead of heat fluxes (Met Office requirement)
-
-- Performance: all thermodynamics in 1D and reduced mpp communications
-- Usability (users & developers friendly)
-
-  - Comprehensive set of outputs (universal units and understandable names + includes CMIP)
-  - New architecture and namelist
-  - All processes can be decoupled from each other (switch on/off)
-  - Ice categories bounds can be defined by the user or set automatically
-  - For open boundaries, the number of ice categories from the forcing model can be different from the number of categories in the regional simulation
-  - Fully compatible with AGRIF_
-  - Revised documentation 
-
-AGRIF for embedded zooms
-========================
-
-- Now compatible with new sea ice component
-- Now compatible with z* coordinate
-- Extended ghost cells area to properly handle scheme with spatial order >2
-- Added vertical refinement (beta)
-- Nesting tools for setup now up to date and working 
-
-Enhancements
-============
-
-- Fix for tracer conservation with split explicit free surface
-- Bulk formulae : move to aerobulk package (:doi:`Brodeau et al. 2016<10.1175/JPO-D-16-0169.1>`), i.e. NCAR, COARE and ECMWF bulk (remove Clio and MFS bulk)
-- Wetting and drying
-- Added tidal self attraction and loading either read from a file or from usual "scalar" approximation
-- Add a 4th order centered (CEN) and Flux Corrected Transport (FCT) tracer advection
-  (using a 4th compact in the vertical)
-- iso-neutral mixing (iso and triad operators):
-  add the Method of Stabilizing Correction (MSC) (more accurate calculation) + add a bilaplacian case
-- Lateral physics (``LDF``): scale aware setting of eddy viscosity and diffusivity
-- Vorticity: 2 new energy conserving scheme: ENT with Coriolis defined at T-point (better for Flux form) and EET a variant of EEN where e3t is used instead of e3f (solved the issue with e3f specification but is not enstrophy conserving) 
-
-Test Cases
-==========
-
-The first test cases available for now are:
-
-- ``CANAL``: east-west periodic canal of variable size with several initial states and associated geostrophic currents (zonal jets or vortex)
-- ``ICE_AGRIF``: east-west + north-south periodic channel. The common configuration includes an AGRIF zoom (1:3) in the middle of the basin to test how an ice patch is advected through it but one can also test the advection schemes (Prather and Ultimate-Macho) by removing the ``key_agrif`` in the cpp keys
-- ``ISOMIP``: simple box configuration with an ice shelf with simple geometry on top. The purpose of this test case is to evaluate the impact of various schemes and new development with iceshelf cavities. The exact original setup is described ​here
-- ``LOCK-EXCHANGE``: classical fluid dynamics experiment that has been adapted by Haidvogel and Beckmann (1999) for testing advection schemes in ocean circulation models. It has been used by several authors including Burchard and Bolding (2002) and :doi:`Ilıcak et al. (2012)<10.1016/j.ocemod.2011.10.003>`. The ``LOCK EXCHANGE`` experiment can in particular illustrate the impact of different choices of numerical schemes and/or subgrid closures on spurious interior mixing
-- ``OVERFLOW``: illustrates the impact of different choices of numerical schemes and/or subgrid closures on spurious interior mixing close to bottom topography. It is adapted from the non-rotating overflow configuration described in Haidvogel and Beckmann (1999) and further used by :doi:`Ilıcak et al. (2012)<10.1016/j.ocemod.2011.10.003>`
-- ``VORTEX``: illustrates the propagation of an anticyclonic eddy over a Beta plan and flat bottom. It is implemented here with an online refined subdomain (thanks to ``AGRIF`` library) out of which the vortex propagates. It serves as a benchmark to diagnose nesting errors as in :doi:`Debreu et al. (2012)<10.1016/j.ocemod.2012.03.003>`, :doi:`Penven et al. (2006)<10.1016/j.ocemod.2005.05.002>` and :doi:`Spall and Holland (1991)<10.1175/1520-0485(1991)021<0205:ANPEMF>2.0.CO;2>`
-- ``WAD``: a set of simple closed basin geometries for testing the wetting and drying capabilities. Examples range from a closed channel with EW linear bottom slope to a parabolic EW channel with a Gaussian ridge
-
-New Reference configurations
-============================
-
-``AGRIF_DEMO``: 2 interlocked zooms (1:4 & 1:3) in the Nordic Seas + 1 zoom (1:1) at the equator
-
-``SPITZ12``: regional configuration around the Svalbard archipelago 
-
-Wave coupling
-=============
-
-Coupled interface to external wave model
-
-Large scale wave interaction process added in momentum and tracer equations 
-
-Passive tracer TOP and biogeochemical PISCES components
-=======================================================
-
-- The passive tracers transport component was redesigned toward a modular structure and users can enable each module directly through logical flags in namelist_top (no more fortran macros!)
-- :doc:`TOP on-line user documentation<tracers>`
-- TOP currently accounts for the following 5 modules: ``CFC`` contains inorganic carbon tracers (CFC11/CFC12/SF6), ``MY_TRC`` is a template for new modules (or external couplings), ``AGE`` deals with water age tracking, ``C14`` as a radiocarbon passive tracer, and the companion ecosystem model ``PISCES``
-- A generalized infrastructure was developed to handle the prescription of either surface, coastal, or open boundaries conditions for each passive tracer
-- A new configuration, named ``ORCA2_OFF_TRC``, was created to provide a benchmark simulation environment to deal with inert carbon tracers dynamics by exploiting the offline coupling with NEMO
-- PISCES model contains new developments and modifications:
-
-  - Particulate Organic Carbon (POC) component comes with a new liability scheme, while the former Kriest parametrisation was superseded
-  - A complex iron chemistry scheme is now available, with an improved description of ligands for the marine iron cycle
-  - Carbonate chemistry is based on MOCSY 2.0 routines (see :doi:`10.5194/gmd-8-485-2015 <Orr and Epitalon, 2015>`), by complying also with CMIP6 standards
-  - Ecosystem components can be optionally modelled by means of explicit nutrient quotas (PISCES-QUOTA) 
-
-High Performance Computing (HPC): performances improvements
-===========================================================
-
-- Reduce number of MPI communications
-  (suppression of redundant communications, gather multiple communications into one)
-- Use of MPI-3 asynchronous routines for performance (use ``key_mpi2`` if MPI-3 not available)
-- Back to standard dynamical allocation (remove of wrk_alloc/dealloc statements)
-- :xios:`XIOS software<>` for IOs version 2.5 as default, and optionally available for restarts 
-
-Simplification and robustness
-=============================
-
-- Revised structure of ``namelist_ref`` / ``namelist_cfg`` and default reference values
-- Lateral physics (``LDF``): simplification of user interface and removal of CPP keys
-- Vertical physics (``ZDF``) (modularity, share shear production calculation between TKE and GKS, removal of all ZDF CPP keys, removal of ``avmu`` & ``avmv``, minimization of MPP comm.: ~15 removed)
-- Remove the split-explicit ZDF scheme for both ``TRA`` and ``DYN``
-- Remove the acceleration of convergence
-- Generalised ``lbc_lnk`` and ``lbc_nfd``
-- Unify mppini
-- Use non uniform jpi/jpj with dynamic allocation to avoid ghost rows/columns
-- MPI Message passing re coded
-- Configuration interface completely rewritten (``DOM`` module mainly suppressed , and in place: ``domain_cfg.nc`` file, or ``usr_def`` module) 
-
-Collaborative Development Environment
-=====================================
-
-- Access to information on wiki reorganised through portals for users/developers/System Team and complete refactoring of all pages and their layout
-- Reorganisation of SVN repository to be compliant with usual directory tree and facilitate building of the executable
-- Define and install a separate repository for test cases to all easy contributions from the community
-- :forge:`Forums<discussion>` created
-- :website:`Public web site<>` has been revamped and cleaned using Wordpress
-- New mailing lists have been set up
-- Improvements of reliability through automatic and regular testing of the changes made in repository 
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/C1D_PAPA/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/C1D_PAPA/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/C1D_PAPA/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -61,5 +61,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icealb.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icealb.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icealb.F90	(revision 11960)
@@ -190,8 +190,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namalb in reference namelist : Albedo parameters
       READ  ( numnam_ice_ref, namalb, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namalb in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namalb in configuration namelist : Albedo parameters
       READ  ( numnam_ice_cfg, namalb, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namalb in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedia.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedia.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedia.F90	(revision 11960)
@@ -178,8 +178,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )      ! Namelist namdia in reference namelist : Parameters for ice
       READ  ( numnam_ice_ref, namdia, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdia in reference namelist' )
-      REWIND( numnam_ice_cfg )      ! Namelist namdia in configuration namelist : Parameters for ice
       READ  ( numnam_ice_cfg, namdia, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdia in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn.F90	(revision 11960)
@@ -225,8 +225,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )         ! Namelist namdyn in reference namelist : Ice dynamics
       READ  ( numnam_ice_ref, namdyn, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn in reference namelist' )
-      REWIND( numnam_ice_cfg )         ! Namelist namdyn in configuration namelist : Ice dynamics
       READ  ( numnam_ice_cfg, namdyn, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_adv.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_adv.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_adv.F90	(revision 11960)
@@ -131,8 +131,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )         ! Namelist namdyn_adv in reference namelist : Ice dynamics
       READ  ( numnam_ice_ref, namdyn_adv, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_adv in reference namelist' )
-      REWIND( numnam_ice_cfg )         ! Namelist namdyn_adv in configuration namelist : Ice dynamics
       READ  ( numnam_ice_cfg, namdyn_adv, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_rdgrft.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_rdgrft.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_rdgrft.F90	(revision 11960)
@@ -908,8 +908,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namicetdme in reference namelist : Ice mechanical ice redistribution
       READ  ( numnam_ice_ref, namdyn_rdgrft, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_rdgrft in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namdyn_rdgrft in configuration namelist : Ice mechanical ice redistribution
       READ  ( numnam_ice_cfg, namdyn_rdgrft, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_rdgrft in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_rhg.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_rhg.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icedyn_rhg.F90	(revision 11960)
@@ -112,8 +112,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )         ! Namelist namdyn_rhg in reference namelist : Ice dynamics
       READ  ( numnam_ice_ref, namdyn_rhg, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_rhg in reference namelist' )
-      REWIND( numnam_ice_cfg )         ! Namelist namdyn_rhg in configuration namelist : Ice dynamics
       READ  ( numnam_ice_cfg, namdyn_rhg, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namdyn_rhg in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/iceistate.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/iceistate.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/iceistate.F90	(revision 11960)
@@ -475,8 +475,6 @@
       !!-----------------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namini in reference namelist : Ice initial state
       READ  ( numnam_ice_ref, namini, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namini in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namini in configuration namelist : Ice initial state
       READ  ( numnam_ice_cfg, namini, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namini in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/iceitd.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/iceitd.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/iceitd.F90	(revision 11960)
@@ -686,8 +686,6 @@
       !!------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )      ! Namelist namitd in reference namelist : Parameters for ice
       READ  ( numnam_ice_ref, namitd, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namitd in reference namelist' )
-      REWIND( numnam_ice_cfg )      ! Namelist namitd in configuration namelist : Parameters for ice
       READ  ( numnam_ice_cfg, namitd, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namitd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icesbc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icesbc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icesbc.F90	(revision 11960)
@@ -284,8 +284,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )         ! Namelist namsbc in reference namelist : Ice dynamics
       READ  ( numnam_ice_ref, namsbc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in reference namelist' )
-      REWIND( numnam_ice_cfg )         ! Namelist namsbc in configuration namelist : Ice dynamics
       READ  ( numnam_ice_cfg, namsbc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icestp.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icestp.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icestp.F90	(revision 11960)
@@ -235,8 +235,8 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~~'
       !
-      !                                ! Open the reference and configuration namelist files and namelist output file
-      CALL ctl_opn( numnam_ice_ref, 'namelist_ice_ref',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-      CALL ctl_opn( numnam_ice_cfg, 'namelist_ice_cfg',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-      IF(lwm) CALL ctl_opn( numoni, 'output.namelist.ice', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, 1 )
+      !                                ! Load the reference and configuration namelist files and open namelist output file
+      CALL load_nml( numnam_ice_ref, 'namelist_ice_ref',    numout, lwm )
+      CALL load_nml( numnam_ice_cfg, 'namelist_ice_cfg',    numout, lwm )
+      IF(lwm) CALL ctl_opn( numoni , 'output.namelist.ice', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, 1 )
       !
       CALL par_init                ! set some ice run parameters
@@ -304,8 +304,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )      ! Namelist nampar in reference namelist : Parameters for ice
       READ  ( numnam_ice_ref, nampar, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampar in reference namelist' )
-      REWIND( numnam_ice_cfg )      ! Namelist nampar in configuration namelist : Parameters for ice
       READ  ( numnam_ice_cfg, nampar, IOSTAT = ios, ERR = 902 )
 902   IF( ios > 0 )   CALL ctl_nam ( ios , 'nampar in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd.F90	(revision 11960)
@@ -539,8 +539,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namthd in reference namelist : Ice thermodynamics
       READ  ( numnam_ice_ref, namthd, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namthd in configuration namelist : Ice thermodynamics
       READ  ( numnam_ice_cfg, namthd, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_da.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_da.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_da.F90	(revision 11960)
@@ -177,8 +177,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namthd_da in reference namelist : Ice thermodynamics
       READ  ( numnam_ice_ref, namthd_da, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd_da in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namthd_da in configuration namelist : Ice thermodynamics
       READ  ( numnam_ice_cfg, namthd_da, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd_da in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_do.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_do.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_do.F90	(revision 11960)
@@ -443,8 +443,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namthd_do in reference namelist : Ice thermodynamics
       READ  ( numnam_ice_ref, namthd_do, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd_do in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namthd_do in configuration namelist : Ice thermodynamics
       READ  ( numnam_ice_cfg, namthd_do, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd_do in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_pnd.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_pnd.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_pnd.F90	(revision 11960)
@@ -208,8 +208,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namthd_pnd  in reference namelist : Melt Ponds  
       READ  ( numnam_ice_ref, namthd_pnd, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd_pnd  in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namthd_pnd  in configuration namelist : Melt Ponds
       READ  ( numnam_ice_cfg, namthd_pnd, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd_pnd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_sal.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_sal.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_sal.F90	(revision 11960)
@@ -132,8 +132,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namthd_sal in reference namelist : Ice salinity
       READ  ( numnam_ice_ref, namthd_sal, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd_sal in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namthd_sal in configuration namelist : Ice salinity
       READ  ( numnam_ice_cfg, namthd_sal, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd_sal in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_zdf.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_zdf.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icethd_zdf.F90	(revision 11960)
@@ -88,8 +88,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namthd_zdf in reference namelist : Ice thermodynamics
       READ  ( numnam_ice_ref, namthd_zdf, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd_zdf in reference namelist' )
-      REWIND( numnam_ice_cfg )              ! Namelist namthd_zdf in configuration namelist : Ice thermodynamics
       READ  ( numnam_ice_cfg, namthd_zdf, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd_zdf in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/NST/agrif_user.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/NST/agrif_user.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/NST/agrif_user.F90	(revision 11960)
@@ -709,8 +709,6 @@
       !!--------------------------------------------------------------------------------------
    !
-   REWIND( numnam_ref )              ! Namelist namagrif in reference namelist : AGRIF zoom
    READ  ( numnam_ref, namagrif, IOSTAT = ios, ERR = 901)
 901 IF( ios /= 0 )   CALL ctl_nam ( ios , 'namagrif in reference namelist' )
-   REWIND( numnam_cfg )              ! Namelist namagrif in configuration namelist : AGRIF zoom
    READ  ( numnam_cfg, namagrif, IOSTAT = ios, ERR = 902 )
 902 IF( ios >  0 )   CALL ctl_nam ( ios , 'namagrif in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ASM/asminc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ASM/asminc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ASM/asminc.F90	(revision 11960)
@@ -147,8 +147,6 @@
       ln_temnofreeze = .FALSE.
 
-      REWIND( numnam_ref )              ! Namelist nam_asminc in reference namelist : Assimilation increment
       READ  ( numnam_ref, nam_asminc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_asminc in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nam_asminc in configuration namelist : Assimilation increment
       READ  ( numnam_cfg, nam_asminc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_asminc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdydta.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdydta.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdydta.F90	(revision 11960)
@@ -373,4 +373,6 @@
       INTEGER ::   ierror, ios     ! 
       !
+      INTEGER ::   nbdy_rdstart, nbdy_loc
+      CHARACTER(LEN=50)                      ::   cerrmsg       ! error string
       CHARACTER(len=3)                       ::   cl3           ! 
       CHARACTER(len=100)                     ::   cn_dir        ! Root directory for location of data files
@@ -415,5 +417,5 @@
       ! Read namelists
       ! --------------
-      REWIND(numnam_cfg)
+      nbdy_rdstart = 1
       DO jbdy = 1, nb_bdy
 
@@ -421,6 +423,5 @@
          WRITE(ctmp2, '(a,i2)') 'block nambdy_dta number ', jbdy
 
-         ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we do a rewind 
-         REWIND(numnam_ref)
+         ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we read from the beginning
          READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901)
 901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in reference namelist' )
@@ -431,6 +432,19 @@
             & .OR. ( dta_bdy(jbdy)%lneed_tra   .AND.       nn_tra_dta(jbdy)    == 1 )   &
             & .OR. ( dta_bdy(jbdy)%lneed_ice   .AND.       nn_ice_dta(jbdy)    == 1 )   )   THEN
-            ! WARNING: we don't do a rewind here, each bdy reads its own nambdy_dta block one after another
-            READ  ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 )
+            !
+            ! Need to support possibility of reading more than one
+            ! nambdy_dta from the namelist_cfg internal file.
+            ! Do this by finding the jbdy'th occurence of nambdy_dta in the
+            ! character buffer as the starting point.
+            !
+            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_dta' )
+            IF( nbdy_loc .GT. 0 ) THEN
+               nbdy_rdstart = nbdy_rdstart + nbdy_loc
+            ELSE
+               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',jbdy,' of nambdy_dta not found'
+               ios = -1
+               CALL ctl_nam ( ios , cerrmsg )
+            ENDIF
+            READ  ( numnam_cfg( MAX( 1, nbdy_rdstart - 2 ): ), nambdy_dta, IOSTAT = ios, ERR = 902)
 902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist' )
             IF(lwm) WRITE( numond, nambdy_dta )           
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdyini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdyini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdyini.F90	(revision 11960)
@@ -75,5 +75,4 @@
       ! Read namelist parameters
       ! ------------------------
-      REWIND( numnam_ref )              ! Namelist nambdy in reference namelist :Unstructured open boundaries
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist' )
@@ -93,5 +92,4 @@
       cn_ice         (2:jp_bdy) = cn_ice         (1)
       nn_ice_dta     (2:jp_bdy) = nn_ice_dta     (1)
-      REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries
       READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist' )
@@ -364,5 +362,4 @@
       ! -------------------------------------------------
 
-      REWIND( numnam_cfg )     
       nblendta(:,:) = 0
       nbdysege = 0
@@ -1079,12 +1076,26 @@
       INTEGER          ::   ios                 ! Local integer output status for namelist read
       INTEGER          ::   nbdyind, nbdybeg, nbdyend
+      INTEGER          ::   nbdy_count, nbdy_rdstart, nbdy_loc
       CHARACTER(LEN=1) ::   ctypebdy   !     -        - 
+      CHARACTER(LEN=50)::   cerrmsg    !     -        - 
       NAMELIST/nambdy_index/ ctypebdy, nbdyind, nbdybeg, nbdyend
       !!----------------------------------------------------------------------
-
-      ! No REWIND here because may need to read more than one nambdy_index namelist.
-      ! Read only namelist_cfg to avoid unseccessfull overwrite 
-      ! keep full control of the configuration namelist
-      READ  ( numnam_cfg, nambdy_index, IOSTAT = ios, ERR = 904 )
+      ! Need to support possibility of reading more than one nambdy_index from
+      ! the namelist_cfg internal file.
+      ! Do this by finding the kb_bdy'th occurence of nambdy_index in the
+      ! character buffer as the starting point.
+      nbdy_rdstart = 1
+      DO nbdy_count = 1, kb_bdy
+       nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_index' )
+       IF( nbdy_loc .GT. 0 ) THEN
+          nbdy_rdstart = nbdy_rdstart + nbdy_loc
+       ELSE
+          WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',kb_bdy,' of nambdy_index not found'
+          ios = -1
+          CALL ctl_nam ( ios , cerrmsg )
+       ENDIF
+      END DO
+      nbdy_rdstart = MAX( 1, nbdy_rdstart - 2 )
+      READ  ( numnam_cfg( nbdy_rdstart: ), nambdy_index, IOSTAT = ios, ERR = 904)
 904   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_index in configuration namelist' )
       IF(lwm) WRITE ( numond, nambdy_index )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdytides.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdytides.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/BDY/bdytides.F90	(revision 11960)
@@ -71,4 +71,6 @@
       INTEGER, DIMENSION(3)                     ::   ilen0       !: length of boundary data (from OBC arrays)
       INTEGER                                   ::   ios                 ! Local integer output status for namelist read
+      INTEGER                                   ::   nbdy_rdstart, nbdy_loc
+      CHARACTER(LEN=50)                         ::   cerrmsg             !: error string
       CHARACTER(len=80)                         ::   clfile              !: full file name for tidal input file 
       REAL(wp),ALLOCATABLE, DIMENSION(:,:,:)    ::   dta_read            !: work space to read in tidal harmonics data
@@ -84,6 +86,6 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
 
-      REWIND(numnam_cfg)
-
+
+      nbdy_rdstart = 1
       DO ib_bdy = 1, nb_bdy
          IF( nn_dyn2d_dta(ib_bdy) >= 2 ) THEN
@@ -94,9 +96,21 @@
             filtide(:) = ''
 
-            REWIND( numnam_ref )
             READ  ( numnam_ref, nambdy_tide, IOSTAT = ios, ERR = 901)
 901         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_tide in reference namelist' )
-            ! Don't REWIND here - may need to read more than one of these namelists. 
-            READ  ( numnam_cfg, nambdy_tide, IOSTAT = ios, ERR = 902 )
+            !
+            ! Need to support possibility of reading more than one
+            ! nambdy_tide from the namelist_cfg internal file.
+            ! Do this by finding the ib_bdy'th occurence of nambdy_tide in the
+            ! character buffer as the starting point.
+            !
+            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_tide' )
+            IF( nbdy_loc .GT. 0 ) THEN
+               nbdy_rdstart = nbdy_rdstart + nbdy_loc
+            ELSE
+               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',ib_bdy,' of nambdy_tide not found'
+               ios = -1
+               CALL ctl_nam ( ios , cerrmsg )
+            ENDIF
+            READ  ( numnam_cfg( MAX( 1, nbdy_rdstart - 2 ): ), nambdy_tide, IOSTAT = ios, ERR = 902)
 902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_tide in configuration namelist' )
             IF(lwm) WRITE ( numond, nambdy_tide )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/c1d.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/c1d.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/c1d.F90	(revision 11960)
@@ -50,9 +50,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namc1d in reference namelist : Tracer advection scheme
       READ  ( numnam_ref, namc1d, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namtra_adv in configuration namelist : Tracer advection scheme
       READ  ( numnam_cfg, namc1d, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc1d in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/dtauvd.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/dtauvd.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/dtauvd.F90	(revision 11960)
@@ -60,9 +60,7 @@
       ierr0 = 0   ;   ierr1 = 0   ;   ierr2 = 0  ;   ierr3 = 0
 
-      REWIND( numnam_ref )              ! Namelist namc1d_uvd in reference namelist : 
       READ  ( numnam_ref, namc1d_uvd, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_uvd in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namc1d_uvd in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namc1d_uvd, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc1d_uvd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/dyndmp.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/dyndmp.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/C1D/dyndmp.F90	(revision 11960)
@@ -79,8 +79,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namc1d_dyndmp in reference namelist : 
       READ  ( numnam_ref, namc1d_dyndmp, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namc1d_dyndmp in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namc1d_dyndmp, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/CRS/crsini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/CRS/crsini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/CRS/crsini.F90	(revision 11960)
@@ -82,8 +82,6 @@
      !---------------------------------------------------------
      !
-      REWIND( numnam_ref )              ! Namelist namrun in reference namelist : Parameters of the run
       READ  ( numnam_ref, namcrs, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcrs in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namrun in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namcrs, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcrs in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/dia25h.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/dia25h.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/dia25h.F90	(revision 11960)
@@ -55,8 +55,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND ( numnam_ref )              ! Read Namelist nam_dia25h in reference namelist : 25hour mean diagnostics
       READ   ( numnam_ref, nam_dia25h, IOSTAT=ios, ERR= 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_dia25h in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nam_dia25h in configuration namelist  25hour diagnostics
       READ  ( numnam_cfg, nam_dia25h, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_dia25h in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diadct.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diadct.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diadct.F90	(revision 11960)
@@ -123,9 +123,7 @@
       !!---------------------------------------------------------------------
 
-     REWIND( numnam_ref )              ! Namelist nam_diadct in reference namelist : Diagnostic: transport through sections
      READ  ( numnam_ref, nam_diadct, IOSTAT = ios, ERR = 901)
 901  IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diadct in reference namelist' )
 
-     REWIND( numnam_cfg )              ! Namelist nam_diadct in configuration namelist : Diagnostic: transport through sections
      READ  ( numnam_cfg, nam_diadct, IOSTAT = ios, ERR = 902 )
 902  IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_diadct in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diaharm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diaharm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diaharm.F90	(revision 11960)
@@ -79,8 +79,6 @@
       ENDIF
       !
-      REWIND( numnam_ref )              ! Namelist nam_diaharm in reference namelist : Tidal harmonic analysis
       READ  ( numnam_ref, nam_diaharm, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_diaharm in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nam_diaharm in configuration namelist : Tidal harmonic analysis
       READ  ( numnam_cfg, nam_diaharm, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_diaharm in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diahsb.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diahsb.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diahsb.F90	(revision 11960)
@@ -364,8 +364,6 @@
          WRITE(numout,*) '~~~~~~~~~~~~ '
       ENDIF
-      REWIND( numnam_ref )              ! Namelist namhsb in reference namelist
       READ  ( numnam_ref, namhsb, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namhsb in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namhsb in configuration namelist
       READ  ( numnam_cfg, namhsb, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namhsb in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diaptr.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diaptr.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diaptr.F90	(revision 11960)
@@ -392,9 +392,7 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnam_ref )              ! Namelist namptr in reference namelist : Poleward transport
       READ  ( numnam_ref, namptr, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namptr in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namptr in configuration namelist : Poleward transport
       READ  ( numnam_cfg, namptr, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namptr in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diatmb.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diatmb.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diatmb.F90	(revision 11960)
@@ -41,9 +41,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Read Namelist nam_diatmb in reference namelist : TMB diagnostics
       READ  ( numnam_ref, nam_diatmb, IOSTAT=ios, ERR= 901 )
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diatmb in reference namelist' )
  
-      REWIND( numnam_cfg )              ! Namelist nam_diatmb in configuration namelist  TMB diagnostics
       READ  ( numnam_cfg, nam_diatmb, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_diatmb in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIU/diu_bulk.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIU/diu_bulk.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIU/diu_bulk.F90	(revision 11960)
@@ -52,8 +52,6 @@
 
       ! Read the namelist
-      REWIND( numnam_ref )
       READ  ( numnam_ref, namdiu, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdiu in reference namelist' )
-      REWIND( numnam_cfg )
       READ  ( numnam_cfg, namdiu, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdiu in configuration namelist' )      
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/domain.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/domain.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/domain.F90	(revision 11960)
@@ -308,8 +308,6 @@
       !
       !
-      REWIND( numnam_ref )              ! Namelist namrun in reference namelist : Parameters of the run
       READ  ( numnam_ref, namrun, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namrun in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namrun in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namrun, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namrun in configuration namelist' )
@@ -406,8 +404,6 @@
 #endif
 
-      REWIND( numnam_ref )              ! Namelist namdom in reference namelist : space & time domain (bathymetry, mesh, timestep)
       READ  ( numnam_ref, namdom, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdom in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namdom in configuration namelist : space & time domain (bathymetry, mesh, timestep)
       READ  ( numnam_cfg, namdom, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdom in configuration namelist' )
@@ -438,8 +434,6 @@
 #if defined key_netcdf4
       !                             ! NetCDF 4 case   ("key_netcdf4" defined)
-      REWIND( numnam_ref )              ! Namelist namnc4 in reference namelist : NETCDF
       READ  ( numnam_ref, namnc4, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namnc4 in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namnc4 in configuration namelist : NETCDF
       READ  ( numnam_cfg, namnc4, IOSTAT = ios, ERR = 908 )
 908   IF( ios >  0 )   CALL ctl_nam ( ios , 'namnc4 in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/dommsk.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/dommsk.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/dommsk.F90	(revision 11960)
@@ -103,8 +103,6 @@
       !!---------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namlbc in reference namelist : Lateral momentum boundary condition
       READ  ( numnam_ref, namlbc, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlbc in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namlbc in configuration namelist : Lateral momentum boundary condition
       READ  ( numnam_cfg, namlbc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlbc in configuration namelist' )
@@ -148,8 +146,6 @@
 
      ! Mask corrections for bdy (read in mppini2)
-      REWIND( numnam_ref )              ! Namelist nambdy in reference namelist :Unstructured open boundaries
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries
       READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/domvvl.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/domvvl.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/domvvl.F90	(revision 11960)
@@ -987,8 +987,6 @@
       !!---------------------------------------------------------------------- 
       !
-      REWIND( numnam_ref )              ! Namelist nam_vvl in reference namelist : 
       READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nam_vvl in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/dtatsd.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/dtatsd.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/dtatsd.F90	(revision 11960)
@@ -65,8 +65,6 @@
       ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0
       !
-      REWIND( numnam_ref )              ! Namelist namtsd in reference namelist : 
       READ  ( numnam_ref, namtsd, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtsd in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namtsd in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namtsd, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtsd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/iscplini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/iscplini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DOM/iscplini.F90	(revision 11960)
@@ -62,8 +62,6 @@
       nn_fiscpl = 0
       ln_hsb    = .FALSE.
-      REWIND( numnam_ref )              ! Namelist namsbc_iscpl in reference namelist : Ice sheet coupling
       READ  ( numnam_ref, namsbc_iscpl, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_iscpl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namsbc_iscpl in configuration namelist : Ice Sheet coupling
       READ  ( numnam_cfg, namsbc_iscpl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_iscpl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynadv.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynadv.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynadv.F90	(revision 11960)
@@ -106,8 +106,6 @@
       ENDIF
       !
-      REWIND( numnam_ref )              ! Namelist namdyn_adv in reference namelist : Momentum advection scheme
       READ  ( numnam_ref, namdyn_adv, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_adv in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namdyn_adv in configuration namelist : Momentum advection scheme
       READ  ( numnam_cfg, namdyn_adv, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynhpg.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynhpg.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynhpg.F90	(revision 11960)
@@ -155,9 +155,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namdyn_hpg in reference namelist : Hydrostatic pressure gradient
       READ  ( numnam_ref, namdyn_hpg, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_hpg in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namdyn_hpg in configuration namelist : Hydrostatic pressure gradient
       READ  ( numnam_cfg, namdyn_hpg, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_hpg in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynspg.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynspg.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynspg.F90	(revision 11960)
@@ -203,9 +203,7 @@
       ENDIF
       !
-      REWIND( numnam_ref )              ! Namelist namdyn_spg in reference namelist : Free surface
       READ  ( numnam_ref, namdyn_spg, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_spg in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namdyn_spg in configuration namelist : Free surface
       READ  ( numnam_cfg, namdyn_spg, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_spg in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynvor.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynvor.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/dynvor.F90	(revision 11960)
@@ -856,8 +856,6 @@
       ENDIF
       !
-      REWIND( numnam_ref )              ! Namelist namdyn_vor in reference namelist : Vorticity scheme options
       READ  ( numnam_ref, namdyn_vor, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_vor in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namdyn_vor in configuration namelist : Vorticity scheme options
       READ  ( numnam_cfg, namdyn_vor, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_vor in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/wet_dry.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/wet_dry.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DYN/wet_dry.F90	(revision 11960)
@@ -79,8 +79,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namwad in reference namelist : Parameters for Wetting/Drying
       READ  ( numnam_ref, namwad, IOSTAT = ios, ERR = 905)
 905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namwad in reference namelist' ) 
-      REWIND( numnam_cfg )              ! Namelist namwad in configuration namelist : Parameters for Wetting/Drying
       READ  ( numnam_cfg, namwad, IOSTAT = ios, ERR = 906)
 906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namwad in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/FLO/floats.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/FLO/floats.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/FLO/floats.F90	(revision 11960)
@@ -89,9 +89,7 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~'
 
-      REWIND( numnam_ref )              ! Namelist namflo in reference namelist : Floats
       READ  ( numnam_ref, namflo, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namflo in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namflo in configuration namelist : Floats
       READ  ( numnam_cfg, namflo, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namflo in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ICB/icbini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ICB/icbini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ICB/icbini.F90	(revision 11960)
@@ -404,8 +404,6 @@
 #endif   
       !                             !==  read namelist  ==!
-      REWIND( numnam_ref )              ! Namelist namberg in reference namelist : Iceberg parameters
       READ  ( numnam_ref, namberg, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namberg in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namberg in configuration namelist : Iceberg parameters
       READ  ( numnam_cfg, namberg, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namberg in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/IOM/in_out_manager.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/IOM/in_out_manager.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/IOM/in_out_manager.F90	(revision 11960)
@@ -139,18 +139,19 @@
    INTEGER ::   numnul          =   -1      !: logical unit for /dev/null
       !                                     !  early output can be collected; do not change
-   INTEGER ::   numnam_ref      =   -1      !: logical unit for reference namelist
-   INTEGER ::   numnam_cfg      =   -1      !: logical unit for configuration specific namelist
    INTEGER ::   numond          =   -1      !: logical unit for Output Namelist Dynamics
-   INTEGER ::   numnam_ice_ref  =   -1      !: logical unit for ice reference namelist
-   INTEGER ::   numnam_ice_cfg  =   -1      !: logical unit for ice reference namelist
    INTEGER ::   numoni          =   -1      !: logical unit for Output Namelist Ice
    INTEGER ::   numevo_ice      =   -1      !: logical unit for ice variables (temp. evolution)
    INTEGER ::   numrun          =   -1      !: logical unit for run statistics
    INTEGER ::   numdct_in       =   -1      !: logical unit for transports computing
-   INTEGER ::   numdct_vol      =   -1      !: logical unit for voulume transports output
-   INTEGER ::   numdct_heat     =   -1      !: logical unit for heat    transports output
-   INTEGER ::   numdct_salt     =   -1      !: logical unit for salt    transports output
+   INTEGER ::   numdct_vol      =   -1      !: logical unit for volume transports output
+   INTEGER ::   numdct_heat     =   -1      !: logical unit for heat   transports output
+   INTEGER ::   numdct_salt     =   -1      !: logical unit for salt   transports output
    INTEGER ::   numfl           =   -1      !: logical unit for floats ascii output
    INTEGER ::   numflo          =   -1      !: logical unit for floats ascii output
+      !
+   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ref      !: character buffer for reference namelist
+   CHARACTER(LEN=:), ALLOCATABLE :: numnam_cfg      !: character buffer for configuration specific namelist
+   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ice_ref  !: character buffer for ice reference namelist
+   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ice_cfg  !: character buffer for ice configuration specific namelist
 
    !!----------------------------------------------------------------------
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LBC/lib_mpp.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LBC/lib_mpp.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LBC/lib_mpp.F90	(revision 11960)
@@ -32,4 +32,5 @@
    !!   ctl_opn       : Open file and check if required file is available.
    !!   ctl_nam       : Prints informations when an error occurs while reading a namelist
+   !!   load_nml      : Read, condense and buffer namelist file into character array for use as an internal file
    !!----------------------------------------------------------------------
    !!----------------------------------------------------------------------
@@ -50,4 +51,5 @@
    !!   mpp_ini_north : initialisation of north fold
    !!   mpp_lbc_north_icb : alternative to mpp_nfd for extra outer halo with icebergs
+   !!   mpp_bcast_nml : broadcast/receive namelist character buffer from reading process to all others
    !!----------------------------------------------------------------------
    USE dom_oce        ! ocean space and time domain
@@ -57,5 +59,5 @@
    PRIVATE
    !
-   PUBLIC   ctl_stop, ctl_warn, ctl_opn, ctl_nam
+   PUBLIC   ctl_stop, ctl_warn, ctl_opn, ctl_nam, load_nml
    PUBLIC   mpp_start, mppstop, mppsync, mpp_comm_free
    PUBLIC   mpp_ini_north
@@ -66,4 +68,5 @@
    PUBLIC   mppsend, mpprecv                          ! needed by TAM and ICB routines
    PUBLIC   mpp_report
+   PUBLIC   mpp_bcast_nml
    PUBLIC   tic_tac
 #if ! defined key_mpp_mpi
@@ -498,4 +501,29 @@
 #endif
    END SUBROUTINE mpp_delay_rcv
+
+   SUBROUTINE mpp_bcast_nml( cdnambuff , kleng )
+      CHARACTER(LEN=:)    , ALLOCATABLE, INTENT(INOUT) :: cdnambuff
+      INTEGER                          , INTENT(INOUT) :: kleng
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_bcast_nml  ***
+      !!
+      !! ** Purpose :   broadcast namelist character buffer
+      !!
+      !!----------------------------------------------------------------------
+      !!
+      INTEGER ::   iflag
+      !!----------------------------------------------------------------------
+      !
+#if defined key_mpp_mpi
+      call MPI_BCAST(kleng, 1, MPI_INT, 0, mpi_comm_oce, iflag)
+      call MPI_BARRIER(mpi_comm_oce, iflag)
+!$AGRIF_DO_NOT_TREAT
+      IF ( .NOT. ALLOCATED(cdnambuff) ) ALLOCATE( CHARACTER(LEN=kleng) :: cdnambuff )
+!$AGRIF_END_DO_NOT_TREAT
+      call MPI_BCAST(cdnambuff, kleng, MPI_CHARACTER, 0, mpi_comm_oce, iflag)
+      call MPI_BARRIER(mpi_comm_oce, iflag)
+#endif
+      !
+   END SUBROUTINE mpp_bcast_nml
 
    
@@ -1066,5 +1094,5 @@
 
    !!----------------------------------------------------------------------
-   !!   ctl_stop, ctl_warn, get_unit, ctl_opn, ctl_nam   routines
+   !!   ctl_stop, ctl_warn, get_unit, ctl_opn, ctl_nam, load_nml   routines
    !!----------------------------------------------------------------------
 
@@ -1277,4 +1305,79 @@
    END FUNCTION get_unit
 
+   SUBROUTINE load_nml( cdnambuff , cdnamfile, kout, ldwp)
+      CHARACTER(LEN=:)    , ALLOCATABLE, INTENT(INOUT) :: cdnambuff
+      CHARACTER(LEN=*), INTENT(IN )                :: cdnamfile
+      CHARACTER(LEN=256)                           :: chline
+      INTEGER, INTENT(IN)                          :: kout
+      LOGICAL, INTENT(IN)                          :: ldwp  !: .true. only for the root broadcaster
+      INTEGER                                      :: itot, iun, iltc, inl, ios, itotsav
+      !
+      ! Check if the namelist buffer has already been allocated. Return if it has.
+      !
+      IF ( ALLOCATED( cdnambuff ) ) RETURN
+      IF( ldwp ) THEN
+         !
+         ! Open namelist file
+         !
+         CALL ctl_opn( iun, cdnamfile, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, kout, ldwp )
+         !
+         ! First pass: count characters excluding comments and trimable white space
+         !
+         itot=0
+     10  READ(iun,'(A256)',END=20,ERR=20) chline
+         iltc = LEN_TRIM(chline)
+         IF ( iltc.GT.0 ) THEN
+          inl = INDEX(chline, '!') 
+          IF( inl.eq.0 ) THEN
+           itot = itot + iltc + 1                                ! +1 for the newline character
+          ELSEIF( inl.GT.0 .AND. LEN_TRIM( chline(1:inl-1) ).GT.0 ) THEN
+           itot = itot + inl                                  !  includes +1 for the newline character
+          ENDIF
+         ENDIF
+         GOTO 10
+     20  CONTINUE
+         !
+         ! Allocate text cdnambuff for condensed namelist
+         !
+!$AGRIF_DO_NOT_TREAT
+         ALLOCATE( CHARACTER(LEN=itot) :: cdnambuff )
+!$AGRIF_END_DO_NOT_TREAT
+         itotsav = itot
+         !
+         ! Second pass: read and transfer pruned characters into cdnambuff
+         !
+         REWIND(iun)
+         itot=1
+     30  READ(iun,'(A256)',END=40,ERR=40) chline
+         iltc = LEN_TRIM(chline)
+         IF ( iltc.GT.0 ) THEN
+          inl = INDEX(chline, '!')
+          IF( inl.eq.0 ) THEN
+           inl = iltc
+          ELSE
+           inl = inl - 1
+          ENDIF
+          IF( inl.GT.0 .AND. LEN_TRIM( chline(1:inl) ).GT.0 ) THEN
+             cdnambuff(itot:itot+inl-1) = chline(1:inl)
+             WRITE( cdnambuff(itot+inl:itot+inl), '(a)' ) NEW_LINE('A')
+             itot = itot + inl + 1
+          ENDIF
+         ENDIF
+         GOTO 30
+     40  CONTINUE
+         itot = itot - 1
+         IF( itotsav .NE. itot ) WRITE(*,*) 'WARNING in load_nml. Allocated ',itotsav,' for read buffer; but used ',itot
+         !
+         ! Close namelist file
+         !
+         CLOSE(iun)
+         !write(*,'(32A)') cdnambuff
+      ENDIF
+#if defined key_mpp_mpi
+      CALL mpp_bcast_nml( cdnambuff, itot )
+#endif
+  END SUBROUTINE load_nml
+
+
    !!----------------------------------------------------------------------
 END MODULE lib_mpp
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LBC/mppini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LBC/mppini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LBC/mppini.F90	(revision 11960)
@@ -176,8 +176,6 @@
       ! -----------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist nammpp in reference namelist
       READ  ( numnam_ref, nammpp, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nammpp in confguration namelist
       READ  ( numnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist' )   
@@ -197,8 +195,6 @@
 
       ! do we need to take into account bdy_msk?
-      REWIND( numnam_ref )              ! Namelist nambdy in reference namelist : BDY
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist (mppini)' )
-      REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist : BDY
       READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist (mppini)' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LDF/ldfdyn.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LDF/ldfdyn.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LDF/ldfdyn.F90	(revision 11960)
@@ -115,9 +115,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namdyn_ldf in reference namelist : Lateral physics
       READ  ( numnam_ref, namdyn_ldf, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_ldf in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namdyn_ldf in configuration namelist : Lateral physics
       READ  ( numnam_cfg, namdyn_ldf, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_ldf in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LDF/ldftra.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LDF/ldftra.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/LDF/ldftra.F90	(revision 11960)
@@ -152,8 +152,6 @@
       ! =================================
       !
-      REWIND( numnam_ref )              ! Namelist namtra_ldf in reference namelist : Lateral physics on tracers
       READ  ( numnam_ref, namtra_ldf, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_ldf in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namtra_ldf in configuration namelist : Lateral physics on tracers
       READ  ( numnam_cfg, namtra_ldf, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_ldf in configuration namelist' )
@@ -511,9 +509,7 @@
       ENDIF
       !
-      REWIND( numnam_ref )              ! Namelist namtra_eiv in reference namelist : eddy induced velocity param.
       READ  ( numnam_ref, namtra_eiv, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_eiv in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namtra_eiv in configuration namelist : eddy induced velocity param.
       READ  ( numnam_cfg, namtra_eiv, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_eiv in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/OBS/diaobs.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/OBS/diaobs.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/OBS/diaobs.F90	(revision 11960)
@@ -202,8 +202,6 @@
 
       ! Read namelist namobs : control observation diagnostics
-      REWIND( numnam_ref )   ! Namelist namobs in reference namelist
       READ  ( numnam_ref, namobs, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namobs in reference namelist' )
-      REWIND( numnam_cfg )   ! Namelist namobs in configuration namelist
       READ  ( numnam_cfg, namobs, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namobs in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcapr.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcapr.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcapr.F90	(revision 11960)
@@ -69,9 +69,7 @@
       NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc
       !!----------------------------------------------------------------------
-      REWIND( numnam_ref )              ! Namelist namsbc_apr in reference namelist : File for atmospheric pressure forcing
       READ  ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_apr in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namsbc_apr in configuration namelist : File for atmospheric pressure forcing
       READ  ( numnam_cfg, namsbc_apr, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcblk.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcblk.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcblk.F90	(revision 11960)
@@ -180,9 +180,7 @@
       !
       !                             !** read bulk namelist  
-      REWIND( numnam_ref )                !* Namelist namsbc_blk in reference namelist : bulk parameters
       READ  ( numnam_ref, namsbc_blk, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_blk in reference namelist' )
       !
-      REWIND( numnam_cfg )                !* Namelist namsbc_blk in configuration namelist : bulk parameters
       READ  ( numnam_cfg, namsbc_blk, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_blk in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbccpl.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbccpl.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbccpl.F90	(revision 11960)
@@ -264,9 +264,7 @@
       ! ================================ !
       !
-      REWIND( numnam_ref )              ! Namelist namsbc_cpl in reference namelist : Variables for OASIS coupling
       READ  ( numnam_ref, namsbc_cpl, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_cpl in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namsbc_cpl in configuration namelist : Variables for OASIS coupling
       READ  ( numnam_cfg, namsbc_cpl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_cpl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcflx.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcflx.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcflx.F90	(revision 11960)
@@ -91,9 +91,7 @@
       IF( kt == nit000 ) THEN                ! First call kt=nit000  
          ! set file information
-         REWIND( numnam_ref )              ! Namelist namsbc_flx in reference namelist : Files for fluxes
          READ  ( numnam_ref, namsbc_flx, IOSTAT = ios, ERR = 901)
 901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_flx in reference namelist' )
 
-         REWIND( numnam_cfg )              ! Namelist namsbc_flx in configuration namelist : Files for fluxes
          READ  ( numnam_cfg, namsbc_flx, IOSTAT = ios, ERR = 902 )
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_cice.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_cice.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_cice.F90	(revision 11960)
@@ -763,9 +763,7 @@
          sn_bot5 = FLD_N( 'botmeltn5_1m' ,    -1.    ,  'botmeltn5' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         ,  ''    )
 
-         REWIND( numnam_ref )              ! Namelist namsbc_cice in reference namelist : 
          READ  ( numnam_ref, namsbc_cice, IOSTAT = ios, ERR = 901)
 901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_cice in reference namelist' )
 
-         REWIND( numnam_cfg )              ! Namelist namsbc_cice in configuration namelist : Parameters of the run
          READ  ( numnam_cfg, namsbc_cice, IOSTAT = ios, ERR = 902 )
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_cice in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_if.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_if.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_if.F90	(revision 11960)
@@ -75,9 +75,7 @@
          !                                      ! ====================== !
          ! set file information
-         REWIND( numnam_ref )              ! Namelist namsbc_iif in reference namelist : Ice if file
          READ  ( numnam_ref, namsbc_iif, IOSTAT = ios, ERR = 901)
 901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_iif in reference namelist' )
 
-         REWIND( numnam_cfg )              ! Namelist Namelist namsbc_iif in configuration namelist : Ice if file
          READ  ( numnam_cfg, namsbc_iif, IOSTAT = ios, ERR = 902 )
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_iif in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcisf.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcisf.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcisf.F90	(revision 11960)
@@ -278,9 +278,7 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs 
       READ  ( numnam_ref, namsbc_isf, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_isf in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
       READ  ( numnam_cfg, namsbc_isf, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcmod.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcmod.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcmod.F90	(revision 11960)
@@ -109,8 +109,6 @@
       !
       !                       !**  read Surface Module namelist
-      REWIND( numnam_ref )          !* Namelist namsbc in reference namelist : Surface boundary
       READ  ( numnam_ref, namsbc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in reference namelist' )
-      REWIND( numnam_cfg )          !* Namelist namsbc in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namsbc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcrnf.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcrnf.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcrnf.F90	(revision 11960)
@@ -267,9 +267,7 @@
       !                                   ! ============
       !
-      REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs 
       READ  ( numnam_ref, namsbc_rnf, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_rnf in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
       READ  ( numnam_cfg, namsbc_rnf, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_rnf in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcssr.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcssr.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcssr.F90	(revision 11960)
@@ -164,9 +164,7 @@
       ENDIF
       ! 
-      REWIND( numnam_ref )              ! Namelist namsbc_ssr in reference namelist : 
       READ  ( numnam_ref, namsbc_ssr, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_ssr in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namsbc_ssr in configuration namelist :
       READ  ( numnam_cfg, namsbc_ssr, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_ssr in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcwave.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcwave.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcwave.F90	(revision 11960)
@@ -397,9 +397,7 @@
       !!---------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namsbc_wave in reference namelist : File for drag coeff. from wave model
       READ  ( numnam_ref, namsbc_wave, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_wave in reference namelist' )
          
-      REWIND( numnam_cfg )              ! Namelist namsbc_wave in configuration namelist : File for drag coeff. from wave model
       READ  ( numnam_cfg, namsbc_wave, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_wave in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/tideini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/tideini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/tideini.F90	(revision 11960)
@@ -58,9 +58,7 @@
       !
       ! Read Namelist nam_tide
-      REWIND( numnam_ref )              ! Namelist nam_tide in reference namelist : Tides
       READ  ( numnam_ref, nam_tide, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_tide in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist nam_tide in configuration namelist : Tides
       READ  ( numnam_cfg, nam_tide, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_tide in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/STO/stopar.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/STO/stopar.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/STO/stopar.F90	(revision 11960)
@@ -261,9 +261,7 @@
 
       ! Read namsto namelist : stochastic parameterization
-      REWIND( numnam_ref )              ! Namelist namdyn_adv in reference namelist : Momentum advection scheme
       READ  ( numnam_ref, namsto, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsto in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namdyn_adv in configuration namelist : Momentum advection scheme
       READ  ( numnam_cfg, namsto, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namsto in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/eosbn2.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/eosbn2.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/eosbn2.F90	(revision 11960)
@@ -1240,9 +1240,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist nameos in reference namelist : equation of state
       READ  ( numnam_ref, nameos, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nameos in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist nameos in configuration namelist : equation of state
       READ  ( numnam_cfg, nameos, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nameos in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traadv.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traadv.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traadv.F90	(revision 11960)
@@ -196,9 +196,7 @@
       !
       !                                !==  Namelist  ==!
-      REWIND( numnam_ref )                   ! Namelist namtra_adv in reference namelist : Tracer advection scheme
       READ  ( numnam_ref, namtra_adv, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_adv in reference namelist' )
       !
-      REWIND( numnam_cfg )                   ! Namelist namtra_adv in configuration namelist : Tracer advection scheme
       READ  ( numnam_cfg, namtra_adv, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_adv in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/trabbc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/trabbc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/trabbc.F90	(revision 11960)
@@ -135,9 +135,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist nambbc in reference namelist : Bottom momentum boundary condition
       READ  ( numnam_ref, nambbc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambbc in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist nambbc in configuration namelist : Bottom momentum boundary condition
       READ  ( numnam_cfg, nambbc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambbc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/trabbl.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/trabbl.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/trabbl.F90	(revision 11960)
@@ -488,9 +488,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist nambbl in reference namelist : Bottom boundary layer scheme
       READ  ( numnam_ref, nambbl, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambbl in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist nambbl in configuration namelist : Bottom boundary layer scheme
       READ  ( numnam_cfg, nambbl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambbl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/tradmp.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/tradmp.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/tradmp.F90	(revision 11960)
@@ -180,9 +180,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )   ! Namelist namtra_dmp in reference namelist : T & S relaxation
       READ  ( numnam_ref, namtra_dmp, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_dmp in reference namelist' )
       !
-      REWIND( numnam_cfg )   ! Namelist namtra_dmp in configuration namelist : T & S relaxation
       READ  ( numnam_cfg, namtra_dmp, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_dmp in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/tramle.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/tramle.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/tramle.F90	(revision 11960)
@@ -267,9 +267,7 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnam_ref )              ! Namelist namtra_mle in reference namelist : Tracer advection scheme
       READ  ( numnam_ref, namtra_mle, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_mle in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namtra_mle in configuration namelist : Tracer advection scheme
       READ  ( numnam_cfg, namtra_mle, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_mle in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traqsr.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traqsr.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traqsr.F90	(revision 11960)
@@ -338,9 +338,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namtra_qsr in reference     namelist
       READ  ( numnam_ref, namtra_qsr, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_qsr in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namtra_qsr in configuration namelist
       READ  ( numnam_cfg, namtra_qsr, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_qsr in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRD/trdini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRD/trdini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRD/trdini.F90	(revision 11960)
@@ -47,9 +47,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namtrd in reference namelist : trends diagnostic
       READ  ( numnam_ref, namtrd, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrd in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namtrd in configuration namelist : trends diagnostic
       READ  ( numnam_cfg, namtrd, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRD/trdmxl.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRD/trdmxl.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRD/trdmxl.F90	(revision 11960)
@@ -733,9 +733,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namtrd_mxl in reference namelist : mixed layer trends diagnostic
       READ  ( numnam_ref, namtrd_mxl, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrd_mxl in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namtrd_mxl in configuration namelist : mixed layer trends diagnostic
       READ  ( numnam_cfg, namtrd_mxl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrd_mxl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/USR/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/USR/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/USR/usrdef_nam.F90	(revision 11960)
@@ -59,5 +59,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfdrg.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfdrg.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfdrg.F90	(revision 11960)
@@ -238,8 +238,6 @@
       !                     !==  drag nature  ==!
       !
-      REWIND( numnam_ref )                   ! Namelist namdrg in reference namelist
       READ  ( numnam_ref, namdrg, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam( ios , 'namdrg in reference namelist' )
-      REWIND( numnam_cfg )                   ! Namelist namdrg in configuration namelist
       READ  ( numnam_cfg, namdrg, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam( ios , 'namdrg in configuration namelist' )
@@ -337,9 +335,7 @@
       !                          !==  read namlist  ==!
       !
-      REWIND( numnam_ref )                   ! Namelist cl_namdrg in reference namelist
       IF(ll_top)   READ  ( numnam_ref, namdrg_top, IOSTAT = ios, ERR = 901)
       IF(ll_bot)   READ  ( numnam_ref, namdrg_bot, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam( ios , TRIM(cl_namref) )
-      REWIND( numnam_cfg )                   ! Namelist cd_namdrg in configuration namelist
       IF(ll_top)   READ  ( numnam_cfg, namdrg_top, IOSTAT = ios, ERR = 902 )
       IF(ll_bot)   READ  ( numnam_cfg, namdrg_bot, IOSTAT = ios, ERR = 902 )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfgls.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfgls.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfgls.F90	(revision 11960)
@@ -858,9 +858,7 @@
       !!----------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namzdf_gls in reference namelist : Vertical eddy diffivity and viscosity using gls turbulent closure scheme
       READ  ( numnam_ref, namzdf_gls, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf_gls in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namzdf_gls in configuration namelist : Vertical eddy diffivity and viscosity using gls turbulent closure scheme
       READ  ( numnam_cfg, namzdf_gls, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf_gls in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfiwm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfiwm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfiwm.F90	(revision 11960)
@@ -423,9 +423,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namzdf_iwm in reference namelist : Wave-driven mixing
       READ  ( numnam_ref, namzdf_iwm, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf_iwm in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namzdf_iwm in configuration namelist : Wave-driven mixing
       READ  ( numnam_cfg, namzdf_iwm, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf_iwm in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfosm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfosm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfosm.F90	(revision 11960)
@@ -1387,9 +1387,7 @@
      !!----------------------------------------------------------------------
      !
-     REWIND( numnam_ref )              ! Namelist namzdf_osm in reference namelist : Osmosis ML model
      READ  ( numnam_ref, namzdf_osm, IOSTAT = ios, ERR = 901)
 901  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_osm in reference namelist' )
 
-     REWIND( numnam_cfg )              ! Namelist namzdf_tke in configuration namelist : Turbulent Kinetic Energy
      READ  ( numnam_cfg, namzdf_osm, IOSTAT = ios, ERR = 902 )
 902  IF( ios >  0 ) CALL ctl_nam ( ios , 'namzdf_osm in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfphy.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfphy.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfphy.F90	(revision 11960)
@@ -93,9 +93,7 @@
       !
       !                           !==  Namelist  ==!
-      REWIND( numnam_ref )              ! Namelist namzdf in reference namelist : Vertical mixing parameters
       READ  ( numnam_ref, namzdf, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namzdf in reference namelist : Vertical mixing parameters
       READ  ( numnam_cfg, namzdf, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfric.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfric.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfric.F90	(revision 11960)
@@ -78,9 +78,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namzdf_ric in reference namelist : Vertical diffusion Kz depends on Richardson number
       READ  ( numnam_ref, namzdf_ric, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_ric in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namzdf_ric in configuration namelist : Vertical diffusion Kz depends on Richardson number
       READ  ( numnam_cfg, namzdf_ric, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namzdf_ric in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdftke.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdftke.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdftke.F90	(revision 11960)
@@ -656,9 +656,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namzdf_tke in reference namelist : Turbulent Kinetic Energy
       READ  ( numnam_ref, namzdf_tke, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tke in reference namelist' )
 
-      REWIND( numnam_cfg )              ! Namelist namzdf_tke in configuration namelist : Turbulent Kinetic Energy
       READ  ( numnam_cfg, namzdf_tke, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namzdf_tke in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/nemogcm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/nemogcm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/nemogcm.F90	(revision 11960)
@@ -309,6 +309,6 @@
       IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ! open reference and configuration namelist files
-                  CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-                  CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+                  CALL load_nml( numnam_ref,        'namelist_ref',                                           -1, lwm )
+                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                           -1, lwm )
       IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ! open /dev/null file to be able to supress output write easily
@@ -319,8 +319,6 @@
       !                             !--------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namctl in reference namelist
       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' )
@@ -377,8 +375,6 @@
       !                             !------------------------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist
       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist
       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )   
@@ -624,9 +620,5 @@
       IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file
       IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file
-      IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist
-      IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist
       IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist
-      IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist
-      IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist
       IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist
       IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution)
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OFF/dtadyn.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OFF/dtadyn.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OFF/dtadyn.F90	(revision 11960)
@@ -230,8 +230,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namdta_dyn in reference namelist : Offline: init. of dynamical data
       READ  ( numnam_ref, namdta_dyn, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdta_dyn in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namdta_dyn in configuration namelist : Offline: init. of dynamical data
       READ  ( numnam_cfg, namdta_dyn, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdta_dyn in configuration namelist' )
@@ -483,8 +481,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namdta_dyn in reference namelist : Offline: init. of dynamical data
       READ  ( numnam_ref, namdta_dyn, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdta_dyn in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namdta_dyn in configuration namelist : Offline: init. of dynamical data
       READ  ( numnam_cfg, namdta_dyn, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdta_dyn in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OFF/nemogcm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/OFF/nemogcm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/OFF/nemogcm.F90	(revision 11960)
@@ -205,6 +205,6 @@
       IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ! open reference and configuration namelist files
-                  CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-                  CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+                  CALL load_nml( numnam_ref,        'namelist_ref',                                           -1, lwm )
+                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                           -1, lwm )
       IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ! open /dev/null file to be able to supress output write easily
@@ -215,8 +215,6 @@
       !                             !--------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namctl in reference namelist
       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' )
@@ -273,8 +271,6 @@
       !                             !------------------------------------!
       !     
-      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist
       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist
       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )   
@@ -463,7 +459,4 @@
       !
       IF( numstp     /= -1 )   CLOSE( numstp     )   ! time-step file
-      IF( numnam_ref /= -1 )   CLOSE( numnam_ref )   ! oce reference namelist
-      IF( numnam_cfg /= -1 )   CLOSE( numnam_cfg )   ! oce configuration namelist
-      IF( numout     /=  6 )   CLOSE( numout     )   ! standard model output file
       IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist
       !
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAO/nemogcm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAO/nemogcm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAO/nemogcm.F90	(revision 11960)
@@ -135,6 +135,6 @@
       IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ! open reference and configuration namelist files
-                  CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-                  CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+                  CALL load_nml( numnam_ref,        'namelist_ref',                                           -1, lwm )
+                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                           -1, lwm )
       IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ! open /dev/null file to be able to supress output write easily
@@ -145,8 +145,6 @@
       !                             !--------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namctl in reference namelist
       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' )
@@ -203,8 +201,6 @@
       !                             !------------------------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist
       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist
       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )   
@@ -363,9 +359,5 @@
       IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file
       IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file
-      IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist
-      IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist
       IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist
-      IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist
-      IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist
       IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist
       IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution)
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAO/sao_data.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAO/sao_data.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAO/sao_data.F90	(revision 11960)
@@ -52,8 +52,6 @@
 
       ! Standard offline obs_oper settings
-      REWIND( numnam_ref )              ! Namelist namctl in reference namelist : Control prints & Benchmark
       READ  ( numnam_ref, namsao, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsao in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist : Control prints & Benchmark
       READ  ( numnam_cfg, namsao, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsao in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/nemogcm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/nemogcm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/nemogcm.F90	(revision 11960)
@@ -243,15 +243,15 @@
       ! open ocean.output as soon as possible to get all output prints (including errors messages)
       IF( lk_oasis ) THEN
-         IF( lwm )   CALL ctl_opn(     numout,              'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+         IF( lwm )   CALL ctl_opn(     numout,               'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
          ! open reference and configuration namelist files
-                     CALL ctl_opn( numnam_ref,        'namelist_sas_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-                     CALL ctl_opn( numnam_cfg,        'namelist_sas_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-         IF( lwm )   CALL ctl_opn(     numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+                     CALL load_nml( numnam_ref,        'namelist_sas_ref',                                           -1, lwm )
+                     CALL load_nml( numnam_cfg,        'namelist_sas_cfg',                                           -1, lwm )
+         IF( lwm )   CALL ctl_opn(      numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ELSE
-         IF( lwm )   CALL ctl_opn(     numout,            'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+         IF( lwm )   CALL ctl_opn(      numout,            'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
          ! open reference and configuration namelist files
-                     CALL ctl_opn( numnam_ref,            'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-                     CALL ctl_opn( numnam_cfg,            'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
-         IF( lwm )   CALL ctl_opn(     numond,     'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
+                     CALL load_nml( numnam_ref,            'namelist_ref',                                           -1, lwm )
+                     CALL load_nml( numnam_cfg,            'namelist_cfg',                                           -1, lwm )
+         IF( lwm )   CALL ctl_opn(      numond,     'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
       ENDIF
       ! open /dev/null file to be able to supress output write easily
@@ -262,8 +262,6 @@
       !                             !--------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namctl in reference namelist
       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' )
@@ -324,8 +322,6 @@
       !                             !------------------------------------!
       !
-      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist
       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist
       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )   
@@ -505,9 +501,5 @@
       IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file      
       IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file
-      IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist
-      IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist
       IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist
-      IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist
-      IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist
       IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist
       IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution)
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/sbcssm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/sbcssm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/sbcssm.F90	(revision 11960)
@@ -190,8 +190,6 @@
       ENDIF
       !
-      REWIND( numnam_ref )              ! Namelist namsbc_sas in reference namelist : Input fields
       READ  ( numnam_ref, namsbc_sas, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_sas in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist namsbc_sas in configuration namelist : Input fields
       READ  ( numnam_cfg, namsbc_sas, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_sas in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/AGE/trcnam_age.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/AGE/trcnam_age.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/AGE/trcnam_age.F90	(revision 11960)
@@ -54,8 +54,6 @@
       ln_trc_obc(jp_age) = .false.
       !
-      REWIND( numnat_ref )              ! Namelist namagedate in reference namelist : AGE parameters
       READ  ( numnat_ref, namage, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namage in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namagedate in configuration namelist : AGE parameters
       READ  ( numnat_cfg, namage, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namage in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/C14/trcnam_c14.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/C14/trcnam_c14.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/C14/trcnam_c14.F90	(revision 11960)
@@ -61,8 +61,6 @@
       ln_trc_obc(jp_c14) = .false.
       !
-      REWIND( numtrc_ref )              ! Namelist namc14_typ in reference namelist :
       READ  ( numtrc_ref, namc14_typ, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc14_typ in reference namelist' )
-      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist 
       READ  ( numtrc_cfg, namc14_typ, IOSTAT = ios, ERR = 902)
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc14_typ in configuration namelist' )
@@ -78,8 +76,6 @@
       ENDIF
 
-      REWIND( numtrc_ref )              ! Namelist namc14_typ in reference namelist :
       READ  ( numtrc_ref, namc14_sbc, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc14_sbc in reference namelist' )
-      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist 
       READ  ( numtrc_cfg, namc14_sbc, IOSTAT = ios, ERR = 904)
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc14_sbc in configuration namelist' )
@@ -94,8 +90,6 @@
       ENDIF
 
-      REWIND( numtrc_ref )              ! Namelist namc14_typ in reference namelist :
       READ  ( numtrc_ref, namc14_fcg, IOSTAT = ios, ERR = 905)
 905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc14_fcg in reference namelist' )
-      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist 
       READ  ( numtrc_cfg, namc14_fcg, IOSTAT = ios, ERR = 906)
 906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc14_fcg in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/CFC/trcnam_cfc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/CFC/trcnam_cfc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/CFC/trcnam_cfc.F90	(revision 11960)
@@ -51,8 +51,6 @@
       ENDIF
       !
-      REWIND( numtrc_ref )              ! Namelist namcfcdate in reference namelist : CFC parameters
       READ  ( numtrc_ref, namcfc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfc in reference namelist' )
-      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist : CFC parameters
       READ  ( numtrc_cfg, namcfc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zbio.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zbio.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zbio.F90	(revision 11960)
@@ -403,8 +403,6 @@
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~'
       !
-      REWIND( numnatp_ref )              ! Namelist namlobphy in reference namelist : Lobster biological parameters
       READ  ( numnatp_ref, namlobphy, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlobphy in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist namlobphy in configuration namelist : Lobster biological parameters
       READ  ( numnatp_cfg, namlobphy, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobphy in configuration namelist' )
@@ -420,8 +418,6 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist namlobnut in reference namelist : Lobster nutriments parameters
       READ  ( numnatp_ref, namlobnut, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlobnut in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist namlobnut in configuration namelist : Lobster nutriments parameters
       READ  ( numnatp_cfg, namlobnut, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobnut in configuration namelist' )
@@ -437,8 +433,6 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist namlobzoo in reference namelist : Lobster zooplankton parameters
       READ  ( numnatp_ref, namlobzoo, IOSTAT = ios, ERR = 905)
 905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlobzoo in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist namlobzoo in configuration namelist : Lobster zooplankton parameters
       READ  ( numnatp_cfg, namlobzoo, IOSTAT = ios, ERR = 906 )
 906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobzoo in configuration namelist' )
@@ -459,8 +453,6 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist namlobdet in reference namelist : Lobster detritus parameters
       READ  ( numnatp_ref, namlobdet, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlobdet in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist namlobdet in configuration namelist : Lobster detritus parameters
       READ  ( numnatp_cfg, namlobdet, IOSTAT = ios, ERR = 908 )
 908   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobdet in configuration namelist' )
@@ -474,8 +466,6 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist namlobdom in reference namelist : Lobster DOM breakdown rate
       READ  ( numnatp_ref, namlobdom, IOSTAT = ios, ERR = 909)
 909   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlobdom in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist namlobdom in configuration namelist : Lobster DOM breakdown rate
       READ  ( numnatp_cfg, namlobdom, IOSTAT = ios, ERR = 910 )
 910   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobdom in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zopt.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zopt.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zopt.F90	(revision 11960)
@@ -160,9 +160,7 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnatp_ref )              ! Namelist namlobopt in reference namelist : Lobster options
       READ  ( numnatp_ref, namlobopt, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlobopt in reference namelist' )
 
-      REWIND( numnatp_cfg )              ! Namelist namlobopt in configuration namelist : Lobster options
       READ  ( numnatp_cfg, namlobopt, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namlobopt in configuration namelist' )
@@ -182,9 +180,7 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist namlobrat in reference namelist : Lobster ratios
       READ  ( numnatp_ref, namlobrat, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlobrat in reference namelist' )
 
-      REWIND( numnatp_cfg )              ! Namelist namlobrat in configuration namelist : Lobster ratios
       READ  ( numnatp_cfg, namlobrat, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 ) CALL ctl_nam ( ios , 'namlobrat in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zsed.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zsed.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P2Z/p2zsed.F90	(revision 11960)
@@ -133,8 +133,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnatp_ref )              ! Namelist namlobsed in reference namelist : Lobster sediments
       READ  ( numnatp_ref, namlobsed, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlosed in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist namlobsed in configuration namelist : Lobster sediments
       READ  ( numnatp_cfg, namlobsed, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobsed in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zfechem.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zfechem.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zfechem.F90	(revision 11960)
@@ -255,8 +255,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )            ! Namelist nampisfer in reference namelist : Pisces iron chemistry
       READ  ( numnatp_ref, nampisfer, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampisfer in reference namelist' )
-      REWIND( numnatp_cfg )            ! Namelist nampisfer in configuration namelist : Pisces iron chemistry
       READ  ( numnatp_cfg, nampisfer, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisfer in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zflx.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zflx.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zflx.F90	(revision 11960)
@@ -240,8 +240,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampisext in reference namelist : Pisces atm. conditions
       READ  ( numnatp_ref, nampisext, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampisext in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisext in configuration namelist : Pisces atm. conditions
       READ  ( numnatp_cfg, nampisext, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisext in configuration namelist' )
@@ -321,8 +319,6 @@
          ENDIF
          !
-         REWIND( numnatp_ref )              ! Namelist nampisatm in reference namelist : Pisces atm. sea level pressure file
          READ  ( numnatp_ref, nampisatm, IOSTAT = ios, ERR = 901)
 901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in reference namelist' )
-         REWIND( numnatp_cfg )              ! Namelist nampisatm in configuration namelist : Pisces atm. sea level pressure file 
          READ  ( numnatp_cfg, nampisatm, IOSTAT = ios, ERR = 902 )
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisatm in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zligand.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zligand.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zligand.F90	(revision 11960)
@@ -126,8 +126,6 @@
          WRITE(numout,*) '~~~~~~~~~~~~~~~'
       ENDIF
-      REWIND( numnatp_ref )              ! Namelist nampislig in reference namelist : Pisces remineralization
       READ  ( numnatp_ref, nampislig, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampislig in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampislig in configuration namelist : Pisces remineralization
       READ  ( numnatp_cfg, nampislig, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampislig in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zlim.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zlim.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zlim.F90	(revision 11960)
@@ -253,8 +253,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampislim in reference namelist : Pisces nutrient limitation parameters
       READ  ( numnatp_ref, namp4zlim, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namp4zlim in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampislim in configuration namelist : Pisces nutrient limitation parameters 
       READ  ( numnatp_cfg, namp4zlim, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namp4zlim in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zlys.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zlys.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zlys.F90	(revision 11960)
@@ -163,8 +163,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampiscal in reference namelist : Pisces CaCO3 dissolution
       READ  ( numnatp_ref, nampiscal, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampiscal in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampiscal in configuration namelist : Pisces CaCO3 dissolution
       READ  ( numnatp_cfg, nampiscal, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampiscal in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmeso.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmeso.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmeso.F90	(revision 11960)
@@ -291,8 +291,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampismes in reference namelist : Pisces mesozooplankton
       READ  ( numnatp_ref, namp4zmes, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namp4zmes in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampismes in configuration namelist : Pisces mesozooplankton
       READ  ( numnatp_cfg, namp4zmes, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namp4zmes in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmicro.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmicro.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmicro.F90	(revision 11960)
@@ -244,8 +244,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampiszoo in reference namelist : Pisces microzooplankton
       READ  ( numnatp_ref, namp4zzoo, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namp4zzoo in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampiszoo in configuration namelist : Pisces microzooplankton
       READ  ( numnatp_cfg, namp4zzoo, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namp4zzoo in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmort.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmort.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zmort.F90	(revision 11960)
@@ -230,8 +230,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampismort in reference namelist : Pisces phytoplankton
       READ  ( numnatp_ref, namp4zmort, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namp4zmort in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampismort in configuration namelist : Pisces phytoplankton
       READ  ( numnatp_cfg, namp4zmort, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namp4zmort in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zopt.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zopt.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zopt.F90	(revision 11960)
@@ -402,8 +402,6 @@
          WRITE(numout,*) '~~~~~~~~~~~~ '
       ENDIF
-      REWIND( numnatp_ref )              ! Namelist nampisopt in reference namelist : Pisces attenuation coef. and PAR
       READ  ( numnatp_ref, nampisopt, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampisopt in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisopt in configuration namelist : Pisces attenuation coef. and PAR
       READ  ( numnatp_cfg, nampisopt, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisopt in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zpoc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zpoc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zpoc.F90	(revision 11960)
@@ -498,8 +498,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampisrem in reference namelist : Pisces remineralization
       READ  ( numnatp_ref, nampispoc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampispoc in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisrem in configuration namelist : Pisces remineralization
       READ  ( numnatp_cfg, nampispoc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampispoc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zprod.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zprod.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zprod.F90	(revision 11960)
@@ -491,8 +491,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampisprod in reference namelist : Pisces phytoplankton production
       READ  ( numnatp_ref, namp4zprod, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namp4zprod in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisprod in configuration namelist : Pisces phytoplankton production
       READ  ( numnatp_cfg, namp4zprod, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namp4zprod in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zrem.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zrem.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zrem.F90	(revision 11960)
@@ -328,8 +328,6 @@
       ENDIF
       !
-      REWIND( numnatp_ref )              ! Namelist nampisrem in reference namelist : Pisces remineralization
       READ  ( numnatp_ref, nampisrem, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampisrem in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisrem in configuration namelist : Pisces remineralization
       READ  ( numnatp_cfg, nampisrem, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisrem in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zsbc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zsbc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zsbc.F90	(revision 11960)
@@ -232,8 +232,6 @@
       ENDIF
       !                            !* set file information
-      REWIND( numnatp_ref )              ! Namelist nampissbc in reference namelist : Pisces external sources of nutrients
       READ  ( numnatp_ref, nampissbc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampissbc in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampissbc in configuration namelist : Pisces external sources of nutrients
       READ  ( numnatp_cfg, nampissbc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampissbc in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zsms.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 11960)
@@ -202,8 +202,6 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist nampisbio in reference namelist : Pisces variables
       READ  ( numnatp_ref, nampisbio, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampisbio in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisbio in configuration namelist : Pisces variables
       READ  ( numnatp_cfg, nampisbio, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisbio in configuration namelist' )
@@ -233,8 +231,6 @@
 
 
-      REWIND( numnatp_ref )              ! Namelist nampisdmp in reference namelist : Pisces damping
       READ  ( numnatp_ref, nampisdmp, IOSTAT = ios, ERR = 905)
 905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampisdmp in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisdmp in configuration namelist : Pisces damping
       READ  ( numnatp_cfg, nampisdmp, IOSTAT = ios, ERR = 906 )
 906   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampisdmp in configuration namelist' )
@@ -248,8 +244,6 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist nampismass in reference namelist : Pisces mass conservation check
       READ  ( numnatp_ref, nampismass, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampismass in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampismass in configuration namelist : Pisces mass conservation check 
       READ  ( numnatp_cfg, nampismass, IOSTAT = ios, ERR = 908 )
 908   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampismass in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zlim.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zlim.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zlim.F90	(revision 11960)
@@ -449,9 +449,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnatp_ref )              ! Namelist nampislim in reference namelist : Pisces nutrient limitation parameters
       READ  ( numnatp_ref, namp5zlim, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislim in reference namelist' )
       !
-      REWIND( numnatp_cfg )              ! Namelist nampislim in configuration namelist : Pisces nutrient limitation parameters 
       READ  ( numnatp_cfg, namp5zlim, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nampislim in configuration namelist' )
@@ -490,9 +488,7 @@
       ENDIF
 
-      REWIND( numnatp_ref )              ! Namelist nampislim in reference namelist : Pisces nutrient limitation parameters
       READ  ( numnatp_ref, namp5zquota, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisquota in reference namelist' )
       !
-      REWIND( numnatp_cfg )              ! Namelist nampislim in configuration namelist : Pisces nutrient limitation parameters 
       READ  ( numnatp_cfg, namp5zquota, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 ) CALL ctl_nam ( ios , 'nampisquota in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmeso.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmeso.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmeso.F90	(revision 11960)
@@ -408,9 +408,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnatp_ref )              ! Namelist nampismes in reference namelist : Pisces mesozooplankton
       READ  ( numnatp_ref, namp5zmes, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismes in reference namelist' )
       !
-      REWIND( numnatp_cfg )              ! Namelist nampismes in configuration namelist : Pisces mesozooplankton
       READ  ( numnatp_cfg, namp5zmes, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nampismes in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmicro.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmicro.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmicro.F90	(revision 11960)
@@ -350,9 +350,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnatp_ref )              ! Namelist nampiszoo in reference namelist : Pisces microzooplankton
       READ  ( numnatp_ref, namp5zzoo, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zzoo in reference namelist' )
       !
-      REWIND( numnatp_cfg )              ! Namelist nampiszoo in configuration namelist : Pisces microzooplankton
       READ  ( numnatp_cfg, namp5zzoo, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namp5zzoo in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmort.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmort.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zmort.F90	(revision 11960)
@@ -290,9 +290,7 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnatp_ref )              ! Namelist nampismort in reference namelist : Pisces phytoplankton
       READ  ( numnatp_ref, namp5zmort, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zmort in reference namelist' )
 
-      REWIND( numnatp_cfg )              ! Namelist nampismort in configuration namelist : Pisces phytoplankton
       READ  ( numnatp_cfg, namp5zmort, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namp5zmort in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zprod.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zprod.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/P4Z/p5zprod.F90	(revision 11960)
@@ -583,9 +583,7 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnatp_ref )              ! Namelist nampisprod in reference namelist : Pisces phytoplankton production
       READ  ( numnatp_ref, namp5zprod, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zprod in reference namelist' )
 
-      REWIND( numnatp_cfg )              ! Namelist nampisprod in configuration namelist : Pisces phytoplankton production
       READ  ( numnatp_cfg, namp5zprod, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namp5zprod in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/SED/sedini.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/SED/sedini.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/SED/sedini.F90	(revision 11960)
@@ -405,6 +405,6 @@
       !!----------------------------------------------------------------------
 
-      INTEGER ::   numnamsed_ref = -1           !! Logical units for namelist sediment
-      INTEGER ::   numnamsed_cfg = -1           !! Logical units for namelist sediment
+      CHARACTER(:), ALLOCATABLE ::   numnamsed_ref           !! Character buffer for reference namelist sediment
+      CHARACTER(:), ALLOCATABLE ::   numnamsed_cfg           !! Character buffer for configuration namelist sediment
       INTEGER :: ios                 ! Local integer output status for namelist read
       CHARACTER(LEN=20)   ::   clname
@@ -451,15 +451,13 @@
       IF(lwp) WRITE(numsed,*) ' sed_init_nam : read SEDIMENT namelist'
       IF(lwp) WRITE(numsed,*) ' ~~~~~~~~~~~~~~'
-      CALL ctl_opn( numnamsed_ref, TRIM( clname )//'_ref', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      CALL ctl_opn( numnamsed_cfg, TRIM( clname )//'_cfg', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      CALL load_nml( numnamsed_ref, TRIM( clname )//'_ref', numout, lwm )
+      CALL load_nml( numnamsed_cfg, TRIM( clname )//'_cfg', numout, lwm )
 
       nitsed000 = nittrc000
       nitsedend = nitend
       ! Namelist nam_run
-      REWIND( numnamsed_ref )              ! Namelist nam_run in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_run, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_run in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_run in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_run, IOSTAT = ios, ERR = 902)
 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_run in configuration namelist' )
@@ -473,9 +471,7 @@
       IF ( ln_p5z .AND. ln_sed_2way ) CALL ctl_stop( '2 ways coupling with sediment cannot be activated with PISCES-QUOTA' )
 
-      REWIND( numnamsed_ref )              ! Namelist nam_geom in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_geom, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_geom in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_geom in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_geom, IOSTAT = ios, ERR = 904)
 904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_geom in configuration namelist' )
@@ -496,9 +492,7 @@
       dtsed = r2dttrc
 
-      REWIND( numnamsed_ref )              ! Namelist nam_trased in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_trased, IOSTAT = ios, ERR = 905)
 905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_trased in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_trased in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_trased, IOSTAT = ios, ERR = 906)
 906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_trased in configuration namelist' )
@@ -529,9 +523,7 @@
       ENDIF
 
-      REWIND( numnamsed_ref )              ! Namelist nam_diased in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_diased, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diased in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_diased in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_diased, IOSTAT = ios, ERR = 908)
 908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diased in configuration namelist' )
@@ -571,9 +563,7 @@
       ! Inorganic chemistry parameters
       !----------------------------------
-      REWIND( numnamsed_ref )              ! Namelist nam_inorg in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_inorg, IOSTAT = ios, ERR = 909)
 909   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_inorg in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_inorg in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_inorg, IOSTAT = ios, ERR = 910)
 910   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_inorg in configuration namelist' )
@@ -597,9 +587,7 @@
       ! Additional parameter linked to POC/O2/No3/Po4
       !----------------------------------------------
-      REWIND( numnamsed_ref )              ! Namelist nam_poc in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_poc, IOSTAT = ios, ERR = 911)
 911   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_poc in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_poc in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_poc, IOSTAT = ios, ERR = 912)
 912   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_poc in configuration namelist' )
@@ -649,9 +637,7 @@
       ! Bioturbation parameter
       !------------------------
-      REWIND( numnamsed_ref )              ! Namelist nam_btb in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_btb, IOSTAT = ios, ERR = 913)
 913   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_btb in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_btb in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_btb, IOSTAT = ios, ERR = 914)
 914   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_btb in configuration namelist' )
@@ -670,9 +656,7 @@
       ! Initial value (t=0) for sediment pore water and solid components
       !----------------------------------------------------------------
-      REWIND( numnamsed_ref )              ! Namelist nam_rst in reference namelist : Pisces variables
       READ  ( numnamsed_ref, nam_rst, IOSTAT = ios, ERR = 915)
 915   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_rst in reference namelist' )
 
-      REWIND( numnamsed_cfg )              ! Namelist nam_rst in reference namelist : Pisces variables
       READ  ( numnamsed_cfg, nam_rst, IOSTAT = ios, ERR = 916)
 916   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_rst in configuration namelist' )
@@ -685,6 +669,4 @@
       nn_dtsed = 1
 
-      CLOSE( numnamsed_cfg )
-      CLOSE( numnamsed_ref )
 
    END SUBROUTINE sed_init_nam
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/sms_pisces.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/sms_pisces.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/sms_pisces.F90	(revision 11960)
@@ -13,7 +13,7 @@
    PUBLIC
 
-   INTEGER ::   numnatp_ref = -1           !! Logical units for namelist pisces
-   INTEGER ::   numnatp_cfg = -1           !! Logical units for namelist pisces
-   INTEGER ::   numonp      = -1           !! Logical unit for namelist pisces output
+   CHARACTER(:), ALLOCATABLE ::   numnatp_ref   !! Character buffer for reference namelist pisces
+   CHARACTER(:), ALLOCATABLE ::   numnatp_cfg   !! Character buffer for configuration namelist pisces
+   INTEGER ::   numonp      = -1                !! Logical unit for namelist pisces output
 
    !                                                       !:  PISCES  : silicon dependant half saturation
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/trcnam_pisces.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/trcnam_pisces.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/PISCES/trcnam_pisces.F90	(revision 11960)
@@ -51,12 +51,10 @@
       IF(lwp) WRITE(numout,*) 'trc_nam_pisces : read PISCES namelist'
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~'
-      CALL ctl_opn( numnatp_ref, TRIM( clname )//'_ref', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      CALL ctl_opn( numnatp_cfg, TRIM( clname )//'_cfg', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      CALL load_nml( numnatp_ref, TRIM( clname )//'_ref', numout, lwm )
+      CALL load_nml( numnatp_cfg, TRIM( clname )//'_cfg', numout, lwm )
       IF(lwm) CALL ctl_opn( numonp     , 'output.namelist.pis' , 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
       !
-      REWIND( numnatp_ref )              ! Namelist nampisbio in reference namelist : Pisces variables
       READ  ( numnatp_ref, nampismod, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampismod in reference namelist' )
-      REWIND( numnatp_cfg )              ! Namelist nampisbio in configuration namelist : Pisces variables
       READ  ( numnatp_cfg, nampismod, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampismod in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcadv.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcadv.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcadv.F90	(revision 11960)
@@ -166,8 +166,6 @@
       !
       !                                !==  Namelist  ==!
-      REWIND( numnat_ref )                   !  namtrc_adv in reference namelist 
       READ  ( numnat_ref, namtrc_adv, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_adv in reference namelist' )
-      REWIND( numnat_cfg )                   ! namtrc_adv in configuration namelist
       READ  ( numnat_cfg, namtrc_adv, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_adv in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcdmp.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcdmp.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcdmp.F90	(revision 11960)
@@ -183,8 +183,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnat_ref )              ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping
       READ  ( numnat_ref, namtrc_dmp, IOSTAT = ios, ERR = 909)
 909   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_dmp in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namtrc_dmp in configuration namelist : Passive tracers newtonian damping
       READ  ( numnat_cfg, namtrc_dmp, IOSTAT = ios, ERR = 910)
 910   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_dmp in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcldf.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcldf.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcldf.F90	(revision 11960)
@@ -149,9 +149,7 @@
       ENDIF
       !
-      REWIND( numnat_ref )             !  namtrc_ldf in reference namelist 
       READ  ( numnat_ref, namtrc_ldf, IOSTAT = ios, ERR = 903)
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_ldf in reference namelist' )
       !
-      REWIND( numnat_cfg )             !  namtrc_ldf in configuration namelist 
       READ  ( numnat_cfg, namtrc_ldf, IOSTAT = ios, ERR = 904 )
 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_ldf in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcrad.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcrad.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcrad.F90	(revision 11960)
@@ -90,8 +90,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnat_ref )              ! namtrc_rad in reference namelist 
       READ  ( numnat_ref, namtrc_rad, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_rad in reference namelist' )
-      REWIND( numnat_cfg )              ! namtrc_rad in configuration namelist 
       READ  ( numnat_cfg, namtrc_rad, IOSTAT = ios, ERR = 908 )
 908   IF( ios > 0 )   CALL ctl_nam ( ios , 'namtrc_rad in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcsink.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcsink.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/TRP/trcsink.F90	(revision 11960)
@@ -218,8 +218,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnat_ref )              ! namtrc_rad in reference namelist 
       READ  ( numnat_ref, namtrc_snk, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_snk in reference namelist' )
-      REWIND( numnat_cfg )              ! namtrc_rad in configuration namelist 
       READ  ( numnat_cfg, namtrc_snk, IOSTAT = ios, ERR = 908 )
 908   IF( ios > 0 )   CALL ctl_nam ( ios , 'namtrc_snk in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trc.F90	(revision 11960)
@@ -18,13 +18,13 @@
 
    !                                     !!- logical units of passive tracers
-   INTEGER, PUBLIC ::   numnat_ref = -1   !: reference passive tracer namelist_top_ref
-   INTEGER, PUBLIC ::   numnat_cfg = -1   !: reference passive tracer namelist_top_cfg
    INTEGER, PUBLIC ::   numont     = -1   !: reference passive tracer namelist output output.namelist.top
-   INTEGER, PUBLIC ::   numtrc_ref = -1   !: reference passive tracer namelist_top_ref
-   INTEGER, PUBLIC ::   numtrc_cfg = -1   !: reference passive tracer namelist_top_cfg
    INTEGER, PUBLIC ::   numonr     = -1   !: reference passive tracer namelist output output.namelist.top
    INTEGER, PUBLIC ::   numstr            !: tracer statistics
    INTEGER, PUBLIC ::   numrtr            !: trc restart (read )
    INTEGER, PUBLIC ::   numrtw            !: trc restart ( write )
+   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_ref   !: character buffer for reference passive tracer namelist_top_ref
+   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_cfg   !: character buffer for configuration specific passive tracer namelist_top_cfg
+   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numtrc_ref   !: character buffer for reference passive tracer namelist_trc_ref
+   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numtrc_cfg   !: character buffer for configuration specific passive tracer namelist_trc_cfg
 
    !! passive tracers fields (before,now,after)
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcbc.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcbc.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcbc.F90	(revision 11960)
@@ -121,8 +121,6 @@
       !
       ! Read Boundary Conditions Namelists
-      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure
       READ  ( numnat_ref, namtrc_bc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_bc in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namtrc_bc in configuration namelist : Passive tracer data structure
       READ  ( numnat_cfg, namtrc_bc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_bc in configuration namelist' )
@@ -130,5 +128,4 @@
 
       IF ( ln_bdy ) THEN
-         REWIND( numnat_ref )              ! Namelist namtrc_bdy in reference namelist : Passive tracer data structure
          READ  ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903)
 903      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist' )
@@ -136,5 +133,4 @@
          cn_trc     (2:jp_bdy) = cn_trc     (1)
          cn_trc_dflt(2:jp_bdy) = cn_trc_dflt(1)
-         REWIND( numnat_cfg )              ! Namelist namtrc_bdy in configuration namelist : Passive tracer data structure
          READ  ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
 904      IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcdta.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcdta.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcdta.F90	(revision 11960)
@@ -98,8 +98,6 @@
       ENDIF
       !
-      REWIND( numnat_ref )              ! Namelist namtrc_dta in reference namelist : Passive tracer input data
       READ  ( numnat_ref, namtrc_dta, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_dta_ini in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namtrc_dta in configuration namelist : Passive tracer input data
       READ  ( numnat_cfg, namtrc_dta, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_dta_ini in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcice.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcice.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcice.F90	(revision 11960)
@@ -85,8 +85,6 @@
       ENDIF
       !
-      REWIND( numnat_ref )              ! Namelist namtrc_ice in reference namelist : Passive tracer input data
       READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
  901  IF( ios /= 0 )   CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ' )
-      REWIND( numnat_cfg )              ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients
       READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
  902  IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcnam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcnam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/src/TOP/trcnam.F90	(revision 11960)
@@ -105,12 +105,10 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
       !
-      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      CALL load_nml( numnat_ref, 'namelist_top_ref' , numout, lwm )
+      CALL load_nml( numnat_cfg, 'namelist_top_cfg' , numout, lwm )
       IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
       !
-      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
       READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
       READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc in configuration namelist' )
@@ -150,8 +148,6 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
 
-      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
       READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
       READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc in configuration namelist' )
@@ -220,6 +216,6 @@
       IF( ll_cfc .OR. ln_c14 ) THEN
         !                             ! Open namelist files
-        CALL ctl_opn( numtrc_ref, 'namelist_trc_ref'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-        CALL ctl_opn( numtrc_cfg, 'namelist_trc_cfg'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+        CALL load_nml( numtrc_ref, 'namelist_trc_ref' , numout, lwm )
+        CALL load_nml( numtrc_cfg, 'namelist_trc_cfg' , numout, lwm )
         IF(lwm) CALL ctl_opn( numonr, 'output.namelist.trc', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
         !
@@ -253,8 +249,6 @@
       ALLOCATE( ln_trdtrc(jptra) ) 
       !
-      REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends
       READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
 905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_trd in reference namelist' )
-      REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
       READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
 906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/BENCH/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -61,5 +61,4 @@
       !!----------------------------------------------------------------------     
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 903 )
 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
@@ -72,9 +71,7 @@
       IF( nn_isize < 0 .AND. nn_jsize < 0 ) THEN
       !
-         REWIND( numnam_ref )              ! Namelist nammpp in reference namelist: mpi variables
          READ  ( numnam_ref, nammpp, IOSTAT = ios, ERR = 901)
 901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist' )
          !
-         REWIND( numnam_cfg )              ! Namelist nammpp in configuration namelist: mpi variables
          READ  ( numnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/BENCH/MY_SRC/zdfiwm.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/BENCH/MY_SRC/zdfiwm.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/BENCH/MY_SRC/zdfiwm.F90	(revision 11960)
@@ -405,9 +405,7 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_ref )              ! Namelist namzdf_iwm in reference namelist : Wave-driven mixing
       READ  ( numnam_ref, namzdf_iwm, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf_iwm in reference namelist' )
       !
-      REWIND( numnam_cfg )              ! Namelist namzdf_iwm in configuration namelist : Wave-driven mixing
       READ  ( numnam_cfg, namzdf_iwm, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf_iwm in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/CANAL/MY_SRC/domvvl.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/CANAL/MY_SRC/domvvl.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/CANAL/MY_SRC/domvvl.F90	(revision 11960)
@@ -992,8 +992,6 @@
       !!---------------------------------------------------------------------- 
       !
-      REWIND( numnam_ref )              ! Namelist nam_vvl in reference namelist : 
       READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nam_vvl in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/CANAL/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/CANAL/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/CANAL/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -84,5 +84,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_ADV1D/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_ADV1D/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_ADV1D/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -63,5 +63,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_ADV2D/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_ADV2D/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_ADV2D/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -63,5 +63,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -63,5 +63,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ISOMIP/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ISOMIP/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/ISOMIP/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -64,5 +64,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -60,5 +60,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/OVERFLOW/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -61,5 +61,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/VORTEX/MY_SRC/domvvl.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/VORTEX/MY_SRC/domvvl.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/VORTEX/MY_SRC/domvvl.F90	(revision 11960)
@@ -988,8 +988,6 @@
       !!---------------------------------------------------------------------- 
       !
-      REWIND( numnam_ref )              ! Namelist nam_vvl in reference namelist : 
       READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist' )
-      REWIND( numnam_cfg )              ! Namelist nam_vvl in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
 902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/VORTEX/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/VORTEX/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/VORTEX/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -63,5 +63,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
Index: NEMO/branches/2019/dev_r11943_MERGE_2019/tests/WAD/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2019/dev_r11943_MERGE_2019/tests/WAD/MY_SRC/usrdef_nam.F90	(revision 11959)
+++ NEMO/branches/2019/dev_r11943_MERGE_2019/tests/WAD/MY_SRC/usrdef_nam.F90	(revision 11960)
@@ -61,5 +61,4 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
