Index: branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/STO/stopack.F90
===================================================================
--- branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/STO/stopack.F90	(revision 13190)
+++ branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/STO/stopack.F90	(revision 13191)
@@ -46,8 +46,8 @@
 #define numnam_ref numnam
 #define numnam_cfg numnam
-#define lwm        lwp   
+#define lwm        lwp
 #define numond     numout
 
-#define wmask      tmask  
+#define wmask      tmask
 
 #endif
@@ -63,7 +63,7 @@
    !!                                          (SPP, SKEB and sea-ice)
    !!----------------------------------------------------------------------
-   !!   
+   !!
    !!   stopack       : Generate stochastic physics perturbations
-   !!   
+   !!
    !!                   Method
    !!                   ======
@@ -71,5 +71,5 @@
    !!   		- SPPT (Stochastically perturbed parameterization
    !!			  tendencies )scheme for user-selected trends for
-   !!  			  tracers, momentum and sea-ice 
+   !!  			  tracers, momentum and sea-ice
    !!   		- SPP (Schastically perturbed parameters) scheme
    !!			  for some (namelist) parameters
@@ -77,13 +77,13 @@
    !!			  backscatter energy dissipated numerically or
    !! 			  through deep convection.
-   !!   
-   !!   
+   !!
+   !!
    !!                   Acknowledgements: C3S funded ERGO project
-   !!   
+   !!
    !!----------------------------------------------------------------------
    USE par_kind
    USE timing          ! Timing
    USE oce             ! ocean dynamics and tracers variables
-   USE dom_oce         ! ocean space and time domain variables 
+   USE dom_oce         ! ocean space and time domain variables
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE in_out_manager  ! I/O manager
@@ -104,5 +104,5 @@
    USE wrk_nemo
    USE diaptr
-   USE zdf_oce         
+   USE zdf_oce
    USE phycst
 
@@ -113,6 +113,6 @@
    PUBLIC tra_sppt_collect
    PUBLIC dyn_sppt_collect
-   PUBLIC tra_sppt_apply 
-   PUBLIC dyn_sppt_apply 
+   PUBLIC tra_sppt_apply
+   PUBLIC dyn_sppt_apply
    PUBLIC stopack_rst
    PUBLIC stopack_init
@@ -140,10 +140,10 @@
    REAL(wp), SAVE :: rn_spp_tau, rn_spp_stdev
    INTEGER :: skeb_filter_pass, spp_filter_pass
- 
+
    ! SPPT Logical switches for individual tendencies
    LOGICAL :: ln_sppt_taumap, ln_stopack_restart, ln_distcoast, &
    ln_sppt_traxad, ln_sppt_trayad, ln_sppt_trazad, ln_sppt_trasad, ln_sppt_traldf, &
    ln_sppt_trazdf, ln_sppt_trazdfp,ln_sppt_traevd, ln_sppt_trabbc, ln_sppt_trabbl, &
-   ln_sppt_tranpc, ln_sppt_tradmp, ln_sppt_traqsr, ln_sppt_transr, ln_sppt_traatf    
+   ln_sppt_tranpc, ln_sppt_tradmp, ln_sppt_traqsr, ln_sppt_transr, ln_sppt_traatf
    LOGICAL :: &
    ln_sppt_dynhpg, ln_sppt_dynspg, ln_sppt_dynkeg, ln_sppt_dynrvo, ln_sppt_dynpvo, ln_sppt_dynzad,&
@@ -181,5 +181,5 @@
    INTEGER, PARAMETER, PUBLIC :: jk_spp_qsi0   = 8
    INTEGER, PARAMETER, PUBLIC :: jk_spp_bfr    = 9
-   INTEGER, PARAMETER, PUBLIC :: jk_spp_aevd   = 10 
+   INTEGER, PARAMETER, PUBLIC :: jk_spp_aevd   = 10
    INTEGER, PARAMETER, PUBLIC :: jk_spp_avt    = 11
    INTEGER, PARAMETER, PUBLIC :: jk_spp_avm    = 12
@@ -219,5 +219,5 @@
    INTEGER, SAVE :: numrep        = 602
    INTEGER, SAVE :: lkt
-   
+
    ! Randome generator seed
    INTEGER, SAVE   :: nn_stopack_seed(4)
@@ -275,5 +275,5 @@
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: bdytra.F90 4292 2013-11-20 16:28:04Z cetlod $ 
+   !! $Id: bdytra.F90 4292 2013-11-20 16:28:04Z cetlod $
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -289,10 +289,10 @@
       !!
       !! ** Purpose :   Collect tracer tendencies (additive)
