Index: /branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/scoord_gen.F90
===================================================================
--- /branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/scoord_gen.F90	(revision 5992)
+++ /branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/scoord_gen.F90	(revision 5993)
@@ -339,5 +339,4 @@
       z_gsigw3  = 0.   ;   z_gsigt3  = 0.   ;   z_gsi3w3  = 0.
       z_esigt3  = 0.   ;   z_esigw3  = 0. 
-      z_esigt3p1  = 0. ;   z_esigw3p1  = 0. 
       z_esigtu3 = 0.   ;   z_esigtv3 = 0.   ;   z_esigtf3 = 0.
       z_esigwu3 = 0.   ;   z_esigwv3 = 0.
@@ -664,108 +663,2 @@
 
    END SUBROUTINE s_tanh
-
-   FUNCTION fssig( pk ) RESULT( pf )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE fssig ***
-      !!       
-      !! ** Purpose :   provide the analytical function in s-coordinate
-      !!          
-      !! ** Method  :   the function provide the non-dimensional position of
-      !!                T and W (i.e. between 0 and 1)
-      !!                T-points at integer values (between 1 and jpk)
-      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
-      !!----------------------------------------------------------------------
-      USE utils, ONLY : wp,rn_theta,rn_thetb,jpk
-      IMPLICIT NONE
-      REAL(wp), INTENT(in) ::   pk   ! continuous "k" coordinate
-      REAL(wp)             ::   pf   ! sigma value
-      !!----------------------------------------------------------------------
-      !
-      pf =   (   TANH( rn_theta * ( -(pk-0.5) / REAL(jpk-1) + rn_thetb )  )   &
-         &     - TANH( rn_thetb * rn_theta                                )  )   &
-         & * (   COSH( rn_theta                           )                      &
-         &     + COSH( rn_theta * ( 2. * rn_thetb - 1. ) )  )              &
-         & / ( 2. * SINH( rn_theta ) )
-      !
-   END FUNCTION fssig
-
-
-   FUNCTION fssig1( pk1, pbb ) RESULT( pf1 )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE fssig1 ***
-      !!
-      !! ** Purpose :   provide the Song and Haidvogel version of the analytical function in s-coordinate
-      !!
-      !! ** Method  :   the function provides the non-dimensional position of
-      !!                T and W (i.e. between 0 and 1)
-      !!                T-points at integer values (between 1 and jpk)
-      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
-      !!----------------------------------------------------------------------
-      USE utils, ONLY : wp, jpk, rn_theta
-      IMPLICIT NONE
-      REAL(wp), INTENT(in) ::   pk1   ! continuous "k" coordinate
-      REAL(wp), INTENT(in) ::   pbb   ! Stretching coefficient
-      REAL(wp)             ::   pf1   ! sigma value
-      !!----------------------------------------------------------------------
-      !
-      IF ( rn_theta == 0 ) then      ! uniform sigma
-         pf1 = - ( pk1 - 0.5 ) / REAL( jpk-1 )
-      ELSE                        ! stretched sigma
-         pf1 =   ( 1. - pbb ) * ( SINH( rn_theta*(-(pk1-0.5)/REAL(jpk-1)) ) ) / SINH( rn_theta )              &
-            &  + pbb * (  (TANH( rn_theta*( (-(pk1-0.5)/REAL(jpk-1)) + 0.5) ) - TANH( 0.5 * rn_theta )  )  &
-            &        / ( 2. * TANH( 0.5 * rn_theta ) )  )
-      ENDIF
-      !
-   END FUNCTION fssig1
-
-
-   FUNCTION fgamma( pk1, pzb, pzs, psmth) RESULT( p_gamma )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE fgamma  ***
-      !!
-      !! ** Purpose :   provide analytical function for the s-coordinate
-      !!
-      !! ** Method  :   the function provides the non-dimensional position of
-      !!                T and W (i.e. between 0 and 1)
-      !!                T-points at integer values (between 1 and jpk)
-      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
-      !!
-      !!                This method allows the maintenance of fixed surface and or
-      !!                bottom cell resolutions (cf. geopotential coordinates) 
-      !!                within an analytically derived stretched S-coordinate framework.
-      !!
-      !! Reference  :   Siddorn and Furner, in prep
-      !!----------------------------------------------------------------------
-      USE utils, ONLY : jpk,wp,rn_alpha
-      IMPLICIT NONE
-      REAL(wp), INTENT(in   ) ::   pk1           ! continuous "k" coordinate
-      REAL(wp)                ::   p_gamma       ! stretched coordinate
-      REAL(wp), INTENT(in   ) ::   pzb           ! Bottom box depth
-      REAL(wp), INTENT(in   ) ::   pzs           ! surface box depth
-      REAL(wp), INTENT(in   ) ::   psmth         ! Smoothing parameter
-      REAL(wp)                ::   za1,za2,za3   ! local variables
-      REAL(wp)                ::   zn1,zn2       ! local variables
-      REAL(wp)                ::   za,zb,zx      ! local variables
-      !!----------------------------------------------------------------------
-      !
-
-      zn1  =  1./(jpk-1.)
-      zn2  =  1. -  zn1
-
-      za1 = (rn_alpha+2.0)*zn1**(rn_alpha+1.0)-(rn_alpha+1.0)*zn1**(rn_alpha+2.0) 
-      za2 = (rn_alpha+2.0)*zn2**(rn_alpha+1.0)-(rn_alpha+1.0)*zn2**(rn_alpha+2.0)
-      za3 = (zn2**3.0 - za2)/( zn1**3.0 - za1)
-     
-      za = pzb - za3*(pzs-za1)-za2
-      za = za/( zn2-0.5*(za2+zn2**2.0) - za3*(zn1-0.5*(za1+zn1**2.0) ) )
-      zb = (pzs - za1 - za*( zn1-0.5*(za1+zn1**2.0 ) ) ) / (zn1**3.0 - za1)
-      zx = 1.0-za/2.0-zb
-
-      p_gamma = za*(pk1*(1.0-pk1/2.0))+zb*pk1**3.0 +  &
-                  & zx*( (rn_alpha+2.0)*pk1**(rn_alpha+1.0)- &
-                  &      (rn_alpha+1.0)*pk1**(rn_alpha+2.0) )
-      p_gamma = p_gamma*psmth+pk1*(1.0-psmth)
-
-      !
-   END FUNCTION fgamma
-
Index: /branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/utils.F90
===================================================================
--- /branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/utils.F90	(revision 5992)
+++ /branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/utils.F90	(revision 5993)
@@ -98,5 +98,5 @@
      INTEGER :: var_id, ncin
 
