Index: LMDZ6/branches/Ocean_skin/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/pbl_surface_mod.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/pbl_surface_mod.F90	(revision 3458)
@@ -27,4 +27,5 @@
 !!                                  wx_pbl_fuse, wx_pbl_split
                                   wx_pbl0_fuse, wx_pbl0_split
+  use config_ocean_skin_m, only: activate_ocean_skin
 
   IMPLICIT NONE
@@ -963,12 +964,14 @@
     rh2m_x(:) = 0. ; qsat2m_x(:) = 0. ; rh2m_w(:) = 0. ; qsat2m_w(:) = 0.
 
-    t_int = nf90_fill_real
-    s_int = nf90_fill_real
-    dter = nf90_fill_real
-    dser = nf90_fill_real
-    tkt = nf90_fill_real
-    tks = nf90_fill_real
-    rf = nf90_fill_real
-    taur = nf90_fill_real
+    if (activate_ocean_skin >= 1) then
+       t_int = nf90_fill_real
+       s_int = nf90_fill_real
+       dter = nf90_fill_real
+       dser = nf90_fill_real
+       tkt = nf90_fill_real
+       tks = nf90_fill_real
+       rf = nf90_fill_real
+       taur = nf90_fill_real
+    end if
 
 ! 2b) Initialization of all local variables that will be compressed later
@@ -1431,5 +1434,5 @@
        ENDIF
 
-       if (nsrf == is_oce) then
+       if (nsrf == is_oce .and. activate_ocean_skin >= 1) then
           yds_ns(:knon) = ds_ns(ni(:knon))
           ydt_ns(:knon) = dt_ns(ni(:knon))
@@ -2561,5 +2564,5 @@
        ENDIF
 
-       if (nsrf == is_oce) then
+       if (nsrf == is_oce .and. activate_ocean_skin >= 1) then
           dt_ns = nf90_fill_real
           ds_ns = nf90_fill_real
@@ -3188,4 +3191,5 @@
     USE indice_sol_mod
     use phys_state_var_mod, only: ds_ns, dt_ns
+    use config_ocean_skin_m, only: activate_ocean_skin
 
     INCLUDE "dimsoil.h"
@@ -3274,6 +3278,8 @@
                       alb_dif(i,k,nsrf) = 0.06
                    ENDDO
-                   ds_ns(i) = 0.
-                   dt_ns(i) = 0.
+                   if (activate_ocean_skin >= 1) then
+                      ds_ns(i) = 0.
+                      dt_ns(i) = 0.
+                   end if
                 ELSE IF (nsrf.EQ.is_sic) THEN
                    tsurf(i,nsrf) = 271.35
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0.F90	(revision 3458)
@@ -30,4 +30,5 @@
   USE time_phylmdz_mod, ONLY: init_iteration, pdtphys, itau_phy
   use netcdf, only: nf90_fill_real
+  use config_ocean_skin_m, only: activate_ocean_skin
 
   IMPLICIT none
@@ -529,11 +530,14 @@
   CALL fonte_neige_init(run_off_lic_0)
 
-  found = phyetat0_get(1, ds_ns, "ds_ns", "delta salinity near surface", 0.)
-  found = phyetat0_get(1, dt_ns, "dT_ns", "delta temperature near surface", 0.)
-
-  where (pctsrf(:, is_oce) == 0.)
-     ds_ns = nf90_fill_real
-     dt_ns = nf90_fill_real
-  end where
+  if (activate_ocean_skin >= 1) then
+     found = phyetat0_get(1, ds_ns, "ds_ns", "delta salinity near surface", 0.)
+     found = phyetat0_get(1, dt_ns, "dT_ns", "delta temperature near surface", &
+          0.)
+
+     where (pctsrf(:, is_oce) == 0.)
+        ds_ns = nf90_fill_real
+        dt_ns = nf90_fill_real
+     end where
+  end if
 
 END SUBROUTINE phyetat0
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phyredem.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phyredem.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phyredem.F90	(revision 3458)
@@ -37,4 +37,5 @@
   USE ocean_slab_mod, ONLY : nslay, tslab, seaice, tice, fsic
   USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys
