Index: LMDZ5/branches/testing/DefLists/cosp_input_nl.txt
===================================================================
--- LMDZ5/branches/testing/DefLists/cosp_input_nl.txt	(revision 1664)
+++ LMDZ5/branches/testing/DefLists/cosp_input_nl.txt	(revision 1664)
@@ -0,0 +1,104 @@
+! (c) British Crown Copyright 2008, the Met Office.
+! All rights reserved.
+! 
+! Redistribution and use in source and binary forms, with or without modification, are permitted 
+! provided that the following conditions are met:
+! 
+!     * Redistributions of source code must retain the above copyright notice, this list 
+!       of conditions and the following disclaimer.
+!     * Redistributions in binary form must reproduce the above copyright notice, this list
+!       of conditions and the following disclaimer in the documentation and/or other materials 
+!       provided with the distribution.
+!     * Neither the name of the Met Office nor the names of its contributors may be used 
+!       to endorse or promote products derived from this software without specific prior written 
+!       permission.
+! 
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
+! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
+! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+! Namelist that sets up the main COSP options
+&COSP_INPUT
+  CMOR_NL='./cmor/cosp_cmor_nl.txt', ! CMOR namelist
+  NPOINTS=9026,! Number of gridpoints (klon dans LMDZi : ici correspond a klon de 96x95)
+  NPOINTS_IT=10000,! Max number of gridpoints to be processed in one iteration
+  NCOLUMNS=20,  ! Number of subcolumns
+  NLEVELS=39,   ! Number of model levels 
+  USE_VGRID=.true., ! Use fixed vertical grid for outputs? (if .true. then you need to define number of levels with Nlr)
+  NLR=40,       ! Number of levels in statistical outputs (only used if USE_VGRID=.true.)
+  CSAT_VGRID=.true., ! CloudSat vertical grid? (if .true. then the CloudSat standard grid is used for the outputs.
+                     !  USE_VGRID needs also be .true.)
+  FINPUT='histday.nc', ! NetCDF file with 1D inputs
+!  FINPUT='cosp_input_um_2d.nc', ! NetCDF file with 2D inputs
+  !----------------------------------------------------------------------------------
+  !--------------- Inputs related to radar simulations
+  !----------------------------------------------------------------------------------
+  RADAR_FREQ=94.0, ! CloudSat radar frequency (GHz)
+  SURFACE_RADAR=0, ! surface=1, spaceborne=0
+  use_mie_tables=0,! use a precomputed lookup table? yes=1,no=0
+  use_gas_abs=1,   ! include gaseous absorption? yes=1,no=0
+  do_ray=0,        ! calculate/output Rayleigh refl=1, not=0
+  melt_lay=0,      ! melting layer model off=0, on=1
+  k2=-1,           ! |K|^2, -1=use frequency dependent default
+  use_reff=.true., ! True if you want effective radius to be used by radar simulator (always used by lidar)
+  use_precipitation_fluxes=.true.,  ! True if precipitation fluxes are input to the algorithm 
+  !----------------------------------------------------------------------------------
+  !---------------- Inputs related to lidar simulations
+  !----------------------------------------------------------------------------------
+  Nprmts_max_hydro=12, ! Max number of parameters for hydrometeor size distributions
+  Naero=1,             ! Number of aerosol species (Not used)
+  Nprmts_max_aero=1,   ! Max number of parameters for aerosol size distributions (Not used)
+  lidar_ice_type=0,    ! Ice particle shape in lidar calculations (0=ice-spheres ; 1=ice-non-spherical)
+  OVERLAP=3,   !  overlap type: 1=max, 2=rand, 3=max/rand
+  !----------------------------------------------------------------------------------
+  !---------------- Inputs related to ISCCP simulator
+  !----------------------------------------------------------------------------------
+  ISCCP_TOPHEIGHT=1,  !  1 = adjust top height using both a computed
+                       !  infrared brightness temperature and the visible
+                       !  optical depth to adjust cloud top pressure. Note
+                       !  that this calculation is most appropriate to compare
+                       !  to ISCCP data during sunlit hours.
+                      !  2 = do not adjust top height, that is cloud top
+                       !  pressure is the actual cloud top pressure
+                       !  in the model
+                      !  3 = adjust top height using only the computed
+                       !  infrared brightness temperature. Note that this
+                       !  calculation is most appropriate to compare to ISCCP
+                       !  IR only algortihm (i.e. you can compare to nighttime
+                       !  ISCCP data with this option)
+  ISCCP_TOPHEIGHT_DIRECTION=1,   ! direction for finding atmosphere pressure level
+                                 ! with interpolated temperature equal to the radiance
+                                 ! determined cloud-top temperature
+                                 ! 1 = find the *lowest* altitude (highest pressure) level
+                                 ! with interpolated temperature equal to the radiance
+                                 ! determined cloud-top temperature
+                                 ! 2 = find the *highest* altitude (lowest pressure) level
+                                 ! with interpolated temperature equal to the radiance 
+                                 ! determined cloud-top temperature
+                                 ! ONLY APPLICABLE IF top_height EQUALS 1 or 3
+                                 ! 1 = default setting, and matches all versions of 
+                                 ! ISCCP simulator with versions numbers 3.5.1 and lower
+                                 ! 2 = experimental setting  
+  !----------------------------------------------------------------------------------
+  !-------------- RTTOV inputs
+  !----------------------------------------------------------------------------------
+  Platform=1,    ! satellite platform
+  Satellite=15,  ! satellite
+  Instrument=0,  ! instrument
+  Nchannels=8,   ! Number of channels to be computed
+  Channels=1,3,5,6,8,10,11,13,        ! Channel numbers (please be sure that you supply Nchannels)
+  Surfem=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,  ! Surface emissivity (please be sure that you supply Nchannels)
+  ZenAng=50.0, ! Satellite Zenith Angle
+  CO2=5.241e-04, ! Mixing ratios of trace gases
+  CH4=9.139e-07,
+  N2O=4.665e-07,
+  CO=2.098e-07
+/
+
+
Index: LMDZ5/branches/testing/DefLists/cosp_output_nl.txt
===================================================================
--- LMDZ5/branches/testing/DefLists/cosp_output_nl.txt	(revision 1664)
+++ LMDZ5/branches/testing/DefLists/cosp_output_nl.txt	(revision 1664)
@@ -0,0 +1,63 @@
+! (c) British Crown Copyright 2008, the Met Office.
+! All rights reserved.
+! 
+! Redistribution and use in source and binary forms, with or without modification, are permitted 
+! provided that the following conditions are met:
+! 
+!     * Redistributions of source code must retain the above copyright notice, this list 
+!       of conditions and the following disclaimer.
+!     * Redistributions in binary form must reproduce the above copyright notice, this list
+!       of conditions and the following disclaimer in the documentation and/or other materials 
+!       provided with the distribution.
+!     * Neither the name of the Met Office nor the names of its contributors may be used 
+!       to endorse or promote products derived from this software without specific prior written 
+!       permission.
+! 
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
+! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
+! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+! Namelist that sets up output-related variables. It controls 
+! the instrument simulators to run and the list of variables 
+! to be written to file
+&COSP_OUTPUT
+  ! Simulator flags
+  Lradar_sim=.false.,
+  Llidar_sim=.true.,
+  Lisccp_sim=.true.,
+  Lmisr_sim=.false.,
+  ! Output variables
+  Lalbisccp=.true.,
+  Latb532=.true.,
+  Lboxptopisccp=.true.,
+  Lboxtauisccp=.true.,
+  Lcfad_dbze94=.false.,
+  Lcfad_lidarsr532=.true.,
+  Lclcalipso=.true.,
+  Lclhcalipso=.true.,
+  Lclisccp2=.true.,
+  Lcllcalipso=.true.,
+  Lclmcalipso=.true.,
+  Lcltcalipso=.true.,
+  Lctpisccp=.true.,
+  Ldbze94=.false.,
+  Ltauisccp=.true.,
+  Ltclisccp=.true.,
+  Llongitude=.false.,
+  Llatitude=.false.,
+  Lparasol_refl=.true.,
+  LclMISR=.false.,
+  Lmeantbisccp=.true.,
+  Lmeantbclrisccp=.true.,
+  ! Use lidar and radar
+  Lclcalipso2=.false.,
+  Lcltlidarradar=.false.,
+  ! These are provided for debugging or special purposes
+  Lfrac_out=.false.,
+  Lbeta_mol532=.true.,  
+/
Index: LMDZ5/branches/testing/DefLists/offline.def
===================================================================
--- LMDZ5/branches/testing/DefLists/offline.def	(revision 1663)
+++ 	(revision )
@@ -1,12 +1,0 @@
-#
-# $Header$
-#
-T
-4
-T
--2.
-48.1
-1
-T
-6
-2
Index: LMDZ5/branches/testing/bld.cfg
===================================================================
--- LMDZ5/branches/testing/bld.cfg	(revision 1663)
+++ LMDZ5/branches/testing/bld.cfg	(revision 1664)
@@ -42,5 +42,5 @@
 bld::target              lib%{DYN}.a lib%{PHYS}.a libgrid.a libfiltrez.a libbibio.a libcosp.a libext_src.a
 bld::target              %EXEC%SUFF_NAME.e
-bld::exe_dep             %{DYN} %{PHYS} grid filtrez bibio cos ext_src
+bld::exe_dep             %{DYN} %{PHYS} grid filtrez bibio cosp ext_src
 
 
Index: LMDZ5/branches/testing/config.def
===================================================================
--- LMDZ5/branches/testing/config.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/config.def
Index: LMDZ5/branches/testing/cosp_input_nl.txt
===================================================================
--- LMDZ5/branches/testing/cosp_input_nl.txt	(revision 1663)
+++ 	(revision )
@@ -1,104 +1,0 @@
-! (c) British Crown Copyright 2008, the Met Office.
-! All rights reserved.
-! 
-! Redistribution and use in source and binary forms, with or without modification, are permitted 
-! provided that the following conditions are met:
-! 
-!     * Redistributions of source code must retain the above copyright notice, this list 
-!       of conditions and the following disclaimer.
-!     * Redistributions in binary form must reproduce the above copyright notice, this list
-!       of conditions and the following disclaimer in the documentation and/or other materials 
-!       provided with the distribution.
-!     * Neither the name of the Met Office nor the names of its contributors may be used 
-!       to endorse or promote products derived from this software without specific prior written 
-!       permission.
-! 
-! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
-! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
-! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
-! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
-! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
-! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-! Namelist that sets up the main COSP options
-&COSP_INPUT
-  CMOR_NL='./cmor/cosp_cmor_nl.txt', ! CMOR namelist
-  NPOINTS=9026,! Number of gridpoints (klon dans LMDZi : ici correspond a klon de 96x95)
-  NPOINTS_IT=10000,! Max number of gridpoints to be processed in one iteration
-  NCOLUMNS=20,  ! Number of subcolumns
-  NLEVELS=39,   ! Number of model levels 
-  USE_VGRID=.true., ! Use fixed vertical grid for outputs? (if .true. then you need to define number of levels with Nlr)
-  NLR=40,       ! Number of levels in statistical outputs (only used if USE_VGRID=.true.)
-  CSAT_VGRID=.true., ! CloudSat vertical grid? (if .true. then the CloudSat standard grid is used for the outputs.
-                     !  USE_VGRID needs also be .true.)
-  FINPUT='histday.nc', ! NetCDF file with 1D inputs
-!  FINPUT='cosp_input_um_2d.nc', ! NetCDF file with 2D inputs
-  !----------------------------------------------------------------------------------
-  !--------------- Inputs related to radar simulations
-  !----------------------------------------------------------------------------------
-  RADAR_FREQ=94.0, ! CloudSat radar frequency (GHz)
-  SURFACE_RADAR=0, ! surface=1, spaceborne=0
-  use_mie_tables=0,! use a precomputed lookup table? yes=1,no=0
-  use_gas_abs=1,   ! include gaseous absorption? yes=1,no=0
-  do_ray=0,        ! calculate/output Rayleigh refl=1, not=0
-  melt_lay=0,      ! melting layer model off=0, on=1
-  k2=-1,           ! |K|^2, -1=use frequency dependent default
-  use_reff=.true., ! True if you want effective radius to be used by radar simulator (always used by lidar)
-  use_precipitation_fluxes=.true.,  ! True if precipitation fluxes are input to the algorithm 
-  !----------------------------------------------------------------------------------
-  !---------------- Inputs related to lidar simulations
-  !----------------------------------------------------------------------------------
-  Nprmts_max_hydro=12, ! Max number of parameters for hydrometeor size distributions
-  Naero=1,             ! Number of aerosol species (Not used)
-  Nprmts_max_aero=1,   ! Max number of parameters for aerosol size distributions (Not used)
-  lidar_ice_type=0,    ! Ice particle shape in lidar calculations (0=ice-spheres ; 1=ice-non-spherical)
-  OVERLAP=3,   !  overlap type: 1=max, 2=rand, 3=max/rand
-  !----------------------------------------------------------------------------------
-  !---------------- Inputs related to ISCCP simulator
-  !----------------------------------------------------------------------------------
-  ISCCP_TOPHEIGHT=1,  !  1 = adjust top height using both a computed
-                       !  infrared brightness temperature and the visible
-                       !  optical depth to adjust cloud top pressure. Note
-                       !  that this calculation is most appropriate to compare
-                       !  to ISCCP data during sunlit hours.
-                      !  2 = do not adjust top height, that is cloud top
-                       !  pressure is the actual cloud top pressure
-                       !  in the model
-                      !  3 = adjust top height using only the computed
-                       !  infrared brightness temperature. Note that this
-                       !  calculation is most appropriate to compare to ISCCP
-                       !  IR only algortihm (i.e. you can compare to nighttime
-                       !  ISCCP data with this option)
-  ISCCP_TOPHEIGHT_DIRECTION=1,   ! direction for finding atmosphere pressure level
-                                 ! with interpolated temperature equal to the radiance
-                                 ! determined cloud-top temperature
-                                 ! 1 = find the *lowest* altitude (highest pressure) level
-                                 ! with interpolated temperature equal to the radiance
-                                 ! determined cloud-top temperature
-                                 ! 2 = find the *highest* altitude (lowest pressure) level
-                                 ! with interpolated temperature equal to the radiance 
-                                 ! determined cloud-top temperature
-                                 ! ONLY APPLICABLE IF top_height EQUALS 1 or 3
-                                 ! 1 = default setting, and matches all versions of 
-                                 ! ISCCP simulator with versions numbers 3.5.1 and lower
-                                 ! 2 = experimental setting  
-  !----------------------------------------------------------------------------------
-  !-------------- RTTOV inputs
-  !----------------------------------------------------------------------------------
-  Platform=1,    ! satellite platform
-  Satellite=15,  ! satellite
-  Instrument=0,  ! instrument
-  Nchannels=8,   ! Number of channels to be computed
-  Channels=1,3,5,6,8,10,11,13,        ! Channel numbers (please be sure that you supply Nchannels)
-  Surfem=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,  ! Surface emissivity (please be sure that you supply Nchannels)
-  ZenAng=50.0, ! Satellite Zenith Angle
-  CO2=5.241e-04, ! Mixing ratios of trace gases
-  CH4=9.139e-07,
-  N2O=4.665e-07,
-  CO=2.098e-07
-/
-
-
Index: LMDZ5/branches/testing/cosp_output_nl.txt
===================================================================
--- LMDZ5/branches/testing/cosp_output_nl.txt	(revision 1663)
+++ 	(revision )
@@ -1,63 +1,0 @@
-! (c) British Crown Copyright 2008, the Met Office.
-! All rights reserved.
-! 
-! Redistribution and use in source and binary forms, with or without modification, are permitted 
-! provided that the following conditions are met:
-! 
-!     * Redistributions of source code must retain the above copyright notice, this list 
-!       of conditions and the following disclaimer.
-!     * Redistributions in binary form must reproduce the above copyright notice, this list
-!       of conditions and the following disclaimer in the documentation and/or other materials 
-!       provided with the distribution.
-!     * Neither the name of the Met Office nor the names of its contributors may be used 
-!       to endorse or promote products derived from this software without specific prior written 
-!       permission.
-! 
-! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
-! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
-! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
-! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
-! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
-! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-! Namelist that sets up output-related variables. It controls 
-! the instrument simulators to run and the list of variables 
-! to be written to file
-&COSP_OUTPUT
-  ! Simulator flags
-  Lradar_sim=.false.,
-  Llidar_sim=.true.,
-  Lisccp_sim=.true.,
-  Lmisr_sim=.false.,
-  ! Output variables
-  Lalbisccp=.true.,
-  Latb532=.true.,
-  Lboxptopisccp=.true.,
-  Lboxtauisccp=.true.,
-  Lcfad_dbze94=.false.,
-  Lcfad_lidarsr532=.true.,
-  Lclcalipso=.true.,
-  Lclhcalipso=.true.,
-  Lclisccp2=.true.,
-  Lcllcalipso=.true.,
-  Lclmcalipso=.true.,
-  Lcltcalipso=.true.,
-  Lctpisccp=.true.,
-  Ldbze94=.false.,
-  Ltauisccp=.true.,
-  Ltclisccp=.true.,
-  Llongitude=.false.,
-  Llatitude=.false.,
-  Lparasol_refl=.true.,
-  LclMISR=.false.,
-  Lmeantbisccp=.true.,
-  Lmeantbclrisccp=.true.,
-  ! Use lidar and radar
-  Lclcalipso2=.false.,
-  Lcltlidarradar=.false.,
-  ! These are provided for debugging or special purposes
-  Lfrac_out=.false.,
-  Lbeta_mol532=.true.,  
-/
Index: LMDZ5/branches/testing/gcm.def
===================================================================
--- LMDZ5/branches/testing/gcm.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/gcm.def
Index: LMDZ5/branches/testing/guide.def
===================================================================
--- LMDZ5/branches/testing/guide.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/guide.def
Index: LMDZ5/branches/testing/libf/dyn3d/ce0l.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3d/ce0l.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3d/ce0l.F90	(revision 1664)
@@ -67,5 +67,5 @@
 #endif
 
-  IF (config_inca /= 'none') THEN
+  IF (type_trac == 'inca') THEN
 #ifdef INCA
     CALL init_const_lmdz(nbtr,anneeref,dayref,iphysiq,day_step,nday)
Index: LMDZ5/branches/testing/libf/dyn3d/conf_gcm.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3d/conf_gcm.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3d/conf_gcm.F	(revision 1664)
@@ -13,4 +13,5 @@
       use ioipsl_getincom
 #endif
+      USE infotrac, ONLY : type_trac
       IMPLICIT NONE
 c-----------------------------------------------------------------------
@@ -571,4 +572,14 @@
        offline = .FALSE.
        CALL getin('offline',offline)
+     
+!Config  Key  = type_trac
+!Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
+!Config  Def  = lmdz
+!Config  Help = 
+!Config         'lmdz' = pas de couplage, pur LMDZ
+!Config         'inca' = model de chime INCA 
+!Config         'repr' = model de chime REPROBUS
+      type_trac = 'lmdz'
+      CALL getin('type_trac',type_trac)
 
 !Config  Key  = config_inca
@@ -643,4 +654,5 @@
       write(lunout,*)' tauyy = ', tauyy
       write(lunout,*)' offline = ', offline
+      write(lunout,*)' type_trac = ', type_trac
       write(lunout,*)' config_inca = ', config_inca
       write(lunout,*)' ok_dynzon = ', ok_dynzon 
@@ -761,4 +773,14 @@
        offline = .FALSE.
        CALL getin('offline',offline)
+
+!Config  Key  = type_trac
+!Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
+!Config  Def  = lmdz
+!Config  Help = 
+!Config         'lmdz' = pas de couplage, pur LMDZ
+!Config         'inca' = model de chime INCA 
+!Config         'repr' = model de chime REPROBUS
+      type_trac = 'lmdz'
+      CALL getin('type_trac',type_trac)
 
 !Config  Key  = config_inca
@@ -886,4 +908,5 @@
       write(lunout,*)' tauy = ', tauy
       write(lunout,*)' offline = ', offline
+      write(lunout,*)' type_trac = ', type_trac
       write(lunout,*)' config_inca = ', config_inca
       write(lunout,*)' ok_dynzon = ', ok_dynzon
Index: LMDZ5/branches/testing/libf/dyn3d/dynredem.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3d/dynredem.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3d/dynredem.F	(revision 1664)
@@ -641,5 +641,5 @@
 #endif
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 ! Ajout Anne pour lecture valeurs traceurs dans un fichier start_trac.nc
          ierr_file = NF_OPEN ("start_trac.nc", NF_NOWRITE,nid_trac)
@@ -654,5 +654,5 @@
       do iq=1,nqtot 
 
-         IF (config_inca == 'none') THEN
+         IF (type_trac /= 'inca') THEN
             ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
             IF (ierr .NE. NF_NOERR) THEN
@@ -666,5 +666,5 @@
             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
 #endif
-        ELSE ! config_inca = 'chem' ou 'aero'
+        ELSE ! type_trac = inca
 ! lecture de la valeur du traceur dans start_trac.nc
            IF (ierr_file .ne. 2) THEN
@@ -730,5 +730,5 @@
 #endif
           ENDIF ! (ierr_file .ne. 2)
-       END IF   ! config_inca
+       END IF   !type_trac
       
       ENDDO
