Index: LMDZ6/trunk/libf/phylmd/Ocean_skin/esat_m.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Ocean_skin/esat_m.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/Ocean_skin/esat_m.f90	(revision 5965)
@@ -5,11 +5,11 @@
 contains
 
-  elemental real function esat(T, P)
-
+   elemental real function esat(T, P)
+   implicit none
     ! Saturation vapor pressure of water in Pa. Buck, 1981,
     ! J. Appl. Meteor. 20, 1527-1532, equation (8).
-
     real, intent(in):: T ! temperature, in K
     real, intent(in):: P ! air pressure, in Pa
+    real            :: esat
 
     !--------------------------------------------------------------------
Index: LMDZ6/trunk/libf/phylmd/Ocean_skin/sens_heat_rain_m.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Ocean_skin/sens_heat_rain_m.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/Ocean_skin/sens_heat_rain_m.F90	(revision 5965)
@@ -27,5 +27,5 @@
      USE yomcst_mod_h, ONLY: eps_w
 #endif
-
+    real            :: sens_heat_rain
     real, intent(in):: rain ! rain mass flux, in kg m-2 s-1
     real, intent(in):: t ! air temperature at 10 m, in K
Index: LMDZ6/trunk/libf/phylmd/albsno.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/albsno.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/albsno.f90	(revision 5965)
@@ -2,6 +2,10 @@
 ! $Header$
 !
+MODULE albsno_mod
+
+CONTAINS
+
 SUBROUTINE albsno(klon, knon, dtime, agesno, alb_neig_grid, precip_snow)
-
+!$gpum horizontal knon klon
   USE clesphys_mod_h
   IMPLICIT NONE
@@ -28,10 +32,10 @@
   REAL                                 :: as
   REAL, DIMENSION(klon,nvm)            :: veget
-  REAL, DIMENSION(nvm),SAVE            :: init, decay
-  !$OMP THREADPRIVATE(init, decay)
+  REAL, DIMENSION(nvm)       :: init  
+  REAL, DIMENSION(nvm)       :: decay
 
-  DATA init /0.55, 0.14, 0.18, 0.29, 0.15, 0.15, 0.14, 0./
-  DATA decay/0.30, 0.67, 0.63, 0.45, 0.40, 0.14, 0.06, 1./
 !****************************************************************************************
+  init  = (/0.55, 0.14, 0.18, 0.29, 0.15, 0.15, 0.14, 0./)
+  decay = (/0.30, 0.67, 0.63, 0.45, 0.40, 0.14, 0.06, 1./)
 
   if (albsno0>=0.) then
@@ -61,2 +65,4 @@
   
 END SUBROUTINE albsno
+
+END MODULE albsno_mod
Index: LMDZ6/trunk/libf/phylmd/calbeta.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/calbeta.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/calbeta.f90	(revision 5965)
@@ -2,7 +2,11 @@
 ! $Header$
 !
+MODULE calbeta_mod
+
+CONTAINS
+
 SUBROUTINE calbeta(dtime,indice,knon,snow,qsol, &
      vbeta,vcal,vdif)
-
+!$gpum horizontal knon
 USE flux_arp_mod_h
     USE dimphy
@@ -96,4 +100,5 @@
 END SUBROUTINE calbeta
 
+END MODULE calbeta_mod
 
 
@@ -111,3 +116,2 @@
 
 
-
Index: LMDZ6/trunk/libf/phylmd/calcul_fluxs_mod.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/calcul_fluxs_mod.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/calcul_fluxs_mod.f90	(revision 5965)
@@ -15,5 +15,5 @@
        tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &
        sens_prec_liq, sens_prec_sol, lat_prec_liq, lat_prec_sol, rhoa)
-
+!$gpum horizontal knon
     USE indice_sol_mod
     use sens_heat_rain_m, only: sens_heat_rain
@@ -104,6 +104,5 @@
     CHARACTER (len = 20)                 :: modname = 'calcul_fluxs'
     LOGICAL                              :: fonte_neige
-    LOGICAL, SAVE                        :: check = .FALSE.
-    !$OMP THREADPRIVATE(check)
+    LOGICAL, PARAMETER                   :: check = .FALSE.
 
 ! End definition
@@ -281,8 +280,8 @@
        p1lay, t1lay, &
        flux_u1, flux_v1)