+  use config_ocean_skin_m, only: activate_ocean_skin  
 
   IMPLICIT none
@@ -337,6 +338,8 @@
        "tendency on zonal wind due to acama gravity waves", du_gwd_front)
 
-  CALL put_field("ds_ns", "delta salinity near surface", ds_ns)
-  CALL put_field("dT_ns", "delta temperature near surface", dT_ns)
+  if (activate_ocean_skin >= 1) then
+     CALL put_field("ds_ns", "delta salinity near surface", ds_ns)
+     CALL put_field("dT_ns", "delta temperature near surface", dT_ns)
+  end if
   
   CALL close_restartphy
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_var_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_var_mod.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_var_mod.F90	(revision 3458)
@@ -167,4 +167,5 @@
   SUBROUTINE phys_output_var_init
     use dimphy
+    use config_ocean_skin_m, only: activate_ocean_skin
 
     IMPLICIT NONE
@@ -220,6 +221,6 @@
     IF (ok_gwd_rando) allocate(zustr_gwd_rando(klon), zvstr_gwd_rando(klon))
 
-    allocate(t_int(klon), s_int(klon), dter(klon), dser(klon), tkt(klon), &
-         tks(klon), rf(klon), taur(klon))
+    if (activate_ocean_skin >= 1) allocate(t_int(klon), s_int(klon), &
+         dter(klon), dser(klon), tkt(klon), tks(klon), rf(klon), taur(klon))
 
   END SUBROUTINE phys_output_var_init
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_write_mod.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_write_mod.F90	(revision 3458)
@@ -376,4 +376,5 @@
 #endif
     USE tracinca_mod, ONLY: config_inca
+    use config_ocean_skin_m, only: activate_ocean_skin
 
     IMPLICIT NONE
@@ -2111,14 +2112,16 @@
        ENDIF   !(iflag_phytrac==1)
 
-       CALL histwrite_phy(o_t_int, t_int)
-       CALL histwrite_phy(o_s_int, s_int)
-       CALL histwrite_phy(o_ds_ns, ds_ns)
-       CALL histwrite_phy(o_dt_ns, dt_ns)
-       CALL histwrite_phy(o_dter, dter)
-       CALL histwrite_phy(o_dser, dser)
-       CALL histwrite_phy(o_tkt, tkt)
-       CALL histwrite_phy(o_tks, tks)
-       CALL histwrite_phy(o_rf, rf)
-       CALL histwrite_phy(o_taur, taur)
+       if (activate_ocean_skin >= 1) then
+          CALL histwrite_phy(o_t_int, t_int)
+          CALL histwrite_phy(o_s_int, s_int)
+          CALL histwrite_phy(o_ds_ns, ds_ns)
+          CALL histwrite_phy(o_dt_ns, dt_ns)
+          CALL histwrite_phy(o_dter, dter)
+          CALL histwrite_phy(o_dser, dser)
+          CALL histwrite_phy(o_tkt, tkt)
+          CALL histwrite_phy(o_tks, tks)
+          CALL histwrite_phy(o_rf, rf)
+          CALL histwrite_phy(o_taur, taur)
+       end if
 
        IF (.NOT.vars_defined) THEN
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90	(revision 3458)
@@ -439,4 +439,5 @@
 USE infotrac_phy, ONLY : nbtr
 USE indice_sol_mod
+use config_ocean_skin_m, only: activate_ocean_skin
 IMPLICIT NONE
 
@@ -621,12 +622,14 @@
       if (.not. ok_hines .and. ok_gwd_rando) allocate(du_gwd_front(klon, klev))
 