Index: LMDZ5/branches/testing/libf/dyn3d/gcm.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3d/gcm.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3d/gcm.F	(revision 1664)
@@ -212,5 +212,5 @@
 c-----------------------------------------------------------------------
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 #ifdef INCA
       call init_const_lmdz(nbtr,anneeref,dayref,iphysiq,day_step,nday, 
@@ -263,5 +263,5 @@
       endif ! of if (read_start)
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 #ifdef INCA
          call init_inca_dim(klon,llm,iim,jjm,
Index: LMDZ5/branches/testing/libf/dyn3d/infotrac.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3d/infotrac.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3d/infotrac.F90	(revision 1664)
@@ -32,4 +32,7 @@
   SUBROUTINE infotrac_init
     USE control_mod
+#ifdef REPROBUS
+    USE CHEM_REP, ONLY : Init_chem_rep_trac
+#endif
     IMPLICIT NONE
 !=======================================================================
@@ -85,9 +88,36 @@
     
 
-    IF (config_inca=='none') THEN
-       type_trac='lmdz'
+    ! Coherence test between parameter type_trac, config_inca and preprocessing keys
+    IF (type_trac=='inca') THEN
+       WRITE(lunout,*) 'You have choosen to couple with INCA chemestry model : type_trac=', &
+            type_trac,' config_inca=',config_inca
+       IF (config_inca/='aero' .AND. config_inca/='chem') THEN
+          WRITE(lunout,*) 'Incoherence between type_trac and config_inca. Model stops. Modify run.def'
+          CALL abort_gcm('infotrac_init','Incoherence between type_trac and config_inca',1)
+       END IF
+#ifndef INCA
+       WRITE(lunout,*) 'To run this option you must add cpp key INCA and compile with INCA code'
+       CALL abort_gcm('infotrac_init','You must compile with cpp key INCA',1)
+#endif
+    ELSE IF (type_trac=='repr') THEN
+       WRITE(lunout,*) 'You have choosen to couple with REPROBUS chemestry model : type_trac=', type_trac
+#ifndef REPROBUS
+       WRITE(lunout,*) 'To run this option you must add cpp key REPROBUS and compile with REPRPBUS code'
+       CALL abort_gcm('infotrac_init','You must compile with cpp key REPROBUS',1)
+#endif
+    ELSE IF (type_trac == 'lmdz') THEN
+       WRITE(lunout,*) 'Tracers are treated in LMDZ only : type_trac=', type_trac
     ELSE
-       type_trac='inca'
-    END IF
+       WRITE(lunout,*) 'type_trac=',type_trac,' not possible. Model stops'
+       CALL abort_gcm('infotrac_init','bad parameter',1)
+    END IF
+
+
+    ! Test if config_inca is other then none for run without INCA
+    IF (type_trac/='inca' .AND. config_inca/='none') THEN
+       WRITE(lunout,*) 'config_inca will now be changed to none as you do not couple with INCA model'
+       config_inca='none'
+    END IF
+
 
 !-----------------------------------------------------------------------
@@ -97,5 +127,5 @@
 !
 !-----------------------------------------------------------------------
-    IF (type_trac == 'lmdz') THEN
+    IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
        OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
        IF(ierr.EQ.0) THEN
@@ -119,6 +149,6 @@
          nbtr=nqtrue
        endif
-    ELSE
-       ! nbtr has been read from INCA by init_cont_lmdz() in gcm.F 
+    ELSE ! type_trac=inca
+       ! nbtr has been read from INCA by init_const_lmdz() in gcm.F 
        nqtrue=nbtr+2
     END IF
@@ -128,4 +158,12 @@
        CALL abort_gcm('infotrac_init','Not enough tracers',1)
     END IF
+    
+! Transfert number of tracers to Reprobus
+    IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+       CALL Init_chem_rep_trac(nbtr)
+#endif
+    END IF
+       
 !
 ! Allocate variables depending on nqtrue and nbtr
@@ -162,5 +200,5 @@
 !    Get choice of advection schema from file tracer.def or from INCA
 !---------------------------------------------------------------------
-    IF (type_trac == 'lmdz') THEN
+    IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
        IF(ierr.EQ.0) THEN
           ! Continue to read tracer.def
Index: LMDZ5/branches/testing/libf/dyn3d/iniacademic.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3d/iniacademic.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3d/iniacademic.F90	(revision 1664)
@@ -209,8 +209,13 @@
         ! surface pressure
         if (iflag_phys>2) then
+           ! specific value for CMIP5 aqua/terra planets
+           ! "Specify the initial dry mass to be equivalent to
+           !  a global mean surface pressure (101325 minus 245) Pa."
+           ps(:)=101080.  
+        else
+           ! use reference surface pressure
            ps(:)=preff
-        else
-           ps(:)=101080.
         endif
+        
         ! ground geopotential
         phis(:)=0.
Index: LMDZ5/branches/testing/libf/dyn3dpar/ce0l.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/ce0l.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/ce0l.F90	(revision 1664)
@@ -78,5 +78,5 @@
 #endif
 
-  IF (config_inca /= 'none') THEN
+  IF (type_trac == 'inca') THEN
 #ifdef INCA
       CALL init_const_lmdz( &
Index: LMDZ5/branches/testing/libf/dyn3dpar/conf_gcm.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/conf_gcm.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/conf_gcm.F	(revision 1664)
@@ -17,4 +17,5 @@
       use parallel, ONLY : omp_chunk
       USE control_mod
+      USE infotrac, ONLY : type_trac
       IMPLICIT NONE
 c-----------------------------------------------------------------------
@@ -102,5 +103,7 @@
       CALL getin('lunout', lunout)
       IF (lunout /= 5 .and. lunout /= 6) THEN
-        OPEN(lunout,FILE='lmdz.out')
+        OPEN(UNIT=lunout,FILE='lmdz.out_0000',ACTION='write', 
+     &          STATUS='unknown',FORM='formatted')
+
       ENDIF
 
@@ -588,4 +591,15 @@
        END IF
        
+!Config  Key  = type_trac
+!Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
+!Config  Def  = lmdz
+!Config  Help = 
+!Config         'lmdz' = pas de couplage, pur LMDZ
+!Config         'inca' = model de chime INCA 
+!Config         'repr' = model de chime REPROBUS
+      type_trac = 'lmdz'
+      CALL getin('type_trac',type_trac)
+
+
 !Config  Key  = config_inca
 !Config  Desc = Choix de configuration de INCA
@@ -659,4 +673,5 @@
       write(lunout,*)' tauyy = ', tauyy
       write(lunout,*)' offline = ', offline
+      write(lunout,*)' type_trac = ', type_trac
       write(lunout,*)' config_inca = ', config_inca
       write(lunout,*)' ok_dynzon = ', ok_dynzon 
@@ -785,4 +800,14 @@
      &         'only the file phystoke.nc will still be created ' 
        END IF
+
+!Config  Key  = type_trac
+!Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
+!Config  Def  = lmdz
+!Config  Help = 
+!Config         'lmdz' = pas de couplage, pur LMDZ
+!Config         'inca' = model de chime INCA 
+!Config         'repr' = model de chime REPROBUS
+      type_trac = 'lmdz'
+      CALL getin('type_trac',type_trac)
 
 !Config  Key  = config_inca
@@ -933,4 +958,5 @@
       write(lunout,*)' tauy = ', tauy
       write(lunout,*)' offline = ', offline
+      write(lunout,*)' type_trac = ', type_trac
       write(lunout,*)' config_inca = ', config_inca
       write(lunout,*)' ok_dynzon = ', ok_dynzon 
Index: LMDZ5/branches/testing/libf/dyn3dpar/dynredem.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/dynredem.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/dynredem.F	(revision 1664)
@@ -641,5 +641,5 @@
 #endif
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 ! Ajout Anne pour lecture valeurs traceurs dans un fichier start_trac.nc
          ierr_file = NF_OPEN ("start_trac.nc", NF_NOWRITE,nid_trac)
@@ -654,5 +654,5 @@
       do iq=1,nqtot 
 
-         IF (config_inca == 'none') THEN
+         IF (type_trac /= 'inca') THEN
             ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
             IF (ierr .NE. NF_NOERR) THEN
@@ -666,5 +666,5 @@
             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
 #endif
-        ELSE ! config_inca = 'chem' ou 'aero'
+        ELSE ! type_trac=inca
 ! lecture de la valeur du traceur dans start_trac.nc
            IF (ierr_file .ne. 2) THEN
@@ -730,5 +730,5 @@
 #endif
           ENDIF ! (ierr_file .ne. 2)
-       END IF   ! config_inca
+       END IF   ! type_trac
       
       ENDDO
Index: LMDZ5/branches/testing/libf/dyn3dpar/dynredem_p.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/dynredem_p.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/dynredem_p.F	(revision 1664)
@@ -650,5 +650,5 @@
 #endif
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 ! Ajout Anne pour lecture valeurs traceurs dans un fichier start_trac.nc
          inquire(FILE="start_trac.nc", EXIST=exist_file) 
@@ -667,5 +667,5 @@
       do iq=1,nqtot 
 
-         IF (config_inca == 'none') THEN
+         IF (type_trac /= 'inca') THEN
             ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
             IF (ierr .NE. NF_NOERR) THEN
@@ -678,5 +678,5 @@
             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
 #endif
-        ELSE ! config_inca = 'chem' ou 'aero'
+        ELSE ! type_trac = inca
 ! lecture de la valeur du traceur dans start_trac.nc
            IF (ierr_file .ne. 2) THEN
@@ -732,5 +732,5 @@
 #endif
           ENDIF ! (ierr_file .ne. 2)
-       END IF   ! config_inca
+       END IF   ! type_trac
       
       ENDDO
Index: LMDZ5/branches/testing/libf/dyn3dpar/exner_hyb_p.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/exner_hyb_p.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/exner_hyb_p.F	(revision 1664)
@@ -125,5 +125,5 @@
       endif
 !$OMP END MASTER
-
+!$OMP BARRIER
         jjb=jj_begin
         jje=jj_end
@@ -171,4 +171,5 @@
       endif
 c$OMP END MASTER
+c$OMP BARRIER
 c
 c
Index: LMDZ5/branches/testing/libf/dyn3dpar/exner_milieu_p.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/exner_milieu_p.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/exner_milieu_p.F	(revision 1664)
@@ -121,5 +121,5 @@
       endif
 !$OMP END MASTER
-
+!$OMP BARRIER
         jjb=jj_begin
         jje=jj_end
@@ -169,4 +169,5 @@
       endif
 c$OMP END MASTER
+c$OMP BARRIER
 c
 c
Index: LMDZ5/branches/testing/libf/dyn3dpar/gcm.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/gcm.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/gcm.F	(revision 1664)
@@ -240,5 +240,5 @@
 #endif
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 #ifdef INCA
          call init_const_lmdz(
@@ -459,5 +459,5 @@
 c   Initialisation des dimensions d'INCA :
 c   --------------------------------------
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 !$OMP PARALLEL
 #ifdef INCA
Index: LMDZ5/branches/testing/libf/dyn3dpar/infotrac.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/infotrac.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/infotrac.F90	(revision 1664)
@@ -32,4 +32,7 @@
   SUBROUTINE infotrac_init
     USE control_mod
+#ifdef REPROBUS
+    USE CHEM_REP, ONLY : Init_chem_rep_trac
+#endif
     IMPLICIT NONE
 !=======================================================================
@@ -85,9 +88,36 @@
     
 
-    IF (config_inca=='none') THEN
-       type_trac='lmdz'
+    ! Coherence test between parameter type_trac, config_inca and preprocessing keys
+    IF (type_trac=='inca') THEN
+       WRITE(lunout,*) 'You have choosen to couple with INCA chemestry model : type_trac=', &
+            type_trac,' config_inca=',config_inca
+       IF (config_inca/='aero' .AND. config_inca/='chem') THEN
+          WRITE(lunout,*) 'Incoherence between type_trac and config_inca. Model stops. Modify run.def'
+          CALL abort_gcm('infotrac_init','Incoherence between type_trac and config_inca',1)
+       END IF
+#ifndef INCA
+       WRITE(lunout,*) 'To run this option you must add cpp key INCA and compile with INCA code'
+       CALL abort_gcm('infotrac_init','You must compile with cpp key INCA',1)
+#endif
+    ELSE IF (type_trac=='repr') THEN
+       WRITE(lunout,*) 'You have choosen to couple with REPROBUS chemestry model : type_trac=', type_trac
+#ifndef REPROBUS
+       WRITE(lunout,*) 'To run this option you must add cpp key REPROBUS and compile with REPRPBUS code'
+       CALL abort_gcm('infotrac_init','You must compile with cpp key REPROBUS',1)
+#endif
+    ELSE IF (type_trac == 'lmdz') THEN
+       WRITE(lunout,*) 'Tracers are treated in LMDZ only : type_trac=', type_trac
     ELSE
-       type_trac='inca'
-    END IF
+       WRITE(lunout,*) 'type_trac=',type_trac,' not possible. Model stops'
+       CALL abort_gcm('infotrac_init','bad parameter',1)
+    END IF
+
+
+    ! Test if config_inca is other then none for run without INCA
+    IF (type_trac/='inca' .AND. config_inca/='none') THEN
+       WRITE(lunout,*) 'config_inca will now be changed to none as you do not couple with INCA model'
+       config_inca='none'
+    END IF
+
 
 !-----------------------------------------------------------------------
@@ -97,5 +127,5 @@
 !
 !-----------------------------------------------------------------------
-    IF (type_trac == 'lmdz') THEN
+    IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
        OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
        IF(ierr.EQ.0) THEN
@@ -119,6 +149,6 @@
          nbtr=nqtrue
        endif
-    ELSE
-       ! nbtr has been read from INCA by init_cont_lmdz() in gcm.F 
+    ELSE ! type_trac=inca
+       ! nbtr has been read from INCA by init_const_lmdz() in gcm.F 
        nqtrue=nbtr+2
     END IF
@@ -128,4 +158,12 @@
        CALL abort_gcm('infotrac_init','Not enough tracers',1)
     END IF
+    
+! Transfert number of tracers to Reprobus
+    IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+       CALL Init_chem_rep_trac(nbtr)
+#endif
+    END IF
+       
 !
 ! Allocate variables depending on nqtrue and nbtr
@@ -162,5 +200,5 @@
 !    Get choice of advection schema from file tracer.def or from INCA
 !---------------------------------------------------------------------
-    IF (type_trac == 'lmdz') THEN
+    IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
        IF(ierr.EQ.0) THEN
           ! Continue to read tracer.def
Index: LMDZ5/branches/testing/libf/dyn3dpar/iniacademic.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/iniacademic.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/iniacademic.F90	(revision 1664)
@@ -115,5 +115,5 @@
   endif
 
-  academic_case: if (iflag_phys == 2) then
+  academic_case: if (iflag_phys >= 2) then
      ! initializations
 
@@ -208,5 +208,14 @@
      IF (.NOT. read_start) THEN
         ! surface pressure
-        ps(:)=preff
+        if (iflag_phys>2) then
+           ! specific value for CMIP5 aqua/terra planets
+           ! "Specify the initial dry mass to be equivalent to
+           !  a global mean surface pressure (101325 minus 245) Pa."
+           ps(:)=101080.  
+        else
+           ! use reference surface pressure
+           ps(:)=preff
+        endif
+        
         ! ground geopotential
         phis(:)=0.
Index: LMDZ5/branches/testing/libf/dyn3dpar/leapfrog_p.F
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/leapfrog_p.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/leapfrog_p.F	(revision 1664)
@@ -189,5 +189,4 @@
 
       INTEGER :: true_itau
-      LOGICAL :: verbose=.true.
       INTEGER :: iapptrac
       INTEGER :: AdjustCount
@@ -407,5 +406,5 @@
            call allgather_timer_average
 
-        if (Verbose) then
+        if (prt_level > 9) then
         
         print *,'*********************************'
Index: LMDZ5/branches/testing/libf/dyn3dpar/parallel.F90
===================================================================
--- LMDZ5/branches/testing/libf/dyn3dpar/parallel.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/dyn3dpar/parallel.F90	(revision 1664)
@@ -43,5 +43,7 @@
       integer, dimension(3) :: blocklen,type
       integer :: comp_id
-
+      character(len=4)  :: num
+      character(len=20) :: filename
+ 
 #ifdef CPP_OMP    
       INTEGER :: OMP_GET_NUM_THREADS
@@ -75,5 +77,16 @@
         mpi_rank=0
       ENDIF
-  
+
+
+! Open text output file with mpi_rank in suffix of file name 
+      IF (lunout /= 5 .and. lunout /= 6) THEN
+         WRITE(num,'(I4.4)') mpi_rank
+         filename='lmdz.out_'//num
+         IF (mpi_rank .NE. 0) THEN
+            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
+               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
+         ENDIF
+      ENDIF
+
       
       allocate(jj_begin_para(0:mpi_size-1))
Index: LMDZ5/branches/testing/libf/phylmd/YOEGWD.h
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/YOEGWD.h	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/YOEGWD.h	(revision 1664)
@@ -2,15 +2,16 @@
 ! $Header$
 !
-C     -----------------------------------------------------------------
-C*    *COMMON* *YOEGWD* - PARAMETERS FOR GRAVITY WAVE DRAG CALCULATIONS
-C     -----------------------------------------------------------------
-C
+!  ATTENTION : ce fichier include est compatible format fixe/format libre
+!                 veillez  n'utiliser que des ! pour les commentaires
+!                 et  bien positionner les & des lignes de continuation
+!                 (les placer en colonne 6 et en colonne 73)
+!     -----------------------------------------------------------------
+!*    *COMMON* *YOEGWD* - PARAMETERS FOR GRAVITY WAVE DRAG CALCULATIONS
+!     -----------------------------------------------------------------
+!
       integer NKTOPG,NSTRA
       real GFRCRIT,GKWAKE,GRCRIT,GVCRIT,GKDRAG,GKLIFT
       real GHMAX,GRAHILO,GSIGCR,GSSEC,GTSEC,GVSEC
-      COMMON/YOEGWD/ GFRCRIT,GKWAKE,GRCRIT,GVCRIT,GKDRAG,GKLIFT
-     *        ,GHMAX,GRAHILO,GSIGCR,NKTOPG,NSTRA,GSSEC,GTSEC,GVSEC
-c$OMP THREADPRIVATE(/YOEGWD/)
-C
-
-
+      COMMON/YOEGWD/ GFRCRIT,GKWAKE,GRCRIT,GVCRIT,GKDRAG,GKLIFT         &
+     &        ,GHMAX,GRAHILO,GSIGCR,NKTOPG,NSTRA,GSSEC,GTSEC,GVSEC
+!$OMP THREADPRIVATE(/YOEGWD/)
Index: LMDZ5/branches/testing/libf/phylmd/aeropt_2bands.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/aeropt_2bands.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/aeropt_2bands.F90	(revision 1664)
@@ -928,8 +928,8 @@
   DO m=1,nb_aer   
     IF (.NOT. used_aer(m)) THEN
-      tau_ae(:,:,:,:)=0.
-      tau_ae_pi(:,:,:,:)=0.
-      piz_ae(:,:,:,:)=0.
-      cg_ae(:,:,:,:)=0.
+      tau_ae(:,:,m,:)=0.
+      tau_ae_pi(:,:,m,:)=0.
+      piz_ae(:,:,m,:)=0.
+      cg_ae(:,:,m,:)=0.
     ENDIF
   ENDDO
Index: LMDZ5/branches/testing/libf/phylmd/clesphys.h
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/clesphys.h	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/clesphys.h	(revision 1664)
@@ -66,5 +66,5 @@
        LOGICAL ok_isccp, ok_regdyn
        REAL lonmin_ins, lonmax_ins, latmin_ins, latmax_ins
-       REAL ecrit_ins, ecrit_hf, ecrit_hf2mth, ecrit_day
+       REAL ecrit_ins, ecrit_hf, ecrit_day
        REAL ecrit_mth, ecrit_tra, ecrit_reg 
        REAL ecrit_LES
@@ -93,5 +93,5 @@
      &     , ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP                     &
      &     , lonmin_ins, lonmax_ins, latmin_ins, latmax_ins             &
-     &     , ecrit_ins, ecrit_hf, ecrit_hf2mth, ecrit_day               &
+     &     , ecrit_ins, ecrit_hf, ecrit_day                             &
      &     , ecrit_mth, ecrit_tra, ecrit_reg                            &
      &     , freq_ISCCP, ecrit_ISCCP, freq_COSP, ip_ebil_phy            &
@@ -100,4 +100,5 @@
      &     , co2_ppm0
      
+       save /clesphys/
 !$OMP THREADPRIVATE(/clesphys/)
  
Index: LMDZ5/branches/testing/libf/phylmd/concvl.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/concvl.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/concvl.F	(revision 1664)
@@ -238,5 +238,6 @@
 cc$$$         close (56)
 c
-         print*, 'supcrit1, supcrit2' ,supcrit1, supcrit2
+         IF (prt_level .ge. 10) 
+     &       WRITE(lunout,*) 'supcrit1, supcrit2' ,supcrit1, supcrit2
 C
 C===========================================================================
@@ -248,9 +249,11 @@
           cbmf(i) = 0.
           plcl(i) = 0.
-          plfc(i) = 0.
-          wbeff(i) = 0.
           sigd(i) = 0.
          ENDDO
       ENDIF   !(ifrst .EQ. 0)
+
+c Initialisation a chaque pas de temps
+      plfc(:)  = 0.
+      wbeff(:) = 100.
 
       DO k = 1, klev+1
@@ -368,6 +371,7 @@
       endif  
 C------------------------------------------------------------------
-      print *,' cva_driver -> cbmf,plcl,plfc,wbeff ',
-     .          cbmf(1),plcl(1),plfc(1),wbeff(1)
+      IF (prt_level .ge. 10)
+     .   WRITE(lunout,*) ' cva_driver -> cbmf,plcl,plfc,wbeff ',
+     .                     cbmf(1),plcl(1),plfc(1),wbeff(1)
 
       DO i = 1,klon
Index: LMDZ5/branches/testing/libf/phylmd/conf_phys.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/conf_phys.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/conf_phys.F90	(revision 1664)
@@ -37,4 +37,5 @@
 
  include "thermcell.h"
+ include "iniprint.h"
 
 !IM : on inclut/initialise les taux de CH4, N2O, CFC11 et CFC12
@@ -101,5 +102,4 @@
 
 ! Local
-  integer              :: numout = 6
   real                 :: zzz
 
@@ -199,7 +199,7 @@
   call getin('OCEAN', ocean_omp)
   IF (ocean_omp /= 'yyyyyy') THEN
-     WRITE(numout,*)'ERROR!! Old variable name OCEAN used in parmeter file.'
-     WRITE(numout,*)'Variable OCEAN has been replaced by the variable type_ocean.'
-     WRITE(numout,*)'You have to update your parameter file physiq.def to succed running'
+     WRITE(lunout,*)'ERROR!! Old variable name OCEAN used in parmeter file.'
+     WRITE(lunout,*)'Variable OCEAN has been replaced by the variable type_ocean.'
+     WRITE(lunout,*)'You have to update your parameter file physiq.def to succed running'
      CALL abort_gcm('conf_phys','Variable OCEAN no longer existing, use variable name type_ocean',1)
   END IF
@@ -1351,5 +1351,5 @@
 !Config Help =
 !
-  ecrit_tra_omp = 30.
+  ecrit_tra_omp = 0.
   call getin('ecrit_tra',ecrit_tra_omp)
 !
@@ -1696,5 +1696,5 @@
 ! Test of coherence between type_ocean and version_ocean
     IF (type_ocean=='couple' .AND. (version_ocean/='opa8' .AND. version_ocean/='nemo') ) THEN
-       WRITE(numout,*)' ERROR version_ocean=',version_ocean,' not valid in coupled configuration'
+       WRITE(lunout,*)' ERROR version_ocean=',version_ocean,' not valid in coupled configuration'
        CALL abort_gcm('conf_phys','version_ocean not valid',1)
     END IF
@@ -1703,5 +1703,5 @@
        version_ocean='sicOBS'
     ELSE IF (type_ocean=='slab' .AND. version_ocean/='sicOBS') THEN
-       WRITE(numout,*)' ERROR version_ocean=',version_ocean,' not valid with slab ocean'
+       WRITE(lunout,*)' ERROR version_ocean=',version_ocean,' not valid with slab ocean'
        CALL abort_gcm('conf_phys','version_ocean not valid',1)
     END IF
@@ -1717,137 +1717,137 @@
 !$OMP MASTER
 
-  write(numout,*)' ##############################################'
-  write(numout,*)' Configuration des parametres de la physique: '
-  write(numout,*)' Type ocean = ', type_ocean
-  write(numout,*)' Version ocean = ', version_ocean
-  write(numout,*)' Config veget = ', ok_veget
-  write(numout,*)' Sortie journaliere = ', ok_journe
-  write(numout,*)' Sortie haute frequence = ', ok_hf
-  write(numout,*)' Sortie mensuelle = ', ok_mensuel
-  write(numout,*)' Sortie instantanee = ', ok_instan
-  write(numout,*)' Frequence appel simulateur ISCCP, freq_ISCCP =', freq_ISCCP
-  write(numout,*)' Frequence appel simulateur ISCCP, ecrit_ISCCP =', ecrit_ISCCP
-  write(numout,*)' Frequence appel simulateur COSP, freq_COSP =', freq_COSP
-  write(numout,*)' Sortie bilan d''energie, ip_ebil_phy =', ip_ebil_phy
-  write(numout,*)' Excentricite = ',R_ecc
-  write(numout,*)' Equinoxe = ',R_peri
-  write(numout,*)' Inclinaison =',R_incl
-  write(numout,*)' Constante solaire =',solaire
-  write(numout,*)' co2_ppm =',co2_ppm
-  write(numout,*)' RCO2_act = ',RCO2_act
-  write(numout,*)' CH4_ppb =',CH4_ppb,' RCH4_act = ',RCH4_act
-  write(numout,*)' N2O_ppb =',N2O_ppb,' RN2O_act=  ',RN2O_act
-  write(numout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11_act=  ',RCFC11_act
-  write(numout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12_act=  ',RCFC12_act
-  write(numout,*)' RCO2_per = ',RCO2_per,' RCH4_per = ', RCH4_per
-  write(numout,*)' RN2O_per = ',RN2O_per,' RCFC11_per = ', RCFC11_per
-  write(numout,*)' RCFC12_per = ',RCFC12_per
-  write(numout,*)' cvl_corr=', cvl_corr
-  write(numout,*)'ok_lic_melt=', ok_lic_melt
-  write(numout,*)'cycle_diurne=',cycle_diurne
-  write(numout,*)'soil_model=',soil_model
-  write(numout,*)'new_oliq=',new_oliq
-  write(numout,*)'ok_orodr=',ok_orodr
-  write(numout,*)'ok_orolf=',ok_orolf
-  write(numout,*)'ok_limitvrai=',ok_limitvrai
-  write(numout,*)'nbapp_rad=',nbapp_rad
-  write(numout,*)'iflag_con=',iflag_con
-  write(numout,*)' epmax = ', epmax
-  write(numout,*)' ok_adj_ema = ', ok_adj_ema
-  write(numout,*)' iflag_clw = ', iflag_clw
-  write(numout,*)' cld_lc_lsc = ', cld_lc_lsc
-  write(numout,*)' cld_lc_con = ', cld_lc_con
-  write(numout,*)' cld_tau_lsc = ', cld_tau_lsc
-  write(numout,*)' cld_tau_con = ', cld_tau_con
-  write(numout,*)' ffallv_lsc = ', ffallv_lsc
-  write(numout,*)' ffallv_con = ', ffallv_con
-  write(numout,*)' coef_eva = ', coef_eva
-  write(numout,*)' reevap_ice = ', reevap_ice
-  write(numout,*)' iflag_pdf = ', iflag_pdf
-  write(numout,*)' iflag_cldcon = ', iflag_cldcon
-  write(numout,*)' iflag_radia = ', iflag_radia
-  write(numout,*)' iflag_rrtm = ', iflag_rrtm
-  write(numout,*)' iflag_ratqs = ', iflag_ratqs
-  write(numout,*)' seuil_inversion = ', seuil_inversion
-  write(numout,*)' fact_cldcon = ', fact_cldcon
-  write(numout,*)' facttemps = ', facttemps
-  write(numout,*)' ok_newmicro = ',ok_newmicro 
-  write(numout,*)' ratqsbas = ',ratqsbas 
-  write(numout,*)' ratqshaut = ',ratqshaut 
-  write(numout,*)' tau_ratqs = ',tau_ratqs 
-  write(numout,*)' top_height = ',top_height 
-  write(numout,*)' rad_froid = ',rad_froid
-  write(numout,*)' rad_chau1 = ',rad_chau1
-  write(numout,*)' rad_chau2 = ',rad_chau2
-  write(numout,*)' t_glace_min = ',t_glace_min
-  write(numout,*)' t_glace_max = ',t_glace_max
-  write(numout,*)' rei_min = ',rei_min
-  write(numout,*)' rei_max = ',rei_max
-  write(numout,*)' overlap = ',overlap 
-  write(numout,*)' cdmmax = ',cdmmax 
-  write(numout,*)' cdhmax = ',cdhmax 
-  write(numout,*)' ksta = ',ksta 
-  write(numout,*)' ksta_ter = ',ksta_ter 
-  write(numout,*)' ok_kzmin = ',ok_kzmin 
-  write(numout,*)' fmagic = ',fmagic
-  write(numout,*)' pmagic = ',pmagic
-  write(numout,*)' ok_ade = ',ok_ade
-  write(numout,*)' ok_aie = ',ok_aie
-  write(numout,*)' aerosol_couple = ', aerosol_couple
-  write(numout,*)' flag_aerosol = ', flag_aerosol
-  write(numout,*)' new_aod = ', new_aod
-  write(numout,*)' aer_type = ',aer_type
-  write(numout,*)' bl95_b0 = ',bl95_b0
-  write(numout,*)' bl95_b1 = ',bl95_b1
-  write(numout,*)' lev_histhf = ',lev_histhf 
-  write(numout,*)' lev_histday = ',lev_histday 
-  write(numout,*)' lev_histmth = ',lev_histmth 
-  write(numout,*)' lev_histins = ',lev_histins
-  write(numout,*)' lev_histLES = ',lev_histLES
-  write(numout,*)' lev_histdayNMC = ',lev_histdayNMC
-  write(numout,*)' ok_histNMC = ',ok_histNMC
-  write(numout,*)' freq_outNMC = ',freq_outNMC
-  write(numout,*)' freq_calNMC = ',freq_calNMC
-  write(numout,*)' iflag_pbl = ', iflag_pbl
-  write(numout,*)' iflag_thermals = ', iflag_thermals
-  write(numout,*)' iflag_thermals_ed = ', iflag_thermals_ed
-  write(numout,*)' iflag_thermals_optflux = ', iflag_thermals_optflux
-  write(numout,*)' iflag_clos = ', iflag_clos
-  write(numout,*)' type_run = ',type_run 
-  write(numout,*)' ok_isccp = ',ok_isccp 
-  write(numout,*)' ok_cosp = ',ok_cosp
-  write(numout,*)' ok_mensuelCOSP = ',ok_mensuelCOSP
-  write(numout,*)' ok_journeCOSP = ',ok_journeCOSP
-  write(numout,*)' ok_hfCOSP =',ok_hfCOSP
-  write(numout,*)' solarlong0 = ', solarlong0
-  write(numout,*)' qsol0 = ', qsol0
-  write(numout,*)' inertie_sol = ', inertie_sol
-  write(numout,*)' inertie_ice = ', inertie_ice
-  write(numout,*)' inertie_sno = ', inertie_sno
-  write(numout,*)' f_cdrag_ter = ',f_cdrag_ter
-  write(numout,*)' f_cdrag_oce = ',f_cdrag_oce
-  write(numout,*)' f_rugoro = ',f_rugoro
-  write(numout,*)' supcrit1 = ', supcrit1
-  write(numout,*)' supcrit2 = ', supcrit2
-  write(numout,*)' iflag_mix = ', iflag_mix
-  write(numout,*)' scut = ', scut
-  write(numout,*)' qqa1 = ', qqa1
-  write(numout,*)' qqa2 = ', qqa2
-  write(numout,*)' gammas = ', gammas
-  write(numout,*)' Fmax = ', Fmax
-  write(numout,*)' alphas = ', alphas
-  write(numout,*)' iflag_wake = ', iflag_wake
-  write(numout,*)' alp_offset = ', alp_offset
-
-  write(numout,*)' lonmin lonmax latmin latmax bilKP_ins =',&
+  write(lunout,*)' ##############################################'
+  write(lunout,*)' Configuration des parametres de la physique: '
+  write(lunout,*)' Type ocean = ', type_ocean
+  write(lunout,*)' Version ocean = ', version_ocean
+  write(lunout,*)' Config veget = ', ok_veget
+  write(lunout,*)' Sortie journaliere = ', ok_journe
+  write(lunout,*)' Sortie haute frequence = ', ok_hf
+  write(lunout,*)' Sortie mensuelle = ', ok_mensuel
+  write(lunout,*)' Sortie instantanee = ', ok_instan
+  write(lunout,*)' Frequence appel simulateur ISCCP, freq_ISCCP =', freq_ISCCP
+  write(lunout,*)' Frequence appel simulateur ISCCP, ecrit_ISCCP =', ecrit_ISCCP
+  write(lunout,*)' Frequence appel simulateur COSP, freq_COSP =', freq_COSP
+  write(lunout,*)' Sortie bilan d''energie, ip_ebil_phy =', ip_ebil_phy
+  write(lunout,*)' Excentricite = ',R_ecc
+  write(lunout,*)' Equinoxe = ',R_peri
+  write(lunout,*)' Inclinaison =',R_incl
+  write(lunout,*)' Constante solaire =',solaire
+  write(lunout,*)' co2_ppm =',co2_ppm
+  write(lunout,*)' RCO2_act = ',RCO2_act
+  write(lunout,*)' CH4_ppb =',CH4_ppb,' RCH4_act = ',RCH4_act
+  write(lunout,*)' N2O_ppb =',N2O_ppb,' RN2O_act=  ',RN2O_act
+  write(lunout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11_act=  ',RCFC11_act
+  write(lunout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12_act=  ',RCFC12_act
+  write(lunout,*)' RCO2_per = ',RCO2_per,' RCH4_per = ', RCH4_per
+  write(lunout,*)' RN2O_per = ',RN2O_per,' RCFC11_per = ', RCFC11_per
+  write(lunout,*)' RCFC12_per = ',RCFC12_per
+  write(lunout,*)' cvl_corr=', cvl_corr
+  write(lunout,*)'ok_lic_melt=', ok_lic_melt
+  write(lunout,*)'cycle_diurne=',cycle_diurne
+  write(lunout,*)'soil_model=',soil_model
+  write(lunout,*)'new_oliq=',new_oliq
+  write(lunout,*)'ok_orodr=',ok_orodr
+  write(lunout,*)'ok_orolf=',ok_orolf
+  write(lunout,*)'ok_limitvrai=',ok_limitvrai
+  write(lunout,*)'nbapp_rad=',nbapp_rad
+  write(lunout,*)'iflag_con=',iflag_con
+  write(lunout,*)' epmax = ', epmax
+  write(lunout,*)' ok_adj_ema = ', ok_adj_ema
+  write(lunout,*)' iflag_clw = ', iflag_clw
+  write(lunout,*)' cld_lc_lsc = ', cld_lc_lsc
+  write(lunout,*)' cld_lc_con = ', cld_lc_con
+  write(lunout,*)' cld_tau_lsc = ', cld_tau_lsc
+  write(lunout,*)' cld_tau_con = ', cld_tau_con
+  write(lunout,*)' ffallv_lsc = ', ffallv_lsc
+  write(lunout,*)' ffallv_con = ', ffallv_con
+  write(lunout,*)' coef_eva = ', coef_eva
+  write(lunout,*)' reevap_ice = ', reevap_ice
+  write(lunout,*)' iflag_pdf = ', iflag_pdf
+  write(lunout,*)' iflag_cldcon = ', iflag_cldcon
+  write(lunout,*)' iflag_radia = ', iflag_radia
+  write(lunout,*)' iflag_rrtm = ', iflag_rrtm
+  write(lunout,*)' iflag_ratqs = ', iflag_ratqs
+  write(lunout,*)' seuil_inversion = ', seuil_inversion
+  write(lunout,*)' fact_cldcon = ', fact_cldcon
+  write(lunout,*)' facttemps = ', facttemps
+  write(lunout,*)' ok_newmicro = ',ok_newmicro 
+  write(lunout,*)' ratqsbas = ',ratqsbas 
+  write(lunout,*)' ratqshaut = ',ratqshaut 
+  write(lunout,*)' tau_ratqs = ',tau_ratqs 
+  write(lunout,*)' top_height = ',top_height 
+  write(lunout,*)' rad_froid = ',rad_froid
+  write(lunout,*)' rad_chau1 = ',rad_chau1
+  write(lunout,*)' rad_chau2 = ',rad_chau2
+  write(lunout,*)' t_glace_min = ',t_glace_min
+  write(lunout,*)' t_glace_max = ',t_glace_max
+  write(lunout,*)' rei_min = ',rei_min
+  write(lunout,*)' rei_max = ',rei_max
+  write(lunout,*)' overlap = ',overlap 
+  write(lunout,*)' cdmmax = ',cdmmax 
+  write(lunout,*)' cdhmax = ',cdhmax 
+  write(lunout,*)' ksta = ',ksta 
+  write(lunout,*)' ksta_ter = ',ksta_ter 
+  write(lunout,*)' ok_kzmin = ',ok_kzmin 
+  write(lunout,*)' fmagic = ',fmagic
+  write(lunout,*)' pmagic = ',pmagic
+  write(lunout,*)' ok_ade = ',ok_ade
+  write(lunout,*)' ok_aie = ',ok_aie
+  write(lunout,*)' aerosol_couple = ', aerosol_couple
+  write(lunout,*)' flag_aerosol = ', flag_aerosol
+  write(lunout,*)' new_aod = ', new_aod
+  write(lunout,*)' aer_type = ',aer_type
+  write(lunout,*)' bl95_b0 = ',bl95_b0
+  write(lunout,*)' bl95_b1 = ',bl95_b1
+  write(lunout,*)' lev_histhf = ',lev_histhf 
+  write(lunout,*)' lev_histday = ',lev_histday 
+  write(lunout,*)' lev_histmth = ',lev_histmth 
+  write(lunout,*)' lev_histins = ',lev_histins
+  write(lunout,*)' lev_histLES = ',lev_histLES
+  write(lunout,*)' lev_histdayNMC = ',lev_histdayNMC
+  write(lunout,*)' ok_histNMC = ',ok_histNMC
+  write(lunout,*)' freq_outNMC = ',freq_outNMC
+  write(lunout,*)' freq_calNMC = ',freq_calNMC
+  write(lunout,*)' iflag_pbl = ', iflag_pbl
+  write(lunout,*)' iflag_thermals = ', iflag_thermals
+  write(lunout,*)' iflag_thermals_ed = ', iflag_thermals_ed
+  write(lunout,*)' iflag_thermals_optflux = ', iflag_thermals_optflux
+  write(lunout,*)' iflag_clos = ', iflag_clos
+  write(lunout,*)' type_run = ',type_run 
+  write(lunout,*)' ok_isccp = ',ok_isccp 
+  write(lunout,*)' ok_cosp = ',ok_cosp
+  write(lunout,*)' ok_mensuelCOSP = ',ok_mensuelCOSP
+  write(lunout,*)' ok_journeCOSP = ',ok_journeCOSP
+  write(lunout,*)' ok_hfCOSP =',ok_hfCOSP
+  write(lunout,*)' solarlong0 = ', solarlong0
+  write(lunout,*)' qsol0 = ', qsol0
+  write(lunout,*)' inertie_sol = ', inertie_sol
+  write(lunout,*)' inertie_ice = ', inertie_ice
+  write(lunout,*)' inertie_sno = ', inertie_sno
+  write(lunout,*)' f_cdrag_ter = ',f_cdrag_ter
+  write(lunout,*)' f_cdrag_oce = ',f_cdrag_oce
+  write(lunout,*)' f_rugoro = ',f_rugoro
+  write(lunout,*)' supcrit1 = ', supcrit1
+  write(lunout,*)' supcrit2 = ', supcrit2
+  write(lunout,*)' iflag_mix = ', iflag_mix
+  write(lunout,*)' scut = ', scut
+  write(lunout,*)' qqa1 = ', qqa1
+  write(lunout,*)' qqa2 = ', qqa2
+  write(lunout,*)' gammas = ', gammas
+  write(lunout,*)' Fmax = ', Fmax
+  write(lunout,*)' alphas = ', alphas
+  write(lunout,*)' iflag_wake = ', iflag_wake
+  write(lunout,*)' alp_offset = ', alp_offset
+
+  write(lunout,*)' lonmin lonmax latmin latmax bilKP_ins =',&
    lonmin_ins, lonmax_ins, latmin_ins, latmax_ins
-  write(numout,*)' ecrit_ hf, ins, day, mth, reg, tra, ISCCP, LES',&
+  write(lunout,*)' ecrit_ hf, ins, day, mth, reg, tra, ISCCP, LES',&
    ecrit_hf, ecrit_ins, ecrit_day, ecrit_mth, ecrit_reg, ecrit_tra, ecrit_ISCCP, ecrit_LES
 
-  write(numout,*) 'ok_strato = ', ok_strato
-  write(numout,*) 'ok_hines = ',  ok_hines
-  write(numout,*) 'read_climoz = ', read_climoz
-  write(numout,*) 'carbon_cycle_tr = ', carbon_cycle_tr
-  write(numout,*) 'carbon_cycle_cpl = ', carbon_cycle_cpl
+  write(lunout,*) 'ok_strato = ', ok_strato
+  write(lunout,*) 'ok_hines = ',  ok_hines
+  write(lunout,*) 'read_climoz = ', read_climoz
+  write(lunout,*) 'carbon_cycle_tr = ', carbon_cycle_tr
+  write(lunout,*) 'carbon_cycle_cpl = ', carbon_cycle_cpl
   
 !$OMP END MASTER
@@ -1866,5 +1866,5 @@
    use IOIPSL
    implicit none
-
+   include "iniprint.h"
 ! Configuration de l'interace atm/surf
 !
@@ -1874,6 +1874,4 @@
   REAL,SAVE     :: tau_calv_omp
 
-! Local
-  integer              :: numout = 6
 !
 !Config Key  = tau_calv
@@ -1891,7 +1889,7 @@
   
 !$OMP MASTER
-  write(numout,*)' ##############################################'
-  WRITE(numout,*)' Configuration de l''interface atm/surfaces  : '
-  WRITE(numout,*)' tau_calv = ',tau_calv
+  write(lunout,*)' ##############################################'
+  WRITE(lunout,*)' Configuration de l''interface atm/surfaces  : '
+  WRITE(lunout,*)' tau_calv = ',tau_calv
 !$OMP END MASTER
 
Index: LMDZ5/branches/testing/libf/phylmd/cv3p1_closure.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/cv3p1_closure.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/cv3p1_closure.F	(revision 1664)
@@ -516,13 +516,22 @@
         wb2(il) = sqrt(2.*max(Ale(il)+cin(il),0.))
       ENDDO
-c
-      IF (flag_wb==0) THEN
-        wbeff(:) = wbmax
-      ELSE IF (flag_wb==1) THEN
-        wbeff(1:ncum) = wbmax/(1.+500./(ph(1:ncum,1)-plfc(1:ncum)))
-      ELSE IF (flag_wb==2) THEN
-        wbeff(1:ncum) = wbmax*(0.01*(ph(1:ncum,1)-plfc(1:ncum)))**2
-      ENDIF
-c
+
+      DO il = 1, ncum
+         IF (plfc(il) .lt. 100.) THEN
+c        This is an irealistic value for plfc => no calculation of wbeff
+            wbeff(il) = 100.1
+         ELSE
+c        Calculate wbeff
+            IF (flag_wb==0) THEN
+               wbeff(il) = wbmax
+            ELSE IF (flag_wb==1) THEN
+               wbeff(il) = wbmax/(1.+500./(ph(il,1)-plfc(il)))
+            ELSE IF (flag_wb==2) THEN
+               wbeff(il) = wbmax*(0.01*(ph(il,1)-plfc(il)))**2
+            ENDIF
+         END IF
+      END DO
+
+
       DO il = 1,ncum
 cjyg    Modification du coef de wb*wb pour conformite avec papier Wake
Index: LMDZ5/branches/testing/libf/phylmd/cv3p_mixing.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/cv3p_mixing.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/cv3p_mixing.F	(revision 1664)
@@ -81,5 +81,5 @@
       Rmix(F) = qqa1*Rmix1(F) + qqa2*Rmix2(F)
 C
-      INTEGER ifrst
+      INTEGER, SAVE :: ifrst
       DATA ifrst/0/
 c$OMP THREADPRIVATE(ifrst)
Index: LMDZ5/branches/testing/libf/phylmd/fisrtilp.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/fisrtilp.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/fisrtilp.F90	(revision 1664)
@@ -147,10 +147,10 @@
   IF (appel1er) THEN
      !
-     PRINT*, 'fisrtilp, ninter:', ninter
-     PRINT*, 'fisrtilp, evap_prec:', evap_prec
-     PRINT*, 'fisrtilp, cpartiel:', cpartiel
+     WRITE(lunout,*) 'fisrtilp, ninter:', ninter
+     WRITE(lunout,*) 'fisrtilp, evap_prec:', evap_prec
+     WRITE(lunout,*) 'fisrtilp, cpartiel:', cpartiel
      IF (ABS(dtime/REAL(ninter)-360.0).GT.0.001) THEN
-        PRINT*, 'fisrtilp: Ce n est pas prevu, voir Z.X.Li', dtime
-        PRINT*, 'Je prefere un sous-intervalle de 6 minutes'
+        WRITE(lunout,*) 'fisrtilp: Ce n est pas prevu, voir Z.X.Li', dtime
+        WRITE(lunout,*) 'Je prefere un sous-intervalle de 6 minutes'
         !         CALL abort
      ENDIF
@@ -616,5 +616,5 @@
 
   if (ncoreczq>0) then
-     print*,'WARNING : ZQ dans fisrtilp ',ncoreczq,' val < 1.e-15.'
+     WRITE(lunout,*)'WARNING : ZQ dans fisrtilp ',ncoreczq,' val < 1.e-15.'
   endif
 
Index: LMDZ5/branches/testing/libf/phylmd/fisrtilp_tr.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/fisrtilp_tr.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/fisrtilp_tr.F	(revision 1664)
@@ -24,4 +24,5 @@
 #include "YOMCST.h"
 #include "tracstoke.h"
+#include "iniprint.h"
 c
 c Arguments:
@@ -136,11 +137,12 @@
       IF (appel1er) THEN
 c
-         PRINT*, 'fisrtilp, calcrat:', calcrat
-         PRINT*, 'fisrtilp, ninter:', ninter
-         PRINT*, 'fisrtilp, evap_prec:', evap_prec
-         PRINT*, 'fisrtilp, cpartiel:', cpartiel
+         WRITE(lunout,*) 'fisrtilp, calcrat:', calcrat
+         WRITE(lunout,*) 'fisrtilp, ninter:', ninter
+         WRITE(lunout,*) 'fisrtilp, evap_prec:', evap_prec
+         WRITE(lunout,*) 'fisrtilp, cpartiel:', cpartiel
          IF (ABS(dtime/REAL(ninter)-360.0).GT.0.001) THEN
-          PRINT*, 'fisrtilp: Ce n est pas prevu, voir Z.X.Li', dtime
-          PRINT*, 'Je prefere un sous-intervalle de 6 minutes'
+          WRITE(lunout,*) 
+     $    'fisrtilp: Ce n est pas prevu, voir Z.X.Li', dtime
+          WRITE(lunout,*) 'Je prefere un sous-intervalle de 6 minutes'
           CALL abort
          ENDIF
Index: LMDZ5/branches/testing/libf/phylmd/hgardfou.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/hgardfou.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/hgardfou.F	(revision 1664)
@@ -11,4 +11,5 @@
 #include "YOMCST.h"
 #include "indicesol.h"
+#include "iniprint.h"
       REAL t(klon,klev), tsol(klon,nbsrf)
       CHARACTER*(*) text
@@ -27,8 +28,9 @@
 
       IF (firstcall) THEN
-         PRINT*, 'hgardfou garantit la temperature dans [100,370] K'
+         WRITE(lunout,*) 
+     $  'hgardfou garantit la temperature dans [100,370] K'
          firstcall = .FALSE.
 c        DO i = 1, klon
-c         print*,'i=',i,'rlon=',rlon(i),'rlat=',rlat(i)
+c         WRITE(lunout,*)'i=',i,'rlon=',rlon(i),'rlat=',rlat(i)
 c        ENDDO
 c
@@ -54,5 +56,6 @@
            ok = .FALSE.
            DO i = 1, jbad
-             PRINT *,'i,k,temperature,lon,lat,pourc ter,oce,lic,sic =',
+             WRITE(lunout,*)
+     $       'i,k,temperature,lon,lat,pourc ter,oce,lic,sic =',
      $       jadrs(i),k,zt(jadrs(i)),rlon(jadrs(i)),rlat(jadrs(i)),
      $       (pctsrf(jadrs(i),nsrf),nsrf=1,nbsrf)
@@ -74,5 +77,6 @@
            ok = .FALSE.
            DO i = 1, jbad
-             PRINT *,'i,k,temperature,lon,lat,pourc ter,oce,lic,sic =',
+             WRITE(lunout,*)
+     $       'i,k,temperature,lon,lat,pourc ter,oce,lic,sic =',
      $       jadrs(i),k,zt(jadrs(i)),rlon(jadrs(i)),rlat(jadrs(i)),
      $       (pctsrf(jadrs(i),nsrf),nsrf=1,nbsrf)
@@ -99,5 +103,6 @@
            ok = .FALSE.
            DO i = 1, jbad
-            PRINT *,'i,nsrf,temperature,lon,lat,pourc ter,oce,lic,sic ='
+            WRITE(lunout,*) 
+     $      'i,nsrf,temperature,lon,lat,pourc ter,oce,lic,sic ='
      $      ,jadrs(i),nsrf,zt(jadrs(i)),rlon(jadrs(i)),rlat(jadrs(i))
      $      ,pctsrf(jadrs(i),nsrf)
@@ -119,5 +124,6 @@
            ok = .FALSE.
            DO i = 1, jbad
-            PRINT *,'i,nsrf,temperature,lon,lat,pourc ter,oce,lic,sic ='
+            WRITE(lunout,*) 
+     $      'i,nsrf,temperature,lon,lat,pourc ter,oce,lic,sic ='
      $      ,jadrs(i),nsrf,zt(jadrs(i)),rlon(jadrs(i)),rlat(jadrs(i))
      $      ,pctsrf(jadrs(i),nsrf)
Index: LMDZ5/branches/testing/libf/phylmd/ini_histrac.h
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/ini_histrac.h	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/ini_histrac.h	(revision 1664)
@@ -2,5 +2,5 @@
 ! $Id $
 !
-  IF (ecrit_tra>0. .AND. config_inca == 'none') THEN
+  IF (ecrit_tra>0.) THEN
 !$OMP MASTER 
      CALL ymds2ju(annee_ref, 1, day_ref, 0.0, zjulian)
@@ -124,4 +124,4 @@
      CALL histend(nid_tra)
 !$OMP END MASTER
-  END IF ! ecrit_tra>0. .AND. config_inca == 'none'
+  END IF ! ecrit_tra>0.
   
Index: LMDZ5/branches/testing/libf/phylmd/init_phys_lmdz.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/init_phys_lmdz.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/init_phys_lmdz.F90	(revision 1664)
@@ -6,4 +6,9 @@
   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
   
@@ -19,4 +24,12 @@
 !$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
  
Index: LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_mpi_data.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_mpi_data.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_mpi_data.F90	(revision 1664)
@@ -167,35 +167,35 @@
   SUBROUTINE print_module_data
   IMPLICIT NONE
-  
-  
-    PRINT *, 'ii_begin =', ii_begin
-    PRINT *, 'ii_end =', ii_end
-    PRINT *, 'jj_begin =',jj_begin
-    PRINT *, 'jj_end =', jj_end
-    PRINT *, 'jj_nb =', jj_nb
-    PRINT *, 'ij_begin =', ij_begin
-    PRINT *, 'ij_end =', ij_end
-    PRINT *, 'ij_nb =', ij_nb
-    PRINT *, 'klon_mpi_begin =', klon_mpi_begin
-    PRINT *, 'klon_mpi_end =', klon_mpi_end
-    PRINT *, 'klon_mpi =', klon_mpi
-    PRINT *, 'jj_para_nb =', jj_para_nb
-    PRINT *, 'jj_para_begin =', jj_para_begin
-    PRINT *, 'jj_para_end =', jj_para_end
-    PRINT *, 'ii_para_begin =', ii_para_begin
-    PRINT *, 'ii_para_end =', ii_para_end
-    PRINT *, 'ij_para_nb =', ij_para_nb
-    PRINT *, 'ij_para_begin =', ij_para_begin
-    PRINT *, 'ij_para_end =', ij_para_end
-    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 *, 'is_mpi_root =', is_mpi_root
-    PRINT *, 'is_north_pole =', is_north_pole
-    PRINT *, 'is_south_pole =', is_south_pole
-    PRINT *, 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
+  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
Index: LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_omp_data.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_omp_data.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_omp_data.F90	(revision 1664)
@@ -91,16 +91,17 @@
   SUBROUTINE Print_module_data
   IMPLICIT NONE
+  INCLUDE "iniprint.h"
 
 !$OMP CRITICAL  
-  PRINT *,'--------> TASK ',omp_rank
-  PRINT *,'omp_size =',omp_size
-  PRINT *,'omp_rank =',omp_rank
-  PRINT *,'is_omp_root =',is_omp_root
-  PRINT *,'klon_omp_para_nb =',klon_omp_para_nb
-  PRINT *,'klon_omp_para_begin =',klon_omp_para_begin
-  PRINT *,'klon_omp_para_end =',klon_omp_para_end    
-  PRINT *,'klon_omp =',klon_omp
-  PRINT *,'klon_omp_begin =',klon_omp_begin
-  PRINT *,'klon_omp_end =',klon_omp_end    
+  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
 
Index: LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_para.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_para.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_para.F90	(revision 1664)
@@ -47,5 +47,6 @@
   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)
@@ -80,5 +81,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      PRINT *, "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
@@ -92,5 +93,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      PRINT *, "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
@@ -102,5 +103,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
-      PRINT *, "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
Index: LMDZ5/branches/testing/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/pbl_surface_mod.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/pbl_surface_mod.F90	(revision 1664)
@@ -385,5 +385,5 @@
     REAL, DIMENSION(klon)              :: yts, yrugos, ypct, yz0_new
     REAL, DIMENSION(klon)              :: yalb, yalb1, yalb2
-    REAL, DIMENSION(klon)              :: yu1, yv1
+    REAL, DIMENSION(klon)              :: yu1, yv1,ytoto
     REAL, DIMENSION(klon)              :: ysnow, yqsurf, yagesno, yqsol
     REAL, DIMENSION(klon)              :: yrain_f, ysnow_f
@@ -439,4 +439,5 @@
     LOGICAL, PARAMETER                 :: zxli=.FALSE. ! utiliser un jeu de fonctions simples
     LOGICAL, PARAMETER                 :: check=.FALSE.
+    REAL, DIMENSION(klon)              :: Kech_h       ! Coefficient d'echange pour l'energie
 
 ! For debugging with IOIPSL
@@ -900,4 +901,11 @@
           y_flux_q1(:) =  flat/RLVTT
           yfluxlat(:) =  flat
+
+          Kech_h(:) = ycdragh(:) * (1.0+SQRT(yu(:,1)**2+yv(:,1)**2)) * &
+               ypplay(:,1)/(RD*yt(:,1))
+          ytoto(:)=(1./RCPD)*(AcoefH(:)+BcoefH(:)*y_flux_t1(:)*dtime)
+          ytsurf_new(:)=ytoto(:)-y_flux_t1(:)/(Kech_h(:)*RCPD)
+          y_d_ts(:) = ytsurf_new(:) - yts(:) 
+
        ELSE
           y_flux_t1(:) =  yfluxsens(:)
Index: LMDZ5/branches/testing/libf/phylmd/phys_output_mod.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/phys_output_mod.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/phys_output_mod.F90	(revision 1664)
@@ -17,25 +17,25 @@
 
 
-   integer, parameter                           :: nfiles = 6
-   logical, dimension(nfiles), save             :: clef_files
-   logical, dimension(nfiles), save             :: clef_stations
-   integer, dimension(nfiles), save             :: lev_files
-   integer, dimension(nfiles), save             :: nid_files
-   integer, dimension(nfiles), save  :: nnid_files
+  integer, parameter                           :: nfiles = 6
+  logical, dimension(nfiles), save             :: clef_files
+  logical, dimension(nfiles), save             :: clef_stations
+  integer, dimension(nfiles), save             :: lev_files
+  integer, dimension(nfiles), save             :: nid_files
+  integer, dimension(nfiles), save  :: nnid_files
 !!$OMP THREADPRIVATE(clef_files, clef_stations, lev_files,nid_files,nnid_files)
-   integer, dimension(nfiles), private, save :: nnhorim
- 
-   integer, dimension(nfiles), private, save :: nhorim, nvertm
-   integer, dimension(nfiles), private, save :: nvertap, nvertbp, nvertAlt
-!   integer, dimension(nfiles), private, save :: nvertp0
-   real, dimension(nfiles), private, save                :: zoutm
-   real,                    private, save                :: zdtime
-   CHARACTER(len=20), dimension(nfiles), private, save   :: type_ecri
-!$OMP THREADPRIVATE(nhorim, nvertm, zoutm,zdtime,type_ecri)
-
-!   integer, save                     :: nid_hf3d 
+  integer, dimension(nfiles), private, save :: nnhorim
+
+  integer, dimension(nfiles), private, save :: nhorim, nvertm
+  integer, dimension(nfiles), private, save :: nvertap, nvertbp, nvertAlt
+  !   integer, dimension(nfiles), private, save :: nvertp0
+  real, dimension(nfiles), private, save                :: zoutm
+  real,                    private, save                :: zdtime
+  CHARACTER(len=20), dimension(nfiles), private, save   :: type_ecri
+  !$OMP THREADPRIVATE(nhorim, nvertm, zoutm,zdtime,type_ecri)
+
+  !   integer, save                     :: nid_hf3d 
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition pour chaque variable du niveau d ecriture dans chaque fichier
+  !! Definition pour chaque variable du niveau d ecriture dans chaque fichier
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!/ histmth, histday, histhf, histins /),'!!!!!!!!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -45,6 +45,6 @@
 
   TYPE ctrl_out
-   integer,dimension(6) :: flag
-   character(len=20)     :: name
+     integer,dimension(6) :: flag
+     character(len=20)     :: name
   END TYPE ctrl_out
 
@@ -61,5 +61,5 @@
   type(ctrl_out),save :: o_contfracOR   = ctrl_out((/ 10, 1,  1, 10, 10, 10 /),'contfracOR')
   type(ctrl_out),save :: o_aireTER      = ctrl_out((/ 10, 10, 1, 10, 10, 10 /),'aireTER')
-  
+
 !!! 2D
   type(ctrl_out),save :: o_flat         = ctrl_out((/ 5, 1, 10, 10, 5, 10 /),'flat')
@@ -70,7 +70,7 @@
   type(ctrl_out),save :: o_t2m_max      = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'t2m_max')
   type(ctrl_out),save,dimension(4) :: o_t2m_srf      = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_ter'), &
-                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_lic'), &
-                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_oce'), &
-                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_sic') /)
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_lic'), &
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_oce'), &
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_sic') /)
 
   type(ctrl_out),save :: o_wind10m      = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'wind10m')
@@ -84,12 +84,12 @@
 
   type(ctrl_out),save,dimension(4) :: o_u10m_srf     = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_ter'), &
-                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_lic'), &
-                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_oce'), &
-                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_sic') /)
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_lic'), &
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_oce'), &
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_v10m_srf     = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_ter'), &
-                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_lic'), &
-                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_oce'), &
-                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_sic') /)
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_lic'), &
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_oce'), &
+       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_sic') /)
 
   type(ctrl_out),save :: o_qsol         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'qsol')
@@ -103,7 +103,7 @@
   type(ctrl_out),save :: o_evap         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'evap')
   type(ctrl_out),save,dimension(4) :: o_evap_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_ter'), &
-                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_lic'), &
-                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_oce'), &
-                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_sic') /)
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_lic'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_oce'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_sic') /)
   type(ctrl_out),save :: o_msnow       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'msnow')
   type(ctrl_out),save :: o_fsnow       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsnow')
@@ -124,9 +124,9 @@
   type(ctrl_out),save :: o_SWdn200clr   = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'SWdn200clr')
 