-      !!                This function is called by the tendency diagnostics 
+      !!                This function is called by the tendency diagnostics
       !!                module
       !!----------------------------------------------------------------------
       INTEGER                   , INTENT(in   ) ::   kt      ! time step
 #endif
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptrdx   ! Temperature 
+      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptrdx   ! Temperature
       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptrdy   ! Salinity
       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
@@ -354,10 +354,10 @@
       !!
       !! ** Purpose :   Collect momentum tendencies (additive)
-      !!                This function is called by the tendency diagnostics 
+      !!                This function is called by the tendency diagnostics
       !!                module
       !!----------------------------------------------------------------------
       INTEGER                   , INTENT(in   ) ::   kt      ! time step
 #endif
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptrdx   ! Temperature 
+      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptrdx   ! Temperature
       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptrdy   ! Salinity
       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
@@ -469,5 +469,5 @@
       !!
       !! ** Purpose :   Apply collinear perturbation to ice fields
-      !!                For specific processes coded in LIM2/LIM3 
+      !!                For specific processes coded in LIM2/LIM3
       !!----------------------------------------------------------------------
       !
@@ -529,5 +529,5 @@
          zicewrk(:,:,jm) = z5     ; jm=jm+1
          zicewrk(:,:,jm) = z6     ; jm=jm+1
-         zicewrk(:,:,jm) = z7   
+         zicewrk(:,:,jm) = z7
        ENDIF
        IF( kopt .EQ. 3 ) THEN
@@ -601,9 +601,9 @@
             CALL lbc_lnk( u_ice, 'U', -1. )
             CALL lbc_lnk( v_ice, 'V', -1. )
-#endif         
+#endif
 #if defined key_lim2   &&   defined key_lim2_vp
             CALL lbc_lnk( u_ice(:,1:jpj), 'I', -1. )
             CALL lbc_lnk( v_ice(:,1:jpj), 'I', -1. )
-#endif         
+#endif
           ENDIF
           DEALLOCATE ( zicewrk )
@@ -616,5 +616,5 @@
       !!                  ***  ROUTINE spp_gen ***
       !!
-      !! ** Purpose :   Perturbing parameters (generic function)  
+      !! ** Purpose :   Perturbing parameters (generic function)
       !!                Given a value of standard deviation, the 2D parameter
       !!                coeff is perturbed following an additive Normal,
@@ -624,5 +624,17 @@
       !!----------------------------------------------------------------------
    INTEGER, INTENT( in ) :: kt
+#if defined key_traldf_c3d
+   REAL(wp), INTENT( inout ), DIMENSION(jpi,jpj,jpk) :: coeff
+   REAL(wp), POINTER, DIMENSION(:,:,:) ::   gauss
+#elif defined key_traldf_c2d
    REAL(wp), INTENT( inout ), DIMENSION(jpi,jpj) :: coeff
+   REAL(wp), POINTER, DIMENSION(:,:) ::   gauss
+#elif defined key_traldf_c1d
+   REAL(wp), INTENT( inout ), DIMENSION(jpk) :: coeff
+   REAL(wp), POINTER, DIMENSION(:) ::   gauss
+#else
+   REAL(wp), INTENT( inout ) :: coeff
+   REAL(wp), POINTER ::   gauss
+#endif
    INTEGER, INTENT( in ) ::  nn_type
    REAL(wp), INTENT( in ) :: rn_sd
@@ -634,4 +646,5 @@
    INTEGER :: jklev
 
+#if defined key_traldf_c2d || key_traldf_c3d
    CALL wrk_alloc(jpi,jpj,gauss)
 
@@ -658,6 +671,11 @@
        gauss = gauss * rn_sd
        coeff = coeff * ( 1._wp + gauss )
+#if defined key_traldf_c3d || key_traldf_c2d || key_traldf_c1d
        WHERE( coeff > 1._wp ) coeff = 1._wp
        WHERE( coeff < 0._wp ) coeff = 0._wp
+#else
+       IF( coeff > 1._wp ) coeff = 1._wp
+       IF( coeff < 0._wp ) coeff = 0._wp
+#endif
    ELSEIF ( nn_type  == 5 ) THEN
        zsd = rn_sd
@@ -665,6 +683,11 @@
        gauss = gauss * zsd + xme
        coeff = exp(gauss) * coeff
+#if defined key_traldf_c3d || key_traldf_c2d || key_traldf_c1d
        WHERE( coeff > 1._wp ) coeff = 1._wp
        WHERE( coeff < 0._wp ) coeff = 0._wp
+#else
+       IF( coeff > 1._wp ) coeff = 1._wp
+       IF( coeff < 0._wp ) coeff = 0._wp
+#endif
    ELSEIF ( nn_type == 6 ) THEN
        zsd = rn_sd
@@ -672,6 +695,11 @@
        gauss = gauss * zsd + xme
        coeff = exp(gauss) * coeff