-
+!$gpum horizontal knon
     USE clesphys_mod_h
     USE yomcst_mod_h
-USE dimphy
+    USE dimphy
 
 
Index: LMDZ6/trunk/libf/phylmd/fonte_neige_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/fonte_neige_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/fonte_neige_mod.F90	(revision 5965)
@@ -237,5 +237,5 @@
 #endif
      &   )
-
+!$gpum horizontal knon
     USE indice_sol_mod
 #ifdef ISO
Index: LMDZ6/trunk/libf/phylmd/limit_read_mod.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/limit_read_mod.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/limit_read_mod.f90	(revision 5965)
@@ -151,4 +151,5 @@
 !GG
   SUBROUTINE limit_read_hice(knon, knindex, hice_out)
+!$gpum horizontal knon klon
 !
 ! This subroutine returns the sea surface temperature already read from limit.nc.
Index: LMDZ6/trunk/libf/phylmd/ocean_forced_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/ocean_forced_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/ocean_forced_mod.F90	(revision 5965)
@@ -43,4 +43,6 @@
     USE phys_output_var_mod, ONLY : sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o
     use config_ocean_skin_m, only: activate_ocean_skin
+    USE calbeta_mod, ONLY : calbeta
+
 #ifdef ISO
     USE infotrac_phy, ONLY: ntiso,niso
@@ -310,4 +312,5 @@
 #endif            
        )
+!$gpum horizontal knon klon
 !
 ! This subroutine treats the ocean where there is ice. 
@@ -329,4 +332,7 @@
     USE fonte_neige_mod,  ONLY : fonte_neige
     USE indice_sol_mod
+    USE albsno_mod, ONLY : albsno
+    USE soil_mod, ONLY : soil
+    USE calbeta_mod, ONLY : calbeta
     USE phys_output_var_mod, ONLY : sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o
 #ifdef ISO
@@ -412,5 +418,5 @@
 ! Local variables
 !****************************************************************************************
-    LOGICAL                     :: check=.FALSE.
+    LOGICAL,PARAMETER           :: check=.FALSE.
     INTEGER                     :: i, j
     REAL                        :: zfra
@@ -470,5 +476,5 @@
 
 ! albedo  and radiation parameters
-    INTEGER, SAVE :: iflag_sic_albedo
+    INTEGER :: iflag_sic_albedo
 ! albedo old or NEMO
     REAL :: alb_sno_dry!=rn_alb_sdry !dry snow albedo
@@ -492,4 +498,5 @@
     ! ice (not snow). Should be visible only, not NIR
     REAL :: pen_ext !=si_pen_ext !extinction length of penetrating shortwave (m-1)
+    REAl :: lon(knon), lat(knon)   ! for indexation
 
 ! HF from ocean below ice
@@ -535,6 +542,8 @@
     IF (soil_model) THEN 
 ! update tsoil and calculate soilcap and soilflux
+       lon(1:knon) = longitude(knindex(1:knon))
+       lat(1:knon) = latitude(knindex(1:knon))
        CALL soil(dtime, is_sic, knon, snow, tsurf_tmp, qsol, &
-        & longitude(knindex(1:knon)), latitude(knindex(1:knon)), tsoil,soilcap, soilflux)
+        & lon, lat, tsoil,soilcap, soilflux)
        cal(1:knon) = RCPD / soilcap(1:knon)
        radsol(1:knon) = radsol(1:knon)  + soilflux(1:knon)
Index: LMDZ6/trunk/libf/phylmd/ocean_slab_mod.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/ocean_slab_mod.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/ocean_slab_mod.f90	(revision 5965)
@@ -352,4 +352,6 @@
     USE slab_heat_transp_mod, ONLY: divgrad_phy,slab_ekman1,slab_ekman2,slab_gmdiff
     USE mod_phys_lmdz_para
+    USE calbeta_mod, ONLY : calbeta
+
 
 
@@ -691,5 +693,7 @@
    USE clesphys_mod_h
    USE yomcst_mod_h
-USE calcul_fluxs_mod
+   USE calcul_fluxs_mod
+    USE calbeta_mod, ONLY : calbeta
+
 
 
Index: LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 5965)
@@ -113,4 +113,5 @@
     USE climb_qbs_mod, ONLY : climb_qbs_init
     USE yamada_c_mod, ONLY : yamada_c_init
