Index: trunk/LMDZ.GENERIC_2.0/README.aymeric
===================================================================
--- trunk/LMDZ.GENERIC_2.0/README.aymeric	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/README.aymeric	(revision 844)
@@ -0,0 +1,51 @@
+
+faire descendre
+http://svn.lmd.jussieu.fr/LMDZ/LMDZ5/trunk
+
+svn co http://svn.lmd.jussieu.fr/LMDZ/LMDZ5/trunk LMDZ5
+
+cd LMDZ5/libf
+executer
+$MOD/LMDZ.GENERIC/libf/phystd/for_lmdz5/linkgen.sh
+
+
+faire generatedoth.sh dans phygeneric
+(ou alors modifier makelmdz_fcm)
+
+
+penser à compiler IOIPSL voir dans LMDZ.COMMON
+puis modifier arch.path
+et compiler et c'est bon
+
+EN FAIT LE CICLAD IFORT EST AUSSI VALABLE SUR LES MACHINES DU LMD
+mais IL FAUT ENLEVER LES OPTIONS APRES NC_DOUBLE
+
+
+makelmdz_fcm -d 48x36x19 -arch CICLADifort -parallel mpi -p dev gcm > log_makelmdz_fcm &
+
+ou pas dev
+
+
+makelmdz_fcm -d 48x36x19 -arch CICLADifort -parallel mpi -p dev gcm
+
+makelmdz_fcm -d 64x48x20 -arch CICLADifort -parallel mpi -p generic gcm -debug
+
+
+makelmdz_fcm -d 64x48x20 -arch CICLADifort -parallel mpi -p generic -debug -cpp NOWRITEDIAGFI gcm
+makelmdz_fcm -d 64x48x20 -arch CICLADifort -parallel mpi -p generic -cpp NOWRITEDIAGFI gcm
+
+
+makelmdz_fcm -d 64x48x20 -arch CICLADifort-seq -p generic -debug gcm
+makegcm -d 64x48x20 -t 2 gcm
+
+
+/home/spiga/MODELES/LMDZ.GENERIC/makegcm -d 64x48x20 -t 0 -debug -cpp NOTRAC start2archive > logcomp
+
+/home/spiga/MODELES/LMDZ.GENERIC/makegcm -d 64x48x20 -t 0 newstart
+
+/home/spiga/MODELES/LMDZ.GENERIC/makegcm -d 128x96x20 -t 0 -debug -cpp NOTRAC newstart
+
+/home/spiga/MODELES/LMDZ.GENERIC/makegcm -d 64x48x20 -t 0 -s 1 -b 3x2 gcm
+
+
+pour initialisation idealisee, qqch comme iniaqua dans phyaqua ???
Index: trunk/LMDZ.GENERIC_2.0/arch
===================================================================
--- trunk/LMDZ.GENERIC_2.0/arch	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/arch	(revision 844)
@@ -0,0 +1,1 @@
+link ../LMDZ.COMMON/arch
Index: trunk/LMDZ.GENERIC_2.0/bld.cfg
===================================================================
--- trunk/LMDZ.GENERIC_2.0/bld.cfg	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/bld.cfg	(revision 844)
@@ -0,0 +1,1 @@
+link ../LMDZ.COMMON/bld.cfg
Index: trunk/LMDZ.GENERIC_2.0/build_gcm
===================================================================
--- trunk/LMDZ.GENERIC_2.0/build_gcm	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/build_gcm	(revision 844)
@@ -0,0 +1,1 @@
+link ../LMDZ.COMMON/build_gcm
Index: trunk/LMDZ.GENERIC_2.0/create_make_gcm
===================================================================
--- trunk/LMDZ.GENERIC_2.0/create_make_gcm	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/create_make_gcm	(revision 844)
@@ -0,0 +1,1 @@
+link ../LMDZ.COMMON/create_make_gcm
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/callphys.def
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/callphys.def	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/callphys.def	(revision 844)
@@ -0,0 +1,172 @@
+## Orbit / general options
+## ~~~~~~~~~~~~~~~~~~~~~~~
+# Run with or without tracer transport ?
+tracer    = .false.
+# Diurnal cycle ?  if diurnal=false, diurnally averaged solar heating
+diurnal   = .true.
+# Seasonal cycle ? if season=false, Ls stays constant, to value set in "start"
+season    = .true. 
+# Tidally resonant orbit ? must have diurnal=false, correct rotation rate in newstart
+tlocked   = .false.
+# Tidal resonance ratio ? ratio T_orbit to T_rotation
+nres      = 1
+# Write some more output on the screen ?
+lwrite    = .false.
+# Save statistics in file "stats.nc" ?
+callstats = .false.
+# Test energy conservation of model physics ?
+enertest  = .false.
+# Check to see if cpp, mugaz values used match gas mixture defined in gases.def (recommended) ?
+check_cpp_match=.false. 
+
+## Directory where external input files are
+## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+datadir     = /san/home/spiga/DATAGENERIC
+datadir     = /home/spiga/datagcm
+
+## Radiative transfer options
+## ~~~~~~~~~~~~~~~~~~~~~~~~~~
+# call radiative transfer?
+callrad    = .true.
+# the rad. transfer is computed every "iradia" physical timestep
+iradia     = 6
+# call multilayer correlated-k radiative transfer ?
+corrk      = .true.
+# Include continuum absorption in radiative transfer (note CO2 is treated separately) ?
+continuum  = .false.
+# folder in which correlated-k data is stored ?
+corrkdir   = null
+# call visible gaseous absorption in radiative transfer ?
+callgasvis = .true.
+# Include Rayleigh scattering in the visible ?
+rayleigh   = .false.
+# Uniform absorption coefficient in radiative transfer?
+graybody     = .true.
+# Constant absorption coefficient in visible 
+#      (in m^2/kg; only if graybody=true):
+#      tau_surf= kappa*P/g
+kappa_VI = 5.e-5
+kappa_VI = 1.e-20
+# Constant absorption coefficient in IR
+#      (in m^2/kg; only if graybody=true):
+kappa_IR = 1.e-4
+kappa_IR = 1.e-5
+# Characteristic planetary equilibrium (black body) temperature
+# This is used only in the aerosol radiative transfer setup. (see aerave.F)
+tplanet    = 215.
+# Output spectral OLR in 3D?
+specOLR    = .false. 
+# Output global radiative balance in file 'rad_bal.out' - slow for 1D!!
+meanOLR    = .false.
+# Variable gas species: Radiatively active ?
+varactive  = .false.
+# Variable gas species: Fixed vertical distribution ?
+#   (not to be used in time integration mode)
+varfixed   = .false.
+# Variable gas species: Saturation percentage value at ground ?
+satval     = 0.0
+# Force specific heat capacity and molecular mass values
+force_cpp      = .false.
+# Remove lower boundary (e.g. for gas giant sims)
+noradsurf    = .false. 
+
+## Star type
+## ~~~~~~~~~
+startype = 1
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# The choices are:
+#
+#	startype = 1		Sol        (G2V-class main sequence)
+#	startype = 2		Ad Leo     (M-class, synthetic)
+#       startype = 3            GJ644
+#       startype = 4            HD128167
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Stellar flux at 1 AU. Examples:
+# 1366.0 W m-2		Sol today
+# 1024.5 W m-2		Sol today x 0.75 = weak early Sun
+# 18.462 W m-2		The feeble Gl581
+# 19.960 W m-2		Gl581 with e=0.38 orbital average
+Fat1AU = 1366.0
+
+## Tracer and aerosol options 
+## ~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Gravitational sedimentation of tracers (just H2O ice for now) ?
+sedimentation = .false.
+
+## Other physics options
+## ~~~~~~~~~~~~~~~~~~~~~
+# call turbulent vertical diffusion ?
+calldifv = .true.
+# use turbdiff instead of vdifc ?
+UseTurbDiff = .true.
+# call convective adjustment ?
+calladj  = .true.
+# call thermal conduction in the soil ?
+callsoil = .true.
+
+#########################################################################
+## extra non-standard definitions for Earth
+#########################################################################
+ 
+## Tracer and aerosol options 
+## ~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Radiatively active CO2 aerosol?
+aeroco2       = .false.
+# Fixed CO2 aerosol distribution?
+aerofixco2    = .false.
+# Radiatively active water aerosol?
+aeroh2o       = .false.
+# Fixed water aerosol distribution?
+aerofixh2o    = .false.
+# basic dust opacity
+dusttau       = 0.0
+# Varying H2O cloud fraction?
+CLFvarying    = .true. 
+# H2O cloud fraction if fixed?
+CLFfixval     = 0.5
+# fixed radii for cloud particles?
+radfixed=.false.
+# number mixing ratio of CO2 ice particles
+Nmix_co2      = 100000.
+# number mixing ratio of water particles (for rafixed=.false.)
+Nmix_h2o      = 1.e7
+# number mixing ratio of water ice particles (for rafixed=.false.)
+Nmix_h2o_ice  = 5.e5
+# radius of H2O water particles (for rafixed=.true.):
+rad_h2o=10.e-6
+# radius of H2O ice particles (for rafixed=.true.):
+rad_h2o_ice=35.e-6
+# atm mass update due to tracer evaporation/condensation?
+mass_redistrib = .false.
+
+## Water options 
+## ~~~~~~~~~~~~~
+# Model water cycle
+water         = .false.
+# Model water cloud formation
+watercond     = .false.
+# Model water precipitation (including coagulation etc.)
+waterrain     = .false.
+# Use simple precipitation scheme?
+precip_scheme=4
+# multiplicative constant in Boucher 95 precip scheme
+Cboucher=1.
+# WATER: hydrology ?
+hydrology     = .false.
+# H2O snow (and ice) albedo ?
+albedosnow    = 0.6
+# Maximum sea ice thickness ?
+maxicethick   = 10.
+# Freezing point of seawater (degrees C) ?
+Tsaldiff      = 0.0
+# Evolve surface water sources ?
+sourceevol    = .false.
+
+## CO2 options 
+## ~~~~~~~~~~~
+# gas is non-ideal CO2 ?
+nonideal      = .false.
+# call CO2 condensation ?
+co2cond       = .false.
+# Set initial temperature profile to 1 K above CO2 condensation everywhere?
+nearco2cond   = .false.
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/diagfi.def
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/diagfi.def	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/diagfi.def	(revision 844)
@@ -0,0 +1,10 @@
+tsurf
+ps
+temp
+u
+v
+ISR
+ASR
+OLR
+GND
+DYN
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/gases.def
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/gases.def	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/gases.def	(revision 844)
@@ -0,0 +1,9 @@
+# gases
+1
+H2_
+1.0
+
+# First line is number of gases
+# Followed by gas names (always 3 characters)
+# and then mixing ratios.
+# mixing ratio -1 means the gas is variable.
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/launch_lmdz.generic
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/launch_lmdz.generic	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/launch_lmdz.generic	(revision 844)
@@ -0,0 +1,9 @@
+#PBS -S  /bin/bash
+#PBS -j  oe
+#PBS -q  infini
+#PBS -N  LMDZ.GENERIC
+
+####### prep run
+cd $PBS_O_WORKDIR
+ulimit -s unlimited
+gcm.e > log
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/launch_lmdz5para
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/launch_lmdz5para	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/launch_lmdz5para	(revision 844)
@@ -0,0 +1,11 @@
+#PBS -S  /bin/bash
+#PBS -j  oe
+#PBS -q  infini
+#PBS -N  LMDZ5_PARA24
+#PBS -l "nodes=1:ppn=24"
+##PBS -l "mem=64gb"
+
+####### prep run
+cd $PBS_O_WORKDIR
+ulimit -s unlimited
+mpirun gcm.e > log
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/run.def
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/run.def	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/run.def	(revision 844)
@@ -0,0 +1,249 @@
+
+#########
+######### THIS IS INTENDED TO WORK BOTH WITH LMDZ.GENERIC + old LMDZ core
+#########                                AND LMDZ.GENERIC + new LMDZ core
+#########
+
+### A INCLURE ?
+## calend=venus  ## calendrier specifique
+## resetvarc=n   ## reinit des variables de controle
+## iflag_trac=0  ## avec ou sans traceurs
+
+################################################################
+#### LMDZ5
+#### IN GCM.DEF
+#### -- those parameters are ignored when using old LMDZ core
+################################################################
+
+## period appel a la dissipation (multiple iperiod, 0 si calcul automatique)
+## (remplace ce qui etait idissip dans l'ancienne dynamique)
+dissip_period = 0
+dissip_period = 2 
+dissip_period = 5
+
+## avec ou sans physique
+## 0: pas de physique (e.g. en mode Shallow Water)
+## 1: avec physique (e.g. physique phylmd)
+## 2: avec rappel newtonien dans la dynamique                                         
+iflag_phys=2
+iflag_phys=1 
+
+## avec ou sans fichiers de demarrage (start.nc, startphy.nc) ?
+## (sans fichiers de demarrage, initialisation des champs par iniacademic
+##  dans la dynamique)
+read_start=n
+read_start=y 
+
+##  Avec ou sans strato // i.e. Couche eponge et second palier pour dissip horizontale
+ok_strato=n
+
+### Dissipation horizontale
+#dissip_fac_mid=2.
+#dissip_fac_up=2.
+## deltaz et hdelta en km
+#dissip_deltaz=10.
+#dissip_hdelta=5.
+## pupstart en Pa
+#dissip_pupstart=1.e3
+
+#  Couche eponge dans les couches de pression plus faible que 100 fois la pression de la derniere couche
+iflag_top_bound=0
+
+########################################
+## LMDZ.COMMON
+##    1: dans les 4 derniers niveaux
+##    2: dans les couches de pression plus faible que 100 fois la pression de la derniere couche
+#iflag_top_bound=1
+## Mode Couche eponge
+##   mode = 0 : pas de sponge
+##   mode = 1 : u et v -> 0
+##   mode = 2 : u et v -> moyenne zonale
+##   mode = 3 : u, v et h -> moyenne zonale
+#mode_top_bound=1
+#######################################
+
+#  Coefficient pour la couche eponge (valeur derniere couche)
+tau_top_bound=1.e-5
+tau_top_bound=5.e-5
+
+################################################################
+#### LMDZ5
+#### IN RUN.DEF
+#### -- those parameters are ignored when using old LMDZ core
+################################################################
+
+## Type de calendrier utilise
+## valeur possible: earth_360d (defaut), earth_365d, earth_366d
+ip_ebil_phy=1
+ip_ebil_dyn=1
+calend=earth_360d
+
+## Jour de l'etat initial ( = 350  si 20 Decembre ,par expl. ,comme ici )
+dayref=10120
+#dayref=40
+
+##  Annee de l'etat  initial (   avec  4  chiffres   )
+anneeref=2000
+
+## Remise a zero de la date initiale
+## =1 is necessary for generic physics
+raz_date=1
+
+## flag de sortie dynzon
+ok_dynzon=n
+## activation du calcul d equilibrage de charge
+adjust=n
+## activation du filtre fft
+use_filtre_fft=n
+## niveau d'impression de controle
+prt_level=10
+
+## coordonnees type planeto
+disvert_type = 2
+
+## the generic physics
+planet_type = generic
+
+## sorties instantanees dans la dynamique (fichiers dyn_hist.nc and co.)
+ok_dyn_ins=n
+ok_dyn_ins=y
+## periode d'ecriture des sorties instantanees dans la dynamique
+## (en pas dynamiques)
+iecri=30
+iecri=120
+iecri=480
+#iecri=4800
+#iecri=9600
+
+## sorties de valeurs moyennes dans la dynamique (fichiers dyn_hist_ave.nc and co.)
+ok_dyn_ave=n
+## periode de stockage des moyennes dans la dynamique (en jours)
+periodav=1
+
+
+#################################
+#### AND NOW THE OLD run.def ####
+#################################
+## -----> REMOVED
+## was present and conflicting with LMDZ5
+## (although useless in old OLD LMDz DYN CORE
+## - iecri [periode d'ecriture du fichier histoire (en jour)]
+## - periodav [periode de stockage fichier histmoy (en jour) dynzon?]
+#################################
+#################################
+
+#----------------------------------------------------------------------- 
+#Parametres de controle du run:                                          
+#------------------------------                                          
+
+# Nombre de jours d'integration                                         
+     nday = 720
+#     nday = 20
+#     nday = 100
+#     nday = 1800
+
+# nombre de pas par jour (multiple de iperiod) ( ici pour dt = 1 min )      
+ day_step = 240
+# day_step = 480
+# day_step = 960
+
+# periode pour le pas Matsuno (en pas)                                  
+  iperiod=5
+
+# periode de sortie des variables de controle (en pas)                  
+  iconser=120
+
+# periode de la dissipation (en pas)                                    
+# -- this is ignored by LMDZ5 which rely on dissip_period instead
+  idissip=5
+
+# choix de l'operateur de dissipation (star ou  non star )              
+ lstardis=.true. 
+
+# avec ou sans coordonnee hybrides
+ hybrid=.true.
+
+# nombre d'iterations de l'operateur de dissipation   gradiv            
+nitergdiv=1
+
+# nombre d'iterations de l'operateur de dissipation  nxgradrot          
+nitergrot=2
+
+# nombre d'iterations de l'operateur de dissipation  divgrad            
+   niterh=2
+
+# temps de dissipation des plus petites long.d ondes pour u,v (gradiv)  
+ tetagdiv=2500. 4000.
+
+# temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
+ tetagrot=2500. 4000.
+
+# temps de dissipation des plus petites long.d ondes pour  h ( divgrad) 
+ tetatemp=2500. 4000.
+
+# coefficient pour gamdissip                                            
+  coefdis=0.
+
+# choix du shema d'integration temporelle (Matsuno ou Matsuno-leapfrog) 
+  purmats=.false. 
+
+# avec ou sans physique                                                 
+   physic=.true.
+
+# periode de la physique (en pas) (en pas dynamiques, n'a de sens que si iflag_phys=1)                                      
+  iphysiq=5
+#  iphysiq=1
+
+# choix d'une grille reguliere                                          
+  grireg=.true.
+
+# frequence (en pas) de l'ecriture du fichier diagfi               
+  ecritphy=480
+#  ecritphy=60
+#  ecritphy=45
+#  ecritphy=50000000
+
+# longitude en degres du centre du zoom                                 
+   clon=0.
+
+# latitude en degres du centre du zoom                                  
+   clat=0.
+
+# facteur de grossissement du zoom,selon longitude                      
+  grossismx=1.
+
+# facteur de grossissement du zoom ,selon latitude                      
+ grossismy=1.
+
+#  Fonction  f(y)  hyperbolique  si = .true.  , sinon  sinusoidale         
+  fxyhypb=.false.
+
+# extension en longitude  de la zone du zoom  ( fraction de la zone totale)
+   dzoomx= 0.
+
+# extension en latitude de la zone  du zoom  ( fraction de la zone totale)
+   dzoomy=0.
+
+#  raideur du zoom en  X
+    taux=2.
+
+#  raideur du zoom en  Y
+    tauy=2.
+
+#  Fonction  f(y) avec y = Sin(latit.) si = .TRUE. ,  Sinon  y = latit.
+  ysinus= .false.
+
+###################### SPONGE LAYER IN OLD DYNAMICS
+###################### -- this is ignored by LMDZ5
+# Avec sponge layer
+  callsponge  = .true.
+# Sponge:  mode0(u=v=0), mode1(u=umoy,v=0), mode2(u=umoy,v=vmoy)
+  mode_sponge= 2
+# Sponge:  hauteur de sponge (km)
+  hsponge= 50
+# Sponge:  tetasponge (secondes)
+  tetasponge = 50000
+###################### 
+
+# some definitions for the physics, in file 'callphys.def'
+INCLUDEDEF=callphys.def
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/run.def.128.96
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/run.def.128.96	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/run.def.128.96	(revision 844)
@@ -0,0 +1,249 @@
+
+#########
+######### THIS IS INTENDED TO WORK BOTH WITH LMDZ.GENERIC + old LMDZ core
+#########                                AND LMDZ.GENERIC + new LMDZ core
+#########
+
+### A INCLURE ?
+## calend=venus  ## calendrier specifique
+## resetvarc=n   ## reinit des variables de controle
+## iflag_trac=0  ## avec ou sans traceurs
+
+################################################################
+#### LMDZ5
+#### IN GCM.DEF
+#### -- those parameters are ignored when using old LMDZ core
+################################################################
+
+## period appel a la dissipation (multiple iperiod, 0 si calcul automatique)
+## (remplace ce qui etait idissip dans l'ancienne dynamique)
+dissip_period = 0
+dissip_period = 2 
+dissip_period = 5
+
+## avec ou sans physique
+## 0: pas de physique (e.g. en mode Shallow Water)
+## 1: avec physique (e.g. physique phylmd)
+## 2: avec rappel newtonien dans la dynamique                                         
+iflag_phys=2
+iflag_phys=1 
+
+## avec ou sans fichiers de demarrage (start.nc, startphy.nc) ?
+## (sans fichiers de demarrage, initialisation des champs par iniacademic
+##  dans la dynamique)
+read_start=n
+read_start=y 
+
+##  Avec ou sans strato // i.e. Couche eponge et second palier pour dissip horizontale
+ok_strato=n
+
+### Dissipation horizontale
+#dissip_fac_mid=2.
+#dissip_fac_up=2.
+## deltaz et hdelta en km
+#dissip_deltaz=10.
+#dissip_hdelta=5.
+## pupstart en Pa
+#dissip_pupstart=1.e3
+
+#  Couche eponge dans les couches de pression plus faible que 100 fois la pression de la derniere couche
+iflag_top_bound=0
+
+########################################
+## LMDZ.COMMON
+##    1: dans les 4 derniers niveaux
+##    2: dans les couches de pression plus faible que 100 fois la pression de la derniere couche
+#iflag_top_bound=1
+## Mode Couche eponge
+##   mode = 0 : pas de sponge
+##   mode = 1 : u et v -> 0
+##   mode = 2 : u et v -> moyenne zonale
+##   mode = 3 : u, v et h -> moyenne zonale
+#mode_top_bound=1
+#######################################
+
+#  Coefficient pour la couche eponge (valeur derniere couche)
+tau_top_bound=1.e-5
+tau_top_bound=5.e-5
+
+################################################################
+#### LMDZ5
+#### IN RUN.DEF
+#### -- those parameters are ignored when using old LMDZ core
+################################################################
+
+## Type de calendrier utilise
+## valeur possible: earth_360d (defaut), earth_365d, earth_366d
+ip_ebil_phy=1
+ip_ebil_dyn=1
+calend=earth_360d
+
+## Jour de l'etat initial ( = 350  si 20 Decembre ,par expl. ,comme ici )
+dayref=10120
+dayref=40
+
+##  Annee de l'etat  initial (   avec  4  chiffres   )
+anneeref=2000
+
+## Remise a zero de la date initiale
+## =1 is necessary for generic physics
+raz_date=1
+
+## flag de sortie dynzon
+ok_dynzon=n
+## activation du calcul d equilibrage de charge
+adjust=n
+## activation du filtre fft
+use_filtre_fft=n
+## niveau d'impression de controle
+prt_level=10
+
+## coordonnees type planeto
+disvert_type = 2
+
+## the generic physics
+planet_type = generic
+
+## sorties instantanees dans la dynamique (fichiers dyn_hist.nc and co.)
+ok_dyn_ins=n
+ok_dyn_ins=y
+## periode d'ecriture des sorties instantanees dans la dynamique
+## (en pas dynamiques)
+iecri=30
+iecri=120
+iecri=480
+iecri=4800
+#iecri=9600
+
+## sorties de valeurs moyennes dans la dynamique (fichiers dyn_hist_ave.nc and co.)
+ok_dyn_ave=n
+## periode de stockage des moyennes dans la dynamique (en jours)
+periodav=1
+
+
+#################################
+#### AND NOW THE OLD run.def ####
+#################################
+## -----> REMOVED
+## was present and conflicting with LMDZ5
+## (although useless in old OLD LMDz DYN CORE
+## - iecri [periode d'ecriture du fichier histoire (en jour)]
+## - periodav [periode de stockage fichier histmoy (en jour) dynzon?]
+#################################
+#################################
+
+#----------------------------------------------------------------------- 
+#Parametres de controle du run:                                          
+#------------------------------                                          
+
+# Nombre de jours d'integration                                         
+     nday = 720
+     nday = 20
+     nday = 100
+     nday = 1800
+
+# nombre de pas par jour (multiple de iperiod) ( ici pour dt = 1 min )      
+ day_step = 240
+ day_step = 480
+# day_step = 960
+
+# periode pour le pas Matsuno (en pas)                                  
+  iperiod=5
+
+# periode de sortie des variables de controle (en pas)                  
+  iconser=120
+
+# periode de la dissipation (en pas)                                    
+# -- this is ignored by LMDZ5 which rely on dissip_period instead
+  idissip=5
+
+# choix de l'operateur de dissipation (star ou  non star )              
+ lstardis=.true. 
+
+# avec ou sans coordonnee hybrides
+ hybrid=.true.
+
+# nombre d'iterations de l'operateur de dissipation   gradiv            
+nitergdiv=1
+
+# nombre d'iterations de l'operateur de dissipation  nxgradrot          
+nitergrot=2
+
+# nombre d'iterations de l'operateur de dissipation  divgrad            
+   niterh=2
+
+# temps de dissipation des plus petites long.d ondes pour u,v (gradiv)  
+ tetagdiv=1000. 2500. 4000.
+
+# temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
+ tetagrot=1000. 2500. 4000.
+
+# temps de dissipation des plus petites long.d ondes pour  h ( divgrad) 
+ tetatemp=1000. 2500. 4000.
+
+# coefficient pour gamdissip                                            
+  coefdis=0.
+
+# choix du shema d'integration temporelle (Matsuno ou Matsuno-leapfrog) 
+  purmats=.false. 
+
+# avec ou sans physique                                                 
+   physic=.true.
+
+# periode de la physique (en pas) (en pas dynamiques, n'a de sens que si iflag_phys=1)                                      
+  iphysiq=5
+#  iphysiq=1
+
+# choix d'une grille reguliere                                          
+  grireg=.true.
+
+# frequence (en pas) de l'ecriture du fichier diagfi               
+  ecritphy=480
+#  ecritphy=60
+#  ecritphy=45
+#  ecritphy=50000000
+
+# longitude en degres du centre du zoom                                 
+   clon=0.
+
+# latitude en degres du centre du zoom                                  
+   clat=0.
+
+# facteur de grossissement du zoom,selon longitude                      
+  grossismx=1.
+
+# facteur de grossissement du zoom ,selon latitude                      
+ grossismy=1.
+
+#  Fonction  f(y)  hyperbolique  si = .true.  , sinon  sinusoidale         
+  fxyhypb=.false.
+
+# extension en longitude  de la zone du zoom  ( fraction de la zone totale)
+   dzoomx= 0.
+
+# extension en latitude de la zone  du zoom  ( fraction de la zone totale)
+   dzoomy=0.
+
+#  raideur du zoom en  X
+    taux=2.
+
+#  raideur du zoom en  Y
+    tauy=2.
+
+#  Fonction  f(y) avec y = Sin(latit.) si = .TRUE. ,  Sinon  y = latit.
+  ysinus= .false.
+
+###################### SPONGE LAYER IN OLD DYNAMICS
+###################### -- this is ignored by LMDZ5
+# Avec sponge layer
+  callsponge  = .true.
+# Sponge:  mode0(u=v=0), mode1(u=umoy,v=0), mode2(u=umoy,v=vmoy)
+  mode_sponge= 2
+# Sponge:  hauteur de sponge (km)
+  hsponge= 50
+# Sponge:  tetasponge (secondes)
+  tetasponge = 50000
+###################### 
+
+# some definitions for the physics, in file 'callphys.def'
+INCLUDEDEF=callphys.def
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/start_gray.def
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/start_gray.def	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/start_gray.def	(revision 844)
@@ -0,0 +1,18 @@
+0
+n
+
+surface_mars.nc
+40
+flat
+y
+1.e5
+bilball
+0.3
+500
+q=0
+isotherm
+283.
+emis
+1
+
+hghg
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/traceur.def.LMDZ5
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/traceur.def.LMDZ5	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/traceur.def.LMDZ5	(revision 844)
@@ -0,0 +1,2 @@
+0
+10 10 dummy
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/traceur.def.LMDZGENERIC
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/traceur.def.LMDZGENERIC	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/traceur.def.LMDZGENERIC	(revision 844)
@@ -0,0 +1,2 @@
+0
+dummy
Index: trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/z2sig.def
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/z2sig.def	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/gray_lmdz.generic_lmdz5/z2sig.def	(revision 844)
@@ -0,0 +1,1 @@
+link ../z2sig.earth
Index: trunk/LMDZ.GENERIC_2.0/deftank/linkgen.sh
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/linkgen.sh	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/linkgen.sh	(revision 844)
@@ -0,0 +1,43 @@
+#! /bin/bash
+
+wheregen=$MOD/LMDZ.GENERIC/
+
+mkdir phygeneric
+cd phygeneric
+
+mkdir bands
+cd bands
+ln -sf $wheregen/libf/grid/dimension/makbands .
+cd ..
+
+
+ln -sf $wheregen/libf/phystd/* .
+\rm for_lmdz5
+\rm ismin*
+\rm ismax*
+\rm rcm1d*
+\rm kcm1d*
+
+ln -sf $wheregen/libf/bibio/cbrt.F .
+ln -sf $wheregen/libf/bibio/lmdstd.h .
+
+ln -sf $wheregen/libf/dyn3d/control.h .
+
+ln -sf $wheregen/libf/phystd/for_lmdz5/generatedoth.sh .
+ln -sf $wheregen/libf/phystd/for_lmdz5/iniphysiq.F . 
+ln -sf $wheregen/libf/phystd/for_lmdz5/dimphys.h .
+
+ln -sf ../phylmd/comgeomphy.F90 .
+ln -sf ../phylmd/dimphy.F90 .
+ln -sf ../phylmd/init_phys_lmdz.F90 .
+ln -sf ../phylmd/iophy.F90 .
+ln -sf ../phylmd/iostart.F90 .
+ln -sf ../phylmd/mod_grid_phy_lmdz.F90 .
+ln -sf ../phylmd/mod_phys_lmdz_mpi_data.F90 .
+ln -sf ../phylmd/mod_phys_lmdz_mpi_transfert.F90 .
+ln -sf ../phylmd/mod_phys_lmdz_omp_data.F90 .
+ln -sf ../phylmd/mod_phys_lmdz_omp_transfert.F90 .
+ln -sf ../phylmd/mod_phys_lmdz_para.F90 .
+ln -sf ../phylmd/mod_phys_lmdz_transfert_para.F90 .
+ln -sf ../phylmd/tetalevel.F .
+ln -sf ../phylmd/write_field_phy.F90 .
Index: trunk/LMDZ.GENERIC_2.0/deftank/z2sig.earth
===================================================================
--- trunk/LMDZ.GENERIC_2.0/deftank/z2sig.earth	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/deftank/z2sig.earth	(revision 844)
@@ -0,0 +1,1 @@
+link ../../LMDZ.GENERIC/deftank/z2sig.earth
Index: trunk/LMDZ.GENERIC_2.0/libf/bibio
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/bibio	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/bibio	(revision 844)
@@ -0,0 +1,1 @@
+link ../../LMDZ.COMMON/libf/bibio
Index: trunk/LMDZ.GENERIC_2.0/libf/dyn3d
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/dyn3d	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/dyn3d	(revision 844)
@@ -0,0 +1,1 @@
+link ../../LMDZ.COMMON/libf/dyn3d
Index: trunk/LMDZ.GENERIC_2.0/libf/dyn3dpar
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/dyn3dpar	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/dyn3dpar	(revision 844)
@@ -0,0 +1,1 @@
+link ../../LMDZ.COMMON/libf/dyn3dpar
Index: trunk/LMDZ.GENERIC_2.0/libf/filtrez
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/filtrez	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/filtrez	(revision 844)
@@ -0,0 +1,1 @@
+link ../../LMDZ.COMMON/libf/filtrez
Index: trunk/LMDZ.GENERIC_2.0/libf/grid
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/grid	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/grid	(revision 844)
@@ -0,0 +1,1 @@
+link ../../LMDZ.COMMON/libf/grid
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerave.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerave.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerave.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/aerave.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerave_new.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerave_new.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerave_new.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/aerave_new.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aeropacity.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aeropacity.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aeropacity.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/aeropacity.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aeroptproperties.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aeroptproperties.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aeroptproperties.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/aeroptproperties.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerosol_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerosol_mod.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/aerosol_mod.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/aerosol_mod.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/ave_stelspec.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/ave_stelspec.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/ave_stelspec.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/ave_stelspec.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bands/bands.3.2
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bands/bands.3.2	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bands/bands.3.2	(revision 844)
@@ -0,0 +1,14 @@
+!-----------------------------------------------------------------------
+!   INCLUDE 'bands.h'
+!
+!   bands.h contains the visible & infrared bands in the model
+!
+!   NBinfrared = L_NSPECTI in the model
+!   NBvisible  = L_NSPECTV in the model
+!-----------------------------------------------------------------------
+
+      INTEGER, parameter :: NBinfrared=3
+      INTEGER, parameter :: NBvisible=2
+
+
+!-----------------------------------------------------------------------
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bands/makbands
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bands/makbands	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bands/makbands	(revision 844)
@@ -0,0 +1,1 @@
+link /home/spiga/MODELES//LMDZ.GENERIC//libf/grid/dimension/makbands
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bilinear.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bilinear.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/bilinear.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/bilinear.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/blackl.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/blackl.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/blackl.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/blackl.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_cpp3d.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_cpp3d.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_cpp3d.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/calc_cpp3d.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_cpp_mugaz.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_cpp_mugaz.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_cpp_mugaz.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/calc_cpp_mugaz.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_rayleigh.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_rayleigh.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calc_rayleigh.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/calc_rayleigh.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calcenergy_kcm.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calcenergy_kcm.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/calcenergy_kcm.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/calcenergy_kcm.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callcorrk.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callcorrk.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callcorrk.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/callcorrk.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callkeys.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callkeys.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callkeys.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/callkeys.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callsedim.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callsedim.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/callsedim.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/callsedim.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cbrt.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cbrt.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cbrt.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/bibio/cbrt.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comcstfi.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comcstfi.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comcstfi.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/comcstfi.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comdiurn_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comdiurn_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comdiurn_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/comdiurn_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comg1d.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comg1d.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comg1d.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/comg1d.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comgeomfi_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comgeomfi_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comgeomfi_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comgeomphy.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comgeomphy.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comgeomphy.F90	(revision 844)
@@ -0,0 +1,23 @@
+module comgeomphy
+   real,save,allocatable :: airephy(:)
+   real,save,allocatable :: cuphy(:)
+   real,save,allocatable :: cvphy(:)
+   real,save,allocatable :: rlatd(:)
+   real,save,allocatable :: rlond(:)
+!$OMP THREADPRIVATE(airephy,cuphy,cvphy,rlatd,rlond)
+contains
+  
+  subroutine InitComgeomphy
+  USE mod_phys_lmdz_para
+  implicit none
+    
+ 
+    allocate(airephy(klon_omp))
+    allocate(cuphy(klon_omp))
+    allocate(cvphy(klon_omp))
+    allocate(rlatd(klon_omp))
+    allocate(rlond(klon_omp))
+
+  end subroutine InitComgeomphy
+  
+end module comgeomphy
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comsaison_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comsaison_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comsaison_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/comsaison_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comsoil_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comsoil_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/comsoil_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/comsoil_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/condense_cloud.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/condense_cloud.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/condense_cloud.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/condense_cloud.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/control.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/control.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/control.h	(revision 844)
@@ -0,0 +1,1 @@
+link /home/spiga/MODELES//LMDZ.GENERIC//libf/dyn3d/control.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/convadj.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/convadj.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/convadj.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/convadj.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cp_neutral.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cp_neutral.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cp_neutral.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/cp_neutral.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cpdet.F.duplicate
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cpdet.F.duplicate	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cpdet.F.duplicate	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/cpdet.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cpdet.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cpdet.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cpdet.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/cpdet.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cvmgp.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cvmgp.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cvmgp.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/cvmgp.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cvmgt.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cvmgt.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/cvmgt.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/cvmgt.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/datafile_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/datafile_mod.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/datafile_mod.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/datafile_mod.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/datareadnc.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/datareadnc.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/datareadnc.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/datareadnc.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/def_var.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/def_var.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/def_var.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/def_var.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dimphy.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dimphy.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dimphy.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.VENUS/libf/phyvenus/dimphy.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dimphys.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dimphys.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dimphys.h	(revision 844)
@@ -0,0 +1,19 @@
+!-----------------------------------------------------------------------
+!   INCLUDE 'dimphys.h'
+
+!! ngridmx : number of horizontal grid points
+!! note: the -1/jjm term will be 0; unless jj=1
+!      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
+! nlayermx : number of atmospheric layers
+      integer, parameter :: nlayermx = llm 
+! nsoilmx : number of subterranean layers
+      !integer, parameter :: nsoilmx = 4 ! for a test 
+      integer, parameter :: nsoilmx = 18 ! for z1=0.02 cm, depth = 104.8 m 
+!-----------------------------------------------------------------------
+
+      common/dimphys/cursor
+      integer cursor  !! this is the position of point 1 on the globe
+                      !! it is 1 obviously for sequential runs
+                      !! but might differ for paraller runs
+                      !! it is used in phyetat0 mostly
+
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dsolver.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dsolver.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dsolver.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/dsolver.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dtridgl.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dtridgl.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/dtridgl.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/dtridgl.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/evap.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/evap.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/evap.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/evap.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/forceWCfn.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/forceWCfn.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/forceWCfn.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/forceWCfn.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gases_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gases_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gases_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/gases_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/generatedoth.sh
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/generatedoth.sh	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/generatedoth.sh	(revision 844)
@@ -0,0 +1,32 @@
+#! /bin/bash
+
+
+bandvis=32
+bandir=36
+
+bandvis=3
+bandir=2
+
+scatterers=1
+#nqmx=2
+
+\rm -f bands.h
+\rm -f scatterers.h
+
+cd bands
+# Build the appropriate 'bands.h' file
+makbands $bandvis $bandir
+# echo contents of bands.h to standard output
+cd ..
+cat bands.h
+
+# Build the appropriate 'scatterers.h' file
+cd scatterers
+./make_scatterers $scatterers
+# echo contents of scatterers.h to standard output
+cd ..
+cat scatterers.h
+
+#cp dimphys.h.ref dimphys.h
+#echo "         integer, parameter :: nqmx=$nqmx" >> dimphys.h
+#cat dimphys.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gfluxi.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gfluxi.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gfluxi.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/gfluxi.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gfluxv.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gfluxv.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gfluxv.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/gfluxv.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gradients_kcm.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gradients_kcm.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/gradients_kcm.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/gradients_kcm.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/hydrol.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/hydrol.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/hydrol.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/hydrol.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniaerosol.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniaerosol.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniaerosol.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/iniaerosol.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/inifis.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/inifis.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/inifis.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/inifis.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniorbit.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniorbit.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniorbit.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/iniorbit.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniphysiq.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniphysiq.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniphysiq.F	(revision 844)
@@ -0,0 +1,196 @@
+!
+! $Id: iniphysiq.F 1403 2010-07-01 09:02:53Z fairhead $
+!
+c
+c
+      SUBROUTINE iniphysiq(ngrid,nlayer,
+     $           punjours,
+     $           pdayref,ptimestep,
+     $           plat,plon,parea,pcu,pcv,
+     $           prad,pg,pr,pcpp,iflag_phys)
+      USE dimphy
+      USE mod_grid_phy_lmdz
+      USE mod_phys_lmdz_para
+      USE comgeomphy
+
+      USE infotrac, only: nqtot
+
+#ifdef CPP_IOIPSL
+      use IOIPSL
+#else
+! if not using IOIPSL, we still need to use (a local version of) getin
+      use ioipsl_getincom
+#endif
+
+      IMPLICIT NONE
+c
+c=======================================================================
+c
+c   subject:
+c   --------
+c
+c   Initialisation for the physical parametrisations of the LMD 
+c   martian atmospheric general circulation modele.
+c
+c   author: Frederic Hourdin 15 / 10 /93
+c   -------
+c
+c   arguments:
+c   ----------
+c
+c   input:
+c   ------
+c
+c    ngrid                 Size of the horizontal grid.
+c                          All internal loops are performed on that grid.
+c    nlayer                Number of vertical layers.
+c    pdayref               Day of reference for the simulation
+c    firstcall             True at the first call
+c    lastcall              True at the last call
+c    pday                  Number of days counted from the North. Spring
+c                          equinoxe.
+c
+c=======================================================================
+c
+c AS: modified for generic physiq
+c
+c-----------------------------------------------------------------------
+c   declarations:
+c   -------------
+ 
+cym#include "dimensions.h"
+cym#include "dimphy.h"
+cym#include "comgeomphy.h"
+
+#include "dimensions.h"
+#include "dimphys.h"  
+!#include "advtrac.h"  
+!iadv is already in infotrac but not invoked here
+#include "control.h"
+
+      REAL prad,pg,pr,pcpp,punjours
+ 
+      INTEGER ngrid,nlayer
+      !REAL plat(ngrid),plon(ngrid),parea(klon_glo)
+      REAL plat(ngrid),plon(ngrid),parea(ngrid)
+      REAL pcu(ngrid),pcv(ngrid)
+      INTEGER pdayref
+      INTEGER :: ibegin,iend,offset
+      INTEGER,INTENT(IN) :: iflag_phys ! type of physics to be called
+
+      INTEGER :: ngrid_sub
+ 
+      REAL ptimestep
+      CHARACTER (LEN=20) :: modname='iniphysiq'
+      CHARACTER (LEN=80) :: abort_message
+
+      IF (nlayer.NE.klev) THEN
+         PRINT*,'STOP in iniphysiq'
+         PRINT*,'Probleme de dimensions :'
+         PRINT*,'nlayer     = ',nlayer
+         PRINT*,'klev   = ',klev
+         abort_message = ''
+         CALL abort_gcm (modname,abort_message,1)
+      ENDIF
+
+      ngrid_sub = klon_mpi_end - klon_mpi_begin + 1
+      IF (ngrid_sub.NE.klon) THEN
+         PRINT*,'STOP in iniphysiq'
+         PRINT*,'Probleme de dimensions :'
+         PRINT*,'ngrid     = ', ngrid_sub
+         PRINT*,'klon   = ', klon
+         abort_message = ''
+         CALL abort_gcm (modname,abort_message,1)
+      ENDIF
+
+      !!!! WE HAVE TO FILL control.h FOR GENERIC PHYSICS
+      !!! -- NOT USED: periodav, nday, iperiod, iconser, idissip, anneeref
+      !!! -- NEEDED : day_step, iphysiq, ecritphy
+          !!!! 1. not done in conf_gcm
+          ecritphy=1
+          call getin("ecritphy",ecritphy)
+          PRINT*,"ecritphy = ",ecritphy
+          !!!! 2. done in conf_gcm, present in control_mod,
+          !!!!    but conflict if both control_mod.F90 and control.h!
+          day_step=240
+          call getin("day_step",day_step)
+          PRINT*,"day_step = ",day_step
+          iphysiq = 5
+          call getin("iphysiq",iphysiq)
+          PRINT*,"iphysiq = ",iphysiq
+
+c$OMP PARALLEL PRIVATE(ibegin,iend) 
+c$OMP+         SHARED(parea,pcu,pcv,plon,plat)
+      
+      offset=klon_mpi_begin-1
+      airephy(1:klon_omp)=parea(offset+klon_omp_begin:
+     &                          offset+klon_omp_end)
+      cuphy(1:klon_omp)=pcu(offset+klon_omp_begin:offset+klon_omp_end)
+      cvphy(1:klon_omp)=pcv(offset+klon_omp_begin:offset+klon_omp_end)
+      rlond(1:klon_omp)=plon(offset+klon_omp_begin:offset+klon_omp_end)
+      rlatd(1:klon_omp)=plat(offset+klon_omp_begin:offset+klon_omp_end)
+
+      !call suphel
+      print*,'not earth physics. we do not call suphel.'
+
+c$OMP END PARALLEL
+
+      !print*,'ATTENTION !!! TRAVAILLER SUR INIPHYSIQ'
+      !print*,'CONTROLE DES LATITUDES, LONGITUDES, PARAMETRES ...'
+      !print*, "BEFORE CORREC....", RA, RG, RD, RCPD
+      !print*, '------------------'
+      !print*, 'RAD ', prad, RA, 100.*abs((prad - RA)/RA)
+      !if (100.*abs((prad - RA)/RA) .gt. 0.1) RA = prad
+      !print*, '------------------'
+      !print*, 'G ', pg, RG, 100.*abs((pg - RG)/RG)
+      !if (100.*abs((pg - RG)/RG) .gt. 0.1) RG = pg
+      !print*, '------------------'
+      !print*, 'R ', pr, RD, 100.*abs((pr - RD)/RD)
+      !if (100.*abs((pr - RD)/RD) .gt. 0.1) RD = pr
+      !print*, '------------------'
+      !print*, 'CP ', pcpp, RCPD, 100.*abs((pcpp - RCPD)/RCPD)
+      !if (100.*abs((pcpp - RCPD)/RCPD) .gt. 0.1) RCPD = pcpp
+      !print*, "AFTER CORREC....", RA, RG, RD, RCPD
+     
+      print*,'agagagagagagagagaga'
+      print*,'klon_mpi_begin =', klon_mpi_begin
+      print*,'klon_mpi_end =', klon_mpi_end
+      print*,'klon_mpi =', klon_mpi
+      print*,'klon_mpi_para_nb =', klon_mpi_para_nb
+      print*,'klon_mpi_para_begin =', klon_mpi_para_begin
+      print*,'klon_mpi_para_end  =', klon_mpi_para_end
+      print*,'mpi_rank =', mpi_rank
+      print*,'mpi_size =', mpi_size
+      print*,'mpi_root =', mpi_root
+      print*,'klon_glo =', klon_glo
+      print*,'is_mpi_root =',is_mpi_root
+      print*,'is_omp_root =',is_omp_root
+
+      !!! AS: CALL inifis (previously done in calfis in planeto version of GCM)
+      !!!   punjours --> daysec
+      !!!   pdayref --> day_ini
+      print*, "START INIFIS !!!!"
+         call inifis(klon,nlayer,
+     $           pdayref,punjours,ptimestep,
+     $           plat(klon_mpi_begin:klon_mpi_end),
+     $           plon(klon_mpi_begin:klon_mpi_end),
+     $           parea(klon_mpi_begin:klon_mpi_end),
+     $           prad,pg,pr,pcpp)
+      print*, "END INIFIS !!!!"
+
+      !! this is an addition to dimphys.h
+      !! initialized in inifis for sequential runs with previous dyn core
+      !! modified here for parallel runs
+      cursor = klon_mpi_begin
+      print*, "CURSOR !!!!", mpi_rank, cursor
+
+      !!OKOKOKOKOK
+      !!print*, plat,plon,parea,prad,pg,pr,pcpp
+
+!      RETURN
+!9999  CONTINUE
+!      abort_message ='Cette version demande les fichier rnatur.dat
+!     & et surf.def'
+!      CALL abort_gcm (modname,abort_message,1)
+
+      END
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/inistats.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/inistats.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/inistats.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/inistats.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/init_phys_lmdz.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/init_phys_lmdz.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/init_phys_lmdz.F90	(revision 844)
@@ -0,0 +1,36 @@
+!
+!$Header$
+!
+SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
+  USE mod_phys_lmdz_para
+  USE mod_grid_phy_lmdz
+  USE dimphy, ONLY : Init_dimphy
+  USE infotrac, ONLY : type_trac
+#ifdef REPROBUS
+  USE CHEM_REP, ONLY : Init_chem_rep_phys
+#endif
+
+  IMPLICIT NONE
+  
+    INTEGER,INTENT(in) :: iim
+    INTEGER,INTENT(in) :: jjp1
+    INTEGER,INTENT(in) :: llm
+    INTEGER,INTENT(in) :: nb_proc
+    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+
+
+    CALL Init_grid_phy_lmdz(iim,jjp1,llm)
+    CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+!$OMP PARALLEL
+    CALL Init_dimphy(klon_omp,nbp_lev)
+
+! Initialization of Reprobus
+    IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+       CALL Init_chem_rep_phys(klon_omp,nbp_lev)
+#endif
+    END IF
+
+!$OMP END PARALLEL
+ 
+END SUBROUTINE Init_Phys_lmdz  
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/initracer.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/initracer.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/initracer.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/initracer.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/iniwrite.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite_specIR.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite_specIR.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite_specIR.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/iniwrite_specIR.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite_specVI.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite_specVI.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwrite_specVI.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/iniwrite_specVI.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwritesoil.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwritesoil.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iniwritesoil.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/iniwritesoil.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interp_line.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interp_line.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interp_line.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interp_line.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2H2.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2H2.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2H2.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interpolateH2H2.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2He.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2He.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2He.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interpolateH2He.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2Ocont_CKD.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2Ocont_CKD.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2Ocont_CKD.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interpolateH2Ocont_CKD.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2Ocont_PPC.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2Ocont_PPC.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateH2Ocont_PPC.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interpolateH2Ocont_PPC.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateN2H2.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateN2H2.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateN2H2.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interpolateN2H2.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateN2N2.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateN2N2.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/interpolateN2N2.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/interpolateN2N2.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iophy.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iophy.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/iophy.F90	(revision 844)
@@ -0,0 +1,444 @@
+!
+! $Header$
+!
+module iophy
+  
+! abd  REAL,private,allocatable,dimension(:),save :: io_lat
+! abd  REAL,private,allocatable,dimension(:),save :: io_lon
+  REAL,allocatable,dimension(:),save :: io_lat
+  REAL,allocatable,dimension(:),save :: io_lon
+  INTEGER, save :: phys_domain_id
+  INTEGER, save :: npstn
+  INTEGER, allocatable, dimension(:), save :: nptabij
+  
+  INTERFACE histwrite_phy
+    MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy
+  END INTERFACE
+
+  INTERFACE histbeg_phy_all
+    MODULE PROCEDURE histbeg_phy,histbeg_phy_points
+  END INTERFACE
+
+
+contains
+
+  subroutine init_iophy_new(rlat,rlon)
+  USE dimphy
+  USE mod_phys_lmdz_para
+  USE mod_grid_phy_lmdz
+  USE ioipsl
+  implicit none
+  include 'dimensions.h'   
+    real,dimension(klon),intent(in) :: rlon
+    real,dimension(klon),intent(in) :: rlat
+
+    REAL,dimension(klon_glo)        :: rlat_glo
+    REAL,dimension(klon_glo)        :: rlon_glo
+    
+    INTEGER,DIMENSION(2) :: ddid
+    INTEGER,DIMENSION(2) :: dsg
+    INTEGER,DIMENSION(2) :: dsl
+    INTEGER,DIMENSION(2) :: dpf
+    INTEGER,DIMENSION(2) :: dpl
+    INTEGER,DIMENSION(2) :: dhs
+    INTEGER,DIMENSION(2) :: dhe 
+    INTEGER :: i    
+
+    CALL gather(rlat,rlat_glo)
+    CALL bcast(rlat_glo)
+    CALL gather(rlon,rlon_glo)
+    CALL bcast(rlon_glo)
+    
+!$OMP MASTER  
+    ALLOCATE(io_lat(jjm+1-1/(iim*jjm)))
+    io_lat(1)=rlat_glo(1)
+    io_lat(jjm+1-1/(iim*jjm))=rlat_glo(klon_glo)
+    IF ((iim*jjm) > 1) then
+      DO i=2,jjm
+        io_lat(i)=rlat_glo(2+(i-2)*iim)
+      ENDDO
+    ENDIF
+
+    ALLOCATE(io_lon(iim))
+    io_lon(:)=rlon_glo(2-1/(iim*jjm):iim+1-1/(iim*jjm))
+
+    ddid=(/ 1,2 /)
+    dsg=(/ iim, jjm+1-1/(iim*jjm) /)
+    dsl=(/ iim, jj_nb /)
+    dpf=(/ 1,jj_begin /)
+    dpl=(/ iim, jj_end /)
+    dhs=(/ ii_begin-1,0 /)
+    if (mpi_rank==mpi_size-1) then
+      dhe=(/0,0/)
+    else
+      dhe=(/ iim-ii_end,0 /)  
+    endif
+    
+    call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, &
+                      'APPLE',phys_domain_id)
+
+!$OMP END MASTER
+      
+  end subroutine init_iophy_new
+
+  subroutine init_iophy(lat,lon)
+  USE dimphy
+  USE mod_phys_lmdz_para
+  use ioipsl
+  implicit none
+  include 'dimensions.h'   
+    real,dimension(iim),intent(in) :: lon
+    real,dimension(jjm+1-1/(iim*jjm)),intent(in) :: lat
+
+    INTEGER,DIMENSION(2) :: ddid
+    INTEGER,DIMENSION(2) :: dsg
+    INTEGER,DIMENSION(2) :: dsl
+    INTEGER,DIMENSION(2) :: dpf
+    INTEGER,DIMENSION(2) :: dpl
+    INTEGER,DIMENSION(2) :: dhs
+    INTEGER,DIMENSION(2) :: dhe 
+
+!$OMP MASTER  
+    allocate(io_lat(jjm+1-1/(iim*jjm)))
+    io_lat(:)=lat(:)
+    allocate(io_lon(iim))
+    io_lon(:)=lon(:)
+   
+    ddid=(/ 1,2 /)
+    dsg=(/ iim, jjm+1-1/(iim*jjm) /)
+    dsl=(/ iim, jj_nb /)
+    dpf=(/ 1,jj_begin /)
+    dpl=(/ iim, jj_end /)
+    dhs=(/ ii_begin-1,0 /)
+    if (mpi_rank==mpi_size-1) then
+      dhe=(/0,0/)
+    else
+      dhe=(/ iim-ii_end,0 /)  
+    endif
+    
+    call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, &
+                      'APPLE',phys_domain_id)
+
+!$OMP END MASTER
+      
+  end subroutine init_iophy
+  
+  subroutine histbeg_phy(name,itau0,zjulian,dtime,nhori,nid_day)
+  USE dimphy
+  USE mod_phys_lmdz_para
+  use ioipsl
+  use write_field
+  implicit none
+  include 'dimensions.h'
+    
+    character*(*), intent(IN) :: name
+    integer, intent(in) :: itau0
+    real,intent(in) :: zjulian
+    real,intent(in) :: dtime
+    integer,intent(out) :: nhori
+    integer,intent(out) :: nid_day
+
+!$OMP MASTER    
+    if (is_sequential) then
+      call histbeg(name,iim,io_lon, jj_nb,io_lat(jj_begin:jj_end), &
+                   1,iim,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day)
+    else
+      call histbeg(name,iim,io_lon, jj_nb,io_lat(jj_begin:jj_end), &
+                   1,iim,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day,phys_domain_id)
+    endif
+!$OMP END MASTER
+  
+  end subroutine histbeg_phy
+
+  subroutine histbeg_phy_points(rlon,rlat,pim,tabij,ipt,jpt, &
+             plon,plat,plon_bounds,plat_bounds, &
+             nname,itau0,zjulian,dtime,nnhori,nnid_day)
+  USE dimphy
+  USE mod_phys_lmdz_para
+  USE mod_grid_phy_lmdz
+  use ioipsl
+  use write_field
+  implicit none
+  include 'dimensions.h' 
+
+    real,dimension(klon),intent(in) :: rlon
+    real,dimension(klon),intent(in) :: rlat
+    integer, intent(in) :: itau0
+    real,intent(in) :: zjulian
+    real,intent(in) :: dtime
+    integer, intent(in) :: pim
+    integer, intent(out) :: nnhori
+    character(len=20), intent(in) :: nname
+    INTEGER, intent(out) :: nnid_day
+    integer :: i
+    REAL,dimension(klon_glo)        :: rlat_glo
+    REAL,dimension(klon_glo)        :: rlon_glo
+    INTEGER, DIMENSION(pim), intent(in)  :: tabij
+    REAL,dimension(pim), intent(in) :: plat, plon
+    INTEGER,dimension(pim), intent(in) :: ipt, jpt
+    REAL,dimension(pim,2), intent(out) :: plat_bounds, plon_bounds
+
+    INTEGER, SAVE :: tabprocbeg, tabprocend
+!$OMP THREADPRIVATE(tabprocbeg, tabprocend)
+    INTEGER :: ip
+    INTEGER, PARAMETER :: nip=1
+    INTEGER :: npproc
+    REAL, allocatable, dimension(:) :: npplat, npplon
+    REAL, allocatable, dimension(:,:) :: npplat_bounds, npplon_bounds
+    INTEGER, PARAMETER :: jjmp1=jjm+1-1/jjm
+    REAL, dimension(iim,jjmp1) :: zx_lon, zx_lat
+
+    CALL gather(rlat,rlat_glo)
+    CALL bcast(rlat_glo)
+    CALL gather(rlon,rlon_glo)
+    CALL bcast(rlon_glo)
+
+!$OMP MASTER
+    DO i=1,pim
+
+!    print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i)
+
+     plon_bounds(i,1)=rlon_glo(tabij(i)-1)
+     plon_bounds(i,2)=rlon_glo(tabij(i)+1)
+     if(plon_bounds(i,2).LE.0..AND.plon_bounds(i,1).GE.0.) THEN
+      if(rlon_glo(tabij(i)).GE.0.) THEN
+       plon_bounds(i,2)=-1*plon_bounds(i,2)
+      endif
+     endif
+     if(plon_bounds(i,2).GE.0..AND.plon_bounds(i,1).LE.0.) THEN
+      if(rlon_glo(tabij(i)).LE.0.) THEN
+       plon_bounds(i,2)=-1*plon_bounds(i,2)
+      endif
+     endif
+!
+     IF ( tabij(i).LE.iim) THEN
+      plat_bounds(i,1)=rlat_glo(tabij(i))
+     ELSE
+      plat_bounds(i,1)=rlat_glo(tabij(i)-iim)
+     ENDIF
+     plat_bounds(i,2)=rlat_glo(tabij(i)+iim)
+!
+!    print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon_glo(tabij(i)),plon_bounds(i,2) 
+!    print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat_glo(tabij(i)),plat_bounds(i,2) 
+!
+    ENDDO
+    if (is_sequential) then
+
+     npstn=pim
+     IF(.NOT. ALLOCATED(nptabij)) THEN
+      ALLOCATE(nptabij(pim))
+     ENDIF 
+     DO i=1,pim
+      nptabij(i)=tabij(i)
+     ENDDO
+
+       CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon_glo,zx_lon)
+       if ((iim*jjm).gt.1) then
+       DO i = 1, iim
+         zx_lon(i,1) = rlon_glo(i+1)
+         zx_lon(i,jjmp1) = rlon_glo(i+1)
+       ENDDO
+       endif
+       CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat_glo,zx_lat)
+
+    DO i=1,pim
+!    print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i)
+
+     plon_bounds(i,1)=zx_lon(ipt(i)-1,jpt(i))
+     plon_bounds(i,2)=zx_lon(ipt(i)+1,jpt(i))
+
+     if (ipt(i).EQ.1) then
+      plon_bounds(i,1)=zx_lon(iim,jpt(i))
+      plon_bounds(i,2)=360.+zx_lon(ipt(i)+1,jpt(i))
+     endif
+ 
+     if (ipt(i).EQ.iim) then
+      plon_bounds(i,2)=360.+zx_lon(1,jpt(i))
+     endif
+
+     plat_bounds(i,1)=zx_lat(ipt(i),jpt(i)-1)
+     plat_bounds(i,2)=zx_lat(ipt(i),jpt(i)+1)
+
+     if (jpt(i).EQ.1) then
+      plat_bounds(i,1)=zx_lat(ipt(i),1)+0.001
+      plat_bounds(i,2)=zx_lat(ipt(i),1)-0.001
+     endif
+ 
+     if (jpt(i).EQ.jjmp1) then
+      plat_bounds(i,1)=zx_lat(ipt(i),jjmp1)+0.001
+      plat_bounds(i,2)=zx_lat(ipt(i),jjmp1)-0.001
+     endif
+!
+!    print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon(tabij(i)),plon_bounds(i,2) 
+!    print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat(tabij(i)),plat_bounds(i,2) 
+!
+    ENDDO
+!    print*,'iophy is_sequential nname, nnhori, nnid_day=',trim(nname),nnhori,nnid_day
+     call histbeg(nname,pim,plon,plon_bounds, & 
+                           plat,plat_bounds, &
+                           itau0, zjulian, dtime, nnhori, nnid_day)
+    else
+     npproc=0
+     DO ip=1, pim
+      tabprocbeg=klon_mpi_begin
+      tabprocend=klon_mpi_end
+      IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN
+       npproc=npproc+1
+       npstn=npproc
+      ENDIF 
+     ENDDO
+!    print*,'CFMIP_iophy mpi_rank npstn',mpi_rank,npstn
+     IF(.NOT. ALLOCATED(nptabij)) THEN
+      ALLOCATE(nptabij(npstn))
+      ALLOCATE(npplon(npstn), npplat(npstn))
+      ALLOCATE(npplon_bounds(npstn,2), npplat_bounds(npstn,2))
+     ENDIF
+     npproc=0
+     DO ip=1, pim
+      IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN
+       npproc=npproc+1
+       nptabij(npproc)=tabij(ip)
+!      print*,'mpi_rank npproc ip plon plat tabij=',mpi_rank,npproc,ip, &
+!      plon(ip),plat(ip),tabij(ip)
+       npplon(npproc)=plon(ip)
+       npplat(npproc)=plat(ip)
+       npplon_bounds(npproc,1)=plon_bounds(ip,1)
+       npplon_bounds(npproc,2)=plon_bounds(ip,2)
+       npplat_bounds(npproc,1)=plat_bounds(ip,1)
+       npplat_bounds(npproc,2)=plat_bounds(ip,2)
+!!!
+!!! print qui sert a reordonner les points stations selon l'ordre CFMIP
+!!! ne pas enlever
+        print*,'iophy_mpi rank ip lon lat',mpi_rank,ip,plon(ip),plat(ip)
+!!!
+      ENDIF
+     ENDDO
+     call histbeg(nname,npstn,npplon,npplon_bounds, &
+                            npplat,npplat_bounds, &
+                            itau0,zjulian,dtime,nnhori,nnid_day,phys_domain_id)
+    endif
+!$OMP END MASTER
+
+  end subroutine histbeg_phy_points
+ 
+  subroutine histwrite2d_phy(nid,lpoint,name,itau,field)
+  USE dimphy
+  USE mod_phys_lmdz_para
+  USE ioipsl
+  implicit none
+  include 'dimensions.h'
+    
+    integer,intent(in) :: nid
+    logical,intent(in) :: lpoint 
+    character*(*), intent(IN) :: name
+    integer, intent(in) :: itau
+    real,dimension(:),intent(in) :: field
+    REAL,dimension(klon_mpi) :: buffer_omp
+    INTEGER, allocatable, dimension(:) :: index2d
+    REAL :: Field2d(iim,jj_nb)
+
+    integer :: ip
+    real,allocatable,dimension(:) :: fieldok
+
+    IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first dimension not equal to klon',1)
+    
+    CALL Gather_omp(field,buffer_omp)    
+!$OMP MASTER
+    CALL grid1Dto2D_mpi(buffer_omp,Field2d)
+    if(.NOT.lpoint) THEN
+     ALLOCATE(index2d(iim*jj_nb))
+     ALLOCATE(fieldok(iim*jj_nb))
+     CALL histwrite(nid,name,itau,Field2d,iim*jj_nb,index2d)
+    else
+     ALLOCATE(fieldok(npstn))
+     ALLOCATE(index2d(npstn))
+
+     if(is_sequential) then
+!     klon_mpi_begin=1
+!     klon_mpi_end=klon
+      DO ip=1, npstn
+       fieldok(ip)=buffer_omp(nptabij(ip))
+      ENDDO
+     else
+      DO ip=1, npstn
+!     print*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip)
+       IF(nptabij(ip).GE.klon_mpi_begin.AND. &
+          nptabij(ip).LE.klon_mpi_end) THEN
+         fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1)
+       ENDIF
+      ENDDO
+     endif
+     CALL histwrite(nid,name,itau,fieldok,npstn,index2d)
+!
+    endif
+    deallocate(index2d)
+    deallocate(fieldok)
+!$OMP END MASTER    
+  end subroutine histwrite2d_phy
+
+  subroutine histwrite3d_phy(nid,lpoint,name,itau,field)
+  USE dimphy
+  USE mod_phys_lmdz_para
+
+  use ioipsl
+  implicit none
+  include 'dimensions.h'
+    
+    integer,intent(in) :: nid
+    logical,intent(in) :: lpoint
+    character*(*), intent(IN) :: name
+    integer, intent(in) :: itau
+    real,dimension(:,:),intent(in) :: field  ! --> field(klon,:)
+    REAL,dimension(klon_mpi,size(field,2)) :: buffer_omp
+    REAL :: Field3d(iim,jj_nb,size(field,2))
+    INTEGER :: ip, n, nlev
+    INTEGER, ALLOCATABLE, dimension(:) :: index3d
+    real,allocatable, dimension(:,:) :: fieldok
+
+    IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first dimension not equal to klon',1)
+    nlev=size(field,2)
+
+!   print*,'hist3d_phy mpi_rank npstn=',mpi_rank,npstn
+
+!   DO ip=1, npstn
+!    print*,'hist3d_phy mpi_rank nptabij',mpi_rank,nptabij(ip)
+!   ENDDO
+
+    CALL Gather_omp(field,buffer_omp)
+!$OMP MASTER
+    CALL grid1Dto2D_mpi(buffer_omp,field3d)
+    if(.NOT.lpoint) THEN
+     ALLOCATE(index3d(iim*jj_nb*nlev))
+     ALLOCATE(fieldok(iim*jj_nb,nlev))
+     CALL histwrite(nid,name,itau,Field3d,iim*jj_nb*nlev,index3d)
+    else
+      nlev=size(field,2)
+      ALLOCATE(index3d(npstn*nlev))
+      ALLOCATE(fieldok(npstn,nlev))
+
+      if(is_sequential) then
+!      klon_mpi_begin=1
+!      klon_mpi_end=klon
+       DO n=1, nlev
+       DO ip=1, npstn
+        fieldok(ip,n)=buffer_omp(nptabij(ip),n)
+       ENDDO
+       ENDDO
+      else
+       DO n=1, nlev
+       DO ip=1, npstn
+        IF(nptabij(ip).GE.klon_mpi_begin.AND. &
+         nptabij(ip).LE.klon_mpi_end) THEN
+         fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n)
+        ENDIF
+       ENDDO
+       ENDDO
+      endif
+      CALL histwrite(nid,name,itau,fieldok,npstn*nlev,index3d)
+    endif 
+  deallocate(index3d)
+  deallocate(fieldok)
+!$OMP END MASTER    
+  end subroutine histwrite3d_phy
+  
+end module iophy
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/kcmprof_fn.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/kcmprof_fn.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/kcmprof_fn.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/kcmprof_fn.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/lagrange.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/lagrange.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/lagrange.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/lagrange.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/largescale.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/largescale.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/largescale.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/largescale.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/lmdstd.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/lmdstd.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/lmdstd.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/bibio/lmdstd.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mass_redistribution.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mass_redistribution.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mass_redistribution.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/mass_redistribution.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mkstat.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mkstat.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mkstat.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/mkstat.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_grid_phy_lmdz.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_grid_phy_lmdz.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_grid_phy_lmdz.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.VENUS/libf/phyvenus/mod_grid_phy_lmdz.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_mpi_data.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_mpi_data.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_mpi_data.F90	(revision 844)
@@ -0,0 +1,203 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_mpi_data
+  USE mod_const_mpi
+  
+  INTEGER,SAVE :: ii_begin
+  INTEGER,SAVE :: ii_end
+  INTEGER,SAVE :: jj_begin
+  INTEGER,SAVE :: jj_end
+  INTEGER,SAVE :: jj_nb
+  INTEGER,SAVE :: ij_begin
+  INTEGER,SAVE :: ij_end
+  INTEGER,SAVE :: ij_nb
+  INTEGER,SAVE :: klon_mpi_begin
+  INTEGER,SAVE :: klon_mpi_end
+  INTEGER,SAVE :: klon_mpi
+  
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_end
+
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_end
+
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_nb
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_end
+
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_nb
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_end 
+
+  
+  INTEGER,SAVE :: mpi_rank
+  INTEGER,SAVE :: mpi_size
+  INTEGER,SAVE :: mpi_root
+  LOGICAL,SAVE :: is_mpi_root
+  LOGICAL,SAVE :: is_using_mpi
+  
+  
+  LOGICAL,SAVE :: is_north_pole
+  LOGICAL,SAVE :: is_south_pole
+  INTEGER,SAVE :: COMM_LMDZ_PHY
+
+CONTAINS
+  
+  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+  USE mod_const_mpi, ONLY : COMM_LMDZ
+  IMPLICIT NONE
+    INTEGER,INTENT(in) :: iim
+    INTEGER,INTENT(in) :: jjp1
+    INTEGER,INTENT(in) :: nb_proc
+    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    
+    INTEGER :: ierr
+    INTEGER :: klon_glo
+    INTEGER :: i
+    
+#ifdef CPP_MPI
+    is_using_mpi=.TRUE.
+#else
+    is_using_mpi=.FALSE.
+#endif
+    
+    if (iim.eq.1) then
+       klon_glo=1
+    else
+       klon_glo=iim*(jjp1-2)+2
+    endif
+    
+    COMM_LMDZ_PHY=COMM_LMDZ
+
+    IF (is_using_mpi) THEN    
+#ifdef CPP_MPI
+      CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)    
+      CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
+#endif
+    ELSE
+      mpi_size=1
+      mpi_rank=0
+    ENDIF
+    
+    IF (mpi_rank == 0) THEN
+      mpi_root = 0
+      is_mpi_root = .true.
+    ENDIF
+    
+    IF (mpi_rank == 0) THEN 
+      is_north_pole = .TRUE.
+    ELSE
+      is_north_pole = .FALSE.
+    ENDIF
+    
+    IF (mpi_rank == mpi_size-1) THEN
+      is_south_pole = .TRUE.
+    ELSE
+      is_south_pole = .FALSE.
+    ENDIF
+    
+    ALLOCATE(jj_para_nb(0:mpi_size-1))
+    ALLOCATE(jj_para_begin(0:mpi_size-1))
+    ALLOCATE(jj_para_end(0:mpi_size-1))
+    
+    ALLOCATE(ij_para_nb(0:mpi_size-1))
+    ALLOCATE(ij_para_begin(0:mpi_size-1))
+    ALLOCATE(ij_para_end(0:mpi_size-1))
+    
+    ALLOCATE(ii_para_begin(0:mpi_size-1))
+    ALLOCATE(ii_para_end(0:mpi_size-1))
+
+    ALLOCATE(klon_mpi_para_nb(0:mpi_size-1))
+    ALLOCATE(klon_mpi_para_begin(0:mpi_size-1))
+    ALLOCATE(klon_mpi_para_end(0:mpi_size-1))
+  
+      
+    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:nb_proc-1)
+
+    DO i=0,mpi_size-1
+      IF (i==0) THEN 
+        klon_mpi_para_begin(i)=1
+      ELSE 
+        klon_mpi_para_begin(i)=klon_mpi_para_end(i-1)+1
+      ENDIF
+        klon_mpi_para_end(i)=klon_mpi_para_begin(i)+klon_mpi_para_nb(i)-1
+    ENDDO
+
+
+    DO i=0,mpi_size-1
+      
+      IF (i==0) THEN
+        ij_para_begin(i) = 1
+      ELSE
+        ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
+      ENDIF
+
+      jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
+      ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
+
+      
+      ij_para_end(i) = klon_mpi_para_end(i)+iim-1
+      jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
+      ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
+
+
+      ij_para_nb(i) = ij_para_end(i)-ij_para_begin(i)+1
+      jj_para_nb(i) = jj_para_end(i)-jj_para_begin(i)+1
+         
+    ENDDO
+  
+    ii_begin = ii_para_begin(mpi_rank)
+    ii_end   = ii_para_end(mpi_rank)
+    jj_begin = jj_para_begin(mpi_rank)
+    jj_end   = jj_para_end(mpi_rank)
+    jj_nb    = jj_para_nb(mpi_rank)
+    ij_begin = ij_para_begin(mpi_rank)
+    ij_end   = ij_para_end(mpi_rank)
+    ij_nb    = ij_para_nb(mpi_rank)
+    klon_mpi_begin = klon_mpi_para_begin(mpi_rank)
+    klon_mpi_end   = klon_mpi_para_end(mpi_rank)
+    klon_mpi       = klon_mpi_para_nb(mpi_rank)
+   
+    CALL Print_module_data
+    
+  END SUBROUTINE Init_phys_lmdz_mpi_data
+
+  SUBROUTINE print_module_data
+  IMPLICIT NONE
+  INCLUDE "iniprint.h" 
+  
+    WRITE(lunout,*) 'ii_begin =', ii_begin
+    WRITE(lunout,*) 'ii_end =', ii_end
+    WRITE(lunout,*) 'jj_begin =',jj_begin
+    WRITE(lunout,*) 'jj_end =', jj_end
+    WRITE(lunout,*) 'jj_nb =', jj_nb
+    WRITE(lunout,*) 'ij_begin =', ij_begin
+    WRITE(lunout,*) 'ij_end =', ij_end
+    WRITE(lunout,*) 'ij_nb =', ij_nb
+    WRITE(lunout,*) 'klon_mpi_begin =', klon_mpi_begin
+    WRITE(lunout,*) 'klon_mpi_end =', klon_mpi_end
+    WRITE(lunout,*) 'klon_mpi =', klon_mpi
+    WRITE(lunout,*) 'jj_para_nb =', jj_para_nb
+    WRITE(lunout,*) 'jj_para_begin =', jj_para_begin
+    WRITE(lunout,*) 'jj_para_end =', jj_para_end
+    WRITE(lunout,*) 'ii_para_begin =', ii_para_begin
+    WRITE(lunout,*) 'ii_para_end =', ii_para_end
+    WRITE(lunout,*) 'ij_para_nb =', ij_para_nb
+    WRITE(lunout,*) 'ij_para_begin =', ij_para_begin
+    WRITE(lunout,*) 'ij_para_end =', ij_para_end
+    WRITE(lunout,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
+    WRITE(lunout,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
+    WRITE(lunout,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
+    WRITE(lunout,*) 'mpi_rank =', mpi_rank
+    WRITE(lunout,*) 'mpi_size =', mpi_size
+    WRITE(lunout,*) 'mpi_root =', mpi_root
+    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
+    WRITE(lunout,*) 'is_north_pole =', is_north_pole
+    WRITE(lunout,*) 'is_south_pole =', is_south_pole
+    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
+  
+  END SUBROUTINE print_module_data
+  
+END MODULE mod_phys_lmdz_mpi_data
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_mpi_transfert.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_mpi_transfert.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_mpi_transfert.F90	(revision 844)
@@ -0,0 +1,1902 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_mpi_transfert
+
+
+  INTERFACE bcast_mpi
+    MODULE PROCEDURE bcast_mpi_c,                                                     &
+                     bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
+                     bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
+		     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
+  END INTERFACE
+
+  INTERFACE scatter_mpi
+    MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
+                     scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
+		     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
+  END INTERFACE
+
+  
+  INTERFACE gather_mpi
+    MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
+                     gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
+		     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
+  END INTERFACE
+  
+  INTERFACE scatter2D_mpi
+    MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
+                     scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
+		     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
+  END INTERFACE
+
+  INTERFACE gather2D_mpi
+    MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
+                     gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
+		     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
+  END INTERFACE 
+  
+  INTERFACE reduce_sum_mpi
+    MODULE PROCEDURE reduce_sum_mpi_i,reduce_sum_mpi_i1,reduce_sum_mpi_i2,reduce_sum_mpi_i3,reduce_sum_mpi_i4, &
+                     reduce_sum_mpi_r,reduce_sum_mpi_r1,reduce_sum_mpi_r2,reduce_sum_mpi_r3,reduce_sum_mpi_r4
+  END INTERFACE 
+
+ INTERFACE grid1dTo2d_mpi
+    MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
+                     grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
+		     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
+ END INTERFACE 
+
+ INTERFACE grid2dTo1d_mpi
+    MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
+                     grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
+		     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
+ END INTERFACE 
+    
+CONTAINS
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Broadcast --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaine de charactère -- !!
+
+  SUBROUTINE bcast_mpi_c(var1)
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var1
+   
+    CALL bcast_mpi_cgen(Var1,len(Var1))
+
+  END SUBROUTINE bcast_mpi_c
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE bcast_mpi_i(var)
+  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var
+    
+    INTEGER               :: var_tmp(1)
+    
+    IF (is_mpi_root) var_tmp(1)=var
+    CALL bcast_mpi_igen(Var_tmp,1)
+    var=var_tmp(1)
+    
+  END SUBROUTINE bcast_mpi_i
+
+  SUBROUTINE bcast_mpi_i1(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:)
+
+    CALL bcast_mpi_igen(Var,size(Var))
+    
+  END SUBROUTINE bcast_mpi_i1
+
+  SUBROUTINE bcast_mpi_i2(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:)
+   
+    CALL bcast_mpi_igen(Var,size(Var))
+  
+  END SUBROUTINE bcast_mpi_i2
+
+  SUBROUTINE bcast_mpi_i3(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:)
+   
+    CALL bcast_mpi_igen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_i3
+
+  SUBROUTINE bcast_mpi_i4(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL bcast_mpi_igen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_i4
+
+
+!! -- Les reels -- !!
+
+  SUBROUTINE bcast_mpi_r(var)
+  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var
+    REAL               :: var_tmp(1)
+    
+    IF (is_mpi_root) var_tmp(1)=var
+    CALL bcast_mpi_rgen(Var_tmp,1)
+    var=var_tmp(1)   
+
+  END SUBROUTINE bcast_mpi_r
+
+  SUBROUTINE bcast_mpi_r1(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r1
+
+  SUBROUTINE bcast_mpi_r2(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r2
+
+  SUBROUTINE bcast_mpi_r3(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r3
+
+  SUBROUTINE bcast_mpi_r4(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r4
+  
+!! -- Les booleans -- !!
+
+  SUBROUTINE bcast_mpi_l(var)
+  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var
+    LOGICAL               :: var_tmp(1)
+    
+    IF (is_mpi_root) var_tmp(1)=var
+    CALL bcast_mpi_lgen(Var_tmp,1)
+    var=var_tmp(1)   
+
+  END SUBROUTINE bcast_mpi_l
+
+  SUBROUTINE bcast_mpi_l1(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l1
+
+  SUBROUTINE bcast_mpi_l2(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l2
+
+  SUBROUTINE bcast_mpi_l3(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l3
+
+  SUBROUTINE bcast_mpi_l4(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l4
+  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter_mpi_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL scatter_mpi_igen(VarIn,Varout,1)
+    
+  END SUBROUTINE scatter_mpi_i
+
+  SUBROUTINE scatter_mpi_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2))
+    
+  END SUBROUTINE scatter_mpi_i1
+  
+  SUBROUTINE scatter_mpi_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
+
+  END SUBROUTINE scatter_mpi_i2
+
+  SUBROUTINE scatter_mpi_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
+  
+  END SUBROUTINE scatter_mpi_i3
+
+
+  SUBROUTINE scatter_mpi_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,1)
+  
+  END SUBROUTINE scatter_mpi_r
+
+  SUBROUTINE scatter_mpi_r1(VarIn, VarOut)
+  USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+  IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2))
+  
+  END SUBROUTINE scatter_mpi_r1
+  
+  SUBROUTINE scatter_mpi_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
+  
+  END SUBROUTINE scatter_mpi_r2
+
+  SUBROUTINE scatter_mpi_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
+  
+  END SUBROUTINE scatter_mpi_r3
+
+
+  SUBROUTINE scatter_mpi_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,1)
+    
+  END SUBROUTINE scatter_mpi_l
+
+  SUBROUTINE scatter_mpi_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2))
+  
+  END SUBROUTINE scatter_mpi_l1
+  
+  SUBROUTINE scatter_mpi_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
+  
+  END SUBROUTINE scatter_mpi_l2
+
+  SUBROUTINE scatter_mpi_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
+  
+  END SUBROUTINE scatter_mpi_l3  
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 
+!!!!! --> Les entiers
+
+  SUBROUTINE gather_mpi_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE gather_mpi_i
+  
+
+!!!!!
+
+  SUBROUTINE gather_mpi_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2))
+  
+  END SUBROUTINE gather_mpi_i1
+
+!!!!!
+  
+  SUBROUTINE gather_mpi_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
+  
+  END SUBROUTINE gather_mpi_i2
+
+!!!!!
+
+  SUBROUTINE gather_mpi_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
+  
+  END SUBROUTINE gather_mpi_i3
+
+!!!!! --> Les reels
+
+  SUBROUTINE gather_mpi_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE gather_mpi_r
+
+!!!!!
+
+  SUBROUTINE gather_mpi_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2))
+  
+  END SUBROUTINE gather_mpi_r1
+
+!!!!!
+  
+  SUBROUTINE gather_mpi_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
+  
+  END SUBROUTINE gather_mpi_r2
+
+!!!!!
+
+  SUBROUTINE gather_mpi_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
+  
+  END SUBROUTINE gather_mpi_r3
+
+!!!!! --> Les booleen
+
+  SUBROUTINE gather_mpi_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL gather_mpi_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE gather_mpi_l
+
+!!!!!
+
+  SUBROUTINE gather_mpi_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2))
+  
+  END SUBROUTINE gather_mpi_l1
+
+!!!!!
+  
+  SUBROUTINE gather_mpi_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
+  
+  END SUBROUTINE gather_mpi_l2
+
+!!!!!
+
+  SUBROUTINE gather_mpi_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
+  
+  END SUBROUTINE gather_mpi_l3
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter2D_mpi_i(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo) :: Var_tmp    
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_i
+
+  SUBROUTINE scatter2D_mpi_i1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    INTEGER,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_i1
+
+  SUBROUTINE scatter2D_mpi_i2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_i2
+  
+  SUBROUTINE scatter2D_mpi_i3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    INTEGER,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter2D_mpi_i3
+
+
+
+  SUBROUTINE scatter2D_mpi_r(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    REAL,DIMENSION(klon_glo) :: Var_tmp    
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_R
+
+
+  SUBROUTINE scatter2D_mpi_r1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_r1
+
+
+  SUBROUTINE scatter2D_mpi_r2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_r2
+  
+  SUBROUTINE scatter2D_mpi_r3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+ 
+  END SUBROUTINE scatter2D_mpi_r3
+  
+  
+  SUBROUTINE scatter2D_mpi_l(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_glo) :: Var_tmp    
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_l
+
+
+  SUBROUTINE scatter2D_mpi_l1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+  
+  END SUBROUTINE scatter2D_mpi_l1
+
+
+  SUBROUTINE scatter2D_mpi_l2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
+  
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_l2
+  
+  SUBROUTINE scatter2D_mpi_l3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+ 
+  END SUBROUTINE scatter2D_mpi_l3
+  
+  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE gather2D_mpi_i(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_glo) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i
+
+  SUBROUTINE gather2D_mpi_i1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i1
+
+  SUBROUTINE gather2D_mpi_i2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i2
+  
+  SUBROUTINE gather2D_mpi_i3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+ 
+    INTEGER,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i3
+
+
+
+  SUBROUTINE gather2D_mpi_r(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r
+
+  SUBROUTINE gather2D_mpi_r1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r1
+
+  SUBROUTINE gather2D_mpi_r2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r2
+  
+  SUBROUTINE gather2D_mpi_r3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r3
+
+  
+  
+  SUBROUTINE gather2D_mpi_l(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l
+
+  SUBROUTINE gather2D_mpi_l1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l1
+
+  SUBROUTINE gather2D_mpi_l2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l2
+  
+  SUBROUTINE gather2D_mpi_l3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l3
+  
+  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des reduce_sum   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE reduce_sum_mpi_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN)  :: VarIn
+    INTEGER,INTENT(OUT) :: VarOut
+    INTEGER             :: VarIn_tmp(1)
+    INTEGER             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn    
+    CALL reduce_sum_mpi_igen(VarIn_tmp,Varout_tmp,1)
+    VarOut=VarOut_tmp(1)
+    
+  END SUBROUTINE reduce_sum_mpi_i
+
+  SUBROUTINE reduce_sum_mpi_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i1
+
+  SUBROUTINE reduce_sum_mpi_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i2
+
+  SUBROUTINE reduce_sum_mpi_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i3
+
+  SUBROUTINE reduce_sum_mpi_i4(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i4                  
+  
+  
+  SUBROUTINE reduce_sum_mpi_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN)  :: VarIn
+    REAL,INTENT(OUT) :: VarOut
+    REAL             :: VarIn_tmp(1)
+    REAL             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn    
+    CALL reduce_sum_mpi_rgen(VarIn_tmp,Varout_tmp,1)
+    VarOut=VarOut_tmp(1)
+  
+  END SUBROUTINE reduce_sum_mpi_r
+
+  SUBROUTINE reduce_sum_mpi_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+     
+  END SUBROUTINE reduce_sum_mpi_r1
+
+  SUBROUTINE reduce_sum_mpi_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_r2
+
+  SUBROUTINE reduce_sum_mpi_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_r3
+
+  SUBROUTINE reduce_sum_mpi_r4(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_r4 
+  
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! SUBROUTINE grid1dTo2d  !!  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+  SUBROUTINE grid1dTo2d_mpi_i(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_mpi_i
+  
+
+  SUBROUTINE grid1dTo2d_mpi_i1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_mpi_i1
+
+  SUBROUTINE grid1dTo2d_mpi_i2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_mpi_i2
+  
+  SUBROUTINE grid1dTo2d_mpi_i3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_mpi_i3
+
+
+  SUBROUTINE grid1dTo2d_mpi_r(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_mpi_r
+  
+
+  SUBROUTINE grid1dTo2d_mpi_r1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_mpi_r1
+
+  SUBROUTINE grid1dTo2d_mpi_r2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_mpi_r2
+  
+  SUBROUTINE grid1dTo2d_mpi_r3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_mpi_r3
+  
+  
+  
+  SUBROUTINE grid1dTo2d_mpi_l(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_mpi_l
+  
+
+  SUBROUTINE grid1dTo2d_mpi_l1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_mpi_l1
+
+  SUBROUTINE grid1dTo2d_mpi_l2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_mpi_l2
+  
+  SUBROUTINE grid1dTo2d_mpi_l3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_mpi_l3
+
+
+  SUBROUTINE grid2dTo1d_mpi_i(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_mpi_i
+  
+
+  SUBROUTINE grid2dTo1d_mpi_i1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_mpi_i1
+
+  SUBROUTINE grid2dTo1d_mpi_i2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_mpi_i2
+  
+  SUBROUTINE grid2dTo1d_mpi_i3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_mpi_i3
+ 
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_r(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_mpi_r
+  
+
+  SUBROUTINE grid2dTo1d_mpi_r1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_mpi_r1
+
+  SUBROUTINE grid2dTo1d_mpi_r2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_mpi_r2
+  
+  SUBROUTINE grid2dTo1d_mpi_r3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_mpi_r3
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_l(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_mpi_l
+  
+
+  SUBROUTINE grid2dTo1d_mpi_l1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_mpi_l1
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_l2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_mpi_l2
+
+  
+  SUBROUTINE grid2dTo1d_mpi_l3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_mpi_l3
+
+               
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! DEFINITION DES FONCTIONS DE TRANSFERT GENERIQUES !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE bcast_mpi_cgen(var,nb)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    IMPLICIT NONE
+    
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+    INTEGER,INTENT(IN) :: nb
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+    
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+#endif
+        
+  END SUBROUTINE bcast_mpi_cgen
+
+
+      
+  SUBROUTINE bcast_mpi_igen(var,nb)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    IMPLICIT NONE
+    
+    INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
+    INTEGER,INTENT(IN) :: nb
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+#endif
+        
+  END SUBROUTINE bcast_mpi_igen
+
+
+
+  
+  SUBROUTINE bcast_mpi_rgen(var,nb)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    IMPLICIT NONE
+    
+    REAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    INTEGER,INTENT(IN) :: nb
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_root_x,COMM_LMDZ_PHY,ierr)
+#endif
+    
+  END SUBROUTINE bcast_mpi_rgen
+  
+
+
+
+  SUBROUTINE bcast_mpi_lgen(var,nb)
+    USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
+    IMPLICIT NONE
+    
+    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    INTEGER,INTENT(IN) :: nb
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_root_x,COMM_LMDZ_PHY,ierr)
+#endif
+
+  END SUBROUTINE bcast_mpi_lgen
+
+  
+
+  SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    INTEGER,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+    
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        DO i=1,dimsize
+          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+      
+#ifdef CPP_MPI 
+    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize,   &
+                      MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
+#endif
+
+  END SUBROUTINE scatter_mpi_igen
+
+  SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    REAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+    
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        DO i=1,dimsize
+          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+      
+#ifdef CPP_MPI 
+    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize,   &
+                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
+
+#endif
+
+  END SUBROUTINE scatter_mpi_rgen
+
+  
+  SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    LOGICAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+    
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        DO i=1,dimsize
+          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+      
+#ifdef CPP_MPI
+    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize,   &
+                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
+#endif
+
+  END SUBROUTINE scatter_mpi_lgen  
+
+
+
+
+  SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
+  
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    INTEGER,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+	Index=Index+nb*dimsize
+      ENDDO
+     
+    ENDIF
+    
+#ifdef CPP_MPI
+    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
+                     MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
+#endif
+
+		          
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        DO i=1,dimsize
+          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
+	  Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE gather_mpi_igen  
+
+  SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
+  
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    REAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+	Index=Index+nb*dimsize
+      ENDDO
+    ENDIF
+    
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+#ifdef CPP_MPI
+    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
+                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
+#endif
+		          
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        DO i=1,dimsize
+          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
+	  Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE gather_mpi_rgen  
+
+  SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    LOGICAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+    
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+	Index=Index+nb*dimsize
+      ENDDO
+    ENDIF
+    
+
+#ifdef CPP_MPI
+    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
+                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
+#endif
+		          
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        DO i=1,dimsize
+          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
+	  Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE gather_mpi_lgen
+  
+
+
+  SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+   
+    INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
+    INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut    
+    INTEGER,INTENT(IN) :: nb
+    INTEGER :: ierr
+   
+    IF (.not.is_using_mpi) THEN
+      VarOut(:)=VarIn(:)
+      RETURN
+    ENDIF
+
+
+#ifdef CPP_MPI
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+#endif
+            
+  END SUBROUTINE reduce_sum_mpi_igen
+  
+  SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
+    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_grid_phy_lmdz
+
+    IMPLICIT NONE
+
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    
+    REAL,DIMENSION(nb),INTENT(IN) :: VarIn
+    REAL,DIMENSION(nb),INTENT(OUT) :: VarOut    
+    INTEGER,INTENT(IN) :: nb
+    INTEGER :: ierr
+ 
+    IF (.not.is_using_mpi) THEN
+      VarOut(:)=VarIn(:)
+      RETURN
+    ENDIF
+   
+#ifdef CPP_MPI
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+#endif
+        
+  END SUBROUTINE reduce_sum_mpi_rgen
+
+
+
+  SUBROUTINE grid1dTo2d_mpi_igen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    VarOut(1:nbp_lon,:)=0
+    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=0
+    
+    offset=ii_begin
+    IF (is_north_pole) Offset=nbp_lon
+    
+    
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        DO ij=1,nbp_lon
+         VarOut(ij,i)=VarIn(1,i)
+	ENDDO
+      ENDDO
+    ENDIF
+    
+    IF (is_south_pole) THEN 
+      DO i=1,dimsize
+        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
+         VarOut(ij,i)=VarIn(klon_mpi,i)
+	ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE grid1dTo2d_mpi_igen   
+
+
+  SUBROUTINE grid1dTo2d_mpi_rgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
+    REAL,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    VarOut(1:nbp_lon,:)=0
+    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=0
+    
+    offset=ii_begin
+    IF (is_north_pole) Offset=nbp_lon
+    
+    
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        DO ij=1,nbp_lon
+         VarOut(ij,i)=VarIn(1,i)
+	ENDDO
+      ENDDO
+    ENDIF
+    
+    IF (is_south_pole) THEN 
+      DO i=1,dimsize
+        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
+         VarOut(ij,i)=VarIn(klon_mpi,i)
+	ENDDO
+      ENDDO
+    ENDIF
+
+   END SUBROUTINE grid1dTo2d_mpi_rgen   
+
+
+
+  SUBROUTINE grid1dTo2d_mpi_lgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    VarOut(1:nbp_lon,:)=.FALSE.
+    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=.FALSE.
+    
+    offset=ii_begin
+    IF (is_north_pole) Offset=nbp_lon
+    
+    
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        DO ij=1,nbp_lon
+         VarOut(ij,i)=VarIn(1,i)
+	ENDDO
+      ENDDO
+    ENDIF
+    
+    IF (is_south_pole) THEN 
+      DO i=1,dimsize
+        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
+         VarOut(ij,i)=VarIn(klon_mpi,i)
+	ENDDO
+      ENDDO
+    ENDIF
+
+   END SUBROUTINE grid1dTo2d_mpi_lgen   
+
+  
+
+
+  SUBROUTINE grid2dTo1d_mpi_igen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=ii_begin
+    IF (is_north_pole) offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        VarOut(1,i)=VarIn(1,i)
+      ENDDO
+    ENDIF
+    
+    
+  END SUBROUTINE grid2dTo1d_mpi_igen   
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_rgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=ii_begin
+    IF (is_north_pole) offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+         VarOut(1,i)=VarIn(1,i)
+      ENDDO
+    ENDIF
+    
+    
+  END SUBROUTINE grid2dTo1d_mpi_rgen   
+  
+
+  SUBROUTINE grid2dTo1d_mpi_lgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=ii_begin
+    IF (is_north_pole) offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        VarOut(1,i)=VarIn(1,i)
+      ENDDO
+    ENDIF
+    
+    
+  END SUBROUTINE grid2dTo1d_mpi_lgen   
+
+END MODULE mod_phys_lmdz_mpi_transfert
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_omp_data.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_omp_data.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_omp_data.F90	(revision 844)
@@ -0,0 +1,109 @@
+!
+!$Id: mod_phys_lmdz_omp_data.F90 1575 2011-09-21 13:57:48Z jghattas $
+!
+MODULE mod_phys_lmdz_omp_data
+
+  INTEGER,SAVE :: omp_size
+  INTEGER,SAVE :: omp_rank
+  LOGICAL,SAVE :: is_omp_root
+  LOGICAL,SAVE :: is_using_omp
+  
+  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_nb
+  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_begin
+  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_end    
+  
+  INTEGER,SAVE :: klon_omp
+  INTEGER,SAVE :: klon_omp_begin
+  INTEGER,SAVE :: klon_omp_end
+!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,klon_omp_begin,klon_omp_end)
+
+CONTAINS
+  
+  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
+    USE dimphy
+    IMPLICIT NONE
+    INTEGER, INTENT(in) :: klon_mpi
+
+    INTEGER :: i
+
+    CHARACTER (LEN=20) :: modname='Init_phys_lmdz_omp_data'
+    CHARACTER (LEN=80) :: abort_message
+
+
+#ifdef CPP_OMP    
+    INTEGER :: OMP_GET_NUM_THREADS
+    EXTERNAL OMP_GET_NUM_THREADS
+    INTEGER :: OMP_GET_THREAD_NUM
+    EXTERNAL OMP_GET_THREAD_NUM
+#endif  
+
+#ifdef CPP_OMP
+!$OMP MASTER
+        is_using_omp=.TRUE.
+        omp_size=OMP_GET_NUM_THREADS()
+!$OMP END MASTER
+        omp_rank=OMP_GET_THREAD_NUM()    
+#else    
+    is_using_omp=.FALSE.
+    omp_size=1
+    omp_rank=0
+#endif
+
+   is_omp_root=.FALSE.
+!$OMP MASTER
+   IF (omp_rank==0) THEN
+     is_omp_root=.TRUE.
+   ELSE
+     abort_message = 'ANORMAL : OMP_MASTER /= 0'
+     CALL abort_gcm (modname,abort_message,1)
+   ENDIF
+!$OMP END MASTER
+
+
+!$OMP MASTER 
+    ALLOCATE(klon_omp_para_nb(0:omp_size-1))
+    ALLOCATE(klon_omp_para_begin(0:omp_size-1))
+    ALLOCATE(klon_omp_para_end(0:omp_size-1))
+    
+    DO i=0,omp_size-1
+      klon_omp_para_nb(i)=klon_mpi/omp_size
+      IF (i<MOD(klon_mpi,omp_size)) klon_omp_para_nb(i)=klon_omp_para_nb(i)+1
+    ENDDO
+    
+    klon_omp_para_begin(0) = 1
+    klon_omp_para_end(0) = klon_omp_para_nb(0)
+    
+    DO i=1,omp_size-1
+      klon_omp_para_begin(i)=klon_omp_para_end(i-1)+1
+      klon_omp_para_end(i)=klon_omp_para_begin(i)+klon_omp_para_nb(i)-1
+    ENDDO
+!$OMP END MASTER
+!$OMP BARRIER
+   
+    klon_omp=klon_omp_para_nb(omp_rank)
+    klon_omp_begin=klon_omp_para_begin(omp_rank)
+    klon_omp_end=klon_omp_para_end(omp_rank)
+    
+    CALL Print_module_data
+    
+  END SUBROUTINE Init_phys_lmdz_omp_data
+
+  SUBROUTINE Print_module_data
+  IMPLICIT NONE
+  INCLUDE "iniprint.h"
+
+!$OMP CRITICAL  
+  WRITE(lunout,*)'--------> TASK ',omp_rank
+  WRITE(lunout,*)'omp_size =',omp_size
+  WRITE(lunout,*)'omp_rank =',omp_rank
+  WRITE(lunout,*)'is_omp_root =',is_omp_root
+  WRITE(lunout,*)'klon_omp_para_nb =',klon_omp_para_nb
+  WRITE(lunout,*)'klon_omp_para_begin =',klon_omp_para_begin
+  WRITE(lunout,*)'klon_omp_para_end =',klon_omp_para_end    
+  WRITE(lunout,*)'klon_omp =',klon_omp
+  WRITE(lunout,*)'klon_omp_begin =',klon_omp_begin
+  WRITE(lunout,*)'klon_omp_end =',klon_omp_end    
+!$OMP END CRITICAL
+
+  END SUBROUTINE Print_module_data
+END MODULE mod_phys_lmdz_omp_data
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_omp_transfert.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_omp_transfert.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_omp_transfert.F90	(revision 844)
@@ -0,0 +1,1057 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_omp_transfert
+
+  PRIVATE
+  
+  INTEGER,PARAMETER :: grow_factor=1.5
+  INTEGER,PARAMETER :: size_min=1024
+  
+  CHARACTER(LEN=size_min),SAVE            :: buffer_c
+!  INTEGER,SAVE                            :: size_c=0
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:)   :: buffer_i
+  INTEGER,SAVE                            :: size_i=0
+  REAL,SAVE,ALLOCATABLE,DIMENSION(:)      :: buffer_r
+  INTEGER,SAVE                            :: size_r=0
+  LOGICAL,SAVE,ALLOCATABLE,DIMENSION(:)   :: buffer_l
+  INTEGER,SAVE                            :: size_l=0
+
+
+  
+  
+  INTERFACE bcast_omp
+    MODULE PROCEDURE bcast_omp_c,                                                     &
+                     bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
+                     bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
+		     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
+  END INTERFACE
+
+  INTERFACE scatter_omp
+    MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
+                     scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
+		     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
+  END INTERFACE
+
+  
+  INTERFACE gather_omp
+    MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
+                     gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
+		     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
+  END INTERFACE
+  
+  
+  INTERFACE reduce_sum_omp
+    MODULE PROCEDURE reduce_sum_omp_i,reduce_sum_omp_i1,reduce_sum_omp_i2,reduce_sum_omp_i3,reduce_sum_omp_i4, &
+                     reduce_sum_omp_r,reduce_sum_omp_r1,reduce_sum_omp_r2,reduce_sum_omp_r3,reduce_sum_omp_r4
+  END INTERFACE 
+
+
+  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp
+
+CONTAINS
+
+  SUBROUTINE check_buffer_i(buff_size)
+  IMPLICIT NONE
+  INTEGER :: buff_size
+
+!$OMP BARRIER
+!$OMP MASTER
+    IF (buff_size>size_i) THEN
+      IF (ALLOCATED(buffer_i)) DEALLOCATE(buffer_i)
+      size_i=MAX(size_min,INT(grow_factor*buff_size))
+      ALLOCATE(buffer_i(size_i))
+    ENDIF
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  END SUBROUTINE check_buffer_i
+  
+  SUBROUTINE check_buffer_r(buff_size)
+  IMPLICIT NONE
+  INTEGER :: buff_size
+
+!$OMP BARRIER
+!$OMP MASTER
+    IF (buff_size>size_r) THEN
+      IF (ALLOCATED(buffer_r)) DEALLOCATE(buffer_r)
+      size_r=MAX(size_min,INT(grow_factor*buff_size))
+      ALLOCATE(buffer_r(size_r))
+    ENDIF
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  END SUBROUTINE check_buffer_r
+  
+  SUBROUTINE check_buffer_l(buff_size)
+  IMPLICIT NONE
+  INTEGER :: buff_size
+
+!$OMP BARRIER
+!$OMP MASTER
+    IF (buff_size>size_l) THEN
+      IF (ALLOCATED(buffer_l)) DEALLOCATE(buffer_l)
+      size_l=MAX(size_min,INT(grow_factor*buff_size))
+      ALLOCATE(buffer_l(size_l))
+    ENDIF
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  END SUBROUTINE check_buffer_l
+    
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Broadcast --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaine de charactère -- !!
+
+  SUBROUTINE bcast_omp_c(var)
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+    
+    CALL bcast_omp_cgen(Var,len(Var),buffer_c)
+    
+  END SUBROUTINE bcast_omp_c
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE bcast_omp_i(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var
+    INTEGER :: Var_tmp(1)
+    
+    Var_tmp(1)=Var
+    CALL check_buffer_i(1)
+    CALL bcast_omp_igen(Var_tmp,1,buffer_i)
+    Var=Var_tmp(1)
+
+  END SUBROUTINE bcast_omp_i
+
+
+  SUBROUTINE bcast_omp_i1(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:)
+   
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i1
+
+
+  SUBROUTINE bcast_omp_i2(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:)
+   
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i2
+
+
+  SUBROUTINE bcast_omp_i3(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:)
+
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i3
+
+
+  SUBROUTINE bcast_omp_i4(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i4
+
+
+!! -- Les reels -- !!
+
+  SUBROUTINE bcast_omp_r(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var
+    REAL :: Var_tmp(1)
+    
+    Var_tmp(1)=Var
+    CALL check_buffer_r(1)
+    CALL bcast_omp_rgen(Var_tmp,1,buffer_r)
+    Var=Var_tmp(1)
+
+  END SUBROUTINE bcast_omp_r
+
+
+  SUBROUTINE bcast_omp_r1(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:)
+   
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r1
+
+
+  SUBROUTINE bcast_omp_r2(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r2
+
+
+  SUBROUTINE bcast_omp_r3(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:)
+
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r3
+
+
+  SUBROUTINE bcast_omp_r4(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r4
+
+  
+!! -- Les booleans -- !!
+
+  SUBROUTINE bcast_omp_l(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var
+    LOGICAL :: Var_tmp(1)
+    
+    Var_tmp(1)=Var
+    CALL check_buffer_l(1)
+    CALL bcast_omp_lgen(Var_tmp,1,buffer_l)
+    Var=Var_tmp(1)
+
+  END SUBROUTINE bcast_omp_l
+
+
+  SUBROUTINE bcast_omp_l1(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:)
+   
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l1
+
+
+  SUBROUTINE bcast_omp_l2(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l2
+
+
+  SUBROUTINE bcast_omp_l3(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
+
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l3
+
+
+  SUBROUTINE bcast_omp_l4(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l4
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter_omp_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,1,buffer_i)
+    
+  END SUBROUTINE scatter_omp_i
+
+
+  SUBROUTINE scatter_omp_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2),buffer_i)
+    
+  END SUBROUTINE scatter_omp_i1
+  
+  
+  SUBROUTINE scatter_omp_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_i)
+
+  END SUBROUTINE scatter_omp_i2
+
+
+  SUBROUTINE scatter_omp_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_i)
+  
+  END SUBROUTINE scatter_omp_i3
+
+
+
+
+  SUBROUTINE scatter_omp_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,1,buffer_r)
+    
+  END SUBROUTINE scatter_omp_r
+
+
+  SUBROUTINE scatter_omp_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2),buffer_r)
+        
+  END SUBROUTINE scatter_omp_r1
+  
+  
+  SUBROUTINE scatter_omp_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_r)
+
+  END SUBROUTINE scatter_omp_r2
+
+
+  SUBROUTINE scatter_omp_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_r)
+  
+  END SUBROUTINE scatter_omp_r3
+  
+
+
+  SUBROUTINE scatter_omp_l(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,1,buffer_l)
+    
+  END SUBROUTINE scatter_omp_l
+
+
+  SUBROUTINE scatter_omp_l1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2),buffer_l)
+    
+  END SUBROUTINE scatter_omp_l1
+  
+  
+  SUBROUTINE scatter_omp_l2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_l)
+
+  END SUBROUTINE scatter_omp_l2
+
+
+  SUBROUTINE scatter_omp_l3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_l)
+  
+  END SUBROUTINE scatter_omp_l3  
+  
+
+  SUBROUTINE gather_omp_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,1,buffer_i)
+    
+  END SUBROUTINE gather_omp_i
+
+
+  SUBROUTINE gather_omp_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2),buffer_i)
+    
+  END SUBROUTINE gather_omp_i1
+
+
+  SUBROUTINE gather_omp_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_i)
+          
+  END SUBROUTINE gather_omp_i2
+  
+
+  SUBROUTINE gather_omp_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_i)
+    
+  END SUBROUTINE gather_omp_i3
+
+
+
+  SUBROUTINE gather_omp_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_r(size(VarOut))   
+    CALL gather_omp_rgen(VarIn,Varout,1,buffer_r)
+    
+  END SUBROUTINE gather_omp_r
+
+
+  SUBROUTINE gather_omp_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    CALL Check_buffer_r(size(VarOut))   
+    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2),buffer_r)
+        
+  END SUBROUTINE gather_omp_r1
+
+
+  SUBROUTINE gather_omp_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarOut))   
+    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_r)
+    
+  END SUBROUTINE gather_omp_r2
+  
+
+  SUBROUTINE gather_omp_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    CALL Check_buffer_r(size(VarOut))       
+    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_r)
+    
+  END SUBROUTINE gather_omp_r3
+
+
+  SUBROUTINE gather_omp_l(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,1,buffer_l)
+    
+  END SUBROUTINE gather_omp_l
+
+
+  SUBROUTINE gather_omp_l1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2),buffer_l)
+    
+  END SUBROUTINE gather_omp_l1
+
+
+  SUBROUTINE gather_omp_l2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_l)
+    
+  END SUBROUTINE gather_omp_l2
+  
+
+  SUBROUTINE gather_omp_l3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_l)
+    
+  END SUBROUTINE gather_omp_l3
+
+
+
+
+  SUBROUTINE reduce_sum_omp_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN)  :: VarIn
+    INTEGER,INTENT(OUT) :: VarOut
+    INTEGER             :: VarIn_tmp(1)
+    INTEGER             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn
+    CALL Check_buffer_i(1)   
+    CALL reduce_sum_omp_igen(VarIn_tmp,Varout_tmp,1,buffer_i)
+    VarOut=VarOut_tmp(1)
+    
+  END SUBROUTINE reduce_sum_omp_i
+
+  SUBROUTINE reduce_sum_omp_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+   
+  END SUBROUTINE reduce_sum_omp_i1
+  
+  
+  SUBROUTINE reduce_sum_omp_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+  
+  END SUBROUTINE reduce_sum_omp_i2
+
+
+  SUBROUTINE reduce_sum_omp_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+  
+  END SUBROUTINE reduce_sum_omp_i3
+
+
+  SUBROUTINE reduce_sum_omp_i4(VarIn, VarOut)
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+  
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+  
+  END SUBROUTINE reduce_sum_omp_i4
+
+
+  SUBROUTINE reduce_sum_omp_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN)  :: VarIn
+    REAL,INTENT(OUT) :: VarOut
+    REAL             :: VarIn_tmp(1)
+    REAL             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn
+    CALL Check_buffer_r(1)   
+    CALL reduce_sum_omp_rgen(VarIn_tmp,Varout_tmp,1,buffer_r)
+    VarOut=VarOut_tmp(1)
+  
+  END SUBROUTINE reduce_sum_omp_r
+
+  SUBROUTINE reduce_sum_omp_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+   
+  END SUBROUTINE reduce_sum_omp_r1
+  
+  
+  SUBROUTINE reduce_sum_omp_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+  
+  END SUBROUTINE reduce_sum_omp_r2
+
+
+  SUBROUTINE reduce_sum_omp_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+  
+  END SUBROUTINE reduce_sum_omp_r3
+
+
+  SUBROUTINE reduce_sum_omp_r4(VarIn, VarOut)
+    IMPLICIT NONE
+
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+  
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+  
+  END SUBROUTINE reduce_sum_omp_r4
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!    LES ROUTINES GENERIQUES    !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE bcast_omp_cgen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+    CHARACTER(LEN=*),INTENT(INOUT) :: Buff
+    INTEGER,INTENT(IN) :: Nb
+    
+    INTEGER :: i
+  
+  !$OMP MASTER
+      Buff=Var
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var=Buff
+    ENDDO
+  !$OMP BARRIER      
+  
+  END SUBROUTINE bcast_omp_cgen
+
+
+      
+  SUBROUTINE bcast_omp_igen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
+    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
+    INTEGER,INTENT(IN) :: Nb
+
+    INTEGER :: i
+    
+  !$OMP MASTER
+    DO i=1,Nb
+      Buff(i)=Var(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var(i)=Buff(i)
+    ENDDO
+  !$OMP BARRIER        
+
+  END SUBROUTINE bcast_omp_igen
+
+
+  SUBROUTINE bcast_omp_rgen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
+    REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
+    INTEGER,INTENT(IN) :: Nb
+
+    INTEGER :: i
+    
+  !$OMP MASTER
+    DO i=1,Nb
+      Buff(i)=Var(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var(i)=Buff(i)
+    ENDDO
+  !$OMP BARRIER        
+
+  END SUBROUTINE bcast_omp_rgen
+
+  SUBROUTINE bcast_omp_lgen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
+    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
+    INTEGER,INTENT(IN) :: Nb
+  
+    INTEGER :: i
+    
+  !$OMP MASTER
+    DO i=1,Nb
+      Buff(i)=Var(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var(i)=Buff(i)
+    ENDDO
+  !$OMP BARRIER        
+
+  END SUBROUTINE bcast_omp_lgen
+
+
+  SUBROUTINE scatter_omp_igen(VarIn,VarOut,dimsize,Buff)
+    USE mod_phys_lmdz_omp_data
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
+    INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        Buff(ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+ 
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+ 
+  END SUBROUTINE scatter_omp_igen
+
+
+  SUBROUTINE scatter_omp_rgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
+    REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        Buff(ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+  END SUBROUTINE scatter_omp_rgen
+
+
+  SUBROUTINE scatter_omp_lgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
+    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+ !$OMP MASTER 
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        Buff(ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+  END SUBROUTINE scatter_omp_lgen
+
+
+
+
+
+  SUBROUTINE gather_omp_igen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+    INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+  
+  
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=Buff(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+  END SUBROUTINE gather_omp_igen
+
+
+  SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+    REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=Buff(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+  END SUBROUTINE gather_omp_rgen
+
+
+  SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=Buff(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+  END SUBROUTINE gather_omp_lgen
+
+
+  SUBROUTINE reduce_sum_omp_igen(VarIn,VarOut,dimsize,Buff)
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(dimsize) :: VarOut
+    INTEGER,INTENT(INOUT),DIMENSION(dimsize) :: Buff
+
+    INTEGER :: i
+
+  !$OMP MASTER
+    Buff(:)=0
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  !$OMP CRITICAL     
+    DO i=1,dimsize
+      Buff(i)=Buff(i)+VarIn(i)
+    ENDDO
+  !$OMP END CRITICAL
+  !$OMP BARRIER  
+  
+  !$OMP MASTER
+    DO i=1,dimsize
+      VarOut(i)=Buff(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  END SUBROUTINE reduce_sum_omp_igen
+
+  SUBROUTINE reduce_sum_omp_rgen(VarIn,VarOut,dimsize,Buff)
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(dimsize) :: VarOut
+    REAL,INTENT(INOUT),DIMENSION(dimsize) :: Buff
+
+    INTEGER :: i
+
+  !$OMP MASTER
+    Buff(:)=0
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  !$OMP CRITICAL     
+    DO i=1,dimsize
+      Buff(i)=Buff(i)+VarIn(i)
+    ENDDO
+  !$OMP END CRITICAL
+  !$OMP BARRIER  
+  
+  !$OMP MASTER
+    DO i=1,dimsize
+      VarOut(i)=Buff(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  END SUBROUTINE reduce_sum_omp_rgen
+
+END MODULE mod_phys_lmdz_omp_transfert
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_para.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_para.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_para.F90	(revision 844)
@@ -0,0 +1,113 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_para
+  USE mod_phys_lmdz_transfert_para
+  USE mod_phys_lmdz_mpi_data
+  USE mod_phys_lmdz_omp_data
+    
+  INTEGER,SAVE :: klon_loc
+  LOGICAL,SAVE :: is_sequential
+  LOGICAL,SAVE :: is_parallel
+  LOGICAL,SAVE :: is_master
+  
+!$OMP THREADPRIVATE(klon_loc,is_master)
+  
+CONTAINS
+
+  SUBROUTINE Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+  IMPLICIT NONE
+    INTEGER,INTENT(in) :: iim
+    INTEGER,INTENT(in) :: jjp1
+    INTEGER,INTENT(in) :: nb_proc
+    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+
+    CALL Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+!$OMP PARALLEL
+    CALL Init_phys_lmdz_omp_data(klon_mpi)
+    klon_loc=klon_omp
+    IF (is_mpi_root .AND. is_omp_root) THEN 
+       is_master=.TRUE.
+     ELSE
+       is_master=.FALSE.
+     ENDIF
+    CALL Test_transfert
+!$OMP END PARALLEL    
+     IF (is_using_mpi .OR. is_using_omp) THEN
+       is_sequential=.FALSE.
+       is_parallel=.TRUE.
+     ELSE
+       is_sequential=.TRUE.
+       is_parallel=.FALSE.
+     ENDIF
+      
+  END SUBROUTINE Init_phys_lmdz_para
+
+  SUBROUTINE Test_transfert
+  USE mod_grid_phy_lmdz
+  IMPLICIT NONE
+    INCLUDE "iniprint.h"
+ 
+    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
+    REAL :: tmp1d_glo(klon_glo,nbp_lev)
+    REAL :: Test_Field2d_glo(nbp_lon,nbp_lat,nbp_lev)
+    REAL :: tmp2d_glo(nbp_lon,nbp_lat,nbp_lev)
+    REAL :: Test_Field1d_loc(klon_loc,nbp_lev)
+    REAL :: Test_Field2d_loc(nbp_lon,jj_nb,nbp_lev)
+    REAL :: CheckSum
+    
+    INTEGER :: i,l
+  
+    Test_Field1d_glo = 0.
+    Test_Field2d_glo = 0.
+    Test_Field1d_loc = 0.
+    Test_Field2d_loc = 0.
+  
+    IF (is_mpi_root) THEN
+!$OMP MASTER
+      DO l=1,nbp_lev
+        DO i=1,klon_glo
+!          Test_Field1d_glo(i,l)=MOD(i,10)+10*(l-1)
+           Test_Field1d_glo(i,l)=1
+        ENDDO
+      ENDDO
+!$OMP END MASTER  
+    ENDIF
+  
+    CALL Scatter(Test_Field1d_glo,Test_Field1d_loc)
+    CALL Gather(Test_Field1d_loc,tmp1d_glo)
+  
+    IF (is_mpi_root) THEN
+!$OMP MASTER  
+      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
+!$OMP END MASTER
+    ENDIF
+    
+    CALL grid1dTo2d_glo(Test_Field1d_glo,Test_Field2d_glo)
+    CALL scatter2D(Test_Field2d_glo,Test_Field1d_loc)
+    CALL gather2d(Test_Field1d_loc,Test_Field2d_glo)
+    CALL grid2dTo1d_glo(Test_Field2d_glo,tmp1d_glo)
+
+    IF (is_mpi_root) THEN
+!$OMP MASTER  
+      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
+!$OMP END MASTER
+    ENDIF
+
+    CALL bcast(Test_Field1d_glo)
+    CALL reduce_sum(Test_Field1d_glo,tmp1d_glo)
+
+    IF (is_mpi_root) THEN
+!$OMP MASTER  
+      Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
+!$OMP END MASTER
+    ENDIF
+    
+     
+   END SUBROUTINE Test_transfert
+  
+END MODULE mod_phys_lmdz_para
+    
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_transfert_para.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_transfert_para.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mod_phys_lmdz_transfert_para.F90	(revision 844)
@@ -0,0 +1,1275 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_transfert_para
+
+  USE mod_phys_lmdz_mpi_transfert
+  USE mod_phys_lmdz_omp_transfert 
+
+
+
+  INTERFACE bcast
+    MODULE PROCEDURE bcast_c,                                     &
+                     bcast_i,bcast_i1,bcast_i2,bcast_i3,bcast_i4, &
+                     bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4, &
+		     bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4
+  END INTERFACE
+
+  INTERFACE scatter
+    MODULE PROCEDURE scatter_i,scatter_i1,scatter_i2,scatter_i3, &
+                     scatter_r,scatter_r1,scatter_r2,scatter_r3, &
+		     scatter_l,scatter_l1,scatter_l2,scatter_l3
+  END INTERFACE
+
+  
+  INTERFACE gather
+    MODULE PROCEDURE gather_i,gather_i1,gather_i2,gather_i3, &
+                     gather_r,gather_r1,gather_r2,gather_r3, &
+		     gather_l,gather_l1,gather_l2,gather_l3  
+  END INTERFACE
+  
+  INTERFACE scatter2D
+    MODULE PROCEDURE scatter2D_i,scatter2D_i1,scatter2D_i2,scatter2D_i3, &
+                     scatter2D_r,scatter2D_r1,scatter2D_r2,scatter2D_r3, &
+		     scatter2D_l,scatter2D_l1,scatter2D_l2,scatter2D_l3
+  END INTERFACE
+
+  INTERFACE gather2D
+    MODULE PROCEDURE gather2D_i,gather2D_i1,gather2D_i2,gather2D_i3, &
+                     gather2D_r,gather2D_r1,gather2D_r2,gather2D_r3, &
+		     gather2D_l,gather2D_l1,gather2D_l2,gather2D_l3
+  END INTERFACE 
+  
+  INTERFACE reduce_sum
+    MODULE PROCEDURE reduce_sum_i,reduce_sum_i1,reduce_sum_i2,reduce_sum_i3,reduce_sum_i4, &
+                     reduce_sum_r,reduce_sum_r1,reduce_sum_r2,reduce_sum_r3,reduce_sum_r4
+  END INTERFACE 
+
+   
+CONTAINS
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Broadcast --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaine de charactère -- !!
+
+  SUBROUTINE bcast_c(var)
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_c
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE bcast_i(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i
+
+  SUBROUTINE bcast_i1(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i1
+
+
+  SUBROUTINE bcast_i2(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i2
+
+
+  SUBROUTINE bcast_i3(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i3
+
+
+  SUBROUTINE bcast_i4(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i4
+
+ 
+!! -- Les reels -- !!
+  
+  SUBROUTINE bcast_r(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var
+
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r
+
+  SUBROUTINE bcast_r1(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r1
+
+
+  SUBROUTINE bcast_r2(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r2
+
+
+  SUBROUTINE bcast_r3(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r3
+
+
+  SUBROUTINE bcast_r4(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r4 
+
+
+!! -- Les booleens -- !!
+  
+  SUBROUTINE bcast_l(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l
+
+  SUBROUTINE bcast_l1(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l1
+
+
+  SUBROUTINE bcast_l2(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l2
+
+
+  SUBROUTINE bcast_l3(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l3
+
+
+  SUBROUTINE bcast_l4(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l4
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
+    
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_i
+
+
+  SUBROUTINE scatter_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_i1
+
+
+  SUBROUTINE scatter_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_i2
+
+
+  SUBROUTINE scatter_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter_i3
+
+
+  SUBROUTINE scatter_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi) :: Var_tmp
+    
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_r
+
+
+  SUBROUTINE scatter_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_r1
+
+
+  SUBROUTINE scatter_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_r2
+
+
+  SUBROUTINE scatter_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter_r3
+  
+  
+
+  SUBROUTINE scatter_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
+    
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_l
+
+
+  SUBROUTINE scatter_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_l1
+
+
+  SUBROUTINE scatter_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_l2
+
+
+  SUBROUTINE scatter_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter_l3
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 
+!!!!! --> Les entiers
+
+  SUBROUTINE gather_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,Varout)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i
+
+
+  SUBROUTINE gather_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,Varout)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i1
+
+
+  SUBROUTINE gather_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i2
+
+
+  SUBROUTINE gather_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i3
+
+
+!!!!! --> Les reels
+
+  SUBROUTINE gather_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r
+
+
+  SUBROUTINE gather_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r1
+
+
+  SUBROUTINE gather_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r2
+
+
+  SUBROUTINE gather_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r3
+
+
+!!!!! --> Les booleens
+
+  SUBROUTINE gather_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l
+
+
+  SUBROUTINE gather_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l1
+
+
+  SUBROUTINE gather_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l2
+
+
+  SUBROUTINE gather_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l3
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+!!!!! --> Les entiers
+
+  SUBROUTINE scatter2D_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i
+
+
+  SUBROUTINE scatter2D_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i1
+  
+
+  SUBROUTINE scatter2D_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i2  
+
+
+  SUBROUTINE scatter2D_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i3
+  
+
+!!!!! --> Les reels
+
+  SUBROUTINE scatter2D_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r
+
+
+  SUBROUTINE scatter2D_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r1
+  
+
+  SUBROUTINE scatter2D_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r2  
+
+
+  SUBROUTINE scatter2D_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r3
+    
+    
+!!!!! --> Les booleens
+
+
+  SUBROUTINE scatter2D_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l
+
+
+  SUBROUTINE scatter2D_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l1
+  
+
+  SUBROUTINE scatter2D_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l2  
+
+
+  SUBROUTINE scatter2D_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l3
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!!!!! --> Les entiers
+
+  SUBROUTINE gather2D_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i
+  
+
+  SUBROUTINE gather2D_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i1
+
+  
+  SUBROUTINE gather2D_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i2
+
+
+  SUBROUTINE gather2D_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i3
+
+
+!!!!! --> Les reels
+
+  SUBROUTINE gather2D_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r
+  
+
+  SUBROUTINE gather2D_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r1
+
+  
+  SUBROUTINE gather2D_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r2
+
+
+  SUBROUTINE gather2D_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r3
+  
+
+!!!!! --> Les booleens
+
+  SUBROUTINE gather2D_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l
+  
+
+  SUBROUTINE gather2D_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l1
+
+  
+  SUBROUTINE gather2D_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l2
+
+
+  SUBROUTINE gather2D_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l3
+  
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des reduce_sum   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Les entiers
+
+  SUBROUTINE reduce_sum_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN)  :: VarIn
+    INTEGER,INTENT(OUT) :: VarOut
+    
+    INTEGER             :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i  
+
+
+  SUBROUTINE reduce_sum_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn))   :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i1  
+
+
+  SUBROUTINE reduce_sum_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i2  
+  
+
+  SUBROUTINE reduce_sum_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i3  
+
+
+  SUBROUTINE reduce_sum_i4(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i4  
+
+
+! Les reels
+
+  SUBROUTINE reduce_sum_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN)  :: VarIn
+    REAL,INTENT(OUT) :: VarOut
+    
+    REAL             :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r  
+
+
+  SUBROUTINE reduce_sum_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn))   :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r1  
+
+
+  SUBROUTINE reduce_sum_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r2  
+  
+
+  SUBROUTINE reduce_sum_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r3  
+
+
+  SUBROUTINE reduce_sum_r4(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r4  
+
+   
+END MODULE mod_phys_lmdz_transfert_para
+
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/moistadj.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/moistadj.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/moistadj.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/moistadj.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mucorr.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mucorr.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mucorr.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/mucorr.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mufract.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mufract.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/mufract.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/mufract.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/multipl.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/multipl.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/multipl.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/multipl.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/newsedim.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/newsedim.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/newsedim.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/newsedim.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/newtrelax.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/newtrelax.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/newtrelax.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/newtrelax.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/optci.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/optci.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/optci.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/optci.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/optcv.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/optcv.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/optcv.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/optcv.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/orbite.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/orbite.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/orbite.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/orbite.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/params_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/params_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/params_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/params_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/phasechange_kcm.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/phasechange_kcm.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/phasechange_kcm.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/phasechange_kcm.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/phyetat0.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/phyetat0.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/phyetat0.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/phyetat0.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/physdem1.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/physdem1.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/physdem1.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/physdem1.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/physiq.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/physiq.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/physiq.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/physiq.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/planete.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/planete.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/planete.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/planete.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/profile.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/profile.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/profile.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/profile.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radcommon_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radcommon_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radcommon_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/radcommon_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radii_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radii_mod.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radii_mod.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/radii_mod.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radinc_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radinc_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/radinc_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/radinc_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/rain.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/rain.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/rain.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/rain.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/scatterers
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/scatterers	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/scatterers	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/scatterers
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/scopyi.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/scopyi.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/scopyi.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/scopyi.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/setspi.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/setspi.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/setspi.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/setspi.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/setspv.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/setspv.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/setspv.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/setspv.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sfluxi.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sfluxi.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sfluxi.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/sfluxi.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sfluxv.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sfluxv.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sfluxv.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/sfluxv.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/soil.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/soil.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/soil.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/soil.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/soil_settings.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/soil_settings.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/soil_settings.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/soil_settings.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/statto.h
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/statto.h	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/statto.h	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/statto.h
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stelang.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stelang.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stelang.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/stelang.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stellarlong.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stellarlong.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stellarlong.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/stellarlong.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stokes.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stokes.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/stokes.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/stokes.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/su_gases.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/su_gases.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/su_gases.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/su_gases.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/su_watercycle.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/su_watercycle.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/su_watercycle.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/su_watercycle.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/suaer_corrk.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/suaer_corrk.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/suaer_corrk.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/suaer_corrk.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sugas_corrk.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sugas_corrk.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/sugas_corrk.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/sugas_corrk.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surface_nature.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surface_nature.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surface_nature.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/surface_nature.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surfdat_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surfdat_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surfdat_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/surfdat_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surfini.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surfini.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/surfini.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/surfini.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tabfi.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tabfi.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tabfi.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/tabfi.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tetalevel.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tetalevel.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tetalevel.F	(revision 844)
@@ -0,0 +1,141 @@
+!
+! $Header$
+!
+c================================================================
+c================================================================
+      SUBROUTINE tetalevel(ilon,ilev,lnew,pgcm,pres,Qgcm,Qpres)
+c================================================================
+c================================================================
+      USE dimphy
+      IMPLICIT none
+
+cym#include "dimensions.h"
+cym#include "dimphy.h"
+
+c================================================================
+c
+c Interpoler des champs 3-D u, v et g du modele a un niveau de
+c pression donnee (pres)
+c
+c INPUT:  ilon ----- nombre de points
+c         ilev ----- nombre de couches
+c         lnew ----- true si on doit reinitialiser les poids
+c         pgcm ----- pressions modeles
+c         pres ----- pression vers laquelle on interpolle
+c         Qgcm ----- champ GCM
+c         Qpres ---- champ interpolle au niveau pres
+c
+c================================================================
+c
+c   arguments :
+c   -----------
+
+      INTEGER ilon, ilev
+      logical lnew
+
+      REAL pgcm(ilon,ilev)
+      REAL Qgcm(ilon,ilev)
+      real pres
+      REAL Qpres(ilon)
+
+c   local :
+c   -------
+c
+cym#include "paramet.h"
+c
+      INTEGER,ALLOCATABLE,SAVE :: lt(:), lb(:)
+      REAL,ALLOCATABLE,SAVE    :: aist(:), aisb(:)
+      REAL,SAVE :: ptop, pbot 
+      LOGICAL,SAVE :: first = .TRUE.
+c$OMP THREADPRIVATE(lt,lb,aist,aisb,ptop, pbot,first)
+
+      INTEGER i, k
+c
+c     PRINT*,'tetalevel pres=',pres
+      IF (first) THEN
+        ALLOCATE(lt(ilon), lb(ilon))
+	ALLOCATE(aist(ilon), aisb(ilon))
+	
+	first=.FALSE.
+      ENDIF
+c=====================================================================
+      if (lnew) then
+c   on r�nitialise les r�ndicages et les poids
+c=====================================================================
+
+
+c Chercher les 2 couches les plus proches du niveau a obtenir
+c
+c Eventuellement, faire l'extrapolation a partir des deux couches
+c les plus basses ou les deux couches les plus hautes:
+      DO 130 i = 1, ilon
+cIM      IF ( ABS(pres-pgcm(i,ilev) ) .LT.
+         IF ( ABS(pres-pgcm(i,ilev) ) .GT.
+     .        ABS(pres-pgcm(i,1)) ) THEN
+            lt(i) = ilev     ! 2
+            lb(i) = ilev-1   ! 1
+         ELSE
+            lt(i) = 2
+            lb(i) = 1
+         ENDIF
+cIM   PRINT*,'i, ABS(pres-pgcm),ABS(pres-pgcm)',
+cIM  .i, ABS(pres-pgcm(i,ilev)),ABS(pres-pgcm(i,1))
+  130 CONTINUE
+      DO 150 k = 1, ilev-1
+         DO 140 i = 1, ilon
+            pbot = pgcm(i,k)
+            ptop = pgcm(i,k+1)
+cIM         IF (ptop.LE.pres .AND. pbot.GE.pres) THEN
+            IF (ptop.GE.pres .AND. pbot.LE.pres) THEN
+               lt(i) = k+1
+               lb(i) = k
+            ENDIF
+  140    CONTINUE
+  150 CONTINUE
+c
+c Interpolation lineaire:
+c
+      DO i = 1, ilon
+c interpolation en logarithme de pression:
+c
+c ...   Modif . P. Le Van    ( 20/01/98) ....
+c       Modif Fr��ic Hourdin (3/01/02)
+
+c       IF(pgcm(i,lb(i)).NE.0.OR.
+c    $     pgcm(i,lt(i)).NE.0.) THEN
+c
+c       PRINT*,'i,lb,lt,2pgcm,pres',i,lb(i),
+c    .  lt(i),pgcm(i,lb(i)),pgcm(i,lt(i)),pres
+c
+        aist(i) = LOG( pgcm(i,lb(i))/ pres )
+     .       / LOG( pgcm(i,lb(i))/ pgcm(i,lt(i)) )
+        aisb(i) = LOG( pres / pgcm(i,lt(i)) )
+     .       / LOG( pgcm(i,lb(i))/ pgcm(i,lt(i)))
+      enddo
+
+
+      endif ! lnew
+
+c======================================================================
+c    inteprollation
+c======================================================================
+
+      do i=1,ilon
+         Qpres(i)= Qgcm(i,lb(i))*aisb(i)+Qgcm(i,lt(i))*aist(i)
+cIM      PRINT*,'i,Qgcm,Qpres',i,Qgcm(i,lb(i)),aisb(i),
+cIM  $   Qgcm(i,lt(i)),aist(i),Qpres(i)
+      enddo
+c
+c Je mets les vents a zero quand je rencontre une montagne
+      do i = 1, ilon
+cIM      if (pgcm(i,1).LT.pres) THEN
+         if (pgcm(i,1).GT.pres) THEN
+c           Qpres(i)=1e33
+            Qpres(i)=1e+20
+cIM         PRINT*,'i,pgcm(i,1),pres =',i,pgcm(i,1),pres
+         endif
+      enddo
+
+c
+      RETURN
+      END
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/totalcloudfrac.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/totalcloudfrac.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/totalcloudfrac.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tpindex.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tpindex.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tpindex.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/tpindex.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tracer_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tracer_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/tracer_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/tracer_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/turbdiff.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/turbdiff.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/turbdiff.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/turbdiff.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdif_cd.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdif_cd.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdif_cd.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/vdif_cd.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdif_kc.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdif_kc.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdif_kc.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/vdif_kc.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdifc.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdifc.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vdifc.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/vdifc.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vlz_fi.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vlz_fi.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/vlz_fi.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/vlz_fi.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watercommon_h.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watercommon_h.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watercommon_h.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/watercommon_h.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watersat.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watersat.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watersat.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/watersat.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watersat_grad.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watersat_grad.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/watersat_grad.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/watersat_grad.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagfi.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagfi.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagfi.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/writediagfi.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagsoil.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagsoil.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagsoil.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/writediagsoil.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagspecIR.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagspecIR.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagspecIR.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/writediagspecIR.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagspecVI.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagspecVI.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writediagspecVI.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/writediagspecVI.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writeg1d.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writeg1d.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/writeg1d.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/writeg1d.F
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/wstats.F90
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/wstats.F90	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/wstats.F90	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/wstats.F90
Index: trunk/LMDZ.GENERIC_2.0/libf/phygeneric/zerophys.F
===================================================================
--- trunk/LMDZ.GENERIC_2.0/libf/phygeneric/zerophys.F	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/libf/phygeneric/zerophys.F	(revision 844)
@@ -0,0 +1,1 @@
+link ../../../LMDZ.GENERIC/libf/phystd/zerophys.F
Index: trunk/LMDZ.GENERIC_2.0/makelmdz_fcm
===================================================================
--- trunk/LMDZ.GENERIC_2.0/makelmdz_fcm	(revision 844)
+++ trunk/LMDZ.GENERIC_2.0/makelmdz_fcm	(revision 844)
@@ -0,0 +1,1 @@
+link ../LMDZ.COMMON/makelmdz_fcm