-! arajouter
-!  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOA')
-!  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOAclr')
-!  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOA')
-!  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOAclr')
+  ! arajouter
+  !  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOA')
+  !  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOAclr')
+  !  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOA')
+  !  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOAclr')
 
   type(ctrl_out),save :: o_LWup200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWup200')
@@ -157,58 +157,58 @@
   type(ctrl_out),save :: o_tauy         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'tauy')
   type(ctrl_out),save,dimension(4) :: o_taux_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_ter'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_lic'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_oce'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_sic') /)
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_lic'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_oce'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_tauy_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_ter'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_lic'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_oce'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_sic') /)
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_lic'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_oce'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_sic') /)
 
 
   type(ctrl_out),save,dimension(4) :: o_pourc_srf    = (/ ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_ter'), &
-                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_lic'), &
-                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_oce'), &
-                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_sic') /)     
+       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_lic'), &
+       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_oce'), &
+       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_sic') /)     
 
   type(ctrl_out),save,dimension(4) :: o_fract_srf    = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_ter'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_lic'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_oce'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_sic') /)
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_lic'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_oce'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_tsol_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_ter'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_lic'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_oce'), &
-                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_sic') /)
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_lic'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_oce'), &
+       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_sens_srf     = (/ ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_ter'), &
-                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_lic'), &
-                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_oce'), &
-                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_sic') /)
+       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_lic'), &
+       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_oce'), &
+       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_lat_srf      = (/ ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_ter'), &
-                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_lic'), &
-                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_oce'), &
-                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_sic') /)
+       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_lic'), &
+       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_oce'), &
+       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_flw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_ter'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_lic'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_oce'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_sic') /)
-                                                 
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_lic'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_oce'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_sic') /)
+
   type(ctrl_out),save,dimension(4) :: o_fsw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_ter'), &