+    USE soil_mod, ONLY : soil_init
 
     IMPLICIT NONE
@@ -272,4 +273,5 @@
     CALL climb_qbs_init
     CALL yamada_c_init
+    CALL soil_init
 
   END SUBROUTINE pbl_surface_init
Index: LMDZ6/trunk/libf/phylmd/soil.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/soil.f90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/soil.f90	(revision 5965)
@@ -2,97 +2,26 @@
 ! $Header$
 !
-SUBROUTINE soil(ptimestep, indice, knon, snow, ptsrf, qsol, &
-     lon, lat, ptsoil, pcapcal, pfluxgrd)
-  
-  USE yomcst_mod_h
-  USE dimphy
-  USE mod_phys_lmdz_para
-  USE indice_sol_mod
-  USE print_control_mod, ONLY: lunout
+MODULE soil_mod
   USE dimsoil_mod_h, ONLY: nsoilmx
-  USE comsoil_mod_h
-  IMPLICIT NONE
-
-!=======================================================================
-!
-!   Auteur:  Frederic Hourdin     30/01/92
-!   -------
-!
-!   Object:  Computation of : the soil temperature evolution
-!   -------                   the surfacic heat capacity "Capcal"
-!                            the surface conduction flux pcapcal
-!
-!   Update: 2021/07 : soil thermal inertia, formerly a constant value,
-!   ------   can also be now a function of soil moisture (F Cheruy's idea)
-!            depending on iflag_inertie, read from physiq.def via conf_phys_m.F90
-!            ("Stage L3" Eve Rebouillat, with E Vignon, A Sima, F Cheruy)
-!
-!   Method: Implicit time integration
-!   -------
-!   Consecutive ground temperatures are related by:
-!           T(k+1) = C(k) + D(k)*T(k)  (*)
-!   The coefficients C and D are computed at the t-dt time-step.
-!   Routine structure:
-!   1) C and D coefficients are computed from the old temperature
-!   2) new temperatures are computed using (*)
-!   3) C and D coefficients are computed from the new temperature
-!      profile for the t+dt time-step
-!   4) the coefficients A and B are computed where the diffusive
-!      fluxes at the t+dt time-step is given by
-!             Fdiff = A + B Ts(t+dt)
-!      or     Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt
-!             with F0 = A + B (Ts(t))
-!                 Capcal = B*dt
-!
-!   Interface:
-!   ----------
-!
-!   Arguments:
-!   ----------
-!   ptimestep            physical timestep (s)
-!   indice               sub-surface index
-!   snow(klon)           snow
-!   ptsrf(klon)          surface temperature at time-step t (K)
-!   qsol(klon)           soil moisture (kg/m2 or mm)
-!   lon(klon)            longitude in radian
-!   lat(klon)            latitude in radian
-!   ptsoil(klon,nsoilmx) temperature inside the ground (K)
-!   pcapcal(klon)        surfacic specific heat (W*m-2*s*K-1)
-!   pfluxgrd(klon)       surface diffusive flux from ground (Wm-2)
-!
-!=======================================================================
-! Arguments
-! ---------
-  REAL, INTENT(IN)                     :: ptimestep
-  INTEGER, INTENT(IN)                  :: indice, knon !, knindex
-  REAL, DIMENSION(knon), INTENT(IN)    :: snow
-  REAL, DIMENSION(knon), INTENT(IN)    :: ptsrf
-  REAL, DIMENSION(knon), INTENT(IN)    :: qsol
-  REAL, DIMENSION(knon), INTENT(IN)    :: lon
-  REAL, DIMENSION(knon), INTENT(IN)    :: lat
-
-  REAL, DIMENSION(knon,nsoilmx), INTENT(INOUT) :: ptsoil
-  REAL, DIMENSION(knon), INTENT(OUT)           :: pcapcal
-  REAL, DIMENSION(knon), INTENT(OUT)           :: pfluxgrd
-
-!-----------------------------------------------------------------------
-! Local variables
-! ---------------
-  INTEGER                             :: ig, jk, ierr
-  REAL                                :: min_period,dalph_soil
-  REAL, DIMENSION(nsoilmx)            :: zdz2
-  REAL                                :: z1s
-  REAL, DIMENSION(knon)               :: ztherm_i
-  REAL, DIMENSION(knon,nsoilmx,nbsrf) :: C_coef, D_coef
-
-! Local saved variables
-! ---------------------
+  PRIVATE
+  
   REAL, SAVE                     :: lambda
 !$OMP THREADPRIVATE(lambda)
   REAL, DIMENSION(nsoilmx), SAVE :: dz1, dz2
 !$OMP THREADPRIVATE(dz1,dz2)
