Index: branches/UKMO/dev_1d_bugfixes/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90
===================================================================
--- branches/UKMO/dev_1d_bugfixes/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90	(revision 12892)
+++ branches/UKMO/dev_1d_bugfixes/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90	(revision 13088)
@@ -21,5 +21,5 @@
    USE lib_mpp        ! MPP library
    USE wrk_nemo       ! work arrays
-   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
    USE stopack
 
@@ -31,5 +31,5 @@
 
    INTEGER  ::   albd_init = 0      !: control flag for initialization
-  
+
    REAL(wp) ::   rmue     = 0.40    !  cosine of local solar altitude
    REAL(wp) ::   ralb_oce = 0.066   ! ocean or lead albedo (Pegau and Paulson, Ann. Glac. 2001)
@@ -37,5 +37,5 @@
    REAL(wp) ::   c2       = 0.10    !  "        "
    REAL(wp) ::   rcloud   = 0.06    ! cloud effect on albedo (only-for nn_ice_alb=0)
- 
+
    !                             !!* namelist namsbc_alb
    INTEGER  ::   nn_ice_alb
@@ -52,7 +52,7 @@
       !!----------------------------------------------------------------------
       !!               ***  ROUTINE albedo_ice  ***
-      !!          
-      !! ** Purpose :   Computation of the albedo of the snow/ice system 
-      !!       
+      !!
+      !! ** Purpose :   Computation of the albedo of the snow/ice system
+      !!
       !! ** Method  :   Two schemes are available (from namelist parameter nn_ice_alb)
       !!                  0: the scheme is that of Shine & Henderson-Sellers (JGR 1985) for clear-skies
@@ -73,12 +73,12 @@
       !! ** Note    :   The parameterization from Shine & Henderson-Sellers presents several misconstructions:
       !!                  1) ice albedo when ice thick. tends to 0 is different than ocean albedo
-      !!                  2) for small ice thick. covered with some snow (<3cm?), albedo is larger 
+      !!                  2) for small ice thick. covered with some snow (<3cm?), albedo is larger
       !!                     under melting conditions than under freezing conditions
-      !!                  3) the evolution of ice albedo as a function of ice thickness shows  
+      !!                  3) the evolution of ice albedo as a function of ice thickness shows
       !!                     3 sharp inflexion points (at 5cm, 100cm and 150cm) that look highly unrealistic
       !!
       !! References :   Shine & Henderson-Sellers 1985, JGR, 90(D1), 2243-2250.
       !!                Brandt et al. 2005, J. Climate, vol 18
-      !!                Grenfell & Perovich 2004, JGR, vol 109 
+      !!                Grenfell & Perovich 2004, JGR, vol 109
       !!----------------------------------------------------------------------
       REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pt_ice      !  ice surface temperature (Kelvin)
@@ -97,10 +97,10 @@
 
       ijpl = SIZE( pt_ice, 3 )                     ! number of ice categories
-      
+
       CALL wrk_alloc( jpi,jpj,ijpl, zalb, zalb_it )
 
-      IF( albd_init == 0 )   CALL albedo_init      ! initialization 
-
-      
+      IF( albd_init == 0 )   CALL albedo_init      ! initialization
+
+
       SELECT CASE ( nn_ice_alb )
 
@@ -109,15 +109,15 @@
       !------------------------------------------
       CASE( 0 )
-       
+
          ralb_sf = 0.80       ! dry snow
          ralb_sm = 0.65       ! melting snow
          ralb_if = 0.72       ! bare frozen ice
-         ralb_im = rn_albice  ! bare puddled ice 
-         
+         ralb_im = rn_albice  ! bare puddled ice
+
          !  Computation of ice albedo (free of snow)
          WHERE     ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice )   ;   zalb(:,:,:) = ralb_im
          ELSE WHERE                                              ;   zalb(:,:,:) = ralb_if
          END  WHERE
-      
+
          WHERE     ( 1.5  < ph_ice                     )  ;  zalb_it = zalb
          ELSE WHERE( 1.0  < ph_ice .AND. ph_ice <= 1.5 )  ;  zalb_it = 0.472  + 2.0 * ( zalb - 0.472 ) * ( ph_ice - 1.0 )
@@ -127,5 +127,5 @@
          ELSE WHERE                                       ;  zalb_it = 0.1    + 3.6    * ph_ice
          END WHERE
-     
+
          DO jl = 1, ijpl
             DO jj = 1, jpj
@@ -133,9 +133,9 @@
                   ! freezing snow
                   ! no effect of underlying ice layer IF snow thickness > c1. Albedo does not depend on snow thick if > c2
-                  !                                        !  freezing snow        
+                  !                                        !  freezing snow
                   zswitch   = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ( ph_snw(ji,jj,jl) - c1 ) ) )
                   zalb_sf   = ( 1._wp - zswitch ) * (  zalb_it(ji,jj,jl)  &
                      &                           + ph_snw(ji,jj,jl) * ( ralb_sf - zalb_it(ji,jj,jl) ) / c1  )   &
-                     &        +         zswitch   * ralb_sf  
+                     &        +         zswitch   * ralb_sf
 
                   ! melting snow
@@ -143,10 +143,10 @@
                   zswitch   = MAX( 0._wp , SIGN( 1._wp , ph_snw(ji,jj,jl) - c2 ) )
                   zalb_sm = ( 1._wp - zswitch ) * ( ralb_im + ph_snw(ji,jj,jl) * ( ralb_sm - ralb_im ) / c2 )   &