-                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_lic'), &
-                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_oce'), &
-                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_sic') /)
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_lic'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_oce'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_wbils_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_ter'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_lic'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_oce'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_sic') /)
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_lic'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_oce'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_wbilo_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_ter'), &
-                                                     ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_lic'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_oce'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_sic') /)
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_lic'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_oce'), &
+       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_sic') /)
 
 
@@ -226,5 +226,5 @@
   type(ctrl_out),save :: o_uq           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'uq')
   type(ctrl_out),save :: o_vq           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'vq')
- 
+
   type(ctrl_out),save :: o_cape         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'cape')
   type(ctrl_out),save :: o_pbase        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'pbase')
@@ -240,11 +240,11 @@
   type(ctrl_out),save :: o_s_lcl        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_lcl')
   type(ctrl_out),save :: o_s_therm      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_therm')
-!IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
-! type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_capCL')
-! type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_oliqCL')
-! type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_cteiCL')
-! type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb1')
-! type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb2')
-! type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb3')
+  !IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
+  ! type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_capCL')
+  ! type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_oliqCL')
+  ! type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_cteiCL')
+  ! type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb1')
+  ! type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb2')
+  ! type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb3')
 
   type(ctrl_out),save :: o_slab_bils    = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'slab_bils_oce')
@@ -261,54 +261,54 @@
 
 
-! Champs interpolles sur des niveaux de pression ??? a faire correctement
-                                              
+  ! Champs interpolles sur des niveaux de pression ??? a faire correctement
+
   type(ctrl_out),save,dimension(7) :: o_uSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u850'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u700'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u500'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u200'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u100'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u50'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u10') /) 
-                                                     
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u700'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u500'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u200'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u100'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u50'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u10') /) 
+
 
   type(ctrl_out),save,dimension(7) :: o_vSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v850'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v700'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v500'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v200'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v100'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v50'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v10') /)
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v700'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v500'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v200'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v100'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v50'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v10') /)
 
   type(ctrl_out),save,dimension(7) :: o_wSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w850'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w700'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w500'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w200'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w100'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w50'), & 
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w10') /)
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w700'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w500'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w200'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w100'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w50'), & 
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w10') /)
 
   type(ctrl_out),save,dimension(7) :: o_tSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t850'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t700'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t500'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t200'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t100'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t50'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t10') /)
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t700'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t500'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t200'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t100'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t50'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t10') /)
 
   type(ctrl_out),save,dimension(7) :: o_qSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q850'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q700'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q500'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q200'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q100'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q50'), & 
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q10') /)
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q700'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q500'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q200'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q100'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q50'), & 
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q10') /)
 
   type(ctrl_out),save,dimension(7) :: o_zSTDlevs   = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z850'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z700'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z500'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z200'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z100'), &
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z50'), & 
-                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z10') /)
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z700'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z500'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z200'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z100'), &
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z50'), & 
+       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z10') /)
 
 
@@ -318,12 +318,12 @@
   type(ctrl_out),save :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'dthmin')
   type(ctrl_out),save,dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_sic') /)
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_lic'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_oce'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_sic') /)
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_lic'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_oce'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_sic') /)
 
   type(ctrl_out),save :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'cldtau')                     
@@ -339,12 +339,12 @@
 
   type(ctrl_out),save,dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_sic') /)
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_lic'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_oce'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_sic') /)
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_lic'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_oce'), &
+       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_sic') /)
 
   type(ctrl_out),save :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'kz')
@@ -370,13 +370,13 @@
 
   type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASBCM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASPOMM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSO4M'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSO4M'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_SSSSM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSSM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSSM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CIDUSTM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIBCM'), &
-                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIPOMM') /)
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASPOMM'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSO4M'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSO4M'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_SSSSM'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSSM'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSSM'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CIDUSTM'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIBCM'), &
+       ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIPOMM') /)
 
   type(ctrl_out),save :: o_od550aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od550aer')
@@ -465,17 +465,17 @@
 
   type(ctrl_out),save,dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_ter'), &
-                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_lic'), &
-                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_oce'), &
-                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_sic') /) 
+       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_lic'), &
+       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_oce'), &
+       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_sic') /) 
 
   type(ctrl_out),save,dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_ter'), &
-                                                     ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_lic'), &
-                                                     ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_oce'), &
-                                                     ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_sic') /)
+       ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_lic'), &
+       ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_oce'), &
+       ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_sic') /)
 
   type(ctrl_out),save,dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_ter'), &
-                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_lic'), &
-                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_oce'), &
-                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_sic') /)
+       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_lic'), &
+       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_oce'), &
+       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_sic') /)
 
   type(ctrl_out),save :: o_alb1         = ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'alb1')
@@ -602,11 +602,11 @@
 
 
-    CONTAINS
+CONTAINS
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!! Ouverture des fichier et definition des variable de sortie !!!!!!!!
-!! histbeg, histvert et histdef
+  !! histbeg, histvert et histdef
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
-  
+
   SUBROUTINE phys_output_open(rlon,rlat,pim,tabij,ipt,jpt,plon,plat, &
        jjmp1,nlevSTD,clevSTD,nbteta, &
@@ -617,18 +617,19 @@
        new_aod, aerosol_couple)   
 
-  USE iophy 
-  USE dimphy
-  USE infotrac
-  USE ioipsl
-  USE mod_phys_lmdz_para
-  USE aero_mod, only : naero_spc,name_aero
-
-  IMPLICIT NONE
-  include "dimensions.h"
-  include "temps.h"
-  include "indicesol.h"
-  include "clesphys.h"
-  include "thermcell.h"
-  include "comvert.h"
+    USE iophy 
+    USE dimphy
+    USE infotrac
+    USE ioipsl
+    USE mod_phys_lmdz_para
+    USE aero_mod, only : naero_spc,name_aero
+
+    IMPLICIT NONE
+    include "dimensions.h"
+    include "temps.h"
+    include "indicesol.h"
+    include "clesphys.h"
+    include "thermcell.h"
+    include "comvert.h"
+    include "iniprint.h"
 
     real,dimension(klon),intent(in) :: rlon
@@ -640,1151 +641,1156 @@
     REAL,dimension(pim,2) :: plat_bounds, plon_bounds
 
-  integer                               :: jjmp1
-  integer                               :: nbteta, nlevSTD, radpas
-  logical                               :: ok_mensuel, ok_journe, ok_hf, ok_instan
-  logical                               :: ok_LES,ok_ade,ok_aie
-  logical                               :: new_aod, aerosol_couple
-  integer, intent(in)::  read_climoz ! read ozone climatology
-  !     Allowed values are 0, 1 and 2
-  !     0: do not read an ozone climatology
-  !     1: read a single ozone climatology that will be used day and night
-  !     2: read two ozone climatologies, the average day and night
-  !     climatology and the daylight climatology
-
-  real                                  :: dtime
-  integer                               :: idayref
-  real                                  :: zjulian
-  real, dimension(klev)                 :: Ahyb, Bhyb, Alt
-  character(len=4), dimension(nlevSTD)  :: clevSTD
-  integer                               :: nsrf, k, iq, iiq, iff, i, j, ilev
-  integer                               :: naero
-  logical                               :: ok_veget
-  integer                               :: iflag_pbl
-  CHARACTER(len=4)                      :: bb2
-  CHARACTER(len=2)                      :: bb3
-  character(len=6)                      :: type_ocean
-  CHARACTER(len=3)                      :: ctetaSTD(nbteta)
-  real, dimension(nfiles)               :: ecrit_files
-  CHARACTER(len=20), dimension(nfiles)  :: phys_out_filenames
-  INTEGER, dimension(iim*jjmp1)         ::  ndex2d
-  INTEGER, dimension(iim*jjmp1*klev)    :: ndex3d
-  integer                               :: imin_ins, imax_ins
-  integer                               :: jmin_ins, jmax_ins
-  integer, dimension(nfiles)            :: phys_out_levmin, phys_out_levmax
-  integer, dimension(nfiles)            :: phys_out_filelevels
-  CHARACTER(len=20), dimension(nfiles)  :: type_ecri_files, phys_out_filetypes
-  character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq', 'DefFreq' /)
-  logical, dimension(nfiles)            :: phys_out_filekeys
-  logical, dimension(nfiles)            :: phys_out_filestations
+    integer                               :: jjmp1
+    integer                               :: nbteta, nlevSTD, radpas
+    logical                               :: ok_mensuel, ok_journe, ok_hf, ok_instan
+    logical                               :: ok_LES,ok_ade,ok_aie
+    logical                               :: new_aod, aerosol_couple
+    integer, intent(in)::  read_climoz ! read ozone climatology
+    !     Allowed values are 0, 1 and 2
+    !     0: do not read an ozone climatology
+    !     1: read a single ozone climatology that will be used day and night
+    !     2: read two ozone climatologies, the average day and night
+    !     climatology and the daylight climatology
+
+    real                                  :: dtime
+    integer                               :: idayref
+    real                                  :: zjulian
+    real, dimension(klev)                 :: Ahyb, Bhyb, Alt
+    character(len=4), dimension(nlevSTD)  :: clevSTD
+    integer                               :: nsrf, k, iq, iiq, iff, i, j, ilev
+    integer                               :: naero
+    logical                               :: ok_veget
+    integer                               :: iflag_pbl
+    CHARACTER(len=4)                      :: bb2
+    CHARACTER(len=2)                      :: bb3
+    character(len=6)                      :: type_ocean
+    CHARACTER(len=3)                      :: ctetaSTD(nbteta)
+    real, dimension(nfiles)               :: ecrit_files
+    CHARACTER(len=20), dimension(nfiles)  :: phys_out_filenames
+    INTEGER, dimension(iim*jjmp1)         ::  ndex2d
+    INTEGER, dimension(iim*jjmp1*klev)    :: ndex3d
+    integer                               :: imin_ins, imax_ins
+    integer                               :: jmin_ins, jmax_ins
+    integer, dimension(nfiles)            :: phys_out_levmin, phys_out_levmax
+    integer, dimension(nfiles)            :: phys_out_filelevels
+    CHARACTER(len=20), dimension(nfiles)  :: type_ecri_files, phys_out_filetypes
+    character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq', 'DefFreq' /)
+    logical, dimension(nfiles)            :: phys_out_filekeys
+    logical, dimension(nfiles)            :: phys_out_filestations
 
 !!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
-
-  logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false., .false. /)
-  real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., -180. /)
-  real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180., 180. /)
-  real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90., -90. /)
-  real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90., 90. /)
-
-   print*,'Debut phys_output_mod.F90'
-! Initialisations (Valeurs par defaut
-
-   if (.not. allocated(o_trac)) ALLOCATE(o_trac(nqtot))
-
-   levmax = (/ klev, klev, klev, klev, klev, klev /)
-
-   phys_out_filenames(1) = 'histmth'
-   phys_out_filenames(2) = 'histday'
-   phys_out_filenames(3) = 'histhf'
-   phys_out_filenames(4) = 'histins'
-   phys_out_filenames(5) = 'histLES'
-   phys_out_filenames(6) = 'histstn'
-
-   type_ecri(1) = 'ave(X)'
-   type_ecri(2) = 'ave(X)'
-   type_ecri(3) = 'ave(X)'
-   type_ecri(4) = 'inst(X)'
-   type_ecri(5) = 'ave(X)'
-   type_ecri(6) = 'inst(X)'
-
-   clef_files(1) = ok_mensuel
-   clef_files(2) = ok_journe
-   clef_files(3) = ok_hf
-   clef_files(4) = ok_instan
-   clef_files(5) = ok_LES
-   clef_files(6) = ok_instan
-
-!sortir des fichiers "stations" si clef_stations(:)=.TRUE.
-   clef_stations(1) = .FALSE.
-   clef_stations(2) = .FALSE.
-   clef_stations(3) = .FALSE.
-   clef_stations(4) = .FALSE.
-   clef_stations(5) = .FALSE.
-   clef_stations(6) = .FALSE.
-
-   lev_files(1) = lev_histmth
-   lev_files(2) = lev_histday
-   lev_files(3) = lev_histhf
-   lev_files(4) = lev_histins
-   lev_files(5) = lev_histLES
-   lev_files(6) = lev_histins
-
-   ecrit_files(1) = ecrit_mth
-   ecrit_files(2) = ecrit_day
-   ecrit_files(3) = ecrit_hf
-   ecrit_files(4) = ecrit_ins
-   ecrit_files(5) = ecrit_LES
-   ecrit_files(6) = ecrit_ins
- 
-!! Lectures des parametres de sorties dans physiq.def
-
-   call getin('phys_out_regfkey',phys_out_regfkey)
-   call getin('phys_out_lonmin',phys_out_lonmin)
-   call getin('phys_out_lonmax',phys_out_lonmax)
-   call getin('phys_out_latmin',phys_out_latmin)
-   call getin('phys_out_latmax',phys_out_latmax)
-     phys_out_levmin(:)=levmin(:)
-   call getin('phys_out_levmin',levmin)
-     phys_out_levmax(:)=levmax(:)
-   call getin('phys_out_levmax',levmax)
-   call getin('phys_out_filenames',phys_out_filenames)
-     phys_out_filekeys(:)=clef_files(:)
-   call getin('phys_out_filekeys',clef_files)
-     phys_out_filestations(:)=clef_stations(:)
-   call getin('phys_out_filestations',clef_stations)
-     phys_out_filelevels(:)=lev_files(:)
-   call getin('phys_out_filelevels',lev_files)
-   call getin('phys_out_filetimesteps',chtimestep)
-     phys_out_filetypes(:)=type_ecri(:)
-   call getin('phys_out_filetypes',type_ecri)
-
-   type_ecri_files(:)=type_ecri(:)
-
-   print*,'phys_out_lonmin=',phys_out_lonmin
-   print*,'phys_out_lonmax=',phys_out_lonmax
-   print*,'phys_out_latmin=',phys_out_latmin
-   print*,'phys_out_latmax=',phys_out_latmax
-   print*,'phys_out_filenames=',phys_out_filenames
-   print*,'phys_out_filetypes=',type_ecri
-   print*,'phys_out_filekeys=',clef_files
-   print*,'phys_out_filestations=',clef_stations
-   print*,'phys_out_filelevels=',lev_files
+    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
+
+    logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false., .false. /)
+    real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., -180. /)
+    real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180., 180. /)
+    real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90., -90. /)
+    real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90., 90. /)
+
+    write(lunout,*) 'Debut phys_output_mod.F90'
+    ! Initialisations (Valeurs par defaut
+
+    if (.not. allocated(o_trac)) ALLOCATE(o_trac(nqtot))
+
+    levmax = (/ klev, klev, klev, klev, klev, klev /)
+
+    phys_out_filenames(1) = 'histmth'
+    phys_out_filenames(2) = 'histday'
+    phys_out_filenames(3) = 'histhf'
+    phys_out_filenames(4) = 'histins'
+    phys_out_filenames(5) = 'histLES'
+    phys_out_filenames(6) = 'histstn'
+
+    type_ecri(1) = 'ave(X)'
+    type_ecri(2) = 'ave(X)'
+    type_ecri(3) = 'ave(X)'
+    type_ecri(4) = 'inst(X)'
+    type_ecri(5) = 'ave(X)'
+    type_ecri(6) = 'inst(X)'
+
+    clef_files(1) = ok_mensuel
+    clef_files(2) = ok_journe
+    clef_files(3) = ok_hf
+    clef_files(4) = ok_instan
+    clef_files(5) = ok_LES
+    clef_files(6) = ok_instan
+
+    !sortir des fichiers "stations" si clef_stations(:)=.TRUE.
+    clef_stations(1) = .FALSE.
+    clef_stations(2) = .FALSE.
+    clef_stations(3) = .FALSE.
+    clef_stations(4) = .FALSE.
+    clef_stations(5) = .FALSE.
+    clef_stations(6) = .FALSE.
+
+    lev_files(1) = lev_histmth
+    lev_files(2) = lev_histday
+    lev_files(3) = lev_histhf
+    lev_files(4) = lev_histins
+    lev_files(5) = lev_histLES
+    lev_files(6) = lev_histins
+
+    ecrit_files(1) = ecrit_mth
+    ecrit_files(2) = ecrit_day
+    ecrit_files(3) = ecrit_hf
+    ecrit_files(4) = ecrit_ins
+    ecrit_files(5) = ecrit_LES
+    ecrit_files(6) = ecrit_ins
+
+    !! Lectures des parametres de sorties dans physiq.def
+
+    call getin('phys_out_regfkey',phys_out_regfkey)
+    call getin('phys_out_lonmin',phys_out_lonmin)
+    call getin('phys_out_lonmax',phys_out_lonmax)
+    call getin('phys_out_latmin',phys_out_latmin)
+    call getin('phys_out_latmax',phys_out_latmax)
+    phys_out_levmin(:)=levmin(:)
+    call getin('phys_out_levmin',levmin)
+    phys_out_levmax(:)=levmax(:)
+    call getin('phys_out_levmax',levmax)
+    call getin('phys_out_filenames',phys_out_filenames)
+    phys_out_filekeys(:)=clef_files(:)
+    call getin('phys_out_filekeys',clef_files)
+    phys_out_filestations(:)=clef_stations(:)
+    call getin('phys_out_filestations',clef_stations)
+    phys_out_filelevels(:)=lev_files(:)
+    call getin('phys_out_filelevels',lev_files)
+    call getin('phys_out_filetimesteps',chtimestep)
+    phys_out_filetypes(:)=type_ecri(:)
+    call getin('phys_out_filetypes',type_ecri)
+
+    type_ecri_files(:)=type_ecri(:)
+
+    write(lunout,*)'phys_out_lonmin=',phys_out_lonmin
+    write(lunout,*)'phys_out_lonmax=',phys_out_lonmax
+    write(lunout,*)'phys_out_latmin=',phys_out_latmin
+    write(lunout,*)'phys_out_latmax=',phys_out_latmax
+    write(lunout,*)'phys_out_filenames=',phys_out_filenames
+    write(lunout,*)'phys_out_filetypes=',type_ecri
+    write(lunout,*)'phys_out_filekeys=',clef_files
+    write(lunout,*)'phys_out_filestations=',clef_stations
+    write(lunout,*)'phys_out_filelevels=',lev_files
 
 !!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
-! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
+    ! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
+    ! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
- zdtime = dtime         ! Frequence ou l on moyenne
-
-! Calcul des Ahyb, Bhyb et Alt
-         do k=1,klev
-          Ahyb(k)=(ap(k)+ap(k+1))/2.
-          Bhyb(k)=(bp(k)+bp(k+1))/2.
-          Alt(k)=log(preff/presnivs(k))*8.
-         enddo
-!          if(prt_level.ge.1) then
-           print*,'Ap Hybrid = ',Ahyb(1:klev)
-           print*,'Bp Hybrid = ',Bhyb(1:klev)
-           print*,'Alt approx des couches pour une haut d echelle de 8km = ',Alt(1:klev)
-!          endif
- DO iff=1,nfiles
-
-    IF (clef_files(iff)) THEN
-
-      if ( chtimestep(iff).eq.'DefFreq' ) then
-! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf ...)*86400.
-        ecrit_files(iff)=ecrit_files(iff)*86400.
-      else
-        call convers_timesteps(chtimestep(iff),dtime,ecrit_files(iff)) 
-      endif
-       print*,'ecrit_files(',iff,')= ',ecrit_files(iff)
-
-      zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
-
-      idayref = day_ref
-      CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
+    zdtime = dtime         ! Frequence ou l on moyenne
+
+    ! Calcul des Ahyb, Bhyb et Alt
+    do k=1,klev
+       Ahyb(k)=(ap(k)+ap(k+1))/2.
+       Bhyb(k)=(bp(k)+bp(k+1))/2.
+       Alt(k)=log(preff/presnivs(k))*8.
+    enddo
+    !          if(prt_level.ge.1) then
+    write(lunout,*)'Ap Hybrid = ',Ahyb(1:klev)
+    write(lunout,*)'Bp Hybrid = ',Bhyb(1:klev)
+    write(lunout,*)'Alt approx des couches pour une haut d echelle de 8km = ',Alt(1:klev)
+    !          endif
+    DO iff=1,nfiles
+
+       IF (clef_files(iff)) THEN
+
+          if ( chtimestep(iff).eq.'DefFreq' ) then
+             ! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf ...)*86400.
+             ecrit_files(iff)=ecrit_files(iff)*86400.
+          else
+             call convers_timesteps(chtimestep(iff),dtime,ecrit_files(iff)) 
+          endif
+          write(lunout,*)'ecrit_files(',iff,')= ',ecrit_files(iff)
+
+          zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
+
+          idayref = day_ref
+          CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
 
 !!!!!!!!!!!!!!!!! Traitement dans le cas ou l'on veut stocker sur un domaine limite !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-     if (phys_out_regfkey(iff)) then
