Index: LMDZ5/trunk/libf/phy1d/lmdz1d.F
===================================================================
--- LMDZ5/trunk/libf/phy1d/lmdz1d.F	(revision 1826)
+++ LMDZ5/trunk/libf/phy1d/lmdz1d.F	(revision 1827)
@@ -632,6 +632,6 @@
         zval=0. 
         zthe=0. 
-        ema_work1=0.
-        ema_work2=0.
+        sig1=0.
+        w01=0.
         u_ancien(1,:)=u(:)
         v_ancien(1,:)=v(:)
@@ -647,5 +647,5 @@
 ! agesno(:,nsrf),zmea,zstd,zsig,zgam,zthe,zpic,zval,rugoro
 ! t_ancien,q_ancien,frugs(:,is_oce),clwcon(:,1),rnebcon(:,1),ratqs(:,1)
-! run_off_lic_0,pbl_tke(:,1:klev,nsrf),zmax0,f0,ema_work1,ema_work2
+! run_off_lic_0,pbl_tke(:,1:klev,nsrf),zmax0,f0,sig1,w01
 ! wake_deltat,wake_deltaq,wake_s,wake_cstar,wake_fip
 !------------------------------------------------------------------------
Index: LMDZ5/trunk/libf/phylmd/concvl.F
===================================================================
--- LMDZ5/trunk/libf/phylmd/concvl.F	(revision 1826)
+++ LMDZ5/trunk/libf/phylmd/concvl.F	(revision 1827)
@@ -2,5 +2,5 @@
      .             dtime,paprs,pplay,
      .             t,q,t_wake,q_wake,s_wake,u,v,tra,ntra,
-     .             ALE,ALP,work1,work2,
+     .             ALE,ALP,sig1,w01,
      .             d_t,d_q,d_u,d_v,d_tra,
      .             rain, snow, kbas, ktop, sigd,
@@ -80,5 +80,5 @@
        REAL tra(klon,klev,nbtr)
        INTEGER ntra
-       REAL work1(klon,klev),work2(klon,klev),ptop2(klon)
+       REAL sig1(klon,klev),w01(klon,klev),ptop2(klon)
        REAL pmflxr(klon,klev+1),pmflxs(klon,klev+1)
        REAL ALE(klon),ALP(klon)
@@ -359,5 +359,5 @@
      $              em_p,em_ph,iflag,
      $              d_t,d_q,d_u,d_v,d_tra,rain,
-     $              Vprecip,cbmf,work1,work2,                  !jyg
+     $              Vprecip,cbmf,sig1,w01,                  !jyg
      $              kbas,ktop,
      $              dtime,Ma,upwd,dnwd,dnwdbis,qcondc,wd,cape,
@@ -382,5 +382,5 @@
      .              em_sig1feed,em_sig2feed,em_wght,
      .              iflag,d_t,d_q,d_u,d_v,d_tra,rain,kbas,ktop,
-     $              cbmf,plcl,plfc,wbeff,work1,work2,ptop2,sigd,
+     $              cbmf,plcl,plfc,wbeff,sig1,w01,ptop2,sigd,
      $              Ma,mip,Vprecip,upwd,dnwd,dnwdbis,qcondc,wd,
      $              cape,cin,tvp,
Index: LMDZ5/trunk/libf/phylmd/etat0_netcdf.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/etat0_netcdf.F90	(revision 1826)
+++ LMDZ5/trunk/libf/phylmd/etat0_netcdf.F90	(revision 1827)
@@ -504,6 +504,6 @@
   zmax0(:) = 40.
   f0(:) = 1.e-5
-  ema_work1(:,:) = 0.
-  ema_work2(:,:) = 0.
+  sig1(:,:) = 0.
+  w01(:,:) = 0.
   wake_deltat(:,:) = 0.
   wake_deltaq(:,:) = 0.
Index: LMDZ5/trunk/libf/phylmd/phyaqua.F
===================================================================
--- LMDZ5/trunk/libf/phylmd/phyaqua.F	(revision 1826)
+++ LMDZ5/trunk/libf/phylmd/phyaqua.F	(revision 1827)
@@ -340,6 +340,6 @@
       zmax0=0.
       f0=0.
-      ema_work1=0.
-      ema_work2=0.
+      sig1=0.
+      w01=0.
       wake_deltat=0.
       wake_deltaq=0.