-                      &     +         zswitch   *   ralb_sm 
+                      &     +         zswitch   *   ralb_sm
                   !
                   ! snow albedo
-                  zswitch  =  MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) )   
+                  zswitch  =  MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) )
                   zalb_st  =  zswitch * zalb_sm + ( 1._wp - zswitch ) * zalb_sf
-               
+
                   ! Ice/snow albedo
                   zswitch   = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ph_snw(ji,jj,jl) ) )
@@ -155,8 +155,13 @@
                END DO
             END DO
-            
+
+#if defined key_traldf_c2d || key_traldf_c3d
             IF ( ln_stopack .AND. nn_spp_icealb > 0 ) &
                & CALL spp_gen( 1, pa_ice_cs(:,:,jl), nn_spp_icealb, rn_icealb_sd, jk_spp_alb, jl )
-                        
+#else
+            IF ( ln_stopack .AND. nn_spp_icealb > 0 ) &
+               & CALL ctl_stop( 'albedo_ice: parameter perturbation will only work with '// &
+                                'key_traldf_c2d or key_traldf_c3d')
+#endif
          END DO
 
@@ -166,5 +171,5 @@
       !  New parameterization (2016)
       !------------------------------------------
-      CASE( 1 ) 
+      CASE( 1 )
 
          ralb_im = rn_albice  ! bare puddled ice
@@ -181,12 +186,12 @@
 !         ralb_sm = 0.82      ! melting snow
 !         ralb_if = 0.54      ! bare frozen ice
-! 
+!
          !  Computation of ice albedo (free of snow)
-         z1_c1 = 1. / ( LOG(1.5) - LOG(0.05) ) 
+         z1_c1 = 1. / ( LOG(1.5) - LOG(0.05) )
          z1_c2 = 1. / 0.05
          WHERE     ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice )   ;   zalb = ralb_im
          ELSE WHERE                                              ;   zalb = ralb_if
          END  WHERE
-         
+
          WHERE     ( 1.5  < ph_ice                     )  ;  zalb_it = zalb
          ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.5 )  ;  zalb_it = zalb     + ( 0.18 - zalb     ) * z1_c1 *  &
@@ -205,8 +210,8 @@
 
                    ! snow albedo
-                  zswitch = MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) )   
+                  zswitch = MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) )
                   zalb_st = zswitch * zalb_sm + ( 1._wp - zswitch ) * zalb_sf
 
-                  ! Ice/snow albedo   
+                  ! Ice/snow albedo
                   zswitch             = MAX( 0._wp , SIGN( 1._wp , - ph_snw(ji,jj,jl) ) )
                   pa_ice_os(ji,jj,jl) = ( 1._wp - zswitch ) * zalb_st + zswitch *  zalb_it(ji,jj,jl)
@@ -214,14 +219,19 @@
               END DO
             END DO
-            
+
+#if defined key_traldf_c2d || key_traldf_c3d
             IF ( ln_stopack .AND. nn_spp_icealb > 0 ) &
                & CALL spp_gen( 1, pa_ice_os(:,:,jl), nn_spp_icealb, rn_icealb_sd, jk_spp_alb, jl )
-            
+#else
+            IF ( ln_stopack .AND. nn_spp_icealb > 0 ) &
+               & CALL ctl_stop( 'albedo_ice: parameter perturbation will only work with '// &
+                                'key_traldf_c2d or key_traldf_c3d')
+#endif
          END DO
          ! Effect of the clouds (2d order polynomial)
-         pa_ice_cs = pa_ice_os - ( - 0.1010 * pa_ice_os * pa_ice_os + 0.1933 * pa_ice_os - 0.0148 ); 
+         pa_ice_cs = pa_ice_os - ( - 0.1010 * pa_ice_os * pa_ice_os + 0.1933 * pa_ice_os - 0.0148 );
 
       END SELECT
-      
+
       CALL wrk_dealloc( jpi,jpj,ijpl, zalb, zalb_it )
       !
@@ -232,5 +242,5 @@
       !!----------------------------------------------------------------------
       !!               ***  ROUTINE albedo_oce  ***
-      !! 
+      !!
       !! ** Purpose :   Computation of the albedo of the ocean
       !!----------------------------------------------------------------------
@@ -238,9 +248,9 @@
       REAL(wp), DIMENSION(:,:), INTENT(out) ::   pa_oce_cs   !  albedo of ocean under clear sky
       !!
-      REAL(wp) :: zcoef 
+      REAL(wp) :: zcoef
       !!----------------------------------------------------------------------
       !
       zcoef = 0.05 / ( 1.1 * rmue**1.4 + 0.15 )   ! Parameterization of Briegled and Ramanathan, 1982
-      pa_oce_cs(:,:) = zcoef 
+      pa_oce_cs(:,:) = zcoef
       pa_oce_os(:,:) = 0.06                       ! Parameterization of Kondratyev, 1969 and Payne, 1972
       !
@@ -257,5 +267,5 @@
       !!----------------------------------------------------------------------
       INTEGER  ::   ios                 ! Local integer output status for namelist read
-      NAMELIST/namsbc_alb/ nn_ice_alb, rn_albice 
+      NAMELIST/namsbc_alb/ nn_ice_alb, rn_albice
       !!----------------------------------------------------------------------
       !
