Index: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/conf_gcm.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3dmem/conf_gcm.F90	(revision 5185)
+++ 	(revision )
@@ -1,1026 +1,0 @@
-
-! $Id$
-
-SUBROUTINE conf_gcm( tapedef, etatinit )
-
-  USE control_mod
-  USE IOIPSL
-  USE misc_mod
-  USE lmdz_filtre_fft, ONLY: use_filtre_fft
-  USE lmdz_filtre_fft_loc, ONLY: use_filtre_fft_loc=>use_filtre_fft
-  USE mod_hallo, ONLY: use_mpi_alloc
-  USE lmdz_infotrac, ONLY: type_trac
-  USE lmdz_assert, ONLY: assert
-  USE comconst_mod, ONLY: dissip_deltaz, dissip_factz, dissip_zref, &
-                          iflag_top_bound, mode_top_bound, tau_top_bound, &
-                          ngroup, maxlatfilter
-  USE logic_mod, ONLY: fxyhypb, iflag_phys, ok_etat0, ok_gradsfile, &
-                       ok_guide, ok_limit, ok_strato, purmats, read_start, &
-                       ysinus, read_orop, adv_qsat_liq
-  USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy, &
-                       alphax,alphay,taux,tauy
-  USE temps_mod, ONLY: calend, year_len, offline_time
-  USE lmdz_iniprint, ONLY: lunout, prt_level
-  USE lmdz_comdissnew, ONLY: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, &
-          tetagrot, tetatemp, coefdis, vert_prof_dissip
-
-  USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
-  USE lmdz_paramet
-  IMPLICIT NONE
-  !-----------------------------------------------------------------------
-  !     Auteurs :   L. Fairhead , P. Le Van  .
-
-  !     Arguments :
-
-  !     tapedef   :
-  !     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
-  !     -metres  du zoom  avec  celles lues sur le fichier start .
-
-  LOGICAL,INTENT(IN) :: etatinit
-  INTEGER,INTENT(IN) :: tapedef
-
-  !   Declarations :
-  !   --------------
-
-
-
-  !   local:
-  !   ------
-
-  CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
-  REAL clonn,clatt,grossismxx,grossismyy
-  REAL dzoomxx,dzoomyy, tauxx,tauyy
-  LOGICAL  fxyhypbb, ysinuss
-  INTEGER i
-  CHARACTER(len=*), PARAMETER :: modname="conf_gcm"
-  CHARACTER(len=80) :: abort_message
-#ifdef CPP_OMP
-  INTEGER, EXTERNAL :: OMP_GET_NUM_THREADS
-#endif
-
-  !  -------------------------------------------------------------------
-
-  !       .........     Version  du 29/04/97       ..........
-
-  !   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
-  !      tetatemp   ajoutes  pour la dissipation   .
-
-  !   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb ** 
-
-  !  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
-  !    Sinon , choix de fxynew  , a derivee sinusoidale  ..
-
-  !   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
-  !         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
-  !                de limit.dat ( dic)                        ...........
-  !           Sinon  etatinit = . FALSE .
-
-  !   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
-  !    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
-  !   celles passees  par run.def ,  au debut du gcm, apres l'appel a 
-  !    lectba .  
-  !   Ces parmetres definissant entre autres la grille et doivent etre
-  !   pareils et coherents , sinon il y aura  divergence du gcm .
-
-  !-----------------------------------------------------------------------
-  !   initialisations:
-  !   ----------------
-
-  !Config  Key  = lunout
-  !Config  Desc = unite de fichier pour les impressions
-  !Config  Def  = 6
-  !Config  Help = unite de fichier pour les impressions 
-  !Config         (defaut sortie standard = 6)
-  lunout=6
-  CALL getin('lunout', lunout)
-  IF (lunout /= 5 .AND. lunout /= 6) THEN
-     OPEN(UNIT=lunout,FILE='lmdz.out_0000',ACTION='write',  &
-          STATUS='unknown',FORM='formatted')
-  ENDIF
-
-  adjust=.FALSE.
-  CALL getin('adjust',adjust)
-
-#ifdef CPP_OMP
-  ! adjust=y not implemented in case of OpenMP threads...
-  !$OMP PARALLEL
-  IF ((OMP_GET_NUM_THREADS()>1).AND.adjust) THEN
-     WRITE(lunout,*)'conf_gcm: Error, adjust should be set to n' &
-          ,' when running with OpenMP threads'
-     abort_message = 'Wrong value for adjust'
-     CALL abort_gcm(modname,abort_message,1)
-  ENDIF
-  !$OMP END PARALLEL         
-#endif
-
-  itaumax=0
-  CALL getin('itaumax',itaumax);
-  IF (itaumax<=0) itaumax=HUGE(itaumax)
-
-  !Config  Key  = prt_level
-  !Config  Desc = niveau d'impressions de débogage
-  !Config  Def  = 0
-  !Config  Help = Niveau d'impression pour le débogage
-  !Config         (0 = minimum d'impression)
-  prt_level = 0
-  CALL getin('prt_level',prt_level)
-
-  !-----------------------------------------------------------------------
-  !  Parametres de controle du run:
-  !-----------------------------------------------------------------------
-  !Config  Key  = planet_type
-  !Config  Desc = planet type ("earth", "mars", "venus", ...)
-  !Config  Def  = earth
-  !Config  Help = this flag sets the type of atymosphere that is considered
-  planet_type="earth"
-  CALL getin('planet_type',planet_type)
-
-  !Config  Key  = calend
-  !Config  Desc = type de calendrier utilise
-  !Config  Def  = earth_360d
-  !Config  Help = valeur possible: earth_360d, earth_365d, earth_366d
-  !Config         
-  calend = 'earth_360d'
-! initialize year_len for aquaplanets and 1D
-  CALL getin('calend', calend)
-  IF (calend == 'earth_360d') THEN
-    year_len=360
-  ELSE IF (calend == 'earth_365d') THEN
-    year_len=365
-  ELSE IF (calend == 'earth_366d') THEN
-    year_len=366
-  ELSE
-    year_len=1
-  ENDIF
-
-  !Config  Key  = dayref
-  !Config  Desc = Jour de l'etat initial
-  !Config  Def  = 1
-  !Config  Help = Jour de l'etat initial ( = 350  si 20 Decembre ,
-  !Config         par expl. ,comme ici ) ... A completer
-  dayref=1
-  CALL getin('dayref', dayref)
-
-  !Config  Key  = anneeref
-  !Config  Desc = Annee de l'etat initial
-  !Config  Def  = 1998
-  !Config  Help = Annee de l'etat  initial 
-  !Config         (   avec  4  chiffres   ) ... A completer
-  anneeref = 1998
-  CALL getin('anneeref',anneeref)
-
-  !Config  Key  = raz_date
-  !Config  Desc = Remise a zero de la date initiale
-  !Config  Def  = 0 (pas de remise a zero)
-  !Config  Help = Remise a zero de la date initiale 
-  !Config         0 pas de remise a zero, on garde la date du fichier restart
-  !Config         1 prise en compte de la date de gcm.def avec remise a zero
-  !Config         des compteurs de pas de temps
-  raz_date = 0
-  CALL getin('raz_date', raz_date)
-
-  !Config  Key  = resetvarc
-  !Config  Desc = Reinit des variables de controle
-  !Config  Def  = n
-  !Config  Help = Reinit des variables de controle
-  resetvarc = .FALSE.
-  CALL getin('resetvarc',resetvarc)
-
-  !Config  Key  = nday
-  !Config  Desc = Nombre de jours d'integration
-  !Config  Def  = 10
-  !Config  Help = Nombre de jours d'integration
-  !Config         ... On pourait aussi permettre des mois ou des annees !
-  nday = 10
-  CALL getin('nday',nday)
-
-  !Config  Key  = starttime
-  !Config  Desc = Heure de depart de la simulation
-  !Config  Def  = 0
-  !Config  Help = Heure de depart de la simulation
-  !Config         en jour
-  starttime = 0
-  CALL getin('starttime',starttime)
-
-  !Config  Key  = day_step
-  !Config  Desc = nombre de pas par jour
-  !Config  Def  = 240 
-  !Config  Help = nombre de pas par jour (multiple de iperiod) (
-  !Config          ici pour  dt = 1 min ) 
-  day_step = 240 
-  CALL getin('day_step',day_step)
-
-  !Config  Key  = nsplit_phys
-  nsplit_phys = 1 
-  CALL getin('nsplit_phys',nsplit_phys)
-
-  !Config  Key  = iperiod
-  !Config  Desc = periode pour le pas Matsuno
-  !Config  Def  = 5
-  !Config  Help = periode pour le pas Matsuno (en pas de temps)
-  iperiod = 5
-  CALL getin('iperiod',iperiod)
-
-  !Config  Key  = iapp_tracvl
-  !Config  Desc = frequence du groupement des flux 
-  !Config  Def  = iperiod
-  !Config  Help = frequence du groupement des flux (en pas de temps) 
-  iapp_tracvl = iperiod
-  CALL getin('iapp_tracvl',iapp_tracvl)
-
-  !Config  Key  = iconser
-  !Config  Desc = periode de sortie des variables de controle
-  !Config  Def  = 240  
-  !Config  Help = periode de sortie des variables de controle
-  !Config         (En pas de temps)
-  iconser = 240  
-  CALL getin('iconser', iconser)
-
-  !Config  Key  = iecri
-  !Config  Desc = periode d'ecriture du fichier histoire
-  !Config  Def  = 1
-  !Config  Help = periode d'ecriture du fichier histoire (en jour) 
-  iecri = 1
-  CALL getin('iecri',iecri)
-
-  !Config  Key  = periodav
-  !Config  Desc = periode de stockage fichier histmoy
-  !Config  Def  = 1
-  !Config  Help = periode de stockage fichier histmoy (en jour) 
-  periodav = 1.
-  CALL getin('periodav',periodav)
-
-  !Config  Key  = output_grads_dyn
-  !Config  Desc = output dynamics diagnostics in 'dyn.dat' file
-  !Config  Def  = n
-  !Config  Help = output dynamics diagnostics in Grads-readable 'dyn.dat' file
-  output_grads_dyn=.FALSE.
-  CALL getin('output_grads_dyn',output_grads_dyn)
-
-  !Config  Key  = dissip_period
-  !Config  Desc = periode de la dissipation 
-  !Config  Def  = 0
-  !Config  Help = periode de la dissipation 
-  !Config  dissip_period=0 => la valeur sera calcule dans inidissip       
-  !Config  dissip_period>0 => on prend cette valeur
-  dissip_period = 0
-  CALL getin('dissip_period',dissip_period)
-
-  !cc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
-  !cc
-
-  !Config  Key  = lstardis
-  !Config  Desc = choix de l'operateur de dissipation
-  !Config  Def  = y
-  !Config  Help = choix de l'operateur de dissipation
-  !Config         'y' si on veut star et 'n' si on veut non-start !
-  !Config         Moi y en a pas comprendre ! 
-  lstardis = .TRUE.
-  CALL getin('lstardis',lstardis)
-
-  !Config  Key  = nitergdiv
-  !Config  Desc = Nombre d'iteration de gradiv
-  !Config  Def  = 1
-  !Config  Help = nombre d'iterations de l'operateur de dissipation 
-  !Config         gradiv
-  nitergdiv = 1
-  CALL getin('nitergdiv',nitergdiv)
-
-  !Config  Key  = nitergrot
-  !Config  Desc = nombre d'iterations de nxgradrot
-  !Config  Def  = 2
-  !Config  Help = nombre d'iterations de l'operateur de dissipation  
-  !Config         nxgradrot
-  nitergrot = 2
-  CALL getin('nitergrot',nitergrot)
-
-  !Config  Key  = niterh
-  !Config  Desc = nombre d'iterations de divgrad
-  !Config  Def  = 2
-  !Config  Help = nombre d'iterations de l'operateur de dissipation
-  !Config         divgrad
-  niterh = 2
-  CALL getin('niterh',niterh)
-
-  !Config  Key  = tetagdiv
-  !Config  Desc = temps de dissipation pour div
-  !Config  Def  = 7200
-  !Config  Help = temps de dissipation des plus petites longeur 
-  !Config         d'ondes pour u,v (gradiv)
-  tetagdiv = 7200.
-  CALL getin('tetagdiv',tetagdiv)
-
-  !Config  Key  = tetagrot
-  !Config  Desc = temps de dissipation pour grad
-  !Config  Def  = 7200
-  !Config  Help = temps de dissipation des plus petites longeur 
-  !Config         d'ondes pour u,v (nxgradrot)
-  tetagrot = 7200.
-  CALL getin('tetagrot',tetagrot)
-
-  !Config  Key  = tetatemp 
-  !Config  Desc = temps de dissipation pour h
-  !Config  Def  = 7200
-  !Config  Help =  temps de dissipation des plus petites longeur 
-  !Config         d'ondes pour h (divgrad)   
-  tetatemp  = 7200.
-  CALL getin('tetatemp',tetatemp )
-
-  ! Parametres controlant la variation sur la verticale des constantes de
-  ! dissipation.
-  ! Pour le moment actifs uniquement dans la version a 39 niveaux
-  ! avec ok_strato=y
-
-  dissip_factz=4.
-  dissip_deltaz=10.
-  dissip_zref=30.
-  CALL getin('dissip_factz',dissip_factz )
-  CALL getin('dissip_deltaz',dissip_deltaz )
-  CALL getin('dissip_zref',dissip_zref )
-
-
-  !maxlatfilter
-  maxlatfilter = -1.0
-  CALL getin('maxlatfilter',maxlatfilter)
-  IF (maxlatfilter > 90) &
-       CALL abort_gcm("conf_gcm", 'maxlatfilter should be <=90', 1)
-  
-
-  ! ngroup
-  ngroup=3
-  CALL getin('ngroup',ngroup)
-  IF (mod(iim, 2**ngroup) /= 0) &
-       CALL abort_gcm("conf_gcm", 'iim must be multiple of 2**ngroup', 1)
-  IF (2**ngroup > jjm + 1) &
-       CALL abort_gcm("conf_gcm", '2**ngroup must be <= jjm + 1', 1)
-
-  ! mode_top_bound : fields towards which sponge relaxation will be done:
-  ! top_bound sponge: only active if ok_strato=.TRUE. and iflag_top_bound!=0
-  !                   iflag_top_bound=0 for no sponge
-  !                   iflag_top_bound=1 for sponge over 4 topmost layers
-  !                   iflag_top_bound=2 for sponge from top to ~1% of top layer pressure
-  iflag_top_bound=1
-  CALL getin('iflag_top_bound',iflag_top_bound)
-  IF (iflag_top_bound < 0 .OR. iflag_top_bound > 2) &
-       CALL abort_gcm("conf_gcm", 'iflag_top_bound must be 0, 1 or 2', 1)
-
-  ! mode_top_bound : fields towards which sponge relaxation will be done:
-  !                  mode_top_bound=0: no relaxation
-  !                  mode_top_bound=1: u and v relax towards 0
-  !                  mode_top_bound=2: u and v relax towards their zonal mean
-  !                  mode_top_bound=3: u,v and pot. temp. relax towards their zonal mean
-  mode_top_bound=3
-  CALL getin('mode_top_bound',mode_top_bound)
-
-  ! top_bound sponge : inverse of charactericstic relaxation time scale for sponge
-  tau_top_bound=1.e-5
-  CALL getin('tau_top_bound',tau_top_bound)
-
-  !Config  Key  = coefdis
-  !Config  Desc = coefficient pour gamdissip
-  !Config  Def  = 0
-  !Config  Help = coefficient pour gamdissip  
-  coefdis = 0.
-  CALL getin('coefdis',coefdis)
-
-  !Config  Key  = purmats
-  !Config  Desc = Schema d'integration
-  !Config  Def  = n
-  !Config  Help = Choix du schema d'integration temporel.
-  !Config         y = pure Matsuno sinon c'est du Matsuno-leapfrog
-  purmats = .FALSE.
-  CALL getin('purmats',purmats)
-
-  !Config  Key  = ok_guide
-  !Config  Desc = Guidage
-  !Config  Def  = n
-  !Config  Help = Guidage
-  ok_guide = .FALSE.
-  CALL getin('ok_guide',ok_guide)
-
-  IF (ok_guide .AND. adjust) CALL abort_gcm("conf_gcm", &
-       "adjust does not work with ok_guide", 1)
-
-  !Config  Key  =  read_start
-  !Config  Desc = Initialize model using a 'start.nc' file
-  !Config  Def  = y
-  !Config  Help = y: intialize dynamical fields using a 'start.nc' file
-  !               n: fields are initialized by 'iniacademic' routine
-  read_start= .TRUE.
-  CALL getin('read_start',read_start)
-
-  !Config  Key  = iflag_phys
-  !Config  Desc = Avec ls physique 
-  !Config  Def  = 1
-  !Config  Help = Permet de faire tourner le modele sans 
-  !Config         physique.
-  iflag_phys = 1
-  CALL getin('iflag_phys',iflag_phys)
-
-  !Config  Key  =  iphysiq
-  !Config  Desc = Periode de la physique
-  !Config  Def  = 5
-  !Config  Help = Periode de la physique en pas de temps de la dynamique.
-  iphysiq = 5
-  CALL getin('iphysiq', iphysiq)
-
-  !Config  Key  = ip_ebil_dyn
-  !Config  Desc = PRINT level for energy conserv. diag.
-  !Config  Def  = 0
-  !Config  Help = PRINT level for energy conservation diag. ;
-  !               les options suivantes existent :
-  !Config         0 pas de print
-  !Config         1 pas de print
-  !Config         2 print,
-  ip_ebil_dyn = 0
-  CALL getin('ip_ebil_dyn',ip_ebil_dyn)
-
-  !cc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
-  !     .........   (  modif  le 17/04/96 )   .........
-
-  test_etatinit: IF (.NOT. etatinit) THEN
-     !Config  Key  = clon
-     !Config  Desc = centre du zoom, longitude
-     !Config  Def  = 0
-     !Config  Help = longitude en degres du centre 
-     !Config         du zoom
-     clonn = 0.
-     CALL getin('clon',clonn)
-
-     !Config  Key  = clat
-     !Config  Desc = centre du zoom, latitude
-     !Config  Def  = 0
-     !Config  Help = latitude en degres du centre du zoom
-     !Config         
-     clatt = 0.
-     CALL getin('clat',clatt)
-
-     IF( ABS(clat - clatt)>= 0.001 )  THEN
-        WRITE(lunout,*)'conf_gcm: La valeur de clat passee par run.def', &
-             ' est differente de celle lue sur le fichier  start '
-        CALL abort_gcm("conf_gcm","stopped",1)
-     ENDIF
-
-     !Config  Key  = grossismx 
-     !Config  Desc = zoom en longitude
-     !Config  Def  = 1.0
-     !Config  Help = facteur de grossissement du zoom,
-     !Config         selon la longitude
-     grossismxx = 1.0
-     CALL getin('grossismx',grossismxx)
-
-     IF( ABS(grossismx - grossismxx)>= 0.001 )  THEN
-        WRITE(lunout,*)'conf_gcm: La valeur de grossismx passee par ', &
-             'run.def est differente de celle lue sur le fichier  start '
-        CALL abort_gcm("conf_gcm","stopped",1)
-      ENDIF
-
-     !Config  Key  = grossismy
-     !Config  Desc = zoom en latitude
-     !Config  Def  = 1.0
-     !Config  Help = facteur de grossissement du zoom,
-     !Config         selon la latitude
-     grossismyy = 1.0
-     CALL getin('grossismy',grossismyy)
-
-     IF( ABS(grossismy - grossismyy)>= 0.001 )  THEN
-        WRITE(lunout,*)'conf_gcm: La valeur de grossismy passee par ', &
-             'run.def est differente de celle lue sur le fichier  start '
-        CALL abort_gcm("conf_gcm","stopped",1)
-     ENDIF
-
-     IF( grossismx<1. )  THEN
-        WRITE(lunout,*) &
-             'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
-        CALL abort_gcm("conf_gcm","stopped",1)
-     ELSE
-        alphax = 1. - 1./ grossismx
-     ENDIF
-
-     IF( grossismy<1. )  THEN
-        WRITE(lunout,*) &
-             'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
-        CALL abort_gcm("conf_gcm","stopped",1)
-     ELSE
-        alphay = 1. - 1./ grossismy
-     ENDIF
-
-     WRITE(lunout,*)'conf_gcm: alphax alphay',alphax,alphay
-
-     !    alphax et alphay sont les anciennes formulat. des grossissements
-
-     !Config  Key  = fxyhypb
-     !Config  Desc = Fonction  hyperbolique
-     !Config  Def  = y
-     !Config  Help = Fonction  f(y)  hyperbolique  si = .TRUE.
-     !Config         sinon  sinusoidale
-     fxyhypbb = .TRUE.
-     CALL getin('fxyhypb',fxyhypbb)
-
-     IF( .NOT.fxyhypb )  THEN
-        IF( fxyhypbb )     THEN
-           WRITE(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
-           WRITE(lunout,*)' *** fxyhypb lu sur le fichier start est ', &
-                'F alors  qu il est  T  sur  run.def  ***'
-           CALL abort_gcm("conf_gcm","stopped",1)
-        ENDIF
-     ELSE
-        IF( .NOT.fxyhypbb )   THEN
-           WRITE(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
-           WRITE(lunout,*)' ***  fxyhypb lu sur le fichier start est ', &
-                'T alors  qu il est  F  sur  run.def  ****  '
-           CALL abort_gcm("conf_gcm","stopped",1)
-        ENDIF
-     ENDIF
-
-     !Config  Key  = dzoomx
-     !Config  Desc = extension en longitude
-     !Config  Def  = 0
-     !Config  Help = extension en longitude  de la zone du zoom  
-     !Config         ( fraction de la zone totale)
-     dzoomxx = 0.0
-     CALL getin('dzoomx',dzoomxx)
-
-     IF( fxyhypb )  THEN
-        IF( ABS(dzoomx - dzoomxx)>= 0.001 )  THEN
-           WRITE(lunout,*)'conf_gcm: La valeur de dzoomx passee par ', &
-                'run.def est differente de celle lue sur le fichier  start '
-           CALL abort_gcm("conf_gcm","stopped",1)
-        ENDIF
-     ENDIF
-
-     !Config  Key  = dzoomy
-     !Config  Desc = extension en latitude
-     !Config  Def  = 0
-     !Config  Help = extension en latitude de la zone  du zoom  
-     !Config         ( fraction de la zone totale)
-     dzoomyy = 0.0
-     CALL getin('dzoomy',dzoomyy)
-
-     IF( fxyhypb )  THEN
-        IF( ABS(dzoomy - dzoomyy)>= 0.001 )  THEN
-           WRITE(lunout,*)'conf_gcm: La valeur de dzoomy passee par ', &
-                'run.def est differente de celle lue sur le fichier  start '
-           CALL abort_gcm("conf_gcm","stopped",1)
-        ENDIF
-     ENDIF
-
-     !Config  Key  = taux
-     !Config  Desc = raideur du zoom en  X
-     !Config  Def  = 3
-     !Config  Help = raideur du zoom en  X
-     tauxx = 3.0
-     CALL getin('taux',tauxx)
-
-     IF( fxyhypb )  THEN
-        IF( ABS(taux - tauxx)>= 0.001 )  THEN
-           WRITE(lunout,*)'conf_gcm: La valeur de taux passee par ', &
-                'run.def est differente de celle lue sur le fichier  start '
-           CALL abort_gcm("conf_gcm","stopped",1)
-        ENDIF
-     ENDIF
-
-     !Config  Key  = tauyy
-     !Config  Desc = raideur du zoom en  Y
-     !Config  Def  = 3
-     !Config  Help = raideur du zoom en  Y
-     tauyy = 3.0
-     CALL getin('tauy',tauyy)
-
-     IF( fxyhypb )  THEN
-        IF( ABS(tauy - tauyy)>= 0.001 )  THEN
-           WRITE(lunout,*)'conf_gcm: La valeur de tauy passee par ', &
-                'run.def est differente de celle lue sur le fichier  start '
-        CALL abort_gcm("conf_gcm","stopped",1)
-        ENDIF
-     ENDIF
-
-     !c
-     IF( .NOT.fxyhypb  )  THEN
-
-        !Config  Key  = ysinus
-        !Config  IF   = !fxyhypb
-        !Config  Desc = Fonction en Sinus
-        !Config  Def  = y
-        !Config  Help = Fonction  f(y) avec y = Sin(latit.) si = .TRUE.
-        !Config         sinon y = latit.
-        ysinuss = .TRUE.
-        CALL getin('ysinus',ysinuss)
-
-        IF( .NOT.ysinus )  THEN
-           IF( ysinuss )     THEN
-              WRITE(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
-              WRITE(lunout,*)' *** ysinus lu sur le fichier start est F', &
-                   ' alors  qu il est  T  sur  run.def  ***'
-              CALL abort_gcm("conf_gcm","stopped",1)
-           ENDIF
-        ELSE
-           IF( .NOT.ysinuss )   THEN
-              WRITE(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
-              WRITE(lunout,*)' *** ysinus lu sur le fichier start est T', &
-                   ' alors  qu il est  F  sur  run.def  ****  '
-              CALL abort_gcm("conf_gcm","stopped",1)
-           ENDIF
-        ENDIF
-     ENDIF ! of IF( .NOT.fxyhypb  )
-
-     !Config  Key  = offline
-     !Config  Desc = ecriture des flux de masse
-     !Config  Def  = n
-     !Config  Help = Permet de sortir les flux de masse sur la grille plev 
-     offline = .FALSE.
-     CALL getin('offline',offline)
-
-     !Config Key  = offline_time
-     !Config Desc =  Choix des frequences de stockage pour le offline
-     !Config Def  = 8
-     !Config Help = offline_time=12     ! stockage toutes les 2h=1jour/12
-     !Config Help = offline_time=8      ! stockage toutes les 3h=1jour/8
-     offline_time = 8
-     CALL getin('offline_time',offline_time)
-
-     IF (offline .AND. adjust) THEN
-        WRITE(lunout,*)  &
-             'WARNING : option offline does not work with adjust=y :'
-        WRITE(lunout,*) 'the files defstoke.nc, fluxstoke.nc ',  &
-             'and fluxstokev.nc will not be created'
-        WRITE(lunout,*)  &
-             'only the file phystoke.nc will still be created ' 
-     ENDIF
-
-     !Config  Key  = type_trac
-     !Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
-     !Config  Def  = lmdz
-     !Config  Help = 
-     !Config         'lmdz' = pas de couplage, pur LMDZ
-     !Config         'inca' = model de chime INCA 
-     !Config         'repr' = model de chime REPROBUS
-     type_trac = 'lmdz'
-     CALL getin('type_trac',type_trac)
-
-
-     !Config  Key  = adv_qsat_liq
-     !Config  Desc = option for qsat calculation in the dynamics
-     !Config  Def  = n 
-     !Config  Help = controls which phase is considered for qsat calculation 
-     !Config          
-     adv_qsat_liq = .FALSE.
-     CALL getin('adv_qsat_liq',adv_qsat_liq)
-
-     !Config  Key  = ok_dynzon 
-     !Config  Desc = calcul et sortie des transports 
-     !Config  Def  = n 
-     !Config  Help = Permet de mettre en route le calcul des transports 
-     !Config          
-     ok_dynzon = .FALSE. 
-     CALL getin('ok_dynzon',ok_dynzon) 
-
-     !Config  Key  = ok_dyn_ins
-     !Config  Desc = sorties instantanees dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = 
-     !Config          
-     ok_dyn_ins = .FALSE. 
-     CALL getin('ok_dyn_ins',ok_dyn_ins) 
-
-     !Config  Key  = ok_dyn_ave
-     !Config  Desc = sorties moyennes dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = 
-     !Config          
-     ok_dyn_ave = .FALSE. 
-     CALL getin('ok_dyn_ave',ok_dyn_ave) 
-
-     !Config  Key  = ok_dyn_xios
-     !Config  Desc = sorties moyennes dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = 
-     !Config          
-     ok_dyn_xios = .FALSE. 
-     CALL getin('ok_dyn_xios',ok_dyn_xios) 
-
-     WRITE(lunout,*)' #########################################'
-     WRITE(lunout,*)' Configuration des parametres du gcm: '
-     WRITE(lunout,*)' planet_type = ', planet_type
-     WRITE(lunout,*)' calend = ', calend
-     WRITE(lunout,*)' dayref = ', dayref
-     WRITE(lunout,*)' anneeref = ', anneeref
-     WRITE(lunout,*)' nday = ', nday
-     WRITE(lunout,*)' day_step = ', day_step
-     WRITE(lunout,*)' iperiod = ', iperiod
-     WRITE(lunout,*)' nsplit_phys = ', nsplit_phys
-     WRITE(lunout,*)' iconser = ', iconser
-     WRITE(lunout,*)' iecri = ', iecri
-     WRITE(lunout,*)' periodav = ', periodav
-     WRITE(lunout,*)' output_grads_dyn = ', output_grads_dyn
-     WRITE(lunout,*)' dissip_period = ', dissip_period
-     WRITE(lunout,*)' lstardis = ', lstardis
-     WRITE(lunout,*)' nitergdiv = ', nitergdiv
-     WRITE(lunout,*)' nitergrot = ', nitergrot
-     WRITE(lunout,*)' niterh = ', niterh
-     WRITE(lunout,*)' tetagdiv = ', tetagdiv
-     WRITE(lunout,*)' tetagrot = ', tetagrot
-     WRITE(lunout,*)' tetatemp = ', tetatemp
-     WRITE(lunout,*)' coefdis = ', coefdis
-     WRITE(lunout,*)' purmats = ', purmats
-     WRITE(lunout,*)' read_start = ', read_start
-     WRITE(lunout,*)' iflag_phys = ', iflag_phys
-     WRITE(lunout,*)' iphysiq = ', iphysiq
-     WRITE(lunout,*)' clonn = ', clonn
-     WRITE(lunout,*)' clatt = ', clatt
-     WRITE(lunout,*)' grossismx = ', grossismx
-     WRITE(lunout,*)' grossismy = ', grossismy
-     WRITE(lunout,*)' fxyhypbb = ', fxyhypbb
-     WRITE(lunout,*)' dzoomxx = ', dzoomxx
-     WRITE(lunout,*)' dzoomy = ', dzoomyy
-     WRITE(lunout,*)' tauxx = ', tauxx
-     WRITE(lunout,*)' tauyy = ', tauyy
-     WRITE(lunout,*)' offline = ', offline
-     WRITE(lunout,*)' offline_time = ', offline_time
-     WRITE(lunout,*)' type_trac = ', type_trac
-     WRITE(lunout,*)' ok_dynzon = ', ok_dynzon
-     WRITE(lunout,*)' ok_dyn_ins = ', ok_dyn_ins
-     WRITE(lunout,*)' ok_dyn_ave = ', ok_dyn_ave
-     WRITE(lunout,*)' ok_dyn_xios = ', ok_dyn_xios
-     WRITE(lunout,*)' adv_qsat_liq = ', adv_qsat_liq
-  else
-     !Config  Key  = clon
-     !Config  Desc = centre du zoom, longitude
-     !Config  Def  = 0
-     !Config  Help = longitude en degres du centre 
-     !Config         du zoom
-     clon = 0.
-     CALL getin('clon',clon)
-
-     !Config  Key  = clat
-     !Config  Desc = centre du zoom, latitude
-     !Config  Def  = 0
-     !Config  Help = latitude en degres du centre du zoom
-     !Config         
-     clat = 0.
-     CALL getin('clat',clat)
-
-     !Config  Key  = grossismx 
-     !Config  Desc = zoom en longitude
-     !Config  Def  = 1.0
-     !Config  Help = facteur de grossissement du zoom,
-     !Config         selon la longitude
-     grossismx = 1.0
-     CALL getin('grossismx',grossismx)
-
-     !Config  Key  = grossismy
-     !Config  Desc = zoom en latitude
-     !Config  Def  = 1.0
-     !Config  Help = facteur de grossissement du zoom,
-     !Config         selon la latitude
-     grossismy = 1.0
-     CALL getin('grossismy',grossismy)
-
-     IF( grossismx<1. )  THEN
-        WRITE(lunout,*) 'conf_gcm: ***ATTENTION !! grossismx < 1 . *** '
-        CALL abort_gcm("conf_gcm","stopped",1)
-     ELSE
-        alphax = 1. - 1./ grossismx
-     ENDIF
-
-     IF( grossismy<1. )  THEN
-        WRITE(lunout,*) 'conf_gcm: ***ATTENTION !! grossismy < 1 . *** '
-        CALL abort_gcm("conf_gcm","stopped",1)
-     ELSE
-        alphay = 1. - 1./ grossismy
-     ENDIF
-
-     WRITE(lunout,*) 'conf_gcm: alphax alphay ',alphax,alphay
-
-     !    alphax et alphay sont les anciennes formulat. des grossissements
-
-     !Config  Key  = fxyhypb
-     !Config  Desc = Fonction  hyperbolique
-     !Config  Def  = y
-     !Config  Help = Fonction  f(y)  hyperbolique  si = .TRUE.
-     !Config         sinon  sinusoidale
-     fxyhypb = .TRUE.
-     CALL getin('fxyhypb',fxyhypb)
-
-     !Config  Key  = dzoomx
-     !Config  Desc = extension en longitude
-     !Config  Def  = 0
-     !Config  Help = extension en longitude  de la zone du zoom  
-     !Config         ( fraction de la zone totale)
-     dzoomx = 0.2
-     CALL getin('dzoomx',dzoomx)
-     CALL assert(dzoomx < 1, "conf_gcm: dzoomx must be < 1")
-
-     !Config  Key  = dzoomy
-     !Config  Desc = extension en latitude
-     !Config  Def  = 0
-     !Config  Help = extension en latitude de la zone  du zoom  
-     !Config         ( fraction de la zone totale)
-     dzoomy = 0.2
-     CALL getin('dzoomy',dzoomy)
-     CALL assert(dzoomy < 1, "conf_gcm: dzoomy must be < 1")
-
-     !Config  Key  = taux
-     !Config  Desc = raideur du zoom en  X
-     !Config  Def  = 3
-     !Config  Help = raideur du zoom en  X
-     taux = 3.0
-     CALL getin('taux',taux)
-
-     !Config  Key  = tauy
-     !Config  Desc = raideur du zoom en  Y
-     !Config  Def  = 3
-     !Config  Help = raideur du zoom en  Y
-     tauy = 3.0
-     CALL getin('tauy',tauy)
-
-     !Config  Key  = ysinus
-     !Config  IF   = !fxyhypb
-     !Config  Desc = Fonction en Sinus
-     !Config  Def  = y
-     !Config  Help = Fonction  f(y) avec y = Sin(latit.) si = .TRUE.
-     !Config         sinon y = latit.
-     ysinus = .TRUE.
-     CALL getin('ysinus',ysinus)
-
-     !Config  Key  = offline
-     !Config  Desc = Nouvelle eau liquide
-     !Config  Def  = n
-     !Config  Help = Permet de mettre en route la
-     !Config         nouvelle parametrisation de l'eau liquide !
-     offline = .FALSE.
-     CALL getin('offline',offline)
-     IF (offline .AND. adjust) THEN
-        WRITE(lunout,*)  &
-             'WARNING : option offline does not work with adjust=y :'
-        WRITE(lunout,*) 'the files defstoke.nc, fluxstoke.nc ',  &
-             'and fluxstokev.nc will not be created'
-        WRITE(lunout,*)  &
-             'only the file phystoke.nc will still be created ' 
-     ENDIF
-
-     !Config  Key  = type_trac
-     !Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
-     !Config  Def  = lmdz
-     !Config  Help = 
-     !Config         'lmdz' = pas de couplage, pur LMDZ
-     !Config         'inca' = model de chime INCA 
-     !Config         'repr' = model de chime REPROBUS
-     type_trac = 'lmdz'
-     CALL getin('type_trac',type_trac)
-
-     !Config  Key  = ok_dynzon 
-     !Config  Desc = sortie des transports zonaux dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = Permet de mettre en route le calcul des transports 
-     !Config          
-     ok_dynzon = .FALSE. 
-     CALL getin('ok_dynzon',ok_dynzon) 
-
-     !Config  Key  = ok_dyn_ins
-     !Config  Desc = sorties instantanees dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = 
-     !Config          
-     ok_dyn_ins = .FALSE. 
-     CALL getin('ok_dyn_ins',ok_dyn_ins) 
-
-     !Config  Key  = ok_dyn_ave
-     !Config  Desc = sorties moyennes dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = 
-     !Config          
-     ok_dyn_ave = .FALSE. 
-     CALL getin('ok_dyn_ave',ok_dyn_ave) 
-
-     !Config  Key  = ok_dyn_xios
-     !Config  Desc = sorties moyennes dans la dynamique
-     !Config  Def  = n 
-     !Config  Help = 
-     !Config          
-     ok_dyn_xios = .FALSE. 
-     CALL getin('ok_dyn_xios',ok_dyn_xios) 
-
-     !Config  Key  = use_filtre_fft
-     !Config  Desc = flag to activate FFTs for the filter
-     !Config  Def  = false
-     !Config  Help = enables to use FFts to do the longitudinal polar 
-     !Config         filtering around the poles.
-     use_filtre_fft=.FALSE.
-     CALL getin('use_filtre_fft',use_filtre_fft)
-     IF (use_filtre_fft .AND. grossismx /= 1.0) THEN
-        WRITE(lunout,*)'WARNING !!! '
-        WRITE(lunout,*)"A zoom in longitude is not compatible", &
-             " with the FFT filter ", &
-             "---> FFT filter deactivated"
-        use_filtre_fft=.FALSE.
-     ENDIF
-     use_filtre_fft_loc=use_filtre_fft
-
-     !Config  Key  = use_mpi_alloc
-     !Config  Desc = Utilise un buffer MPI en mémoire globale
-     !Config  Def  = false
-     !Config  Help = permet d'activer l'utilisation d'un buffer MPI
-     !Config         en mémoire globale a l'aide de la fonction MPI_ALLOC.
-     !Config         Cela peut améliorer la bande passante des transferts MPI
-     !Config         d'un facteur 2  
-     use_mpi_alloc=.FALSE.
-     CALL getin('use_mpi_alloc',use_mpi_alloc)
-
-     !Config key = ok_strato
-     !Config  Desc = activation de la version strato
-     !Config  Def  = .FALSE.
-     !Config  Help = active la version stratosphérique de LMDZ de F. Lott
-
-     ok_strato=.FALSE.
-     CALL getin('ok_strato',ok_strato)
-
-     vert_prof_dissip = merge(1, 0, ok_strato .AND. llm==39)
-     CALL getin('vert_prof_dissip', vert_prof_dissip)
-     CALL assert(vert_prof_dissip == 0 .OR. vert_prof_dissip ==  1, &
-          "bad value for vert_prof_dissip")
-
-     !Config  Key  = ok_gradsfile
-     !Config  Desc = activation des sorties grads du guidage
-     !Config  Def  = n
-     !Config  Help = active les sorties grads du guidage
-
-     ok_gradsfile = .FALSE.
-     CALL getin('ok_gradsfile',ok_gradsfile)
-
-     !Config  Key  = ok_limit
-     !Config  Desc = creation des fichiers limit dans create_etat0_limit
-     !Config  Def  = y
-     !Config  Help = production du fichier limit.nc requise
-
-     ok_limit = .TRUE.
-     CALL getin('ok_limit',ok_limit)
-
-     !Config  Key  = ok_etat0
-     !Config  Desc = creation des fichiers etat0 dans create_etat0_limit
-     !Config  Def  = y
-     !Config  Help = production des fichiers start.nc, startphy.nc requise
-
-     ok_etat0 = .TRUE.
-     CALL getin('ok_etat0',ok_etat0)
-
-     !Config  Key  = read_orop
-     !Config  Desc = lecture du fichier de params orographiques sous maille
-     !Config  Def  = f
-     !Config  Help = lecture fichier plutot que grid_noro
-
-     read_orop = .FALSE.
-     CALL getin('read_orop',read_orop)
-
-     WRITE(lunout,*)' #########################################'
-     WRITE(lunout,*)' Configuration des parametres de cel0_limit: '
-     WRITE(lunout,*)' planet_type = ', planet_type
-     WRITE(lunout,*)' calend = ', calend
-     WRITE(lunout,*)' dayref = ', dayref
-     WRITE(lunout,*)' anneeref = ', anneeref
-     WRITE(lunout,*)' nday = ', nday
-     WRITE(lunout,*)' day_step = ', day_step
-     WRITE(lunout,*)' iperiod = ', iperiod
-     WRITE(lunout,*)' iconser = ', iconser
-     WRITE(lunout,*)' iecri = ', iecri
-     WRITE(lunout,*)' periodav = ', periodav
-     WRITE(lunout,*)' output_grads_dyn = ', output_grads_dyn
-     WRITE(lunout,*)' dissip_period = ', dissip_period
-     WRITE(lunout,*)' lstardis = ', lstardis
-     WRITE(lunout,*)' nitergdiv = ', nitergdiv
-     WRITE(lunout,*)' nitergrot = ', nitergrot
-     WRITE(lunout,*)' niterh = ', niterh
-     WRITE(lunout,*)' tetagdiv = ', tetagdiv
-     WRITE(lunout,*)' tetagrot = ', tetagrot
-     WRITE(lunout,*)' tetatemp = ', tetatemp
-     WRITE(lunout,*)' coefdis = ', coefdis
-     WRITE(lunout,*)' purmats = ', purmats
-     WRITE(lunout,*)' read_start = ', read_start
-     WRITE(lunout,*)' iflag_phys = ', iflag_phys
-     WRITE(lunout,*)' iphysiq = ', iphysiq
-     WRITE(lunout,*)' clon = ', clon
-     WRITE(lunout,*)' clat = ', clat
-     WRITE(lunout,*)' grossismx = ', grossismx
-     WRITE(lunout,*)' grossismy = ', grossismy
-     WRITE(lunout,*)' fxyhypb = ', fxyhypb
-     WRITE(lunout,*)' dzoomx = ', dzoomx
-     WRITE(lunout,*)' dzoomy = ', dzoomy
-     WRITE(lunout,*)' taux = ', taux
-     WRITE(lunout,*)' tauy = ', tauy
-     WRITE(lunout,*)' offline = ', offline
-     WRITE(lunout,*)' type_trac = ', type_trac
-     WRITE(lunout,*)' ok_dynzon = ', ok_dynzon
-     WRITE(lunout,*)' ok_dyn_ins = ', ok_dyn_ins
-     WRITE(lunout,*)' ok_dyn_ave = ', ok_dyn_ave
-     WRITE(lunout,*)' ok_dyn_xios = ', ok_dyn_xios
-     WRITE(lunout,*)' use_filtre_fft = ', use_filtre_fft
-     WRITE(lunout,*)' use_mpi_alloc = ', use_mpi_alloc
-     WRITE(lunout,*)' ok_strato = ', ok_strato
-     WRITE(lunout,*)' ok_gradsfile = ', ok_gradsfile
-     WRITE(lunout,*)' ok_limit = ', ok_limit
-     WRITE(lunout,*)' ok_etat0 = ', ok_etat0
-     WRITE(lunout,*)' ok_guide = ', ok_guide
-     WRITE(lunout,*)' read_orop = ', read_orop
-  ENDIF test_etatinit
-
-END SUBROUTINE conf_gcm
Index: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/gcm.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3dmem/gcm.F90	(revision 5185)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3dmem/gcm.F90	(revision 5186)
@@ -1,3 +1,2 @@
-
 ! $Id$
 
@@ -14,5 +13,4 @@
   USE control_mod
 
-
   USE iniphysiq_mod, ONLY: iniphysiq
   USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_PHYS
@@ -20,7 +18,7 @@
   USE comconst_mod, ONLY: cpp, daysec, dtphys, dtvr, g, r, rad
   USE logic_mod ! all of it, because of copyin clause when calling leapfrog
-  USE temps_mod, ONLY: calend,start_time,annee_ref,day_ref, &
-                       itau_dyn,itau_phy,day_ini,jD_ref,jH_ref,day_end, &
-                       dt,hour_ini,itaufin
+  USE temps_mod, ONLY: calend, start_time, annee_ref, day_ref, &
+          itau_dyn, itau_phy, day_ini, jD_ref, jH_ref, day_end, &
+          dt, hour_ini, itaufin
   USE mod_xios_dyn3dmem, ONLY: xios_dyn3dmem_init
   USE lmdz_filtreg, ONLY: inifilr
@@ -34,4 +32,6 @@
   USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
   USE lmdz_paramet
+  USE lmdz_conf_gcm, ONLY: conf_gcm
+
   IMPLICIT NONE
 
@@ -66,16 +66,14 @@
   !   -------------
 
-
-
   REAL zdtvr
 
   !   variables dynamiques
-  REAL,ALLOCATABLE,SAVE  :: vcov(:,:),ucov(:,:) ! vents covariants
-  REAL,ALLOCATABLE,SAVE  :: teta(:,:)     ! temperature potentielle 
-  REAL, ALLOCATABLE,SAVE :: q(:,:,:)      ! champs advectes
-  REAL,ALLOCATABLE,SAVE  :: ps(:)         ! pression  au sol
+  REAL, ALLOCATABLE, SAVE :: vcov(:, :), ucov(:, :) ! vents covariants
+  REAL, ALLOCATABLE, SAVE :: teta(:, :)     ! temperature potentielle
+  REAL, ALLOCATABLE, SAVE :: q(:, :, :)      ! champs advectes
+  REAL, ALLOCATABLE, SAVE :: ps(:)         ! pression  au sol
   !      REAL p (ip1jmp1,llmp1  )               ! pression aux interfac.des couches
-  REAL,ALLOCATABLE,SAVE  :: masse(:,:)    ! masse d'air
-  REAL,ALLOCATABLE,SAVE  :: phis(:)       ! geopotentiel au sol
+  REAL, ALLOCATABLE, SAVE :: masse(:, :)    ! masse d'air
+  REAL, ALLOCATABLE, SAVE :: phis(:)       ! geopotentiel au sol
   !      REAL phi(ip1jmp1,llm)                  ! geopotentiel
   !      REAL w(ip1jmp1,llm)                    ! vitesse verticale
@@ -103,16 +101,15 @@
   !-jld 
 
-
-  CHARACTER (LEN=80) :: dynhist_file, dynhistave_file
-  CHARACTER (LEN=20) :: modname
-  CHARACTER (LEN=80) :: abort_message
+  CHARACTER (LEN = 80) :: dynhist_file, dynhistave_file
+  CHARACTER (LEN = 20) :: modname
+  CHARACTER (LEN = 80) :: abort_message
   ! locales pour gestion du temps
   INTEGER :: an, mois, jour
   REAL :: heure
   ! needed for xios interface
-  CHARACTER (LEN=10) :: xios_cal_type
+  CHARACTER (LEN = 10) :: xios_cal_type
   INTEGER :: anref, moisref, jourref
   REAL :: heureref
-  
+
 
 
@@ -124,5 +121,5 @@
   modname = 'gcm'
   descript = 'Run GCM LMDZ'
-  lafin    = .FALSE.
+  lafin = .FALSE.
   dynhist_file = 'dyn_hist'
   dynhistave_file = 'dyn_hist_ave'
@@ -134,7 +131,7 @@
   !  ---------------------------------------
 
-  CALL conf_gcm( 99, .TRUE. )
+  CALL conf_gcm(99, .TRUE.)
   IF (mod(iphysiq, iperiod) /= 0) CALL abort_gcm("conf_gcm", &
-       "iphysiq must be a multiple of iperiod", 1)
+          "iphysiq must be a multiple of iperiod", 1)
 
 
@@ -147,11 +144,11 @@
   CALL Read_Distrib
 
-!#ifdef CPP_PHYS
-!  CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
+  !#ifdef CPP_PHYS
+  !  CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
   !#endif
   !      CALL set_bands
   !#ifdef CPP_PHYS
-!  CALL Init_interface_dyn_phys
-!#endif
+  !  CALL Init_interface_dyn_phys
+  !#endif
   CALL barrier
 
@@ -177,18 +174,18 @@
 
   IF (calend == 'earth_360d') THEN
-     CALL ioconf_calendar('360_day')
-     WRITE(lunout,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an'
-     xios_cal_type='d360'
+    CALL ioconf_calendar('360_day')
+    WRITE(lunout, *)'CALENDRIER CHOISI: Terrestre a 360 jours/an'
+    xios_cal_type = 'd360'
   ELSE IF (calend == 'earth_365d') THEN
-     CALL ioconf_calendar('noleap')
-     WRITE(lunout,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an'
-     xios_cal_type='noleap'
+    CALL ioconf_calendar('noleap')
+    WRITE(lunout, *)'CALENDRIER CHOISI: Terrestre a 365 jours/an'
+    xios_cal_type = 'noleap'
   ELSE IF (calend == 'gregorian') THEN
-     CALL ioconf_calendar('gregorian')
-     WRITE(lunout,*)'CALENDRIER CHOISI: Terrestre bissextile'
-     xios_cal_type='gregorian'
+    CALL ioconf_calendar('gregorian')
+    WRITE(lunout, *)'CALENDRIER CHOISI: Terrestre bissextile'
+    xios_cal_type = 'gregorian'
   else
-     abort_message = 'Mauvais choix de calendrier'
-     CALL abort_gcm(modname,abort_message,1)
+    abort_message = 'Mauvais choix de calendrier'
+    CALL abort_gcm(modname, abort_message, 1)
   ENDIF
 
@@ -202,11 +199,11 @@
 
   ! Allocation de la tableau q : champs advectes   
-  ALLOCATE(ucov(ijb_u:ije_u,llm))
-  ALLOCATE(vcov(ijb_v:ije_v,llm))
-  ALLOCATE(teta(ijb_u:ije_u,llm))
-  ALLOCATE(masse(ijb_u:ije_u,llm))
+  ALLOCATE(ucov(ijb_u:ije_u, llm))
+  ALLOCATE(vcov(ijb_v:ije_v, llm))
+  ALLOCATE(teta(ijb_u:ije_u, llm))
+  ALLOCATE(masse(ijb_u:ije_u, llm))
   ALLOCATE(ps(ijb_u:ije_u))
   ALLOCATE(phis(ijb_u:ije_u))
-  ALLOCATE(q(ijb_u:ije_u,llm,nqtot))
+  ALLOCATE(q(ijb_u:ije_u, llm, nqtot))
 
   !-----------------------------------------------------------------------
@@ -216,31 +213,31 @@
   !  lecture du fichier start.nc
   IF (read_start) THEN
-     ! we still need to run iniacademic to initialize some
-     ! constants & fields, if we run the 'newtonian' or 'SW' cases:
-     IF (iflag_phys/=1) THEN
-        CALL iniacademic_loc(vcov,ucov,teta,q,masse,ps,phis,time_0)
-     endif
-
-     !        if (planet_type.EQ."earth") THEN
-     ! Load an Earth-format start file
-     CALL dynetat0_loc("start.nc",vcov,ucov, &
-          teta,q,masse,ps,phis, time_0)
-     !        endif ! of if (planet_type.EQ."earth")
-
-     !       WRITE(73,*) 'ucov',ucov
-     !       WRITE(74,*) 'vcov',vcov
-     !       WRITE(75,*) 'teta',teta
-     !       WRITE(76,*) 'ps',ps
-     !       WRITE(77,*) 'q',q
+    ! we still need to run iniacademic to initialize some
+    ! constants & fields, if we run the 'newtonian' or 'SW' cases:
+    IF (iflag_phys/=1) THEN
+      CALL iniacademic_loc(vcov, ucov, teta, q, masse, ps, phis, time_0)
+    endif
+
+    !        if (planet_type.EQ."earth") THEN
+    ! Load an Earth-format start file
+    CALL dynetat0_loc("start.nc", vcov, ucov, &
+            teta, q, masse, ps, phis, time_0)
+    !        endif ! of if (planet_type.EQ."earth")
+
+    !       WRITE(73,*) 'ucov',ucov
+    !       WRITE(74,*) 'vcov',vcov
+    !       WRITE(75,*) 'teta',teta
+    !       WRITE(76,*) 'ps',ps
+    !       WRITE(77,*) 'q',q
 
   ENDIF ! of if (read_start)
 
   ! le cas echeant, creation d un etat initial
-  IF (prt_level > 9) WRITE(lunout,*) &
-       'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT'
+  IF (prt_level > 9) WRITE(lunout, *) &
+          'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT'
   IF (.NOT.read_start) THEN
-     start_time=0.
-     annee_ref=anneeref
-     CALL iniacademic_loc(vcov,ucov,teta,q,masse,ps,phis,time_0)
+    start_time = 0.
+    annee_ref = anneeref
+    CALL iniacademic_loc(vcov, ucov, teta, q, masse, ps, phis, time_0)
   ENDIF
 
@@ -250,20 +247,20 @@
   !  on recalcule eventuellement le pas de temps
 
-  IF(MOD(day_step,iperiod)/=0) THEN
-     abort_message =  &
-          'Il faut choisir un nb de pas par jour multiple de iperiod'
-     CALL abort_gcm(modname,abort_message,1)
-  ENDIF
-
-  IF(MOD(day_step,iphysiq)/=0) THEN
-     abort_message =  &
-          'Il faut choisir un nb de pas par jour multiple de iphysiq'
-     CALL abort_gcm(modname,abort_message,1)
-  ENDIF
-
-  zdtvr    = daysec/REAL(day_step)
+  IF(MOD(day_step, iperiod)/=0) THEN
+    abort_message = &
+            'Il faut choisir un nb de pas par jour multiple de iperiod'
+    CALL abort_gcm(modname, abort_message, 1)
+  ENDIF
+
+  IF(MOD(day_step, iphysiq)/=0) THEN
+    abort_message = &
+            'Il faut choisir un nb de pas par jour multiple de iphysiq'
+    CALL abort_gcm(modname, abort_message, 1)
+  ENDIF
+
+  zdtvr = daysec / REAL(day_step)
   IF(dtvr/=zdtvr) THEN
-     WRITE(lunout,*) &
-          'WARNING!!! changement de pas de temps',dtvr,'>',zdtvr
+    WRITE(lunout, *) &
+            'WARNING!!! changement de pas de temps', dtvr, '>', zdtvr
   ENDIF
 
@@ -271,32 +268,32 @@
 
   IF (start_time /= starttime) THEN
-     WRITE(lunout,*)' GCM: Attention l''heure de depart lue dans le' &
-          ,' fichier restart ne correspond pas a celle lue dans le run.def'
-     IF (raz_date == 1) THEN
-        WRITE(lunout,*)'Je prends l''heure lue dans run.def'
-        start_time = starttime
-     ELSE
-        WRITE(lunout,*)'Je m''arrete'
-        CALL abort
-     ENDIF
+    WRITE(lunout, *)' GCM: Attention l''heure de depart lue dans le' &
+            , ' fichier restart ne correspond pas a celle lue dans le run.def'
+    IF (raz_date == 1) THEN
+      WRITE(lunout, *)'Je prends l''heure lue dans run.def'
+      start_time = starttime
+    ELSE
+      WRITE(lunout, *)'Je m''arrete'
+      CALL abort
+    ENDIF
   ENDIF
   IF (raz_date == 1) THEN
-     annee_ref = anneeref
-     day_ref = dayref
-     day_ini = dayref
-     itau_dyn = 0
-     itau_phy = 0
-     time_0 = 0.
-     WRITE(lunout,*) &
-          'GCM: On reinitialise a la date lue dans gcm.def'
+    annee_ref = anneeref
+    day_ref = dayref
+    day_ini = dayref
+    itau_dyn = 0
+    itau_phy = 0
+    time_0 = 0.
+    WRITE(lunout, *) &
+            'GCM: On reinitialise a la date lue dans gcm.def'
   ELSE IF (annee_ref /= anneeref .OR. day_ref /= dayref) THEN
-     WRITE(lunout,*) &
-          'GCM: Attention les dates initiales lues dans le fichier'
-     WRITE(lunout,*) &
-          ' restart ne correspondent pas a celles lues dans '
-     WRITE(lunout,*)' gcm.def'
-     WRITE(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
-     WRITE(lunout,*)' day_ref=',day_ref," dayref=",dayref
-     WRITE(lunout,*)' Pas de remise a zero'
+    WRITE(lunout, *) &
+            'GCM: Attention les dates initiales lues dans le fichier'
+    WRITE(lunout, *) &
+            ' restart ne correspondent pas a celles lues dans '
+    WRITE(lunout, *)' gcm.def'
+    WRITE(lunout, *)' annee_ref=', annee_ref, " anneeref=", anneeref
+    WRITE(lunout, *)' day_ref=', day_ref, " dayref=", dayref
+    WRITE(lunout, *)' Pas de remise a zero'
   ENDIF
   !      if (annee_ref .NE. anneeref .OR. day_ref .NE. dayref) THEN
@@ -333,29 +330,29 @@
   CALL ioconf_startdate(INT(jD_ref), jH_ref)
 
-  WRITE(lunout,*)'DEBUG'
-  WRITE(lunout,*)'annee_ref, mois, day_ref, heure, jD_ref'
-  WRITE(lunout,*)annee_ref, mois, day_ref, heure, jD_ref
-  CALL ju2ymds(jD_ref+jH_ref,anref, moisref, jourref, heureref)
-  WRITE(lunout,*)'jD_ref+jH_ref,an, mois, jour, heure'
-  WRITE(lunout,*)jD_ref+jH_ref,anref, moisref, jourref, heureref
+  WRITE(lunout, *)'DEBUG'
+  WRITE(lunout, *)'annee_ref, mois, day_ref, heure, jD_ref'
+  WRITE(lunout, *)annee_ref, mois, day_ref, heure, jD_ref
+  CALL ju2ymds(jD_ref + jH_ref, anref, moisref, jourref, heureref)
+  WRITE(lunout, *)'jD_ref+jH_ref,an, mois, jour, heure'
+  WRITE(lunout, *)jD_ref + jH_ref, anref, moisref, jourref, heureref
 
   IF (iflag_phys==1) THEN
-     ! these initialisations have already been done (via iniacademic)
-     ! if running in SW or Newtonian mode
-     !-----------------------------------------------------------------------
-     !   Initialisation des constantes dynamiques :
-     !   ------------------------------------------
-     dtvr = zdtvr
-     CALL iniconst
-
-     !-----------------------------------------------------------------------
-     !   Initialisation de la geometrie :
-     !   --------------------------------
-     CALL inigeom
-
-     !-----------------------------------------------------------------------
-     !   Initialisation du filtre :
-     !   --------------------------
-     CALL inifilr
+    ! these initialisations have already been done (via iniacademic)
+    ! if running in SW or Newtonian mode
+    !-----------------------------------------------------------------------
+    !   Initialisation des constantes dynamiques :
+    !   ------------------------------------------
+    dtvr = zdtvr
+    CALL iniconst
+
+    !-----------------------------------------------------------------------
+    !   Initialisation de la geometrie :
+    !   --------------------------------
+    CALL inigeom
+
+    !-----------------------------------------------------------------------
+    !   Initialisation du filtre :
+    !   --------------------------
+    CALL inifilr
   ENDIF ! of if (iflag_phys.EQ.1)
 
@@ -364,6 +361,6 @@
   !   ----------------------------------
 
-  CALL inidissip( lstardis, nitergdiv, nitergrot, niterh   , &
-       tetagdiv, tetagrot , tetatemp, vert_prof_dissip)
+  CALL inidissip(lstardis, nitergdiv, nitergrot, niterh, &
+          tetagdiv, tetagrot, tetatemp, vert_prof_dissip)
 
   !-----------------------------------------------------------------------
@@ -371,20 +368,19 @@
   !   ------------------------
 
-
   IF (nday>=0) THEN
-     day_end = day_ini + nday
+    day_end = day_ini + nday
   else
-     day_end = day_ini - nday/day_step
-  ENDIF
-
-  WRITE(lunout,300)day_ini,day_end
-300 FORMAT('1'/,15x,'run du jour',i7,2x,'au jour',i7//)
+    day_end = day_ini - nday / day_step
+  ENDIF
+
+  WRITE(lunout, 300)day_ini, day_end
+  300 FORMAT('1'/, 15x, 'run du jour', i7, 2x, 'au jour', i7//)
 
   CALL ju2ymds(jD_ref + day_ini - day_ref, an, mois, jour, heure)
-  write (lunout,301)jour, mois, an
+  write (lunout, 301)jour, mois, an
   CALL ju2ymds(jD_ref + day_end - day_ref, an, mois, jour, heure)
-  write (lunout,302)jour, mois, an
-301 FORMAT('1'/,15x,'run du ', i2,'/',i2,'/',i4)
-302 FORMAT('1'/,15x,'    au ', i2,'/',i2,'/',i4)
+  write (lunout, 302)jour, mois, an
+  301 FORMAT('1'/, 15x, 'run du ', i2, '/', i2, '/', i4)
+  302 FORMAT('1'/, 15x, '    au ', i2, '/', i2, '/', i4)
 
   !-----------------------------------------------------------------------
@@ -395,15 +391,15 @@
   !      istdyn=day_step/4     ! stockage toutes les 6h=1jour/4
   !      istdyn=day_step/12     ! stockage toutes les 2h=1jour/12
-  istdyn=day_step/8     ! stockage toutes les 6h=1jour/12
-  istphy=istdyn/iphysiq
+  istdyn = day_step / 8     ! stockage toutes les 6h=1jour/12
+  istphy = istdyn / iphysiq
 
   IF ((iflag_phys==1).OR.(iflag_phys>=100)) THEN
-     ! Physics:
+    ! Physics:
     IF (CPPKEY_PHYS) THEN
-      CALL iniphysiq(iim,jjm,llm, &
-            distrib_phys(mpi_rank),comm_lmdz, &
-            daysec,day_ini,dtphys/nsplit_phys, &
-            rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
-            iflag_phys)
+      CALL iniphysiq(iim, jjm, llm, &
+              distrib_phys(mpi_rank), comm_lmdz, &
+              daysec, day_ini, dtphys / nsplit_phys, &
+              rlatu, rlatv, rlonu, rlonv, aire, cu, cv, rad, g, r, cpp, &
+              iflag_phys)
     END IF
   ENDIF ! of IF ((iflag_phys==1).OR.(iflag_phys>=100))
@@ -418,25 +414,25 @@
 
   time_step = zdtvr
-     IF (ok_dyn_ins) THEN
-        ! initialize output file for instantaneous outputs
-        ! t_ops = iecri * daysec ! do operations every t_ops
-        t_ops =((1.0*iecri)/day_step) * daysec
-        t_wrt = daysec ! iecri * daysec ! write output every t_wrt
-        CALL inithist_loc(day_ref,annee_ref,time_step, &
-             t_ops,t_wrt)
-     endif
-
-     IF (ok_dyn_ave) THEN
-        ! initialize output file for averaged outputs
-        t_ops = iperiod * time_step ! do operations every t_ops
-        t_wrt = periodav * daysec   ! write output every t_wrt
-        CALL initdynav_loc(day_ref,annee_ref,time_step,t_ops,t_wrt)
-     END IF
-  dtav = iperiod*dtvr/daysec
-
-! setting up DYN3D/XIOS inerface
+  IF (ok_dyn_ins) THEN
+    ! initialize output file for instantaneous outputs
+    ! t_ops = iecri * daysec ! do operations every t_ops
+    t_ops = ((1.0 * iecri) / day_step) * daysec
+    t_wrt = daysec ! iecri * daysec ! write output every t_wrt
+    CALL inithist_loc(day_ref, annee_ref, time_step, &
+            t_ops, t_wrt)
+  endif
+
+  IF (ok_dyn_ave) THEN
+    ! initialize output file for averaged outputs
+    t_ops = iperiod * time_step ! do operations every t_ops
+    t_wrt = periodav * daysec   ! write output every t_wrt
+    CALL initdynav_loc(day_ref, annee_ref, time_step, t_ops, t_wrt)
+  END IF
+  dtav = iperiod * dtvr / daysec
+
+  ! setting up DYN3D/XIOS inerface
   IF (ok_dyn_xios) THEN
-      CALL xios_dyn3dmem_init(xios_cal_type, anref, moisref, jourref,heureref, an,   &
-          mois, jour, heure, zdtvr)
+    CALL xios_dyn3dmem_init(xios_cal_type, anref, moisref, jourref, heureref, an, &
+            mois, jour, heure, zdtvr)
   ENDIF
 
@@ -460,5 +456,5 @@
   !$OMP COPYIN(ok_strato,ok_gradsfile,ok_limit,ok_etat0) &
   !$OMP COPYIN(iflag_phys,iflag_trac,adv_qsat_liq)
-  CALL leapfrog_loc(ucov,vcov,teta,ps,masse,phis,q,time_0)
+  CALL leapfrog_loc(ucov, vcov, teta, ps, masse, phis, q, time_0)
   !$OMP END PARALLEL
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_conf_gcm.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_conf_gcm.f90	(revision 5186)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_conf_gcm.f90	(revision 5186)
@@ -0,0 +1,1032 @@
+MODULE lmdz_conf_gcm
+  IMPLICIT NONE; PRIVATE
+  PUBLIC conf_gcm
+
+CONTAINS
+
+  SUBROUTINE conf_gcm(tapedef, etatinit)
+
+    USE control_mod
+    USE IOIPSL
+    USE misc_mod
+    USE lmdz_filtre_fft, ONLY: use_filtre_fft
+    USE lmdz_filtre_fft_loc, ONLY: use_filtre_fft_loc => use_filtre_fft
+    USE mod_hallo, ONLY: use_mpi_alloc
+    USE lmdz_infotrac, ONLY: type_trac
+    USE lmdz_assert, ONLY: assert
+    USE comconst_mod, ONLY: dissip_deltaz, dissip_factz, dissip_zref, &
+            iflag_top_bound, mode_top_bound, tau_top_bound, &
+            ngroup, maxlatfilter
+    USE logic_mod, ONLY: fxyhypb, iflag_phys, ok_etat0, ok_gradsfile, &
+            ok_guide, ok_limit, ok_strato, purmats, read_start, &
+            ysinus, read_orop, adv_qsat_liq
+    USE serre_mod, ONLY: clon, clat, grossismx, grossismy, dzoomx, dzoomy, &
+            alphax, alphay, taux, tauy
+    USE temps_mod, ONLY: calend, year_len, offline_time
+    USE lmdz_iniprint, ONLY: lunout, prt_level
+    USE lmdz_comdissnew, ONLY: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, &
+            tetagrot, tetatemp, coefdis, vert_prof_dissip
+
+    USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
+    USE lmdz_paramet
+    IMPLICIT NONE
+    !-----------------------------------------------------------------------
+    !     Auteurs :   L. Fairhead , P. Le Van  .
+
+    !     Arguments :
+
+    !     tapedef   :
+    !     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
+    !     -metres  du zoom  avec  celles lues sur le fichier start .
+
+    LOGICAL, INTENT(IN) :: etatinit
+    INTEGER, INTENT(IN) :: tapedef
+
+    !   Declarations :
+    !   --------------
+
+
+
+    !   local:
+    !   ------
+
+    CHARACTER ch1*72, ch2*72, ch3*72, ch4*12
+    REAL clonn, clatt, grossismxx, grossismyy
+    REAL dzoomxx, dzoomyy, tauxx, tauyy
+    LOGICAL  fxyhypbb, ysinuss
+    INTEGER i
+    CHARACTER(len = *), PARAMETER :: modname = "conf_gcm"
+    CHARACTER(len = 80) :: abort_message
+#ifdef CPP_OMP
+  INTEGER, EXTERNAL :: OMP_GET_NUM_THREADS
+#endif
+
+    !  -------------------------------------------------------------------
+
+    !       .........     Version  du 29/04/97       ..........
+
+    !   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
+    !      tetatemp   ajoutes  pour la dissipation   .
+
+    !   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
+
+    !  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
+    !    Sinon , choix de fxynew  , a derivee sinusoidale  ..
+
+    !   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
+    !         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
+    !                de limit.dat ( dic)                        ...........
+    !           Sinon  etatinit = . FALSE .
+
+    !   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
+    !    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
+    !   celles passees  par run.def ,  au debut du gcm, apres l'appel a
+    !    lectba .
+    !   Ces parmetres definissant entre autres la grille et doivent etre
+    !   pareils et coherents , sinon il y aura  divergence du gcm .
+
+    !-----------------------------------------------------------------------
+    !   initialisations:
+    !   ----------------
+
+    !Config  Key  = lunout
+    !Config  Desc = unite de fichier pour les impressions
+    !Config  Def  = 6
+    !Config  Help = unite de fichier pour les impressions
+    !Config         (defaut sortie standard = 6)
+    lunout = 6
+    CALL getin('lunout', lunout)
+    IF (lunout /= 5 .AND. lunout /= 6) THEN
+      OPEN(UNIT = lunout, FILE = 'lmdz.out_0000', ACTION = 'write', &
+              STATUS = 'unknown', FORM = 'formatted')
+    ENDIF
+
+    adjust = .FALSE.
+    CALL getin('adjust', adjust)
+
+#ifdef CPP_OMP
+  ! adjust=y not implemented in case of OpenMP threads...
+  !$OMP PARALLEL
+  IF ((OMP_GET_NUM_THREADS()>1).AND.adjust) THEN
+     WRITE(lunout,*)'conf_gcm: Error, adjust should be set to n' &
+          ,' when running with OpenMP threads'
+     abort_message = 'Wrong value for adjust'
+     CALL abort_gcm(modname,abort_message,1)
+  ENDIF
+  !$OMP END PARALLEL         
+#endif
+
+    itaumax = 0
+    CALL getin('itaumax', itaumax);
+    IF (itaumax<=0) itaumax = HUGE(itaumax)
+
+    !Config  Key  = prt_level
+    !Config  Desc = niveau d'impressions de débogage
+    !Config  Def  = 0
+    !Config  Help = Niveau d'impression pour le débogage
+    !Config         (0 = minimum d'impression)
+    prt_level = 0
+    CALL getin('prt_level', prt_level)
+
+    !-----------------------------------------------------------------------
+    !  Parametres de controle du run:
+    !-----------------------------------------------------------------------
+    !Config  Key  = planet_type
+    !Config  Desc = planet type ("earth", "mars", "venus", ...)
+    !Config  Def  = earth
+    !Config  Help = this flag sets the type of atymosphere that is considered
+    planet_type = "earth"
+    CALL getin('planet_type', planet_type)
+
+    !Config  Key  = calend
+    !Config  Desc = type de calendrier utilise
+    !Config  Def  = earth_360d
+    !Config  Help = valeur possible: earth_360d, earth_365d, earth_366d
+    !Config
+    calend = 'earth_360d'
+    ! initialize year_len for aquaplanets and 1D
+    CALL getin('calend', calend)
+    IF (calend == 'earth_360d') THEN
+      year_len = 360
+    ELSE IF (calend == 'earth_365d') THEN
+      year_len = 365
+    ELSE IF (calend == 'earth_366d') THEN
+      year_len = 366
+    ELSE
+      year_len = 1
+    ENDIF
+
+    !Config  Key  = dayref
+    !Config  Desc = Jour de l'etat initial
+    !Config  Def  = 1
+    !Config  Help = Jour de l'etat initial ( = 350  si 20 Decembre ,
+    !Config         par expl. ,comme ici ) ... A completer
+    dayref = 1
+    CALL getin('dayref', dayref)
+
+    !Config  Key  = anneeref
+    !Config  Desc = Annee de l'etat initial
+    !Config  Def  = 1998
+    !Config  Help = Annee de l'etat  initial
+    !Config         (   avec  4  chiffres   ) ... A completer
+    anneeref = 1998
+    CALL getin('anneeref', anneeref)
+
+    !Config  Key  = raz_date
+    !Config  Desc = Remise a zero de la date initiale
+    !Config  Def  = 0 (pas de remise a zero)
+    !Config  Help = Remise a zero de la date initiale
+    !Config         0 pas de remise a zero, on garde la date du fichier restart
+    !Config         1 prise en compte de la date de gcm.def avec remise a zero
+    !Config         des compteurs de pas de temps
+    raz_date = 0
+    CALL getin('raz_date', raz_date)
+
+    !Config  Key  = resetvarc
+    !Config  Desc = Reinit des variables de controle
+    !Config  Def  = n
+    !Config  Help = Reinit des variables de controle
+    resetvarc = .FALSE.
+    CALL getin('resetvarc', resetvarc)
+
+    !Config  Key  = nday
+    !Config  Desc = Nombre de jours d'integration
+    !Config  Def  = 10
+    !Config  Help = Nombre de jours d'integration
+    !Config         ... On pourait aussi permettre des mois ou des annees !
+    nday = 10
+    CALL getin('nday', nday)
+
+    !Config  Key  = starttime
+    !Config  Desc = Heure de depart de la simulation
+    !Config  Def  = 0
+    !Config  Help = Heure de depart de la simulation
+    !Config         en jour
+    starttime = 0
+    CALL getin('starttime', starttime)
+
+    !Config  Key  = day_step
+    !Config  Desc = nombre de pas par jour
+    !Config  Def  = 240
+    !Config  Help = nombre de pas par jour (multiple de iperiod) (
+    !Config          ici pour  dt = 1 min )
+    day_step = 240
+    CALL getin('day_step', day_step)
+
+    !Config  Key  = nsplit_phys
+    nsplit_phys = 1
+    CALL getin('nsplit_phys', nsplit_phys)
+
+    !Config  Key  = iperiod
+    !Config  Desc = periode pour le pas Matsuno
+    !Config  Def  = 5
+    !Config  Help = periode pour le pas Matsuno (en pas de temps)
+    iperiod = 5
+    CALL getin('iperiod', iperiod)
+
+    !Config  Key  = iapp_tracvl
+    !Config  Desc = frequence du groupement des flux
+    !Config  Def  = iperiod
+    !Config  Help = frequence du groupement des flux (en pas de temps)
+    iapp_tracvl = iperiod
+    CALL getin('iapp_tracvl', iapp_tracvl)
+
+    !Config  Key  = iconser
+    !Config  Desc = periode de sortie des variables de controle
+    !Config  Def  = 240
+    !Config  Help = periode de sortie des variables de controle
+    !Config         (En pas de temps)
+    iconser = 240
+    CALL getin('iconser', iconser)
+
+    !Config  Key  = iecri
+    !Config  Desc = periode d'ecriture du fichier histoire
+    !Config  Def  = 1
+    !Config  Help = periode d'ecriture du fichier histoire (en jour)
+    iecri = 1
+    CALL getin('iecri', iecri)
+
+    !Config  Key  = periodav
+    !Config  Desc = periode de stockage fichier histmoy
+    !Config  Def  = 1
+    !Config  Help = periode de stockage fichier histmoy (en jour)
+    periodav = 1.
+    CALL getin('periodav', periodav)
+
+    !Config  Key  = output_grads_dyn
+    !Config  Desc = output dynamics diagnostics in 'dyn.dat' file
+    !Config  Def  = n
+    !Config  Help = output dynamics diagnostics in Grads-readable 'dyn.dat' file
+    output_grads_dyn = .FALSE.
+    CALL getin('output_grads_dyn', output_grads_dyn)
+
+    !Config  Key  = dissip_period
+    !Config  Desc = periode de la dissipation
+    !Config  Def  = 0
+    !Config  Help = periode de la dissipation
+    !Config  dissip_period=0 => la valeur sera calcule dans inidissip
+    !Config  dissip_period>0 => on prend cette valeur
+    dissip_period = 0
+    CALL getin('dissip_period', dissip_period)
+
+    !cc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
+    !cc
+
+    !Config  Key  = lstardis
+    !Config  Desc = choix de l'operateur de dissipation
+    !Config  Def  = y
+    !Config  Help = choix de l'operateur de dissipation
+    !Config         'y' si on veut star et 'n' si on veut non-start !
+    !Config         Moi y en a pas comprendre !
+    lstardis = .TRUE.
+    CALL getin('lstardis', lstardis)
+
+    !Config  Key  = nitergdiv
+    !Config  Desc = Nombre d'iteration de gradiv
+    !Config  Def  = 1
+    !Config  Help = nombre d'iterations de l'operateur de dissipation
+    !Config         gradiv
+    nitergdiv = 1
+    CALL getin('nitergdiv', nitergdiv)
+
+    !Config  Key  = nitergrot
+    !Config  Desc = nombre d'iterations de nxgradrot
+    !Config  Def  = 2
+    !Config  Help = nombre d'iterations de l'operateur de dissipation
+    !Config         nxgradrot
+    nitergrot = 2
+    CALL getin('nitergrot', nitergrot)
+
+    !Config  Key  = niterh
+    !Config  Desc = nombre d'iterations de divgrad
+    !Config  Def  = 2
+    !Config  Help = nombre d'iterations de l'operateur de dissipation
+    !Config         divgrad
+    niterh = 2
+    CALL getin('niterh', niterh)
+
+    !Config  Key  = tetagdiv
+    !Config  Desc = temps de dissipation pour div
+    !Config  Def  = 7200
+    !Config  Help = temps de dissipation des plus petites longeur
+    !Config         d'ondes pour u,v (gradiv)
+    tetagdiv = 7200.
+    CALL getin('tetagdiv', tetagdiv)
+
+    !Config  Key  = tetagrot
+    !Config  Desc = temps de dissipation pour grad
+    !Config  Def  = 7200
+    !Config  Help = temps de dissipation des plus petites longeur
+    !Config         d'ondes pour u,v (nxgradrot)
+    tetagrot = 7200.
+    CALL getin('tetagrot', tetagrot)
+
+    !Config  Key  = tetatemp
+    !Config  Desc = temps de dissipation pour h
+    !Config  Def  = 7200
+    !Config  Help =  temps de dissipation des plus petites longeur
+    !Config         d'ondes pour h (divgrad)
+    tetatemp = 7200.
+    CALL getin('tetatemp', tetatemp)
+
+    ! Parametres controlant la variation sur la verticale des constantes de
+    ! dissipation.
+    ! Pour le moment actifs uniquement dans la version a 39 niveaux
+    ! avec ok_strato=y
+
+    dissip_factz = 4.
+    dissip_deltaz = 10.
+    dissip_zref = 30.
+    CALL getin('dissip_factz', dissip_factz)
+    CALL getin('dissip_deltaz', dissip_deltaz)
+    CALL getin('dissip_zref', dissip_zref)
+
+
+    !maxlatfilter
+    maxlatfilter = -1.0
+    CALL getin('maxlatfilter', maxlatfilter)
+    IF (maxlatfilter > 90) &
+            CALL abort_gcm("conf_gcm", 'maxlatfilter should be <=90', 1)
+
+
+    ! ngroup
+    ngroup = 3
+    CALL getin('ngroup', ngroup)
+    IF (mod(iim, 2**ngroup) /= 0) &
+            CALL abort_gcm("conf_gcm", 'iim must be multiple of 2**ngroup', 1)
+    IF (2**ngroup > jjm + 1) &
+            CALL abort_gcm("conf_gcm", '2**ngroup must be <= jjm + 1', 1)
+
+    ! mode_top_bound : fields towards which sponge relaxation will be done:
+    ! top_bound sponge: only active if ok_strato=.TRUE. and iflag_top_bound!=0
+    !                   iflag_top_bound=0 for no sponge
+    !                   iflag_top_bound=1 for sponge over 4 topmost layers
+    !                   iflag_top_bound=2 for sponge from top to ~1% of top layer pressure
+    iflag_top_bound = 1
+    CALL getin('iflag_top_bound', iflag_top_bound)
+    IF (iflag_top_bound < 0 .OR. iflag_top_bound > 2) &
+            CALL abort_gcm("conf_gcm", 'iflag_top_bound must be 0, 1 or 2', 1)
+
+    ! mode_top_bound : fields towards which sponge relaxation will be done:
+    !                  mode_top_bound=0: no relaxation
+    !                  mode_top_bound=1: u and v relax towards 0
+    !                  mode_top_bound=2: u and v relax towards their zonal mean
+    !                  mode_top_bound=3: u,v and pot. temp. relax towards their zonal mean
+    mode_top_bound = 3
+    CALL getin('mode_top_bound', mode_top_bound)
+
+    ! top_bound sponge : inverse of charactericstic relaxation time scale for sponge
+    tau_top_bound = 1.e-5
+    CALL getin('tau_top_bound', tau_top_bound)
+
+    !Config  Key  = coefdis
+    !Config  Desc = coefficient pour gamdissip
+    !Config  Def  = 0
+    !Config  Help = coefficient pour gamdissip
+    coefdis = 0.
+    CALL getin('coefdis', coefdis)
+
+    !Config  Key  = purmats
+    !Config  Desc = Schema d'integration
+    !Config  Def  = n
+    !Config  Help = Choix du schema d'integration temporel.
+    !Config         y = pure Matsuno sinon c'est du Matsuno-leapfrog
+    purmats = .FALSE.
+    CALL getin('purmats', purmats)
+
+    !Config  Key  = ok_guide
+    !Config  Desc = Guidage
+    !Config  Def  = n
+    !Config  Help = Guidage
+    ok_guide = .FALSE.
+    CALL getin('ok_guide', ok_guide)
+
+    IF (ok_guide .AND. adjust) CALL abort_gcm("conf_gcm", &
+            "adjust does not work with ok_guide", 1)
+
+    !Config  Key  =  read_start
+    !Config  Desc = Initialize model using a 'start.nc' file
+    !Config  Def  = y
+    !Config  Help = y: intialize dynamical fields using a 'start.nc' file
+    !               n: fields are initialized by 'iniacademic' routine
+    read_start = .TRUE.
+    CALL getin('read_start', read_start)
+
+    !Config  Key  = iflag_phys
+    !Config  Desc = Avec ls physique
+    !Config  Def  = 1
+    !Config  Help = Permet de faire tourner le modele sans
+    !Config         physique.
+    iflag_phys = 1
+    CALL getin('iflag_phys', iflag_phys)
+
+    !Config  Key  =  iphysiq
+    !Config  Desc = Periode de la physique
+    !Config  Def  = 5
+    !Config  Help = Periode de la physique en pas de temps de la dynamique.
+    iphysiq = 5
+    CALL getin('iphysiq', iphysiq)
+
+    !Config  Key  = ip_ebil_dyn
+    !Config  Desc = PRINT level for energy conserv. diag.
+    !Config  Def  = 0
+    !Config  Help = PRINT level for energy conservation diag. ;
+    !               les options suivantes existent :
+    !Config         0 pas de print
+    !Config         1 pas de print
+    !Config         2 print,
+    ip_ebil_dyn = 0
+    CALL getin('ip_ebil_dyn', ip_ebil_dyn)
+
+    !cc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
+    !     .........   (  modif  le 17/04/96 )   .........
+
+    test_etatinit: IF (.NOT. etatinit) THEN
+      !Config  Key  = clon
+      !Config  Desc = centre du zoom, longitude
+      !Config  Def  = 0
+      !Config  Help = longitude en degres du centre
+      !Config         du zoom
+      clonn = 0.
+      CALL getin('clon', clonn)
+
+      !Config  Key  = clat
+      !Config  Desc = centre du zoom, latitude
+      !Config  Def  = 0
+      !Config  Help = latitude en degres du centre du zoom
+      !Config
+      clatt = 0.
+      CALL getin('clat', clatt)
+
+      IF(ABS(clat - clatt)>= 0.001)  THEN
+        WRITE(lunout, *)'conf_gcm: La valeur de clat passee par run.def', &
+                ' est differente de celle lue sur le fichier  start '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ENDIF
+
+      !Config  Key  = grossismx
+      !Config  Desc = zoom en longitude
+      !Config  Def  = 1.0
+      !Config  Help = facteur de grossissement du zoom,
+      !Config         selon la longitude
+      grossismxx = 1.0
+      CALL getin('grossismx', grossismxx)
+
+      IF(ABS(grossismx - grossismxx)>= 0.001)  THEN
+        WRITE(lunout, *)'conf_gcm: La valeur de grossismx passee par ', &
+                'run.def est differente de celle lue sur le fichier  start '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ENDIF
+
+      !Config  Key  = grossismy
+      !Config  Desc = zoom en latitude
+      !Config  Def  = 1.0
+      !Config  Help = facteur de grossissement du zoom,
+      !Config         selon la latitude
+      grossismyy = 1.0
+      CALL getin('grossismy', grossismyy)
+
+      IF(ABS(grossismy - grossismyy)>= 0.001)  THEN
+        WRITE(lunout, *)'conf_gcm: La valeur de grossismy passee par ', &
+                'run.def est differente de celle lue sur le fichier  start '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ENDIF
+
+      IF(grossismx<1.)  THEN
+        WRITE(lunout, *) &
+                'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ELSE
+        alphax = 1. - 1. / grossismx
+      ENDIF
+
+      IF(grossismy<1.)  THEN
+        WRITE(lunout, *) &
+                'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ELSE
+        alphay = 1. - 1. / grossismy
+      ENDIF
+
+      WRITE(lunout, *)'conf_gcm: alphax alphay', alphax, alphay
+
+      !    alphax et alphay sont les anciennes formulat. des grossissements
+
+      !Config  Key  = fxyhypb
+      !Config  Desc = Fonction  hyperbolique
+      !Config  Def  = y
+      !Config  Help = Fonction  f(y)  hyperbolique  si = .TRUE.
+      !Config         sinon  sinusoidale
+      fxyhypbb = .TRUE.
+      CALL getin('fxyhypb', fxyhypbb)
+
+      IF(.NOT.fxyhypb)  THEN
+        IF(fxyhypbb)     THEN
+          WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+          WRITE(lunout, *)' *** fxyhypb lu sur le fichier start est ', &
+                  'F alors  qu il est  T  sur  run.def  ***'
+          CALL abort_gcm("conf_gcm", "stopped", 1)
+        ENDIF
+      ELSE
+        IF(.NOT.fxyhypbb)   THEN
+          WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+          WRITE(lunout, *)' ***  fxyhypb lu sur le fichier start est ', &
+                  'T alors  qu il est  F  sur  run.def  ****  '
+          CALL abort_gcm("conf_gcm", "stopped", 1)
+        ENDIF
+      ENDIF
+
+      !Config  Key  = dzoomx
+      !Config  Desc = extension en longitude
+      !Config  Def  = 0
+      !Config  Help = extension en longitude  de la zone du zoom
+      !Config         ( fraction de la zone totale)
+      dzoomxx = 0.0
+      CALL getin('dzoomx', dzoomxx)
+
+      IF(fxyhypb)  THEN
+        IF(ABS(dzoomx - dzoomxx)>= 0.001)  THEN
+          WRITE(lunout, *)'conf_gcm: La valeur de dzoomx passee par ', &
+                  'run.def est differente de celle lue sur le fichier  start '
+          CALL abort_gcm("conf_gcm", "stopped", 1)
+        ENDIF
+      ENDIF
+
+      !Config  Key  = dzoomy
+      !Config  Desc = extension en latitude
+      !Config  Def  = 0
+      !Config  Help = extension en latitude de la zone  du zoom
+      !Config         ( fraction de la zone totale)
+      dzoomyy = 0.0
+      CALL getin('dzoomy', dzoomyy)
+
+      IF(fxyhypb)  THEN
+        IF(ABS(dzoomy - dzoomyy)>= 0.001)  THEN
+          WRITE(lunout, *)'conf_gcm: La valeur de dzoomy passee par ', &
+                  'run.def est differente de celle lue sur le fichier  start '
+          CALL abort_gcm("conf_gcm", "stopped", 1)
+        ENDIF
+      ENDIF
+
+      !Config  Key  = taux
+      !Config  Desc = raideur du zoom en  X
+      !Config  Def  = 3
+      !Config  Help = raideur du zoom en  X
+      tauxx = 3.0
+      CALL getin('taux', tauxx)
+
+      IF(fxyhypb)  THEN
+        IF(ABS(taux - tauxx)>= 0.001)  THEN
+          WRITE(lunout, *)'conf_gcm: La valeur de taux passee par ', &
+                  'run.def est differente de celle lue sur le fichier  start '
+          CALL abort_gcm("conf_gcm", "stopped", 1)
+        ENDIF
+      ENDIF
+
+      !Config  Key  = tauyy
+      !Config  Desc = raideur du zoom en  Y
+      !Config  Def  = 3
+      !Config  Help = raideur du zoom en  Y
+      tauyy = 3.0
+      CALL getin('tauy', tauyy)
+
+      IF(fxyhypb)  THEN
+        IF(ABS(tauy - tauyy)>= 0.001)  THEN
+          WRITE(lunout, *)'conf_gcm: La valeur de tauy passee par ', &
+                  'run.def est differente de celle lue sur le fichier  start '
+          CALL abort_gcm("conf_gcm", "stopped", 1)
+        ENDIF
+      ENDIF
+
+      !c
+      IF(.NOT.fxyhypb)  THEN
+
+        !Config  Key  = ysinus
+        !Config  IF   = !fxyhypb
+        !Config  Desc = Fonction en Sinus
+        !Config  Def  = y
+        !Config  Help = Fonction  f(y) avec y = Sin(latit.) si = .TRUE.
+        !Config         sinon y = latit.
+        ysinuss = .TRUE.
+        CALL getin('ysinus', ysinuss)
+
+        IF(.NOT.ysinus)  THEN
+          IF(ysinuss)     THEN
+            WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+            WRITE(lunout, *)' *** ysinus lu sur le fichier start est F', &
+                    ' alors  qu il est  T  sur  run.def  ***'
+            CALL abort_gcm("conf_gcm", "stopped", 1)
+          ENDIF
+        ELSE
+          IF(.NOT.ysinuss)   THEN
+            WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+            WRITE(lunout, *)' *** ysinus lu sur le fichier start est T', &
+                    ' alors  qu il est  F  sur  run.def  ****  '
+            CALL abort_gcm("conf_gcm", "stopped", 1)
+          ENDIF
+        ENDIF
+      ENDIF ! of IF( .NOT.fxyhypb  )
+
+      !Config  Key  = offline
+      !Config  Desc = ecriture des flux de masse
+      !Config  Def  = n
+      !Config  Help = Permet de sortir les flux de masse sur la grille plev
+      offline = .FALSE.
+      CALL getin('offline', offline)
+
+      !Config Key  = offline_time
+      !Config Desc =  Choix des frequences de stockage pour le offline
+      !Config Def  = 8
+      !Config Help = offline_time=12     ! stockage toutes les 2h=1jour/12
+      !Config Help = offline_time=8      ! stockage toutes les 3h=1jour/8
+      offline_time = 8
+      CALL getin('offline_time', offline_time)
+
+      IF (offline .AND. adjust) THEN
+        WRITE(lunout, *)  &
+                'WARNING : option offline does not work with adjust=y :'
+        WRITE(lunout, *) 'the files defstoke.nc, fluxstoke.nc ', &
+                'and fluxstokev.nc will not be created'
+        WRITE(lunout, *)  &
+                'only the file phystoke.nc will still be created '
+      ENDIF
+
+      !Config  Key  = type_trac
+      !Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
+      !Config  Def  = lmdz
+      !Config  Help =
+      !Config         'lmdz' = pas de couplage, pur LMDZ
+      !Config         'inca' = model de chime INCA
+      !Config         'repr' = model de chime REPROBUS
+      type_trac = 'lmdz'
+      CALL getin('type_trac', type_trac)
+
+
+      !Config  Key  = adv_qsat_liq
+      !Config  Desc = option for qsat calculation in the dynamics
+      !Config  Def  = n
+      !Config  Help = controls which phase is considered for qsat calculation
+      !Config
+      adv_qsat_liq = .FALSE.
+      CALL getin('adv_qsat_liq', adv_qsat_liq)
+
+      !Config  Key  = ok_dynzon
+      !Config  Desc = calcul et sortie des transports
+      !Config  Def  = n
+      !Config  Help = Permet de mettre en route le calcul des transports
+      !Config
+      ok_dynzon = .FALSE.
+      CALL getin('ok_dynzon', ok_dynzon)
+
+      !Config  Key  = ok_dyn_ins
+      !Config  Desc = sorties instantanees dans la dynamique
+      !Config  Def  = n
+      !Config  Help =
+      !Config
+      ok_dyn_ins = .FALSE.
+      CALL getin('ok_dyn_ins', ok_dyn_ins)
+
+      !Config  Key  = ok_dyn_ave
+      !Config  Desc = sorties moyennes dans la dynamique
+      !Config  Def  = n
+      !Config  Help =
+      !Config
+      ok_dyn_ave = .FALSE.
+      CALL getin('ok_dyn_ave', ok_dyn_ave)
+
+      !Config  Key  = ok_dyn_xios
+      !Config  Desc = sorties moyennes dans la dynamique
+      !Config  Def  = n
+      !Config  Help =
+      !Config
+      ok_dyn_xios = .FALSE.
+      CALL getin('ok_dyn_xios', ok_dyn_xios)
+
+      WRITE(lunout, *)' #########################################'
+      WRITE(lunout, *)' Configuration des parametres du gcm: '
+      WRITE(lunout, *)' planet_type = ', planet_type
+      WRITE(lunout, *)' calend = ', calend
+      WRITE(lunout, *)' dayref = ', dayref
+      WRITE(lunout, *)' anneeref = ', anneeref
+      WRITE(lunout, *)' nday = ', nday
+      WRITE(lunout, *)' day_step = ', day_step
+      WRITE(lunout, *)' iperiod = ', iperiod
+      WRITE(lunout, *)' nsplit_phys = ', nsplit_phys
+      WRITE(lunout, *)' iconser = ', iconser
+      WRITE(lunout, *)' iecri = ', iecri
+      WRITE(lunout, *)' periodav = ', periodav
+      WRITE(lunout, *)' output_grads_dyn = ', output_grads_dyn
+      WRITE(lunout, *)' dissip_period = ', dissip_period
+      WRITE(lunout, *)' lstardis = ', lstardis
+      WRITE(lunout, *)' nitergdiv = ', nitergdiv
+      WRITE(lunout, *)' nitergrot = ', nitergrot
+      WRITE(lunout, *)' niterh = ', niterh
+      WRITE(lunout, *)' tetagdiv = ', tetagdiv
+      WRITE(lunout, *)' tetagrot = ', tetagrot
+      WRITE(lunout, *)' tetatemp = ', tetatemp
+      WRITE(lunout, *)' coefdis = ', coefdis
+      WRITE(lunout, *)' purmats = ', purmats
+      WRITE(lunout, *)' read_start = ', read_start
+      WRITE(lunout, *)' iflag_phys = ', iflag_phys
+      WRITE(lunout, *)' iphysiq = ', iphysiq
+      WRITE(lunout, *)' clonn = ', clonn
+      WRITE(lunout, *)' clatt = ', clatt
+      WRITE(lunout, *)' grossismx = ', grossismx
+      WRITE(lunout, *)' grossismy = ', grossismy
+      WRITE(lunout, *)' fxyhypbb = ', fxyhypbb
+      WRITE(lunout, *)' dzoomxx = ', dzoomxx
+      WRITE(lunout, *)' dzoomy = ', dzoomyy
+      WRITE(lunout, *)' tauxx = ', tauxx
+      WRITE(lunout, *)' tauyy = ', tauyy
+      WRITE(lunout, *)' offline = ', offline
+      WRITE(lunout, *)' offline_time = ', offline_time
+      WRITE(lunout, *)' type_trac = ', type_trac
+      WRITE(lunout, *)' ok_dynzon = ', ok_dynzon
+      WRITE(lunout, *)' ok_dyn_ins = ', ok_dyn_ins
+      WRITE(lunout, *)' ok_dyn_ave = ', ok_dyn_ave
+      WRITE(lunout, *)' ok_dyn_xios = ', ok_dyn_xios
+      WRITE(lunout, *)' adv_qsat_liq = ', adv_qsat_liq
+    else
+      !Config  Key  = clon
+      !Config  Desc = centre du zoom, longitude
+      !Config  Def  = 0
+      !Config  Help = longitude en degres du centre
+      !Config         du zoom
+      clon = 0.
+      CALL getin('clon', clon)
+
+      !Config  Key  = clat
+      !Config  Desc = centre du zoom, latitude
+      !Config  Def  = 0
+      !Config  Help = latitude en degres du centre du zoom
+      !Config
+      clat = 0.
+      CALL getin('clat', clat)
+
+      !Config  Key  = grossismx
+      !Config  Desc = zoom en longitude
+      !Config  Def  = 1.0
+      !Config  Help = facteur de grossissement du zoom,
+      !Config         selon la longitude
+      grossismx = 1.0
+      CALL getin('grossismx', grossismx)
+
+      !Config  Key  = grossismy
+      !Config  Desc = zoom en latitude
+      !Config  Def  = 1.0
+      !Config  Help = facteur de grossissement du zoom,
+      !Config         selon la latitude
+      grossismy = 1.0
+      CALL getin('grossismy', grossismy)
+
+      IF(grossismx<1.)  THEN
+        WRITE(lunout, *) 'conf_gcm: ***ATTENTION !! grossismx < 1 . *** '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ELSE
+        alphax = 1. - 1. / grossismx
+      ENDIF
+
+      IF(grossismy<1.)  THEN
+        WRITE(lunout, *) 'conf_gcm: ***ATTENTION !! grossismy < 1 . *** '
+        CALL abort_gcm("conf_gcm", "stopped", 1)
+      ELSE
+        alphay = 1. - 1. / grossismy
+      ENDIF
+
+      WRITE(lunout, *) 'conf_gcm: alphax alphay ', alphax, alphay
+
+      !    alphax et alphay sont les anciennes formulat. des grossissements
+
+      !Config  Key  = fxyhypb
+      !Config  Desc = Fonction  hyperbolique
+      !Config  Def  = y
+      !Config  Help = Fonction  f(y)  hyperbolique  si = .TRUE.
+      !Config         sinon  sinusoidale
+      fxyhypb = .TRUE.
+      CALL getin('fxyhypb', fxyhypb)
+
+      !Config  Key  = dzoomx
+      !Config  Desc = extension en longitude
+      !Config  Def  = 0
+      !Config  Help = extension en longitude  de la zone du zoom
+      !Config         ( fraction de la zone totale)
+      dzoomx = 0.2
+      CALL getin('dzoomx', dzoomx)
+      CALL assert(dzoomx < 1, "conf_gcm: dzoomx must be < 1")
+
+      !Config  Key  = dzoomy
+      !Config  Desc = extension en latitude
+      !Config  Def  = 0
+      !Config  Help = extension en latitude de la zone  du zoom
+      !Config         ( fraction de la zone totale)
+      dzoomy = 0.2
+      CALL getin('dzoomy', dzoomy)
+      CALL assert(dzoomy < 1, "conf_gcm: dzoomy must be < 1")
+
+      !Config  Key  = taux
+      !Config  Desc = raideur du zoom en  X
+      !Config  Def  = 3
+      !Config  Help = raideur du zoom en  X
+      taux = 3.0
+      CALL getin('taux', taux)
+
+      !Config  Key  = tauy
+      !Config  Desc = raideur du zoom en  Y
+      !Config  Def  = 3
+      !Config  Help = raideur du zoom en  Y
+      tauy = 3.0
+      CALL getin('tauy', tauy)
+
+      !Config  Key  = ysinus
+      !Config  IF   = !fxyhypb
+      !Config  Desc = Fonction en Sinus
+      !Config  Def  = y
+      !Config  Help = Fonction  f(y) avec y = Sin(latit.) si = .TRUE.
+      !Config         sinon y = latit.
+      ysinus = .TRUE.
+      CALL getin('ysinus', ysinus)
+
+      !Config  Key  = offline
+      !Config  Desc = Nouvelle eau liquide
+      !Config  Def  = n
+      !Config  Help = Permet de mettre en route la
+      !Config         nouvelle parametrisation de l'eau liquide !
+      offline = .FALSE.
+      CALL getin('offline', offline)
+      IF (offline .AND. adjust) THEN
+        WRITE(lunout, *)  &
+                'WARNING : option offline does not work with adjust=y :'
+        WRITE(lunout, *) 'the files defstoke.nc, fluxstoke.nc ', &
+                'and fluxstokev.nc will not be created'
+        WRITE(lunout, *)  &
+                'only the file phystoke.nc will still be created '
+      ENDIF
+
+      !Config  Key  = type_trac
+      !Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
+      !Config  Def  = lmdz
+      !Config  Help =
+      !Config         'lmdz' = pas de couplage, pur LMDZ
+      !Config         'inca' = model de chime INCA
+      !Config         'repr' = model de chime REPROBUS
+      type_trac = 'lmdz'
+      CALL getin('type_trac', type_trac)
+
+      !Config  Key  = ok_dynzon
+      !Config  Desc = sortie des transports zonaux dans la dynamique
+      !Config  Def  = n
+      !Config  Help = Permet de mettre en route le calcul des transports
+      !Config
+      ok_dynzon = .FALSE.
+      CALL getin('ok_dynzon', ok_dynzon)
+
+      !Config  Key  = ok_dyn_ins
+      !Config  Desc = sorties instantanees dans la dynamique
+      !Config  Def  = n
+      !Config  Help =
+      !Config
+      ok_dyn_ins = .FALSE.
+      CALL getin('ok_dyn_ins', ok_dyn_ins)
+
+      !Config  Key  = ok_dyn_ave
+      !Config  Desc = sorties moyennes dans la dynamique
+      !Config  Def  = n
+      !Config  Help =
+      !Config
+      ok_dyn_ave = .FALSE.
+      CALL getin('ok_dyn_ave', ok_dyn_ave)
+
+      !Config  Key  = ok_dyn_xios
+      !Config  Desc = sorties moyennes dans la dynamique
+      !Config  Def  = n
+      !Config  Help =
+      !Config
+      ok_dyn_xios = .FALSE.
+      CALL getin('ok_dyn_xios', ok_dyn_xios)
+
+      !Config  Key  = use_filtre_fft
+      !Config  Desc = flag to activate FFTs for the filter
+      !Config  Def  = false
+      !Config  Help = enables to use FFts to do the longitudinal polar
+      !Config         filtering around the poles.
+      use_filtre_fft = .FALSE.
+      CALL getin('use_filtre_fft', use_filtre_fft)
+      IF (use_filtre_fft .AND. grossismx /= 1.0) THEN
+        WRITE(lunout, *)'WARNING !!! '
+        WRITE(lunout, *)"A zoom in longitude is not compatible", &
+                " with the FFT filter ", &
+                "---> FFT filter deactivated"
+        use_filtre_fft = .FALSE.
+      ENDIF
+      use_filtre_fft_loc = use_filtre_fft
+
+      !Config  Key  = use_mpi_alloc
+      !Config  Desc = Utilise un buffer MPI en mémoire globale
+      !Config  Def  = false
+      !Config  Help = permet d'activer l'utilisation d'un buffer MPI
+      !Config         en mémoire globale a l'aide de la fonction MPI_ALLOC.
+      !Config         Cela peut améliorer la bande passante des transferts MPI
+      !Config         d'un facteur 2
+      use_mpi_alloc = .FALSE.
+      CALL getin('use_mpi_alloc', use_mpi_alloc)
+
+      !Config key = ok_strato
+      !Config  Desc = activation de la version strato
+      !Config  Def  = .FALSE.
+      !Config  Help = active la version stratosphérique de LMDZ de F. Lott
+
+      ok_strato = .FALSE.
+      CALL getin('ok_strato', ok_strato)
+
+      vert_prof_dissip = merge(1, 0, ok_strato .AND. llm==39)
+      CALL getin('vert_prof_dissip', vert_prof_dissip)
+      CALL assert(vert_prof_dissip == 0 .OR. vert_prof_dissip ==  1, &
+              "bad value for vert_prof_dissip")
+
+      !Config  Key  = ok_gradsfile
+      !Config  Desc = activation des sorties grads du guidage
+      !Config  Def  = n
+      !Config  Help = active les sorties grads du guidage
+
+      ok_gradsfile = .FALSE.
+      CALL getin('ok_gradsfile', ok_gradsfile)
+
+      !Config  Key  = ok_limit
+      !Config  Desc = creation des fichiers limit dans create_etat0_limit
+      !Config  Def  = y
+      !Config  Help = production du fichier limit.nc requise
+
+      ok_limit = .TRUE.
+      CALL getin('ok_limit', ok_limit)
+
+      !Config  Key  = ok_etat0
+      !Config  Desc = creation des fichiers etat0 dans create_etat0_limit
+      !Config  Def  = y
+      !Config  Help = production des fichiers start.nc, startphy.nc requise
+
+      ok_etat0 = .TRUE.
+      CALL getin('ok_etat0', ok_etat0)
+
+      !Config  Key  = read_orop
+      !Config  Desc = lecture du fichier de params orographiques sous maille
+      !Config  Def  = f
+      !Config  Help = lecture fichier plutot que grid_noro
+
+      read_orop = .FALSE.
+      CALL getin('read_orop', read_orop)
+
+      WRITE(lunout, *)' #########################################'
+      WRITE(lunout, *)' Configuration des parametres de cel0_limit: '
+      WRITE(lunout, *)' planet_type = ', planet_type
+      WRITE(lunout, *)' calend = ', calend
+      WRITE(lunout, *)' dayref = ', dayref
+      WRITE(lunout, *)' anneeref = ', anneeref
+      WRITE(lunout, *)' nday = ', nday
+      WRITE(lunout, *)' day_step = ', day_step
+      WRITE(lunout, *)' iperiod = ', iperiod
+      WRITE(lunout, *)' iconser = ', iconser
+      WRITE(lunout, *)' iecri = ', iecri
+      WRITE(lunout, *)' periodav = ', periodav
+      WRITE(lunout, *)' output_grads_dyn = ', output_grads_dyn
+      WRITE(lunout, *)' dissip_period = ', dissip_period
+      WRITE(lunout, *)' lstardis = ', lstardis
+      WRITE(lunout, *)' nitergdiv = ', nitergdiv
+      WRITE(lunout, *)' nitergrot = ', nitergrot
+      WRITE(lunout, *)' niterh = ', niterh
+      WRITE(lunout, *)' tetagdiv = ', tetagdiv
+      WRITE(lunout, *)' tetagrot = ', tetagrot
+      WRITE(lunout, *)' tetatemp = ', tetatemp
+      WRITE(lunout, *)' coefdis = ', coefdis
+      WRITE(lunout, *)' purmats = ', purmats
+      WRITE(lunout, *)' read_start = ', read_start
+      WRITE(lunout, *)' iflag_phys = ', iflag_phys
+      WRITE(lunout, *)' iphysiq = ', iphysiq
+      WRITE(lunout, *)' clon = ', clon
+      WRITE(lunout, *)' clat = ', clat
+      WRITE(lunout, *)' grossismx = ', grossismx
+      WRITE(lunout, *)' grossismy = ', grossismy
+      WRITE(lunout, *)' fxyhypb = ', fxyhypb
+      WRITE(lunout, *)' dzoomx = ', dzoomx
+      WRITE(lunout, *)' dzoomy = ', dzoomy
+      WRITE(lunout, *)' taux = ', taux
+      WRITE(lunout, *)' tauy = ', tauy
+      WRITE(lunout, *)' offline = ', offline
+      WRITE(lunout, *)' type_trac = ', type_trac
+      WRITE(lunout, *)' ok_dynzon = ', ok_dynzon
+      WRITE(lunout, *)' ok_dyn_ins = ', ok_dyn_ins
+      WRITE(lunout, *)' ok_dyn_ave = ', ok_dyn_ave
+      WRITE(lunout, *)' ok_dyn_xios = ', ok_dyn_xios
+      WRITE(lunout, *)' use_filtre_fft = ', use_filtre_fft
+      WRITE(lunout, *)' use_mpi_alloc = ', use_mpi_alloc
+      WRITE(lunout, *)' ok_strato = ', ok_strato
+      WRITE(lunout, *)' ok_gradsfile = ', ok_gradsfile
+      WRITE(lunout, *)' ok_limit = ', ok_limit
+      WRITE(lunout, *)' ok_etat0 = ', ok_etat0
+      WRITE(lunout, *)' ok_guide = ', ok_guide
+      WRITE(lunout, *)' read_orop = ', read_orop
+    ENDIF test_etatinit
+
+  END SUBROUTINE conf_gcm
+
+
+END MODULE lmdz_conf_gcm