-  LOGICAL, SAVE                  :: firstcall=.TRUE.
-!$OMP THREADPRIVATE(firstcall)
-    
+  LOGICAL, SAVE                  :: is_initialized=.FALSE.
+!$OMP THREADPRIVATE(is_initialized)
+
+  PUBLIC :: soil_init, soil
+
+CONTAINS
+
+SUBROUTINE soil_init
+USE dimsoil_mod_h, ONLY: nsoilmx
+USE print_control_mod, ONLY: lunout
+USE mod_phys_lmdz_para
+IMPLICIT NONE
+  REAL                                :: min_period,dalph_soil
+  INTEGER                             :: ig, jk, ierr
 !-----------------------------------------------------------------------
 !   Depthts:
@@ -107,9 +36,9 @@
 !-----------------------------------------------------------------------
 
-  IF (firstcall) THEN
 !-----------------------------------------------------------------------
 !   ground levels 
 !   grnd=z/l where l is the skin depth of the diurnal cycle:
 !-----------------------------------------------------------------------
+    IF (.NOT. is_initialized) THEN
 
      min_period=1800. ! en secondes
@@ -154,6 +83,92 @@
      ENDDO
 
-     firstcall =.FALSE.
+     is_initialized=.TRUE.
   END IF
+
+END SUBROUTINE  soil_init
+
+SUBROUTINE soil(ptimestep, indice, knon, snow, ptsrf, qsol, &
+     lon, lat, ptsoil, pcapcal, pfluxgrd)
+!$gpum horizontal knon klon
+  USE yomcst_mod_h
+  USE dimphy
+  USE mod_phys_lmdz_para
+  USE indice_sol_mod
+  USE print_control_mod, ONLY: lunout
+  USE dimsoil_mod_h, ONLY: nsoilmx
+  USE comsoil_mod_h
+  IMPLICIT NONE
+
+!=======================================================================
+!
+!   Auteur:  Frederic Hourdin     30/01/92
+!   -------
+!
+!   Object:  Computation of : the soil temperature evolution
+!   -------                   the surfacic heat capacity "Capcal"
+!                            the surface conduction flux pcapcal
+!
+!   Update: 2021/07 : soil thermal inertia, formerly a constant value,
+!   ------   can also be now a function of soil moisture (F Cheruy's idea)
+!            depending on iflag_inertie, read from physiq.def via conf_phys_m.F90
+!            ("Stage L3" Eve Rebouillat, with E Vignon, A Sima, F Cheruy)
+!
+!   Method: Implicit time integration
+!   -------
+!   Consecutive ground temperatures are related by:
+!           T(k+1) = C(k) + D(k)*T(k)  (*)
+!   The coefficients C and D are computed at the t-dt time-step.
+!   Routine structure:
+!   1) C and D coefficients are computed from the old temperature
+!   2) new temperatures are computed using (*)
+!   3) C and D coefficients are computed from the new temperature
+!      profile for the t+dt time-step
+!   4) the coefficients A and B are computed where the diffusive
+!      fluxes at the t+dt time-step is given by
+!             Fdiff = A + B Ts(t+dt)
+!      or     Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt
+!             with F0 = A + B (Ts(t))
+!                 Capcal = B*dt
+!
+!   Interface:
+!   ----------
+!
+!   Arguments:
+!   ----------
+!   ptimestep            physical timestep (s)
+!   indice               sub-surface index
+!   snow(klon)           snow
+!   ptsrf(klon)          surface temperature at time-step t (K)
+!   qsol(klon)           soil moisture (kg/m2 or mm)
+!   lon(klon)            longitude in radian
+!   lat(klon)            latitude in radian
+!   ptsoil(klon,nsoilmx) temperature inside the ground (K)
+!   pcapcal(klon)        surfacic specific heat (W*m-2*s*K-1)
+!   pfluxgrd(klon)       surface diffusive flux from ground (Wm-2)
+!
+!=======================================================================
+! Arguments
+! ---------
+  REAL, INTENT(IN)                     :: ptimestep
+  INTEGER, INTENT(IN)                  :: indice, knon !, knindex
+  REAL, DIMENSION(knon), INTENT(IN)    :: snow
+  REAL, DIMENSION(knon), INTENT(IN)    :: ptsrf
+  REAL, DIMENSION(knon), INTENT(IN)    :: qsol
+  REAL, DIMENSION(knon), INTENT(IN)    :: lon
+  REAL, DIMENSION(knon), INTENT(IN)    :: lat
+
+  REAL, DIMENSION(knon,nsoilmx), INTENT(INOUT) :: ptsoil
+  REAL, DIMENSION(knon), INTENT(OUT)           :: pcapcal
+  REAL, DIMENSION(knon), INTENT(OUT)           :: pfluxgrd
+
+!-----------------------------------------------------------------------
+! Local variables
+! ---------------
+  INTEGER                             :: ig, jk, ierr
+  REAL, DIMENSION(nsoilmx)            :: zdz2
+  REAL                                :: z1s
+  REAL, DIMENSION(knon)               :: ztherm_i
+  REAL, DIMENSION(knon,nsoilmx,nbsrf) :: C_coef, D_coef
+
 
 
@@ -351,2 +366,4 @@
     
 END SUBROUTINE soil
