Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 2315)
+++ trunk/LMDZ.GENERIC/README	(revision 2336)
@@ -1576,2 +1576,6 @@
 == 05/05/2020 (r2308) == JVO
 Fix a nasty copy-paste bug from r2297 in n-layer aerosol scheme 
+
+== 05/06/2020 == EM
+Update start2archive/newstart programs to handle recently introduced
+non-orographic GW variables in (re-)start files.
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/lect_start_archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/lect_start_archive.F	(revision 2315)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/lect_start_archive.F	(revision 2336)
@@ -3,13 +3,11 @@
      &     t,ucov,vcov,ps,h,phisold_newgrid,
      &     q,qsurf,surfith,nid,
-     &     rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
-
-!      USE surfdat_h
+     &     rnat,pctsrf_sic,tslab,tsea_ice,sea_ice,
+     &     du_nonoro_gwd,dv_nonoro_gwd,east_gwstress,west_gwstress)
+
       USE comsoil_h, ONLY: nsoilmx, layer, mlayer, volcapa, inertiedat
       USE tracer_h, ONLY: igcm_co2_ice
       USE infotrac, ONLY: tname, nqtot
       USE slab_ice_h, ONLY: noceanmx
-!      USE control_mod
-! to use  'getin'
       USE callkeys_mod, ONLY: ok_slab_ocean
       USE comvert_mod, ONLY: ap,bp,aps,bps,preff
@@ -18,14 +16,5 @@
 c=======================================================================
 c
-c
-c   Auteur:    05/1997 , 12/2003 : coord hybride  FF
-c   ------
-c
-c
-c   Objet:     Lecture des variables d'un fichier "start_archive"
-c              Plus besoin de régler ancienne valeurs grace
-c              a l'allocation dynamique de memoire (Yann Wanherdrick)
-c
-c
+c    Routine to load variables from the "start_archive.nc" file
 c
 c=======================================================================
@@ -33,12 +22,9 @@
       implicit none
 
-#include "dimensions.h"
-!#include "dimphys.h"
-!#include "planete.h"
-#include "paramet.h"
-#include "comgeom2.h"
-!#include "control.h"
-#include "netcdf.inc"
-!#include"advtrac.h"
+      include "dimensions.h"
+      include "paramet.h"
+      include "comgeom2.h"
+      include "netcdf.inc"
+
 c=======================================================================
 c   Declarations
@@ -62,20 +48,5 @@
       CHARACTER*2   str2
 
-!      REAL dimfirst(4) ! tableau contenant les 1ers elements des dimensions
-
-!      REAL dimlast(4) ! tableau contenant les derniers elements des dimensions
-
-!      REAL dimcycl(4) ! tableau contenant les periodes des dimensions
-!      CHARACTER*120 dimsource
-!      CHARACTER*16 dimname
-!      CHARACTER*80 dimtitle
-!      CHARACTER*40 dimunits
-!      INTEGER   dimtype
-
-!      INTEGER dimord(4)  ! tableau contenant l''ordre
-!      data dimord /1,2,3,4/ ! de sortie des dimensions
-
-!      INTEGER vardim(4)
-      REAL date
+      REAL,INTENT(OUT) :: date
       INTEGER   memo
 !      character (len=50) :: tmpname
@@ -83,14 +54,7 @@
 c Variable histoire 
 c------------------
-      REAL vcov(iip1,jjm,llm),ucov(iip1,jjp1,llm) ! vents covariants
-      REAL h(iip1,jjp1,llm),ps(iip1,jjp1)
-      REAL q(iip1,jjp1,llm,nqtot),qtot(iip1,jjp1,llm)
-
-c autre variables dynamique nouvelle grille
-c------------------------------------------
-
-c!-*-
-!      integer klatdat,klongdat
-!      PARAMETER (klatdat=180,klongdat=360)
+      REAL,INTENT(OUT) :: vcov(iip1,jjm,llm),ucov(iip1,jjp1,llm) ! vents covariants
+      REAL,INTENT(OUT) :: h(iip1,jjp1,llm),ps(iip1,jjp1)
+      REAL,INTENT(OUT) :: q(iip1,jjp1,llm,nqtot)
 
 c Physique sur grille scalaire 
@@ -99,16 +63,21 @@
 c variable physique
 c------------------
-      REAL tsurf(ngrid) ! surface temperature
-      REAL tsoil(ngrid,nsoilmx) ! soil temperature
+      REAL,INTENT(OUT) :: tsurf(ngrid) ! surface temperature
+      REAL,INTENT(OUT) :: tsoil(ngrid,nsoilmx) ! soil temperature
       REAL co2ice(ngrid) ! CO2 ice layer
-      REAL emis(ngrid)
-      REAL q2(ngrid,llm+1),qsurf(ngrid,nqtot)
-      REAL tslab(ngrid,noceanmx)
-      REAL rnat(ngrid),pctsrf_sic(ngrid)
-      REAL tsea_ice(ngrid),sea_ice(ngrid)
+      REAL,INTENT(OUT) :: emis(ngrid)
+      REAL,INTENT(OUT) :: q2(ngrid,llm+1),qsurf(ngrid,nqtot)
+      REAL,INTENT(OUT) :: tslab(ngrid,noceanmx)
+      REAL ,INTENT(OUT) ::rnat(ngrid),pctsrf_sic(ngrid)
+      REAL,INTENT(OUT) :: tsea_ice(ngrid),sea_ice(ngrid)
 c     REAL phisfi(ngrid)