-     CALL check_nf90( nf90_open('bathy.nc', NF90_NOWRITE, ncin), 'Error opening bathy.nc file' )
+     CALL check_nf90( nf90_open('bathy_meter.nc', NF90_NOWRITE, ncin), 'Error opening bathy_meter.nc file' )
 
      ! Find the size of the input bathymetry
@@ -134,5 +134,5 @@
      INTEGER, INTENT(out)         :: len
      ! Local variables
-     INTEGER :: id_var, istatus
+     INTEGER :: id_var
 
      id_var = 1
@@ -222,4 +222,106 @@
 
    END SUBROUTINE check_nf90
+   FUNCTION fssig( pk ) RESULT( pf )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE fssig ***
+      !!       
+      !! ** Purpose :   provide the analytical function in s-coordinate
+      !!          
+      !! ** Method  :   the function provide the non-dimensional position of
+      !!                T and W (i.e. between 0 and 1)
+      !!                T-points at integer values (between 1 and jpk)
+      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
+      !!----------------------------------------------------------------------
+!     USE utils, ONLY : wp,rn_theta,rn_thetb,jpk
+      IMPLICIT NONE
+      REAL(wp), INTENT(in) ::   pk   ! continuous "k" coordinate
+      REAL(wp)             ::   pf   ! sigma value
+      !!----------------------------------------------------------------------
+      !
+      pf =   (   TANH( rn_theta * ( -(pk-0.5) / REAL(jpk-1) + rn_thetb )  )   &
+         &     - TANH( rn_thetb * rn_theta                                )  )   &
+         & * (   COSH( rn_theta                           )                      &
+         &     + COSH( rn_theta * ( 2. * rn_thetb - 1. ) )  )              &
+         & / ( 2. * SINH( rn_theta ) )
+      !
+   END FUNCTION fssig
+
+   FUNCTION fssig1( pk1, pbb ) RESULT( pf1 )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE fssig1 ***
+      !!
+      !! ** Purpose :   provide the Song and Haidvogel version of the analytical function in s-coordinate
+      !!
+      !! ** Method  :   the function provides the non-dimensional position of
+      !!                T and W (i.e. between 0 and 1)
+      !!                T-points at integer values (between 1 and jpk)
+      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
+      !!----------------------------------------------------------------------
+!     USE utils, ONLY : wp, jpk, rn_theta
+      IMPLICIT NONE
+      REAL(wp), INTENT(in) ::   pk1   ! continuous "k" coordinate
+      REAL(wp), INTENT(in) ::   pbb   ! Stretching coefficient
+      REAL(wp)             ::   pf1   ! sigma value
+      !!----------------------------------------------------------------------
+      !
+      IF ( rn_theta == 0 ) then      ! uniform sigma
+         pf1 = - ( pk1 - 0.5 ) / REAL( jpk-1 )
+      ELSE                        ! stretched sigma
+         pf1 =   ( 1. - pbb ) * ( SINH( rn_theta*(-(pk1-0.5)/REAL(jpk-1)) ) ) / SINH( rn_theta )              &
+            &  + pbb * (  (TANH( rn_theta*( (-(pk1-0.5)/REAL(jpk-1)) + 0.5) ) - TANH( 0.5 * rn_theta )  )  &
+            &        / ( 2. * TANH( 0.5 * rn_theta ) )  )
+      ENDIF
+      !
+   END FUNCTION fssig1
+
+   FUNCTION fgamma( pk1, pzb, pzs, psmth) RESULT( p_gamma )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE fgamma  ***
+      !!
+      !! ** Purpose :   provide analytical function for the s-coordinate
+      !!
+      !! ** Method  :   the function provides the non-dimensional position of
+      !!                T and W (i.e. between 0 and 1)
+      !!                T-points at integer values (between 1 and jpk)
+      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
+      !!
+      !!                This method allows the maintenance of fixed surface and or
+      !!                bottom cell resolutions (cf. geopotential coordinates) 
+      !!                within an analytically derived stretched S-coordinate framework.
+      !!
+      !! Reference  :   Siddorn and Furner, in prep
+      !!----------------------------------------------------------------------
+!     USE utils, ONLY : jpk,wp,rn_alpha
+      IMPLICIT NONE
+      REAL(wp), INTENT(in   ) ::   pk1           ! continuous "k" coordinate
+      REAL(wp)                ::   p_gamma       ! stretched coordinate
+      REAL(wp), INTENT(in   ) ::   pzb           ! Bottom box depth
+      REAL(wp), INTENT(in   ) ::   pzs           ! surface box depth
+      REAL(wp), INTENT(in   ) ::   psmth         ! Smoothing parameter
+      REAL(wp)                ::   za1,za2,za3   ! local variables
+      REAL(wp)                ::   zn1,zn2       ! local variables
+      REAL(wp)                ::   za,zb,zx      ! local variables
+      !!----------------------------------------------------------------------
+      !
+
+      zn1  =  1./(jpk-1.)
+      zn2  =  1. -  zn1
+
+      za1 = (rn_alpha+2.0)*zn1**(rn_alpha+1.0)-(rn_alpha+1.0)*zn1**(rn_alpha+2.0) 
+      za2 = (rn_alpha+2.0)*zn2**(rn_alpha+1.0)-(rn_alpha+1.0)*zn2**(rn_alpha+2.0)
+      za3 = (zn2**3.0 - za2)/( zn1**3.0 - za1)
+     
+      za = pzb - za3*(pzs-za1)-za2
+      za = za/( zn2-0.5*(za2+zn2**2.0) - za3*(zn1-0.5*(za1+zn1**2.0) ) )
+      zb = (pzs - za1 - za*( zn1-0.5*(za1+zn1**2.0 ) ) ) / (zn1**3.0 - za1)
+      zx = 1.0-za/2.0-zb
+
+      p_gamma = za*(pk1*(1.0-pk1/2.0))+zb*pk1**3.0 +  &
+                  & zx*( (rn_alpha+2.0)*pk1**(rn_alpha+1.0)- &
+                  &      (rn_alpha+1.0)*pk1**(rn_alpha+2.0) )
+      p_gamma = p_gamma*psmth+pk1*(1.0-psmth)
+
+      !
+   END FUNCTION fgamma
 
 