-      ALLOCATE(ds_ns(klon), dt_ns(klon))
+      if (activate_ocean_skin >= 1) ALLOCATE(ds_ns(klon), dt_ns(klon))
 
     END SUBROUTINE phys_state_var_init
 
 !======================================================================
-SUBROUTINE phys_state_var_end
+    SUBROUTINE phys_state_var_end
+      ! Useful only for lmdz1d.
 !USE dimphy
 USE indice_sol_mod
+use config_ocean_skin_m, only: activate_ocean_skin
 IMPLICIT NONE
 include "clesphys.h"
@@ -754,4 +757,5 @@
       deallocate(ale_bl_trig)
 !!! fin nrlmd le 10/04/2012
+      if (activate_ocean_skin >= 1) deALLOCATE(ds_ns, dt_ns)
 
 END SUBROUTINE phys_state_var_end
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/surf_ocean_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/surf_ocean_mod.F90	(revision 3434)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/surf_ocean_mod.F90	(revision 3458)
@@ -33,4 +33,5 @@
     USE limit_read_mod
     use sens_heat_rain_m, only: sens_heat_rain
+    use config_ocean_skin_m, only: activate_ocean_skin
     !
     ! This subroutine will make a call to ocean_XXX_noice according to the ocean mode (force, 
@@ -103,5 +104,5 @@
     REAL, intent(out):: t_int(:) ! (knon) interface temperature, in K
     real, intent(out):: s_int(:) ! (knon) interface salinity, in ppt
-    
+
     REAL, intent(out):: dter(:) ! (knon)
     ! Temperature variation in the diffusive microlayer, that is
@@ -311,19 +312,23 @@
     ENDIF
 
-    rhoa = PS(:KNON) / (Rd * temp_air(:knon) * (1. + retv * spechum(:knon)))
-    xlv = rlvtt
-    precip_tot = precip_rain(:knon) + precip_snow(:knon)
-    rf =  sens_heat_rain(precip_tot, temp_air(:knon), spechum(:knon), rhoa, &
-         xlv, tsurf_new(:knon), ps(:knon))
-    s1 = 35.
-    call bulk_flux(tkt, tks, taur, dter, dser, t_int, s_int, ds_ns, dt_ns, &
-         u = windsp(:knon), t_ocean_1 = tsurf_new(:knon), s1 = s1, &
-         rain = precip_tot, hf = - fluxsens(:knon), hlb = - fluxlat(:knon), &
-         rnl = - lwnet(:knon), &
-         tau = sqrt(flux_u1(:knon)**2 + flux_v1(:knon)**2), rhoa = rhoa, &
-         xlv = xlv, rf = rf, dtime = dtime, rns = swnet(:knon))
+    if (activate_ocean_skin >= 1) then
+       rhoa = PS(:KNON) / (Rd * temp_air(:knon) * (1. + retv * spechum(:knon)))
+       xlv = rlvtt
+       precip_tot = precip_rain(:knon) + precip_snow(:knon)
+       rf =  sens_heat_rain(precip_tot, temp_air(:knon), spechum(:knon), rhoa, &
+            xlv, tsurf_new(:knon), ps(:knon))
+       s1 = 35.
+       call bulk_flux(tkt, tks, taur, dter, dser, t_int, s_int, ds_ns, dt_ns, &
+            u = windsp(:knon), t_ocean_1 = tsurf_new(:knon), s1 = s1, &
+            rain = precip_tot, hf = - fluxsens(:knon), hlb = - fluxlat(:knon), &
+            rnl = - lwnet(:knon), &
+            tau = sqrt(flux_u1(:knon)**2 + flux_v1(:knon)**2), rhoa = rhoa, &
+            xlv = xlv, rf = rf, dtime = dtime, rns = swnet(:knon))
+    end if
+    
+    if (activate_ocean_skin == 2) tsurf_new(:knon) = t_int
 
   END SUBROUTINE surf_ocean
-  !******************************************************************************
+  !****************************************************************************
   !
 END MODULE surf_ocean_mod
