Index: branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90
===================================================================
--- branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90	(revision 7029)
+++ branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90	(revision 7268)
@@ -162,5 +162,8 @@
                   &                               + avmv(ji,jj,jk) + avmv(ji,jj-1,jk)  )   &
                   &          + avtb(jk) * tmask(ji,jj,jk)
-               !                                            ! Add the background coefficient on eddy viscosity
+            END DO
+         END DO
+         DO jj = 2, jpjm1                                   ! Add the background coefficient on eddy viscosity
+            DO ji = fs_2, fs_jpim1
                avmu(ji,jj,jk) = avmu(ji,jj,jk) + avmb(jk) * umask(ji,jj,jk)
                avmv(ji,jj,jk) = avmv(ji,jj,jk) + avmb(jk) * vmask(ji,jj,jk)
Index: branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 7029)
+++ branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 7268)
@@ -295,5 +295,5 @@
          IF(lwp) WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), zmean, zmin, zmax, zdrift
       END DO
-      WRITE(numout,*) 
+      IF(lwp) WRITE(numout,*) 
 9000  FORMAT(' tracer nb :',i2,'    name :',a10,'    mean :',e18.10,'    min :',e18.10, &
       &      '    max :',e18.10,'    drift :',e18.10, ' %')
Index: branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/TOP_SRC/trcsub.F90
===================================================================
--- branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 7029)
+++ branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 7268)
@@ -16,10 +16,4 @@
    USE in_out_manager
    USE lbclnk
-#if defined key_zdftke
-   USE zdftke          ! twice TKE (en)
-#endif
-#if defined key_zdfgls
-   USE zdfgls, ONLY: en
-#endif
    USE trabbl
    USE zdf_oce