+
+END MODULE soil_mod
Index: LMDZ6/trunk/libf/phylmd/surf_land_bucket_hetero_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/surf_land_bucket_hetero_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/surf_land_bucket_hetero_mod.F90	(revision 5965)
@@ -41,4 +41,6 @@
     USE surf_param_mod, ONLY: eff_surf_param, average_surf_var
     USE cdrag_mod
+    USE albsno_mod, ONLY :  albsno
+    USE calbeta_mod, ONLY :  calbeta
 
 #ifdef ISO
Index: LMDZ6/trunk/libf/phylmd/surf_land_bucket_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/surf_land_bucket_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/surf_land_bucket_mod.F90	(revision 5965)
@@ -47,4 +47,8 @@
     USE yomcst_mod_h
     USE dimsoil_mod_h, ONLY: nsoilmx
+    USE albsno_mod, ONLY :  albsno
+    USE soil_mod, ONLY :  soil
+    USE calbeta_mod, ONLY :  calbeta
+
 !****************************************************************************************
 ! Bucket calculations for surface.
Index: LMDZ6/trunk/libf/phylmd/surf_landice_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/surf_landice_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/surf_landice_mod.F90	(revision 5965)
@@ -58,4 +58,8 @@
     USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INLANDSIS
     USE dimsoil_mod_h, ONLY: nsoilmx
+    USE albsno_mod, ONLY : albsno
+    USE soil_mod, ONLY : soil
+    USE calbeta_mod, ONLY :  calbeta
+
 
 
Index: LMDZ6/trunk/libf/phylmd/surf_seaice_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/surf_seaice_mod.F90	(revision 5964)
+++ LMDZ6/trunk/libf/phylmd/surf_seaice_mod.F90	(revision 5965)
@@ -31,4 +31,5 @@
 #endif               
          &      )
+!$gpum horizontal knon klon
 
   USE dimphy
@@ -150,5 +151,5 @@
 !****************************************************************************************
     IF (type_ocean == 'couple') THEN
-       
+!$gpum nocall       
        CALL ocean_cpl_ice( &
             rlon, rlat, swnet, lwnet, alb1, & 
@@ -165,4 +166,5 @@
        
     ELSE IF (type_ocean == 'slab'.AND.version_ocean=='sicINT') THEN
+!$gpum nocall  
        CALL ocean_slab_ice( & 
           itime, dtime, jour, knon, knindex, &
@@ -176,5 +178,7 @@
 
       ELSE ! type_ocean=force or slab +sicOBS or sicNO
+
        IF (is_master) WRITE(lunout,*) "******* CHECKSUM  ==> ocean_forced IN *******"
+!$gpum nocall checksum
        CALL checksum("itime", itime)
        CALL checksum("dtime", dtime)