-
-        imin_ins=1
-        imax_ins=iim
-        jmin_ins=1
-        jmax_ins=jjmp1
-
-! correction abderr        
-        do i=1,iim
-           print*,'io_lon(i)=',io_lon(i)
-           if (io_lon(i).le.phys_out_lonmin(iff)) imin_ins=i
-           if (io_lon(i).le.phys_out_lonmax(iff)) imax_ins=i+1
-        enddo
-
-        do j=1,jjmp1
-            print*,'io_lat(j)=',io_lat(j)
-            if (io_lat(j).ge.phys_out_latmin(iff)) jmax_ins=j+1
-            if (io_lat(j).ge.phys_out_latmax(iff)) jmin_ins=j
-        enddo
-
-        print*,'On stoke le fichier histoire numero ',iff,' sur ', &
-         imin_ins,imax_ins,jmin_ins,jmax_ins
-         print*,'longitudes : ', &
-         io_lon(imin_ins),io_lon(imax_ins), &
-         'latitudes : ', &
-         io_lat(jmax_ins),io_lat(jmin_ins)
-
- CALL histbeg(phys_out_filenames(iff),iim,io_lon,jjmp1,io_lat, &
-              imin_ins,imax_ins-imin_ins+1, &
-              jmin_ins,jmax_ins-jmin_ins+1, &
-              itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
+          if (phys_out_regfkey(iff)) then
+
+             imin_ins=1
+             imax_ins=iim
+             jmin_ins=1
+             jmax_ins=jjmp1
+
+             ! correction abderr        
+             do i=1,iim
+                write(lunout,*)'io_lon(i)=',io_lon(i)
+                if (io_lon(i).le.phys_out_lonmin(iff)) imin_ins=i
+                if (io_lon(i).le.phys_out_lonmax(iff)) imax_ins=i+1
+             enddo
+
+             do j=1,jjmp1
+                write(lunout,*)'io_lat(j)=',io_lat(j)
+                if (io_lat(j).ge.phys_out_latmin(iff)) jmax_ins=j+1
+                if (io_lat(j).ge.phys_out_latmax(iff)) jmin_ins=j
+             enddo
+
+             write(lunout,*)'On stoke le fichier histoire numero ',iff,' sur ', &
+                  imin_ins,imax_ins,jmin_ins,jmax_ins
+             write(lunout,*)'longitudes : ', &
+                  io_lon(imin_ins),io_lon(imax_ins), &
+                  'latitudes : ', &
+                  io_lat(jmax_ins),io_lat(jmin_ins)
+
+             CALL histbeg(phys_out_filenames(iff),iim,io_lon,jjmp1,io_lat, &
+                  imin_ins,imax_ins-imin_ins+1, &
+                  jmin_ins,jmax_ins-jmin_ins+1, &
+                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!IM fichiers stations
-     else if (clef_stations(iff)) THEN
-
-     print*,'phys_output_mod phys_out_filenames=',phys_out_filenames(iff)
-
-      call histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
-                           phys_out_filenames(iff), &
-                           itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
-       else
- CALL histbeg_phy(phys_out_filenames(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
-       endif
- 
-      CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", &
-           levmax(iff) - levmin(iff) + 1, &
-           presnivs(levmin(iff):levmax(iff)), nvertm(iff),"down")
+             !IM fichiers stations
+          else if (clef_stations(iff)) THEN
+
+             write(lunout,*)'phys_output_mod phys_out_filenames=',phys_out_filenames(iff)
+
+             call histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
+                  phys_out_filenames(iff), &
+                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
+          else
+             CALL histbeg_phy(phys_out_filenames(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
+          endif
+
+          CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", &
+               levmax(iff) - levmin(iff) + 1, &
+               presnivs(levmin(iff):levmax(iff)), nvertm(iff),"down")
 
 !!!!!!!!!!!!! Traitement des champs 3D pour histhf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!!!!!!!! A Revoir plus tard !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!          IF (iff.eq.3.and.lev_files(iff).ge.4) THEN
-!          CALL histbeg_phy("histhf3d",itau_phy, &
-!     &                     zjulian, dtime, &
-!     &                     nhorim, nid_hf3d)
-
-!         CALL histvert(nid_hf3d, "presnivs", &
-!     &                 "Vertical levels", "mb", &
-!     &                 klev, presnivs/100., nvertm)
-!          ENDIF
-!
+          !          IF (iff.eq.3.and.lev_files(iff).ge.4) THEN
+          !          CALL histbeg_phy("histhf3d",itau_phy, &
+          !     &                     zjulian, dtime, &
+          !     &                     nhorim, nid_hf3d)
+
+          !         CALL histvert(nid_hf3d, "presnivs", &
+          !     &                 "Vertical levels", "mb", &
+          !     &                 klev, presnivs/100., nvertm)
+          !          ENDIF
+          !
 !!!! Composentes de la coordonnee sigma-hybride 
-   CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
-                 levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
-
-   CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", &
-                 levmax(iff) - levmin(iff) + 1,Bhyb,nvertbp(iff))
-
-   CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &
-                 levmax(iff) - levmin(iff) + 1,Alt,nvertAlt(iff))
-
-!   CALL histvert(nid_files(iff), "preff","Reference pressure", "Pa", &
-!                 1,preff,nvertp0(iff))
+          CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
+               levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
+
+          CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", &
+               levmax(iff) - levmin(iff) + 1,Bhyb,nvertbp(iff))
+
+          CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &
+               levmax(iff) - levmin(iff) + 1,Alt,nvertAlt(iff))
+
+          !   CALL histvert(nid_files(iff), "preff","Reference pressure", "Pa", &
+          !                 1,preff,nvertp0(iff))
 !!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- IF (.NOT.clef_stations(iff)) THEN
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-   type_ecri(1) = 'once'
-   type_ecri(2) = 'once'
-   type_ecri(3) = 'once'
-   type_ecri(4) = 'once'
-   type_ecri(5) = 'once'
-   type_ecri(6) = 'once'
-   CALL histdef2d(iff,clef_stations(iff),o_aire%flag,o_aire%name,"Grid area", "-")
-   CALL histdef2d(iff,clef_stations(iff),o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
- ENDIF
-   type_ecri(:) = type_ecri_files(:)
+          IF (.NOT.clef_stations(iff)) THEN
+             !
+             !IM: there is no way to have one single value in a netcdf file
+             !
+             type_ecri(1) = 'once'
+             type_ecri(2) = 'once'
+             type_ecri(3) = 'once'
+             type_ecri(4) = 'once'
+             type_ecri(5) = 'once'
+             type_ecri(6) = 'once'
+             CALL histdef2d(iff,clef_stations(iff),o_aire%flag,o_aire%name,"Grid area", "-")
+             CALL histdef2d(iff,clef_stations(iff),o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
+          ENDIF
+          type_ecri(:) = type_ecri_files(:)
 
 !!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- CALL histdef2d(iff,clef_stations(iff),o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2" )
- CALL histdef2d(iff,clef_stations(iff),o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
- CALL histdef2d(iff,clef_stations(iff),o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
- CALL histdef2d(iff,clef_stations(iff),o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
- CALL histdef2d(iff,clef_stations(iff),o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
- CALL histdef2d(iff,clef_stations(iff),o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
-  IF (.NOT.clef_stations(iff)) THEN 
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-   type_ecri(1) = 't_min(X)'
-   type_ecri(2) = 't_min(X)'
-   type_ecri(3) = 't_min(X)'
-   type_ecri(4) = 't_min(X)'
-   type_ecri(5) = 't_min(X)' 
-   type_ecri(6) = 't_min(X)' 
-   CALL histdef2d(iff,clef_stations(iff),o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
-   type_ecri(1) = 't_max(X)'
-   type_ecri(2) = 't_max(X)'
-   type_ecri(3) = 't_max(X)'
-   type_ecri(4) = 't_max(X)'
-   type_ecri(5) = 't_max(X)' 
-   type_ecri(6) = 't_max(X)' 
-   CALL histdef2d(iff,clef_stations(iff),o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
-  ENDIF 
-   type_ecri(:) = type_ecri_files(:)
- CALL histdef2d(iff,clef_stations(iff),o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
- CALL histdef2d(iff,clef_stations(iff),o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
- CALL histdef2d(iff,clef_stations(iff),o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
- CALL histdef2d(iff,clef_stations(iff),o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
- CALL histdef2d(iff,clef_stations(iff),o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
- CALL histdef2d(iff,clef_stations(iff),o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
- CALL histdef2d(iff,clef_stations(iff),o_psol%flag,o_psol%name, "Surface Pressure", "Pa" ) 
- CALL histdef2d(iff,clef_stations(iff),o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
-
-  if (.not. ok_veget) then
- CALL histdef2d(iff,clef_stations(iff),o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
-  endif
-
- CALL histdef2d(iff,clef_stations(iff),o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
- CALL histdef2d(iff,clef_stations(iff),o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
- CALL histdef2d(iff,clef_stations(iff),o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)") 
- CALL histdef2d(iff,clef_stations(iff),o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
- CALL histdef2d(iff,clef_stations(iff),o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
- CALL histdef2d(iff,clef_stations(iff),o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
- CALL histdef2d(iff,clef_stations(iff),o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
- CALL histdef2d(iff,clef_stations(iff),o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" ) 
- CALL histdef2d(iff,clef_stations(iff),o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2") 
- CALL histdef2d(iff,clef_stations(iff),o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
- CALL histdef2d(iff,clef_stations(iff),o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2") 
- CALL histdef2d(iff,clef_stations(iff),o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
- CALL histdef2d(iff,clef_stations(iff),o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2") 
- CALL histdef2d(iff,clef_stations(iff),o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" ) 
- CALL histdef2d(iff,clef_stations(iff),o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
- CALL histdef2d(iff,clef_stations(iff),o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2") 
- CALL histdef2d(iff,clef_stations(iff),o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2") 
- CALL histdef2d(iff,clef_stations(iff),o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2")  
- CALL histdef2d(iff,clef_stations(iff),o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2") 
- CALL histdef2d(iff,clef_stations(iff),o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s") 
- CALL histdef2d(iff,clef_stations(iff),o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s") 
-
- CALL histdef2d(iff,clef_stations(iff),o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
- CALL histdef2d(iff,clef_stations(iff),o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
-
-     DO nsrf = 1, nbsrf
- CALL histdef2d(iff,clef_stations(iff),o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
- CALL histdef2d(iff,clef_stations(iff),o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
- CALL histdef2d(iff,clef_stations(iff), &
-o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
- CALL histdef2d(iff,clef_stations(iff), &
-o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
- CALL histdef2d(iff,clef_stations(iff), &
-o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
- CALL histdef2d(iff,clef_stations(iff), &
-o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
- CALL histdef2d(iff,clef_stations(iff), &
-o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
- CALL histdef2d(iff,clef_stations(iff), &
-o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
- CALL histdef2d(iff,clef_stations(iff), &
-o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
-  if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
- CALL histdef2d(iff,clef_stations(iff), &
-o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
-
-  IF (.NOT.clef_stations(iff)) THEN 
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-   type_ecri(1) = 't_max(X)'
-   type_ecri(2) = 't_max(X)'
-   type_ecri(3) = 't_max(X)'
-   type_ecri(4) = 't_max(X)'
-   type_ecri(5) = 't_max(X)'
-   type_ecri(6) = 't_max(X)'
-  CALL histdef2d(iff,clef_stations(iff), &
-  o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
-   type_ecri(:) = type_ecri_files(:)
-  ENDIF
-
-  endif
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo VIS surf. "//clnsurf(nsrf),"-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Surface roughness "//clnsurf(nsrf),"m")
- CALL histdef2d(iff,clef_stations(iff), &
-o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
-END DO
-
-IF (new_aod .AND. (.NOT. aerosol_couple)) THEN
- IF (ok_ade.OR.ok_aie) THEN
-
-  CALL histdef2d(iff,clef_stations(iff), &
-o_od550aer%flag,o_od550aer%name, "Total aerosol optical depth at 550nm", "-")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_od865aer%flag,o_od865aer%name, "Total aerosol optical depth at 870nm", "-")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_absvisaer%flag,o_absvisaer%name, "Absorption aerosol visible optical depth", "-")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_od550lt1aer%flag,o_od550lt1aer%name, "Fine mode optical depth", "-")
-
-
-  CALL histdef2d(iff,clef_stations(iff), &
-o_sconcso4%flag,o_sconcso4%name,"Surface Concentration of Sulfate ","kg/m3")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_sconcoa%flag,o_sconcoa%name,"Surface Concentration of Organic Aerosol ","kg/m3")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_sconcbc%flag,o_sconcbc%name,"Surface Concentration of Black Carbon ","kg/m3")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_sconcss%flag,o_sconcss%name,"Surface Concentration of Sea Salt ","kg/m3")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_sconcdust%flag,o_sconcdust%name,"Surface Concentration of Dust ","kg/m3")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_concso4%flag,o_concso4%name,"Concentration of Sulfate ","kg/m3")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_concoa%flag,o_concoa%name,"Concentration of Organic Aerosol ","kg/m3")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_concbc%flag,o_concbc%name,"Concentration of Black Carbon ","kg/m3")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_concss%flag,o_concss%name,"Concentration of Sea Salt ","kg/m3")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_concdust%flag,o_concdust%name,"Concentration of Dust ","kg/m3")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_loadso4%flag,o_loadso4%name,"Column Load of Sulfate ","kg/m2")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_loadoa%flag,o_loadoa%name,"Column Load of Organic Aerosol ","kg/m2")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_loadbc%flag,o_loadbc%name,"Column Load of Black Carbon ","kg/m2")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_loadss%flag,o_loadss%name,"Column Load of Sea Salt ","kg/m2")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_loaddust%flag,o_loaddust%name,"Column Load of Dust ","kg/m2")
-
-  DO naero = 1, naero_spc
-  CALL histdef2d(iff,clef_stations(iff), &
-o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
-  END DO
- ENDIF
-ENDIF
-
- IF (ok_ade) THEN
-  CALL histdef2d(iff,clef_stations(iff), &
-o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
-
- IF (.NOT. aerosol_couple) THEN 
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoacf_ant%flag,o_swtoacf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfcf_ant%flag,o_swsrfcf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at SRF", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
- ENDIF
-
- ENDIF
-
- IF (ok_aie) THEN
-  CALL histdef2d(iff,clef_stations(iff), &
-o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
-!Cloud droplet number concentration
-  CALL histdef3d(iff,clef_stations(iff), &
-o_scdnc%flag,o_scdnc%name, "Cloud droplet number concentration","m-3")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_cldncl%flag,o_cldncl%name, "CDNC at top of liquid water cloud", "m-3")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_reffclws%flag,o_reffclws%name, "Stratiform Cloud Droplet Effective Radius (aerosol diags.)","m")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_reffclwc%flag,o_reffclwc%name, "Convective Cloud Droplet Effective Radius (aerosol diags.)","m")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_cldnvi%flag,o_cldnvi%name, "Column Integrated Cloud Droplet Number", "m-2")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_lcc3d%flag,o_lcc3d%name, "Cloud liquid fraction","1")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_lcc3dcon%flag,o_lcc3dcon%name, "Convective cloud liquid fraction","1")
-  CALL histdef3d(iff,clef_stations(iff), &
-o_lcc3dstra%flag,o_lcc3dstra%name, "Stratiform cloud liquid fraction","1")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_lcc%flag,o_lcc%name, "Cloud liquid fraction at top of cloud","1")
-  CALL histdef2d(iff,clef_stations(iff), &
-o_reffclwtop%flag,o_reffclwtop%name, "Droplet effective radius at top of liquid water cloud", "m")
- ENDIF
-
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_alb1%flag,o_alb1%name, "Surface VIS albedo", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_alb2%flag,o_alb2%name, "Surface Near IR albedo", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
- CALL histdef2d(iff,clef_stations(iff), &
-o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
- CALL histdef2d(iff,clef_stations(iff), &
-o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
- CALL histdef2d(iff,clef_stations(iff), &
-o_ue%flag,o_ue%name, "Zonal energy transport", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_ve%flag,o_ve%name, "Merid energy transport", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_vq%flag,o_vq%name, "Merid humidity transport", "-")
-
-     IF(iflag_con.GE.3) THEN ! sb
- CALL histdef2d(iff,clef_stations(iff), &
-o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
- CALL histdef2d(iff,clef_stations(iff), &
-o_pbase%flag,o_pbase%name, "Cld base pressure", "Pa")
- CALL histdef2d(iff,clef_stations(iff), &
-o_ptop%flag,o_ptop%name, "Cld top pressure", "Pa")
- CALL histdef2d(iff,clef_stations(iff), &
-o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_plcl%flag,o_plcl%name, "Lifting Condensation Level", "hPa")
- CALL histdef2d(iff,clef_stations(iff), &
-o_plfc%flag,o_plfc%name, "Level of Free Convection", "hPa")
- CALL histdef2d(iff,clef_stations(iff), &
-o_wbeff%flag,o_wbeff%name, "Conv. updraft velocity at LFC", "m/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
-  IF (.NOT.clef_stations(iff)) THEN 
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-    type_ecri(1) = 't_max(X)'
-    type_ecri(2) = 't_max(X)'
-    type_ecri(3) = 't_max(X)'
-    type_ecri(4) = 't_max(X)'
-    type_ecri(5) = 't_max(X)'
-    type_ecri(6) = 't_max(X)'
-    CALL histdef2d(iff,clef_stations(iff), &
-  o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
-  ENDIF
-   type_ecri(:) = type_ecri_files(:)
- CALL histdef3d(iff,clef_stations(iff), &
-o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
-   type_ecri(1) = 'inst(X)'
-   type_ecri(2) = 'inst(X)'
-   type_ecri(3) = 'inst(X)'
-   type_ecri(4) = 'inst(X)'
-   type_ecri(5) = 'inst(X)'
-   type_ecri(6) = 'inst(X)'
- CALL histdef2d(iff,clef_stations(iff), &
-o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
-   type_ecri(:) = type_ecri_files(:)
-     ENDIF !iflag_con .GE. 3
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
- CALL histdef2d(iff,clef_stations(iff), &
-o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
- CALL histdef2d(iff,clef_stations(iff), &
-o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
- CALL histdef2d(iff,clef_stations(iff), &
-o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
-!IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
-!CALL histdef2d(iff,clef_stations(iff), &
-!o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
-!CALL histdef2d(iff,clef_stations(iff), &
-!o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
-!CALL histdef2d(iff,clef_stations(iff), &
-!o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
-!CALL histdef2d(iff,clef_stations(iff), &
-!o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
-!CALL histdef2d(iff,clef_stations(iff), &
-!o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
-!CALL histdef2d(iff,clef_stations(iff), &
-!o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
-
-! Champs interpolles sur des niveaux de pression
-
-   type_ecri(1) = 'inst(X)'
-   type_ecri(2) = 'inst(X)'
-   type_ecri(3) = 'inst(X)'
-   type_ecri(4) = 'inst(X)'
-   type_ecri(5) = 'inst(X)'
-   type_ecri(6) = 'inst(X)'
-
-! Attention a reverifier
-
-        ilev=0        
-        DO k=1, nlevSTD
-     bb2=clevSTD(k)
-     IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200" &
-.OR.bb2.EQ."100".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
-      ilev=ilev+1
-!     print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
- CALL histdef2d(iff,clef_stations(iff), &
-o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"hPa", "m/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"hPa", "m/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"hPa", "Pa/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_zSTDlevs(ilev)%flag,o_zSTDlevs(ilev)%name,"Geopotential height "//bb2//"hPa", "m")
- CALL histdef2d(iff,clef_stations(iff), &
-o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"hPa", "kg/kg" )
- CALL histdef2d(iff,clef_stations(iff), &
-o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"hPa", "K")
-     ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
-       ENDDO
-   type_ecri(:) = type_ecri_files(:)
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
-
- IF (type_ocean=='slab') & 
-     CALL histdef2d(iff,clef_stations(iff), &
-o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
-
-! Couplage conv-CL
- IF (iflag_con.GE.3) THEN
-    IF (iflag_coupl>=1) THEN
- CALL histdef2d(iff,clef_stations(iff), &
-o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2") 
- CALL histdef2d(iff,clef_stations(iff), &
-o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2") 
-    ENDIF
- ENDIF !(iflag_con.GE.3)
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
- CALL histdef2d(iff,clef_stations(iff), &
-o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
- CALL histdef2d(iff,clef_stations(iff), &
-o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
-
-  IF (.NOT.clef_stations(iff)) THEN 
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-   type_ecri(1) = 't_min(X)'
-   type_ecri(2) = 't_min(X)'
-   type_ecri(3) = 't_min(X)'
-   type_ecri(4) = 't_min(X)'
-   type_ecri(5) = 't_min(X)'
-   type_ecri(6) = 't_min(X)'
-   CALL histdef2d(iff,clef_stations(iff),o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
-   type_ecri(1) = 't_max(X)'
-   type_ecri(2) = 't_max(X)'
-   type_ecri(3) = 't_max(X)'
-   type_ecri(4) = 't_max(X)'
-   type_ecri(5) = 't_max(X)'
-   type_ecri(6) = 't_max(X)'
-   CALL histdef2d(iff,clef_stations(iff),o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
-  ENDIF  
-
-   type_ecri(:) = type_ecri_files(:)
- CALL histdef2d(iff,clef_stations(iff),o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
- CALL histdef2d(iff,clef_stations(iff),o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
- CALL histdef2d(iff,clef_stations(iff), &
-o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
- CALL histdef2d(iff,clef_stations(iff),o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
-
- CALL histdef2d(iff,clef_stations(iff),o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,clef_stations(iff),o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_rugs%flag,o_rugs%name, "rugosity", "-" )
-
-! Champs 3D:
- CALL histdef3d(iff,clef_stations(iff),o_ec550aer%flag,o_ec550aer%name, "Extinction at 550nm", "m^-1")
- CALL histdef3d(iff,clef_stations(iff),o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
- CALL histdef3d(iff,clef_stations(iff),o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
- CALL histdef3d(iff,clef_stations(iff),o_temp%flag,o_temp%name, "Air temperature", "K" )
- CALL histdef3d(iff,clef_stations(iff),o_theta%flag,o_theta%name, "Potential air temperature", "K" )
- CALL histdef3d(iff,clef_stations(iff),o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_ovapinit%flag,o_ovapinit%name, "Specific humidity (begin of timestep)", "kg/kg" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_pres%flag,o_pres%name, "Air pressure", "Pa" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_mass%flag,o_mass%name, "Masse Couches", "kg/m2" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_zfull%flag,o_zfull%name, "Altitude of full pressure levels", "m" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_zhalf%flag,o_zhalf%name, "Altitude of half pressure levels", "m" )
- CALL histdef3d(iff,clef_stations(iff), &
-o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rhum%flag,o_rhum%name, "Relative humidity", "-")
- CALL histdef3d(iff,clef_stations(iff), &
-o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
- if (read_climoz == 2) &
-      CALL histdef3d(iff,clef_stations(iff), &
-o_ozone_light%flag,o_ozone_light%name, &
-      "Daylight ozone mole fraction", "-")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
- CALL histdef3d(iff,clef_stations(iff), &
-o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
-!IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
- CALL histdef3d(iff,clef_stations(iff), &
-o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
- CALL histdef3d(iff,clef_stations(iff), &
-o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
- CALL histdef3d(iff,clef_stations(iff), &
-o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
- CALL histdef3d(iff,clef_stations(iff), &
-o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
-!Cloud droplet effective radius
- CALL histdef3d(iff,clef_stations(iff), &
-o_re%flag,o_re%name, "Cloud droplet effective radius","um")
- CALL histdef3d(iff,clef_stations(iff), &
-o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
-!FH Sorties pour la couche limite
-     if (iflag_pbl>1) then
- CALL histdef3d(iff,clef_stations(iff), &
-o_tke%flag,o_tke%name, "TKE", "m2/s2")
-  IF (.NOT.clef_stations(iff)) THEN 
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-   type_ecri(1) = 't_max(X)'
-   type_ecri(2) = 't_max(X)'
-   type_ecri(3) = 't_max(X)'
-   type_ecri(4) = 't_max(X)'
-   type_ecri(5) = 't_max(X)'
-   type_ecri(6) = 't_max(X)'
-   CALL histdef3d(iff,clef_stations(iff), &
-  o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
-  ENDIF 
-   type_ecri(:) = type_ecri_files(:)
-     endif
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_kz%flag,o_kz%name, "Kz melange", "m2/s")
-  IF (.NOT.clef_stations(iff)) THEN 
-!
-!IM: there is no way to have one single value in a netcdf file
-!
-   type_ecri(1) = 't_max(X)'
-   type_ecri(2) = 't_max(X)'
-   type_ecri(3) = 't_max(X)'
-   type_ecri(4) = 't_max(X)'
-   type_ecri(5) = 't_max(X)'
-   type_ecri(6) = 't_max(X)'
-   CALL histdef3d(iff,clef_stations(iff), &
-   o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
-  ENDIF
-   type_ecri(:) = type_ecri_files(:)
- CALL histdef3d(iff,clef_stations(iff), &
-o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg") 
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
-
-! Wakes
- IF(iflag_con.EQ.3) THEN
- IF (iflag_wake >= 1) THEN
-   CALL histdef2d(iff,clef_stations(iff), &
-o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
-   CALL histdef2d(iff,clef_stations(iff), &
-o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
-   CALL histdef2d(iff,clef_stations(iff), &
-o_ale%flag,o_ale%name, "ALE", "m2/s2")
-   CALL histdef2d(iff,clef_stations(iff), &
-o_alp%flag,o_alp%name, "ALP", "W/m2")
-   CALL histdef2d(iff,clef_stations(iff),o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
-   CALL histdef2d(iff,clef_stations(iff),o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
-   CALL histdef2d(iff,clef_stations(iff),o_wake_h%flag,o_wake_h%name, "wake_h", "-")
-   CALL histdef2d(iff,clef_stations(iff),o_wake_s%flag,o_wake_s%name, "wake_s", "-")
-   CALL histdef3d(iff,clef_stations(iff),o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
-   CALL histdef3d(iff,clef_stations(iff),o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
-   CALL histdef3d(iff,clef_stations(iff),o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
-   CALL histdef3d(iff,clef_stations(iff),o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
-   CALL histdef3d(iff,clef_stations(iff),o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
- ENDIF
-   CALL histdef3d(iff,clef_stations(iff),o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
-   CALL histdef3d(iff,clef_stations(iff),o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
-   CALL histdef3d(iff,clef_stations(iff),o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
- ENDIF !(iflag_con.EQ.3)
-
- CALL histdef3d(iff,clef_stations(iff),o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff),o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
- CALL histdef3d(iff,clef_stations(iff),o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff),o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff),o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s") 
- CALL histdef3d(iff,clef_stations(iff),o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff),o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff),o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
- CALL histdef3d(iff,clef_stations(iff),o_ratqs%flag,o_ratqs%name, "RATQS", " ")
- CALL histdef3d(iff,clef_stations(iff),o_dtthe%flag,o_dtthe%name, "Thermal dT", "K/s")
-
-if(iflag_thermals.gt.1) THEN
- CALL histdef3d(iff,clef_stations(iff),o_dqlscth%flag,o_dqlscth%name, "dQ therm.", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff),o_dqlscst%flag,o_dqlscst%name, "dQ strat.", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff),o_dtlscth%flag,o_dtlscth%name, "dQ therm.", "K/s")
- CALL histdef3d(iff,clef_stations(iff),o_dtlscst%flag,o_dtlscst%name, "dQ strat.", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_plulth%flag,o_plulth%name, "Rainfall therm.", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_plulst%flag,o_plulst%name, "Rainfall strat.", "K/s")
- CALL histdef2d(iff,clef_stations(iff),o_lmaxth%flag,o_lmaxth%name, "Upper level thermals", "")
- CALL histdef3d(iff,clef_stations(iff),o_ptconvth%flag,o_ptconvth%name, "POINTS CONVECTIFS therm.", " ")
- CALL histdef3d(iff,clef_stations(iff),o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "kg/(m2*s)")
- CALL histdef3d(iff,clef_stations(iff),o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
- CALL histdef3d(iff,clef_stations(iff),o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
- CALL histdef3d(iff,clef_stations(iff), &
-o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
- CALL histdef3d(iff,clef_stations(iff), &
-o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
- CALL histdef3d(iff,clef_stations(iff), &
-o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
-
- CALL histdef2d(iff,clef_stations(iff), &
-o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
- CALL histdef2d(iff,clef_stations(iff), &
-o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dqthe%flag,o_dqthe%name, "Thermal dQ", "(kg/kg)/s")
-endif !iflag_thermals.gt.1
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
- CALL histdef3d(iff,clef_stations(iff), &
-o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
-
-     IF (ok_orodr) THEN
- CALL histdef3d(iff,clef_stations(iff), &
-o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtoro%flag,o_dtoro%name, "Orography dT", "K/s")
-     ENDIF
-
-     IF (ok_orolf) THEN
- CALL histdef3d(iff,clef_stations(iff), &
-o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dtlif%flag,o_dtlif%name, "Orography dT", "K/s")
-     ENDIF
-
-     IF (ok_hines) then
- CALL histdef3d(iff,clef_stations(iff), &
-o_duhin%flag,o_duhin%name, "Hines GWD dU", "m/s2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_dvhin%flag,o_dvhin%name, "Hines GWD dV", "m/s2")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_dthin%flag,o_dthin%name, "Hines GWD dT", "K/s")
-     ENDIF
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_rsu%flag,o_rsu%name, "SW upward radiation", "W m-2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rsd%flag,o_rsd%name, "SW downward radiation", "W m-2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rlu%flag,o_rlu%name, "LW upward radiation", "W m-2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rld%flag,o_rld%name, "LW downward radiation", "W m-2")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_rsucs%flag,o_rsucs%name, "SW CS upward radiation", "W m-2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rsdcs%flag,o_rsdcs%name, "SW CS downward radiation", "W m-2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rlucs%flag,o_rlucs%name, "LW CS upward radiation", "W m-2")
- CALL histdef3d(iff,clef_stations(iff), &
-o_rldcs%flag,o_rldcs%name, "LW CS downward radiation", "W m-2")
- 
- CALL histdef3d(iff,clef_stations(iff), &
-o_tnt%flag,o_tnt%name, "Tendency of air temperature", "K s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_tntc%flag,o_tntc%name, "Tendency of air temperature due to Moist Convection", &
-"K s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_tntr%flag,o_tntr%name, "Air temperature tendency due to Radiative heating", &
-"K s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_tntscpbl%flag,o_tntscpbl%name, "Air temperature tendency due to St cloud and precipitation and BL mixing", &
-"K s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_tnhus%flag,o_tnhus%name, "Tendency of specific humidity", "s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_tnhusc%flag,o_tnhusc%name, "Tendency of specific humidity due to convection", "s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_tnhusscpbl%flag,o_tnhusscpbl%name, "Tendency of Specific humidity due to ST cl, precip and BL mixing", &
-"s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_evu%flag,o_evu%name, "Eddy viscosity coefficient for Momentum Variables", "m2 s-1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_h2o%flag,o_h2o%name, "Mass Fraction of Water", "1")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_mcd%flag,o_mcd%name, "Downdraft COnvective Mass Flux", "kg/(m2*s)")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_dmc%flag,o_dmc%name, "Deep COnvective Mass Flux", "kg/(m2*s)")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_ref_liq%flag,o_ref_liq%name, "Effective radius of convective cloud liquid water particle", "m")
-
- CALL histdef3d(iff,clef_stations(iff), &
-o_ref_ice%flag,o_ref_ice%name, "Effective radius of startiform cloud ice particle", "m")
-
-   if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR. &
-    RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR. &
-    RCFC12_per.NE.RCFC12_act) THEN
-
- CALL histdef2d(iff,clef_stations(iff),o_rsut4co2%flag,o_rsut4co2%name, &
- "TOA Out SW in 4xCO2 atmosphere", "W/m2") 
-CALL histdef2d(iff,clef_stations(iff),o_rlut4co2%flag,o_rlut4co2%name, &
-"TOA Out LW in 4xCO2 atmosphere", "W/m2") 
-CALL histdef2d(iff,clef_stations(iff),o_rsutcs4co2%flag,o_rsutcs4co2%name, &
-"TOA Out CS SW in 4xCO2 atmosphere", "W/m2") 
-CALL histdef2d(iff,clef_stations(iff),o_rlutcs4co2%flag,o_rlutcs4co2%name, &
-"TOA Out CS LW in 4xCO2 atmosphere", "W/m2") 
-
-CALL histdef3d(iff,clef_stations(iff),o_rsu4co2%flag,o_rsu4co2%name, &
-"Upwelling SW 4xCO2 atmosphere", "W/m2") 
-CALL histdef3d(iff,clef_stations(iff),o_rlu4co2%flag,o_rlu4co2%name, &
-"Upwelling LW 4xCO2 atmosphere", "W/m2") 
-CALL histdef3d(iff,clef_stations(iff),o_rsucs4co2%flag,o_rsucs4co2%name, &
-"Upwelling CS SW 4xCO2 atmosphere", "W/m2") 
-CALL histdef3d(iff,clef_stations(iff),o_rlucs4co2%flag,o_rlucs4co2%name, &
-"Upwelling CS LW 4xCO2 atmosphere", "W/m2") 
-
- CALL histdef3d(iff,clef_stations(iff),o_rsd4co2%flag,o_rsd4co2%name, &
- "Downwelling SW 4xCO2 atmosphere", "W/m2") 
- CALL histdef3d(iff,clef_stations(iff),o_rld4co2%flag,o_rld4co2%name, &
-"Downwelling LW 4xCO2 atmosphere", "W/m2") 
- CALL histdef3d(iff,clef_stations(iff),o_rsdcs4co2%flag,o_rsdcs4co2%name, &
-"Downwelling CS SW 4xCO2 atmosphere", "W/m2") 
- CALL histdef3d(iff,clef_stations(iff),o_rldcs4co2%flag,o_rldcs4co2%name, &
-"Downwelling CS LW 4xCO2 atmosphere", "W/m2") 
-
-   endif
-
-
-    IF (nqtot>=3) THEN
-     DO iq=3,nqtot  
-       iiq=niadv(iq)
-       o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq))
-       CALL histdef3d (iff,clef_stations(iff), &
- o_trac(iq-2)%flag,o_trac(iq-2)%name,'Tracer '//ttext(iiq), "-" )
-     ENDDO
-    ENDIF
-
-        CALL histend(nid_files(iff))
-
-         ndex2d = 0
-         ndex3d = 0
-
-         ENDIF ! clef_files
-
-         ENDDO !  iff
-     print*,'Fin phys_output_mod.F90'
-      end subroutine phys_output_open
-
-      SUBROUTINE histdef2d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
-      
-       use ioipsl
-       USE dimphy
-       USE mod_phys_lmdz_para
-       USE iophy
-
-       IMPLICIT NONE
-       
-       include "dimensions.h"
-       include "temps.h"
-       include "indicesol.h"
-       include "clesphys.h"
-
-       integer                          :: iff
-       logical                          :: lpoint
-       integer, dimension(nfiles)       :: flag_var
-       character(len=20)                 :: nomvar
-       character(len=*)                 :: titrevar
-       character(len=*)                 :: unitvar
-
-       real zstophym
-
-       if (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') then
-         zstophym=zoutm(iff)
-       else
-         zstophym=zdtime
-       endif
-
-! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
-       call conf_physoutputs(nomvar,flag_var)
-      
-       if(.NOT.lpoint) THEN  
+          CALL histdef2d(iff,clef_stations(iff),o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2" )
+          CALL histdef2d(iff,clef_stations(iff),o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
+          CALL histdef2d(iff,clef_stations(iff),o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
+          CALL histdef2d(iff,clef_stations(iff),o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
+          CALL histdef2d(iff,clef_stations(iff),o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
+          CALL histdef2d(iff,clef_stations(iff),o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
+          IF (.NOT.clef_stations(iff)) THEN 
+             !
+             !IM: there is no way to have one single value in a netcdf file
+             !
+             type_ecri(1) = 't_min(X)'
+             type_ecri(2) = 't_min(X)'
+             type_ecri(3) = 't_min(X)'
+             type_ecri(4) = 't_min(X)'
+             type_ecri(5) = 't_min(X)' 
+             type_ecri(6) = 't_min(X)' 
+             CALL histdef2d(iff,clef_stations(iff),o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
+             type_ecri(1) = 't_max(X)'
+             type_ecri(2) = 't_max(X)'
+             type_ecri(3) = 't_max(X)'
+             type_ecri(4) = 't_max(X)'
+             type_ecri(5) = 't_max(X)' 
+             type_ecri(6) = 't_max(X)' 
+             CALL histdef2d(iff,clef_stations(iff),o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
+          ENDIF
+          type_ecri(:) = type_ecri_files(:)
+          CALL histdef2d(iff,clef_stations(iff),o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
+          CALL histdef2d(iff,clef_stations(iff),o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
+          CALL histdef2d(iff,clef_stations(iff),o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
+          CALL histdef2d(iff,clef_stations(iff),o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
+          CALL histdef2d(iff,clef_stations(iff),o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
+          CALL histdef2d(iff,clef_stations(iff),o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
+          CALL histdef2d(iff,clef_stations(iff),o_psol%flag,o_psol%name, "Surface Pressure", "Pa" ) 
+          CALL histdef2d(iff,clef_stations(iff),o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
+
+          if (.not. ok_veget) then
+             CALL histdef2d(iff,clef_stations(iff),o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
+          endif
+
+          CALL histdef2d(iff,clef_stations(iff),o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
+          CALL histdef2d(iff,clef_stations(iff),o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
+          CALL histdef2d(iff,clef_stations(iff),o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)") 
+          CALL histdef2d(iff,clef_stations(iff),o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
+          CALL histdef2d(iff,clef_stations(iff),o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
+          CALL histdef2d(iff,clef_stations(iff),o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
+          CALL histdef2d(iff,clef_stations(iff),o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
+          CALL histdef2d(iff,clef_stations(iff),o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" ) 
+          CALL histdef2d(iff,clef_stations(iff),o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2") 
+          CALL histdef2d(iff,clef_stations(iff),o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
+          CALL histdef2d(iff,clef_stations(iff),o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2") 
+          CALL histdef2d(iff,clef_stations(iff),o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
+          CALL histdef2d(iff,clef_stations(iff),o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2") 
+          CALL histdef2d(iff,clef_stations(iff),o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" ) 
+          CALL histdef2d(iff,clef_stations(iff),o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
+          CALL histdef2d(iff,clef_stations(iff),o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2") 
+          CALL histdef2d(iff,clef_stations(iff),o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2") 
+          CALL histdef2d(iff,clef_stations(iff),o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2")  
+          CALL histdef2d(iff,clef_stations(iff),o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2") 
+          CALL histdef2d(iff,clef_stations(iff),o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s") 
+          CALL histdef2d(iff,clef_stations(iff),o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s") 
+
+          CALL histdef2d(iff,clef_stations(iff),o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
+          CALL histdef2d(iff,clef_stations(iff),o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
+
+          DO nsrf = 1, nbsrf
+             CALL histdef2d(iff,clef_stations(iff),o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
+             CALL histdef2d(iff,clef_stations(iff),o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
+             if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+
+                IF (.NOT.clef_stations(iff)) THEN 
+                   !
+                   !IM: there is no way to have one single value in a netcdf file
+                   !
+                   type_ecri(1) = 't_max(X)'
+                   type_ecri(2) = 't_max(X)'
+                   type_ecri(3) = 't_max(X)'
+                   type_ecri(4) = 't_max(X)'
+                   type_ecri(5) = 't_max(X)'
+                   type_ecri(6) = 't_max(X)'
+                   CALL histdef2d(iff,clef_stations(iff), &
+                        o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+                   type_ecri(:) = type_ecri_files(:)
+                ENDIF
+
+             endif
+
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo VIS surf. "//clnsurf(nsrf),"-")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Surface roughness "//clnsurf(nsrf),"m")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
+          END DO
+
+          IF (new_aod .AND. (.NOT. aerosol_couple)) THEN
+             IF (ok_ade.OR.ok_aie) THEN
+
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_od550aer%flag,o_od550aer%name, "Total aerosol optical depth at 550nm", "-")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_od865aer%flag,o_od865aer%name, "Total aerosol optical depth at 870nm", "-")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_absvisaer%flag,o_absvisaer%name, "Absorption aerosol visible optical depth", "-")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_od550lt1aer%flag,o_od550lt1aer%name, "Fine mode optical depth", "-")
+
+
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_sconcso4%flag,o_sconcso4%name,"Surface Concentration of Sulfate ","kg/m3")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_sconcoa%flag,o_sconcoa%name,"Surface Concentration of Organic Aerosol ","kg/m3")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_sconcbc%flag,o_sconcbc%name,"Surface Concentration of Black Carbon ","kg/m3")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_sconcss%flag,o_sconcss%name,"Surface Concentration of Sea Salt ","kg/m3")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_sconcdust%flag,o_sconcdust%name,"Surface Concentration of Dust ","kg/m3")
+                CALL histdef3d(iff,clef_stations(iff), &
+                     o_concso4%flag,o_concso4%name,"Concentration of Sulfate ","kg/m3")
+                CALL histdef3d(iff,clef_stations(iff), &
+                     o_concoa%flag,o_concoa%name,"Concentration of Organic Aerosol ","kg/m3")
+                CALL histdef3d(iff,clef_stations(iff), &
+                     o_concbc%flag,o_concbc%name,"Concentration of Black Carbon ","kg/m3")
+                CALL histdef3d(iff,clef_stations(iff), &
+                     o_concss%flag,o_concss%name,"Concentration of Sea Salt ","kg/m3")
+                CALL histdef3d(iff,clef_stations(iff), &
+                     o_concdust%flag,o_concdust%name,"Concentration of Dust ","kg/m3")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_loadso4%flag,o_loadso4%name,"Column Load of Sulfate ","kg/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_loadoa%flag,o_loadoa%name,"Column Load of Organic Aerosol ","kg/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_loadbc%flag,o_loadbc%name,"Column Load of Black Carbon ","kg/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_loadss%flag,o_loadss%name,"Column Load of Sea Salt ","kg/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_loaddust%flag,o_loaddust%name,"Column Load of Dust ","kg/m2")
+
+                DO naero = 1, naero_spc
+                   CALL histdef2d(iff,clef_stations(iff), &
+                        o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
+                END DO
+             ENDIF
+          ENDIF
+
+          IF (ok_ade) THEN
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
+
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
+
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
+
+             IF (.NOT. aerosol_couple) THEN 
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
+                CALL histdef2d(iff, clef_stations(iff), o_swtoacf_ant%flag, &
+                     o_swtoacf_ant%name, &
+                     "Anthropogenic aerosol impact on cloud radiative forcing at TOA", &
+                     "W/m2")
+                CALL histdef2d(iff, clef_stations(iff), o_swsrfcf_ant%flag, &
+                     o_swsrfcf_ant%name, &
+                     "Anthropogenic aerosol impact on cloud radiative forcing at SRF", &
+                     "W/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
+             ENDIF
+          ENDIF
+
+          IF (ok_aie) THEN
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
+             !Cloud droplet number concentration
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_scdnc%flag,o_scdnc%name, "Cloud droplet number concentration","m-3")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_cldncl%flag,o_cldncl%name, "CDNC at top of liquid water cloud", "m-3")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_reffclws%flag,o_reffclws%name, "Stratiform Cloud Droplet Effective Radius (aerosol diags.)","m")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_reffclwc%flag,o_reffclwc%name, "Convective Cloud Droplet Effective Radius (aerosol diags.)","m")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_cldnvi%flag,o_cldnvi%name, "Column Integrated Cloud Droplet Number", "m-2")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_lcc3d%flag,o_lcc3d%name, "Cloud liquid fraction","1")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_lcc3dcon%flag,o_lcc3dcon%name, "Convective cloud liquid fraction","1")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_lcc3dstra%flag,o_lcc3dstra%name, "Stratiform cloud liquid fraction","1")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_lcc%flag,o_lcc%name, "Cloud liquid fraction at top of cloud","1")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_reffclwtop%flag,o_reffclwtop%name, "Droplet effective radius at top of liquid water cloud", "m")
+          ENDIF
+
+
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_alb1%flag,o_alb1%name, "Surface VIS albedo", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_alb2%flag,o_alb2%name, "Surface Near IR albedo", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_ue%flag,o_ue%name, "Zonal energy transport", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_ve%flag,o_ve%name, "Merid energy transport", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_vq%flag,o_vq%name, "Merid humidity transport", "-")
+
+          IF(iflag_con.GE.3) THEN ! sb
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_pbase%flag,o_pbase%name, "Cld base pressure", "Pa")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_ptop%flag,o_ptop%name, "Cld top pressure", "Pa")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
+             if (iflag_con /= 30) then
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_plcl%flag,o_plcl%name, "Lifting Condensation Level", "hPa")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_plfc%flag,o_plfc%name, "Level of Free Convection", "hPa")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_wbeff%flag,o_wbeff%name, "Conv. updraft velocity at LFC (<100)", "m/s")
+             end if
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
+             IF (.NOT.clef_stations(iff)) THEN 
+                !
+                !IM: there is no way to have one single value in a netcdf file
+                !
+                type_ecri(1) = 't_max(X)'
+                type_ecri(2) = 't_max(X)'
+                type_ecri(3) = 't_max(X)'
+                type_ecri(4) = 't_max(X)'
+                type_ecri(5) = 't_max(X)'
+                type_ecri(6) = 't_max(X)'
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
+             ENDIF
+             type_ecri(:) = type_ecri_files(:)
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
+             type_ecri(1) = 'inst(X)'
+             type_ecri(2) = 'inst(X)'
+             type_ecri(3) = 'inst(X)'
+             type_ecri(4) = 'inst(X)'
+             type_ecri(5) = 'inst(X)'
+             type_ecri(6) = 'inst(X)'
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
+             type_ecri(:) = type_ecri_files(:)
+          ENDIF !iflag_con .GE. 3
+
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
+          !IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
+          !CALL histdef2d(iff,clef_stations(iff), &
+          !o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
+          !CALL histdef2d(iff,clef_stations(iff), &
+          !o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
+          !CALL histdef2d(iff,clef_stations(iff), &
+          !o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
+          !CALL histdef2d(iff,clef_stations(iff), &
+          !o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
+          !CALL histdef2d(iff,clef_stations(iff), &
+          !o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
+          !CALL histdef2d(iff,clef_stations(iff), &
+          !o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
+
+          ! Champs interpolles sur des niveaux de pression
+
+          type_ecri(1) = 'inst(X)'
+          type_ecri(2) = 'inst(X)'
+          type_ecri(3) = 'inst(X)'
+          type_ecri(4) = 'inst(X)'
+          type_ecri(5) = 'inst(X)'
+          type_ecri(6) = 'inst(X)'
+
+          ! Attention a reverifier
+
+          ilev=0        
+          DO k=1, nlevSTD
+             bb2=clevSTD(k)
+             IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200" &
+                  .OR.bb2.EQ."100".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
+                ilev=ilev+1
+                !     print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"hPa", "m/s")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"hPa", "m/s")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"hPa", "Pa/s")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_zSTDlevs(ilev)%flag,o_zSTDlevs(ilev)%name,"Geopotential height "//bb2//"hPa", "m")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"hPa", "kg/kg" )
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"hPa", "K")
+             ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
+          ENDDO
+          type_ecri(:) = type_ecri_files(:)
+
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
+
+          IF (type_ocean=='slab') & 
+               CALL histdef2d(iff,clef_stations(iff), &
+               o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
+
+          ! Couplage conv-CL
+          IF (iflag_con.GE.3) THEN
+             IF (iflag_coupl>=1) THEN
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2") 
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2") 
+             ENDIF
+          ENDIF !(iflag_con.GE.3)
+
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
+
+          IF (.NOT.clef_stations(iff)) THEN 
+             !
+             !IM: there is no way to have one single value in a netcdf file
+             !
+             type_ecri(1) = 't_min(X)'
+             type_ecri(2) = 't_min(X)'
+             type_ecri(3) = 't_min(X)'
+             type_ecri(4) = 't_min(X)'
+             type_ecri(5) = 't_min(X)'
+             type_ecri(6) = 't_min(X)'
+             CALL histdef2d(iff,clef_stations(iff),o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
+             type_ecri(1) = 't_max(X)'
+             type_ecri(2) = 't_max(X)'
+             type_ecri(3) = 't_max(X)'
+             type_ecri(4) = 't_max(X)'
+             type_ecri(5) = 't_max(X)'
+             type_ecri(6) = 't_max(X)'
+             CALL histdef2d(iff,clef_stations(iff),o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
+          ENDIF
+
+          type_ecri(:) = type_ecri_files(:)
+          CALL histdef2d(iff,clef_stations(iff),o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
+          CALL histdef2d(iff,clef_stations(iff),o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
+          CALL histdef2d(iff,clef_stations(iff), &
+               o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
+          CALL histdef2d(iff,clef_stations(iff),o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
+
+          CALL histdef2d(iff,clef_stations(iff),o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
+          CALL histdef2d(iff,clef_stations(iff),o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
+          CALL histdef2d(iff,clef_stations(iff),o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
+          CALL histdef2d(iff,clef_stations(iff),o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
+          CALL histdef2d(iff,clef_stations(iff),o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
+          CALL histdef2d(iff,clef_stations(iff),o_rugs%flag,o_rugs%name, "rugosity", "-" )
+
+          ! Champs 3D:
+          CALL histdef3d(iff,clef_stations(iff),o_ec550aer%flag,o_ec550aer%name, "Extinction at 550nm", "m^-1")
+          CALL histdef3d(iff,clef_stations(iff),o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
+          CALL histdef3d(iff,clef_stations(iff),o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
+          CALL histdef3d(iff,clef_stations(iff),o_temp%flag,o_temp%name, "Air temperature", "K" )
+          CALL histdef3d(iff,clef_stations(iff),o_theta%flag,o_theta%name, "Potential air temperature", "K" )
+          CALL histdef3d(iff,clef_stations(iff),o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_ovapinit%flag,o_ovapinit%name, "Specific humidity (begin of timestep)", "kg/kg" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_pres%flag,o_pres%name, "Air pressure", "Pa" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_mass%flag,o_mass%name, "Masse Couches", "kg/m2" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_zfull%flag,o_zfull%name, "Altitude of full pressure levels", "m" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_zhalf%flag,o_zhalf%name, "Altitude of half pressure levels", "m" )
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rhum%flag,o_rhum%name, "Relative humidity", "-")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
+          if (read_climoz == 2) &
+               CALL histdef3d(iff,clef_stations(iff), &
+               o_ozone_light%flag,o_ozone_light%name, &
+               "Daylight ozone mole fraction", "-")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
+          !IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
+          !Cloud droplet effective radius
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_re%flag,o_re%name, "Cloud droplet effective radius","um")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
+          !FH Sorties pour la couche limite
+          if (iflag_pbl>1) then
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_tke%flag,o_tke%name, "TKE", "m2/s2")
+             IF (.NOT.clef_stations(iff)) THEN 
+                !
+                !IM: there is no way to have one single value in a netcdf file
+                !
+                type_ecri(1) = 't_max(X)'
+                type_ecri(2) = 't_max(X)'
+                type_ecri(3) = 't_max(X)'
+                type_ecri(4) = 't_max(X)'
+                type_ecri(5) = 't_max(X)'
+                type_ecri(6) = 't_max(X)'
+                CALL histdef3d(iff,clef_stations(iff), &
+                     o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
+             ENDIF
+             type_ecri(:) = type_ecri_files(:)
+          endif
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_kz%flag,o_kz%name, "Kz melange", "m2/s")
+          IF (.NOT.clef_stations(iff)) THEN 
+             !
+             !IM: there is no way to have one single value in a netcdf file
+             !
+             type_ecri(1) = 't_max(X)'
+             type_ecri(2) = 't_max(X)'
+             type_ecri(3) = 't_max(X)'
+             type_ecri(4) = 't_max(X)'
+             type_ecri(5) = 't_max(X)'
+             type_ecri(6) = 't_max(X)'
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
+          ENDIF
+          type_ecri(:) = type_ecri_files(:)
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg") 
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
+
+          ! Wakes
+          IF(iflag_con.EQ.3) THEN
+             IF (iflag_wake >= 1) THEN
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_ale%flag,o_ale%name, "ALE", "m2/s2")
+                CALL histdef2d(iff,clef_stations(iff), &
+                     o_alp%flag,o_alp%name, "ALP", "W/m2")
+                CALL histdef2d(iff,clef_stations(iff),o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
+                CALL histdef2d(iff,clef_stations(iff),o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
+                CALL histdef2d(iff,clef_stations(iff),o_wake_h%flag,o_wake_h%name, "wake_h", "-")
+                CALL histdef2d(iff,clef_stations(iff),o_wake_s%flag,o_wake_s%name, "wake_s", "-")
+                CALL histdef3d(iff,clef_stations(iff),o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
+                CALL histdef3d(iff,clef_stations(iff),o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
+                CALL histdef3d(iff,clef_stations(iff),o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
+                CALL histdef3d(iff,clef_stations(iff),o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
+                CALL histdef3d(iff,clef_stations(iff),o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
+             ENDIF
+             CALL histdef3d(iff,clef_stations(iff),o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
+             CALL histdef3d(iff,clef_stations(iff),o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
+             CALL histdef3d(iff,clef_stations(iff),o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
+          ENDIF !(iflag_con.EQ.3)
+
+          CALL histdef3d(iff,clef_stations(iff),o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff),o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
+          CALL histdef3d(iff,clef_stations(iff),o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
+          CALL histdef3d(iff,clef_stations(iff),o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff),o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s") 
+          CALL histdef3d(iff,clef_stations(iff),o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff),o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
+          CALL histdef3d(iff,clef_stations(iff),o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
+          CALL histdef3d(iff,clef_stations(iff),o_ratqs%flag,o_ratqs%name, "RATQS", " ")
+          CALL histdef3d(iff,clef_stations(iff),o_dtthe%flag,o_dtthe%name, "Thermal dT", "K/s")
+
+          if(iflag_thermals.gt.1) THEN
+             CALL histdef3d(iff,clef_stations(iff),o_dqlscth%flag,o_dqlscth%name, "dQ therm.", "(kg/kg)/s")
+             CALL histdef3d(iff,clef_stations(iff),o_dqlscst%flag,o_dqlscst%name, "dQ strat.", "(kg/kg)/s")
+             CALL histdef3d(iff,clef_stations(iff),o_dtlscth%flag,o_dtlscth%name, "dQ therm.", "K/s")
+             CALL histdef3d(iff,clef_stations(iff),o_dtlscst%flag,o_dtlscst%name, "dQ strat.", "K/s")
+             CALL histdef2d(iff,clef_stations(iff),o_plulth%flag,o_plulth%name, "Rainfall therm.", "K/s")
+             CALL histdef2d(iff,clef_stations(iff),o_plulst%flag,o_plulst%name, "Rainfall strat.", "K/s")
+             CALL histdef2d(iff,clef_stations(iff),o_lmaxth%flag,o_lmaxth%name, "Upper level thermals", "")
+             CALL histdef3d(iff,clef_stations(iff),o_ptconvth%flag,o_ptconvth%name, "POINTS CONVECTIFS therm.", " ")
+             CALL histdef3d(iff,clef_stations(iff),o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "kg/(m2*s)")
+             CALL histdef3d(iff,clef_stations(iff),o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
+             CALL histdef3d(iff,clef_stations(iff),o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
+
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
+             CALL histdef2d(iff,clef_stations(iff), &
+                  o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dqthe%flag,o_dqthe%name, "Thermal dQ", "(kg/kg)/s")
+          endif !iflag_thermals.gt.1
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
+
+          IF (ok_orodr) THEN
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dtoro%flag,o_dtoro%name, "Orography dT", "K/s")
+          ENDIF
+
+          IF (ok_orolf) THEN
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dtlif%flag,o_dtlif%name, "Orography dT", "K/s")
+          ENDIF
+
+          IF (ok_hines) then
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_duhin%flag,o_duhin%name, "Hines GWD dU", "m/s2")
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dvhin%flag,o_dvhin%name, "Hines GWD dV", "m/s2")
+
+             CALL histdef3d(iff,clef_stations(iff), &
+                  o_dthin%flag,o_dthin%name, "Hines GWD dT", "K/s")
+          ENDIF
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rsu%flag,o_rsu%name, "SW upward radiation", "W m-2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rsd%flag,o_rsd%name, "SW downward radiation", "W m-2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rlu%flag,o_rlu%name, "LW upward radiation", "W m-2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rld%flag,o_rld%name, "LW downward radiation", "W m-2")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rsucs%flag,o_rsucs%name, "SW CS upward radiation", "W m-2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rsdcs%flag,o_rsdcs%name, "SW CS downward radiation", "W m-2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rlucs%flag,o_rlucs%name, "LW CS upward radiation", "W m-2")
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_rldcs%flag,o_rldcs%name, "LW CS downward radiation", "W m-2")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tnt%flag,o_tnt%name, "Tendency of air temperature", "K s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tntc%flag,o_tntc%name, "Tendency of air temperature due to Moist Convection", &
+               "K s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tntr%flag,o_tntr%name, "Air temperature tendency due to Radiative heating", &
+               "K s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tntscpbl%flag,o_tntscpbl%name, "Air temperature tendency due to St cloud and precipitation and BL mixing", &
+               "K s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tnhus%flag,o_tnhus%name, "Tendency of specific humidity", "s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tnhusc%flag,o_tnhusc%name, "Tendency of specific humidity due to convection", "s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_tnhusscpbl%flag,o_tnhusscpbl%name, "Tendency of Specific humidity due to ST cl, precip and BL mixing", &
+               "s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_evu%flag,o_evu%name, "Eddy viscosity coefficient for Momentum Variables", "m2 s-1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_h2o%flag,o_h2o%name, "Mass Fraction of Water", "1")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_mcd%flag,o_mcd%name, "Downdraft COnvective Mass Flux", "kg/(m2*s)")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_dmc%flag,o_dmc%name, "Deep COnvective Mass Flux", "kg/(m2*s)")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_ref_liq%flag,o_ref_liq%name, "Effective radius of convective cloud liquid water particle", "m")
+
+          CALL histdef3d(iff,clef_stations(iff), &
+               o_ref_ice%flag,o_ref_ice%name, "Effective radius of startiform cloud ice particle", "m")
+
+          if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR. &
+               RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR. &
+               RCFC12_per.NE.RCFC12_act) THEN
+
+             CALL histdef2d(iff,clef_stations(iff),o_rsut4co2%flag,o_rsut4co2%name, &
+                  "TOA Out SW in 4xCO2 atmosphere", "W/m2") 
+             CALL histdef2d(iff,clef_stations(iff),o_rlut4co2%flag,o_rlut4co2%name, &
+                  "TOA Out LW in 4xCO2 atmosphere", "W/m2") 
+             CALL histdef2d(iff,clef_stations(iff),o_rsutcs4co2%flag,o_rsutcs4co2%name, &
+                  "TOA Out CS SW in 4xCO2 atmosphere", "W/m2") 
+             CALL histdef2d(iff,clef_stations(iff),o_rlutcs4co2%flag,o_rlutcs4co2%name, &
+                  "TOA Out CS LW in 4xCO2 atmosphere", "W/m2") 
+
+             CALL histdef3d(iff,clef_stations(iff),o_rsu4co2%flag,o_rsu4co2%name, &
+                  "Upwelling SW 4xCO2 atmosphere", "W/m2") 
+             CALL histdef3d(iff,clef_stations(iff),o_rlu4co2%flag,o_rlu4co2%name, &
+                  "Upwelling LW 4xCO2 atmosphere", "W/m2") 
+             CALL histdef3d(iff,clef_stations(iff),o_rsucs4co2%flag,o_rsucs4co2%name, &
+                  "Upwelling CS SW 4xCO2 atmosphere", "W/m2") 
+             CALL histdef3d(iff,clef_stations(iff),o_rlucs4co2%flag,o_rlucs4co2%name, &
+                  "Upwelling CS LW 4xCO2 atmosphere", "W/m2") 
+
+             CALL histdef3d(iff,clef_stations(iff),o_rsd4co2%flag,o_rsd4co2%name, &
+                  "Downwelling SW 4xCO2 atmosphere", "W/m2") 
+             CALL histdef3d(iff,clef_stations(iff),o_rld4co2%flag,o_rld4co2%name, &
+                  "Downwelling LW 4xCO2 atmosphere", "W/m2") 
+             CALL histdef3d(iff,clef_stations(iff),o_rsdcs4co2%flag,o_rsdcs4co2%name, &
+                  "Downwelling CS SW 4xCO2 atmosphere", "W/m2") 
+             CALL histdef3d(iff,clef_stations(iff),o_rldcs4co2%flag,o_rldcs4co2%name, &
+                  "Downwelling CS LW 4xCO2 atmosphere", "W/m2") 
+
+          endif
+
+
+          IF (nqtot>=3) THEN
+             DO iq=3,nqtot  
+                iiq=niadv(iq)
+                o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq))
+                CALL histdef3d (iff,clef_stations(iff), &
+                     o_trac(iq-2)%flag,o_trac(iq-2)%name,'Tracer '//ttext(iiq), "-" )
+             ENDDO
+          ENDIF
+
+          CALL histend(nid_files(iff))
+
+          ndex2d = 0
+          ndex3d = 0
+
+       ENDIF ! clef_files
+
+    ENDDO !  iff
+    write(lunout,*)'Fin phys_output_mod.F90'
+  end subroutine phys_output_open
+
+  SUBROUTINE histdef2d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
+
+    use ioipsl
+    USE dimphy
+    USE mod_phys_lmdz_para
+    USE iophy
+
+    IMPLICIT NONE
+
+    include "dimensions.h"
+    include "temps.h"
+    include "indicesol.h"
+    include "clesphys.h"
+
+    integer                          :: iff
+    logical                          :: lpoint
+    integer, dimension(nfiles)       :: flag_var
+    character(len=20)                 :: nomvar
+    character(len=*)                 :: titrevar
+    character(len=*)                 :: unitvar
+
+    real zstophym
+
+    if (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') then
+       zstophym=zoutm(iff)
+    else
+       zstophym=zdtime
+    endif
+
+    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
+    call conf_physoutputs(nomvar,flag_var)
+
+    if(.NOT.lpoint) THEN  
        if ( flag_var(iff)<=lev_files(iff) ) then
- call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
+          call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
                iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
                type_ecri(iff), zstophym,zoutm(iff))                
-       endif                      
-       else
+       endif
+    else
        if ( flag_var(iff)<=lev_files(iff) ) then
- call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
+          call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
                npstn,1,nhorim(iff), 1,1,1, -99, 32, &
                type_ecri(iff), zstophym,zoutm(iff))                
-       endif                      
-       endif                      
-      end subroutine histdef2d
-
-      SUBROUTINE histdef3d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
-
-       use ioipsl
-       USE dimphy
-       USE mod_phys_lmdz_para
-       USE iophy
-
-       IMPLICIT NONE
-
-       include "dimensions.h"
-       include "temps.h"
-       include "indicesol.h"
-       include "clesphys.h"
-
-       integer                          :: iff
-       logical                          :: lpoint
-       integer, dimension(nfiles)       :: flag_var
-       character(len=20)                 :: nomvar
-       character(len=*)                 :: titrevar
-       character(len=*)                 :: unitvar
-
-       real zstophym
-
-! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
-       call conf_physoutputs(nomvar,flag_var)
-
-       if (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') then
-         zstophym=zoutm(iff)
-       else
-         zstophym=zdtime
        endif
-
-       if(.NOT.lpoint) THEN
+    endif
+  end subroutine histdef2d
+
+  SUBROUTINE histdef3d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
+
+    use ioipsl
+    USE dimphy
+    USE mod_phys_lmdz_para
+    USE iophy
+
+    IMPLICIT NONE
+
+    include "dimensions.h"
+    include "temps.h"
+    include "indicesol.h"
+    include "clesphys.h"
+
+    integer                          :: iff
+    logical                          :: lpoint
+    integer, dimension(nfiles)       :: flag_var
+    character(len=20)                 :: nomvar
+    character(len=*)                 :: titrevar
+    character(len=*)                 :: unitvar
+
+    real zstophym
+
+    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
+    call conf_physoutputs(nomvar,flag_var)
+
+    if (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') then
+       zstophym=zoutm(iff)
+    else
+       zstophym=zdtime
+    endif
+
+    if(.NOT.lpoint) THEN
        if ( flag_var(iff)<=lev_files(iff) ) then
           call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
@@ -1793,5 +1799,5 @@
                zstophym, zoutm(iff))
        endif
-       else
+    else
        if ( flag_var(iff)<=lev_files(iff) ) then
           call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
@@ -1800,69 +1806,70 @@
                type_ecri(iff), zstophym,zoutm(iff))
        endif
-       endif
-      end subroutine histdef3d
-
-      SUBROUTINE conf_physoutputs(nam_var,flag_var)
+    endif
+  end subroutine histdef3d
+
+  SUBROUTINE conf_physoutputs(nam_var,flag_var)
 !!! Lecture des noms et niveau de sortie des variables dans output.def
-!   en utilisant les routines getin de IOIPSL  
-       use ioipsl
-
-       IMPLICIT NONE
-
-       include 'iniprint.h'
-
-       character(len=20)                :: nam_var
-       integer, dimension(nfiles)      :: flag_var
-
-        IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:)
-        call getin('flag_'//nam_var,flag_var)
-        call getin('name_'//nam_var,nam_var)
-        IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:)
-
-      END SUBROUTINE conf_physoutputs
-
-      SUBROUTINE convers_timesteps(str,dtime,timestep)
-
-        use ioipsl
-        USE phys_cal_mod
-
-        IMPLICIT NONE
-
-        character(len=20)   :: str
-        character(len=10)   :: type
-        integer             :: ipos,il
-        real                :: ttt,xxx,timestep,dayseconde,dtime
-        parameter (dayseconde=86400.)
-        include "temps.h"
-        include "comconst.h"
-
-        ipos=scan(str,'0123456789.',.true.)
-!  
-        il=len_trim(str)
-        print*,ipos,il
-        read(str(1:ipos),*) ttt
-        print*,ttt
-        type=str(ipos+1:il)
-
-
-        if ( il == ipos ) then
-        type='day'
-        endif
-
-        if ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
-        if ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) then
-           print*,'annee_ref,day_ref mon_len',annee_ref,day_ref,ioget_mon_len(annee_ref,day_ref)
-           timestep = ttt * dayseconde * mth_len
-        endif
-        if ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
-        if ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
-        if ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
-        if ( type == 'TS' ) timestep = dtime
-
-        print*,'type =      ',type
-        print*,'nb j/h/m =  ',ttt
-        print*,'timestep(s)=',timestep
-
-        END SUBROUTINE convers_timesteps
+    !   en utilisant les routines getin de IOIPSL  
+    use ioipsl
+
+    IMPLICIT NONE
+
+    include 'iniprint.h'
+
+    character(len=20)                :: nam_var
+    integer, dimension(nfiles)      :: flag_var
+
+    IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:)
+    call getin('flag_'//nam_var,flag_var)
+    call getin('name_'//nam_var,nam_var)
+    IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:)
+
+  END SUBROUTINE conf_physoutputs
+
+  SUBROUTINE convers_timesteps(str,dtime,timestep)
+
+    use ioipsl
+    USE phys_cal_mod
+
+    IMPLICIT NONE
+
+    character(len=20)   :: str
+    character(len=10)   :: type
+    integer             :: ipos,il
+    real                :: ttt,xxx,timestep,dayseconde,dtime
+    parameter (dayseconde=86400.)
+    include "temps.h"
+    include "comconst.h"
+    include "iniprint.h"
+
+    ipos=scan(str,'0123456789.',.true.)
+    !  
+    il=len_trim(str)
+    write(lunout,*)ipos,il
+    read(str(1:ipos),*) ttt
+    write(lunout,*)ttt
+    type=str(ipos+1:il)
+
+
+    if ( il == ipos ) then
+       type='day'
+    endif
+
+    if ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
+    if ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) then
+       write(lunout,*)'annee_ref,day_ref mon_len',annee_ref,day_ref,ioget_mon_len(annee_ref,day_ref)
+       timestep = ttt * dayseconde * mth_len
+    endif
+    if ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
+    if ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
+    if ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
+    if ( type == 'TS' ) timestep = ttt * dtime
+
+    write(lunout,*)'type =      ',type
+    write(lunout,*)'nb j/h/m =  ',ttt
+    write(lunout,*)'timestep(s)=',timestep
+
+  END SUBROUTINE convers_timesteps
 
 END MODULE phys_output_mod
Index: LMDZ5/branches/testing/libf/phylmd/phys_output_write.h
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/phys_output_write.h	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/phys_output_write.h	(revision 1664)
@@ -614,19 +614,20 @@
         ENDIF
 
-        IF (o_plcl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
-     $o_plcl%name,itau_w,plcl)
-        ENDIF
-
-        IF (o_plfc%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
-     $o_plfc%name,itau_w,plfc)
-        ENDIF
-
-        IF (o_wbeff%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
-     $o_wbeff%name,itau_w,wbeff)
-        ENDIF
-
+        if (iflag_con /= 30) then
+           if (o_plcl%flag(iff)<=lev_files(iff)) THEN
+              CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $             o_plcl%name,itau_w,plcl)
+           ENDIF
+
+           IF (o_plfc%flag(iff)<=lev_files(iff)) THEN
+              CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $             o_plfc%name,itau_w,plfc)
+           ENDIF
+
+           IF (o_wbeff%flag(iff)<=lev_files(iff)) THEN
+              CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $             o_wbeff%name,itau_w,wbeff)
+           ENDIF
+        end if
 
         IF (o_prw%flag(iff)<=lev_files(iff)) THEN
Index: LMDZ5/branches/testing/libf/phylmd/physiq.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/physiq.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/physiq.F	(revision 1664)
@@ -42,4 +42,7 @@
       use radlwsw_m, only: radlwsw
       USE control_mod
+#ifdef REPROBUS
+      USE CHEM_REP, ONLY : Init_chem_rep_xjour
+#endif
 
 
@@ -1215,4 +1218,6 @@
       REAL, dimension(klon, klev) :: cldtaurad  ! epaisseur optique pour radlwsw,COSP
       REAL, dimension(klon, klev) :: cldemirad  ! emissivite pour radlwsw,COSP 
+      INTEGER :: nbtr_tmp ! Number of tracer inside concvl
+      REAL, dimension(klon,klev) :: sh_in ! Specific humidity entering in phytrac
 
 cIM for NMC files
@@ -1355,5 +1360,5 @@
          tau_overturning_th(:)=0.
 
-         IF (config_inca /= 'none') THEN
+         IF (type_trac == 'inca') THEN
             ! jg : initialisation jusqu'au ces variables sont dans restart
             ccm(:,:,:) = 0.
@@ -1619,5 +1624,4 @@
 #endif
 
-         ecrit_hf2mth = ecrit_mth/ecrit_hf
 
          ecrit_hf = ecrit_hf * un_jour
@@ -1633,7 +1637,4 @@
          ecrit_LES = ecrit_LES * un_jour
 c
-         PRINT*,'physiq ecrit_ hf day mth reg tra ISCCP hf2mth',
-     .   ecrit_hf,ecrit_day,ecrit_mth,ecrit_reg,ecrit_tra,ecrit_ISCCP,
-     .   ecrit_hf2mth
 
 cXXXPB Positionner date0 pour initialisation de ORCHIDEE
@@ -1652,5 +1653,5 @@
 cc         ENDDO
 c
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 #ifdef INCA
          CALL VTe(VTphysiq)
@@ -1740,4 +1741,15 @@
       CALL change_srf_frac(itap, dtime, days_elapsed+1, 
      *     pctsrf, falb1, falb2, ftsol, u10m, v10m, pbl_tke)
+
+
+! Update time and other variables in Reprobus
+      IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+         CALL Init_chem_rep_xjour(jD_cur-jD_ref+day_ref)
+         print*,'xjour equivalent rjourvrai',jD_cur-jD_ref+day_ref
+         CALL Rtime(debut)
+#endif
+      END IF
+
 
 ! Tendances bidons pour les processus qui n'affectent pas certaines
@@ -2292,8 +2304,13 @@
           IF (ok_cvl) THEN ! new driver for convectL
 
+             IF (type_trac == 'repr') THEN
+                nbtr_tmp=ntra
+             ELSE
+                nbtr_tmp=nbtr
+             END IF
           CALL concvl (iflag_con,iflag_clos,
      .        dtime,paprs,pplay,t_undi,q_undi,
      .        t_wake,q_wake,wake_s,
-     .        u_seri,v_seri,tr_seri,nbtr,
+     .        u_seri,v_seri,tr_seri,nbtr_tmp,
      .        ALE,ALP,
      .        ema_work1,ema_work2,
@@ -3150,5 +3167,5 @@
       ENDDO
 
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 #ifdef INCA
          CALL VTe(VTphysiq)
@@ -3204,5 +3221,5 @@
          CALL VTb(VTphysiq)
 #endif 
-      END IF !config_inca /= 'none'
+      END IF !type_trac = inca
 c     
 c Calculer les parametres optiques des nuages et quelques
@@ -3668,4 +3685,10 @@
 C
 
+       IF (type_trac=='repr') THEN
+          sh_in(:,:) = q_seri(:,:)
+       ELSE
+          sh_in(:,:) = qx(:,:,ivap)
+       END IF
+
       call phytrac (
      I     itap,     days_elapsed+1,    jH_cur,   debut,
@@ -3677,5 +3700,5 @@
      I     rlat,     frac_impa, frac_nucl,rlon,
      I     presnivs, pphis,     pphi,     albsol1,
-     I     qx(:,:,ivap),rhcl,   cldfra,   rneb, 
+     I     sh_in,    rhcl,      cldfra,   rneb, 
      I     diafra,   cldliq,    itop_con, ibas_con,
      I     pmflxr,   pmflxs,    prfl,     psfl,
@@ -3860,5 +3883,5 @@
 #include "calcul_divers.h"
 c
-      IF (config_inca /= 'none') THEN
+      IF (type_trac == 'inca') THEN
 #ifdef INCA
          CALL VTe(VTphysiq)
Index: LMDZ5/branches/testing/libf/phylmd/phytrac.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/phytrac.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/phytrac.F90	(revision 1664)
@@ -33,6 +33,6 @@
   USE traclmdz_mod
   USE tracinca_mod
+  USE tracreprobus_mod
   USE control_mod
-
 
 
@@ -46,4 +46,5 @@
   INCLUDE "paramet.h"
   INCLUDE "thermcell.h"
+  INCLUDE "iniprint.h"
 !==========================================================================
 !                   -- ARGUMENT DESCRIPTION --
@@ -55,5 +56,5 @@
   INTEGER,INTENT(IN) :: nstep      ! Appel physique
   INTEGER,INTENT(IN) :: julien     ! Jour julien
-  REAL,INTENT(IN)    :: gmtime
+  REAL,INTENT(IN)    :: gmtime     ! Heure courante
   REAL,INTENT(IN)    :: pdtphys    ! Pas d'integration pour la physique (seconde)
   LOGICAL,INTENT(IN) :: debutphy   ! le flag de l'initialisation de la physique
@@ -202,5 +203,5 @@
 !######################################################################
   IF (debutphy) THEN
-     WRITE(*,*) 'FIRST TIME IN PHYTRAC : pdtphys(sec) = ',pdtphys,'ecrit_tra (sec) = ',ecrit_tra
+     IF (prt_level >9) WRITE(lunout,*) 'FIRST TIME IN PHYTRAC : pdtphys(sec) = ',pdtphys,'ecrit_tra (sec) = ',ecrit_tra
      ALLOCATE( source(klon,nbtr), stat=ierr)
      IF (ierr /= 0) CALL abort_gcm('phytrac', 'pb in allocation 1',1)
@@ -217,4 +218,6 @@
         source(:,:)=0.
         CALL tracinca_init(aerosol,lessivage)
+     CASE('repr')
+        source(:,:)=0.
      END SELECT
 !
@@ -222,5 +225,5 @@
 ! ----------------------------
 #ifdef CPP_IOIPSL
-!     INCLUDE "ini_histrac.h"
+     INCLUDE "ini_histrac.h"
 #endif
   END IF
@@ -257,4 +260,13 @@
           rfname,                                        &
           tr_seri,  source,   solsym)      
+
+  CASE('repr')
+     !   -- CHIMIE REPROBUS --
+
+     CALL tracreprobus(pdtphys, gmtime, debutphy, julien, &
+          presnivs, xlat, xlon, pphis, pphi, &
+          t_seri, pplay, paprs, sh , &
+          tr_seri, solsym)
+     
   END SELECT
 
@@ -403,5 +415,5 @@
 !=============================================================
 #ifdef CPP_IOIPSL
-!  INCLUDE "write_histrac.h"
+  INCLUDE "write_histrac.h"
 #endif
 
Index: LMDZ5/branches/testing/libf/phylmd/press_coefoz_m.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/press_coefoz_m.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/press_coefoz_m.F90	(revision 1664)
@@ -60,5 +60,7 @@
        press_in_edg(1) = 0.
        ! We choose edges halfway in logarithm:
-       forall (k = 2:n_plev) press_in_edg(k) = sqrt(plev(k - 1) * plev(k))
+       DO k = 2,n_plev
+          press_in_edg(k) = SQRT(plev(k - 1) * plev(k))
+       ENDDO
        press_in_edg(n_plev + 1) = huge(0.)
        ! (infinity, but any value guaranteed to be greater than the
Index: LMDZ5/branches/testing/libf/phylmd/radiation_AR4.F
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/radiation_AR4.F	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/radiation_AR4.F	(revision 1664)
@@ -19,4 +19,5 @@
 cym#include "raddim.h"
 #include "YOMCST.h"
+#include "iniprint.h"
 C
 C     ------------------------------------------------------------------
@@ -163,17 +164,14 @@
         allocate(ZFSUPAI(KDLON,KFLEV+1))
         allocate(ZFSDNAI(KDLON,KFLEV+1))
-        DO JK = 1 , KDLON*(KFLEV+1)
-          ZFSUPAD(JK,1) = 0.0     ! ZFSUPAD(:,:)=0.
-          ZFSDNAD(JK,1) = 0.0     ! ZFSDNAD(:,:)=0.
-          ZFSUPAI(JK,1) = 0.0     ! ZFSUPAI(:,:)=0.
-          ZFSDNAI(JK,1) = 0.0     ! ZFSDNAI(:,:)=0.
-        END DO
+
+        ZFSUPAD(:,:)=0.
+        ZFSDNAD(:,:)=0.
+        ZFSUPAI(:,:)=0.
+        ZFSDNAI(:,:)=0.
       endif
-!rv
-      
-c
+
       IF (appel1er) THEN
-         PRINT*, 'SW calling frequency : ', swpas
-         PRINT*, "   In general, it should be 1"
+         WRITE(lunout,*) 'SW calling frequency : ', swpas
+         WRITE(lunout,*) "   In general, it should be 1"
          appel1er = .FALSE.
       ENDIF
@@ -526,8 +524,14 @@
       USE dimphy
       USE radiation_AR4_param, only : RSUN, RRAY
+      USE infotrac, ONLY : type_trac
+#ifdef REPROBUS
+      USE CHEM_REP, ONLY : RSUNTIME, ok_SUNTIME
+#endif
+
       IMPLICIT none
 cym#include "dimensions.h"
 cym#include "dimphy.h"
-cym#include "raddim.h"
+cym#include "raddim.h"i
+#include "iniprint.h"
 C
 C     ------------------------------------------------------------------
@@ -613,4 +617,16 @@
       INTEGER jl, jk, k, jaj, ikm1, ikl
 
+C If running with Reporbus, overwrite default values of RSUN. 
+C Otherwise keep default values from radiation_AR4_param module.  
+      IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+         IF (ok_SUNTIME) THEN
+            RSUN(1) = RSUNTIME(1)
+            RSUN(2) = RSUNTIME(2)
+         ENDIF
+         WRITE(lunout,*)'RSUN(1): ',RSUN(1)
+#endif
+      END IF
+
 C     ------------------------------------------------------------------
 C
@@ -754,4 +770,9 @@
       USE dimphy
       USE radiation_AR4_param, only : RSUN, RRAY
+      USE infotrac, ONLY : type_trac
+#ifdef REPROBUS
+      use CHEM_REP, only : RSUNTIME, ok_SUNTIME
+#endif
+
       IMPLICIT none
 cym#include "dimensions.h"
@@ -873,4 +894,16 @@
       INTEGER jref, jkl, jklp1, jajp, jkki, jkkp4, jn2j, iabs
       REAL(KIND=8) ZRMUM1, ZWH2O, ZCNEB, ZAA, ZBB, ZRKI, ZRE11
+
+C If running with Reporbus, overwrite default values of RSUN. 
+C Otherwise keep default values from radiation_AR4_param module.  
+      IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+         IF (ok_SUNTIME) THEN
+            RSUN(1)=RSUNTIME(1)
+            RSUN(2)=RSUNTIME(2)
+         END IF
+#endif
+      END IF
+
 C
 
@@ -2307,4 +2340,5 @@
 #include "raddimlw.h"
 #include "YOMCST.h"
+#include "iniprint.h"
 C
 C-----------------------------------------------------------------------
@@ -2412,7 +2446,7 @@
 C     ------------------------------------------------------------------
       IF (appel1er) THEN
-         PRINT*, "LW clear-sky calling frequency: ", lw0pas
-         PRINT*, "LW cloudy-sky calling frequency: ", lwpas
-         PRINT*, "   In general, they should be 1"
+         WRITE(lunout,*) "LW clear-sky calling frequency: ", lw0pas
+         WRITE(lunout,*) "LW cloudy-sky calling frequency: ", lwpas
+         WRITE(lunout,*) "   In general, they should be 1"
 cym
 	 allocate(ZFLUX(KDLON,2,KFLEV+1) )
@@ -2485,4 +2519,13 @@
       USE dimphy
       USE radiation_AR4_param, only : TREF, RT1, RAER, AT, BT, OCT
+      USE infotrac, ONLY : type_trac
+#ifdef REPROBUS
+      USE CHEM_REP, ONLY: RCH42D,
+     $                    RN2O2D,
+     $                    RCFC112D,
+     $                    RCFC122D,
+     $                    ok_Rtime2D
+#endif
+
       IMPLICIT none
 cym#include "dimensions.h"
@@ -2800,17 +2843,55 @@
      S                +ZUAER(JL,5)    *ZDUC(JL,JC)*ZDIFF
 C
-      PABCU(JL,19,JC)=PABCU(JL,19,JCP1)
-     S               +ZABLY(JL,8,JC)*RCH4/RCO2*ZPHM6(JL)*ZDIFF
-      PABCU(JL,20,JC)=PABCU(JL,20,JCP1)
+C
+
+      IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+         IF (ok_Rtime2D) THEN
+            PABCU(JL,19,JC)=PABCU(JL,19,JCP1)
+     S           +ZABLY(JL,8,JC)*RCH42D(JL,JC)/RCO2*ZPHM6(JL)*ZDIFF
+            PABCU(JL,20,JC)=PABCU(JL,20,JCP1)
+     S           +ZABLY(JL,9,JC)*RCH42D(JL,JC)/RCO2*ZPSM6(JL)*ZDIFF
+            PABCU(JL,21,JC)=PABCU(JL,21,JCP1)
+     S           +ZABLY(JL,8,JC)*RN2O2D(JL,JC)/RCO2*ZPHN6(JL)*ZDIFF
+            PABCU(JL,22,JC)=PABCU(JL,22,JCP1)
+     S           +ZABLY(JL,9,JC)*RN2O2D(JL,JC)/RCO2*ZPSN6(JL)*ZDIFF
+C
+            PABCU(JL,23,JC)=PABCU(JL,23,JCP1)
+     S           +ZABLY(JL,8,JC)*RCFC112D(JL,JC)/RCO2         *ZDIFF
+            PABCU(JL,24,JC)=PABCU(JL,24,JCP1)
+     S           +ZABLY(JL,8,JC)*RCFC122D(JL,JC)/RCO2         *ZDIFF
+         ELSE
+            ! Same calculation as for type_trac /= repr
+            PABCU(JL,19,JC)=PABCU(JL,19,JCP1)
+     S           +ZABLY(JL,8,JC)*RCH4/RCO2*ZPHM6(JL)*ZDIFF
+            PABCU(JL,20,JC)=PABCU(JL,20,JCP1)
+     S           +ZABLY(JL,9,JC)*RCH4/RCO2*ZPSM6(JL)*ZDIFF
+            PABCU(JL,21,JC)=PABCU(JL,21,JCP1)
+     S           +ZABLY(JL,8,JC)*RN2O/RCO2*ZPHN6(JL)*ZDIFF
+            PABCU(JL,22,JC)=PABCU(JL,22,JCP1)
+     S           +ZABLY(JL,9,JC)*RN2O/RCO2*ZPSN6(JL)*ZDIFF
+C     
+            PABCU(JL,23,JC)=PABCU(JL,23,JCP1)
+     S               +ZABLY(JL,8,JC)*RCFC11/RCO2         *ZDIFF
+            PABCU(JL,24,JC)=PABCU(JL,24,JCP1)
+     S           +ZABLY(JL,8,JC)*RCFC12/RCO2         *ZDIFF
+         END IF
+#endif
+      ELSE
+         PABCU(JL,19,JC)=PABCU(JL,19,JCP1)
+     S        +ZABLY(JL,8,JC)*RCH4/RCO2*ZPHM6(JL)*ZDIFF
+         PABCU(JL,20,JC)=PABCU(JL,20,JCP1)
      S               +ZABLY(JL,9,JC)*RCH4/RCO2*ZPSM6(JL)*ZDIFF
-      PABCU(JL,21,JC)=PABCU(JL,21,JCP1)
-     S               +ZABLY(JL,8,JC)*RN2O/RCO2*ZPHN6(JL)*ZDIFF
-      PABCU(JL,22,JC)=PABCU(JL,22,JCP1)
-     S               +ZABLY(JL,9,JC)*RN2O/RCO2*ZPSN6(JL)*ZDIFF
-C
-      PABCU(JL,23,JC)=PABCU(JL,23,JCP1)
-     S               +ZABLY(JL,8,JC)*RCFC11/RCO2         *ZDIFF
-      PABCU(JL,24,JC)=PABCU(JL,24,JCP1)
-     S               +ZABLY(JL,8,JC)*RCFC12/RCO2         *ZDIFF
+         PABCU(JL,21,JC)=PABCU(JL,21,JCP1)
+     S        +ZABLY(JL,8,JC)*RN2O/RCO2*ZPHN6(JL)*ZDIFF
+         PABCU(JL,22,JC)=PABCU(JL,22,JCP1)
+     S        +ZABLY(JL,9,JC)*RN2O/RCO2*ZPSN6(JL)*ZDIFF
+C     
+         PABCU(JL,23,JC)=PABCU(JL,23,JCP1)
+     S        +ZABLY(JL,8,JC)*RCFC11/RCO2         *ZDIFF
+         PABCU(JL,24,JC)=PABCU(JL,24,JCP1)
+     S        +ZABLY(JL,8,JC)*RCFC12/RCO2         *ZDIFF
+      END IF
+      
  523  CONTINUE
  524  CONTINUE
Index: LMDZ5/branches/testing/libf/phylmd/radiation_AR4_param.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/radiation_AR4_param.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/radiation_AR4_param.F90	(revision 1664)
@@ -159,5 +159,6 @@
       0.90811926E+01,  0.75073923E+02,  0.24654438E+03,  0.39332612E+03,  0.29385281E+03,  0.89107921E+02 /) , (/ 6,6 /) )
 
-      REAL*8, dimension(2), parameter :: RSUN = (/ 0.441676 , 0.558324 /)
+! If running with Reporbus type_trac=repr, values of RSUN might be overritten in radiation_AR4
+      REAL*8, dimension(2) :: RSUN = (/ 0.441676 , 0.558324 /)
       REAL*8, dimension(2,6), parameter :: RRAY = reshape ( &
          (/ .428937E-01, .697200E-02,&
Index: LMDZ5/branches/testing/libf/phylmd/radlwsw.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/radlwsw.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/radlwsw.F90	(revision 1664)
@@ -30,5 +30,9 @@
 
   USE DIMPHY
-  use assert_m, only: assert
+  USE assert_m, ONLY : assert
+  USE infotrac, ONLY : type_trac
+#ifdef REPROBUS
+  USE CHEM_REP, ONLY : solaireTIME, ok_SUNTIME, ndimozon
+#endif
 
   !======================================================================
@@ -229,4 +233,12 @@
   !
   PSCT = solaire/zdist/zdist
+
+  IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+     if(ok_SUNTIME) PSCT = solaireTIME/zdist/zdist
+     print*,'Constante solaire: ',PSCT*zdist*zdist
+#endif
+  END IF
+
   DO j = 1, nb_gr
     iof = kdlon*(j-1)
@@ -281,4 +293,12 @@
       ENDDO
     ENDDO
+
+    IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+       ndimozon = size(wo, 3)
+       CALL RAD_INTERACTIF(POZON,iof)
+#endif
+    END IF
+
     !
     DO k = 1, kflev+1
Index: LMDZ5/branches/testing/libf/phylmd/soil.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/soil.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/soil.F90	(revision 1664)
@@ -54,4 +54,5 @@
   INCLUDE "indicesol.h"
   INCLUDE "comsoil.h"
+  INCLUDE "iniprint.h"
 !-----------------------------------------------------------------------
 ! Arguments
@@ -111,6 +112,6 @@
            READ(99,*) min_period
            READ(99,*) dalph_soil
-           PRINT*,'Discretization for the soil model'
-           PRINT*,'First level e-folding depth',min_period, &
+           WRITE(lunout,*)'Discretization for the soil model'
+           WRITE(lunout,*)'First level e-folding depth',min_period, &
                 '   dalph',dalph_soil
            CLOSE(99)
@@ -135,10 +136,10 @@
      ENDDO
      lambda=fz(.5)*dz1(1)
-     PRINT*,'full layers, intermediate layers (seconds)'
+     WRITE(lunout,*)'full layers, intermediate layers (seconds)'
      DO jk=1,nsoilmx
         rk=jk
         rk1=jk+.5
         rk2=jk-.5
-        PRINT *,'fz=', &
+        WRITE(lunout,*)'fz=', &
              fz(rk1)*fz(rk2)*3.14,fz(rk)*fz(rk)*3.14
      ENDDO
@@ -175,5 +176,5 @@
      ENDDO
   ELSE
-     PRINT*, "valeur d indice non prevue", indice
+     WRITE(lunout,*) "valeur d indice non prevue", indice
      CALL abort
   ENDIF
Index: LMDZ5/branches/testing/libf/phylmd/sw_aeroAR4.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/sw_aeroAR4.F90	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/sw_aeroAR4.F90	(revision 1664)
@@ -26,4 +26,5 @@
 #include "YOMCST.h"
 #include "clesphys.h"
+#include "iniprint.h"
   !
   !     ------------------------------------------------------------------
@@ -225,6 +226,6 @@
 
   IF (appel1er) THEN
-     PRINT*, 'SW calling frequency : ', swpas
-     PRINT*, "   In general, it should be 1"
+     WRITE(lunout,*) 'SW calling frequency : ', swpas
+     WRITE(lunout,*) "   In general, it should be 1"
      appel1er = .FALSE.
   ENDIF
Index: LMDZ5/branches/testing/libf/phylmd/tracreprobus_mod.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/tracreprobus_mod.F90	(revision 1664)
+++ LMDZ5/branches/testing/libf/phylmd/tracreprobus_mod.F90	(revision 1664)
@@ -0,0 +1,109 @@
+MODULE tracreprobus_mod
+!
+! This module prepares and calls the Reprobus main subroutine 
+!
+
+CONTAINS
+
+  SUBROUTINE tracreprobus(pdtphys, gmtime, debutphy, julien, &
+       presnivs, xlat, xlon, pphis, pphi, &
+       t_seri, pplay, paprs, sh , &
+       tr_seri, solsym)
+
+    USE dimphy
+    USE infotrac
+#ifdef REPROBUS 
+    USE CHEM_REP, ONLY : pdt_rep, &  ! pas de temps reprobus
+         daynum, iter, &             ! jourjulien, iteration chimie
+         pdel
+#endif
+    IMPLICIT NONE
+
+! Input argument
+!---------------
+    REAL,INTENT(IN)    :: pdtphys    ! Pas d'integration pour la physique (seconde)
+    REAL,INTENT(IN)    :: gmtime     ! Heure courante
+    LOGICAL,INTENT(IN) :: debutphy   ! le flag de l'initialisation de la physique
+    INTEGER,INTENT(IN) :: julien     ! Jour julien
+
+    REAL,DIMENSION(klev),INTENT(IN)        :: presnivs! pressions approximat. des milieux couches (en PA)
+    REAL,DIMENSION(klon),INTENT(IN)        :: xlat    ! latitudes pour chaque point 
+    REAL,DIMENSION(klon),INTENT(IN)        :: xlon    ! longitudes pour chaque point 
+    REAL,DIMENSION(klon),INTENT(IN)        :: pphis   ! geopotentiel du sol
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: pphi    ! geopotentiel de chaque couche
+
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: t_seri  ! Temperature
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: pplay   ! pression pour le mileu de chaque couche (en Pa)
+    REAL,DIMENSION(klon,klev+1),INTENT(IN) :: paprs   ! pression pour chaque inter-couche (en Pa)
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: sh      ! humidite specifique   
+
+
+! Output argument
+!----------------
+    REAL,DIMENSION(klon,klev,nbtr),INTENT(INOUT)  :: tr_seri ! Concentration Traceur [U/KgA]  
+    CHARACTER(len=8),DIMENSION(nbtr), INTENT(OUT) :: solsym
+  
+
+! Local variables
+!----------------
+    INTEGER :: it, k
+
+#ifdef REPROBUS
+    !   -- CHIMIE REPROBUS --
+    pdt_rep=pdtphys/2.
+    
+    DO k = 1, klev
+       pdel(:,k) = paprs(:,k) - paprs (:,k+1)
+    END DO
+    
+    ! initialisation de ozone passif a ozone en debut d hiver HN et HS
+    IF (julien == 341 .OR. julien == 181) THEN
+       tr_seri(:,:,11)=tr_seri(:,:,8)
+    END IF
+    
+    DO  iter = 1,2
+       daynum = FLOAT(julien) + gmtime + (iter-1)*pdt_rep/86400.
+       
+       DO it=1, nbtr
+!     WRITE(lunout,*)it,' ',minval(tr_seri(:,:,it)),maxval(tr_seri(:,:,it))
+! seulement pour les especes chimiques (pas l'age de l'air)
+! verif valeurs extremes
+! correction: a 1.e-30 quand =0 ou negatif et
+! call abort si >ou= 1.e10
+          WRITE(*,*)it,'nqtot',nqtot,'nbtr',nbtr
+          IF (it < nqtot) THEN
+             WRITE(*,*)'ici',it,nqtot
+#ifdef REPROBUS
+             CALL minmaxqfi_chimie(tr_seri(1,1,it),0.,1.e10,'avant chimie ')
+#endif
+             WRITE(*,*)'apres'
+          ENDIF
+       ENDDO
+       
+#ifdef REPROBUS
+       CALL chemmain_rlong_1401( &
+            tr_seri, & !argument phytrac (change de nom apres: vmr)
+            xlon,    & !argument phytrac (change de nom apres: lon)
+            xlat,    & !argument phytrac (change de nom apres: lat)
+            t_seri,  & !argument phytrac (meme nom)
+            pplay,   & !argument phytrac (meme nom)
+            pphi,    & !argument phytrac (meme nom)
+            pphis,   & !argument phytrac (meme nom)
+            presnivs, & !argument phytrac (meme nom)
+            sh,      & !argument phytrac (meme nom)
+            debutphy) !argument phytrac (change de nom apres: debut)
+       ! pdel, pdt_rep, daynum : definit dans phytrac et utilise dans chemmain
+       !                 et transporte par CHEM_REP
+#endif        
+       
+    END DO
+    
+
+    ! 
+    DO it=1,nbtr
+       WRITE(solsym(it),'(i2)') it
+    END DO
+#endif
+  END SUBROUTINE tracreprobus
+
+END MODULE tracreprobus_mod
Index: LMDZ5/branches/testing/libf/phylmd/write_histrac.h
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/write_histrac.h	(revision 1663)
+++ LMDZ5/branches/testing/libf/phylmd/write_histrac.h	(revision 1664)
@@ -3,11 +3,11 @@
 !  ECRITURE DU FICHIER :  histrac.nc
 !***************************************
-  IF (ecrit_tra > 0. .AND. config_inca == 'none') THEN
+  IF (ecrit_tra > 0.) THEN
      
      itau_w = itau_phy + nstep
      
-     CALL histwrite_phy(nid_tra,"phis",itau_w,pphis)
-     CALL histwrite_phy(nid_tra,"aire",itau_w,airephy)
-     CALL histwrite_phy(nid_tra,"zmasse",itau_w,zmasse)
+     CALL histwrite_phy(nid_tra,.FALSE.,"phis",itau_w,pphis)
+     CALL histwrite_phy(nid_tra,.FALSE.,"aire",itau_w,airephy)
+     CALL histwrite_phy(nid_tra,.FALSE.,"zmasse",itau_w,zmasse)
 
 !TRACEURS
@@ -17,23 +17,23 @@
 
 ! CONCENTRATIONS
-        CALL histwrite_phy(nid_tra,tname(iiq),itau_w,tr_seri(:,:,it))
+        CALL histwrite_phy(nid_tra,.FALSE.,tname(iiq),itau_w,tr_seri(:,:,it))
 
 ! TD LESSIVAGE       
         IF (lessivage .AND. aerosol(it)) THEN
-           CALL histwrite_phy(nid_tra,"fl"//tname(iiq),itau_w,flestottr(:,:,it))
+           CALL histwrite_phy(nid_tra,.FALSE.,"fl"//tname(iiq),itau_w,flestottr(:,:,it))
         ENDIF
 
 ! TD THERMIQUES
         IF (iflag_thermals.gt.0) THEN
-           CALL histwrite_phy(nid_tra,"d_tr_th_"//tname(iiq),itau_w,d_tr_th(:,:,it))
+           CALL histwrite_phy(nid_tra,.FALSE.,"d_tr_th_"//tname(iiq),itau_w,d_tr_th(:,:,it))
         ENDIF
 
 ! TD CONVECTION
         IF (iflag_con.GE.2) THEN
-           CALL histwrite_phy(nid_tra,"d_tr_cv_"//tname(iiq),itau_w,d_tr_cv(:,:,it))
+           CALL histwrite_phy(nid_tra,.FALSE.,"d_tr_cv_"//tname(iiq),itau_w,d_tr_cv(:,:,it))
         ENDIF
 
 ! TD COUCHE-LIMITE
-        CALL histwrite_phy(nid_tra,"d_tr_cl_"//tname(iiq),itau_w,d_tr_cl(:,:,it))
+        CALL histwrite_phy(nid_tra,.FALSE.,"d_tr_cl_"//tname(iiq),itau_w,d_tr_cl(:,:,it))
      ENDDO
 !---------------
@@ -41,37 +41,37 @@
 !
 ! VENT (niveau 1)   
-     CALL histwrite_phy(nid_tra,"pyu1",itau_w,yu1)
-     CALL histwrite_phy(nid_tra,"pyv1",itau_w,yv1)
+     CALL histwrite_phy(nid_tra,.FALSE.,"pyu1",itau_w,yu1)
+     CALL histwrite_phy(nid_tra,.FALSE.,"pyv1",itau_w,yv1)
 !
 ! TEMPERATURE DU SOL
      zx_tmp_fi2d(:)=ftsol(:,1)         
-     CALL histwrite_phy(nid_tra,"ftsol1",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"ftsol1",itau_w,zx_tmp_fi2d)
      zx_tmp_fi2d(:)=ftsol(:,2)
-     CALL histwrite_phy(nid_tra,"ftsol2",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"ftsol2",itau_w,zx_tmp_fi2d)
      zx_tmp_fi2d(:)=ftsol(:,3)
-     CALL histwrite_phy(nid_tra,"ftsol3",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"ftsol3",itau_w,zx_tmp_fi2d)
      zx_tmp_fi2d(:)=ftsol(:,4)
-     CALL histwrite_phy(nid_tra,"ftsol4",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"ftsol4",itau_w,zx_tmp_fi2d)
 !      
 ! NATURE DU SOL
      zx_tmp_fi2d(:)=pctsrf(:,1)
-     CALL histwrite_phy(nid_tra,"psrf1",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"psrf1",itau_w,zx_tmp_fi2d)
      zx_tmp_fi2d(:)=pctsrf(:,2)
-     CALL histwrite_phy(nid_tra,"psrf2",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"psrf2",itau_w,zx_tmp_fi2d)
      zx_tmp_fi2d(:)=pctsrf(:,3)
-     CALL histwrite_phy(nid_tra,"psrf3",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"psrf3",itau_w,zx_tmp_fi2d)
      zx_tmp_fi2d(:)=pctsrf(:,4)
-     CALL histwrite_phy(nid_tra,"psrf4",itau_w,zx_tmp_fi2d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"psrf4",itau_w,zx_tmp_fi2d)
  
 ! DIVERS    
-     CALL histwrite_phy(nid_tra,"pplay",itau_w,pplay)     
-     CALL histwrite_phy(nid_tra,"T",itau_w,t_seri)     
-     CALL histwrite_phy(nid_tra,"mfu",itau_w,pmfu)
-     CALL histwrite_phy(nid_tra,"mfd",itau_w,pmfd)
-     CALL histwrite_phy(nid_tra,"en_u",itau_w,pen_u)
-     CALL histwrite_phy(nid_tra,"en_d",itau_w,pen_d)
-     CALL histwrite_phy(nid_tra,"de_d",itau_w,pde_d)
-     CALL histwrite_phy(nid_tra,"de_u",itau_w,pde_u)
-     CALL histwrite_phy(nid_tra,"coefh",itau_w,coefh)
+     CALL histwrite_phy(nid_tra,.FALSE.,"pplay",itau_w,pplay)     
+     CALL histwrite_phy(nid_tra,.FALSE.,"T",itau_w,t_seri)     
+     CALL histwrite_phy(nid_tra,.FALSE.,"mfu",itau_w,pmfu)
+     CALL histwrite_phy(nid_tra,.FALSE.,"mfd",itau_w,pmfd)
+     CALL histwrite_phy(nid_tra,.FALSE.,"en_u",itau_w,pen_u)
+     CALL histwrite_phy(nid_tra,.FALSE.,"en_d",itau_w,pen_d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"de_d",itau_w,pde_d)
+     CALL histwrite_phy(nid_tra,.FALSE.,"de_u",itau_w,pde_u)
+     CALL histwrite_phy(nid_tra,.FALSE.,"coefh",itau_w,coefh)
 
      IF (ok_sync) THEN
@@ -81,4 +81,4 @@
      ENDIF
 
-  ENDIF !ecrit_tra>0. .AND. config_inca == 'none'
+  ENDIF !ecrit_tra>0.
 
Index: LMDZ5/branches/testing/offline.def
===================================================================
--- LMDZ5/branches/testing/offline.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/offline.def
Index: LMDZ5/branches/testing/orchidee.def
===================================================================
--- LMDZ5/branches/testing/orchidee.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/orchidee.def
Index: LMDZ5/branches/testing/output.def
===================================================================
--- LMDZ5/branches/testing/output.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/output.def
Index: LMDZ5/branches/testing/physiq.def
===================================================================
--- LMDZ5/branches/testing/physiq.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/physiq.def
Index: LMDZ5/branches/testing/run.def
===================================================================
--- LMDZ5/branches/testing/run.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/run.def
Index: LMDZ5/branches/testing/traceur.def
===================================================================
--- LMDZ5/branches/testing/traceur.def	(revision 1663)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link DefLists/traceur.def