Index: branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/TOOLS/MISCELLANEOUS/README_uspcfg
===================================================================
--- branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/TOOLS/MISCELLANEOUS/README_uspcfg	(revision 7268)
+++ branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/TOOLS/MISCELLANEOUS/README_uspcfg	(revision 7268)
@@ -0,0 +1,134 @@
+Instructions for using unsupported configurations on systems without wget access to
+the internet
+
+The unsupported configurations in NEMO are provided as a way for users to provide
+alternative configurations to the wider community without having to rely on system team
+sponsership and support. The idea is to provide minimal but sufficient information
+with the standard distribution to allow ancillary files to be fetched from remote
+servers at compile time. Thus a makenemo command such as:
+
+./makenemo -n MYISOMIP -u ISOMIP -m some_arch
+
+will create a new configuration called MYISOMIP with MY_SRC and EXP00 directories
+populated from a remote server. It does this by first using the wget command to fetch a
+list of remote files and then using wget repeatedly to fetch each of the files listed
+therein. The location of the remote list is contained in one line of information held
+in the uspcfg.txt file (in CONFIG).
+
+These instructions provide a work-around for systems without direct access to the
+internet or on which wget has been disabled/not installed. On these systems it is
+possible to create local copies of the remote files and replace the wget function
+with a local copy command. It will be the user's responsibility to ensure that the
+local copies reflect any changes made in the remote sources.
+
+The procedure requires the following steps:
+
+1. From the target NEMOGCM directory on your target system copy the following
+   files into a working directory on a system that does have internet access
+   and a working wget command:
+
+      a. TOOLS/MISCELLANEOUS/make_usp_tar.sh
+      b. CONFIG/uspcfg.txt
+
+2. On that alternative system and in the working directory containing the newly
+   copied files, run the make_usp_tar.sh script. The script takes three arguments:
+
+      a. The name of the uspcfg.txt file
+      b. The name of the unsupported configuration you wish to use
+      c. The name of a directory that will be created and filled with the remote
+         files in the current working directory. This directory will be tarred and
+         eventually transferred to the target system. There it will be unpacked and
+         will form the local archive for this configuration. A meaningful name is
+         therefore recommended.
+
+   For example:
+
+   ./make_usp_tar.sh uspcfg.txt ISOMIP ISOMIP_ARCHIVE
+
+3. Copy the resulting tarball (in this case: ISOMIP_ARCHIVE.tar) to the target 
+   system and unpack (tar xvf ISOMIP_ARCHIVE.tar) in a location that is visible to 
+   the node on which you intend to compile nemo. The unpacked directory will contain
+   the files retrieved from the remote server, modified versions of the file list and
+   uspcfg.txt files and two new scripts. For example:
+
+   ls -1R ISOMIP_ARCHIVE
+   cpp_ISOMIP.fcm             - downloaded from remote server
+   def_wget                   - newly constructed script
+   local_template.ctl         - file list modified for local copy
+   uspcfg_local_template.txt  - a copy of uspcfg.txt with modification for local copy
+   remote_file.list           - downloaded from remote server
+   set_local_uspcfg           - newly constructed script
+   EXP00                      - new subdirectory
+   MY_SRC                     - new subdirectory
+
+   ./EXP00:
+   iodef.xml                  - downloaded from remote server
+   namelist_cfg               - downloaded from remote server
+
+   ./MY_SRC:
+   domzgr.F90                 - downloaded from remote server
+   istate.F90                 - downloaded from remote server
+
+4. The final stage is to enter the directory and execute the set_local_uspcfg script.
+   This script will prompt for a full path to the target CONFIG directory and then:
+
+   a. Edit the templates and create local.ctl and uspcfg_local.txt files by inserting 
+      the full path to the archive directory (i.e. the current working directory)
+   b. move uspcfg_local.txt to the named CONFIG directory
+   c. rename any existing uspcfg.txt file in the CONFIG directory to uspcfg_remote.txt
+   d. insert symbolic link (uspcfg.txt) to uspcfg_local.txt in the CONFIG directory
+   e. redefine/define wget as an exported bash function to simply copy
+
+   This last action is needed so that subsequent use of makenemo with the -u argument
+   will not invoke wget. For this to be effective the set_local_usp script should be run
+   within the same bash shell as makenemo will be run in. I.e.:
+
+   . ./set_local_usp
+
+   If this is not possible or the makenemo command is run at a later date, then the
+   def_wget script should be run in the bash shell before any attempt to use the -u
+   option of makenemo. I.e.:
+
+   . ./def_wget
+
+   [ Tip: check that the definition/re-definition of wget has worked correctly by
+     issuing this command:
+
+     wget a b c
+
+     If you get messages such as:
+
+       wget a b c
+       --2016-10-27 10:14:52--  http://a/
+       Resolving a... failed: Name or service not known.
+       wget: unable to resolve host address `a'
+       .
+       .
+
+     then the re-definition of wget has not been retained by the current shell. Run
+     . ./def_wget and try again. You should get a response such as:
+
+     wget a b c
+     Expected wget usage: wget src -O dest
+     -O not found. No action taken
+
+     if the environment is set correctly
+   ]
+
+5. The setup is now complete and moving to the CONFIG directory and issuing a command
+   such as:
+
+    ./makenemo -n MYISOMIP -u ISOMIP -m target_arch
+
+   should correctly configure from local archives only.   
+
+   [ Tip: the -u argument ( and hence the need to switch wget to local copies on isolated
+     systems ) is only required when compiling for the first time. Subsequent compilations
+     following code changes in the MYISOMIP directories can be carried out in your
+     default nemo environment. I.e.:
+
+     ./makenemo -n MYISOMIP -m target_arch
+
+     will not require any of the preceeding steps in future sessions.
+   ]
+
Index: branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/TOOLS/MISCELLANEOUS/make_usp_tar.sh
===================================================================
--- branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/TOOLS/MISCELLANEOUS/make_usp_tar.sh	(revision 7268)
+++ branches/NERC/dev_r6998_ORCHESTRA/NEMOGCM/TOOLS/MISCELLANEOUS/make_usp_tar.sh	(revision 7268)
@@ -0,0 +1,235 @@
+#!/bin/bash
+#set -x
+set -o posix
+#set -u
+#set -e
+#+
+# ===============
+# make_usp_tar.sh
+# ===============
+# ---------------
+# Fetch and tar a unsupported configuration setup.
+# This script is only needed when target systems do
+# not have wget access to the internet. To configure
+# unsupported conigurations on these systems it will
+# first be necessary to run this script on a system that
+# does have access. Then copy access the resulting tar file,
+# unpack and run the enclosed set_local_uspcfg script in a 
+# bash shell to complete the process. That script redefines/
+# defines wget as a bash function to perform local copies 
+# from this unpacked tarball. If you wish to create a new 
+# configuration based on this local copy of an unsupported 
+# configuration in future sessions then you may need to 
+# redefine wget again before running makenemo with the 
+# appropriate -u setting. A simple script: def_wget is included
+# for such situations.
+# ---------------
+# SYNOPSIS
+# ========
+#  $ make_usp_tar.sh uspcfg.txt target_conf target_dir
+# Note target_dir.tar will be created
+#
+# DESCRIPTION
+# ===========
+# - Extract target configuration details from uspcfg.txt
+# - Create target directory
+# - Recursively use wget to retrieve remote configuration files
+#   into target directory
+# - Copy uspcfg.txt into target directory and alter remote paths
+#   to local (relative) versions
+# - tar target_directory and remove originals
+#----------------------------------------------------------------
+#
+#----------------------------------------------------------------
+# Check the correct number of arguments have been provided
+#----------------------------------------------------------------
+#
+   if [ "$#" != "3" ]; then
+    echo "Expected usage: make_usp_tar.sh uspcfg.txt target_conf target_dir"
+    exit
+   fi
+#
+#----------------------------------------------------------------
+# Check the named uspcfg.txt file exists
+#----------------------------------------------------------------
+#
+   if [ ! -f $1 ]; then
+    echo "named uspcfg.txt file does not exist ($1); attempt abandoned"
+    exit
+   fi
+#
+#----------------------------------------------------------------
+# Check the requested configuration is listed in the named uspcfg.txt file
+#----------------------------------------------------------------
+#
+   inthere=$( grep -c "$2" $1 )
+   if [ "$inthere" -lt 1 ]; then
+    echo "requested configuration is not in named uspcfg.txt file ($2); attempt abandoned"
+    exit
+   fi
+#
+#----------------------------------------------------------------
+# Create the target directory if it does not already exist
+# and cd into it
+#----------------------------------------------------------------
+#
+   if [ ! -d $3 ]; then
+    mkdir $3
+   else
+    echo "target directory already exists; attempt abandoned"
+    exit
+   fi
+   basedir=$(pwd)
+#
+   cd ${3}
+#
+#----------------------------------------------------------------
+# Copy named uspcfg.txt file into target directory
+#----------------------------------------------------------------
+#
+   cp $basedir/$1 .
+#
+#----------------------------------------------------------------
+# Extract information on target configuration and
+# retrieve full file list from remote server
+#----------------------------------------------------------------
+#
+   grep "$2 " $1 > ./cfg.tmp
+#
+   LOCAL_REF=$(cat cfg.tmp | awk 'BEGIN {FS = "#" }{print $2}')
+   TAB=$(cat cfg.tmp | awk 'BEGIN {FS = "#" }{print $3}')
+   REMOTE_CTL=$(cat cfg.tmp | awk 'BEGIN {FS = "#" }{print $4}')
+   wget ${REMOTE_CTL} -O remote_file.list
+#
+#----------------------------------------------------------------
+# Retrieve each remote file and create local directory structure
+# At the same time prepare a local version of the control file
+# by replacing http links with a string that will be replaced later
+# with a local directory path
+#----------------------------------------------------------------
+#
+   if [ -f remote_file.list ] ; then
+    cat remote_file.list | grep -v '^#' |
+     while
+      read remfile locfile
+      do
+       if [ $remfile == 'create_directory' ] ;then
+         mkdir $locfile
+         echo $remfile "                 " $locfile >> local_template.ctl
+       else
+         wget $remfile -O $locfile
+         remfile=$(echo $remfile | sed -e "s;.*$locfile;SET_LOCAL_DIRECTORY_HERE/$locfile;")
+         echo $remfile "  " $locfile >> local_template.ctl
+       fi
+      done
+   else
+    echo "Unable to find remote_file.list. Attempt abandoned"
+    echo "Files may be left in "$(pwd)
+    exit
+   fi
+#
+#----------------------------------------------------------------
+# Construct a modified version of the named uspcfg.txt file
+# First copy across all the other untouched configuration listed
+#----------------------------------------------------------------
+#
+   grep -v "$2 " $1 >  uspcfg_local_template.txt
+#
+#----------------------------------------------------------------
+# Now append the modified entry, replacing http links as before
+#----------------------------------------------------------------
+#
+   cat cfg.tmp | sed -e "s;http.*$;SET_LOCAL_DIRECTORY_HERE/local.ctl;" >> uspcfg_local_template.txt
+#
+#
+#----------------------------------------------------------------
+# Construct a script that can be used later to complete a local installation
+#----------------------------------------------------------------
+#
+cat > set_local_uspcfg << EOF
+#!/bin/bash
+   if [ "\$( echo $SHELL | grep -c bash )" -lt 1 ]; then
+    echo "WARNING: This is only going to be effective in a bash shell"
+    echo "since it redefines the wget command as a bash function."
+    echo "(ignore this comment if you are in a bash shell)"
+   fi
+   basedir=\$(pwd)
+#
+   echo "Enter full path to the CONFIG directory on your target system: "
+   read confdir
+#
+# Edit the local.ctl file to set the local directory path
+#
+   sed -e "s;SET_LOCAL_DIRECTORY_HERE;\$basedir;" local_template.ctl > local.ctl
+#
+# Edit the uspcfg_local.txt file to set the local directory path
+#
+   sed -e "s;SET_LOCAL_DIRECTORY_HERE;\$basedir;" uspcfg_local_template.txt > uspcfg_local.txt
+#
+# Install local versions in the named CONFIG directory
+#
+   if [ -f \$confdir/uspcfg.txt ] && [ ! -L \$confdir/uspcfg.txt ]; then
+    mv \$confdir/uspcfg.txt \$confdir/uspcfg_remote.txt
+    echo "\$confdir/uspcfg.txt moved to \$confdir/uspcfg_remote.txt"
+   fi
+   if [ -f \$confdir/uspcfg_local.txt ]; then
+    echo "Existing uspcfg_local.txt file found in \$confdir"
+    echo "This has been moved to: "\$confdir/uspcfg_local.txt\$\$
+    mv \$confdir/uspcfg_local.txt \$confdir/uspcfg_local.txt\$\$
+   fi
+   mv uspcfg_local.txt \$confdir/uspcfg_local.txt
+   ln -s \$confdir/uspcfg_local.txt \$confdir/uspcfg.txt
+#
+# define/redefine the wget command
+#
+function wget {
+   if [ "\$2" != "-O" ]; then
+    echo "Expected wget usage: wget src -O dest"
+    echo "-O not found. No action taken"
+   else
+    cp \$1 \$3
+   fi
+}
+export -f wget
+EOF
+#----------------------------------------------------------------
+# Construct a script that can be used later to just redefine wget 
+# in bash shell sessions
+#----------------------------------------------------------------
+#
+cat > def_wget << EOFC
+#!/bin/bash
+   if [ "\$( echo $SHELL | grep -c bash )" -lt 1 ]; then
+    echo "WARNING: This is only going to be effective in a bash shell"
+    echo "since it redefines the wget command as a bash function."
+    echo "(ignore this comment if you are in a bash shell)"
+   fi
+function wget {
+   if [ "\$2" != "-O" ]; then
+    echo "Expected wget usage: wget src -O dest"
+    echo "-O not found. No action taken"
+   else
+    cp \$1 \$3
+   fi
+}
+export -f wget
+EOFC
+#----------------------------------------------------------------
+# Make sure these scripts have execute permission
+#----------------------------------------------------------------
+   chmod 755 set_local_uspcfg
+   chmod 755 def_wget
+#
+#----------------------------------------------------------------
+# Tidy up and tar the contents of the downloaded configuration
+#----------------------------------------------------------------
+   rm cfg.tmp
+   cd $basedir
+   tar cvf ${3}.tar $3
+   echo ${3}.tar " file successfully created and prepared for local references. Move this"
+   echo "tar file to your target system, unpack and run the set_local_uspcfg script in a "
+   echo "bash shell to complete the process. This script redefines/defines wget as a bash"
+   echo "function to perform local copies from this unpacked tarball. If you wish to create"
+   echo "a new configuration based on this local copy of an unsupported configuration in "
+   echo "future sessions then you may need to rerun the def_wget script"
+exit