+#if defined key_traldf_c3d || key_traldf_c2d || key_traldf_c1d
        WHERE( coeff > 1._wp ) coeff = 1._wp
        WHERE( coeff < 0._wp ) coeff = 0._wp
+#else
+       IF( coeff > 1._wp ) coeff = 1._wp
+       IF( coeff < 0._wp ) coeff = 0._wp
+#endif
    ELSE
        CALL ctl_stop( 'spp dqdt wrong option')
@@ -687,5 +715,5 @@
        jklev = klev
      ELSE
-       jklev = 0 
+       jklev = 0
      ENDIF
      CALL spp_stats(kt,kspp,jklev,coeff)
@@ -694,4 +722,10 @@
    CALL wrk_dealloc(jpi,jpj,gauss)
 
+#else
+   CALL ctl_stop( 'spp_gen: parameter perturbation will only work with '// &
+                  'key_traldf_c2d or key_traldf_c3d')
+#endif
+
+
    END SUBROUTINE
 
@@ -704,49 +738,57 @@
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: mt,kp,kl
-   REAL(wp), INTENT(IN) :: rcf(jpi,jpj)
+#if defined key_traldf_c3d
+   REAL(wp), INTENT( inout ), DIMENSION(jpi,jpj,jpk) :: rcf
+#elif defined key_traldf_c2d
+   REAL(wp), INTENT( inout ), DIMENSION(jpi,jpj) :: rcf
+#elif defined key_traldf_c1d
+   REAL(wp), INTENT( inout ), DIMENSION(jpk) :: rcf
+#else
+   REAL(wp), INTENT( inout ) :: rcf
+#endif
    REAL(wp) :: mi,ma
    CHARACTER(LEN=16) :: cstr = '                '
-   SELECT CASE ( kp ) 
-     CASE( jk_spp_alb   ) 
+   SELECT CASE ( kp )
+     CASE( jk_spp_alb   )
        cstr = 'ALBEDO      '
-     CASE( jk_spp_rhg   ) 
-       cstr = 'ICE RHEOLOGY' 
-     CASE( jk_spp_relw  ) 
-       cstr = 'RELATIVE WND' 
-     CASE( jk_spp_dqdt  ) 
-       cstr = 'SST RELAXAT.' 
-     CASE( jk_spp_deds  ) 
-       cstr = 'SSS RELAXAT.' 
-     CASE( jk_spp_arnf  ) 
-       cstr = 'RIVER MIXING' 
-     CASE( jk_spp_geot  ) 
-       cstr = 'GEOTHERM.FLX' 
-     CASE( jk_spp_qsi0  ) 
-       cstr = 'SOLAR EXTIN.' 
-     CASE( jk_spp_bfr   ) 
-       cstr = 'BOTTOM FRICT' 
-     CASE( jk_spp_aevd  ) 
-       cstr = 'EDDY VISCDIF' 
-     CASE( jk_spp_avt   ) 
+     CASE( jk_spp_rhg   )
+       cstr = 'ICE RHEOLOGY'
+     CASE( jk_spp_relw  )
+       cstr = 'RELATIVE WND'
+     CASE( jk_spp_dqdt  )
+       cstr = 'SST RELAXAT.'
+     CASE( jk_spp_deds  )
+       cstr = 'SSS RELAXAT.'
+     CASE( jk_spp_arnf  )
+       cstr = 'RIVER MIXING'
+     CASE( jk_spp_geot  )
+       cstr = 'GEOTHERM.FLX'
+     CASE( jk_spp_qsi0  )
+       cstr = 'SOLAR EXTIN.'
+     CASE( jk_spp_bfr   )
+       cstr = 'BOTTOM FRICT'
+     CASE( jk_spp_aevd  )
+       cstr = 'EDDY VISCDIF'
+     CASE( jk_spp_avt   )
        cstr = 'VERT. DIFFUS'
-     CASE( jk_spp_avm   ) 
+     CASE( jk_spp_avm   )
        cstr = 'VERT. VISCOS'
-     CASE( jk_spp_tkelc ) 
+     CASE( jk_spp_tkelc )
        cstr = 'TKE LANGMUIR'
-     CASE( jk_spp_tkedf ) 
-       cstr = 'TKE RN_EDIFF' 
-     CASE( jk_spp_tkeds ) 
-       cstr = 'TKE RN_EDISS' 
-     CASE( jk_spp_tkebb ) 
+     CASE( jk_spp_tkedf )
+       cstr = 'TKE RN_EDIFF'
+     CASE( jk_spp_tkeds )
+       cstr = 'TKE RN_EDISS'
+     CASE( jk_spp_tkebb )
        cstr = 'TKE RN_EBB  '
-     CASE( jk_spp_tkefr ) 
+     CASE( jk_spp_tkefr )
        cstr = 'TKE RN_EFR  '