+      REAL,INTENT(OUT):: du_nonoro_gwd(ngrid,llm)
+      REAL,INTENT(OUT):: dv_nonoro_gwd(ngrid,llm)
+      REAL,INTENT(OUT):: east_gwstress(ngrid,llm)
+      REAL,INTENT(OUT):: west_gwstress(ngrid,llm)
 
       INTEGER i,j,l
-      INTEGER nid,nvarid
+      INTEGER,INTENT(IN) :: nid
+      INTEGER :: nvarid
 c     REAL year_day,periheli,aphelie,peri_day
 c     REAL obliquit,z0,emin_turb,lmixmin
@@ -122,6 +91,6 @@
 c------------------------------------------------------
       real us(iip1,jjp1,llm),vs(iip1,jjp1,llm)
-      REAL phisold_newgrid(iip1,jjp1)
-      REAL t(iip1,jjp1,llm)
+      REAL,INTENT(OUT) :: phisold_newgrid(iip1,jjp1)
+      REAL,INTENT(OUT) :: t(iip1,jjp1,llm)
       real tsurfS(iip1,jjp1),tsoilS(iip1,jjp1,nsoilmx)
       real inertiedatS(iip1,jjp1,nsoilmx)
@@ -132,4 +101,6 @@
       real pctsrf_sicS(iip1,jjp1),tsea_iceS(iip1,jjp1)
       real rnatS(iip1,jjp1), sea_iceS(iip1,jjp1)
+      real du_nonoro_gwdS(iip1,jjp1,llm),dv_nonoro_gwdS(iip1,jjp1,llm)
+      real east_gwstressS(iip1,jjp1,llm),west_gwstressS(iip1,jjp1,llm)
 
       real ptotal, co2icetotal
@@ -163,5 +134,8 @@
       real, dimension(:,:), allocatable :: rnatold,pctsrf_sicold
       real, dimension(:,:), allocatable :: tsea_iceold,sea_iceold
-
+      real,allocatable :: du_nonoro_gwdold(:,:,:)
+      real,allocatable :: dv_nonoro_gwdold(:,:,:)
+      real,allocatable :: east_gwstressold(:,:,:)
+      real,allocatable :: west_gwstressold(:,:,:)
 
       real tab_cntrl(100)
@@ -181,5 +155,5 @@
       real, dimension(:), allocatable :: newval
 
-      real surfith(iip1,jjp1) ! surface thermal inertia
+      real,intent(out) :: surfith(iip1,jjp1) ! surface thermal inertia
       ! surface thermal inertia at old horizontal grid resolution
       real, dimension(:,:), allocatable :: surfithold 
@@ -319,10 +293,15 @@
       allocate(sea_iceold(imold+1,jmold+1))
 
+      allocate(du_nonoro_gwdold(imold+1,jmold+1,lmold))
+      allocate(dv_nonoro_gwdold(imold+1,jmold+1,lmold))
+      allocate(east_gwstressold(imold+1,jmold+1,lmold))
+      allocate(west_gwstressold(imold+1,jmold+1,lmold))
+
       allocate(var (imold+1,jmold+1,llm))
       allocate(varp1 (imold+1,jmold+1,llm+1))
 
-      write(*,*) 'q2',ngrid,llm+1
-      write(*,*) 'q2S',iip1,jjp1,llm+1
-      write(*,*) 'q2old',imold+1,jmold+1,lmold+1
+      write(*,*) 'lect_start_archive: q2',ngrid,llm+1
+      write(*,*) 'lect_start_archive: q2S',iip1,jjp1,llm+1
+      write(*,*) 'lect_start_archive: q2old',imold+1,jmold+1,lmold+1
 
 !-----------------------------------------------------------------------
