Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 2340)
+++ trunk/LMDZ.GENERIC/README	(revision 2354)
@@ -1583,2 +1583,6 @@
 == 09/06/2020 (r2340) == JVO
 In addition to r2297, for the n-layer aerosol scheme, enables to set the particle size effective variance with aeronlay_nueff in callphys.def.
+
+== 09/06/2020 == EM
+Major cleanup: remove obsolete compilation scripts (makegcm*) and old dynamical
+core, as it is obsolete with respect to the one provide in LMDZ.COMMON.
Index: trunk/LMDZ.GENERIC/create_make_gcm
===================================================================
--- trunk/LMDZ.GENERIC/create_make_gcm	(revision 2340)
+++ 	(revision )
@@ -1,263 +1,0 @@
-#!/bin/sh
-#set -xv
-#
-# Ehouarn: added the following feature:
-#          create_make_gcm must be called with list of directories
-#          which contain header (or modules) which should be scanned
-#          by create_make_gcm when checking dependencies.
-#          Example:
-#          create_make_gcm dyn3d grid
-#          means that header/modules will be looked for in directories
-#          ., dyn3d and grid
-#
-
-# arguments given to create_make_gcm are the directories to scan
-src_dirs=$*
-
-machine=`hostname`
-os=`uname`
-gcm=`pwd`
-logfile=$gcm/create_make_gcm.log
-rm -f $logfile ; touch -f $logfile
-libf=$gcm/libf
-libo=$gcm/libo
-CRAY=0
-if [ "$machine" = "atlas" -o "$machine" = "etoile" -o "$machine" = "axis" ] ; then
-  CRAY=1
-fi
-XNEC=0
-if [ "$machine" = "rhodes" ] ; then
-  XNEC=1
-fi
-VPP=0
-if [ "$machine" = "nymphea0" ] ; then
-  VPP=1
-fi
-#
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo "# Definitions de Macros pour Make"
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo 
-echo "# create_make_gcm arguments: $*"
-echo
-echo "# Repertoires :"
-echo
-echo "GCM     = "$gcm
-if [ "$CRAY" = '0' ] ; then
-   echo "MACHINE = sun4"
-fi
-echo 'LIBF    = $(GCM)/libf'
-if [ "$CRAY" = '0' ] ; then
-#   echo 'LIBO    = $(GCM)/libo/$(MACHINE)'
-   echo 'LIBO    = $(LIBOGCM)/$(MACHINE)'
-else
-   echo 'LIBO    = $(GCM)/libo'
-fi
-#echo 'LOCAL_DIR=$(GCM)'
-#echo $localdir
-echo "LOCAL_DIR=`echo $localdir`"
-echo 'MISC    = $(LIBF)/misc'
-#echo 'AERONOMARS    = $(LIBF)/aeronomars'
-echo "FILTRE   = filtre"
-echo "PHYS  = "
-echo 'DYN  = $(DYNTYPE)'
-echo 'LIBPHY = $(LIBO)/libphy$(PHYS).a'
-echo 'LIBDYN_PHY = $(LIBO)/libdynlmdz_phy$(PHYS).a'
-echo 'DIRMAIN= $(DYN)$(DIM)d'
-echo 'RM=rm'
-echo
-echo "OPLINK = "
-echo
-echo '# Les differentes librairies pour l"edition des liens:'
-echo
-echo 'L_DYN      = -ldyn$(DIM)d'
-echo 'L_FILTRE   = -l$(FILTRE)'
-echo 'L_DYN_PHY = -ldynlmdz_phy$(PHYS) '
-echo 'L_PHY = -lphy$(PHYS) -lphy_common'
-echo 'L_MISC    = -lmisc'
-#echo 'L_AERONOMARS    = -laeronomars'
-echo 'L_ADJNT    ='
-echo
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo "# Option de compilation FORTRAN"
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo
-   echo 'COMPILE = $(F77) $(OPTIM) $(INCLUDE) -c'
-   echo 'COMPILE90 = $(F90) $(OPTIM90) $(INCLUDE) -c'
-   echo 'COMPTRU90 = $(F90) $(OPTIMTRU90) $(INCLUDE) -c'
-   echo "LINK    = $LINK"
-   echo "AR      = $AR"
-echo
-echo
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo "# Creation des differents executables"
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo
-echo "# Executables:"
-echo "# ------------"
-echo
-echo "PROG = code"
-echo 'DYN  = dyn$(DIM)d'
-echo
-echo 'main : $(DYN) misc phys phy_common dyn_phy $(OPTION_DEP) '
-echo '	cd $(LIBO) ; $(RANLIB) lib*.a ; cd $(GCM) ;\'
-echo '	cd $(LOCAL_DIR); \'
-echo '	$(COMPILE90) $(LIBF)/$(DIRMAIN)/$(SOURCE) -o $(PROG).o ; \'
-echo '	$(LINK) $(PROG).o -L$(LIBO) $(L_DYN) $(L_DYN_PHY) $(L_ADJNT) $(L_FILTRE) $(L_PHY) $(L_DYN_PHY) $(L_MISC) $(L_DYN) $(L_PHY) $(OPLINK) $(OPTION_LINK) -o $(LOCAL_DIR)/$(PROG).e ; $(RM) $(PROG).o '
-echo
-echo 'dyn : $(LIBO)/libdyn$(DIM)d.a $(FILTRE)$(DIM)d'
-echo
-echo 'olddyn : $(LIBO)/libolddyn$(DIM)d.a $(FILTRE)$(DIM)d'
-echo
-echo 'phys : $(LIBPHY)'
-echo 'phy_common : $(LIBPHY_COMMON)'
-echo
-echo 'dyn3d : $(LIBO)/libdyn3d.a $(LIBO)/lib$(FILTRE).a'
-echo 'dyn2d : $(LIBO)/libdyn2d.a'
-echo 'dyn1d : '
-echo
-echo 'dyn_phy: $(LIBDYN_PHYS)'
-echo
-echo 'misc : $(LIBO)/libmisc.a'
-echo
-#echo 'aeronomars : $(LIBO)/libaeronomars.a'
-#echo
-echo 'adjnt : $(LIBO)/libadjnt.a'
-echo
-echo '$(FILTRE)3d : $(LIBO)/lib$(FILTRE).a'
-echo
-echo '$(FILTRE)2d :'
-echo
-echo '$(FILTRE)1d :'
-echo
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo "# Contenu des differentes bibliotheques"
-echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
-echo
-echo
-cd $libf >/dev/null 2>&1
-
-for diri in $src_dirs ; do
-
-   if [ -d $diri ] ; then
-   if [ "`ls $diri/*.F`" != "" ] || [ "`ls $diri/*.[fF]90`" != "" ]  ; then 
-#      cd $diri >/dev/null 2>&1
-      echo
-      listlib=""
-# Liste des fichiers .F et .F90 n'etant pas des programmes principaux
-      for fili in `ls $diri/*.[fF]` ; do
-         # Check if file is a routine or main program
-         # i.e: look for the "program" keword preceeded by leading spaces
-         test=` (  head $fili | grep -i '^ *program' ) `
-         # if it is not a main program, add it to the list
-         if [ "$test" = "" ] ; then listlib=$listlib" "$fili ; fi
-      done
-      for fili in `ls $diri/*.[fF]90` ; do
-         # Check if file is a routine or main program
-         # i.e. look for "program" keyword (with possibly some leading spaces)
-         test=` (  head $fili | grep -i '^ \{0,\}program' ) `
-         # if it is not a main program, add it to the list
-         if [ "$test" = "" ] ; then listlib=$listlib" "$fili ; fi 
-      done
-      echo
-      echo $listlib >> $logfile
-      echo
-      # topdiri contains main dir name (without trailing "/blabla" for subdirs)
-      topdiri=${diri%/*}
-      echo "#=================================================================="
-      echo "# Contenu de la bibliotheque correspondant au Directory "$diri
-      echo "#=================================================================="
-      echo
-      for trufile in $listlib ; do
-         fili=`echo $trufile | awk -F/ ' { print $NF } ' | cut -d. -f1`
-         echo '$(LIBO)/lib'$topdiri".a : " '$(LIBO)/lib'$topdiri".a("$fili".o)"
-         echo
-      done
-      echo '.PRECIOUS	: $(LIBO)/lib'$topdiri'.a'
-      echo
-      echo
-      echo "# Compilation of elements in $diri of library lib"$topdiri".a"
-      echo
-      for trufile in $listlib ; do
-         fili=`echo $trufile | awk -F/ ' { print $NF } ' | cut -d. -f1`
-         F90=0 ; egrep -i '^ *use ' $trufile > /dev/null 2>&1 && F90=1
-                 egrep -i '^ *module ' $trufile > /dev/null 2>&1 && F90=1
-                 egrep -i '#include*.inc ' $trufile > /dev/null 2>&1 && F90=1
-         str1='$(LIBO)/lib'$topdiri'.a('$fili'.o) : $(LIBF)/'$trufile
-         [ "$fili" = "$diri/chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F
-
-##########################################################################
-# TRAITEMENT DES DEPENDANCES
-# Differents cas de dependance correspondant a des include ou des
-# use module.
-# soit dans le repertoire local soit dans un autre.
-# Pour dyn3d, il faudrait remplacer la chaine de caractere par $DYN
-# ou quelque chose du genre.
-##########################################################################
-
-         for stri in ` ( sed -e '/^[cC\!]/d' $trufile | sed -e "/\#include /s/\#include /XXnclude /" -e "/include /s/include /XXnclude /" -e "/INCLUDE /s/INCLUDE /XXnclude /" | sed -n "/XXnclude /s/XXnclude//p" | sed 's/\"//g' | sort | uniq ; sed -e '/^[cC\!]/d' $trufile | egrep -i '^ *use ' | sed -e 's/,/ /' | awk ' { print $2 } ' | sort | uniq ) ` ; do
-            echo $trufile $fili $stri >> $logfile
-            strj=`echo $stri | tr [A-Z] [a-z]`
-            str2=""
-            for dirinc in $src_dirs ; do
-# Recherche dans l'ordre hierarchique inverse car seule la derniere
-# ligne est conservee
-#               if [ $dirinc = phydev ] ; then
-#                   dirstr='$(PHYS)'
-#                   libstr='phy$(PHYS)'
-#               else
-                   dirstr=$dirinc
-                   libstr=$dirinc
-#               fi
-               echo dirinc $dirinc >> $logfile
-               if [ -f $dirinc/$stri ] ; then
-                  str2='$(LIBF)/'$dirstr/$stri
-               elif [ -f $dirinc/$strj ] ; then
-                  str2='$(LIBF)/'$dirstr/$stri
-               elif [ -f $dirinc/$strj.[fF]90 ]  || [ -f $dirinc/$strj.[fF] ]  ; then 
-                  strlib=`echo $libstr | awk -F/ ' { print $1 } '`
-                  str2='$(LIBO)/lib'$strlib'.a('$strj'.o)'
-               elif [ -f $dirinc/$stri.[fF]90 ]  || [ -f $dirinc/$stri.[fF] ]  ; then 
-                  strlib=`echo $libstr | awk -F/ ' { print $1 } '`
-                  str2='$(LIBO)/lib'$strlib'.a('$stri'.o)'
-               fi
-               echo stri $stri  >> $logfile
-               echo str2 $str2  >> $logfile
-            done
-               echo dernier str2 $str2  >> $logfile
-            if [ "$str2" = "" ] ; then
-               echo Warn: Include $diri $trufile $fili $stri pas trouve >> $logfile
-            elif [ "$str2" = "$str1" ] ; then
-               echo Warn: Include $diri $trufile $fili $stri $str1 trouve 2x >> $logfile
-            else
-               echo $str1 \\
-               str1=$str2
-            fi
-         done # Fin de la boucle sur les dependances et ecriture de la derniere
-         echo $str1
-         # Compile in LIBO directory; and before compiling, remove
-         # object from library
-         echo '	cd $(LIBO); \'
-         echo '	$(AR) d $(LIBO)/lib'$topdiri'.a '$fili'.o ; \'
-	 if [ "$F90" -eq '0' ] ; then
-         ## Fixed Form Fortran 77
-	   echo '	$(COMPILE) $(LIBF)/'$trufile' ; \'
-	 else
-         ## Fortran 90
-           if [ `echo $trufile | cut -d. -f2` = F90 ] ; then
-	      ## Free Form
-              echo '	$(COMPTRU90) $(LIBF)/'$trufile' ; \'
-           else
-	      echo '	$(COMPILE90) $(LIBF)/'$trufile' ; \'
-           fi
-	 fi
-         # Put generated object in library
-         echo '	$(AR) r $(LIBO)/lib'$topdiri'.a '$fili'.o ; $(RM) '$fili'.o ; \'
-	 echo
-      done
-#	 
-      echo
-   cd $libf
-   fi
-   fi
-done
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/caldyn0.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/caldyn0.F	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/caldyn0.F	(revision 2354)
@@ -1,1 +1,88 @@
-link ../../dyn3d/caldyn0.F
+      SUBROUTINE caldyn0
+     $ (itau,ucov,vcov,teta,ps,masse,pk,phis ,
+     $  phi,w,pbaru,pbarv,time )
+
+      USE comvert_mod, ONLY: ap,bp
+
+      IMPLICIT NONE
+
+c=======================================================================
+c
+c  Auteur :  P. Le Van
+c
+c   Objet:
+c   ------
+c
+c   Calcul des tendances dynamiques.
+c
+c Modif 04/93 F.Forget
+c=======================================================================
+
+c-----------------------------------------------------------------------
+c   0. Declarations:
+c   ----------------
+
+#include "dimensions.h"
+#include "paramet.h"
+#include "comgeom.h"
+
+c   Arguments:
+c   ----------
+
+      INTEGER itau
+      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm),teta(ip1jmp1,llm)
+      REAL ps(ip1jmp1),phis(ip1jmp1)
+      REAL pk(iip1,jjp1,llm)
+      REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm)
+      REAL phi(ip1jmp1,llm),masse(ip1jmp1,llm)
+      REAL pbaru(ip1jmp1,llm),pbarv(ip1jm,llm)
+      REAL time
+
+c   Local:
+c   ------
+
+      REAL ang(ip1jmp1,llm),p(ip1jmp1,llmp1)
+      REAL massebx(ip1jmp1,llm),masseby(ip1jm,llm),psexbarxy(ip1jm)
+      REAL vorpot(ip1jm,llm)
+      REAL w(ip1jmp1,llm),ecin(ip1jmp1,llm),convm(ip1jmp1,llm)
+      REAL bern(ip1jmp1,llm)
+      REAL massebxy(ip1jm,llm), dp(ip1jmp1)
+    
+
+      INTEGER   ij,l
+      EXTERNAL  advect,bernoui,convmas,covcont ,
+     *          enercin,flumass,tourpot,vitvert,sortvarc,traceur,
+     *          pression,psextbar,massdair
+
+c-----------------------------------------------------------------------
+c   Calcul des tendances dynamiques:
+c   --------------------------------
+      CALL covcont  (llm,ucov,vcov,ucont,vcont)
+      CALL pression (ip1jmp1,ap,bp,ps,p)
+      CALL psextbar (ps,psexbarxy)
+      CALL massdair (p,masse)
+      CALL massbar  (masse,massebx,masseby)
+      CALL massbarxy(masse,massebxy)
+      CALL flumass  (massebx,masseby,vcont,ucont,pbaru,pbarv)
+      CALL convmas  (pbaru,pbarv,convm)
+
+      DO ij =1, ip1jmp1
+         dp( ij ) = convm( ij,1 ) / airesurg( ij )
+      ENDDO
+
+      CALL vitvert (convm,w)
+      CALL tourpot (vcov,ucov,massebxy,vorpot)
+      CALL enercin (vcov,ucov,vcont,ucont,ecin)
+      CALL bernoui (ip1jmp1,llm,phi,ecin,bern)
+
+      DO l=1,llm
+         DO ij=1,ip1jmp1
+            ang(ij,l) = ucov(ij,l) + constang(ij)
+         ENDDO
+      ENDDO
+
+        CALL sortvarc0
+     $ (itau,ucov,teta,ps,masse,pk,phis,vorpot,phi,bern,dp,time,vcov)
+
+      RETURN
+      END
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/defrun_new.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/defrun_new.F	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/defrun_new.F	(revision 2354)
@@ -1,1 +1,535 @@
-link ../../dyn3d/defrun_new.F
+      SUBROUTINE defrun_new( tapedef, etatinit )
+#ifndef CPP_PARA
+c
+c-----------------------------------------------------------------------
+c     Auteurs :   L. Fairhead , P. Le Van  .
+c      Modif C. Hourdin F. Forget VERSION MARTIENNE
+c
+c
+c  -------------------------------------------------------------------
+c
+c                    MODIF JUIN 2000 (zoom)
+c       .........     Version  du 29/04/97       ..........
+c
+c   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
+c   tetatemp   ajoutes  pour la dissipation   .
+c
+c   Autre parametre ajoute en fin de liste : ** fxyhypb ** 
+c
+c   Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
+c   Sinon , choix de fxynew  , a derivee sinusoidale  ..
+c
+c   ......  etatinit = . TRUE. si defrun_new  est appele dans NEWSTART
+c   ETAT0_LMD  ou  LIMIT_LMD  pour l'initialisation de start.dat (dic) et
+c   de limit.dat (dic)  ...........
+c   Sinon  etatinit = . FALSE .
+c
+c   Donc etatinit = .F.  si on veut comparer les valeurs de  alphax ,
+c   alphay,clon,clat, fxyhypb  lues sur  le fichier  start  avec
+c   celles passees  par run.def ,  au debut du gcm, apres l'appel a 
+c   lectba .  
+c   Ces parametres definissant entre autres la grille et doivent etre
+c   pareils et coherents , sinon il y aura  divergence du gcm .
+c
+c
+c-----------------------------------------------------------------------
+c   Declarations :
+c   --------------
+! to use  'getin'
+      USE ioipsl_getincom
+      use sponge_mod,only: callsponge,nsponge,mode_sponge,tetasponge
+      use control_mod,only: nday, day_step, iperiod, anneeref,
+     &                      iconser, dissip_period, iphysiq
+      USE logic_mod, ONLY: hybrid,purmats,fxyhypb,ysinus,iflag_phys
+      USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy,
+     .			alphax,alphay,taux,tauy
+      IMPLICIT NONE
+
+#include "dimensions.h"
+#include "paramet.h"
+!#include "control.h"
+#include "comdissnew.h"
+#include "iniprint.h"
+c
+c   arguments:
+c   ---------
+      LOGICAL  etatinit ! should be .false. for a call from gcm.F
+                        ! and .true. for a call from newstart.F
+      INTEGER  tapedef  ! unit number to assign to 'run.def' file
+c
+c   local variables:
+c   ---------------
+
+      CHARACTER ch1*72,ch2*72,ch3*72,ch4*8 ! to store various strings
+      integer tapeerr ! unit number for error message
+      parameter (tapeerr=0)
+
+c     REAL clonn,clatt,alphaxx,alphayy
+c     LOGICAL  fxyhypbb
+      INTEGER ierr
+      REAL clonn,clatt,grossismxx,grossismyy
+      REAL dzoomxx,dzoomyy,tauxx,tauyy,temp
+      LOGICAL  fxyhypbb, ysinuss
+
+
+c   initialisations:
+c   ----------------
+ 
+!      lunout=6
+
+c-----------------------------------------------------------------------
+c  Parametres de controle du run:
+c-----------------------------------------------------------------------
+
+
+!Initialisation des parametres "terrestres", qui ne concernent pas
+!le modele martien et ne sont donc plus lues dans "run.def"
+
+        anneeref=0
+        ! Note: anneref is a common in 'control.h'
+
+      OPEN(tapedef,file='run.def',status='old',form='formatted'
+     .     ,iostat=ierr)
+      CLOSE(tapedef) ! first call to getin will open the file
+
+      !lunout: default unit for the text outputs
+      lunout=6
+      CALL getin('lunout', lunout)
+      IF (lunout /= 5 .and. lunout /= 6) THEN
+        OPEN(UNIT=lunout,FILE='lmdz.out',ACTION='write',
+     &       STATUS='unknown',FORM='formatted')
+      ENDIF
+
+      IF(ierr.EQ.0) THEN ! if file run.def is found
+        WRITE(lunout,*) "DEFRUN_NEW: reading file run.def"
+        
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "Number of days to run:"
+        nday=1 ! default value
+        call getin("nday",nday)
+        WRITE(lunout,*)" nday = ",nday
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "Number of dynamical steps per day:",
+     & "(should be a multiple of iperiod)"
+        day_step=960 ! default value
+        call getin("day_step",day_step)
+        WRITE(lunout,*)" day_step = ",day_step
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "periode pour le pas Matsuno (en pas)"
+        iperiod=5 ! default value
+        call getin("iperiod",iperiod)
+        WRITE(lunout,*)" iperiod = ",iperiod
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "periode de sortie des variables de ",
+     &  "controle (en pas)"
+        iconser=120 ! default value
+        call getin("iconser",iconser)
+        WRITE(lunout,*)" iconser = ",iconser
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "periode de la dissipation (en pas)"
+        dissip_period=5 ! default value
+        call getin("idissip",dissip_period)
+        ! if there is a "dissip_period" in run.def, it overrides "idissip"
+        call getin("dissip_period",dissip_period)
+        WRITE(lunout,*)" dissip_period = ",dissip_period
+
+ccc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
+ccc
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "choix de l'operateur de dissipation ",
+     & "(star ou  non star )"
+        lstardis=.true. ! default value
+        call getin("lstardis",lstardis)
+        WRITE(lunout,*)" lstardis = ",lstardis
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "avec ou sans coordonnee hybrides"
+        hybrid=.true. ! default value
+        call getin("hybrid",hybrid)
+        WRITE(lunout,*)" hybrid = ",hybrid
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "nombre d'iterations de l'operateur de ",
+     & "dissipation   gradiv "
+        nitergdiv=1 ! default value
+        call getin("nitergdiv",nitergdiv)
+        WRITE(lunout,*)" nitergdiv = ",nitergdiv
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "nombre d'iterations de l'operateur de ",
+     & "dissipation  nxgradrot"
+        nitergrot=2 ! default value
+        call getin("nitergrot",nitergrot)
+        WRITE(lunout,*)" nitergrot = ",nitergrot
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "nombre d'iterations de l'operateur de ",
+     & "dissipation  divgrad"
+        niterh=2 ! default value
+        call getin("niterh",niterh)
+        WRITE(lunout,*)" niterh = ",niterh
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "temps de dissipation des plus petites ",
+     & "long.d ondes pour u,v (gradiv)"
+        tetagdiv=4000. ! default value
+        call getin("tetagdiv",tetagdiv)
+        WRITE(lunout,*)" tetagdiv = ",tetagdiv
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "temps de dissipation des plus petites ",
+     & "long.d ondes pour u,v(nxgradrot)"
+        tetagrot=5000. ! default value
+        call getin("tetagrot",tetagrot)
+        WRITE(lunout,*)" tetagrot = ",tetagrot
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "temps de dissipation des plus petites ",
+     & "long.d ondes pour  h ( divgrad)"
+        tetatemp=5000. ! default value
+        call getin("tetatemp",tetatemp)
+        WRITE(lunout,*)" tetatemp = ",tetatemp
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "coefficient pour gamdissip"
+        coefdis=0. ! default value
+        call getin("coefdis",coefdis)
+        WRITE(lunout,*)" coefdis = ",coefdis
+c
+c    ...............................................................
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "choix du shema d'integration temporelle ",
+     & "(true==Matsuno ou false==Matsuno-leapfrog)"
+        purmats=.false. ! default value
+        call getin("purmats",purmats)
+        WRITE(lunout,*)" purmats = ",purmats
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "avec ou sans physique"
+!        physic=.true. ! default value
+!        call getin("physic",physic)
+!        WRITE(lunout,*)" physic = ",physic
+        iflag_phys=1 ! default value
+        call getin("iflag_phys",iflag_phys)
+        WRITE(lunout,*)" iflag_phys = ",iflag_phys
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "periode de la physique (en pas)"
+        iphysiq=20 ! default value
+        call getin("iphysiq",iphysiq)
+        WRITE(lunout,*)" iphysiq = ",iphysiq
+
+!        WRITE(lunout,*) ""
+!        WRITE(lunout,*) "choix d'une grille reguliere"
+!        grireg=.true.
+!        call getin("grireg",grireg)
+!        WRITE(lunout,*)" grireg = ",grireg
+
+ccc   .... P.Le Van, ajout le 03/01/96 pour l'ecriture phys ...
+c
+!        WRITE(lunout,*) ""
+!        WRITE(lunout,*) "frequence (en pas) de l'ecriture ",
+!     & "du fichier diagfi.nc"
+!        ecritphy=240
+!        call getin("ecritphy",ecritphy)
+!        WRITE(lunout,*)" ecritphy = ",ecritphy
+
+ccc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
+c     .........   (  modif  le 17/04/96 )   .........
+c
+        if (.not.etatinit ) then 
+
+           clonn=63.
+           call getin("clon",clonn)
+           
+           IF( ABS(clon - clonn).GE. 0.001 )  THEN
+             PRINT *,' La valeur de clon passee par run.def est '
+     *       ,'differente de celle lue sur le fichier start '
+             STOP
+           ENDIF
+c
+c
+           clatt=0.
+           call getin("clat",clatt)
+  
+           IF( ABS(clat - clatt).GE. 0.001 )  THEN
+             PRINT *,' La valeur de clat passee par run.def est '
+     *       ,'differente de celle lue sur le fichier start '
+             STOP
+           ENDIF
+
+           grossismxx=1.0
+           call getin("grossismx",grossismxx)
+
+           if(grossismxx.eq.0) then  
+             write(*,*)
+             write(*,*)'ERREUR : dans run.def, grossismx =0'
+             write(*,*)'Attention a ne pas utiliser une version de'
+             write(*,*)'run.def avant le nouveau zoom LMDZ2.3 (06/2000)'
+             write(*,*)'(Il faut ajouter grossismx,dzoomx,etc... a la'
+             write(*,*)'place de alphax, alphay. cf. dyn3d). '
+             write(*,*)
+             stop
+           end if
+
+           IF( ABS(grossismx - grossismxx).GE. 0.001 )  THEN
+             PRINT *,' La valeur de grossismx passee par run.def est '
+     *       ,'differente de celle lue sur le fichier  start =',
+     *        grossismx
+             if (grossismx.eq.0) then
+                  write(*,*) 'OK,Normal : c est un vieux start'
+     *             , 'd avant le nouveau zoom LMDZ2.3 (06/2000)'
+                 grossismx=grossismxx
+             else
+                   STOP
+             endif
+           ENDIF
+
+           grossismyy=1.0
+           call getin("grossismy",grossismyy)
+
+           IF( ABS(grossismy - grossismyy).GE. 0.001 )  THEN
+             PRINT *,' La valeur de grossismy passee par run.def est '
+     *       ,'differente de celle lue sur le fichier  start =',
+     *        grossismy
+             if (grossismy.eq.0) then
+                  write(*,*) 'OK,Normal : c est un vieux start'
+     *             , 'd avant le nouveau zoom LMDZ2.3 (06/2000)'
+                 grossismy=grossismyy
+             else
+                   STOP
+             endif
+           ENDIF
+
+
+           IF( grossismx.LT.1. )  THEN
+             PRINT *,' ***  ATTENTION !! grossismx < 1 .   *** '
+             STOP
+           ELSE
+             alphax = 1. - 1./ grossismx
+           ENDIF
+
+           IF( grossismy.LT.1. )  THEN
+             PRINT *,' ***  ATTENTION !! grossismy < 1 .   *** '
+             STOP
+           ELSE
+             alphay = 1. - 1./ grossismy
+           ENDIF
+
+           PRINT *,' '
+           PRINT *,' --> In defrun: alphax alphay  ',alphax,alphay
+           PRINT *,' '
+c
+           fxyhypbb=.false.
+           call getin("fxyhypbb",fxyhypbb)
+  
+           IF( .NOT.fxyhypb )  THEN
+             IF( fxyhypbb )     THEN
+                PRINT *,' ********  PBS DANS  DEFRUN  ******** '
+                PRINT *,' *** fxyhypb lu sur le fichier start est F ',
+     *          'alors  qu il est  T  sur  run.def  ***'
+                STOP
+             ENDIF
+           ELSE
+             IF( .NOT.fxyhypbb )   THEN
+                PRINT *,' ********  PBS DANS  DEFRUN  ******** '
+                PRINT *,' ***  fxyhypb lu sur le fichier start est T ',
+     *         'alors  qu il est  F  sur  run.def  ****  '
+                STOP
+             ENDIF
+           ENDIF
+           dzoomxx=0.0
+           call getin("dzoomx",dzoomxx)
+
+           IF( fxyhypb )  THEN
+              IF( ABS(dzoomx - dzoomxx).GE. 0.001 )  THEN
+                PRINT *,' La valeur de dzoomx passee par run.def est '
+     *          ,'differente de celle lue sur le fichier  start '
+                STOP
+              ENDIF
+           ENDIF
+
+           dzoomyy=0.0
+           call getin("dzoomy",dzoomyy)
+
+           IF( fxyhypb )  THEN
+              IF( ABS(dzoomy - dzoomyy).GE. 0.001 )  THEN
+                PRINT *,' La valeur de dzoomy passee par run.def est '
+     *          ,'differente de celle lue sur le fichier  start '
+                STOP
+              ENDIF
+           ENDIF
+
+           tauxx=2.0
+           call getin("taux",tauxx)
+
+           tauyy=2.0
+           call getin("tauy",tauyy)
+
+           IF( fxyhypb )  THEN
+              IF( ABS(taux - tauxx).GE. 0.001 )  THEN
+                WRITE(6,*)' La valeur de taux passee par run.def est', 
+     *             'differente de celle lue sur le fichier  start '
+                CALL ABORT
+              ENDIF
+
+              IF( ABS(tauy - tauyy).GE. 0.001 )  THEN
+                WRITE(6,*)' La valeur de tauy passee par run.def est',
+     *          'differente de celle lue sur le fichier  start '
+                CALL ABORT
+              ENDIF
+           ENDIF
+  
+        ELSE    ! Below, case when etainit=.true.
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "longitude en degres du centre du zoom"
+           clon=63. ! default value
+           call getin("clon",clon)
+           WRITE(lunout,*)" clon = ",clon
+           
+c
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "latitude en degres du centre du zoom "
+           clat=0. ! default value
+           call getin("clat",clat)
+           WRITE(lunout,*)" clat = ",clat
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "facteur de grossissement du zoom,",
+     & " selon longitude"
+           grossismx=1.0 ! default value
+           call getin("grossismx",grossismx)
+           WRITE(lunout,*)" grossismx = ",grossismx
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "facteur de grossissement du zoom ,",
+     & " selon latitude"
+           grossismy=1.0 ! default value
+           call getin("grossismy",grossismy)
+           WRITE(lunout,*)" grossismy = ",grossismy
+
+           IF( grossismx.LT.1. )  THEN
+            PRINT *,' ***  ATTENTION !! grossismx < 1 .   *** '
+            STOP
+           ELSE
+             alphax = 1. - 1./ grossismx
+           ENDIF
+
+           IF( grossismy.LT.1. )  THEN
+             PRINT *,' ***  ATTENTION !! grossismy < 1 .   *** '
+             STOP
+           ELSE
+             alphay = 1. - 1./ grossismy
+           ENDIF
+
+           PRINT *,' Defrun  alphax alphay  ',alphax,alphay
+c
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "Fonction  f(y)  hyperbolique  si = .true.",
+     &  ", sinon  sinusoidale"
+           fxyhypb=.false. ! default value
+           call getin("fxyhypb",fxyhypb)
+           WRITE(lunout,*)" fxyhypb = ",fxyhypb
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "extension en longitude de la zone du zoom", 
+     & " (fraction de la zone totale)"
+           dzoomx=0. ! default value
+           call getin("dzoomx",dzoomx)
+           WRITE(lunout,*)" dzoomx = ",dzoomx
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "extension en latitude de la zone du zoom", 
+     & " (fraction de la zone totale)"
+           dzoomy=0. ! default value
+           call getin("dzoomy",dzoomy)
+           WRITE(lunout,*)" dzoomy = ",dzoomy
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "raideur du zoom en  X"
+           taux=2. ! default value
+           call getin("taux",taux)
+           WRITE(lunout,*)" taux = ",taux
+
+           WRITE(lunout,*) ""
+           WRITE(lunout,*) "raideur du zoom en  Y"
+           tauy=2.0 ! default value
+           call getin("tauy",tauy)
+           WRITE(lunout,*)" tauy = ",tauy
+
+        END IF ! of if (.not.etatinit )
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "Use a sponge layer?"
+        callsponge=.true. ! default value
+        call getin("callsponge",callsponge)
+        WRITE(lunout,*)" callsponge = ",callsponge
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "Sponge: number of layers over which",
+     &                    " sponge extends"
+        nsponge=3 ! default value
+        call getin("nsponge",nsponge)
+        WRITE(lunout,*)" nsponge = ",nsponge
+
+        WRITE(lunout,*)""
+        WRITE(lunout,*)"Sponge mode: (forcing is towards ..."
+        WRITE(lunout,*)"  over upper nsponge layers)"
+        WRITE(lunout,*)"  0: (h=hmean,u=v=0)"
+        WRITE(lunout,*)"  1: (h=hmean,u=umean,v=0)"
+        WRITE(lunout,*)"  2: (h=hmean,u=umean,v=vmean)"
+        mode_sponge=2 ! default value
+        call getin("mode_sponge",mode_sponge)
+        WRITE(lunout,*)" mode_sponge = ",mode_sponge
+
+        WRITE(lunout,*) ""
+        WRITE(lunout,*) "Sponge: characteristic time scale tetasponge"
+        WRITE(lunout,*) "(seconds) at topmost layer (time scale then "
+        WRITE(lunout,*) " doubles with decreasing layer index)."
+        tetasponge=50000.0
+        call getin("tetasponge",tetasponge)
+        WRITE(lunout,*)" tetasponge = ",tetasponge
+
+
+      WRITE(lunout,*) '-----------------------------------------------'
+      WRITE(lunout,*) ' '
+      WRITE(lunout,*) ' '
+c
+
+c       Unlike on Earth (cf LMDZ2.2) , always a regular grid on Mars :
+        ysinus = .false. !Mars Mettre a jour
+
+
+      WRITE(lunout,*) '-----------------------------------------------'
+      WRITE(lunout,*) ' '
+      WRITE(lunout,*) ' '
+cc
+      ELSE
+        write(tapeerr,*) ' WHERE IS run.def ? WE NEED IT !!!!!!!!!!!!!!'
+        stop
+      ENDIF ! of IF(ierr.eq.0)
+
+c     Test sur le zoom
+
+      if((grossismx.eq.1).and.(grossismy.eq.1)) then  
+c        Pas de zoom :
+         write(lunout,*) 'No zoom ? -> fxyhypb set to False'
+     &   ,'           (It runs better that way)'
+         fxyhypb = .false.
+      else     
+c        Avec Zoom
+         if (.not.fxyhypb) stop 'With zoom, fxyhypb should be set to T 
+     &in run.def for this version... -> STOP ! '     
+      end if
+#else
+      write(*,*) "defrun_new should not be used in parallel mode!"
+      stop
+#endif
+! of #ifndef CPP_PARA
+      END
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/exner_hyb.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/exner_hyb.F	(revision 2340)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../dyn3d/exner_hyb.F
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F	(revision 2354)
@@ -44,4 +44,5 @@
       use phys_state_var_mod, only: phys_state_var_init
       use phyetat0_mod, only: phyetat0
+      use exner_hyb_m, only: exner_hyb
       implicit none
 
@@ -136,5 +137,4 @@
       REAL :: xpn,xps,xppn(iim),xpps(iim)
       REAL :: p3d(iip1, jjp1, llm+1)
-      REAL :: beta(iip1,jjp1,llm)
 !      REAL dteta(ip1jmp1,llm)
 
@@ -1588,5 +1588,5 @@
 c-----------------------------------------------------------------------
 
-      CALL exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
+      CALL exner_hyb(ip1jmp1, ps, p3d, pks, pk, pkf)
 ! Calcul de la temperature potentielle teta
 
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F	(revision 2354)
@@ -37,4 +37,5 @@
       use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd,
      &                          east_gwstress, west_gwstress
+      use exner_hyb_m, only: exner_hyb
       implicit none
 
@@ -58,5 +59,4 @@
       REAL pk(ip1jmp1,llm)
       REAL pkf(ip1jmp1,llm)
-      REAL beta(iip1,jjp1,llm)
       REAL phis(ip1jmp1)                     ! geopotentiel au sol
       REAL masse(ip1jmp1,llm)                ! masse de l'atmosphere
@@ -291,5 +291,5 @@
 
       CALL pression(ip1jmp1, ap, bp, ps, p3d)
-      call exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
+      call exner_hyb(ip1jmp1, ps, p3d, pks, pk, pkf)
 
 c=======================================================================
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/abort_gcm.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/abort_gcm.F	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/abort_gcm.F	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/abort_gcm.F
+link ../../../../LMDZ.COMMON/libf/dyn3d/abort_gcm.F
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comconst_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comconst_mod.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comconst_mod.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/comconst_mod.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/comconst_mod.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comgeom.h
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comgeom.h	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comgeom.h	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/comgeom.h
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/comgeom.h
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comvert_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comvert_mod.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/comvert_mod.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/comvert_mod.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/comvert_mod.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/control_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/control_mod.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/control_mod.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/control_mod.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/control_mod.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/disvert.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/disvert.F	(revision 2340)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../dyn3d/disvert.F
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/disvert_noterre.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/disvert_noterre.F	(revision 2354)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/disvert_noterre.F	(revision 2354)
@@ -0,0 +1,1 @@
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/disvert_noterre.F
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/ener_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/ener_mod.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/ener_mod.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/ener_mod.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/ener_mod.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/infotrac.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/infotrac.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/infotrac.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/infotrac.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/infotrac.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/logic_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/logic_mod.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/logic_mod.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/logic_mod.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d/logic_mod.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/mod_const_mpi.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/mod_const_mpi.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/mod_const_mpi.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/mod_const_mpi.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d/mod_const_mpi.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/paramet.h
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/paramet.h	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/paramet.h	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/paramet.h
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/paramet.h
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 2354)
@@ -28,5 +28,5 @@
      &                       presnivs,pseudoalt,scaleheight
       USE vertical_layers_mod, ONLY: init_vertical_layers
-      USE logic_mod, ONLY: hybrid,autozlevs
+      USE logic_mod, ONLY: hybrid
       use regular_lonlat_mod, only: init_regular_lonlat
       use planete_mod, only: ini_planete_mod
@@ -124,4 +124,5 @@
 
 !     added by RW for autozlevs computation
+      logical autozlevs
       real nu, xx, pMIN, zlev, Htop
       real logplevs(llm)
@@ -739,5 +740,5 @@
       endif
 
-      call disvert
+      call disvert_noterre
       ! now that disvert has been called, initialize module vertical_layers_mod
       call init_vertical_layers(nlayer,preff,scaleheight,
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/serre_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/serre_mod.F90	(revision 2340)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/serre_mod.F90	(revision 2354)
@@ -1,1 +1,1 @@
-link ../../dyn3d/serre_mod.F90
+link ../../../../LMDZ.COMMON/libf/dyn3d_common/serre_mod.F90
Index: trunk/LMDZ.GENERIC/makegcm
===================================================================
--- trunk/LMDZ.GENERIC/makegcm	(revision 2340)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link makegcm_ifort
Index: trunk/LMDZ.GENERIC/makegcm_gfortran
===================================================================
--- trunk/LMDZ.GENERIC/makegcm_gfortran	(revision 2340)
+++ 	(revision )
@@ -1,849 +1,0 @@
-#!/bin/csh -f
-# $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $
-#set verbose echo
-########################################################################
-# options par defaut pour la commande make
-########################################################################
-set dim="64x48x32"
-set physique=std
-set phys="PHYS=$physique"
-set include='-I$(LIBF)/grid -I$(LIBF)/misc -I. -I$(LIBF)/dynphy_lonlat'
-set ntrac = 1
-set filtre=filtrez
-set grille=reg
-set dyntype="dyn"
-set bands="32x36"
-set scatterers="1"
-set full=""
-#src_dirs: directories containing source files 
-set src_dirs="grid misc" 
-
-########################################################################
-# path a changer contenant les sources et les objets du modele
-########################################################################
-
-#### If you want you can set environment variables here
-# default LMDGCM is where the makegcm script is:
-#setenv LMDGCM `pwd`"/"`dirname $0` # only works for relative paths
-set scriptdir=`dirname $0`
-setenv LMDGCM `readlink -f $scriptdir`
-#setenv LMDGCM "/san/home/rdword/gcm/LMDZ.GENERIC"
-setenv LIBOGCM $LMDGCM/libo
-# NetCDF, on LMD computers:
-setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_gfortran/lib
-setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_gfortran/include
-#####
-# Adapt example below to your personal machine (here "antolini"), if necessary
-if (`hostname -s` == "antolini" ) then
-  setenv NCDFLIB /home/MILLOUR/netcdf64-4.0.1_gfortran/lib
-  setenv NCDFINC /home/MILLOUR/netcdf64-4.0.1_gfortran/include
-endif
-
-setenv localdir "`pwd`"
-set MODIPSL=0
-echo $localdir | grep modipsl >& /dev/null
-if ( ! $status ) then
-  set MODIPSL=1
-  setenv LMDGCM $localdir
-  cd ../..
-  setenv LIBOGCM "`pwd`/lib"
-  cd $localdir
-  if ( `hostname` == rhodes ) then
-    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
-    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
-  else
-    if ( `hostname` == nymphea0 ) then
-      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
-      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
-    else
-      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
-    endif 
-  endif 
-else
-  if ( ! $?LMDGCM ) then
-    echo You must initialize the variable LMDGCM in your environnement
-    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
-    exit
-  endif
-  if ( ! $?LIBOGCM ) then
-    set LIBOGCM=$LMDGCM/libo
-  endif
-  if ( ! $?NCDFLIB ) then
-    echo You must initialize the variable NCDFLIB in your environnement
-    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
-    exit
-  endif
-  if ( ! $?NCDFINC ) then
-    echo You must initialize the variable NCDFINC in your environnement
-    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
-    exit
-  endif
-endif
-set model=$LMDGCM
-set libo=$LIBOGCM
-
-########################################################################
-#  Les differentes platformes reconnues
-########################################################################
-
-set HP=0
-set IBM=0
-set SUN=0
-set VPP=0
-set CRAY=0
-set DEC=0
-set LINUX=0
-set NEC=0
-set XNEC=0
-if ( `uname` == HP-UX ) then
-   set machine=HP
-   set HP=1
-else if (`uname` == UNIX_System_V ) then
-   set machine=VPP
-   set VPP=1
-else if (`uname` == SunOS ) then
-   set machine=SUN
-   set SUN=1
-else if ( `uname` == AIX ) then
-   set machine=IBM
-   set IBM=1
-else if ( `uname` == OSF1 ) then
-   set machine=ALPHA
-   set DEC=1
-else if ( `uname` == Linux ) then
-   set machine=LINUX
-   set LINUX=1
-else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
-   set machine=CRAY
-   set CRAY=1
-else if ( `uname` == SUPER-UX ) then
-   set machine=NEC
-   set NEC=1
-else if ( `hostname` == rhodes) then
-   set machine=XNEC
-   set XNEC=1
-else if ( `uname` == CYGWIN_NT-6.1-WOW64) then
-   set machine=LINUX
-   set LINUX=1
-else
-   echo Vous travaillez sur une machine non prevue par le reglement
-   exit
-endif
-
-# create $libo directory if it doesn't exist
-if ( ! -d $libo )  then
-   mkdir $libo
-endif
-
-if $VPP then
-set netcdf=netcdf_v
-else 
-set netcdf=netcdf
-endif
-########################################################################
-#  Quelques initialisations de variables du shell.
-########################################################################
-
-set dyn=
-set opt_link=""
-set adjnt=""
-set opt_dep=""
-
-set optim90=""
-set oplink=""
-
-########################################################################
-#  Optimisations par defaut suivant les machines
-########################################################################
-
-echo "Optimisations par defaut suivant les machines"
-set libf=$model/libf
-#setenv localdir "LOCAL_DIR=`pwd`"
-#setenv localdir "`pwd`"
-cd $model
-if $CRAY then
-   set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv '
-   set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf "
-   set mod_loc_dir=" "
-   set mod_suffix=" "
-else if $SUN then
-   set optim90=" -fast"
-   set optimtru90=" -fast -free"
-   set opt_link="-L$NCDFLIB -lnetcdf"
-   set mod_loc_dir=$localdir
-   set mod_suffix=mod
-else if $HP then
-else if $IBM then
-else if $VPP then
-   set optim90="$optim -X9 -w"
-   if $COUPLE then
-     set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
-     set oplink="-Wl,-t,-P,-dy "
-   else
-     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
-     set oplink="-Wl,-t,-dy "
-   endif
-   set mod_loc_dir=$IOIPSLDIR
-   set mod_suffix=mod
-else if $DEC then
-else if $LINUX then
-
-# Ehouarn 'gfortran' compiler
-   set optim="-O3 -funroll-loops "
-   set optim90="-O3 -funroll-loops "
-   set optimtru90="-O3 -funroll-loops "
-   set opt_link=" -L$NCDFLIB -lnetcdf "
-
-   #NB: on gnome -O3 ==> NaNs ...
-   #set optim=" -O2 -ip -mkl=sequential -align common "
-   #set optim90=" -O2 -ip -mkl=sequential -align common "
-   #set optimtru90=" -O2 -ip -mkl=sequential -align common "
-
-   set mod_loc_dir="./"
-   set mod_suffix=mod
-else if $NEC then
-   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
-   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
-###   set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
-   set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib  -lnetcdf_i8r8 "
-   set mod_loc_dir="."
-   set mod_suffix="mod"
-else if $XNEC then
-   set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   if $MODIPSL then
-     if $COUPLE then
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB "
-     else
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB "
-     endif
-     set mod_loc_dir="./"
-   else
-     set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
-     set mod_loc_dir="."
-   endif
-   set mod_suffix="mod"
-
-endif
-
-set nomlib=${machine}_gfortran
-
-# Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64)
-if (`uname` == Linux && `uname -m` == "x86_64") then
-  set nomlib=${machine}64_gfortran
-endif
-
-########################################################################
-# lecture des options de mymake
-########################################################################
-
-top:
-if ($#argv > 0) then
-    switch ($1:q)
-
-    case -h:
-
-########################################################################
-# Manuel en ligne
-########################################################################
-more <<eod
-
-
-makegcm [Options] prog
-
-
-The makegcm script:
--------------------
-
-1. compiles a series of subroutines located in the $LMDGCM/libf
- sub-directories.
- The objects are then stored in the libraries in $LIBOGCM.
-
-2. then, makegcm compiles program prog.f located by default in
-$LMDGCM/libf/dyn3d and makes the link with the libraries.
-
-Environment Variables '$LMDGCM' and '$LIBOGCM'
- must be set as environment variables or directly
- in the makegcm file.
-
-The makegcm command is used to control the different versions of the model
- in parallel, compiled using the compilation options 
- and the various dimensions, without having to recompile the whole model.
-
-The FORTRAN libraries are stored in directory $LIBOGCM.
-
-
-OPTIONS:
---------
-
-The following options can either be defined by default by editing the
-makegcm "script", or in interactive mode:
-
--d imxjmxlm  where im, jm, and lm are the number of longitudes,
-             latitudes and vertical layers respectively.
-
--s nscat   Number of radiatively active scatterers
-
--p PHYS    Selects the set of physical parameterizations
-           you want to compile the model with.
-           The model is then compiled using the physical
-           parameterization sources in directory:
-            $LMDGCM/libf/phyPHYS
-
--g grille  Selects the grid type.
-           This option overwrites file
-           $LMDGCM/libf/grid/fxyprim.h
-           with file
-           $LMDGCM/libf/grid/fxy_grille.h
-           the grid can take the following values:
-           1. reg - the regular grid
-           2. sin - to obtain equidistant points in terms of sin(latitude)
-           3. new - to zoom into a part of the globe
-
--O "compilation options" set of fortran compilation options to use
-
--include path
-           Used if the subroutines contain #include files (ccp) that 
-           are located in directories that are not referenced by default.
-
--adjnt     Compiles the adjoint model to the dynamical code.
-
--olddyn    To compile GCM with "old dynamics"
-
--filtre  filter
-           To select the longitudinal filter in the polar regions.
-           "filter" corresponds to the name of a directory located in
-           $LMDGCM/libf. The standard filter for the model is "filtrez"
-           which can be used for a regular grid and for a  
-           grid with longitudinal zoom.
-
--link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
-           Adds a link to FORTRAN libraries
-           libfile1.a, libfile2.a ... 
-           located in directories dir1, dir2 ...respectively
-           If dirn is a directory with an automatic path 
-           (/usr/lib ... for example) 
-           there is no need to specify  -Ldirn.
-
--full      Full (re)compilation (from scratch)
-
-eod
-exit
-
-########################################################################
-# Lecture des differentes options
-########################################################################
-
-    case -d
-        set dim=$2 ; shift ; shift ; goto top
-                        
-    case -O:
-        set optim90="$2" ; set optim="$2" ; set optimtru90="$2" ; shift ; shift ; goto top
-
-     case -p
-        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
-
-     case -s
-        set scatterers="$2" ; shift ; goto top
-
-     case -g
-        set grille="$2" ; shift ; shift ; goto top
-
-    case -b
-        set bands=$2 ; shift ; shift ; goto top
-           
-     case -t
-        set ntrac=$2 ; shift ; shift ; goto top
-
-     case -include
-        set include="$include -I$2" ; shift ; shift ; goto top
-
-     case -adjnt
-        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
-
-     case -olddyn
-        set dyntype="olddyn" ; shift; goto top
-
-     case -full
-        set full="full" ; shift ; goto top
-
-     case -filtre
-        set filtre=$2 ; shift ; shift ; goto top
-
-     case -link
-        set opt_link="$opt_link $2" ; shift ; shift ; goto top
-
-     case -debug
-        if $HP then
-           set optim90=" -g "
-        else if $SUN then
-           setenv PARALLEL 4
-           set optim90=" -g -C "
-           set optimtru90=" -g -C "
-        else if $CRAY then
-           set optim90="$optim90"" -G1 "
-        else if $LINUX then
-
-           ## for gfortran
-           set optim="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow"
-           set optim90="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow"
-           set optimtru90="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow"
-
-        else 
-           echo "pas d option debug predefinie pour cette machine"
-           exit
-        endif
-        shift ; goto top
-
-     default
-        set code="$1" ; shift ; goto top
-
-   endsw
-endif
-
-
-echo "apres les opts dim $dim"
-
-########################################################################
-# cas special sans physique
-########################################################################
-if ( "$physique" == 'nophys' ) then
-   set phys="L_PHY= LIBPHY="
-else
-   set src_dirs="$src_dirs phy_common phy$physique"
-   set include="$include "'-I$(LIBF)/phy_common  -I$(LIBF)/phy'"$physique"
-   set LIBPHY_COMMON='$(LIBO)/libphy_common.a'
-endif
-set libdyn_phy=""
-set LIBDYN_PHYS=""
-########################################################################
-#subtilites sur le nom de la librairie
-########################################################################
-
-
-\rm tmp ; touch tmp
-\rm tmp90 ; touch tmp90
-foreach i ( $optim90 )
-   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp
-end
-set suf=
-foreach i ( `sort tmp | uniq ` )
-   set suf=$suf$i
-end
-if ( ! $IBM ) then
-   set nomlib="$nomlib$suf"
-endif
-if ( $DEC ) then
-   set nomlib=DEC
-endif
-
-# dimension
-echo "dimension avant sed $dim"
-if ( $IBM ) then
-   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
-   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
-else if ( $SUN || $XNEC ) then
-   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
-   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
-else
-     set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
-     set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
-endif
-
-# bands
-echo "bands avant sed $bands"
-if ( $IBM ) then
-   set bands=`echo $bands | sed -en 's/[^0-9]/ /g'`
-   set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'`
-else if ( $SUN || $XNEC ) then
-   set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` 
-   set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
-else
-     set bands=`echo $bands | sed -e 's/[^0-9]/ /g'`
-     set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
-endif
-
-
-# build final name of libraries directory:
-if ( "$dyntype" == "olddyn" ) then
-  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn
-else
-  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}
-endif
-
-# Append number of bands to nomlib (new for universal model)
-set nomlib=${nomlib}_${bands_}
-
-# Append 'physique' type, if it is not mars, to nomlib
-if ( "$physique" != "mars" ) then
-  set nomlib=${nomlib}_${physique}
-endif
-
-## M-A-F nomlib trop long sur CRAY pour ar
-if ( $CRAY ) then
-    set nomlib=F90_${dim_}_t${ntrac}
-endif
-if ( $NEC || $XNEC ) then
-    set nomlib=F90_${dim_}_t${ntrac}
-endif
-
-echo "calcul de la dimension"
-set dimc=`echo $dim | wc -w`
-
-if ( "$dimc" == "2" ) then
-  set include="$include "'-I$(LIBF)/dyn2d '
-  set dimh=$dim
-endif
-if ( "$dimc" == "3" ) then
-  if ( "$dyntype" == "olddyn" ) then
-    set include="$include "'-I$(LIBF)/olddyn3d '
-    set src_dirs="$src_dirs olddyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
-  else
-    set include="$include "'-I$(LIBF)/dyn3d '
-    set src_dirs="$src_dirs dyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
-  endif
-  set libdyn_phy="-ldynphy_lonlat"
-  set LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.a'
-  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
-endif
-echo "dimc is $dimc"
-
-########################################################################
-# path pour les #include
-########################################################################
-
-set include="$include -I$NCDFINC "
-echo $include
-
-########################################################################
-# Gestion des dimensions du modele.
-# on cree ou remplace le fichier des dimensions/nombre de traceur
-########################################################################
-
-cd $libf/grid
-if ( -f dimensions.h ) then
-  echo "WARNING: you are already compiling the model somewhere else"
-  echo "Wait until the first compilation is finished before starting."
-  echo "If you are sure that you are not compiling elsewhere, you can"
-  echo "type [yes] to continue."
-  echo "Do you want to continue?"
-  if ( $< == "yes" ) then
-    #remove old dimensions.h , bands.h and scatterers.h files
-    \rm -f $libf/grid/dimensions.h
-    \rm -f $libf/grid/bands.h
-    \rm -f $libf/phy${physique}/bands.h
-    \rm -f $libf/phy${physique}/scatterers.h
-  else
-    exit
-  endif
-endif
-
-# Build the appropriate 'dimensions.h' file
-cd dimension
-./makdim $dim
-# echo contents of dimensions.h to standard output
-cat $libf/grid/dimensions.h
-
-# Build the appropriate 'bands.h' file
-cd $libf/phy$physique/bands
-./makbands $bands
-# echo contents of bands.h to standard output
-cat $libf/phy$physique/bands.h
-
-# Build the appropriate 'scatterers.h' file
-cd $libf/phy$physique/scatterers
-./make_scatterers $scatterers
-# echo contents of scatterers.h to standard output
-cat $libf/phy$physique/scatterers.h
-
-cd $LMDGCM
-# set path to objects directory
-set libo=$libo/$nomlib
-# create objects directory, if it doesn't exist
-if ( ! -d $libo )  then
-   mkdir $libo
-   cd $model
-endif
-
-########################################################################
-# Differentes dynamiques (3d, 2d, 1d)
-########################################################################
-
-set dimension=`echo $dim | wc -w`
-echo dimension $dimension dim $dim
-if ( $dimension == 1 ) then
-  echo "No dynamics"
-##  set dyn="L_DYN= DYN= L_FILTRE= "
-## NB: we still need to have L_DYN=libdyn3d to reach routines and module
-## objects which are located in dyn3d
-  set dyntype=""
-  set filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
-  set dyn="L_DYN= DYN= L_FILTRE= "
-  set dirmain="phy$physique/dyn1d"
-  set src_dirs="$src_dirs phy$physique/dyn1d "
-  set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d'
-endif
-endif
-
-cd $model
-if ( $dimension == 3 ) then
-  cd libf/grid
-  \rm fxyprim.h
-  cp -p fxy_${grille}.h fxyprim.h
-endif
-
-######################################################################
-# Gestion du filtre qui n'existe qu'en 3d.
-######################################################################
-
-# set filtre to 'oldfiltrez' if using -olddyn option
-if ( "$dyntype" == "olddyn" ) then
-  set filtre="oldfiltrez"
-endif
-
-if ( `expr $dimc \> 2` == 1 ) then
-   set filtre="FILTRE=$filtre"
-   if ( "$dyntype" == "olddyn" ) then
-     set src_dirs="$src_dirs oldfiltrez"
-   else
-     set src_dirs="$src_dirs filtrez"
-   endif
-else
-   set filtre="FILTRE= L_FILTRE= L_DYN= "
-endif
-echo "MACRO FILTRE $filtre"
-
-echo "dimc $dimc"
-
-#cleanup for a full recompilation, if requested
-if ("$full" == "full") then
-# remove makefile and $libo
-  cd $model
-  \rm -f makefile
-  \rm -rf $libo/*
-endif
-
-########################################################################
-#  Avant de lancer le make, on recree le makefile si necessaire
-########################################################################
-# c'est a dire dans 3 cas:
-# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
-#    derniere creation du makefile
-# 2. si le fichier contenant cette liste "liste_des_sources"
-#    n'existe pas.
-# 3. Si le makefile n'existe pas.
-########################################################################
-
-cd $model
-find libf -name '*.[Fh]' -print | sort >! tmp77
-#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
-find libf -name '*.[Fh]90' -print | sort >> tmp90
-
-if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
-     || `diff tmp90 liste_des_sources_f90 | wc -w` \
-     || ! -f makefile \
-     || ! -f liste_des_sources_f90 \
-     || ! -f liste_des_sources_f77 ) then
-        echo "les fichiers suivants ont ete crees ou detruits"
-        echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
-        diff liste_des_sources_f77 tmp77
-        diff liste_des_sources_f90 tmp90
-        \cp tmp77 liste_des_sources_f77
-        \cp tmp90 liste_des_sources_f90
-        echo "Remaking the makefile!"
-        echo "src_dirs: $src_dirs"
-        create_make_gcm $src_dirs >! tmp
-        \mv tmp makefile
-        echo "New makefile created."
-endif
-
-########################################################################
-#  Execution de la comande make
-########################################################################
-
-
-echo PHYSIQUE $phys
-echo dynamique $dyn $dimension
-echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
-echo PATH pour les fichiers INCLUDE $include
-echo OPLINK="$oplink"
-
-if $HP then
-   set f77='fort77 +OP'
-   set f90='jensaisrien'
-   set opt_link="$opt_link -lm"
-else  if $VPP then
-   set f77=frt
-   set f90=$f77
-else if $CRAY then
-   set f77=f90
-   set f90=f90
-else if $LINUX then
-# default for gfortran is that "free format" is up to 132 characters,
-# but we sometimes have more, so move that limit to 264 characters
-   set f77="gfortran -ffree-line-length-264"
-   set f90="gfortran -ffree-line-length-264"
-#   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdff -lnetcdf "
-   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf "
-else if $SUN then
-   set f77=f90
-   set f90=f90
-else if $NEC then
-   set f77=f90
-   set f90=f90
-else if $XNEC then
-   set f77=sxmpif90
-   set f90=sxmpif90
-else
-   set f77=f77
-   set f90=f90
-endif
-
-cd $model
-
-if $VPP then
-  set make="gmake RANLIB=ls"
-else if $CRAY then
-  set make="make RANLIB=ls"
-else if $NEC then
-  set make="make RANLIB=ls"
-else if $LINUX then
-  set make="make -k RANLIB=ranlib"
-else if $XNEC then
-  set make="/usr/local/bin/gmake RANLIB=ls"
-  set make="/usr/freeware/bin/gmake RANLIB=ls"
-else
-  set make="make RANLIB=ranlib"
-endif
-
-#
-# etat0_netcdf a besoin d'info de la physique
-# A revoir
-set include="$include"" -I$libf/phy$physique"
-
-
-#################################################################
-# Execution de la comande make... ENFIN!
-#################################################################
-
-if $VPP then
-  set optim90=" $optim90 -Am -M$libo"
-  set optimtru90="$optim90"
-else if $SUN then
- set optim90=" $optim90 -M$libo"
- set optimtru90=" $optimtru90 "
-else if $NEC then
- set optim90=" $optim90 -I$libo "
-else if $XNEC then
- set optim90=" $optim90 -I$libo "
- set optimtru90=" $optimtru90 -I$libo "
-else if $LINUX then
-# set optim="$optim -module $libo"
-# set optim90="$optim90 -module $libo"
-# set optimtru90="$optimtru90 -module $libo"
-# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
-# set mod_loc_dir=$libo
-
-# Ehouarn : adapt to gfortran
- set optim="$optim -I${libo}"
- set optim90="$optim90 -I${libo}"
- set optimtru90="$optimtru90 -ffree-form -I${libo}"
-
-endif
-
-set link="$f90 $optim90"
-
-set ar=ar
-
-if $XNEC then
-  set link="sxld $opt_link"
-  set link="$f90 "
-#  set ar=sxar
-endif
-
-cd $localdir
-
-set source_code=${code}.F
-# handle cases when the main program is in the physics directory
-set dirmain=dyn${dimc}d
-if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
-  set source_code=${code}.F90
-endif
-if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then
-  set dirmain=phy${physique}/dyn1d
-  set source_code=${code}.F
-endif
-if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then
-  set dirmain=phy${physique}/dyn1d
-  set source_code=${code}.F90
-endif
-if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F ) then
-  set dirmain=dynphy_lonlat/phy${physique}
-  set source_code=${code}.F
-endif
-if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F90 ) then
-  set dirmain=dynphy_lonlat/phy${physique}
-  set source_code=${code}.F90
-endif
-
-echo $make -f $LMDGCM/makefile \
-OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
-OPTIM="$optim" \
-OPTIM90="$optim90" \
-OPTIMTRU90="$optimtru90" \
-INCLUDE="$include" \
-$filtre \
-LIBO=$libo \
-$phys \
-LIBPHY_COMMON=${LIBPHY_COMMON} \
-LIBDYN_PHYS=${LIBDYN_PHYS} \
-DIM=$dimc \
-DYNTYPE="$dyntype" \
-L_DYN_PHY="$libdyn_phy" \
-L_ADJNT="$adjnt" \
-LOCAL_DIR="$localdir"  \
-F77="$f77" \
-F90="$f90" \
-OPLINK="$oplink" \
-LINK="$link" \
-GCM="$LMDGCM" \
-MOD_LOC_DIR=$mod_loc_dir \
-MOD_SUFFIX=$mod_suffix \
-AR=$ar \
-DIRMAIN=$dirmain \
-SOURCE=$source_code \
-PROG=$code
-
-
-$make -f $LMDGCM/makefile \
-OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
-OPTIM="$optim" \
-OPTIM90="$optim90" \
-OPTIMTRU90="$optimtru90" \
-INCLUDE="$include" \
-$filtre \
-LIBO=$libo \
-$phys \
-LIBPHY_COMMON=${LIBPHY_COMMON} \
-LIBDYN_PHYS=${LIBDYN_PHYS} \
-DIM=$dimc \
-DYNTYPE="$dyntype" \
-L_DYN_PHY="$libdyn_phy" \
-L_ADJNT="$adjnt" \
-LOCAL_DIR="$localdir"  \
-F77="$f77" \
-F90="$f90" \
-OPLINK="$oplink" \
-LINK="$link" \
-GCM="$LMDGCM" \
-MOD_LOC_DIR=$mod_loc_dir \
-MOD_SUFFIX=$mod_suffix \
-AR=$ar \
-DIRMAIN=$dirmain \
-SOURCE=$source_code \
-PROG=$code
-
-\rm -f $libf/grid/dimensions.h
-\rm -f $libf/grid/bands.h
-\rm -f $libf/phy$physique/bands.h
-\rm -f $libf/phy$physique/scatterers.h
Index: trunk/LMDZ.GENERIC/makegcm_ifort
===================================================================
--- trunk/LMDZ.GENERIC/makegcm_ifort	(revision 2340)
+++ 	(revision )
@@ -1,846 +1,0 @@
-#!/bin/csh -f
-# $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $
-#set verbose echo
-########################################################################
-# options par defaut pour la commande make
-########################################################################
-set dim="64x48x32"
-set physique=std
-set phys="PHYS=$physique"
-set include='-I$(LIBF)/grid -I$(LIBF)/misc -I. -I$(LIBF)/dynphy_lonlat'
-set ntrac = 1
-set filtre=filtrez
-set grille=reg
-set dyntype="dyn"
-set bands="32x36"
-set scatterers="1"
-set full=""
-#src_dirs: directories containing source files 
-set src_dirs="grid misc" 
-
-########################################################################
-# path a changer contenant les sources et les objets du modele
-########################################################################
-
-#### If you want you can set environment variables here
-# default LMDGCM is where the makegcm script is:
-#setenv LMDGCM `pwd`"/"`dirname $0` # only works for relative paths
-set scriptdir=`dirname $0`
-setenv LMDGCM `readlink -f $scriptdir`
-#setenv LMDGCM "/san/home/rdword/gcm/LMDZ.GENERIC"
-setenv LIBOGCM $LMDGCM/libo
-## NetCDF, what is below is OK on Gnome
-if ( `hostname` == n201 ) then
-    echo "GNOME cluster"
-    setenv NCDFLIB /usr/local/lib
-    setenv NCDFINC /usr/local/include
-else if ( `hostname` == ciclad1.ipsl.jussieu.fr ) then
-    echo "CICLAD cluster"
-    setenv NCDFLIB /opt/netcdf/ifort/lib
-    setenv NCDFINC /opt/netcdf/ifort/include
-else if ( `hostname` == ada337 || `hostname` == ada338 ) then
-    echo "ADA cluster"
-    setenv NCDFLIB /smplocal/pub/NetCDF/4.1.3/seq/lib
-    setenv NCDFINC /smplocal/pub/NetCDF/4.1.3/seq/include
-else
-   # NetCDF, on LMD farm:
-    echo "LMD machines"
-    setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_ifort/lib
-    setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_ifort/include
-endif
-
-setenv localdir "`pwd`"
-set MODIPSL=0
-echo $localdir | grep modipsl >& /dev/null
-if ( ! $status ) then
-  set MODIPSL=1
-  setenv LMDGCM $localdir
-  cd ../..
-  setenv LIBOGCM "`pwd`/lib"
-  cd $localdir
-  if ( `hostname` == rhodes ) then
-    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
-    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
-  else
-    if ( `hostname` == nymphea0 ) then
-      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
-      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
-    else
-      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
-    endif 
-  endif 
-else
-  if ( ! $?LMDGCM ) then
-    echo You must initialize the variable LMDGCM in your environnement
-    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
-    exit
-  endif
-  if ( ! $?LIBOGCM ) then
-    set LIBOGCM=$LMDGCM/libo
-  endif
-  if ( ! $?NCDFLIB ) then
-    echo You must initialize the variable NCDFLIB in your environnement
-    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
-    exit
-  endif
-  if ( ! $?NCDFINC ) then
-    echo You must initialize the variable NCDFINC in your environnement
-    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
-    exit
-  endif
-endif
-set model=$LMDGCM
-set libo=$LIBOGCM
-
-########################################################################
-#  Les differentes platformes reconnues
-########################################################################
-
-set HP=0
-set IBM=0
-set SUN=0
-set VPP=0
-set CRAY=0
-set DEC=0
-set LINUX=0
-set NEC=0
-set XNEC=0
-if ( `uname` == HP-UX ) then
-   set machine=HP
-   set HP=1
-else if (`uname` == UNIX_System_V ) then
-   set machine=VPP
-   set VPP=1
-else if (`uname` == SunOS ) then
-   set machine=SUN
-   set SUN=1
-else if ( `uname` == AIX ) then
-   set machine=IBM
-   set IBM=1
-else if ( `uname` == OSF1 ) then
-   set machine=ALPHA
-   set DEC=1
-else if ( `uname` == Linux ) then
-   set machine=LINUX
-   set LINUX=1
-else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
-   set machine=CRAY
-   set CRAY=1
-else if ( `uname` == SUPER-UX ) then
-   set machine=NEC
-   set NEC=1
-else if ( `hostname` == rhodes) then
-   set machine=XNEC
-   set XNEC=1
-else if ( `uname` == CYGWIN_NT-6.1-WOW64) then
-   set machine=LINUX
-   set LINUX=1
-else
-   echo Vous travaillez sur une machine non prevue par le reglement
-   exit
-endif
-
-# create $libo directory if it doesn't exist
-if ( ! -d $libo )  then
-   mkdir $libo
-endif
-
-if $VPP then
-set netcdf=netcdf_v
-else 
-set netcdf=netcdf
-endif
-########################################################################
-#  Quelques initialisations de variables du shell.
-########################################################################
-
-set dyn=
-set opt_link=""
-set adjnt=""
-set opt_dep=""
-
-set optim90=""
-set oplink=""
-
-########################################################################
-#  Optimisations par defaut suivant les machines
-########################################################################
-
-echo "Optimisations par defaut suivant les machines"
-set libf=$model/libf
-#setenv localdir "LOCAL_DIR=`pwd`"
-#setenv localdir "`pwd`"
-cd $model
-if $CRAY then
-   set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv '
-   set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf "
-   set mod_loc_dir=" "
-   set mod_suffix=" "
-else if $SUN then
-   set optim90=" -fast"
-   set optimtru90=" -fast -free"
-   set opt_link="-L$NCDFLIB -lnetcdf"
-   set mod_loc_dir=$localdir
-   set mod_suffix=mod
-else if $HP then
-else if $IBM then
-else if $VPP then
-   set optim90="$optim -X9 -w"
-   if $COUPLE then
-     set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
-     set oplink="-Wl,-t,-P,-dy "
-   else
-     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
-     set oplink="-Wl,-t,-dy "
-   endif
-   set mod_loc_dir=$IOIPSLDIR
-   set mod_suffix=mod
-else if $DEC then
-else if $LINUX then
-   #NB: on gnome -O3 ==> NaNs ...
-   set optim=" -O2 -fp-model precise -ip -mkl=sequential -align all "
-   set optim90=" -O2 -fp-model precise -ip -mkl=sequential -align all "
-   set optimtru90=" -O2 -fp-model precise -ip -mkl=sequential -align all "
-   if ( `hostname` == ciclad1.ipsl.jussieu.fr ) then
-       echo "YOU ARE ON CICLAD CLUSTER"
-       set opt_link=" -L$NCDFLIB -lnetcdf"  # this is necessary on ciclad
-   endif
-   set mod_loc_dir=$LIBOGCM
-   set mod_suffix=mod
-else if $NEC then
-   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
-   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
-###   set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
-   set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib  -lnetcdf_i8r8 "
-   set mod_loc_dir="."
-   set mod_suffix="mod"
-else if $XNEC then
-   set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   if $MODIPSL then
-     if $COUPLE then
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB "
-     else
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB "
-     endif
-     set mod_loc_dir="./"
-   else
-     set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
-     set mod_loc_dir="."
-   endif
-   set mod_suffix="mod"
-
-endif
-
-set nomlib=${machine}
-
-# Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64)
-if (`uname` == Linux && `uname -m` == "x86_64") then
-  set nomlib=${machine}64
-endif
-
-########################################################################
-# lecture des options de mymake
-########################################################################
-
-top:
-if ($#argv > 0) then
-    switch ($1:q)
-
-    case -h:
-
-########################################################################
-# Manuel en ligne
-########################################################################
-more <<eod
-
-
-makegcm [Options] prog
-
-
-The makegcm script:
--------------------
-
-1. compiles a series of subroutines located in the $LMDGCM/libf
- sub-directories.
- The objects are then stored in the libraries in $LIBOGCM.
-
-2. then, makegcm compiles program prog.f located by default in
-$LMDGCM/libf/dyn3d and makes the link with the libraries.
-
-Environment Variables '$LMDGCM' and '$LIBOGCM'
- must be set as environment variables or directly
- in the makegcm file.
-
-The makegcm command is used to control the different versions of the model
- in parallel, compiled using the compilation options 
- and the various dimensions, without having to recompile the whole model.
-
-The FORTRAN libraries are stored in directory $LIBOGCM.
-
-
-OPTIONS:
---------
-
-The following options can either be defined by default by editing the
-makegcm "script", or in interactive mode:
-
--d imxjmxlm  where im, jm, and lm are the number of longitudes,
-             latitudes and vertical layers respectively.
-
--s nscat   Number of radiatively active scatterers
-
--p PHYS    Selects the set of physical parameterizations
-           you want to compile the model with.
-           The model is then compiled using the physical
-           parameterization sources in directory:
-            $LMDGCM/libf/phyPHYS
-
--g grille  Selects the grid type.
-           This option overwrites file
-           $LMDGCM/libf/grid/fxyprim.h
-           with file
-           $LMDGCM/libf/grid/fxy_grille.h
-           the grid can take the following values:
-           1. reg - the regular grid
-           2. sin - to obtain equidistant points in terms of sin(latitude)
-           3. new - to zoom into a part of the globe
-
--O "compilation options" set of fortran compilation options to use
-
--include path
-           Used if the subroutines contain #include files (ccp) that 
-           are located in directories that are not referenced by default.
-
--adjnt     Compiles the adjoint model to the dynamical code.
-
--olddyn    To compile GCM with "old dynamics"
-
--filtre  filter
-           To select the longitudinal filter in the polar regions.
-           "filter" corresponds to the name of a directory located in
-           $LMDGCM/libf. The standard filter for the model is "filtrez"
-           which can be used for a regular grid and for a  
-           grid with longitudinal zoom.
-
--link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
-           Adds a link to FORTRAN libraries
-           libfile1.a, libfile2.a ... 
-           located in directories dir1, dir2 ...respectively
-           If dirn is a directory with an automatic path 
-           (/usr/lib ... for example) 
-           there is no need to specify  -Ldirn.
-
--full      Full (re)compilation (from scratch)
-
-eod
-exit
-
-########################################################################
-# Lecture des differentes options
-########################################################################
-
-    case -d
-        set dim=$2 ; shift ; shift ; goto top
-                        
-    case -O:
-        set optim90="$2" ; set optim="$2" ; set optimtru90="$2" ; shift ; shift ; goto top
-
-     case -p
-        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
-
-     case -s
-        set scatterers="$2" ; shift ; goto top
-
-     case -g
-        set grille="$2" ; shift ; shift ; goto top
-
-    case -b
-        set bands=$2 ; shift ; shift ; goto top
-           
-     case -t
-        set ntrac=$2 ; shift ; shift ; goto top
-
-     case -include
-        set include="$include -I$2" ; shift ; shift ; goto top
-
-     case -adjnt
-        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
-
-     case -olddyn
-        set dyntype="olddyn" ; shift; goto top
-
-     case -full
-        set full="full" ; shift ; goto top
-
-     case -filtre
-        set filtre=$2 ; shift ; shift ; goto top
-
-     case -link
-        set opt_link="$opt_link $2" ; shift ; shift ; goto top
-
-     case -debug
-        if $HP then
-           set optim90=" -g "
-        else if $SUN then
-           setenv PARALLEL 4
-           set optim90=" -g -C "
-           set optimtru90=" -g -C "
-        else if $CRAY then
-           set optim90="$optim90"" -G1 "
-        else if $LINUX then
-	   set optim=" -g -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
-           set optim90=" -g -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
-           set optimtru90=" -g -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
-        else 
-           echo "pas d option debug predefinie pour cette machine"
-           exit
-        endif
-        shift ; goto top
-
-     default
-        set code="$1" ; shift ; goto top
-
-   endsw
-endif
-
-
-echo "apres les opts dim $dim"
-
-########################################################################
-# cas special sans physique
-########################################################################
-if ( "$physique" == 'nophys' ) then
-   set phys="L_PHY= LIBPHY="
-else
-   set src_dirs="$src_dirs phy_common phy$physique"
-   set include="$include "'-I$(LIBF)/phy_common  -I$(LIBF)/phy'"$physique"
-   set LIBPHY_COMMON='$(LIBO)/libphy_common.a'
-endif
-set libdyn_phy=""
-set LIBDYN_PHYS=""
-########################################################################
-#subtilites sur le nom de la librairie
-########################################################################
-
-
-\rm tmp ; touch tmp
-\rm tmp90 ; touch tmp90
-foreach i ( $optim90 )
-   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp
-end
-set suf=
-foreach i ( `sort tmp | uniq ` )
-   set suf=$suf$i
-end
-if ( ! $IBM ) then
-   set nomlib="$nomlib$suf"
-endif
-if ( $DEC ) then
-   set nomlib=DEC
-endif
-
-# dimension
-echo "dimension avant sed $dim"
-if ( $IBM ) then
-   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
-   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
-else if ( $SUN || $XNEC ) then
-   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
-   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
-else
-     set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
-     set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
-endif
-
-# bands
-echo "bands avant sed $bands"
-if ( $IBM ) then
-   set bands=`echo $bands | sed -en 's/[^0-9]/ /g'`
-   set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'`
-else if ( $SUN || $XNEC ) then
-   set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` 
-   set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
-else
-     set bands=`echo $bands | sed -e 's/[^0-9]/ /g'`
-     set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
-endif
-
-
-# build final name of libraries directory:
-if ( "$dyntype" == "olddyn" ) then
-  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn
-else
-  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}
-endif
-
-# Append number of bands to nomlib (new for universal model)
-set nomlib=${nomlib}_${bands_}
-
-# Append 'physique' type, if it is not mars, to nomlib
-if ( "$physique" != "mars" ) then
-  set nomlib=${nomlib}_${physique}
-endif
-
-## M-A-F nomlib trop long sur CRAY pour ar
-if ( $CRAY ) then
-    set nomlib=F90_${dim_}_t${ntrac}
-endif
-if ( $NEC || $XNEC ) then
-    set nomlib=F90_${dim_}_t${ntrac}
-endif
-
-echo "calcul de la dimension"
-set dimc=`echo $dim | wc -w`
-
-if ( "$dimc" == "2" ) then
-  set include="$include "'-I$(LIBF)/dyn2d '
-  set dimh=$dim
-endif
-if ( "$dimc" == "3" ) then
-  if ( "$dyntype" == "olddyn" ) then
-    set include="$include "'-I$(LIBF)/olddyn3d '
-    set src_dirs="$src_dirs olddyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
-  else
-    set include="$include "'-I$(LIBF)/dyn3d '
-    set src_dirs="$src_dirs dyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
-  endif
-  set libdyn_phy="-ldynphy_lonlat"
-  set LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.a'
-  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
-endif
-echo "dimc is $dimc"
-
-########################################################################
-# path pour les #include
-########################################################################
-
-set include="$include -I$NCDFINC "
-echo $include
-
-########################################################################
-# Gestion des dimensions du modele.
-# on cree ou remplace le fichier des dimensions/nombre de traceur
-########################################################################
-
-cd $libf/grid
-if ( -f dimensions.h ) then
-  echo "WARNING: you are already compiling the model somewhere else"
-  echo "Wait until the first compilation is finished before starting."
-  echo "If you are sure that you are not compiling elsewhere, you can"
-  echo "type [yes] to continue."
-  echo "Do you want to continue?"
-  if ( $< == "yes" ) then
-    #remove old dimensions.h , bands.h and scatterers.h files
-    \rm -f $libf/grid/dimensions.h
-    \rm -f $libf/grid/bands.h
-    \rm -f $libf/phy${physique}/bands.h
-    \rm -f $libf/phy${physique}/scatterers.h
-  else
-    exit
-  endif
-endif
-
-# Build the appropriate 'dimensions.h' file
-cd dimension
-./makdim $dim
-# echo contents of dimensions.h to standard output
-cat $libf/grid/dimensions.h
-
-# Build the appropriate 'bands.h' file
-cd $libf/phy$physique/bands
-./makbands $bands
-# echo contents of bands.h to standard output
-cat $libf/phy$physique/bands.h
-
-# Build the appropriate 'scatterers.h' file
-cd $libf/phy$physique/scatterers
-./make_scatterers $scatterers
-# echo contents of scatterers.h to standard output
-cat $libf/phy$physique/scatterers.h
-
-cd $LMDGCM
-# set path to objects directory
-set libo=$libo/$nomlib
-# create objects directory, if it doesn't exist
-if ( ! -d $libo )  then
-   mkdir $libo
-   cd $model
-endif
-
-########################################################################
-# Differentes dynamiques (3d, 2d, 1d)
-########################################################################
-
-set dimension=`echo $dim | wc -w`
-echo dimension $dimension dim $dim
-if ( $dimension == 1 ) then
-  echo "No dynamics"
-##  set dyn="L_DYN= DYN= L_FILTRE= "
-## NB: we still need to have L_DYN=libdyn3d to reach routines and module
-## objects which are located in dyn3d
-  set dyntype=""
-  set filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
-  set dyn="L_DYN= DYN= L_FILTRE= "
-  set dirmain="phy$physique/dyn1d"
-  set src_dirs="$src_dirs phy$physique/dyn1d "
-  set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d'
-endif
-endif
-
-cd $model
-if ( $dimension == 3 ) then
-  cd libf/grid
-  \rm fxyprim.h
-  cp -p fxy_${grille}.h fxyprim.h
-endif
-
-######################################################################
-# Gestion du filtre qui n'existe qu'en 3d.
-######################################################################
-
-# set filtre to 'oldfiltrez' if using -olddyn option
-if ( "$dyntype" == "olddyn" ) then
-  set filtre="oldfiltrez"
-endif
-
-if ( `expr $dimc \> 2` == 1 ) then
-   set filtre="FILTRE=$filtre"
-   if ( "$dyntype" == "olddyn" ) then
-     set src_dirs="$src_dirs oldfiltrez"
-   else
-     set src_dirs="$src_dirs filtrez"
-   endif
-else
-   set filtre="FILTRE= L_FILTRE= L_DYN= "
-endif
-echo "MACRO FILTRE $filtre"
-
-echo "dimc $dimc"
-
-#cleanup for a full recompilation, if requested
-if ("$full" == "full") then
-# remove makefile and $libo
-  cd $model
-  \rm -f makefile
-  \rm -rf $libo/*
-endif
-
-########################################################################
-#  Avant de lancer le make, on recree le makefile si necessaire
-########################################################################
-# c'est a dire dans 3 cas:
-# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
-#    derniere creation du makefile
-# 2. si le fichier contenant cette liste "liste_des_sources"
-#    n'existe pas.
-# 3. Si le makefile n'existe pas.
-########################################################################
-
-cd $model
-find libf -name '*.[Fh]' -print | sort >! tmp77
-#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
-find libf -name '*.[Fh]90' -print | sort >> tmp90
-
-if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
-     || `diff tmp90 liste_des_sources_f90 | wc -w` \
-     || ! -f makefile \
-     || ! -f liste_des_sources_f90 \
-     || ! -f liste_des_sources_f77 ) then
-        echo "les fichiers suivants ont ete crees ou detruits"
-        echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
-        diff liste_des_sources_f77 tmp77
-        diff liste_des_sources_f90 tmp90
-        \cp tmp77 liste_des_sources_f77
-        \cp tmp90 liste_des_sources_f90
-        echo "Remaking the makefile!"
-        echo "src_dirs: $src_dirs"
-        ./create_make_gcm $src_dirs >! tmp
-        \mv tmp makefile
-        echo "New makefile created."
-endif
-
-########################################################################
-#  Execution de la comande make
-########################################################################
-
-
-echo PHYSIQUE $phys
-echo dynamique $dyn $dimension
-echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
-echo PATH pour les fichiers INCLUDE $include
-echo OPLINK="$oplink"
-
-if $HP then
-   set f77='fort77 +OP'
-   set f90='jensaisrien'
-   set opt_link="$opt_link -lm"
-else  if $VPP then
-   set f77=frt
-   set f90=$f77
-else if $CRAY then
-   set f77=f90
-   set f90=f90
-else if $LINUX then
-   set f77=ifort
-   set f90=ifort
-#### uncomment for double precision
-#   set f77="ifort -real-size 64 -DNC_DOUBLE"
-#   set f90="ifort -real-size 64 -DNC_DOUBLE"
-   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf "
-else if $SUN then
-   set f77=f90
-   set f90=f90
-else if $NEC then
-   set f77=f90
-   set f90=f90
-else if $XNEC then
-   set f77=sxmpif90
-   set f90=sxmpif90
-else
-   set f77=f77
-   set f90=f90
-endif
-
-cd $model
-
-if $VPP then
-  set make="gmake RANLIB=ls"
-else if $CRAY then
-  set make="make RANLIB=ls"
-else if $NEC then
-  set make="make RANLIB=ls"
-else if $LINUX then
-  set make="make -k RANLIB=ranlib"
-else if $XNEC then
-  set make="/usr/local/bin/gmake RANLIB=ls"
-  set make="/usr/freeware/bin/gmake RANLIB=ls"
-else
-  set make="make RANLIB=ranlib"
-endif
-
-#
-# etat0_netcdf a besoin d'info de la physique
-# A revoir
-set include="$include"" -I$libf/phy$physique"
-
-
-#################################################################
-# Execution de la comande make... ENFIN!
-#################################################################
-
-if $VPP then
-  set optim90=" $optim90 -Am -M$libo"
-  set optimtru90="$optim90"
-else if $SUN then
- set optim90=" $optim90 -M$libo"
- set optimtru90=" $optimtru90 "
-else if $NEC then
- set optim90=" $optim90 -I$libo "
-else if $XNEC then
- set optim90=" $optim90 -I$libo "
- set optimtru90=" $optimtru90 -I$libo "
-else if $LINUX then
- set optim="$optim -module $libo"
- set optim90="$optim90 -module $libo"
- set optimtru90="$optimtru90 -module $libo"
-# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
-# set mod_loc_dir=$libo
-endif
-
-set link="$f90 $optim90"
-
-set ar=ar
-
-if $XNEC then
-  set link="sxld $opt_link"
-  set link="$f90 "
-#  set ar=sxar
-endif
-
-cd $localdir
-
-set source_code=${code}.F
-# handle cases when the main program is in the physics directory
-set dirmain=dyn${dimc}d
-if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
-  set source_code=${code}.F90
-endif
-if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then
-  set dirmain=phy${physique}/dyn1d
-  set source_code=${code}.F
-endif
-if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then
-  set dirmain=phy${physique}/dyn1d
-  set source_code=${code}.F90
-endif
-if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F ) then
-  set dirmain=dynphy_lonlat/phy${physique}
-  set source_code=${code}.F
-endif
-if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F90 ) then
-  set dirmain=dynphy_lonlat/phy${physique}
-  set source_code=${code}.F90
-endif
-
-echo $make -f $LMDGCM/makefile \
-OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
-OPTIM="$optim" \
-OPTIM90="$optim90" \
-OPTIMTRU90="$optimtru90" \
-INCLUDE="$include" \
-$filtre \
-LIBO=$libo \
-$phys \
-LIBPHY_COMMON=${LIBPHY_COMMON} \
-LIBDYN_PHYS=${LIBDYN_PHYS} \
-DIM=$dimc \
-DYNTYPE="$dyntype" \
-L_DYN_PHY="$libdyn_phy" \
-L_ADJNT="$adjnt" \
-LOCAL_DIR="$localdir"  \
-F77="$f77" \
-F90="$f90" \
-OPLINK="$oplink" \
-LINK="$link" \
-GCM="$LMDGCM" \
-MOD_LOC_DIR=$mod_loc_dir \
-MOD_SUFFIX=$mod_suffix \
-AR=$ar \
-DIRMAIN=$dirmain \
-SOURCE=$source_code \
-PROG=$code
-
-
-$make -f $LMDGCM/makefile \
-OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
-OPTIM="$optim" \
-OPTIM90="$optim90" \
-OPTIMTRU90="$optimtru90" \
-INCLUDE="$include" \
-$filtre \
-LIBO=$libo \
-$phys \
-LIBPHY_COMMON=${LIBPHY_COMMON} \
-LIBDYN_PHYS=${LIBDYN_PHYS} \
-DIM=$dimc \
-DYNTYPE="$dyntype" \
-L_DYN_PHY="$libdyn_phy" \
-L_ADJNT="$adjnt" \
-LOCAL_DIR="$localdir"  \
-F77="$f77" \
-F90="$f90" \
-OPLINK="$oplink" \
-LINK="$link" \
-GCM="$LMDGCM" \
-MOD_LOC_DIR=$mod_loc_dir \
-MOD_SUFFIX=$mod_suffix \
-AR=$ar \
-DIRMAIN=$dirmain \
-SOURCE=$source_code \
-PROG=$code
-
-\rm -f $libf/grid/dimensions.h
-\rm -f $libf/grid/bands.h
-\rm -f $libf/phy$physique/bands.h
-\rm -f $libf/phy$physique/scatterers.h
Index: trunk/LMDZ.GENERIC/makegcm_pgf90
===================================================================
--- trunk/LMDZ.GENERIC/makegcm_pgf90	(revision 2340)
+++ 	(revision )
@@ -1,844 +1,0 @@
-#!/bin/csh -f
-# $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $
-#set verbose echo
-########################################################################
-# options par defaut pour la commande make
-########################################################################
-set dim="64x48x32"
-set physique=std
-set phys="PHYS=$physique"
-set include='-I$(LIBF)/grid -I$(LIBF)/misc -I. -I$(LIBF)/dynphy_lonlat'
-set ntrac = 1
-set filtre=filtrez
-set grille=reg
-set dyntype="dyn"
-set bands="32x36"
-set scatterers="1"
-set full=""
-#src_dirs: directories containing source files 
-set src_dirs="grid misc" 
-
-########################################################################
-# path a changer contenant les sources et les objets du modele
-########################################################################
-
-#### If you want you can set environment variables here
-# default LMDGCM is where the makegcm script is:
-#setenv LMDGCM `pwd`"/"`dirname $0` # only works for relative paths
-set scriptdir=`dirname $0`
-setenv LMDGCM `readlink -f $scriptdir`
-#setenv LMDGCM "/san/home/rdword/gcm/LMDZ.GENERIC"
-setenv LIBOGCM $LMDGCM/libo
-# NetCDF, on LMD computers:
-setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_pgi/lib
-setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_pgi/include
-####
-# Adapt example below to your personal machine (here "antolini"), if necessary
-if (`hostname -s` == "antolini" ) then
-  setenv NCDFLIB /home/MILLOUR/netcdf64-4.0.1_pgi/lib
-  setenv NCDFINC /home/MILLOUR/netcdf64-4.0.1_pgi/include
-endif
-
-setenv localdir "`pwd`"
-set MODIPSL=0
-echo $localdir | grep modipsl >& /dev/null
-if ( ! $status ) then
-  set MODIPSL=1
-  setenv LMDGCM $localdir
-  cd ../..
-  setenv LIBOGCM "`pwd`/lib"
-  cd $localdir
-  if ( `hostname` == rhodes ) then
-    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
-    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
-  else
-    if ( `hostname` == nymphea0 ) then
-      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
-      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
-    else
-      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
-    endif 
-  endif 
-else
-  if ( ! $?LMDGCM ) then
-    echo You must initialize the variable LMDGCM in your environnement
-    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
-    exit
-  endif
-  if ( ! $?LIBOGCM ) then
-    set LIBOGCM=$LMDGCM/libo
-  endif
-  if ( ! $?NCDFLIB ) then
-    echo You must initialize the variable NCDFLIB in your environnement
-    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
-    exit
-  endif
-  if ( ! $?NCDFINC ) then
-    echo You must initialize the variable NCDFINC in your environnement
-    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
-    exit
-  endif
-endif
-set model=$LMDGCM
-set libo=$LIBOGCM
-
-########################################################################
-#  Les differentes platformes reconnues
-########################################################################
-
-set HP=0
-set IBM=0
-set SUN=0
-set VPP=0
-set CRAY=0
-set DEC=0
-set LINUX=0
-set NEC=0
-set XNEC=0
-if ( `uname` == HP-UX ) then
-   set machine=HP
-   set HP=1
-else if (`uname` == UNIX_System_V ) then
-   set machine=VPP
-   set VPP=1
-else if (`uname` == SunOS ) then
-   set machine=SUN
-   set SUN=1
-else if ( `uname` == AIX ) then
-   set machine=IBM
-   set IBM=1
-else if ( `uname` == OSF1 ) then
-   set machine=ALPHA
-   set DEC=1
-else if ( `uname` == Linux ) then
-   set machine=LINUX
-   set LINUX=1
-else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
-   set machine=CRAY
-   set CRAY=1
-else if ( `uname` == SUPER-UX ) then
-   set machine=NEC
-   set NEC=1
-else if ( `hostname` == rhodes) then
-   set machine=XNEC
-   set XNEC=1
-else if ( `uname` == CYGWIN_NT-6.1-WOW64) then
-   set machine=LINUX
-   set LINUX=1
-else
-   echo Vous travaillez sur une machine non prevue par le reglement
-   exit
-endif
-
-# create $libo directory if it doesn't exist
-if ( ! -d $libo )  then
-   mkdir $libo
-endif
-
-if $VPP then
-set netcdf=netcdf_v
-else 
-set netcdf=netcdf
-endif
-########################################################################
-#  Quelques initialisations de variables du shell.
-########################################################################
-
-set dyn=
-set opt_link=""
-set adjnt=""
-set opt_dep=""
-
-set optim90=""
-set oplink=""
-
-########################################################################
-#  Optimisations par defaut suivant les machines
-########################################################################
-
-echo "Optimisations par defaut suivant les machines"
-set libf=$model/libf
-#setenv localdir "LOCAL_DIR=`pwd`"
-#setenv localdir "`pwd`"
-cd $model
-if $CRAY then
-   set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv '
-   set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf "
-   set mod_loc_dir=" "
-   set mod_suffix=" "
-else if $SUN then
-   set optim90=" -fast"
-   set optimtru90=" -fast -free"
-   set opt_link="-L$NCDFLIB -lnetcdf"
-   set mod_loc_dir=$localdir
-   set mod_suffix=mod
-else if $HP then
-else if $IBM then
-else if $VPP then
-   set optim90="$optim -X9 -w"
-   if $COUPLE then
-     set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
-     set oplink="-Wl,-t,-P,-dy "
-   else
-     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
-     set oplink="-Wl,-t,-dy "
-   endif
-   set mod_loc_dir=$IOIPSLDIR
-   set mod_suffix=mod
-else if $DEC then
-else if $LINUX then
-   set optim=" -O2 -Munroll -Mcache_align "
-   set optim90=" -O2 -Munroll -Mcache_align "
-   set optimtru90=" -O2 -Munroll -Mcache_align "
-   set opt_link=" -L$NCDFLIB -lnetcdf"
-   set mod_loc_dir=$localdir
-   set mod_suffix=mod
-# Ehouarn 'ifort' compiler
-#   #NB: on gnome -O3 ==> NaNs ...
-#   set optim=" -O2 -ip -mkl=sequential -align common "
-#   set optim90=" -O2 -ip -mkl=sequential -align common "
-#   set optimtru90=" -O2 -ip -mkl=sequential -align common "
-#   set mod_loc_dir=$LIBOGCM
-#   set mod_suffix=mod
-else if $NEC then
-   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
-   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
-###   set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
-   set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib  -lnetcdf_i8r8 "
-   set mod_loc_dir="."
-   set mod_suffix="mod"
-else if $XNEC then
-   set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   if $MODIPSL then
-     if $COUPLE then
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB "
-     else
-       set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB "
-     endif
-     set mod_loc_dir="./"
-   else
-     set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
-     set mod_loc_dir="."
-   endif
-   set mod_suffix="mod"
-
-endif
-
-set nomlib=${machine}
-
-# Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64)
-if (`uname` == Linux && `uname -m` == "x86_64") then
-  set nomlib=${machine}64
-endif
-
-########################################################################
-# lecture des options de mymake
-########################################################################
-
-top:
-if ($#argv > 0) then
-    switch ($1:q)
-
-    case -h:
-
-########################################################################
-# Manuel en ligne
-########################################################################
-more <<eod
-
-
-makegcm [Options] prog
-
-
-The makegcm script:
--------------------
-
-1. compiles a series of subroutines located in the $LMDGCM/libf
- sub-directories.
- The objects are then stored in the libraries in $LIBOGCM.
-
-2. then, makegcm compiles program prog.f located by default in
-$LMDGCM/libf/dyn3d and makes the link with the libraries.
-
-Environment Variables '$LMDGCM' and '$LIBOGCM'
- must be set as environment variables or directly
- in the makegcm file.
-
-The makegcm command is used to control the different versions of the model
- in parallel, compiled using the compilation options 
- and the various dimensions, without having to recompile the whole model.
-
-The FORTRAN libraries are stored in directory $LIBOGCM.
-
-
-OPTIONS:
---------
-
-The following options can either be defined by default by editing the
-makegcm "script", or in interactive mode:
-
--d imxjmxlm  where im, jm, and lm are the number of longitudes,
-             latitudes and vertical layers respectively.
-
--s nscat   Number of radiatively active scatterers
-
--p PHYS    Selects the set of physical parameterizations
-           you want to compile the model with.
-           The model is then compiled using the physical
-           parameterization sources in directory:
-            $LMDGCM/libf/phyPHYS
-
--g grille  Selects the grid type.
-           This option overwrites file
-           $LMDGCM/libf/grid/fxyprim.h
-           with file
-           $LMDGCM/libf/grid/fxy_grille.h
-           the grid can take the following values:
-           1. reg - the regular grid
-           2. sin - to obtain equidistant points in terms of sin(latitude)
-           3. new - to zoom into a part of the globe
-
--O "compilation options" set of fortran compilation options to use
-
--include path
-           Used if the subroutines contain #include files (ccp) that 
-           are located in directories that are not referenced by default.
-
--adjnt     Compiles the adjoint model to the dynamical code.
-
--olddyn    To compile GCM with "old dynamics"
-
--filtre  filter
-           To select the longitudinal filter in the polar regions.
-           "filter" corresponds to the name of a directory located in
-           $LMDGCM/libf. The standard filter for the model is "filtrez"
-           which can be used for a regular grid and for a  
-           grid with longitudinal zoom.
-
--link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
-           Adds a link to FORTRAN libraries
-           libfile1.a, libfile2.a ... 
-           located in directories dir1, dir2 ...respectively
-           If dirn is a directory with an automatic path 
-           (/usr/lib ... for example) 
-           there is no need to specify  -Ldirn.
-
--full      Full (re)compilation (from scratch)
-
-eod
-exit
-
-########################################################################
-# Lecture des differentes options
-########################################################################
-
-    case -d
-        set dim=$2 ; shift ; shift ; goto top
-                        
-    case -O:
-        set optim90="$2" ; set optim="$2" ; set optimtru90="$2" ; shift ; shift ; goto top
-
-     case -p
-        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
-
-     case -s
-        set scatterers="$2" ; shift ; goto top
-
-     case -g
-        set grille="$2" ; shift ; shift ; goto top
-
-    case -b
-        set bands=$2 ; shift ; shift ; goto top
-           
-     case -t
-        set ntrac=$2 ; shift ; shift ; goto top
-
-     case -include
-        set include="$include -I$2" ; shift ; shift ; goto top
-
-     case -adjnt
-        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
-
-     case -olddyn
-        set dyntype="olddyn" ; shift; goto top
-
-     case -full
-        set full="full" ; shift ; goto top
-
-     case -filtre
-        set filtre=$2 ; shift ; shift ; goto top
-
-     case -link
-        set opt_link="$opt_link $2" ; shift ; shift ; goto top
-
-     case -debug
-        if $HP then
-           set optim90=" -g "
-        else if $SUN then
-           setenv PARALLEL 4
-           set optim90=" -g -C "
-           set optimtru90=" -g -C "
-        else if $CRAY then
-           set optim90="$optim90"" -G1 "
-        else if $LINUX then
-           set optim="-g -Mbounds -Kieee -Ktrap=fp -traceback"
-           set optim90="-g -Mbounds -Kieee -Ktrap=fp -traceback"
-           set optimtru90="-g -Mbounds -Kieee -Ktrap=fp -traceback"
-#	   set optim=" -g -no-ftz -traceback -ftrapuv -fp-stack-check "
-#           set optim90=" -g -no-ftz -traceback -ftrapuv -fp-stack-check "
-#           set optimtru90=" -g -no-ftz -traceback -ftrapuv -fp-stack-check "
-        else 
-           echo "pas d option debug predefinie pour cette machine"
-           exit
-        endif
-        shift ; goto top
-
-     default
-        set code="$1" ; shift ; goto top
-
-   endsw
-endif
-
-
-echo "apres les opts dim $dim"
-
-########################################################################
-# cas special sans physique
-########################################################################
-if ( "$physique" == 'nophys' ) then
-   set phys="L_PHY= LIBPHY="
-else
-   set src_dirs="$src_dirs phy_common phy$physique"
-   set include="$include "'-I$(LIBF)/phy_common  -I$(LIBF)/phy'"$physique"
-   set LIBPHY_COMMON='$(LIBO)/libphy_common.a'
-endif
-set libdyn_phy=""
-set LIBDYN_PHYS=""
-########################################################################
-#subtilites sur le nom de la librairie
-########################################################################
-
-
-\rm tmp ; touch tmp
-\rm tmp90 ; touch tmp90
-foreach i ( $optim90 )
-   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp
-end
-set suf=
-foreach i ( `sort tmp | uniq ` )
-   set suf=$suf$i
-end
-if ( ! $IBM ) then
-   set nomlib="$nomlib$suf"
-endif
-if ( $DEC ) then
-   set nomlib=DEC
-endif
-
-# dimension
-echo "dimension avant sed $dim"
-if ( $IBM ) then
-   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
-   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
-else if ( $SUN || $XNEC ) then
-   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
-   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
-else
-     set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
-     set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
-endif
-
-# bands
-echo "bands avant sed $bands"
-if ( $IBM ) then
-   set bands=`echo $bands | sed -en 's/[^0-9]/ /g'`
-   set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'`
-else if ( $SUN || $XNEC ) then
-   set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` 
-   set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
-else
-     set bands=`echo $bands | sed -e 's/[^0-9]/ /g'`
-     set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
-endif
-
-
-# build final name of libraries directory:
-if ( "$dyntype" == "olddyn" ) then
-  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn
-else
-  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}
-endif
-
-# Append number of bands to nomlib (new for universal model)
-set nomlib=${nomlib}_${bands_}
-
-# Append 'physique' type, if it is not mars, to nomlib
-if ( "$physique" != "mars" ) then
-  set nomlib=${nomlib}_${physique}
-endif
-
-## M-A-F nomlib trop long sur CRAY pour ar
-if ( $CRAY ) then
-    set nomlib=F90_${dim_}_t${ntrac}
-endif
-if ( $NEC || $XNEC ) then
-    set nomlib=F90_${dim_}_t${ntrac}
-endif
-
-echo "calcul de la dimension"
-set dimc=`echo $dim | wc -w`
-
-if ( "$dimc" == "2" ) then
-  set include="$include "'-I$(LIBF)/dyn2d '
-  set dimh=$dim
-endif
-if ( "$dimc" == "3" ) then
-  if ( "$dyntype" == "olddyn" ) then
-    set include="$include "'-I$(LIBF)/olddyn3d '
-    set src_dirs="$src_dirs olddyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
-  else
-    set include="$include "'-I$(LIBF)/dyn3d '
-    set src_dirs="$src_dirs dyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
-  endif
-  set libdyn_phy="-ldynphy_lonlat"
-  set LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.a'
-  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
-endif
-echo "dimc is $dimc"
-
-########################################################################
-# path pour les #include
-########################################################################
-
-set include="$include -I$NCDFINC "
-echo $include
-
-########################################################################
-# Gestion des dimensions du modele.
-# on cree ou remplace le fichier des dimensions/nombre de traceur
-########################################################################
-
-cd $libf/grid
-if ( -f dimensions.h ) then
-  echo "WARNING: you are already compiling the model somewhere else"
-  echo "Wait until the first compilation is finished before starting."
-  echo "If you are sure that you are not compiling elsewhere, you can"
-  echo "type [yes] to continue."
-  echo "Do you want to continue?"
-  if ( $< == "yes" ) then
-    #remove old dimensions.h , bands.h and scatterers.h files
-    \rm -f $libf/grid/dimensions.h
-    \rm -f $libf/grid/bands.h
-    \rm -f $libf/phy${physique}/bands.h
-    \rm -f $libf/phy${physique}/scatterers.h
-  else
-    exit
-  endif
-endif
-
-# Build the appropriate 'dimensions.h' file
-cd dimension
-./makdim $dim
-# echo contents of dimensions.h to standard output
-cat $libf/grid/dimensions.h
-
-# Build the appropriate 'bands.h' file
-cd $libf/phy$physique/bands
-./makbands $bands
-# echo contents of bands.h to standard output
-cat $libf/phy$physique/bands.h
-
-# Build the appropriate 'scatterers.h' file
-cd $libf/phy$physique/scatterers
-./make_scatterers $scatterers
-# echo contents of scatterers.h to standard output
-cat $libf/phy$physique/scatterers.h
-
-cd $LMDGCM
-# set path to objects directory
-set libo=$libo/$nomlib
-# create objects directory, if it doesn't exist
-if ( ! -d $libo )  then
-   mkdir $libo
-   cd $model
-endif
-
-########################################################################
-# Differentes dynamiques (3d, 2d, 1d)
-########################################################################
-
-set dimension=`echo $dim | wc -w`
-echo dimension $dimension dim $dim
-if ( $dimension == 1 ) then
-  echo "No dynamics"
-##  set dyn="L_DYN= DYN= L_FILTRE= "
-## NB: we still need to have L_DYN=libdyn3d to reach routines and module
-## objects which are located in dyn3d
-  set dyntype=""
-  set filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
-  set dyn="L_DYN= DYN= L_FILTRE= "
-  set dirmain="phy$physique/dyn1d"
-  set src_dirs="$src_dirs phy$physique/dyn1d "
-  set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d'
-endif
-endif
-
-cd $model
-if ( $dimension == 3 ) then
-  cd libf/grid
-  \rm fxyprim.h
-  cp -p fxy_${grille}.h fxyprim.h
-endif
-
-######################################################################
-# Gestion du filtre qui n'existe qu'en 3d.
-######################################################################
-
-# set filtre to 'oldfiltrez' if using -olddyn option
-if ( "$dyntype" == "olddyn" ) then
-  set filtre="oldfiltrez"
-endif
-
-if ( `expr $dimc \> 2` == 1 ) then
-   set filtre="FILTRE=$filtre"
-   if ( "$dyntype" == "olddyn" ) then
-     set src_dirs="$src_dirs oldfiltrez"
-   else
-     set src_dirs="$src_dirs filtrez"
-   endif
-else
-   set filtre="FILTRE= L_FILTRE= L_DYN= "
-endif
-echo "MACRO FILTRE $filtre"
-
-echo "dimc $dimc"
-
-#cleanup for a full recompilation, if requested
-if ("$full" == "full") then
-# remove makefile and $libo
-  cd $model
-  \rm -f makefile
-  \rm -rf $libo/*
-endif
-
-########################################################################
-#  Avant de lancer le make, on recree le makefile si necessaire
-########################################################################
-# c'est a dire dans 3 cas:
-# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
-#    derniere creation du makefile
-# 2. si le fichier contenant cette liste "liste_des_sources"
-#    n'existe pas.
-# 3. Si le makefile n'existe pas.
-########################################################################
-
-cd $model
-find libf -name '*.[Fh]' -print | sort >! tmp77
-#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
-find libf -name '*.[Fh]90' -print | sort >> tmp90
-
-if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
-     || `diff tmp90 liste_des_sources_f90 | wc -w` \
-     || ! -f makefile \
-     || ! -f liste_des_sources_f90 \
-     || ! -f liste_des_sources_f77 ) then
-        echo "les fichiers suivants ont ete crees ou detruits"
-        echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
-        diff liste_des_sources_f77 tmp77
-        diff liste_des_sources_f90 tmp90
-        \cp tmp77 liste_des_sources_f77
-        \cp tmp90 liste_des_sources_f90
-        echo "Remaking the makefile!"
-        echo "src_dirs: $src_dirs"
-        create_make_gcm $src_dirs >! tmp
-        \mv tmp makefile
-        echo "New makefile created."
-endif
-
-########################################################################
-#  Execution de la comande make
-########################################################################
-
-
-echo PHYSIQUE $phys
-echo dynamique $dyn $dimension
-echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
-echo PATH pour les fichiers INCLUDE $include
-echo OPLINK="$oplink"
-
-if $HP then
-   set f77='fort77 +OP'
-   set f90='jensaisrien'
-   set opt_link="$opt_link -lm"
-else  if $VPP then
-   set f77=frt
-   set f90=$f77
-else if $CRAY then
-   set f77=f90
-   set f90=f90
-else if $LINUX then
-#   set f77=ifort
-#   set f90=ifort
-#   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf "
-   set f77=pgf90
-   set f90=pgf90
-else if $SUN then
-   set f77=f90
-   set f90=f90
-else if $NEC then
-   set f77=f90
-   set f90=f90
-else if $XNEC then
-   set f77=sxmpif90
-   set f90=sxmpif90
-else
-   set f77=f77
-   set f90=f90
-endif
-
-cd $model
-
-if $VPP then
-  set make="gmake RANLIB=ls"
-else if $CRAY then
-  set make="make RANLIB=ls"
-else if $NEC then
-  set make="make RANLIB=ls"
-else if $LINUX then
-  set make="make -k RANLIB=ranlib"
-else if $XNEC then
-  set make="/usr/local/bin/gmake RANLIB=ls"
-  set make="/usr/freeware/bin/gmake RANLIB=ls"
-else
-  set make="make RANLIB=ranlib"
-endif
-
-#
-# etat0_netcdf a besoin d'info de la physique
-# A revoir
-set include="$include"" -I$libf/phy$physique"
-
-
-#################################################################
-# Execution de la comande make... ENFIN!
-#################################################################
-
-if $VPP then
-  set optim90=" $optim90 -Am -M$libo"
-  set optimtru90="$optim90"
-else if $SUN then
- set optim90=" $optim90 -M$libo"
- set optimtru90=" $optimtru90 "
-else if $NEC then
- set optim90=" $optim90 -I$libo "
-else if $XNEC then
- set optim90=" $optim90 -I$libo "
- set optimtru90=" $optimtru90 -I$libo "
-else if $LINUX then
-# set optim="$optim -I${libo}"
-# set optim90="$optim90 -I${libo}"
-# set optimtru90="$optimtru90 -ffree-form -I${libo}"
- set optim="$optim -module $libo"
- set optim90="$optim90 -module $libo"
- set optimtru90="$optimtru90 -module $libo"
-# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
-# set mod_loc_dir=$libo
-endif
-
-set link="$f90 $optim90"
-
-set ar=ar
-
-if $XNEC then
-  set link="sxld $opt_link"
-  set link="$f90 "
-#  set ar=sxar
-endif
-
-cd $localdir
-
-set source_code=${code}.F
-# handle cases when the main program is in the physics directory
-set dirmain=dyn${dimc}d
-if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
-  set source_code=${code}.F90
-endif
-if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then
-  set dirmain=phy${physique}/dyn1d
-  set source_code=${code}.F
-endif
-if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then
-  set dirmain=phy${physique}/dyn1d
-  set source_code=${code}.F90
-endif
-if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F ) then
-  set dirmain=dynphy_lonlat/phy${physique}
-  set source_code=${code}.F
-endif
-if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F90 ) then
-  set dirmain=dynphy_lonlat/phy${physique}
-  set source_code=${code}.F90
-endif
-
-echo $make -f $LMDGCM/makefile \
-OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
-OPTIM="$optim" \
-OPTIM90="$optim90" \
-OPTIMTRU90="$optimtru90" \
-INCLUDE="$include" \
-$filtre \
-LIBO=$libo \
-$phys \
-LIBPHY_COMMON=${LIBPHY_COMMON} \
-LIBDYN_PHYS=${LIBDYN_PHYS} \
-DIM=$dimc \
-DYNTYPE="$dyntype" \
-L_DYN_PHY="$libdyn_phy" \
-L_ADJNT="$adjnt" \
-LOCAL_DIR="$localdir"  \
-F77="$f77" \
-F90="$f90" \
-OPLINK="$oplink" \
-LINK="$link" \
-GCM="$LMDGCM" \
-MOD_LOC_DIR=$mod_loc_dir \
-MOD_SUFFIX=$mod_suffix \
-AR=$ar \
-DIRMAIN=$dirmain \
-SOURCE=$source_code \
-PROG=$code
-
-
-$make -f $LMDGCM/makefile \
-OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
-OPTIM="$optim" \
-OPTIM90="$optim90" \
-OPTIMTRU90="$optimtru90" \
-INCLUDE="$include" \
-$filtre \
-LIBO=$libo \
-$phys \
-LIBPHY_COMMON=${LIBPHY_COMMON} \
-LIBDYN_PHYS=${LIBDYN_PHYS} \
-DIM=$dimc \
-DYNTYPE="$dyntype" \
-L_DYN_PHY="$libdyn_phy" \
-L_ADJNT="$adjnt" \
-LOCAL_DIR="$localdir"  \
-F77="$f77" \
-F90="$f90" \
-OPLINK="$oplink" \
-LINK="$link" \
-GCM="$LMDGCM" \
-MOD_LOC_DIR=$mod_loc_dir \
-MOD_SUFFIX=$mod_suffix \
-AR=$ar \
-DIRMAIN=$dirmain \
-SOURCE=$source_code \
-PROG=$code
-
-\rm -f $libf/grid/dimensions.h
-\rm -f $libf/grid/bands.h
-\rm -f $libf/phy$physique/bands.h
-\rm -f $libf/phy$physique/scatterers.h