-     CASE( jk_spp_ahtu  ) 
+     CASE( jk_spp_ahtu  )
        cstr = 'TRALDF AHTU '
-     CASE( jk_spp_ahtv  ) 
+     CASE( jk_spp_ahtv  )
        cstr = 'TRALDF AHTV '
-     CASE( jk_spp_ahtw  ) 
+     CASE( jk_spp_ahtw  )
        cstr = 'TRALDF AHTW '
-     CASE( jk_spp_ahtt  ) 
+     CASE( jk_spp_ahtt  )
        cstr = 'TRALDF AHTT '
      CASE( jk_spp_ahubbl )
@@ -765,6 +807,11 @@
        CALL ctl_stop('Unrecognized SPP parameter: add it or turn off diagnostics')
    END SELECT
+#if defined key_traldf_c3d || key_traldf_c2d || key_traldf_c1d
    mi = MINVAL(rcf)
    ma = MAXVAL(rcf)
+#else
+   mi = rcf
+   ma = rcf
+#endif
    IF(lk_mpp) CALL mpp_min(mi)
    IF(lk_mpp) CALL mpp_max(ma)
@@ -795,46 +842,46 @@
 
    DO jp=1,jk_spp
-     SELECT CASE ( jp ) 
-       CASE( jk_spp_alb   ) 
+     SELECT CASE ( jp )
+       CASE( jk_spp_alb   )
          cstr = 'ALBEDO      '
-       CASE( jk_spp_rhg   ) 
-         cstr = 'ICE RHEOLOGY' 
-       CASE( jk_spp_relw  ) 
-         cstr = 'RELATIVE WND' 
-       CASE( jk_spp_dqdt  ) 
-         cstr = 'SST RELAXAT.' 
-       CASE( jk_spp_deds  ) 
-         cstr = 'SSS RELAXAT.' 
-       CASE( jk_spp_arnf  ) 
-         cstr = 'RIVER MIXING' 
-       CASE( jk_spp_geot  ) 
-         cstr = 'GEOTHERM.FLX' 
-       CASE( jk_spp_qsi0  ) 
-         cstr = 'SOLAR EXTIN.' 
-       CASE( jk_spp_bfr   ) 
-         cstr = 'BOTTOM FRICT' 
-       CASE( jk_spp_aevd  ) 
-         cstr = 'EDDY VISCDIF' 
-       CASE( jk_spp_avt   ) 
+       CASE( jk_spp_rhg   )
+         cstr = 'ICE RHEOLOGY'
+       CASE( jk_spp_relw  )
+         cstr = 'RELATIVE WND'
+       CASE( jk_spp_dqdt  )
+         cstr = 'SST RELAXAT.'
+       CASE( jk_spp_deds  )
+         cstr = 'SSS RELAXAT.'
+       CASE( jk_spp_arnf  )
+         cstr = 'RIVER MIXING'
+       CASE( jk_spp_geot  )
+         cstr = 'GEOTHERM.FLX'
+       CASE( jk_spp_qsi0  )
+         cstr = 'SOLAR EXTIN.'
+       CASE( jk_spp_bfr   )
+         cstr = 'BOTTOM FRICT'
+       CASE( jk_spp_aevd  )
+         cstr = 'EDDY VISCDIF'
+       CASE( jk_spp_avt   )
          cstr = 'VERT. DIFFUS'
-       CASE( jk_spp_avm   ) 
+       CASE( jk_spp_avm   )
          cstr = 'VERT. VISCOS'
-       CASE( jk_spp_tkelc ) 
+       CASE( jk_spp_tkelc )
          cstr = 'TKE LANGMUIR'
-       CASE( jk_spp_tkedf ) 
-         cstr = 'TKE RN_EDIFF' 
-       CASE( jk_spp_tkeds ) 
-         cstr = 'TKE RN_EDISS' 
-       CASE( jk_spp_tkebb ) 
+       CASE( jk_spp_tkedf )
+         cstr = 'TKE RN_EDIFF'
+       CASE( jk_spp_tkeds )
+         cstr = 'TKE RN_EDISS'
+       CASE( jk_spp_tkebb )
          cstr = 'TKE RN_EBB  '
-       CASE( jk_spp_tkefr ) 
+       CASE( jk_spp_tkefr )
          cstr = 'TKE RN_EFR  '
-       CASE( jk_spp_ahtu  ) 
+       CASE( jk_spp_ahtu  )
          cstr = 'TRALDF AHTU '
-       CASE( jk_spp_ahtv  ) 
+       CASE( jk_spp_ahtv  )
          cstr = 'TRALDF AHTV '
-       CASE( jk_spp_ahtw  ) 
+       CASE( jk_spp_ahtw  )
          cstr = 'TRALDF AHTW '