@@ -337,5 +316,5 @@
       ierr = NF_INQ_VARID (nid, "controle", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "Lect_start_archive: champ <controle> est absent"
+         PRINT*, "Lect_start_archive: champ <controle> not found"
          CALL abort
       ENDIF
@@ -358,5 +337,5 @@
       ierr = NF_INQ_VARID (nid, "rlonv", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <rlonv> est absent"
+         PRINT*, "lect_start_archive: Field <rlonv> not found"
          CALL abort
       ENDIF
@@ -367,5 +346,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <rlonv>"
+         PRINT*, "lect_start_archive: Failed loading <rlonv>"
          CALL abort
       ENDIF
@@ -373,5 +352,5 @@
       ierr = NF_INQ_VARID (nid, "rlatu", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <rlatu> est absent"
+         PRINT*, "lect_start_archive: Field <rlatu> not found"
          CALL abort
       ENDIF 
@@ -382,5 +361,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <rlatu>"
+         PRINT*, "lect_start_archive: Failed loading <rlatu>"
          CALL abort
       ENDIF
@@ -388,5 +367,5 @@
       ierr = NF_INQ_VARID (nid, "rlonu", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <rlonu> est absent"
+         PRINT*, "lect_start_archive: Field <rlonu> not found"
          CALL abort
       ENDIF
@@ -397,5 +376,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <rlonu>"
+         PRINT*, "lect_start_archive: Failed loading <rlonu>"
          CALL abort
       ENDIF
@@ -403,5 +382,5 @@
       ierr = NF_INQ_VARID (nid, "rlatv", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <rlatv> est absent"
+         PRINT*, "lect_start_archive: Field <rlatv> not found"
          CALL abort
       ENDIF
@@ -412,5 +391,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <rlatv>"
+         PRINT*, "lect_start_archive: Failed loading <rlatv>"
          CALL abort
       ENDIF
@@ -423,5 +402,5 @@
       ierr = NF_INQ_VARID (nid, "aps", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <aps> est absent"
+         PRINT*, "lect_start_archive: Field <aps> not found"
          apsold=0
          PRINT*, "<aps> set to 0"
@@ -433,5 +412,5 @@
 #endif
          IF (ierr .NE. NF_NOERR) THEN
-            PRINT*, "lect_start_archive: Lecture echouee pour <aps>"
+            PRINT*, "lect_start_archive: Failed loading <aps>"
          ENDIF
       ENDIF
@@ -439,5 +418,5 @@
       ierr = NF_INQ_VARID (nid, "bps", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <bps> est absent"
+         PRINT*, "lect_start_archive: Field <bps> not found"
          PRINT*, "It must be an old start_archive, lets look for sig_s"
          ierr = NF_INQ_VARID (nid, "sig_s", nvarid)
@@ -453,5 +432,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <bps>"
+         PRINT*, "lect_start_archive: Failed loading <bps>"
          CALL abort
       END IF
@@ -542,5 +521,5 @@
       ierr = NF_INQ_VARID (nid, "phisinit", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <phisinit> est absent"
+         PRINT*, "lect_start_archive: Field <phisinit> not found"
          CALL abort
       ENDIF
@@ -551,5 +530,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <phisinit>"
+         PRINT*, "lect_start_archive: Failed loading <phisinit>"
          CALL abort
       ENDIF
@@ -571,5 +550,5 @@
          ierr = NF_INQ_DIMID (nid, "temps", nvarid)
          IF (ierr .NE. NF_NOERR) THEN
-            PRINT*, "lect_start_archive: Le champ <Time> est absent"
+            PRINT*, "lect_start_archive: Field <Time> not found"
             CALL abort
          endif
@@ -586,5 +565,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <Time>"
+         PRINT*, "lect_start_archive: Failed loading <Time>"
          CALL abort
       ENDIF
@@ -592,11 +571,11 @@
       write(*,*)
       write(*,*)
-      write(*,*) 'Differentes dates des etats initiaux stockes:'
-      write(*,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+      write(*,*) 'Available dates for the stored initial conditions:'
+      write(*,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
       pi=2.*ASIN(1.)
       do i=1,timelen
 c       call solarlong(timelist(i),sollong(i))
 c       sollong(i) = sollong(i)*180./pi
-        write(*,*) 'etat initial au jour martien' ,int(timelist(i))
+        write(*,*) 'initial state for day ' ,int(timelist(i))
 c       write(*,6) nint(timelist(i)),nint(mod(timelist(i),669)),
 c    .    sollong(i)
@@ -606,5 +585,5 @@
  
       write(*,*)
-      write(*,*) 'Choix de la date'
+      write(*,*) 'Choice for the date'
  123  read(*,*,iostat=ierr) date
       if(ierr.ne.0) goto 123
@@ -619,10 +598,10 @@
         write(*,*)
         write(*,*)
-        write(*,*) 'He alors... Y sait pas lire !?!'
+        write(*,*) "Wrong value... can't you read !?!"
         write(*,*)
-        write(*,*) 'Differentes dates des etats initiaux stockes:'
-        write(*,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+        write(*,*) 'Available dates for the stored initial conditions:'
+        write(*,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
         do i=1,timelen
-          write(*,*) 'etat initial au jour martien' ,nint(timelist(i))
+          write(*,*) 'initial state for day ' ,nint(timelist(i))
 c         write(*,6) nint(timelist(i)),nint(mod(timelist(i),669))
         end do
@@ -642,24 +621,7 @@
       count=(/imold+1,jmold+1,1,0/)
        
-! CO2ice is now in qsurf(igcm_co2_ice) ...
-!      ierr = NF_INQ_VARID (nid, "co2ice", nvarid)
-!      IF (ierr .NE. NF_NOERR) THEN
-!         PRINT*, "lect_start_archive: Le champ <co2ice> est absent"
-!         CALL abort
-!      ENDIF
-!#ifdef NC_DOUBLE
-!      ierr = NF_GET_VARA_DOUBLE(nid, nvarid,start,count,co2iceold)
-!#else
-!      ierr = NF_GET_VARA_REAL(nid, nvarid,start,count,co2iceold)
-!#endif
-!      IF (ierr .NE. NF_NOERR) THEN
-!         PRINT*, "lect_start_archive: Lecture echouee pour <co2ice>"
-!         PRINT*, NF_STRERROR(ierr)
-!         CALL abort
-!      ENDIF
-c
       ierr = NF_INQ_VARID (nid, "emis", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <emis> est absent"
+         PRINT*, "lect_start_archive: Field <emis> not found"
          CALL abort
       ENDIF
@@ -670,5 +632,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <emis>"
+         PRINT*, "lect_start_archive: Failed loading <emis>"
          CALL abort
       ENDIF
@@ -676,5 +638,5 @@
       ierr = NF_INQ_VARID (nid, "ps", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <ps> est absent"
+         PRINT*, "lect_start_archive: Field <ps> not found"
          CALL abort
       ENDIF
@@ -685,5 +647,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <ps>"
+         PRINT*, "lect_start_archive: Failed loading <ps>"
          CALL abort
       ENDIF
@@ -691,5 +653,5 @@
       ierr = NF_INQ_VARID (nid, "tsurf", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <tsurf> est absent"
+         PRINT*, "lect_start_archive: Field <tsurf> not found"
          CALL abort
       ENDIF
@@ -700,5 +662,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <tsurf>"
+         PRINT*, "lect_start_archive: Failed loading <tsurf>"
          CALL abort
       ENDIF
@@ -706,5 +668,5 @@
       ierr = NF_INQ_VARID (nid, "q2surf", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <q2surf> est absent"
+         PRINT*, "lect_start_archive: Field <q2surf> not found"
          CALL abort
       ENDIF
@@ -715,5 +677,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <q2surf>"
+         PRINT*, "lect_start_archive: Failed loading <q2surf>"
          CALL abort
       ENDIF
@@ -734,5 +696,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <tslab>"
+         PRINT*, "lect_start_archive: Failed loading <tslab>"
       ENDIF
 
@@ -744,5 +706,5 @@
       ierr = NF_INQ_VARID (nid, "rnat", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <rnat> est absent"
+         PRINT*, "lect_start_archive: Field <rnat> not found"
       ENDIF
 #ifdef NC_DOUBLE
@@ -752,10 +714,10 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <rnat>"
+         PRINT*, "lect_start_archive: Failed loading <rnat>"
       ENDIF
 c
       ierr = NF_INQ_VARID (nid, "pctsrf_sic", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <pctsrf_sic> est absent"
+         PRINT*, "lect_start_archive: Field <pctsrf_sic> not found"
       ENDIF
 #ifdef NC_DOUBLE
@@ -765,10 +727,10 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <pctsrf_sic>"
+         PRINT*, "lect_start_archive: Failed loading <pctsrf_sic>"
       ENDIF
 c
       ierr = NF_INQ_VARID (nid, "tsea_ice", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <tsea_ice> est absent"
+         PRINT*, "lect_start_archive: Field <tsea_ice> not found"
       ENDIF
 #ifdef NC_DOUBLE
@@ -778,10 +740,10 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <tsea_ice>"
+         PRINT*, "lect_start_archive: Failed loading <tsea_ice>"
       ENDIF
 c
       ierr = NF_INQ_VARID (nid, "sea_ice", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <sea_ice> est absent"
+         PRINT*, "lect_start_archive: Field <sea_ice> not found"
       ENDIF
 #ifdef NC_DOUBLE
@@ -791,5 +753,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <sea_ice>"
+         PRINT*, "lect_start_archive: Failed loading <sea_ice>"
       ENDIF
   
@@ -801,14 +763,6 @@
 
 ! Surface tracers:      
-      do iq=1,nqtot
-        ! initialize all surface tracers to zero
-        call initial0((jmold+1)*(imold+1), qsurfold(1,1,iq))
-      enddo
-
-
-!      print*,'tname=',tname
-!      print*,'nid',nid
-!      print*,'nvarid',nvarid
-!      stop
+      ! initialize all surface tracers to zero
+      qsurfold(1:imold+1,1:jmold+1,1:nqtot)=0
 
       DO iq=1,nqtot
@@ -843,5 +797,4 @@
      &             " Failed loading <",trim(txt),">"
           write (*,*) trim(txt),'    is set to 0'
-!          call initial0((jmold+1)*(imold+1), qsurfold(1,1,iq))
         ENDIF
 
@@ -905,21 +858,4 @@
       endif ! of if (olddepthdef)
 
-!
-! Read soil thermal inertias
-!
-!      if (.not.olddepthdef) then ! no thermal inertia data in "old" archives
-!       ierr=NF_INQ_VARID(nid,"inertiedat",nvarid)
-!       if (ierr.ne.NF_NOERR) then
-!        write(*,*)"lect_start_archive: Cannot find <inertiedat>"
-!	call abort
-!       else
-!#ifdef NC_DOUBLE
-!      ierr=NF_GET_VARA_DOUBLE(nid,nvarid,start,count,inertiedatold)
-!#else
-!      ierr=NF_GET_VARA_REAL(nid,nvarid,start,count,inertiedatold)
-!#endif
-!       endif ! of if (ierr.ne.NF_NOERR)
-!      endif
-
 c-----------------------------------------------------------------------
 c 5.3	Lecture des champs 3D (t,u,v, q2atm,q)
@@ -932,5 +868,5 @@
       ierr = NF_INQ_VARID (nid,"temp", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <temp> est absent"
+         PRINT*, "lect_start_archive: Field <temp> not found"
          CALL abort
       ENDIF
@@ -941,5 +877,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <temp>"
+         PRINT*, "lect_start_archive: Failed loading <temp>"
          CALL abort
       ENDIF
@@ -947,5 +883,5 @@
       ierr = NF_INQ_VARID (nid,"u", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <u> est absent"
+         PRINT*, "lect_start_archive: Field <u> not found"
          CALL abort
       ENDIF
@@ -956,5 +892,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <u>"
+         PRINT*, "lect_start_archive: Failed loading <u>"
          CALL abort
       ENDIF
@@ -962,5 +898,5 @@
       ierr = NF_INQ_VARID (nid,"v", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <v> est absent"
+         PRINT*, "lect_start_archive: Field <v> not found"
          CALL abort
       ENDIF
@@ -971,5 +907,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <v>"
+         PRINT*, "lect_start_archive: Failed loading <v>"
          CALL abort
       ENDIF
@@ -977,5 +913,5 @@
       ierr = NF_INQ_VARID (nid,"q2atm", nvarid)
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Le champ <q2atm> est absent"
+         PRINT*, "lect_start_archive: Field <q2atm> not found"
          CALL abort
       ENDIF
@@ -986,5 +922,5 @@
 #endif
       IF (ierr .NE. NF_NOERR) THEN
-         PRINT*, "lect_start_archive: Lecture echouee pour <q2atm>"
+         PRINT*, "lect_start_archive: Failed loading <q2atm>"
          CALL abort
       ENDIF
@@ -992,7 +928,5 @@
 
 ! Tracers:      
-      do iq=1,nqtot
-         call initial0((jmold+1)*(imold+1)*lmold,qold(1,1,1,iq) )
-      enddo
+      qold(1:imold+1,1:jmold+1,1:lmold,1:nqtot)=0.
 
       DO iq=1,nqtot
@@ -1025,4 +959,72 @@
       ENDDO ! of DO iq=1,nqtot
 
+! Non-orographic GWs:
+      write(*,*)"lect_start_archive: loading du_nonoro_gwd"
+      ierr = NF_INQ_VARID (nid,"du_nonoro_gwd", nvarid)
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Field <du_nonoro_gwd> not found"
+         PRINT*, "Setting it to zero"
+         du_nonoro_gwdold(:,:,:)=0
+      ENDIF
+#ifdef NC_DOUBLE
+      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,du_nonoro_gwdold)
+#else
+      ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,du_nonoro_gwdold)
+#endif
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Failed loading <du_nonoro_gwd>"
+         CALL abort
+      ENDIF
+
+      write(*,*)"lect_start_archive: loading dv_nonoro_gwd"
+      ierr = NF_INQ_VARID (nid,"dv_nonoro_gwd", nvarid)
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Field <dv_nonoro_gwd> not found"
+         PRINT*, "Setting it to zero"
+         dv_nonoro_gwdold(:,:,:)=0
+      ENDIF
+#ifdef NC_DOUBLE
+      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,dv_nonoro_gwdold)
+#else
+      ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,dv_nonoro_gwdold)
+#endif
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Failed loading <dv_nonoro_gwd>"
+         CALL abort
+      ENDIF
+
+      write(*,*)"lect_start_archive: loading east_gwstress"
+      ierr = NF_INQ_VARID (nid,"east_gwstress", nvarid)
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Field <east_gwstress> not found"
+         PRINT*, "Setting it to zero"
+         east_gwstressold(:,:,:)=0
+      ENDIF
+#ifdef NC_DOUBLE
+      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,east_gwstressold)
+#else
+      ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,east_gwstressold)
+#endif
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Failed loading <east_gwstress>"
+         CALL abort
+      ENDIF
+
+      write(*,*)"lect_start_archive: loading west_gwstress"
+      ierr = NF_INQ_VARID (nid,"west_gwstress", nvarid)
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Field <west_gwstress> not found"
+         PRINT*, "Setting it to zero"
+         west_gwstressold(:,:,:)=0
+      ENDIF
+#ifdef NC_DOUBLE
+      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,west_gwstressold)
+#else
+      ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,west_gwstressold)
+#endif
+      IF (ierr .NE. NF_NOERR) THEN
+         PRINT*, "lect_start_archive: Failed loading <west_gwstress>"
+         CALL abort
+      ENDIF
 
 !=======================================================================
@@ -1106,10 +1108,10 @@
 
       write(*,*)
-      write(*,*)'Ancienne grille: masse de l atm :',ptotalold
-      write(*,*)'Nouvelle grille: masse de l atm :',ptotal
+      write(*,*)'Old grid: atmospheric mass :',ptotalold
+      write(*,*)'New grid: atmospheric mass :',ptotal
       write (*,*) 'Ratio new atm./ old atm =', ptotal/ptotalold 
       write(*,*)
-      write(*,*)'Ancienne grille: masse de la glace CO2:',co2icetotalold
-      write(*,*)'Nouvelle grille: masse de la glace CO2:',co2icetotal
+      write(*,*)'Old grid: mass of CO2 ice:',co2icetotalold
+      write(*,*)'New grid: mass of CO2 ice:',co2icetotal
       if (co2icetotalold.ne.0.) then
       write(*,*)'Ratio new ice./old ice =',co2icetotal/co2icetotalold
@@ -1325,4 +1327,33 @@
      &                   rlonuold,rlatvold,rlonu,rlatv)
       write (*,*) 'lect_start_archive: t ', t(1,jjp1,1)  ! INFO
+
+! Non-orographic GW
+      call interp_vert
+     &    (du_nonoro_gwdold,var,lmold,llm,apsold,bpsold,aps,bps,
+     &     psold,(imold+1)*(jmold+1))
+      call interp_horiz(var,du_nonoro_gwdS,imold,jmold,iim,jjm,llm,
+     &                   rlonuold,rlatvold,rlonu,rlatv)
+      call gr_dyn_fi(llm,iim+1,jjm+1,ngrid,du_nonoro_gwdS,du_nonoro_gwd)
+      
+      call interp_vert
+     &    (dv_nonoro_gwdold,var,lmold,llm,apsold,bpsold,aps,bps,
+     &     psold,(imold+1)*(jmold+1))
+      call interp_horiz(var,dv_nonoro_gwdS,imold,jmold,iim,jjm,llm,
+     &                   rlonuold,rlatvold,rlonu,rlatv)
+      call gr_dyn_fi(llm,iim+1,jjm+1,ngrid,dv_nonoro_gwdS,dv_nonoro_gwd)
+      
+      call interp_vert
+     &    (east_gwstressold,var,lmold,llm,apsold,bpsold,aps,bps,
+     &     psold,(imold+1)*(jmold+1))
+      call interp_horiz(var,east_gwstressS,imold,jmold,iim,jjm,llm,
+     &                   rlonuold,rlatvold,rlonu,rlatv)
+      call gr_dyn_fi(llm,iim+1,jjm+1,ngrid,east_gwstressS,east_gwstress)
+      
+      call interp_vert
+     &    (west_gwstressold,var,lmold,llm,apsold,bpsold,aps,bps,
+     &     psold,(imold+1)*(jmold+1))
+      call interp_horiz(var,west_gwstressS,imold,jmold,iim,jjm,llm,
+     &                   rlonuold,rlatvold,rlonu,rlatv)
+      call gr_dyn_fi(llm,iim+1,jjm+1,ngrid,west_gwstressS,west_gwstress)
 
 c q2 : pbl wind variance
@@ -1488,5 +1519,3 @@
       deallocate(sea_iceold)
 
-!      write(*,*)'lect_start_archive: END'
-      return
       end
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F	(revision 2315)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F	(revision 2336)
@@ -23,4 +23,6 @@
       USE surfdat_h, ONLY: phisfi, albedodat,
      &                     zmea, zstd, zsig, zgam, zthe
+      USE nonoro_gwd_ran_mod, ONLY: du_nonoro_gwd, dv_nonoro_gwd,
+     &                              east_gwstress, west_gwstress
       use datafile_mod, only: datadir, surfdir
       use ioipsl_getin_p_mod, only: getin_p
@@ -38,5 +40,7 @@
       USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
       use tabfi_mod, only: tabfi
+      use dimphy, only: init_dimphy
       use iniphysiq_mod, only: iniphysiq
+      use phys_state_var_mod, only: phys_state_var_init
       use phyetat0_mod, only: phyetat0
       implicit none
@@ -283,13 +287,8 @@
       call initracer(ngridmx,nqtot,tname)
 
-! Take care of arrays in common modules
-      ! ALLOCATE ARRAYS in surfdat_h (if not already done, e.g. when using start_archive)
-      IF (.not. ALLOCATED(albedodat)) ALLOCATE(albedodat(ngridmx))
-      IF (.not. ALLOCATED(phisfi)) ALLOCATE(phisfi(ngridmx))
-      IF (.not. ALLOCATED(zmea)) ALLOCATE(zmea(ngridmx))
-      IF (.not. ALLOCATED(zstd)) ALLOCATE(zstd(ngridmx))
-      IF (.not. ALLOCATED(zsig)) ALLOCATE(zsig(ngridmx))
-      IF (.not. ALLOCATED(zgam)) ALLOCATE(zgam(ngridmx))
-      IF (.not. ALLOCATED(zthe)) ALLOCATE(zthe(ngridmx))
+! Initialize dimphy module (klon,klev,..)
+      call init_dimphy(ngridmx,llm)
+! Allocate saved arrays (as in firstcall of physiq)
+      call phys_state_var_init(nqtot)
 
 c-----------------------------------------------------------------------
@@ -552,5 +551,6 @@
      &   t,ucov,vcov,ps,teta,phisold_newgrid,q,qsurf,
      &   surfith,nid,
-     &   rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
+     &   rnat,pctsrf_sic,tslab,tsea_ice,sea_ice,
+     &   du_nonoro_gwd,dv_nonoro_gwd,east_gwstress,west_gwstress)
         write(*,*) "OK, read start_archive file"
         ! copy soil thermal inertia
@@ -1128,20 +1128,4 @@
            CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)
 
-c$$$           do ig=1,ngridmx
-c$$$             j=(ig-2)/iim +2
-c$$$              if(ig.eq.1) j=1
-c$$$              if (rlatu(j)*180./pi.gt.80.) then
-c$$$
-c$$$                   qsurf(ig,igcm_h2o_ice)=1.e5
-c$$$                   qsurf(ig,igcm_h2o_vap)=0.0!1.e5
-c$$$
-c$$$                   write(*,*) 'ig=',ig,'    H2O ice mass (kg/m2)= ',
-c$$$     &              qsurf(ig,igcm_h2o_ice)
-c$$$
-c$$$                   write(*,*)'     ==> Ice mesh South boundary (deg)= ',
-c$$$     &              rlatv(j)*180./pi
-c$$$                end if
-c$$$           enddo
-
 c      watercaps : H20 ice on permanent southern cap
 c      -------------------------------------------------
@@ -1169,18 +1153,4 @@
            ENDDO
            CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)
-
-c$$$           do ig=1,ngridmx
-c$$$               j=(ig-2)/iim +2
-c$$$               if(ig.eq.1) j=1
-c$$$               if (rlatu(j)*180./pi.lt.-80.) then
-c$$$                  qsurf(ig,igcm_h2o_ice)=1.e5
-c$$$                  qsurf(ig,igcm_h2o_vap)=0.0 !1.e5
-c$$$
-c$$$                  write(*,*) 'ig=',ig,'   H2O ice mass (kg/m2)= ',
-c$$$     &                 qsurf(ig,igcm_h2o_ice)
-c$$$                  write(*,*)'     ==> Ice mesh North boundary (deg)= ',
-c$$$     &                 rlatv(j-1)*180./pi
-c$$$               end if
-c$$$           enddo
 
 
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F	(revision 2315)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F	(revision 2336)
@@ -22,10 +22,6 @@
       USE comsoil_h
       
-!      USE comgeomfi_h, ONLY: lati, long, area
-!      use control_mod
-!      use comgeomphy, only: initcomgeomphy
       use slab_ice_h, only: noceanmx
-! to use  'getin'
-      USE ioipsl_getincom
+      USE ioipsl_getincom, only: getin
       USE planete_mod, only: year_day
       USE mod_const_mpi, ONLY: COMM_LMDZ
@@ -37,5 +33,8 @@
       USE temps_mod, ONLY: day_ini
       USE iniphysiq_mod, ONLY: iniphysiq
+      use phys_state_var_mod, only: phys_state_var_init
       use phyetat0_mod, only: phyetat0
+      use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd,
+     &                          east_gwstress, west_gwstress
       implicit none
 
@@ -45,9 +44,5 @@
       include "comdissip.h"
       include "comgeom.h"
-!#include "control.h"
-
-!#include "dimphys.h"
-!#include "planete.h"
-!#include"advtrac.h"
+
       include "netcdf.inc"
 c-----------------------------------------------------------------------
@@ -111,4 +106,7 @@
       REAL tslabS(ip1jmp1,noceanmx),tsea_iceS(ip1jmp1)
 
+!     For non-orographic GW
+      REAL du_nonoro_gwdS(ip1jmp1,llm),dv_nonoro_gwdS(ip1jmp1,llm)
+      REAL east_gwstressS(ip1jmp1,llm),west_gwstressS(ip1jmp1,llm)
 
 c Variables intermediaires : vent naturel, mais pas coord scalaire
@@ -234,4 +232,7 @@
       Lmodif=0
 
+! Allocate saved arrays (as in firstcall of physiq)
+      call phys_state_var_init(nqtot)
+      
 ! Initialize tracer names, indexes and properties
       CALL initracer(ngridmx,nqtot,tname)
@@ -357,4 +358,8 @@
       call gr_fi_dyn(noceanmx,ngridmx,iip1,jjp1,tslab,tslabS)
 
+      call gr_fi_dyn(llm,ngridmx,iip1,jjp1,du_nonoro_gwd,du_nonoro_gwdS)
+      call gr_fi_dyn(llm,ngridmx,iip1,jjp1,dv_nonoro_gwd,dv_nonoro_gwdS)
+      call gr_fi_dyn(llm,ngridmx,iip1,jjp1,east_gwstress,east_gwstressS)
+      call gr_fi_dyn(llm,ngridmx,iip1,jjp1,west_gwstress,west_gwstressS)
 c=======================================================================
 c Info pour controler
@@ -370,5 +375,5 @@
          ENDDO
       ENDDO
-      write(*,*)'Ancienne grille : masse de l''atm :',ptotal
+      write(*,*)'Old grid: : atmospheric mass :',ptotal
 !      write(*,*)'Ancienne grille : masse de la glace CO2 :',co2icetotal
 
@@ -519,23 +524,37 @@
       IF(ierr.EQ.0) THEN
 
-
-         write(*,*) "Use slab-ocean ?"
-         ok_slab_ocean=.false.         ! default value
-         call getin("ok_slab_ocean",ok_slab_ocean)
-         write(*,*) "ok_slab_ocean = ",ok_slab_ocean
-
-      if(ok_slab_ocean) then
-      call write_archive(nid,ntime,'rnat'
-     &        ,'rnat','',2,rnatS)
-      call write_archive(nid,ntime,'pctsrf_sic'
-     &        ,'pctsrf_sic','',2,pctsrf_sicS)
-      call write_archive(nid,ntime,'sea_ice'
-     &        ,'sea_ice','',2,sea_iceS)
-      call write_archive(nid,ntime,'tslab'
-     &        ,'tslab','',-2,tslabS)
-      call write_archive(nid,ntime,'tsea_ice'
-     &        ,'tsea_ice','',2,tsea_iceS)
-      endif !ok_slab_ocean
-      ENDIF
+        write(*,*) "Use slab-ocean ?"
+        ok_slab_ocean=.false.         ! default value
+        call getin("ok_slab_ocean",ok_slab_ocean)
+        write(*,*) "ok_slab_ocean = ",ok_slab_ocean
+
+        if(ok_slab_ocean) then
+          call write_archive(nid,ntime,'rnat'
+     &            ,'rnat','',2,rnatS)
+          call write_archive(nid,ntime,'pctsrf_sic'
+     &            ,'pctsrf_sic','',2,pctsrf_sicS)
+          call write_archive(nid,ntime,'sea_ice'
+     &            ,'sea_ice','',2,sea_iceS)
+          call write_archive(nid,ntime,'tslab'
+     &            ,'tslab','',-2,tslabS)
+          call write_archive(nid,ntime,'tsea_ice'
+     &            ,'tsea_ice','',2,tsea_iceS)
+        endif !ok_slab_ocean
+      
+      ENDIF ! of IF(ierr.EQ.0)
+
+! Non-orographic gavity waves
+      call write_archive(nid,ntime,"du_nonoro_gwd",
+     &     "Zonal wind tendency due to GW",'m.s-1',3,du_nonoro_gwdS)
+      call write_archive(nid,ntime,"dv_nonoro_gwd",
+     &     "Meridional wind tendency due to GW",'m.s-1',
+     &     3,dv_nonoro_gwdS)
+      call write_archive(nid,ntime,"east_gwstress",
+     &     "Eastward stress profile due to GW",'kg.m-1.s-2',
+     &     3,east_gwstressS)
+      call write_archive(nid,ntime,"west_gwstress",
+     &     "Westward stress profile due to GW",'kg.m-1.s-2',
+     &     3,west_gwstressS)
+
 c-----------------------------------------------------------------------
 c Fin 
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/write_archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/write_archive.F	(revision 2315)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/write_archive.F	(revision 2336)
@@ -37,8 +37,8 @@
       implicit none
 
-#include "dimensions.h"
-#include "paramet.h"
-#include "comgeom.h"
-#include "netcdf.inc"
+      include "dimensions.h"
+      include "paramet.h"
+      include "comgeom.h"
+      include "netcdf.inc"
 
 c-----------------------------------------------------------------------
@@ -83,5 +83,5 @@
 
               write (*,*) "====================="
-              write (*,*) "creation de ",nom
+              write (*,*) "defining ",nom
               call def_var(nid,nom,titre,unite,4,id,varid,ierr)
 
@@ -113,6 +113,6 @@
 
            if (ierr.ne.NF_NOERR) then
-              write(*,*) "***** PUT_VAR matter in write_archive"
-              write(*,*) "***** with ",nom," ",nf_STRERROR(ierr)
+              write(*,*) "***** PUT_VAR problem in write_archive"
+              write(*,*) "***** with ",trim(nom)," ",nf_STRERROR(ierr)
               call abort
            endif
@@ -140,5 +140,5 @@
 	  ! define the variable
 	  write(*,*)"====================="
-	  write(*,*)"defining ",nom
+	  write(*,*)"defining variable ",trim(nom)
 	  call def_var(nid,nom,titre,unite,4,id,varid,ierr)
 	  
@@ -182,5 +182,5 @@
           ! define the variable
           write(*,*)"====================="
-          write(*,*)"defining ",nom
+          write(*,*)"defining variable ",trim(nom)
           call def_var(nid,nom,titre,unite,4,id,varid,ierr)
 
@@ -222,5 +222,5 @@
 
               write (*,*) "====================="
-              write (*,*) "creation de ",nom
+              write (*,*) "defining variable ",trim(nom)
 
               call def_var(nid,nom,titre,unite,3,id,varid,ierr)
@@ -243,5 +243,5 @@
 
            if (ierr.ne.NF_NOERR) then
-              write(*,*) "***** PUT_VAR matter in write_archive"
+              write(*,*) "***** PUT_VAR problem in write_archive"
               write(*,*) "***** with ",nom,nf_STRERROR(ierr)
               call abort
@@ -264,5 +264,5 @@
 
               write (*,*) "====================="
-              write (*,*) "creation de ",nom
+              write (*,*) "defining variable ",trim(nom)
 
               call def_var(nid,nom,titre,unite,1,id,varid,ierr)
@@ -279,5 +279,5 @@
 #endif
            if (ierr.ne.NF_NOERR) then
-              write(*,*) "***** PUT_VAR matter in write_archive"
+              write(*,*) "***** PUT_VAR problem in write_archive"
               write(*,*) "***** with ",nom,nf_STRERROR(ierr)
               call abort
@@ -289,5 +289,4 @@
         endif ! of if (dim.eq.3) else if (dim.eq.-3) ....
 
-      return
       end
 