Index: LMDZ5/trunk/libf/phylmd/phyetat0.F
===================================================================
--- LMDZ5/trunk/libf/phylmd/phyetat0.F	(revision 1826)
+++ 	(revision )
@@ -1,1105 +1,0 @@
-!
-! $Id$
-!
-c
-c
-      SUBROUTINE phyetat0 (fichnom,
-     .           clesphy0,
-     .           tabcntr0)
-
-      USE dimphy
-      USE mod_grid_phy_lmdz
-      USE mod_phys_lmdz_para
-      USE iophy
-      USE ocean_cpl_mod,    ONLY : ocean_cpl_init
-      USE fonte_neige_mod,  ONLY : fonte_neige_init
-      USE pbl_surface_mod,  ONLY : pbl_surface_init
-      USE surface_data,     ONLY : type_ocean
-      USE phys_state_var_mod
-      USE iostart
-      USE write_field_phy
-      USE infotrac
-      USE traclmdz_mod,    ONLY : traclmdz_from_restart
-      USE carbon_cycle_mod,ONLY :
-     &     carbon_cycle_tr, carbon_cycle_cpl, co2_send
-      USE indice_sol_mod
-
-      IMPLICIT none
-c======================================================================
-c Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
-c Objet: Lecture de l'etat initial pour la physique
-c======================================================================
-#include "dimensions.h"
-#include "netcdf.inc"
-#include "dimsoil.h"
-#include "clesphys.h"
-#include "temps.h"
-#include "thermcell.h"
-#include "compbl.h"
-c======================================================================
-      CHARACTER*(*) fichnom
-
-c les variables globales lues dans le fichier restart
-
-      REAL tsoil(klon,nsoilmx,nbsrf)
-      REAL tslab(klon), seaice(klon)
-      REAL qsurf(klon,nbsrf)
-      REAL qsol(klon)
-      REAL snow(klon,nbsrf)
-      REAL evap(klon,nbsrf)
-      real fder(klon)
-      REAL frugs(klon,nbsrf)
-      REAL agesno(klon,nbsrf)
-      REAL run_off_lic_0(klon)
-      REAL fractint(klon)
-      REAL trs(klon,nbtr)
-
-      CHARACTER*6 ocean_in
-      LOGICAL ok_veget_in
-
-      INTEGER        longcles
-      PARAMETER    ( longcles = 20 )
-      REAL clesphy0( longcles )
-c
-      REAL xmin, xmax
-c
-      INTEGER nid, nvarid
-      INTEGER ierr, i, nsrf, isoil ,k
-      INTEGER length
-      PARAMETER (length=100)
-      INTEGER it, iiq
-      REAL tab_cntrl(length), tabcntr0(length)
-      CHARACTER*7 str7
-      CHARACTER*2 str2
-      LOGICAL :: found
-
-c FH1D
-c     real iolat(jjm+1)
-      real iolat(jjm+1-1/(iim*jjm))
-c
-c Ouvrir le fichier contenant l'etat initial:
-c
-
-     
-      CALL open_startphy(fichnom)
-      
-
-c
-c Lecture des parametres de controle:
-c
-      CALL get_var("controle",tab_cntrl)
-       
-c
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
-! Les constantes de la physiques sont lues dans la physique seulement.
-! Les egalites du type
-!             tab_cntrl( 5 )=clesphy0(1)
-! sont remplacees par
-!             clesphy0(1)=tab_cntrl( 5 )
-! On inverse aussi la logique.
-! On remplit les tab_cntrl avec les parametres lus dans les .def
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-         DO i = 1, length
-           tabcntr0( i ) = tab_cntrl( i )
-         ENDDO
-c
-         tab_cntrl(1)=dtime
-         tab_cntrl(2)=radpas
-
-c co2_ppm : value from the previous time step
-         IF (carbon_cycle_tr .OR. carbon_cycle_cpl) THEN
-            co2_ppm = tab_cntrl(3)
-            RCO2    = co2_ppm * 1.0e-06  * 44.011/28.97 
-c ELSE : keep value from .def
-         END IF
-
-c co2_ppm0 : initial value of atmospheric CO2 (from create_etat0_limit.e .def)
-         co2_ppm0   = tab_cntrl(16)
-
-         solaire_etat0      = tab_cntrl(4)
-         tab_cntrl(5)=iflag_con
-         tab_cntrl(6)=nbapp_rad
-
-         if (cycle_diurne) tab_cntrl( 7) =1.
-         if (soil_model) tab_cntrl( 8) =1.
-         if (new_oliq) tab_cntrl( 9) =1.
-         if (ok_orodr) tab_cntrl(10) =1.
-         if (ok_orolf) tab_cntrl(11) =1.
-         if (ok_limitvrai) tab_cntrl(12) =1.
-
-
-      itau_phy = tab_cntrl(15)
-
-       
-      clesphy0(1)=tab_cntrl( 5 )
-      clesphy0(2)=tab_cntrl( 6 )
-      clesphy0(3)=tab_cntrl( 7 )
-      clesphy0(4)=tab_cntrl( 8 )
-      clesphy0(5)=tab_cntrl( 9 )
-      clesphy0(6)=tab_cntrl( 10 )
-      clesphy0(7)=tab_cntrl( 11 )
-      clesphy0(8)=tab_cntrl( 12 )
-
-c
-c Lecture des latitudes (coordonnees):
-c
-      CALL get_field("latitude",rlat)
-
-c
-c Lecture des longitudes (coordonnees):
-c
-      CALL get_field("longitude",rlon)
-
-C
-C
-C Lecture du masque terre mer
-C
-      CALL get_field("masque",zmasq,found)
-      IF (.NOT. found) THEN
-        PRINT*, 'phyetat0: Le champ <masque> est absent'
-        PRINT *, 'fichier startphy non compatible avec phyetat0'
-      ENDIF
-
-       
-C Lecture des fractions pour chaque sous-surface
-C
-C initialisation des sous-surfaces
-C
-      pctsrf = 0.
-C
-C fraction de terre
-C
-
-      CALL get_field("FTER",pctsrf(:,is_ter),found)
-      IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FTER> est absent'
-
-C
-C fraction de glace de terre
-C
-      CALL get_field("FLIC",pctsrf(:,is_lic),found)
-      IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FLIC> est absent'
-
-C
-C fraction d'ocean
-C
-      CALL get_field("FOCE",pctsrf(:,is_oce),found)
-      IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FOCE> est absent'
-
-C
-C fraction glace de mer
-C
-      CALL get_field("FSIC",pctsrf(:,is_sic),found)
-      IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FSIC> est absent'
-
-C
-C  Verification de l'adequation entre le masque et les sous-surfaces
-C
-      fractint( 1 : klon) = pctsrf(1 : klon, is_ter) 
-     $    + pctsrf(1 : klon, is_lic)
-      DO i = 1 , klon
-        IF ( abs(fractint(i) - zmasq(i) ) .GT. EPSFRA ) THEN
-            WRITE(*,*) 'phyetat0: attention fraction terre pas ', 
-     $          'coherente ', i, zmasq(i), pctsrf(i, is_ter)
-     $          ,pctsrf(i, is_lic)
-            WRITE(*,*) 'Je force la coherence zmasq=fractint'
-            zmasq(i) = fractint(i)
-        ENDIF 
-      END DO 
-      fractint (1 : klon) =  pctsrf(1 : klon, is_oce) 
-     $    + pctsrf(1 : klon, is_sic)
-      DO i = 1 , klon
-        IF ( abs( fractint(i) - (1. - zmasq(i))) .GT. EPSFRA ) THEN
-            WRITE(*,*) 'phyetat0 attention fraction ocean pas ', 
-     $          'coherente ', i, zmasq(i) , pctsrf(i, is_oce)
-     $          ,pctsrf(i, is_sic)
-            WRITE(*,*) 'Je force la coherence zmasq=fractint'
-            zmasq(i) = fractint(i)
-        ENDIF 
-      END DO 
-
-C
-c Lecture des temperatures du sol:
-c
-
-       CALL get_field("TS",ftsol(:,1),found)
-       IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <TS> est absent'
-         PRINT*, '          Mais je vais essayer de lire TS**'
-         DO nsrf = 1, nbsrf
-           IF (nsrf.GT.99) THEN
-             PRINT*, "Trop de sous-mailles"
-             CALL abort
-           ENDIF
-           WRITE(str2,'(i2.2)') nsrf
-           CALL get_field("TS"//str2,ftsol(:,nsrf))
-
-           xmin = 1.0E+20
-           xmax = -1.0E+20
-           DO i = 1, klon
-              xmin = MIN(ftsol(i,nsrf),xmin)
-              xmax = MAX(ftsol(i,nsrf),xmax)
-           ENDDO
-           PRINT*,'Temperature du sol TS**:', nsrf, xmin, xmax
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <TS> est present'
-         PRINT*, '          J ignore donc les autres temperatures TS**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(ftsol(i,1),xmin)
-            xmax = MAX(ftsol(i,1),xmax)
-         ENDDO
-         PRINT*,'Temperature du sol <TS>', xmin, xmax
-         DO nsrf = 2, nbsrf
-         DO i = 1, klon
-            ftsol(i,nsrf) = ftsol(i,1)
-         ENDDO
-         ENDDO
-      ENDIF
-
-c
-c Lecture des temperatures du sol profond:
-c
-      DO nsrf = 1, nbsrf
-        DO isoil=1, nsoilmx
-          IF (isoil.GT.99 .AND. nsrf.GT.99) THEN
-            PRINT*, "Trop de couches ou sous-mailles"
-            CALL abort
-          ENDIF
-          WRITE(str7,'(i2.2,"srf",i2.2)') isoil, nsrf
-          
-          CALL get_field('Tsoil'//str7,tsoil(:,isoil,nsrf),found)
-          IF (.NOT. found) THEN
-            PRINT*, "phyetat0: Le champ <Tsoil"//str7//"> est absent"
-            PRINT*, "          Il prend donc la valeur de surface"
-            DO i=1, klon
-               tsoil(i,isoil,nsrf)=ftsol(i,nsrf)
-            ENDDO
-          ENDIF
-        ENDDO
-      ENDDO
-c
-c Lecture de l'humidite de l'air juste au dessus du sol:
-c
-
-      CALL get_field("QS",qsurf(:,1),found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <QS> est absent'
-         PRINT*, '          Mais je vais essayer de lire QS**'
-         DO nsrf = 1, nbsrf
-           IF (nsrf.GT.99) THEN
-             PRINT*, "Trop de sous-mailles"
-             CALL abort
-           ENDIF
-           WRITE(str2,'(i2.2)') nsrf
-           CALL get_field("QS"//str2,qsurf(:,nsrf))
-           xmin = 1.0E+20
-           xmax = -1.0E+20
-           DO i = 1, klon
-              xmin = MIN(qsurf(i,nsrf),xmin)
-              xmax = MAX(qsurf(i,nsrf),xmax)
-           ENDDO
-           PRINT*,'Humidite pres du sol QS**:', nsrf, xmin, xmax
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <QS> est present'
-         PRINT*, '          J ignore donc les autres humidites QS**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(qsurf(i,1),xmin)
-            xmax = MAX(qsurf(i,1),xmax)
-         ENDDO
-         PRINT*,'Humidite pres du sol <QS>', xmin, xmax
-         DO nsrf = 2, nbsrf
-           DO i = 1, klon
-             qsurf(i,nsrf) = qsurf(i,1)
-           ENDDO
-         ENDDO
-      ENDIF
-
-C
-C Eau dans le sol (pour le modele de sol "bucket")
-C
-      CALL get_field("QSOL",qsol,found)
-      IF (.NOT. found) THEN
-        PRINT*, 'phyetat0: Le champ <QSOL> est absent'
-        PRINT*, '          Valeur par defaut nulle'
-          qsol(:)=0.
-      ENDIF
-
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-        xmin = MIN(qsol(i),xmin)
-        xmax = MAX(qsol(i),xmax)
-      ENDDO
-      PRINT*,'Eau dans le sol (mm) <QSOL>', xmin, xmax
-
-c
-c Lecture de neige au sol:
-c
-
-      CALL get_field("SNOW",snow(:,1),found)
-      IF (.NOT. found) THEN
-        PRINT*, 'phyetat0: Le champ <SNOW> est absent'
-        PRINT*, '          Mais je vais essayer de lire SNOW**'
-        DO nsrf = 1, nbsrf
-          IF (nsrf.GT.99) THEN
-            PRINT*, "Trop de sous-mailles"
-            CALL abort
-          ENDIF
-          WRITE(str2,'(i2.2)') nsrf
-          CALL get_field( "SNOW"//str2,snow(:,nsrf))
-          xmin = 1.0E+20
-          xmax = -1.0E+20
-          DO i = 1, klon
-            xmin = MIN(snow(i,nsrf),xmin)
-            xmax = MAX(snow(i,nsrf),xmax)
-          ENDDO
-          PRINT*,'Neige du sol SNOW**:', nsrf, xmin, xmax
-        ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <SNOW> est present'
-         PRINT*, '          J ignore donc les autres neiges SNOW**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(snow(i,1),xmin)
-            xmax = MAX(snow(i,1),xmax)
-         ENDDO
-         PRINT*,'Neige du sol <SNOW>', xmin, xmax
-         DO nsrf = 2, nbsrf
-         DO i = 1, klon
-            snow(i,nsrf) = snow(i,1)
-         ENDDO
-         ENDDO
-      ENDIF
-c
-c Lecture de albedo de l'interval visible au sol:
-c
-      CALL get_field("ALBE",falb1(:,1),found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <ALBE> est absent'
-         PRINT*, '          Mais je vais essayer de lire ALBE**'
-         DO nsrf = 1, nbsrf
-           IF (nsrf.GT.99) THEN
-             PRINT*, "Trop de sous-mailles"
-             CALL abort
-           ENDIF
-           WRITE(str2,'(i2.2)') nsrf
-           CALL get_field("ALBE"//str2,falb1(:,nsrf))
-           xmin = 1.0E+20
-           xmax = -1.0E+20
-           DO i = 1, klon
-              xmin = MIN(falb1(i,nsrf),xmin)
-              xmax = MAX(falb1(i,nsrf),xmax)
-           ENDDO
-           PRINT*,'Albedo du sol ALBE**:', nsrf, xmin, xmax
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <ALBE> est present'
-         PRINT*, '          J ignore donc les autres ALBE**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(falb1(i,1),xmin)
-            xmax = MAX(falb1(i,1),xmax)
-         ENDDO
-         PRINT*,'Neige du sol <ALBE>', xmin, xmax
-         DO nsrf = 2, nbsrf
-           DO i = 1, klon
-            falb1(i,nsrf) = falb1(i,1)
-           ENDDO
-         ENDDO
-      ENDIF
-
-c
-c Lecture de albedo au sol dans l'interval proche infra-rouge:
-c
-      CALL get_field("ALBLW",falb2(:,1),found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <ALBLW> est absent'
-         PRINT*, '          Mais je vais prendre ALBE**'
-         DO nsrf = 1, nbsrf
-           DO i = 1, klon
-             falb2(i,nsrf) = falb1(i,nsrf)
-           ENDDO
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <ALBLW> est present'
-         PRINT*, '          J ignore donc les autres ALBLW**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(falb2(i,1),xmin)
-            xmax = MAX(falb2(i,1),xmax)
-         ENDDO
-         PRINT*,'Neige du sol <ALBLW>', xmin, xmax
-         DO nsrf = 2, nbsrf
-           DO i = 1, klon
-             falb2(i,nsrf) = falb2(i,1)
-           ENDDO
-         ENDDO
-      ENDIF
-c
-c Lecture de evaporation:  
-c
-      CALL get_field("EVAP",evap(:,1),found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <EVAP> est absent'
-         PRINT*, '          Mais je vais essayer de lire EVAP**'
-         DO nsrf = 1, nbsrf
-           IF (nsrf.GT.99) THEN
-             PRINT*, "Trop de sous-mailles"
-             CALL abort
-           ENDIF
-           WRITE(str2,'(i2.2)') nsrf
-           CALL get_field("EVAP"//str2, evap(:,nsrf))
-           xmin = 1.0E+20
-           xmax = -1.0E+20
-           DO i = 1, klon
-              xmin = MIN(evap(i,nsrf),xmin)
-              xmax = MAX(evap(i,nsrf),xmax)
-           ENDDO
-           PRINT*,'evap du sol EVAP**:', nsrf, xmin, xmax
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <EVAP> est present'
-         PRINT*, '          J ignore donc les autres EVAP**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(evap(i,1),xmin)
-            xmax = MAX(evap(i,1),xmax)
-         ENDDO
-         PRINT*,'Evap du sol <EVAP>', xmin, xmax
-         DO nsrf = 2, nbsrf
-         DO i = 1, klon
-            evap(i,nsrf) = evap(i,1)
-         ENDDO
-         ENDDO
-      ENDIF
-c
-c Lecture precipitation liquide:
-c
-      CALL get_field("rain_f",rain_fall)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(rain_fall(i),xmin)
-         xmax = MAX(rain_fall(i),xmax)
-      ENDDO
-      PRINT*,'Precipitation liquide rain_f:', xmin, xmax
-c
-c Lecture precipitation solide:
-c
-      CALL get_field("snow_f",snow_fall)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(snow_fall(i),xmin)
-         xmax = MAX(snow_fall(i),xmax)
-      ENDDO
-      PRINT*,'Precipitation solide snow_f:', xmin, xmax
-c
-c Lecture rayonnement solaire au sol:
-c
-      CALL get_field("solsw",solsw,found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <solsw> est absent'
-         PRINT*, 'mis a zero'
-         solsw(:) = 0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(solsw(i),xmin)
-         xmax = MAX(solsw(i),xmax)
-      ENDDO
-      PRINT*,'Rayonnement solaire au sol solsw:', xmin, xmax
-c
-c Lecture rayonnement IF au sol:
-c
-      CALL get_field("sollw",sollw,found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <sollw> est absent'
-         PRINT*, 'mis a zero'
-         sollw = 0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(sollw(i),xmin)
-         xmax = MAX(sollw(i),xmax)
-      ENDDO
-      PRINT*,'Rayonnement IF au sol sollw:', xmin, xmax
-      
-c
-c Lecture derive des flux:
-c
-      CALL get_field("fder",fder,found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <fder> est absent'
-         PRINT*, 'mis a zero'
-         fder = 0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(fder(i),xmin)
-         xmax = MAX(fder(i),xmax)
-      ENDDO
-      PRINT*,'Derive des flux fder:', xmin, xmax
-
-c
-c Lecture du rayonnement net au sol:
-c
-      CALL get_field("RADS",radsol)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(radsol(i),xmin)
-         xmax = MAX(radsol(i),xmax)
-      ENDDO
-      PRINT*,'Rayonnement net au sol radsol:', xmin, xmax
-c
-c Lecture de la longueur de rugosite 
-c
-c
-      CALL get_field("RUG",frugs(:,1),found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <RUG> est absent'
-         PRINT*, '          Mais je vais essayer de lire RUG**'
-         DO nsrf = 1, nbsrf
-           IF (nsrf.GT.99) THEN
-             PRINT*, "Trop de sous-mailles"
-             CALL abort
-           ENDIF
-           WRITE(str2,'(i2.2)') nsrf
-           CALL get_field("RUG"//str2,frugs(:,nsrf))
-           xmin = 1.0E+20
-           xmax = -1.0E+20
-           DO i = 1, klon
-              xmin = MIN(frugs(i,nsrf),xmin)
-              xmax = MAX(frugs(i,nsrf),xmax)
-           ENDDO
-           PRINT*,'rugosite du sol RUG**:', nsrf, xmin, xmax
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <RUG> est present'
-         PRINT*, '          J ignore donc les autres RUG**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(frugs(i,1),xmin)
-            xmax = MAX(frugs(i,1),xmax)
-         ENDDO
-         PRINT*,'rugosite <RUG>', xmin, xmax
-         DO nsrf = 2, nbsrf
-         DO i = 1, klon
-            frugs(i,nsrf) = frugs(i,1)
-         ENDDO
-         ENDDO
-      ENDIF
-
-c
-c Lecture de l'age de la neige:
-c
-      CALL get_field("AGESNO",agesno(:,1),found)
-      IF (.NOT. found) THEN
-         PRINT*, 'phyetat0: Le champ <AGESNO> est absent'
-         PRINT*, '          Mais je vais essayer de lire AGESNO**'
-         DO nsrf = 1, nbsrf
-           IF (nsrf.GT.99) THEN
-             PRINT*, "Trop de sous-mailles"
-             CALL abort
-           ENDIF
-           WRITE(str2,'(i2.2)') nsrf
-           CALL get_field("AGESNO"//str2,agesno(:,nsrf),found)
-           IF (.NOT. found) THEN
-              PRINT*, "phyetat0: Le champ <AGESNO"//str2//"> est absent"
-              agesno = 50.0
-           ENDIF
-           xmin = 1.0E+20
-           xmax = -1.0E+20
-           DO i = 1, klon
-              xmin = MIN(agesno(i,nsrf),xmin)
-              xmax = MAX(agesno(i,nsrf),xmax)
-           ENDDO
-           PRINT*,'Age de la neige AGESNO**:', nsrf, xmin, xmax
-         ENDDO
-      ELSE
-         PRINT*, 'phyetat0: Le champ <AGESNO> est present'
-         PRINT*, '          J ignore donc les autres AGESNO**'
-         xmin = 1.0E+20
-         xmax = -1.0E+20
-         DO i = 1, klon
-            xmin = MIN(agesno(i,1),xmin)
-            xmax = MAX(agesno(i,1),xmax)
-         ENDDO
-         PRINT*,'Age de la neige <AGESNO>', xmin, xmax
-         DO nsrf = 2, nbsrf
-         DO i = 1, klon
-            agesno(i,nsrf) = agesno(i,1)
-         ENDDO
-         ENDDO
-      ENDIF
-
-c
-      CALL get_field("ZMEA", zmea)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zmea(i),xmin)
-         xmax = MAX(zmea(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zmea:', xmin, xmax
-c
-c
-      CALL get_field("ZSTD",zstd)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zstd(i),xmin)
-         xmax = MAX(zstd(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zstd:', xmin, xmax
-c
-c
-      CALL get_field("ZSIG",zsig)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zsig(i),xmin)
-         xmax = MAX(zsig(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zsig:', xmin, xmax
-c
-c
-      CALL get_field("ZGAM",zgam)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zgam(i),xmin)
-         xmax = MAX(zgam(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zgam:', xmin, xmax
-c
-c
-      CALL get_field("ZTHE",zthe)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zthe(i),xmin)
-         xmax = MAX(zthe(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zthe:', xmin, xmax
-c
-c
-      CALL get_field("ZPIC",zpic)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zpic(i),xmin)
-         xmax = MAX(zpic(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zpic:', xmin, xmax
-c
-      CALL get_field("ZVAL",zval)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(zval(i),xmin)
-         xmax = MAX(zval(i),xmax)
-      ENDDO
-      PRINT*,'OROGRAPHIE SOUS-MAILLE zval:', xmin, xmax
-c
-c
-      CALL get_field("RUGSREL",rugoro)
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      DO i = 1, klon
-         xmin = MIN(rugoro(i),xmin)
-         xmax = MAX(rugoro(i),xmax)
-      ENDDO
-      PRINT*,'Rugosite relief (ecart-type) rugsrel:', xmin, xmax
-c
-c
-     
-c
-      ancien_ok = .TRUE.
-
-      CALL get_field("TANCIEN",t_ancien,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <TANCIEN> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         ancien_ok = .FALSE.
-      ENDIF
-
-
-      CALL get_field("QANCIEN",q_ancien,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <QANCIEN> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         ancien_ok = .FALSE.
-      ENDIF
-
-      CALL get_field("UANCIEN",u_ancien,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <UANCIEN> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         ancien_ok = .FALSE.
-      ENDIF
-
-      CALL get_field("VANCIEN",v_ancien,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <VANCIEN> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         ancien_ok = .FALSE.
-      ENDIF
-
-      clwcon=0.
-      CALL get_field("CLWCON",clwcon,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ CLWCON est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(clwcon)
-      xmax = MAXval(clwcon)
-      PRINT*,'Eau liquide convective (ecart-type) clwcon:', xmin, xmax
-c
-      rnebcon = 0.
-      CALL get_field("RNEBCON",rnebcon,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ RNEBCON est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(rnebcon)
-      xmax = MAXval(rnebcon)
-      PRINT*,'Nebulosite convective (ecart-type) rnebcon:', xmin, xmax
-
-c
-c Lecture ratqs
-c
-      ratqs=0.
-      CALL get_field("RATQS",ratqs,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <RATQS> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(ratqs)
-      xmax = MAXval(ratqs)
-      PRINT*,'(ecart-type) ratqs:', xmin, xmax
-c
-c Lecture run_off_lic_0
-c
-      CALL get_field("RUNOFFLIC0",run_off_lic_0,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <RUNOFFLIC0> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         run_off_lic_0 = 0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(run_off_lic_0)
-      xmax = MAXval(run_off_lic_0)
-      PRINT*,'(ecart-type) run_off_lic_0:', xmin, xmax
-
-
-c Lecture de l'energie cinetique turbulente
-c
-
-      IF (iflag_pbl>1) then
-        DO nsrf = 1, nbsrf
-          IF (nsrf.GT.99) THEN
-            PRINT*, "Trop de sous-mailles"
-            CALL abort
-          ENDIF
-          WRITE(str2,'(i2.2)') nsrf
-          CALL get_field("TKE"//str2,pbl_tke(:,1:klev+1,nsrf),found)
-          IF (.NOT. found) THEN
-            PRINT*, "phyetat0: <TKE"//str2//"> est absent"
-            pbl_tke(:,:,nsrf)=1.e-8
-          ENDIF
-          xmin = 1.0E+20
-          xmax = -1.0E+20
-          DO k = 1, klev+1
-            DO i = 1, klon
-              xmin = MIN(pbl_tke(i,k,nsrf),xmin)
-              xmax = MAX(pbl_tke(i,k,nsrf),xmax)
-            ENDDO
-          ENDDO
-          PRINT*,'Temperature du sol TKE**:', nsrf, xmin, xmax
-        ENDDO
-      ENDIF
-c
-c zmax0
-      CALL get_field("ZMAX0",zmax0,found)
-      IF (.NOT. found) THEN
-        PRINT*, "phyetat0: Le champ <ZMAX0> est absent"
-        PRINT*, "Depart legerement fausse. Mais je continue"
-        zmax0=40.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(zmax0)
-      xmax = MAXval(zmax0)
-      PRINT*,'(ecart-type) zmax0:', xmin, xmax
-c
-c           f0(ig)=1.e-5
-c f0
-      CALL get_field("F0",f0,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <f0> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         f0=1.e-5
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(f0)
-      xmax = MAXval(f0)
-      PRINT*,'(ecart-type) f0:', xmin, xmax
-c
-c ema_work1
-c
-      CALL get_field("EMA_WORK1",ema_work1,found)
-      IF (.NOT. found) THEN
-        PRINT*, "phyetat0: Le champ <EMA_WORK1> est absent"
-        PRINT*, "Depart legerement fausse. Mais je continue"
-        ema_work1=0.
-      ELSE
-        xmin = 1.0E+20
-        xmax = -1.0E+20
-        DO k = 1, klev
-          DO i = 1, klon
-            xmin = MIN(ema_work1(i,k),xmin)
-            xmax = MAX(ema_work1(i,k),xmax)
-          ENDDO
-        ENDDO
-        PRINT*,'ema_work1:', xmin, xmax
-      ENDIF
-c
-c ema_work2
-c
-      CALL get_field("EMA_WORK2",ema_work2,found)
-      IF (.NOT. found) THEN
-        PRINT*, "phyetat0: Le champ <EMA_WORK2> est absent"
-        PRINT*, "Depart legerement fausse. Mais je continue"
-        ema_work2=0.
-      ELSE
-        xmin = 1.0E+20
-        xmax = -1.0E+20
-        DO k = 1, klev
-          DO i = 1, klon
-            xmin = MIN(ema_work2(i,k),xmin)
-            xmax = MAX(ema_work2(i,k),xmax)
-          ENDDO
-        ENDDO
-        PRINT*,'ema_work2:', xmin, xmax
-      ENDIF
-c
-c wake_deltat
-c
-      CALL get_field("WAKE_DELTAT",wake_deltat,found)
-      IF (.NOT. found) THEN
-        PRINT*, "phyetat0: Le champ <WAKE_DELTAT> est absent"
-        PRINT*, "Depart legerement fausse. Mais je continue"
-        wake_deltat=0.
-      ELSE
-        xmin = 1.0E+20
-        xmax = -1.0E+20
-        DO k = 1, klev
-          DO i = 1, klon
-            xmin = MIN(wake_deltat(i,k),xmin)
-            xmax = MAX(wake_deltat(i,k),xmax)
-          ENDDO
-        ENDDO
-        PRINT*,'wake_deltat:', xmin, xmax
-      ENDIF
-c
-c wake_deltaq
-c   
-      CALL get_field("WAKE_DELTAQ",wake_deltaq,found)
-      IF (.NOT. found) THEN
-        PRINT*, "phyetat0: Le champ <WAKE_DELTAQ> est absent"
-        PRINT*, "Depart legerement fausse. Mais je continue"
-        wake_deltaq=0.
-      ELSE
-        xmin = 1.0E+20
-        xmax = -1.0E+20
-        DO k = 1, klev
-          DO i = 1, klon
-            xmin = MIN(wake_deltaq(i,k),xmin)
-            xmax = MAX(wake_deltaq(i,k),xmax)
-          ENDDO
-        ENDDO
-        PRINT*,'wake_deltaq:', xmin, xmax
-      ENDIF
-c
-c wake_s
-c
-      CALL get_field("WAKE_S",wake_s,found)
-      IF (.NOT. found) THEN
-        PRINT*, "phyetat0: Le champ <WAKE_S> est absent"
-        PRINT*, "Depart legerement fausse. Mais je continue"
-        wake_s=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(wake_s)
-      xmax = MAXval(wake_s)
-      PRINT*,'(ecart-type) wake_s:', xmin, xmax
-c
-c wake_cstar
-c
-      CALL get_field("WAKE_CSTAR",wake_cstar,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <WAKE_CSTAR> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         wake_cstar=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(wake_cstar)
-      xmax = MAXval(wake_cstar)
-      PRINT*,'(ecart-type) wake_cstar:', xmin, xmax
-c
-c wake_pe
-c
-      CALL get_field("WAKE_PE",wake_pe,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <WAKE_PE> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         wake_pe=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(wake_pe)
-      xmax = MAXval(wake_pe)
-      PRINT*,'(ecart-type) wake_pe:', xmin, xmax
-c
-c wake_fip
-c
-      CALL get_field("WAKE_FIP",wake_fip,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <WAKE_FIP> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         wake_fip=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(wake_fip)
-      xmax = MAXval(wake_fip)
-      PRINT*,'(ecart-type) wake_fip:', xmin, xmax
-c
-c  thermiques
-c
-
-      CALL get_field("FM_THERM",fm_therm,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <fm_therm> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         fm_therm=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(fm_therm)
-      xmax = MAXval(fm_therm)
-      PRINT*,'(ecart-type) fm_therm:', xmin, xmax
-
-      CALL get_field("ENTR_THERM",entr_therm,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <entr_therm> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         entr_therm=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(entr_therm)
-      xmax = MAXval(entr_therm)
-      PRINT*,'(ecart-type) entr_therm:', xmin, xmax
-
-      CALL get_field("DETR_THERM",detr_therm,found)
-      IF (.NOT. found) THEN
-         PRINT*, "phyetat0: Le champ <detr_therm> est absent"
-         PRINT*, "Depart legerement fausse. Mais je continue"
-         detr_therm=0.
-      ENDIF
-      xmin = 1.0E+20
-      xmax = -1.0E+20
-      xmin = MINval(detr_therm)
-      xmax = MAXval(detr_therm)
-      PRINT*,'(ecart-type) detr_therm:', xmin, xmax
-
-
-
-c
-c Read and send field trs to traclmdz
-c
-      IF (type_trac == 'lmdz') THEN
-         DO it=1,nbtr
-            iiq=niadv(it+2)
-            CALL get_field("trs_"//tname(iiq),trs(:,it),found)
-            IF (.NOT. found) THEN
-               PRINT*, 
-     $           "phyetat0: Le champ <trs_"//tname(iiq)//"> est absent"
-               PRINT*, "Depart legerement fausse. Mais je continue"
-               trs(:,it) = 0.
-            ENDIF
-            xmin = 1.0E+20
-            xmax = -1.0E+20
-            xmin = MINval(trs(:,it))
-            xmax = MAXval(trs(:,it))
-            PRINT*,"(ecart-type) trs_"//tname(iiq)//" :", xmin, xmax
-
-         END DO
-         CALL traclmdz_from_restart(trs)
-
-         IF (carbon_cycle_cpl) THEN
-            ALLOCATE(co2_send(klon), stat=ierr)
-            IF (ierr /= 0) CALL abort_gcm
-     &           ('phyetat0','pb allocation co2_send',1)
-            CALL get_field("co2_send",co2_send,found)
-            IF (.NOT. found) THEN
-               PRINT*,"phyetat0: Le champ <co2_send> est absent"
-               PRINT*,"Initialisation uniforme a co2_ppm=",co2_ppm
-               co2_send(:) = co2_ppm
-            END IF
-         END IF
-      END IF
-
-
-c on ferme le fichier
-      CALL close_startphy
-
-      CALL init_iophy_new(rlat,rlon)
-      	
-
-c
-c Initialize module pbl_surface_mod 
-c
-      CALL pbl_surface_init(qsol, fder, snow, qsurf,
-     $     evap, frugs, agesno, tsoil)
-
-c Initialize module ocean_cpl_mod for the case of coupled ocean
-      IF ( type_ocean == 'couple' ) THEN
-         CALL ocean_cpl_init(dtime, rlon, rlat)
-      ENDIF
-c
-c Initilialize module fonte_neige_mod      
-c
-      CALL fonte_neige_init(run_off_lic_0)
-
-
-      RETURN
-      END
Index: LMDZ5/trunk/libf/phylmd/phyetat0.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phyetat0.F90	(revision 1827)
+++ LMDZ5/trunk/libf/phylmd/phyetat0.F90	(revision 1827)
@@ -0,0 +1,1049 @@
+! $Id$
+
+SUBROUTINE phyetat0 (fichnom, clesphy0, tabcntr0)
+
+  USE dimphy
+  USE mod_grid_phy_lmdz
+  USE mod_phys_lmdz_para
+  USE iophy
+  USE ocean_cpl_mod,    ONLY : ocean_cpl_init
+  USE fonte_neige_mod,  ONLY : fonte_neige_init
+  USE pbl_surface_mod,  ONLY : pbl_surface_init
+  USE surface_data,     ONLY : type_ocean
+  USE phys_state_var_mod
+  USE iostart
+  USE write_field_phy
+  USE infotrac
+  USE traclmdz_mod,    ONLY : traclmdz_from_restart
+  USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl, co2_send
+  USE indice_sol_mod
+
+  IMPLICIT none
+  !======================================================================
+  ! Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
+  ! Objet: Lecture de l'etat initial pour la physique
+  !======================================================================
+  include "dimensions.h"
+  include "netcdf.inc"
+  include "dimsoil.h"
+  include "clesphys.h"
+  include "temps.h"
+  include "thermcell.h"
+  include "compbl.h"
+  !======================================================================
+  CHARACTER*(*) fichnom
+
+  ! les variables globales lues dans le fichier restart
+
+  REAL tsoil(klon, nsoilmx, nbsrf)
+  REAL tslab(klon), seaice(klon)
+  REAL qsurf(klon, nbsrf)
+  REAL qsol(klon)
+  REAL snow(klon, nbsrf)
+  REAL evap(klon, nbsrf)
+  real fder(klon)
+  REAL frugs(klon, nbsrf)
+  REAL agesno(klon, nbsrf)
+  REAL run_off_lic_0(klon)
+  REAL fractint(klon)
+  REAL trs(klon, nbtr)
+
+  CHARACTER*6 ocean_in
+  LOGICAL ok_veget_in
+
+  INTEGER        longcles
+  PARAMETER    ( longcles = 20 )
+  REAL clesphy0( longcles )
+
+  REAL xmin, xmax
+
+  INTEGER nid, nvarid
+  INTEGER ierr, i, nsrf, isoil , k
+  INTEGER length
+  PARAMETER (length=100)
+  INTEGER it, iiq
+  REAL tab_cntrl(length), tabcntr0(length)
+  CHARACTER*7 str7
+  CHARACTER*2 str2
+  LOGICAL :: found
+
+  ! FH1D
+  !     real iolat(jjm+1)
+  real iolat(jjm+1-1/(iim*jjm))
+
+  ! Ouvrir le fichier contenant l'etat initial:
+
+  CALL open_startphy(fichnom)
+
+  ! Lecture des parametres de controle:
+
+  CALL get_var("controle", tab_cntrl)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
+  ! Les constantes de la physiques sont lues dans la physique seulement.
+  ! Les egalites du type
+  !             tab_cntrl( 5 )=clesphy0(1)
+  ! sont remplacees par
+  !             clesphy0(1)=tab_cntrl( 5 )
+  ! On inverse aussi la logique.
+  ! On remplit les tab_cntrl avec les parametres lus dans les .def
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  DO i = 1, length
+     tabcntr0( i ) = tab_cntrl( i )
+  ENDDO
+
+  tab_cntrl(1)=dtime
+  tab_cntrl(2)=radpas
+
+  ! co2_ppm : value from the previous time step
+  IF (carbon_cycle_tr .OR. carbon_cycle_cpl) THEN
+     co2_ppm = tab_cntrl(3)
+     RCO2    = co2_ppm * 1.0e-06  * 44.011/28.97 
+     ! ELSE : keep value from .def
+  END IF
+
+  ! co2_ppm0 : initial value of atmospheric CO2 (from create_etat0_limit.e .def)
+  co2_ppm0   = tab_cntrl(16)
+
+  solaire_etat0      = tab_cntrl(4)
+  tab_cntrl(5)=iflag_con
+  tab_cntrl(6)=nbapp_rad
+
+  if (cycle_diurne) tab_cntrl( 7) =1.
+  if (soil_model) tab_cntrl( 8) =1.
+  if (new_oliq) tab_cntrl( 9) =1.
+  if (ok_orodr) tab_cntrl(10) =1.
+  if (ok_orolf) tab_cntrl(11) =1.
+  if (ok_limitvrai) tab_cntrl(12) =1.
+
+  itau_phy = tab_cntrl(15)
+
+  clesphy0(1)=tab_cntrl( 5 )
+  clesphy0(2)=tab_cntrl( 6 )
+  clesphy0(3)=tab_cntrl( 7 )
+  clesphy0(4)=tab_cntrl( 8 )
+  clesphy0(5)=tab_cntrl( 9 )
+  clesphy0(6)=tab_cntrl( 10 )
+  clesphy0(7)=tab_cntrl( 11 )
+  clesphy0(8)=tab_cntrl( 12 )
+
+  ! Lecture des latitudes (coordonnees):
+
+  CALL get_field("latitude", rlat)
+
+  ! Lecture des longitudes (coordonnees):
+
+  CALL get_field("longitude", rlon)
+
+  ! Lecture du masque terre mer
+
+  CALL get_field("masque", zmasq, found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <masque> est absent'
+     PRINT *, 'fichier startphy non compatible avec phyetat0'
+  ENDIF
+
+  ! Lecture des fractions pour chaque sous-surface
+
+  ! initialisation des sous-surfaces
+
+  pctsrf = 0.
+
+  ! fraction de terre
+
+  CALL get_field("FTER", pctsrf(:, is_ter), found)
+  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FTER> est absent'
+
+  ! fraction de glace de terre
+
+  CALL get_field("FLIC", pctsrf(:, is_lic), found)
+  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FLIC> est absent'
+
+  ! fraction d'ocean
+
+  CALL get_field("FOCE", pctsrf(:, is_oce), found)
+  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FOCE> est absent'
+
+  ! fraction glace de mer
+
+  CALL get_field("FSIC", pctsrf(:, is_sic), found)
+  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FSIC> est absent'
+
+  !  Verification de l'adequation entre le masque et les sous-surfaces
+
+  fractint( 1 : klon) = pctsrf(1 : klon, is_ter)  &
+       + pctsrf(1 : klon, is_lic)
+  DO i = 1 , klon
+     IF ( abs(fractint(i) - zmasq(i) ) .GT. EPSFRA ) THEN
+        WRITE(*, *) 'phyetat0: attention fraction terre pas ',  &
+             'coherente ', i, zmasq(i), pctsrf(i, is_ter) &
+             , pctsrf(i, is_lic)
+        WRITE(*, *) 'Je force la coherence zmasq=fractint'
+        zmasq(i) = fractint(i)
+     ENDIF
+  END DO
+  fractint (1 : klon) =  pctsrf(1 : klon, is_oce)  &
+       + pctsrf(1 : klon, is_sic)
+  DO i = 1 , klon
+     IF ( abs( fractint(i) - (1. - zmasq(i))) .GT. EPSFRA ) THEN
+        WRITE(*, *) 'phyetat0 attention fraction ocean pas ',  &
+             'coherente ', i, zmasq(i) , pctsrf(i, is_oce) &
+             , pctsrf(i, is_sic)
+        WRITE(*, *) 'Je force la coherence zmasq=fractint'
+        zmasq(i) = fractint(i)
+     ENDIF
+  END DO
+
+  ! Lecture des temperatures du sol:
+
+  CALL get_field("TS", ftsol(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <TS> est absent'
+     PRINT*, '          Mais je vais essayer de lire TS**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("TS"//str2, ftsol(:, nsrf))
+
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(ftsol(i, nsrf), xmin)
+           xmax = MAX(ftsol(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'Temperature du sol TS**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <TS> est present'
+     PRINT*, '          J ignore donc les autres temperatures TS**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(ftsol(i, 1), xmin)
+        xmax = MAX(ftsol(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Temperature du sol <TS>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           ftsol(i, nsrf) = ftsol(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Lecture des temperatures du sol profond:
+
+  DO nsrf = 1, nbsrf
+     DO isoil=1, nsoilmx
+        IF (isoil.GT.99 .AND. nsrf.GT.99) THEN
+           PRINT*, "Trop de couches ou sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str7, '(i2.2, "srf", i2.2)') isoil, nsrf
+
+        CALL get_field('Tsoil'//str7, tsoil(:, isoil, nsrf), found)
+        IF (.NOT. found) THEN
+           PRINT*, "phyetat0: Le champ <Tsoil"//str7//"> est absent"
+           PRINT*, "          Il prend donc la valeur de surface"
+           DO i=1, klon
+              tsoil(i, isoil, nsrf)=ftsol(i, nsrf)
+           ENDDO
+        ENDIF
+     ENDDO
+  ENDDO
+
+  ! Lecture de l'humidite de l'air juste au dessus du sol:
+
+  CALL get_field("QS", qsurf(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <QS> est absent'
+     PRINT*, '          Mais je vais essayer de lire QS**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("QS"//str2, qsurf(:, nsrf))
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(qsurf(i, nsrf), xmin)
+           xmax = MAX(qsurf(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'Humidite pres du sol QS**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <QS> est present'
+     PRINT*, '          J ignore donc les autres humidites QS**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(qsurf(i, 1), xmin)
+        xmax = MAX(qsurf(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Humidite pres du sol <QS>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           qsurf(i, nsrf) = qsurf(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Eau dans le sol (pour le modele de sol "bucket")
+
+  CALL get_field("QSOL", qsol, found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <QSOL> est absent'
+     PRINT*, '          Valeur par defaut nulle'
+     qsol(:)=0.
+  ENDIF
+
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(qsol(i), xmin)
+     xmax = MAX(qsol(i), xmax)
+  ENDDO
+  PRINT*, 'Eau dans le sol (mm) <QSOL>', xmin, xmax
+
+  ! Lecture de neige au sol:
+
+  CALL get_field("SNOW", snow(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <SNOW> est absent'
+     PRINT*, '          Mais je vais essayer de lire SNOW**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field( "SNOW"//str2, snow(:, nsrf))
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(snow(i, nsrf), xmin)
+           xmax = MAX(snow(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'Neige du sol SNOW**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <SNOW> est present'
+     PRINT*, '          J ignore donc les autres neiges SNOW**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(snow(i, 1), xmin)
+        xmax = MAX(snow(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Neige du sol <SNOW>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           snow(i, nsrf) = snow(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Lecture de albedo de l'interval visible au sol:
+
+  CALL get_field("ALBE", falb1(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <ALBE> est absent'
+     PRINT*, '          Mais je vais essayer de lire ALBE**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("ALBE"//str2, falb1(:, nsrf))
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(falb1(i, nsrf), xmin)
+           xmax = MAX(falb1(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'Albedo du sol ALBE**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <ALBE> est present'
+     PRINT*, '          J ignore donc les autres ALBE**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(falb1(i, 1), xmin)
+        xmax = MAX(falb1(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Neige du sol <ALBE>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           falb1(i, nsrf) = falb1(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Lecture de albedo au sol dans l'interval proche infra-rouge:
+
+  CALL get_field("ALBLW", falb2(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <ALBLW> est absent'
+     PRINT*, '          Mais je vais prendre ALBE**'
+     DO nsrf = 1, nbsrf
+        DO i = 1, klon
+           falb2(i, nsrf) = falb1(i, nsrf)
+        ENDDO
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <ALBLW> est present'
+     PRINT*, '          J ignore donc les autres ALBLW**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(falb2(i, 1), xmin)
+        xmax = MAX(falb2(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Neige du sol <ALBLW>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           falb2(i, nsrf) = falb2(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Lecture de evaporation:  
+
+  CALL get_field("EVAP", evap(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <EVAP> est absent'
+     PRINT*, '          Mais je vais essayer de lire EVAP**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("EVAP"//str2, evap(:, nsrf))
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(evap(i, nsrf), xmin)
+           xmax = MAX(evap(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'evap du sol EVAP**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <EVAP> est present'
+     PRINT*, '          J ignore donc les autres EVAP**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(evap(i, 1), xmin)
+        xmax = MAX(evap(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Evap du sol <EVAP>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           evap(i, nsrf) = evap(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Lecture precipitation liquide:
+
+  CALL get_field("rain_f", rain_fall)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(rain_fall(i), xmin)
+     xmax = MAX(rain_fall(i), xmax)
+  ENDDO
+  PRINT*, 'Precipitation liquide rain_f:', xmin, xmax
+
+  ! Lecture precipitation solide:
+
+  CALL get_field("snow_f", snow_fall)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(snow_fall(i), xmin)
+     xmax = MAX(snow_fall(i), xmax)
+  ENDDO
+  PRINT*, 'Precipitation solide snow_f:', xmin, xmax
+
+  ! Lecture rayonnement solaire au sol:
+
+  CALL get_field("solsw", solsw, found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <solsw> est absent'
+     PRINT*, 'mis a zero'
+     solsw(:) = 0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(solsw(i), xmin)
+     xmax = MAX(solsw(i), xmax)
+  ENDDO
+  PRINT*, 'Rayonnement solaire au sol solsw:', xmin, xmax
+
+  ! Lecture rayonnement IF au sol:
+
+  CALL get_field("sollw", sollw, found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <sollw> est absent'
+     PRINT*, 'mis a zero'
+     sollw = 0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(sollw(i), xmin)
+     xmax = MAX(sollw(i), xmax)
+  ENDDO
+  PRINT*, 'Rayonnement IF au sol sollw:', xmin, xmax
+
+  ! Lecture derive des flux:
+
+  CALL get_field("fder", fder, found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <fder> est absent'
+     PRINT*, 'mis a zero'
+     fder = 0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(fder(i), xmin)
+     xmax = MAX(fder(i), xmax)
+  ENDDO
+  PRINT*, 'Derive des flux fder:', xmin, xmax
+
+  ! Lecture du rayonnement net au sol:
+
+  CALL get_field("RADS", radsol)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(radsol(i), xmin)
+     xmax = MAX(radsol(i), xmax)
+  ENDDO
+  PRINT*, 'Rayonnement net au sol radsol:', xmin, xmax
+
+  ! Lecture de la longueur de rugosite 
+
+  CALL get_field("RUG", frugs(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <RUG> est absent'
+     PRINT*, '          Mais je vais essayer de lire RUG**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("RUG"//str2, frugs(:, nsrf))
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(frugs(i, nsrf), xmin)
+           xmax = MAX(frugs(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'rugosite du sol RUG**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <RUG> est present'
+     PRINT*, '          J ignore donc les autres RUG**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(frugs(i, 1), xmin)
+        xmax = MAX(frugs(i, 1), xmax)
+     ENDDO
+     PRINT*, 'rugosite <RUG>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           frugs(i, nsrf) = frugs(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  ! Lecture de l'age de la neige:
+
+  CALL get_field("AGESNO", agesno(:, 1), found)
+  IF (.NOT. found) THEN
+     PRINT*, 'phyetat0: Le champ <AGESNO> est absent'
+     PRINT*, '          Mais je vais essayer de lire AGESNO**'
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("AGESNO"//str2, agesno(:, nsrf), found)
+        IF (.NOT. found) THEN
+           PRINT*, "phyetat0: Le champ <AGESNO"//str2//"> est absent"
+           agesno = 50.0
+        ENDIF
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO i = 1, klon
+           xmin = MIN(agesno(i, nsrf), xmin)
+           xmax = MAX(agesno(i, nsrf), xmax)
+        ENDDO
+        PRINT*, 'Age de la neige AGESNO**:', nsrf, xmin, xmax
+     ENDDO
+  ELSE
+     PRINT*, 'phyetat0: Le champ <AGESNO> est present'
+     PRINT*, '          J ignore donc les autres AGESNO**'
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO i = 1, klon
+        xmin = MIN(agesno(i, 1), xmin)
+        xmax = MAX(agesno(i, 1), xmax)
+     ENDDO
+     PRINT*, 'Age de la neige <AGESNO>', xmin, xmax
+     DO nsrf = 2, nbsrf
+        DO i = 1, klon
+           agesno(i, nsrf) = agesno(i, 1)
+        ENDDO
+     ENDDO
+  ENDIF
+
+  CALL get_field("ZMEA", zmea)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zmea(i), xmin)
+     xmax = MAX(zmea(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zmea:', xmin, xmax
+
+  CALL get_field("ZSTD", zstd)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zstd(i), xmin)
+     xmax = MAX(zstd(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zstd:', xmin, xmax
+
+  CALL get_field("ZSIG", zsig)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zsig(i), xmin)
+     xmax = MAX(zsig(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zsig:', xmin, xmax
+
+  CALL get_field("ZGAM", zgam)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zgam(i), xmin)
+     xmax = MAX(zgam(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zgam:', xmin, xmax
+
+  CALL get_field("ZTHE", zthe)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zthe(i), xmin)
+     xmax = MAX(zthe(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zthe:', xmin, xmax
+
+  CALL get_field("ZPIC", zpic)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zpic(i), xmin)
+     xmax = MAX(zpic(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zpic:', xmin, xmax
+
+  CALL get_field("ZVAL", zval)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(zval(i), xmin)
+     xmax = MAX(zval(i), xmax)
+  ENDDO
+  PRINT*, 'OROGRAPHIE SOUS-MAILLE zval:', xmin, xmax
+
+  CALL get_field("RUGSREL", rugoro)
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  DO i = 1, klon
+     xmin = MIN(rugoro(i), xmin)
+     xmax = MAX(rugoro(i), xmax)
+  ENDDO
+  PRINT*, 'Rugosite relief (ecart-type) rugsrel:', xmin, xmax
+
+  ancien_ok = .TRUE.
+
+  CALL get_field("TANCIEN", t_ancien, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <TANCIEN> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     ancien_ok = .FALSE.
+  ENDIF
+
+  CALL get_field("QANCIEN", q_ancien, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <QANCIEN> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     ancien_ok = .FALSE.
+  ENDIF
+
+  CALL get_field("UANCIEN", u_ancien, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <UANCIEN> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     ancien_ok = .FALSE.
+  ENDIF
+
+  CALL get_field("VANCIEN", v_ancien, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <VANCIEN> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     ancien_ok = .FALSE.
+  ENDIF
+
+  clwcon=0.
+  CALL get_field("CLWCON", clwcon, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ CLWCON est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(clwcon)
+  xmax = MAXval(clwcon)
+  PRINT*, 'Eau liquide convective (ecart-type) clwcon:', xmin, xmax
+
+  rnebcon = 0.
+  CALL get_field("RNEBCON", rnebcon, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ RNEBCON est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(rnebcon)
+  xmax = MAXval(rnebcon)
+  PRINT*, 'Nebulosite convective (ecart-type) rnebcon:', xmin, xmax
+
+  ! Lecture ratqs
+
+  ratqs=0.
+  CALL get_field("RATQS", ratqs, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <RATQS> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(ratqs)
+  xmax = MAXval(ratqs)
+  PRINT*, '(ecart-type) ratqs:', xmin, xmax
+
+  ! Lecture run_off_lic_0
+
+  CALL get_field("RUNOFFLIC0", run_off_lic_0, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <RUNOFFLIC0> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     run_off_lic_0 = 0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(run_off_lic_0)
+  xmax = MAXval(run_off_lic_0)
+  PRINT*, '(ecart-type) run_off_lic_0:', xmin, xmax
+
+  ! Lecture de l'energie cinetique turbulente
+
+  IF (iflag_pbl>1) then
+     DO nsrf = 1, nbsrf
+        IF (nsrf.GT.99) THEN
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+        WRITE(str2, '(i2.2)') nsrf
+        CALL get_field("TKE"//str2, pbl_tke(:, 1:klev+1, nsrf), found)
+        IF (.NOT. found) THEN
+           PRINT*, "phyetat0: <TKE"//str2//"> est absent"
+           pbl_tke(:, :, nsrf)=1.e-8
+        ENDIF
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        DO k = 1, klev+1
+           DO i = 1, klon
+              xmin = MIN(pbl_tke(i, k, nsrf), xmin)
+              xmax = MAX(pbl_tke(i, k, nsrf), xmax)
+           ENDDO
+        ENDDO
+        PRINT*, 'Temperature du sol TKE**:', nsrf, xmin, xmax
+     ENDDO
+  ENDIF
+
+  ! zmax0
+  CALL get_field("ZMAX0", zmax0, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <ZMAX0> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     zmax0=40.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(zmax0)
+  xmax = MAXval(zmax0)
+  PRINT*, '(ecart-type) zmax0:', xmin, xmax
+
+  !           f0(ig)=1.e-5
+  ! f0
+  CALL get_field("F0", f0, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <f0> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     f0=1.e-5
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(f0)
+  xmax = MAXval(f0)
+  PRINT*, '(ecart-type) f0:', xmin, xmax
+
+  ! sig1 or ema_work1
+
+  CALL get_field("sig1", sig1, found)
+  IF (.NOT. found) CALL get_field("EMA_WORK1", sig1, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ sig1 est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     sig1=0.
+  ELSE
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO k = 1, klev
+        DO i = 1, klon
+           xmin = MIN(sig1(i, k), xmin)
+           xmax = MAX(sig1(i, k), xmax)
+        ENDDO
+     ENDDO
+     PRINT*, 'sig1:', xmin, xmax
+  ENDIF
+
+  ! w01 or ema_work2
+
+  CALL get_field("w01", w01, found)
+  IF (.NOT. found) CALL get_field("EMA_WORK2", w01, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ w01 est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     w01=0.
+  ELSE
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO k = 1, klev
+        DO i = 1, klon
+           xmin = MIN(w01(i, k), xmin)
+           xmax = MAX(w01(i, k), xmax)
+        ENDDO
+     ENDDO
+     PRINT*, 'w01:', xmin, xmax
+  ENDIF
+
+  ! wake_deltat
+
+  CALL get_field("WAKE_DELTAT", wake_deltat, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <WAKE_DELTAT> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     wake_deltat=0.
+  ELSE
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO k = 1, klev
+        DO i = 1, klon
+           xmin = MIN(wake_deltat(i, k), xmin)
+           xmax = MAX(wake_deltat(i, k), xmax)
+        ENDDO
+     ENDDO
+     PRINT*, 'wake_deltat:', xmin, xmax
+  ENDIF
+
+  ! wake_deltaq
+
+  CALL get_field("WAKE_DELTAQ", wake_deltaq, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <WAKE_DELTAQ> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     wake_deltaq=0.
+  ELSE
+     xmin = 1.0E+20
+     xmax = -1.0E+20
+     DO k = 1, klev
+        DO i = 1, klon
+           xmin = MIN(wake_deltaq(i, k), xmin)
+           xmax = MAX(wake_deltaq(i, k), xmax)
+        ENDDO
+     ENDDO
+     PRINT*, 'wake_deltaq:', xmin, xmax
+  ENDIF
+
+  ! wake_s
+
+  CALL get_field("WAKE_S", wake_s, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <WAKE_S> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     wake_s=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(wake_s)
+  xmax = MAXval(wake_s)
+  PRINT*, '(ecart-type) wake_s:', xmin, xmax
+
+  ! wake_cstar
+
+  CALL get_field("WAKE_CSTAR", wake_cstar, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <WAKE_CSTAR> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     wake_cstar=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(wake_cstar)
+  xmax = MAXval(wake_cstar)
+  PRINT*, '(ecart-type) wake_cstar:', xmin, xmax
+
+  ! wake_pe
+
+  CALL get_field("WAKE_PE", wake_pe, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <WAKE_PE> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     wake_pe=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(wake_pe)
+  xmax = MAXval(wake_pe)
+  PRINT*, '(ecart-type) wake_pe:', xmin, xmax
+
+  ! wake_fip
+
+  CALL get_field("WAKE_FIP", wake_fip, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <WAKE_FIP> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     wake_fip=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(wake_fip)
+  xmax = MAXval(wake_fip)
+  PRINT*, '(ecart-type) wake_fip:', xmin, xmax
+
+  !  thermiques
+
+  CALL get_field("FM_THERM", fm_therm, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <fm_therm> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     fm_therm=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(fm_therm)
+  xmax = MAXval(fm_therm)
+  PRINT*, '(ecart-type) fm_therm:', xmin, xmax
+
+  CALL get_field("ENTR_THERM", entr_therm, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <entr_therm> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     entr_therm=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(entr_therm)
+  xmax = MAXval(entr_therm)
+  PRINT*, '(ecart-type) entr_therm:', xmin, xmax
+
+  CALL get_field("DETR_THERM", detr_therm, found)
+  IF (.NOT. found) THEN
+     PRINT*, "phyetat0: Le champ <detr_therm> est absent"
+     PRINT*, "Depart legerement fausse. Mais je continue"
+     detr_therm=0.
+  ENDIF
+  xmin = 1.0E+20
+  xmax = -1.0E+20
+  xmin = MINval(detr_therm)
+  xmax = MAXval(detr_therm)
+  PRINT*, '(ecart-type) detr_therm:', xmin, xmax
+
+  ! Read and send field trs to traclmdz
+
+  IF (type_trac == 'lmdz') THEN
+     DO it=1, nbtr
+        iiq=niadv(it+2)
+        CALL get_field("trs_"//tname(iiq), trs(:, it), found)
+        IF (.NOT. found) THEN
+           PRINT*,  &
+                "phyetat0: Le champ <trs_"//tname(iiq)//"> est absent"
+           PRINT*, "Depart legerement fausse. Mais je continue"
+           trs(:, it) = 0.
+        ENDIF
+        xmin = 1.0E+20
+        xmax = -1.0E+20
+        xmin = MINval(trs(:, it))
+        xmax = MAXval(trs(:, it))
+        PRINT*, "(ecart-type) trs_"//tname(iiq)//" :", xmin, xmax
+
+     END DO
+     CALL traclmdz_from_restart(trs)
+
+     IF (carbon_cycle_cpl) THEN
+        ALLOCATE(co2_send(klon), stat=ierr)
+        IF (ierr /= 0) CALL abort_gcm &
+             ('phyetat0', 'pb allocation co2_send', 1)
+        CALL get_field("co2_send", co2_send, found)
+        IF (.NOT. found) THEN
+           PRINT*, "phyetat0: Le champ <co2_send> est absent"
+           PRINT*, "Initialisation uniforme a co2_ppm=", co2_ppm
+           co2_send(:) = co2_ppm
+        END IF
+     END IF
+  END IF
+
+  ! on ferme le fichier
+  CALL close_startphy
+
+  CALL init_iophy_new(rlat, rlon)
+
+  ! Initialize module pbl_surface_mod 
+
+  CALL pbl_surface_init(qsol, fder, snow, qsurf, &
+       evap, frugs, agesno, tsoil)
+
+  ! Initialize module ocean_cpl_mod for the case of coupled ocean
+  IF ( type_ocean == 'couple' ) THEN
+     CALL ocean_cpl_init(dtime, rlon, rlat)
+  ENDIF
+
+  ! Initilialize module fonte_neige_mod      
+
+  CALL fonte_neige_init(run_off_lic_0)
+
+END SUBROUTINE phyetat0
Index: LMDZ5/trunk/libf/phylmd/phyredem.F
===================================================================
--- LMDZ5/trunk/libf/phylmd/phyredem.F	(revision 1826)
+++ 	(revision )
@@ -1,356 +1,0 @@
-!
-! $Id$
-!
-c
-      SUBROUTINE phyredem (fichnom)
-
-      USE dimphy
-      USE mod_grid_phy_lmdz
-      USE mod_phys_lmdz_para
-      USE fonte_neige_mod,  ONLY : fonte_neige_final
-      USE pbl_surface_mod,  ONLY : pbl_surface_final
-      USE phys_state_var_mod
-      USE iostart
-      USE traclmdz_mod, ONLY : traclmdz_to_restart
-      USE infotrac
-      USE control_mod
-      USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
-      USE indice_sol_mod
-
-      IMPLICIT none
-c======================================================================
-c Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
-c Objet: Ecriture de l'etat de redemarrage pour la physique
-c======================================================================
-#include "netcdf.inc"
-#include "dimsoil.h"
-#include "clesphys.h"
-#include "temps.h"
-#include "thermcell.h"
-#include "compbl.h"
-c======================================================================
-      CHARACTER*(*) fichnom
-
-c les variables globales ecrites dans le fichier restart
-
-      
-      REAL tsoil(klon,nsoilmx,nbsrf)
-      REAL tslab(klon), seaice(klon)
-      REAL qsurf(klon,nbsrf)
-      REAL qsol(klon)
-      REAL snow(klon,nbsrf)
-      REAL evap(klon,nbsrf)
-      real fder(klon)
-      REAL frugs(klon,nbsrf)
-      REAL agesno(klon,nbsrf)
-      REAL run_off_lic_0(klon)
-      REAL trs(klon,nbtr)
-c
-      INTEGER nid, nvarid, idim1, idim2, idim3
-      INTEGER ierr
-      INTEGER length
-      PARAMETER (length=100)
-      REAL tab_cntrl(length)
-c
-      INTEGER isoil, nsrf
-      CHARACTER (len=7) :: str7
-      CHARACTER (len=2) :: str2
-      INTEGER           :: it, iiq
-      
-c======================================================================
-c 
-c Get variables which will be written to restart file from module 
-c pbl_surface_mod
-      CALL pbl_surface_final(qsol, fder, snow, qsurf, 
-     $     evap, frugs, agesno, tsoil)
-
-c Get a variable calculated in module fonte_neige_mod
-      CALL fonte_neige_final(run_off_lic_0)
-
-c======================================================================
-
-      CALL open_restartphy(fichnom)
-      
-      DO ierr = 1, length
-         tab_cntrl(ierr) = 0.0
-      ENDDO
-      tab_cntrl(1) = dtime
-      tab_cntrl(2) = radpas
-c co2_ppm : current value of atmospheric CO2
-      tab_cntrl(3) = co2_ppm
-      tab_cntrl(4) = solaire
-      tab_cntrl(5) = iflag_con
-      tab_cntrl(6) = nbapp_rad
-
-      IF( cycle_diurne ) tab_cntrl( 7 ) = 1.
-      IF(   soil_model ) tab_cntrl( 8 ) = 1.
-      IF(     new_oliq ) tab_cntrl( 9 ) = 1.
-      IF(     ok_orodr ) tab_cntrl(10 ) = 1.
-      IF(     ok_orolf ) tab_cntrl(11 ) = 1.
-
-      tab_cntrl(13) = day_end
-      tab_cntrl(14) = annee_ref
-      tab_cntrl(15) = itau_phy
-
-c co2_ppm0 : initial value of atmospheric CO2
-      tab_cntrl(16) = co2_ppm0
-c
-      CALL put_var("controle","Parametres de controle",tab_cntrl)
-c
-
-      CALL put_field("longitude",
-     .               "Longitudes de la grille physique",rlon)
-     
-      CALL put_field("latitude","Latitudes de la grille physique",rlat)
-
-c
-C PB ajout du masque terre/mer
-C
-      CALL put_field("masque","masque terre mer",zmasq)
-
-c BP ajout des fraction de chaque sous-surface
-C
-C 1. fraction de terre 
-C
-      CALL put_field("FTER","fraction de continent",pctsrf(:,is_ter))
-C 
-C 2. Fraction de glace de terre
-C 
-      CALL put_field("FLIC","fraction glace de terre",pctsrf(:,is_lic))
-C
-C 3. fraction ocean
-C
-      CALL put_field("FOCE","fraction ocean",pctsrf(:,is_oce))
-C
-C 4. Fraction glace de mer
-C
-      CALL put_field("FSIC","fraction glace mer",pctsrf(:,is_sic))
-C
-C
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-          WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("TS"//str2,"Temperature de surface No."//str2,
-     .                    ftsol(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      ENDDO
-c
-      DO nsrf = 1, nbsrf
-        DO isoil=1, nsoilmx
-          IF (isoil.LE.99 .AND. nsrf.LE.99) THEN
-            WRITE(str7,'(i2.2,"srf",i2.2)') isoil,nsrf
-            CALL put_field("Tsoil"//str7,"Temperature du sol No."//str7,
-     .                     tsoil(:,isoil,nsrf))
-          ELSE
-            PRINT*, "Trop de couches"
-            CALL abort
-          ENDIF
-        ENDDO
-      ENDDO
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-          WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("QS"//str2,"Humidite de surface No."//str2,
-     .                   qsurf(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      END DO
-C
-      CALL put_field("QSOL","Eau dans le sol (mm)",qsol)
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-          WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("ALBE"//str2,"albedo de surface No."//str2,
-     .                   falb1(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      ENDDO
-
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-          WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("ALBLW"//str2,"albedo LW de surface No."//str2,
-     .                   falb2(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      ENDDO
-c
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-          WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("EVAP"//str2,"Evaporation de surface No."//str2
-     .                   ,evap(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      ENDDO
-
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-          WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("SNOW"//str2,"Neige de surface No."//str2,
-     .                   snow(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      ENDDO
-
-c
-      CALL put_field("RADS","Rayonnement net a la surface",radsol)
-c
-      CALL put_field("solsw","Rayonnement solaire a la surface",solsw)
-c
-      CALL put_field("sollw","Rayonnement IF a la surface",sollw)
-c
-      CALL put_field("fder","Derive de flux",fder)
-c
-      CALL put_field("rain_f","precipitation liquide",rain_fall)
-c
-      CALL put_field("snow_f", "precipitation solide",snow_fall)
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-          CALL put_field("RUG"//str2,"rugosite de surface No."//str2,
-     .         frugs(:,nsrf))
-        ELSE
-          PRINT*, "Trop de sous-mailles"
-          CALL abort
-        ENDIF
-      ENDDO
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-            WRITE(str2,'(i2.2)') nsrf
-            CALL put_field("AGESNO"//str2,
-     .                     "Age de la neige surface No."//str2,
-     .                     agesno(:,nsrf))
-        ELSE
-            PRINT*, "Trop de sous-mailles"
-            CALL abort
-        ENDIF
-      ENDDO
-c
-      CALL put_field("ZMEA","ZMEA",zmea)
-c
-      CALL put_field("ZSTD","ZSTD",zstd)
-      
-      CALL put_field("ZSIG","ZSIG",zsig)
-      
-      CALL put_field("ZGAM","ZGAM",zgam)
-      
-      CALL put_field("ZTHE","ZTHE",zthe)
-      
-      CALL put_field("ZPIC","ZPIC",zpic)
-      
-      CALL put_field("ZVAL","ZVAL",zval)
-      
-      CALL put_field("RUGSREL","RUGSREL",rugoro)
-      
-      CALL put_field("TANCIEN","TANCIEN",t_ancien)
-      
-      CALL put_field("QANCIEN","QANCIEN",q_ancien)
-
-      CALL put_field("UANCIEN","",u_ancien)
-
-      CALL put_field("VANCIEN","",v_ancien)
-
-      CALL put_field("RUGMER","Longueur de rugosite sur mer",
-     .               frugs(:,is_oce))
-      
-      CALL put_field("CLWCON","Eau liquide convective",clwcon)
-      
-      CALL put_field("RNEBCON","Nebulosite convective",rnebcon)
-      
-      CALL put_field("RATQS", "Ratqs",ratqs)
-c
-c run_off_lic_0
-c
-      CALL put_field("RUNOFFLIC0","Runofflic0",run_off_lic_0)
-c
-c
-!!!!!!!!!!!!!!!!!!!! DEB TKE PBL !!!!!!!!!!!!!!!!!!!!!!!!!
-c
-      IF (iflag_pbl>1) then
-        DO nsrf = 1, nbsrf
-          IF (nsrf.LE.99) THEN
-            WRITE(str2,'(i2.2)') nsrf
-            CALL put_field("TKE"//str2,"Energ. Cineti. Turb."//str2,
-     .                     pbl_tke(:,1:klev+1,nsrf))
-          ELSE
-            PRINT*, "Trop de sous-mailles"
-            CALL abort
-          ENDIF
-        ENDDO
-      ENDIF
-
-!!!!!!!!!!!!!!!!!!!! FIN TKE PBL !!!!!!!!!!!!!!!!!!!!!!!!!
-cIM ajout zmax0, f0, ema_work1, ema_work2
-cIM wake_deltat, wake_deltaq, wake_s, wake_cstar, wake_pe, wake_fip
-      
-      CALL put_field("ZMAX0","ZMAX0",zmax0)
-      
-      CALL put_field("F0","F0",f0)
-      
-      CALL put_field("EMA_WORK1","EMA_WORK1",ema_work1)
-      
-      CALL put_field("EMA_WORK2","EMA_WORK2",ema_work2)
-      
-c wake_deltat
-      CALL put_field("WAKE_DELTAT","WAKE_DELTAT",wake_deltat)
-
-      CALL put_field("WAKE_DELTAQ","WAKE_DELTAQ",wake_deltaq)
-      
-      CALL put_field("WAKE_S","WAKE_S",wake_s)
-      
-      CALL put_field("WAKE_CSTAR","WAKE_CSTAR",wake_cstar)
-      
-      CALL put_field("WAKE_PE","WAKE_PE",wake_pe)
-
-      CALL put_field("WAKE_FIP","WAKE_FIP",wake_fip)
-
-c thermiques
-
-      CALL put_field("FM_THERM","FM_THERM",fm_therm)
-
-      CALL put_field("ENTR_THERM","ENTR_THERM",entr_therm)
-
-      CALL put_field("DETR_THERM","DETR_THERM",detr_therm)
-
-! trs from traclmdz_mod
-      IF (type_trac == 'lmdz') THEN
-         CALL traclmdz_to_restart(trs)
-         DO it=1,nbtr
-            iiq=niadv(it+2)
-            CALL put_field("trs_"//tname(iiq),"",trs(:,it))
-         END DO
-         IF (carbon_cycle_cpl) THEN
-            IF (.NOT. ALLOCATED(co2_send)) THEN
-               ! This is the case of create_etat0_limit, ce0l
-               ALLOCATE(co2_send(klon))
-               co2_send(:) = co2_ppm0
-            END IF
-            CALL put_field("co2_send","co2_ppm for coupling",co2_send)
-         END IF
-      END IF
-
-      CALL close_restartphy
-!$OMP BARRIER
-      RETURN
-      END
Index: LMDZ5/trunk/libf/phylmd/phyredem.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phyredem.F90	(revision 1827)
+++ LMDZ5/trunk/libf/phylmd/phyredem.F90	(revision 1827)
@@ -0,0 +1,345 @@
+! $Id$
+
+SUBROUTINE phyredem (fichnom)
+
+  USE dimphy
+  USE mod_grid_phy_lmdz
+  USE mod_phys_lmdz_para
+  USE fonte_neige_mod,  ONLY : fonte_neige_final
+  USE pbl_surface_mod,  ONLY : pbl_surface_final
+  USE phys_state_var_mod
+  USE iostart
+  USE traclmdz_mod, ONLY : traclmdz_to_restart
+  USE infotrac
+  USE control_mod
+  USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
+  USE indice_sol_mod
+
+  IMPLICIT none
+  !======================================================================
+  ! Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
+  ! Objet: Ecriture de l'etat de redemarrage pour la physique
+  !======================================================================
+  include "netcdf.inc"
+  include "dimsoil.h"
+  include "clesphys.h"
+  include "temps.h"
+  include "thermcell.h"
+  include "compbl.h"
+  !======================================================================
+  CHARACTER*(*) fichnom
+
+  ! les variables globales ecrites dans le fichier restart
+
+  REAL tsoil(klon, nsoilmx, nbsrf)
+  REAL tslab(klon), seaice(klon)
+  REAL qsurf(klon, nbsrf)
+  REAL qsol(klon)
+  REAL snow(klon, nbsrf)
+  REAL evap(klon, nbsrf)
+  real fder(klon)
+  REAL frugs(klon, nbsrf)
+  REAL agesno(klon, nbsrf)
+  REAL run_off_lic_0(klon)
+  REAL trs(klon, nbtr)
+
+  INTEGER nid, nvarid, idim1, idim2, idim3
+  INTEGER ierr
+  INTEGER length
+  PARAMETER (length=100)
+  REAL tab_cntrl(length)
+
+  INTEGER isoil, nsrf
+  CHARACTER (len=7) :: str7
+  CHARACTER (len=2) :: str2
+  INTEGER           :: it, iiq
+
+  !======================================================================
+
+  ! Get variables which will be written to restart file from module 
+  ! pbl_surface_mod
+  CALL pbl_surface_final(qsol, fder, snow, qsurf,  &
+       evap, frugs, agesno, tsoil)
+
+  ! Get a variable calculated in module fonte_neige_mod
+  CALL fonte_neige_final(run_off_lic_0)
+
+  !======================================================================
+
+  CALL open_restartphy(fichnom)
+
+  DO ierr = 1, length
+     tab_cntrl(ierr) = 0.0
+  ENDDO
+  tab_cntrl(1) = dtime
+  tab_cntrl(2) = radpas
+  ! co2_ppm : current value of atmospheric CO2
+  tab_cntrl(3) = co2_ppm
+  tab_cntrl(4) = solaire
+  tab_cntrl(5) = iflag_con
+  tab_cntrl(6) = nbapp_rad
+
+  IF( cycle_diurne ) tab_cntrl( 7 ) = 1.
+  IF(   soil_model ) tab_cntrl( 8 ) = 1.
+  IF(     new_oliq ) tab_cntrl( 9 ) = 1.
+  IF(     ok_orodr ) tab_cntrl(10 ) = 1.
+  IF(     ok_orolf ) tab_cntrl(11 ) = 1.
+
+  tab_cntrl(13) = day_end
+  tab_cntrl(14) = annee_ref
+  tab_cntrl(15) = itau_phy
+
+  ! co2_ppm0 : initial value of atmospheric CO2
+  tab_cntrl(16) = co2_ppm0
+
+  CALL put_var("controle", "Parametres de controle", tab_cntrl)
+
+  CALL put_field("longitude", &
+       "Longitudes de la grille physique", rlon)
+
+  CALL put_field("latitude", "Latitudes de la grille physique", rlat)
+
+  ! PB ajout du masque terre/mer
+
+  CALL put_field("masque", "masque terre mer", zmasq)
+
+  ! BP ajout des fraction de chaque sous-surface
+
+  ! 1. fraction de terre 
+
+  CALL put_field("FTER", "fraction de continent", pctsrf(:, is_ter))
+
+  ! 2. Fraction de glace de terre
+
+  CALL put_field("FLIC", "fraction glace de terre", pctsrf(:, is_lic))
+
+  ! 3. fraction ocean
+
+  CALL put_field("FOCE", "fraction ocean", pctsrf(:, is_oce))
+
+  ! 4. Fraction glace de mer
+
+  CALL put_field("FSIC", "fraction glace mer", pctsrf(:, is_sic))
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("TS"//str2, "Temperature de surface No."//str2, &
+             ftsol(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  DO nsrf = 1, nbsrf
+     DO isoil=1, nsoilmx
+        IF (isoil.LE.99 .AND. nsrf.LE.99) THEN
+           WRITE(str7, '(i2.2, "srf", i2.2)') isoil, nsrf
+           CALL put_field("Tsoil"//str7, "Temperature du sol No."//str7, &
+                tsoil(:, isoil, nsrf))
+        ELSE
+           PRINT*, "Trop de couches"
+           CALL abort
+        ENDIF
+     ENDDO
+  ENDDO
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("QS"//str2, "Humidite de surface No."//str2, &
+             qsurf(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  END DO
+
+  CALL put_field("QSOL", "Eau dans le sol (mm)", qsol)
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("ALBE"//str2, "albedo de surface No."//str2, &
+             falb1(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("ALBLW"//str2, "albedo LW de surface No."//str2, &
+             falb2(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("EVAP"//str2, "Evaporation de surface No."//str2 &
+             , evap(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("SNOW"//str2, "Neige de surface No."//str2, &
+             snow(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  CALL put_field("RADS", "Rayonnement net a la surface", radsol)
+
+  CALL put_field("solsw", "Rayonnement solaire a la surface", solsw)
+
+  CALL put_field("sollw", "Rayonnement IF a la surface", sollw)
+
+  CALL put_field("fder", "Derive de flux", fder)
+
+  CALL put_field("rain_f", "precipitation liquide", rain_fall)
+
+  CALL put_field("snow_f", "precipitation solide", snow_fall)
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("RUG"//str2, "rugosite de surface No."//str2, &
+             frugs(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  DO nsrf = 1, nbsrf
+     IF (nsrf.LE.99) THEN
+        WRITE(str2, '(i2.2)') nsrf
+        CALL put_field("AGESNO"//str2, &
+             "Age de la neige surface No."//str2, &
+             agesno(:, nsrf))
+     ELSE
+        PRINT*, "Trop de sous-mailles"
+        CALL abort
+     ENDIF
+  ENDDO
+
+  CALL put_field("ZMEA", "ZMEA", zmea)
+
+  CALL put_field("ZSTD", "ZSTD", zstd)
+
+  CALL put_field("ZSIG", "ZSIG", zsig)
+
+  CALL put_field("ZGAM", "ZGAM", zgam)
+
+  CALL put_field("ZTHE", "ZTHE", zthe)
+
+  CALL put_field("ZPIC", "ZPIC", zpic)
+
+  CALL put_field("ZVAL", "ZVAL", zval)
+
+  CALL put_field("RUGSREL", "RUGSREL", rugoro)
+
+  CALL put_field("TANCIEN", "TANCIEN", t_ancien)
+
+  CALL put_field("QANCIEN", "QANCIEN", q_ancien)
+
+  CALL put_field("UANCIEN", "", u_ancien)
+
+  CALL put_field("VANCIEN", "", v_ancien)
+
+  CALL put_field("RUGMER", "Longueur de rugosite sur mer", &
+       frugs(:, is_oce))
+
+  CALL put_field("CLWCON", "Eau liquide convective", clwcon)
+
+  CALL put_field("RNEBCON", "Nebulosite convective", rnebcon)
+
+  CALL put_field("RATQS", "Ratqs", ratqs)
+
+  ! run_off_lic_0
+
+  CALL put_field("RUNOFFLIC0", "Runofflic0", run_off_lic_0)
+
+  ! DEB TKE PBL !
+
+  IF (iflag_pbl>1) then
+     DO nsrf = 1, nbsrf
+        IF (nsrf.LE.99) THEN
+           WRITE(str2, '(i2.2)') nsrf
+           CALL put_field("TKE"//str2, "Energ. Cineti. Turb."//str2, &
+                pbl_tke(:, 1:klev+1, nsrf))
+        ELSE
+           PRINT*, "Trop de sous-mailles"
+           CALL abort
+        ENDIF
+     ENDDO
+  ENDIF
+
+  ! FIN TKE PBL !
+  !IM ajout zmax0, f0, sig1, w01
+  !IM wake_deltat, wake_deltaq, wake_s, wake_cstar, wake_pe, wake_fip
+
+  CALL put_field("ZMAX0", "ZMAX0", zmax0)
+
+  CALL put_field("F0", "F0", f0)
+
+  CALL put_field("sig1", "sig1 Emanuel", sig1)
+
+  CALL put_field("w01", "w01 Emanuel", w01)
+
+  ! wake_deltat
+  CALL put_field("WAKE_DELTAT", "WAKE_DELTAT", wake_deltat)
+
+  CALL put_field("WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq)
+
+  CALL put_field("WAKE_S", "WAKE_S", wake_s)
+
+  CALL put_field("WAKE_CSTAR", "WAKE_CSTAR", wake_cstar)
+
+  CALL put_field("WAKE_PE", "WAKE_PE", wake_pe)
+
+  CALL put_field("WAKE_FIP", "WAKE_FIP", wake_fip)
+
+  ! thermiques
+
+  CALL put_field("FM_THERM", "FM_THERM", fm_therm)
+
+  CALL put_field("ENTR_THERM", "ENTR_THERM", entr_therm)
+
+  CALL put_field("DETR_THERM", "DETR_THERM", detr_therm)
+
+  ! trs from traclmdz_mod
+  IF (type_trac == 'lmdz') THEN
+     CALL traclmdz_to_restart(trs)
+     DO it=1, nbtr
+        iiq=niadv(it+2)
+        CALL put_field("trs_"//tname(iiq), "", trs(:, it))
+     END DO
+     IF (carbon_cycle_cpl) THEN
+        IF (.NOT. ALLOCATED(co2_send)) THEN
+           ! This is the case of create_etat0_limit, ce0l
+           ALLOCATE(co2_send(klon))
+           co2_send(:) = co2_ppm0
+        END IF
+        CALL put_field("co2_send", "co2_ppm for coupling", co2_send)
+     END IF
+  END IF
+
+  CALL close_restartphy
+  !$OMP BARRIER
+
+END SUBROUTINE phyredem
Index: LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90	(revision 1826)
+++ LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90	(revision 1827)
@@ -68,6 +68,6 @@
       REAL, ALLOCATABLE, SAVE :: zmax0(:), f0(:) ! 
 !$OMP THREADPRIVATE(zmax0,f0)
-      REAL, ALLOCATABLE, SAVE :: ema_work1(:,:), ema_work2(:,:)
-!$OMP THREADPRIVATE(ema_work1,ema_work2)
+      REAL, ALLOCATABLE, SAVE :: sig1(:,:), w01(:,:)
+!$OMP THREADPRIVATE(sig1,w01)
       REAL, ALLOCATABLE, SAVE :: entr_therm(:,:), fm_therm(:,:)
 !$OMP THREADPRIVATE(entr_therm,fm_therm)
@@ -400,5 +400,5 @@
       ALLOCATE(coefm(klon,klev+1,nbsrf+1))
       ALLOCATE(zmax0(klon), f0(klon))
-      ALLOCATE(ema_work1(klon,klev), ema_work2(klon,klev))
+      ALLOCATE(sig1(klon,klev), w01(klon,klev))
       ALLOCATE(entr_therm(klon,klev), fm_therm(klon,klev+1))
       ALLOCATE(detr_therm(klon,klev))
@@ -536,5 +536,5 @@
       deallocate(ratqs, pbl_tke,coefh,coefm)
       deallocate(zmax0, f0)
-      deallocate(ema_work1, ema_work2)
+      deallocate(sig1, w01)
       deallocate(entr_therm, fm_therm)
       deallocate(detr_therm)
Index: LMDZ5/trunk/libf/phylmd/physiq.F
===================================================================
--- LMDZ5/trunk/libf/phylmd/physiq.F	(revision 1826)
+++ LMDZ5/trunk/libf/phylmd/physiq.F	(revision 1827)
@@ -2275,5 +2275,5 @@
      .        u_seri,v_seri,tr_seri,nbtr_tmp,
      .        ALE,ALP,
-     .        ema_work1,ema_work2,
+     .        sig1,w01,
      .        d_t_con,d_q_con,d_u_con,d_v_con,d_tr,
      .        rain_con, snow_con, ibas_con, itop_con, sigd,
@@ -2308,5 +2308,5 @@
      .        paprs,pplay,t_seri,q_seri,
      .        u_seri,v_seri,tr_seri,ntra,
-     .        ema_work1,ema_work2,
+     .        sig1,w01,
      .        d_t_con,d_q_con,d_u_con,d_v_con,d_tr,
      .        rain_con, snow_con, ibas_con, itop_con,