-       CASE( jk_spp_ahtt  ) 
+       CASE( jk_spp_ahtt  )
          cstr = 'TRALDF AHTT '
        CASE( jk_spp_ahubbl )
@@ -1195,5 +1242,5 @@
       ! Note: sshn should be staggered before being used.
       SELECT CASE ( cd_type )
-               CASE ( 'T' )  
+               CASE ( 'T' )
                 jk=1
                 zv = SUM( tmask_i(:,:)*tmask(:,:,jk)*e1t(:,:)*e2t(:,:)*sshn(:,:)*zts(:,:,1) )
@@ -1285,5 +1332,5 @@
       ! Random noise on 2d field
       IF ( istep == 1 ) THEN
-         CALL sppt_rand2d( g2d ) 
+         CALL sppt_rand2d( g2d )
          CALL lbc_lnk( g2d , 'T', 1._wp)
          g2d_save = g2d
@@ -1297,5 +1344,5 @@
          g2d = rn_skeb_stdev * g2d_save / rn_sppt_stdev
       ENDIF
-   
+
       ! Laplacian filter and re-normalization
       DO jf = 1, nk
@@ -1314,5 +1361,5 @@
       ENDIF
 #endif
-   
+
       ! AR(1) process and array swap
       g2d = a*gb + b*g2d
@@ -1360,5 +1407,5 @@
         ENDDO
       ENDIF
-      
+
       ! Bound
       IF( nn_sppt_step_bound .EQ. 2 ) THEN
@@ -1482,12 +1529,12 @@
 
 #ifdef NEMO_V34
-      REWIND( numnam )            
+      REWIND( numnam )
       READ  ( numnam, namstopack )
 #else
-      REWIND( numnam_ref ) 
+      REWIND( numnam_ref )
       READ  ( numnam_ref, namstopack, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namstopack in reference namelist', lwp )
 
-      REWIND( numnam_cfg )  
+      REWIND( numnam_cfg )
       READ  ( numnam_cfg, namstopack, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namstopack in configuration namelist', lwp )
@@ -1568,50 +1615,50 @@
          WRITE(numout,*)
          WRITE(numout,*) '       Number of passes for spatial filter (AR1 field)     spp_filter_pass:', spp_filter_pass
-         WRITE(numout,*) '       Standard deviation of random generator (AR1 field)  rn_spp_stdev :', rn_spp_stdev      
+         WRITE(numout,*) '       Standard deviation of random generator (AR1 field)  rn_spp_stdev :', rn_spp_stdev
          WRITE(numout,*) '       Decorr. time scale                     (AR1 field)  rn_spp_tau   :', rn_spp_tau
          WRITE(numout,*)
-         WRITE(numout,*) '       SPP for bottom friction coeff                       nn_spp_bfr   :', nn_spp_bfr  
-         WRITE(numout,*) '                                            STDEV          rn_bfr_sd    :', rn_bfr_sd   
-         WRITE(numout,*) '       SPP for SST relaxation  coeff                       nn_spp_dqdt  :', nn_spp_dqdt 
-         WRITE(numout,*) '                                            STDEV          rn_dqdt_sd   :', rn_dqdt_sd   
-         WRITE(numout,*) '       SPP for SSS relaxation  coeff                       nn_spp_dedt  :', nn_spp_dedt 
-         WRITE(numout,*) '                                            STDEV          rn_dedt_sd   :', rn_dedt_sd   
-         WRITE(numout,*) '       SPP for vertical tra mixing coeff (only TKE, GLS)   nn_spp_avt   :', nn_spp_avt  
-         WRITE(numout,*) '                                            STDEV          rn_avt_sd    :', rn_avt_sd   
-         WRITE(numout,*) '       SPP for vertical dyn mixing coeff (only TKE, GLS)   nn_spp_avm   :', nn_spp_avm  
-         WRITE(numout,*) '                                            STDEV          rn_avm_sd    :', rn_avm_sd   
+         WRITE(numout,*) '       SPP for bottom friction coeff                       nn_spp_bfr   :', nn_spp_bfr
+         WRITE(numout,*) '                                            STDEV          rn_bfr_sd    :', rn_bfr_sd
+         WRITE(numout,*) '       SPP for SST relaxation  coeff                       nn_spp_dqdt  :', nn_spp_dqdt
+         WRITE(numout,*) '                                            STDEV          rn_dqdt_sd   :', rn_dqdt_sd
+         WRITE(numout,*) '       SPP for SSS relaxation  coeff                       nn_spp_dedt  :', nn_spp_dedt
+         WRITE(numout,*) '                                            STDEV          rn_dedt_sd   :', rn_dedt_sd
+         WRITE(numout,*) '       SPP for vertical tra mixing coeff (only TKE, GLS)   nn_spp_avt   :', nn_spp_avt
+         WRITE(numout,*) '                                            STDEV          rn_avt_sd    :', rn_avt_sd
+         WRITE(numout,*) '       SPP for vertical dyn mixing coeff (only TKE, GLS)   nn_spp_avm   :', nn_spp_avm
+         WRITE(numout,*) '                                            STDEV          rn_avm_sd    :', rn_avm_sd
          WRITE(numout,*) '       SPP for solar penetration scheme  (only RGB)        nn_spp_qsi0  :', nn_spp_qsi0
-         WRITE(numout,*) '                                            STDEV          rn_qsi0_sd   :', rn_qsi0_sd   
+         WRITE(numout,*) '                                            STDEV          rn_qsi0_sd   :', rn_qsi0_sd
          WRITE(numout,*) '       SPP for horiz. diffusivity  U                       nn_spp_ahtu  :', nn_spp_ahtu
-         WRITE(numout,*) '                                            STDEV          rn_ahtu_sd   :', rn_ahtu_sd   
+         WRITE(numout,*) '                                            STDEV          rn_ahtu_sd   :', rn_ahtu_sd
          WRITE(numout,*) '       SPP for horiz. diffusivity  V                       nn_spp_ahtv  :', nn_spp_ahtv
-         WRITE(numout,*) '                                            STDEV          rn_ahtv_sd   :', rn_ahtv_sd   
+         WRITE(numout,*) '                                            STDEV          rn_ahtv_sd   :', rn_ahtv_sd
          WRITE(numout,*) '       SPP for horiz. diffusivity  W                       nn_spp_ahtw  :', nn_spp_ahtw
-         WRITE(numout,*) '                                            STDEV          rn_ahtw_sd   :', rn_ahtw_sd   
+         WRITE(numout,*) '                                            STDEV          rn_ahtw_sd   :', rn_ahtw_sd
          WRITE(numout,*) '       SPP for horiz. diffusivity  T                       nn_spp_ahtt  :', nn_spp_ahtt
-         WRITE(numout,*) '                                            STDEV          rn_ahtt_sd   :', rn_ahtt_sd   
+         WRITE(numout,*) '                                            STDEV          rn_ahtt_sd   :', rn_ahtt_sd
          WRITE(numout,*) '       SPP for horiz. viscosity (1/3)                      nn_spp_ahm1  :', nn_spp_ahm1
-         WRITE(numout,*) '                                            STDEV          rn_ahm1_sd   :', rn_ahm1_sd   
+         WRITE(numout,*) '                                            STDEV          rn_ahm1_sd   :', rn_ahm1_sd
          WRITE(numout,*) '       SPP for horiz. viscosity (2/4)                      nn_spp_ahm2  :', nn_spp_ahm2
-         WRITE(numout,*) '                                            STDEV          rn_ahm2_sd   :', rn_ahm2_sd   
+         WRITE(numout,*) '                                            STDEV          rn_ahm2_sd   :', rn_ahm2_sd
          WRITE(numout,*) '       SPP for relative wind factor                        nn_spp_relw  :', nn_spp_relw
          WRITE(numout,*) '       (use 4, 5, 6 for nn_spp_relw to have options 1, 2, 3 with limits bounded to [0,1]'
-         WRITE(numout,*) '                                            STDEV          rn_relw_sd   :', rn_relw_sd   
+         WRITE(numout,*) '                                            STDEV          rn_relw_sd   :', rn_relw_sd
          WRITE(numout,*) '       SPP for mixing close to river mouth                 nn_spp_arnf  :', nn_spp_arnf
-         WRITE(numout,*) '                                            STDEV          rn_arnf_sd   :', rn_arnf_sd   
+         WRITE(numout,*) '                                            STDEV          rn_arnf_sd   :', rn_arnf_sd
          WRITE(numout,*) '       SPP for geothermal heating                          nn_spp_geot  :', nn_spp_geot
-         WRITE(numout,*) '                                            STDEV          rn_geot_sd   :', rn_geot_sd   
+         WRITE(numout,*) '                                            STDEV          rn_geot_sd   :', rn_geot_sd
          WRITE(numout,*) '       SPP for enhanced vertical diffusion                 nn_spp_aevd  :', nn_spp_aevd
-         WRITE(numout,*) '                                            STDEV          rn_aevd_sd   :', rn_aevd_sd   
+         WRITE(numout,*) '                                            STDEV          rn_aevd_sd   :', rn_aevd_sd
          WRITE(numout,*) '       SPP for TKE rn_lc    Langmuir cell coefficient      nn_spp_tkelc :', nn_spp_tkelc
-         WRITE(numout,*) '                                            STDEV          rn_tkelc_sd  :', rn_tkelc_sd   
+         WRITE(numout,*) '                                            STDEV          rn_tkelc_sd  :', rn_tkelc_sd
          WRITE(numout,*) '       SPP for TKE rn_ediff Eddy diff. coefficient         nn_spp_tkedf :', nn_spp_tkedf
-         WRITE(numout,*) '                                            STDEV          rn_tkedf_sd  :', rn_tkedf_sd   
+         WRITE(numout,*) '                                            STDEV          rn_tkedf_sd  :', rn_tkedf_sd
          WRITE(numout,*) '       SPP for TKE rn_ediss Kolmogoroff dissipation coeff. nn_spp_tkeds :', nn_spp_tkeds
-         WRITE(numout,*) '                                            STDEV          rn_tkeds_sd  :', rn_tkeds_sd   
+         WRITE(numout,*) '                                            STDEV          rn_tkeds_sd  :', rn_tkeds_sd
          WRITE(numout,*) '       SPP for TKE rn_ebb   Surface input of tke           nn_spp_tkebb :', nn_spp_tkebb
-         WRITE(numout,*) '                                            STDEV          rn_tkebb_sd  :', rn_tkebb_sd   
+         WRITE(numout,*) '                                            STDEV          rn_tkebb_sd  :', rn_tkebb_sd
          WRITE(numout,*) '       SPP for TKE rn_efr   Fraction of srf TKE below ML   nn_spp_tkefr :', nn_spp_tkefr
-         WRITE(numout,*) '                                            STDEV          rn_tkefr_sd  :', rn_tkefr_sd   
+         WRITE(numout,*) '                                            STDEV          rn_tkefr_sd  :', rn_tkefr_sd
          WRITE(numout,*) '       SPP for BBL U  diffusivity                          nn_spp_ahubbl:', nn_spp_ahubbl
          WRITE(numout,*) '                                            STDEV          rn_ahubbl_sd :', rn_ahubbl_sd
@@ -1626,10 +1673,10 @@
          WRITE(numout,*)
          WRITE(numout,*) ' SKEB Perturbation scheme '
-         WRITE(numout,*) '       SKEB switch                                         ln_skeb      :', ln_skeb    
-         WRITE(numout,*) '       SKEB ratio of backscattered energy                  rn_skeb      :', rn_skeb    
+         WRITE(numout,*) '       SKEB switch                                         ln_skeb      :', ln_skeb
+         WRITE(numout,*) '       SKEB ratio of backscattered energy                  rn_skeb      :', rn_skeb
          WRITE(numout,*) '       Frequency update for dissipation mask               nn_dcom_freq :', nn_dcom_freq
          WRITE(numout,*) '       Numerical dissipation factor (resolut. dependent)   rn_kh        :', rn_kh
          WRITE(numout,*) '       Number of passes for spatial filter (AR1 field)     skeb_filter_pass:', skeb_filter_pass
-         WRITE(numout,*) '       Standard deviation of random generator (AR1 field)  rn_skeb_stdev:', rn_skeb_stdev      
+         WRITE(numout,*) '       Standard deviation of random generator (AR1 field)  rn_skeb_stdev:', rn_skeb_stdev
          WRITE(numout,*) '       Decorr. time scale                     (AR1 field)  rn_skeb_tau  :', rn_skeb_tau
          WRITE(numout,*) '       Option of convection energy dissipation             nn_dconv     :', nn_dconv
@@ -1752,8 +1799,8 @@
 
       ! Find filter attenuation factor
-   
+
       flt_fac = sppt_fltfac( sppt_filter_pass )
       rdt_sppt = nn_rndm_freq * rn_rdt
-   
+
       IF( ln_sppt_taumap ) THEN
          CALL iom_open ( 'sppt_tau_map', inum )
@@ -1798,5 +1845,5 @@
       gauss_b = 0._wp
       ! Weigths
-      gauss_w(:)    = 1.0_wp 
+      gauss_w(:)    = 1.0_wp
       IF( nn_vwei .eq. 1 ) THEN
         gauss_w(1)    = 0.0_wp
@@ -1861,5 +1908,5 @@
       IF(lwp .and. ln_stopack_diags) &
       CALL ctl_opn(numdiag, 'stopack.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
-   
+
    END SUBROUTINE stopack_init
    !
@@ -1874,6 +1921,6 @@
       INTEGER :: id1, jseed
       CHARACTER(LEN=10)   ::   clseed='spsd0_0000'
-      INTEGER(KIND=8)     ::   ziseed(4)           ! RNG seeds in integer type 
-      INTEGER(KIND=8)     ::   ivals(8) 
+      INTEGER(KIND=8)     ::   ziseed(4)           ! RNG seeds in integer type
+      INTEGER(KIND=8)     ::   ivals(8)
       REAL(wp)            ::   zrseed4(4)           ! RNG seeds in integer type
       REAL(wp)            ::   zrseed2d(jpi,jpj)
@@ -1983,6 +2030,6 @@
       !!---------------------------------------------------------------------
       !
-      ALLOCATE( spptt(jpi,jpj,jpk) , sppts(jpi,jpj,jpk) , gauss_n(jpi,jpj,jpk) ,& 
-      gauss_nu(jpi,jpj,jpk) , gauss_nv(jpi,jpj,jpk) , & 
+      ALLOCATE( spptt(jpi,jpj,jpk) , sppts(jpi,jpj,jpk) , gauss_n(jpi,jpj,jpk) ,&
+      gauss_nu(jpi,jpj,jpk) , gauss_nv(jpi,jpj,jpk) , &
       spptu(jpi,jpj,jpk) , spptv(jpi,jpj,jpk) , gauss_n_2d(jpi,jpj) ,&
       gauss_b (jpi,jpj), sppt_tau(jpi,jpj), sppt_a(jpi,jpj), sppt_b(jpi,jpj), gauss_w(jpk),&
@@ -2208,5 +2255,5 @@
       IF ( ln_dpsiv ) THEN
        DO jp=1,jpni-1
-         IF( jpri == jp ) THEN ! SEND TO EAST 
+         IF( jpri == jp ) THEN ! SEND TO EAST
           zwrk(1:jpj) = dpsiv(jpi-1,:)
           tag=2000+narea
@@ -2268,5 +2315,5 @@
    REAL :: ds,dt,dtot,kh2
    INTEGER :: ji,jj,jk
-   
+
    IF ( mt .eq. nit000 ) THEN
         ALLOCATE ( dnum(jpi,jpj,jpk) )
@@ -2287,5 +2334,5 @@
           dt = (vn(ji,jj,jk)-vn(ji-1,jj,jk))*vmask(ji,jj,jk)*vmask(ji-1,jj,jk)/ e2v(ji,jj) + &
                (un(ji,jj,jk)-un(ji,jj-1,jk))*umask(ji,jj,jk)*umask(ji,jj-1,jk)/ e1u(ji,jj)
-  
+
           dtot = sqrt( ds*ds + dt*dt ) * tmask(ji,jj,jk)
           dnum(ji,jj,jk) = dtot*dtot*dtot*kh2*e1t(ji,jj)*e2t(ji,jj)
@@ -2293,10 +2340,10 @@
       ENDDO
      ENDDO
-   
+
      CALL lbc_lnk(dnum,'T',1._wp)
 
    ENDIF
 
-   END SUBROUTINE 
+   END SUBROUTINE
 
    SUBROUTINE skeb_dcon ( mt )
@@ -2329,5 +2376,5 @@
 
            zz = - grav*avt(ji,jj,jk) * ( rhd(ji,jj,jk)-rhd(ji,jj,jk-1) ) * wmask(ji,jj,jk) * tmask(ji,jj,jk) * tmask(ji,jj,jk-1) &
-              & / ( rau0 * fse3w(ji,jj,jk) ) 
+              & / ( rau0 * fse3w(ji,jj,jk) )
 
            dcon(ji,jj,jk) = kc2*zz*e1t(ji,jj)*e2t(ji,jj)*rau0 / fse3w(ji,jj,jk)
@@ -2378,5 +2425,5 @@
      IF(ln_skeb_own_gauss) THEN
        DO jk=1,jpkm1
-         psi(:,:,jk) = rn_skeb * sqrt( rn_beta_num * dnum(:,:,jk) ) * gauss_n_2d_k(:,:) 
+         psi(:,:,jk) = rn_skeb * sqrt( rn_beta_num * dnum(:,:,jk) ) * gauss_n_2d_k(:,:)
        ENDDO
      ELSE
@@ -2407,5 +2454,5 @@
      IF(ln_skeb_own_gauss) THEN
        DO jk=1,jpkm1
-         psi(:,:,jk) = rn_skeb * sqrt( rn_beta_con * dcon(:,:,jk) ) * gauss_n_2d_k(:,:) 
+         psi(:,:,jk) = rn_skeb * sqrt( rn_beta_con * dcon(:,:,jk) ) * gauss_n_2d_k(:,:)
        ENDDO
      ELSE
@@ -2440,5 +2487,5 @@
    IF(ln_skeb_own_gauss) THEN
      DO jk=1,jpkm1
-       psi(:,:,jk) = rn_skeb * sqrt( rn_beta_num * dnum(:,:,jk)+ rn_beta_con * dcon(:,:,jk) ) * gauss_n_2d_k(:,:) 
+       psi(:,:,jk) = rn_skeb * sqrt( rn_beta_num * dnum(:,:,jk)+ rn_beta_con * dcon(:,:,jk) ) * gauss_n_2d_k(:,:)
      ENDDO
    ELSE
