Index: /LMDZ6/trunk/libf/phylmd/Dust/dustemission_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/dustemission_mod.F90	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/dustemission_mod.F90	(revision 3786)
@@ -153,4 +153,15 @@
 !======================================================================================
 !--------------------------------------------------------------------------------------
+
+  SUBROUTINE dustemis_out_init()
+
+    USE dimphy
+
+    !AS: moved here from subroutine initdust
+    ALLOCATE( m1dflux(klon) )
+    ALLOCATE( m2dflux(klon) )
+    ALLOCATE( m3dflux(klon) )
+
+  END SUBROUTINE dustemis_out_init
 
   SUBROUTINE dustemission( debutphy, xlat, xlon, &    !Input
@@ -625,7 +636,8 @@
     ALLOCATE( srel(nats,nclass) )
     ALLOCATE( srel2(nats,nclass) )
-    ALLOCATE( m1dflux(klon) )
-    ALLOCATE( m2dflux(klon) )
-    ALLOCATE( m3dflux(klon) )
+    !!AS: moved to subroutine dustemission_output_init
+    !ALLOCATE( m1dflux(klon) )
+    !ALLOCATE( m2dflux(klon) )
+    !ALLOCATE( m3dflux(klon) )
 
 
Index: /LMDZ6/trunk/libf/phylmd/Dust/lsc_scav_spl.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/lsc_scav_spl.F90	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/lsc_scav_spl.F90	(revision 3786)
@@ -179,5 +179,5 @@
 
 !  pressure and size of the layer
-  DO k=klev-1, 1, -1
+  DO k=klev, 1, -1
    DO i=1, klon 
      zrho(i,k)=pplay(i,k)/t(i,k)/RD   
Index: /LMDZ6/trunk/libf/phylmd/Dust/phys_output_write_spl_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/phys_output_write_spl_mod.F90	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/phys_output_write_spl_mod.F90	(revision 3786)
@@ -68,5 +68,5 @@
        flux_sparam_sscoa,u10m_ss,v10m_ss
 
-  USE dustemission_mod, ONLY : m1dflux, m2dflux, m3dflux
+  USE dustemission_mod, ONLY : m1dflux, m2dflux, m3dflux 
 
 !  USE phytrac_mod, ONLY : d_tr_cl, d_tr_th, d_tr_cv, d_tr_lessi_impa, &
@@ -82,5 +82,5 @@
 CONTAINS 
 
-  ! ug Routine pour définir (los du premier passageà) ET sortir les variables
+  ! ug Routine pour définir (lors du premier passageà) ET sortir les variables
   SUBROUTINE phys_output_write_spl(itap, pdtphys, paprs, pphis, &
        pplay, lmax_th, aerosol_couple,         &
@@ -90,5 +90,5 @@
 
     ! This subroutine does the actual writing of diagnostics that were
-    ! defined and initialised in phys_output_mod.F90
+    ! defined and initialised mainly in phytracr_spl_mod.F90 (SPLA tracers, subroutine phytracr_spl_out_init)
 
     USE dimphy, ONLY: klon, klev, klevp1
@@ -148,15 +148,17 @@
          o_alp_bl_fluct_m, o_alp_bl_fluct_tke, &
          o_alp_bl_conv, o_alp_bl_stat, &
-         o_slab_qflux, o_tslab, o_slab_bils, &
+         o_slab_qflux, o_tslab, &
+         !o_slab_bils, &
          o_slab_bilg, o_slab_sic, o_slab_tice, &
          o_weakinv, o_dthmin, o_cldtau, &
          o_cldemi, o_pr_con_l, o_pr_con_i, &
          o_pr_lsc_l, o_pr_lsc_i, o_re, o_fl, &
-         o_rh2m, o_rh2m_min, o_rh2m_max, &
+         o_rh2m, &
+         !o_rh2m_min, o_rh2m_max, &
          o_qsat2m, o_tpot, o_tpote, o_SWnetOR, &
          o_LWdownOR, o_snowl, &
          o_solldown, o_dtsvdfo, o_dtsvdft, &
          o_dtsvdfg, o_dtsvdfi, o_z0m, o_z0h, o_od550aer, &
-         o_od865aer, o_absvisaer, o_od550lt1aer, &
+         o_od865aer, o_abs550aer, o_od550lt1aer, &
          o_sconcso4, o_sconcno3, o_sconcoa, o_sconcbc, &
          o_sconcss, o_sconcdust, o_concso4, o_concno3, &
@@ -300,4 +302,5 @@
          ema_cbmf, Ma, fm_therm, ale_bl, alp_bl, ale, &
          alp, cin, wake_pe, wake_s, wake_deltat, &
+         ale_wake, ale_bl_stat, &
          wake_deltaq, ftd, fqd, ale_bl_trig, albsol1, &
          rnebcon, wo, falb1, albsol2, coefh, clwcon0, &
@@ -323,13 +326,16 @@
          t2m, fluxt, fluxlat, fsollw, fsolsw, &
          wfbils, wfbilo, cdragm, cdragh, cldl, cldm, &
-         cldh, cldt, JrNt, cldljn, cldmjn, cldhjn, &
-         cldtjn, cldq, flwp, fiwp, ue, ve, uq, vq, &
+         cldh, cldt, JrNt, &
+         ! cldljn, cldmjn, cldhjn, cldtjn &
+         cldq, flwp, fiwp, ue, ve, uq, vq, &
          plcl, plfc, wbeff, upwd, dnwd, dnwd0, prw, &
          s_pblh, s_pblt, s_lcl, s_therm, uwriteSTD, &
          vwriteSTD, wwriteSTD, phiwriteSTD, qwriteSTD, &
-         twriteSTD, ale_wake, alp_wake, wake_h, &
+         twriteSTD, alp_wake, wake_h, &
+         !ale_wake, &
          wake_omg, d_t_wake, d_q_wake, Vprecip, &
          wdtrainA, wdtrainM, n2, s2, proba_notrig, &
-         random_notrig, ale_bl_stat, &
+         random_notrig, &
+         !ale_bl_stat, &
          alp_bl_det, alp_bl_fluct_m, alp_bl_conv, &
          alp_bl_stat, alp_bl_fluct_tke, slab_wfbils, &
@@ -337,5 +343,5 @@
          pmflxr, pmflxs, prfl, psfl, re, fl, rh2m, &
          qsat2m, tpote, tpot, d_ts, od550aer, &
-         od865aer, absvisaer, od550lt1aer, sconcso4, sconcno3, &
+         od865aer, abs550aer, od550lt1aer, sconcso4, sconcno3, &
          sconcoa, sconcbc, sconcss, sconcdust, concso4, concno3, &
          concoa, concbc, concss, concdust, loadso4, &
@@ -372,5 +378,5 @@
          bils_ec,bils_ech, bils_tke, bils_kinetic, bils_latent, bils_enthalp, &
          itau_con, nfiles, clef_files, nid_files, zvstr_gwd_rando
-    USE ocean_slab_mod, ONLY: tslab, slab_bils, slab_bilg, tice, seaice
+    USE ocean_slab_mod, ONLY: tslab, slab_bilg, tice, seaice
     USE pbl_surface_mod, ONLY: snow
     USE indice_sol_mod, ONLY: nbsrf
@@ -405,4 +411,5 @@
     INTEGER, DIMENSION(klon) :: lmax_th
     LOGICAL :: aerosol_couple, ok_sync
+    LOGICAL :: ok_ade, ok_aie
     LOGICAL, DIMENSION(klon, klev) :: ptconv, ptconvth
     REAL :: pdtphys
@@ -442,9 +449,12 @@
     CALL set_itau_iophy(itau_w)
 
-    IF (.NOT.vars_defined) THEN
-       iinitend = 2
-    ELSE
-       iinitend = 1
-    ENDIF
+!AS, vu avec LF : le test est fait maintenant au debut du pdt, pas a la fin, alors on ne passe plus qu'une fois
+! Donc le "IF (.NOT.vars_defined)" devient inutile, et la boucle "DO iinit=1, iinitend" pourra etre eliminee 
+!  ainsi que iinit, iinitend
+!    IF (.NOT.vars_defined) THEN
+!       iinitend = 2
+!    ELSE
+!       iinitend = 1
+!    ENDIF
 
     ! ug la boucle qui suit ne sert qu'une fois, pour l'initialisation, sinon il n'y a toujours qu'un seul passage:
@@ -735,8 +745,18 @@
        CALL histwrite_phy(o_cldt, cldt)
        CALL histwrite_phy(o_JrNt, JrNt)
-       CALL histwrite_phy(o_cldljn, cldl*JrNt)
-       CALL histwrite_phy(o_cldmjn, cldm*JrNt)
-       CALL histwrite_phy(o_cldhjn, cldh*JrNt)
-       CALL histwrite_phy(o_cldtjn, cldt*JrNt)
+
+       !CALL histwrite_phy(o_cldljn, cldl*JrNt)
+       IF (vars_defined)  zx_tmp_fi2d=cldl*JrNt
+       CALL histwrite_phy(o_cldljn, zx_tmp_fi2d)
+       !CALL histwrite_phy(o_cldmjn, cldm*JrNt)
+       IF (vars_defined)  zx_tmp_fi2d=cldm*JrNt
+       CALL histwrite_phy(o_cldmjn, zx_tmp_fi2d)
+       !CALL histwrite_phy(o_cldhjn, cldh*JrNt)
+       IF (vars_defined)  zx_tmp_fi2d=cldh*JrNt
+       CALL histwrite_phy(o_cldhjn, zx_tmp_fi2d)
+       !CALL histwrite_phy(o_cldtjn, cldt*JrNt)
+       IF (vars_defined)  zx_tmp_fi2d=cldt*JrNt
+       CALL histwrite_phy(o_cldtjn, zx_tmp_fi2d)
+
        CALL histwrite_phy(o_cldq, cldq)
        IF (vars_defined)       zx_tmp_fi2d(1:klon) = flwp(1:klon)
@@ -932,5 +952,5 @@
        IF (type_ocean=='slab ') THEN
           CALL histwrite_phy(o_slab_qflux, slab_wfbils)
-          CALL histwrite_phy(o_slab_bils, slab_bils)
+          !CALL histwrite_phy(o_slab_bils, slab_bils)
           IF (nslay.EQ.1) THEN
               zx_tmp_fi2d(:)=tslab(:,1)
@@ -967,5 +987,5 @@
           ENDDO
        ENDIF
-       CALL histwrite_phy(o_rh2m_min, zx_tmp_fi2d)
+       !CALL histwrite_phy(o_rh2m_min, zx_tmp_fi2d)
 
        IF (vars_defined) THEN
@@ -974,5 +994,5 @@
           ENDDO
        ENDIF
-       CALL histwrite_phy(o_rh2m_max, zx_tmp_fi2d)
+       !CALL histwrite_phy(o_rh2m_max, zx_tmp_fi2d)
 
        CALL histwrite_phy(o_qsat2m, qsat2m)
@@ -996,5 +1016,5 @@
           CALL histwrite_phy(o_od550aer, od550aer)
           CALL histwrite_phy(o_od865aer, od865aer)
-          CALL histwrite_phy(o_absvisaer, absvisaer)
+          CALL histwrite_phy(o_abs550aer, abs550aer)
           CALL histwrite_phy(o_od550lt1aer, od550lt1aer)
           CALL histwrite_phy(o_sconcso4, sconcso4)
@@ -1136,12 +1156,17 @@
        CALL histwrite_phy(o_rnebjn, zx_tmp_fi3d)
        CALL histwrite_phy(o_rhum, zx_rh)
-       CALL histwrite_phy(o_ozone, &
-            wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
+       !CALL histwrite_phy(o_ozone, &
+       !     wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
+       IF (vars_defined) zx_tmp_fi3d = wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd
+       CALL histwrite_phy(o_ozone, zx_tmp_fi3d)
 
        IF (read_climoz == 2) THEN
-          CALL histwrite_phy(o_ozone_light, &
-               wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
-       ENDIF
-
+         !CALL histwrite_phy(o_ozone_light, &
+         !     wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
+         IF (vars_defined) zx_tmp_fi3d = wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd
+         CALL histwrite_phy(o_ozone_light, zx_tmp_fi3d)
+       ENDIF
+
+       !AS: dans phys_output_write il y a en plus : CALL histwrite_phy(o_duphy, d_u) 
        CALL histwrite_phy(o_dtphy, d_t)
        CALL histwrite_phy(o_dqphy,  d_qx(:,:,ivap))
@@ -1585,8 +1610,9 @@
 #endif
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-        IF (nqtot.GE.nqo+1) THEN
-            DO iq=nqo+1,nqtot
-              IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
-
+       IF (nqtot.GE.nqo+1) THEN
+         !AS: type_trac = 'lmdz' par defaut dans libf/dyn3d/conf_gcm.F90
+         !Changé par inca, repr(obus), coag(ulation), co2i(nteractif), PAS par SPLA
+         !Cet "if" est donc inutile : IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
+           DO iq=nqo+1,nqtot
              CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))
              CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))
@@ -1612,6 +1638,6 @@
              ENDIF
              CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
-             ENDIF
-          ENDDO
+           ENDDO
+         !ENDIF
        ENDIF
 
@@ -1639,5 +1665,5 @@
        ENDIF
 
-    ENDDO
+    ENDDO ! iinit
 
     IF (vars_defined) THEN
Index: /LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90	(revision 3786)
@@ -3,5 +3,4 @@
 
 MODULE phytracr_spl_mod
-
 
 ! Recuperation des morceaux de la physique de Jeronimo specifiques
@@ -445,4 +444,265 @@
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+SUBROUTINE phytracr_spl_out_init()
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!AS : This new subroutine centralises les ALLOCATE dont on a besoin au premier appel 
+!     de phys_output_write_spl dans physiq
+
+    USE dimphy
+    USE infotrac_phy, ONLY: nbtr
+    USE dustemission_mod, ONLY :  dustemis_out_init
+
+    ! pour les variables m[1-3]dflux
+    CALL dustemis_out_init() 
+
+    !AS: moved here from  section INITIALISATIONS of subroutine phytracr_spl_ini
+    !    ALLOCATE variables from spla_output_write.h, section "traceur"
+
+!traceur
+      ALLOCATE( diff_aod550_tot(klon)     )
+      ALLOCATE( diag_aod670_tot(klon)     )
+      ALLOCATE( diag_aod865_tot(klon)     )
+      ALLOCATE( diff_aod550_tr2(klon)     )
+      ALLOCATE( diag_aod670_tr2(klon)     )
+      ALLOCATE( diag_aod865_tr2(klon)     )
+      ALLOCATE( diag_aod550_ss(klon)      )
+      ALLOCATE( diag_aod670_ss(klon)      )
+      ALLOCATE( diag_aod865_ss(klon)      )
+      ALLOCATE( diag_aod550_dust(klon)    )
+      ALLOCATE( diag_aod670_dust(klon)    )
+      ALLOCATE( diag_aod865_dust(klon)    )
+      ALLOCATE( diag_aod550_dustsco(klon)  )
+      ALLOCATE( diag_aod670_dustsco(klon)  )
+      ALLOCATE( diag_aod865_dustsco(klon)  )
+      !AS: les 15 vars _terra et 15 _aqua suivantes sont groupees differemment dans spla_output_write.h
+      ALLOCATE( aod550_terra(klon))
+      ALLOCATE( aod550_tr2_terra(klon))
+      ALLOCATE( aod550_ss_terra(klon))
+      ALLOCATE( aod550_dust_terra(klon))
+      ALLOCATE( aod550_dustsco_terra(klon))
+      ALLOCATE( aod670_terra(klon))
+      ALLOCATE( aod670_tr2_terra(klon))
+      ALLOCATE( aod670_ss_terra(klon))
+      ALLOCATE( aod670_dust_terra(klon))
+      ALLOCATE( aod670_dustsco_terra(klon))
+      ALLOCATE( aod865_terra(klon))
+      ALLOCATE( aod865_tr2_terra(klon))
+      ALLOCATE( aod865_ss_terra(klon))
+      ALLOCATE( aod865_dust_terra(klon))
+      ALLOCATE( aod865_dustsco_terra(klon))
+
+      ALLOCATE( aod550_aqua(klon))
+      ALLOCATE( aod550_tr2_aqua(klon))
+      ALLOCATE( aod550_ss_aqua(klon))
+      ALLOCATE( aod550_dust_aqua(klon))
+      ALLOCATE( aod550_dustsco_aqua(klon))
+      ALLOCATE( aod670_aqua(klon))
+      ALLOCATE( aod670_tr2_aqua(klon))
+      ALLOCATE( aod670_ss_aqua(klon))
+      ALLOCATE( aod670_dust_aqua(klon))
+      ALLOCATE( aod670_dustsco_aqua(klon))
+      ALLOCATE( aod865_aqua(klon))
+      ALLOCATE( aod865_tr2_aqua(klon))
+      ALLOCATE( aod865_ss_aqua(klon))
+      ALLOCATE( aod865_dust_aqua(klon))
+      ALLOCATE( aod865_dustsco_aqua(klon))
+
+      ALLOCATE(  sconc01(klon)     )
+      ALLOCATE(  trm01(klon)     )
+      ALLOCATE(  sconc02(klon)     )
+      ALLOCATE(  trm02(klon)     )
+      ALLOCATE(  sconc03(klon)     )
+      ALLOCATE(  trm03(klon)     )
+      ALLOCATE(  sconc04(klon)     )
+      ALLOCATE(  trm04(klon)     )
+      ALLOCATE(  sconc05(klon)     )
+      ALLOCATE(  trm05(klon)     )
+
+! Lessivage
+      ALLOCATE(  flux01(klon)     )
+      ALLOCATE(  flux02(klon)     )
+      ALLOCATE(  flux03(klon)     )
+      ALLOCATE(  flux04(klon)     )
+      ALLOCATE(  flux05(klon)     )
+      ALLOCATE(  ds01(klon)     )
+      ALLOCATE(  ds02(klon)     )
+      ALLOCATE(  ds03(klon)     )
+      ALLOCATE(  ds04(klon)     )
+      ALLOCATE(  ds05(klon)     )
+      ALLOCATE(  dh01(klon)     )
+      ALLOCATE(  dh02(klon)     )
+      ALLOCATE(  dh03(klon)     )
+      ALLOCATE(  dh04(klon)     )
+      ALLOCATE(  dh05(klon)     )
+      ALLOCATE(  dtrconv01(klon)     )
+      ALLOCATE(  dtrconv02(klon)     )
+      ALLOCATE(  dtrconv03(klon)     )
+      ALLOCATE(  dtrconv04(klon)     )
+      ALLOCATE(  dtrconv05(klon)     )
+      ALLOCATE(  dtherm01(klon)     )
+      ALLOCATE(  dtherm02(klon)     )
+      ALLOCATE(  dtherm03(klon)     )
+      ALLOCATE(  dtherm04(klon)     )
+      ALLOCATE(  dtherm05(klon)     )
+      ALLOCATE(  dhkecv01(klon)     )
+      ALLOCATE(  dhkecv02(klon)     )
+      ALLOCATE(  dhkecv03(klon)     )
+      ALLOCATE(  dhkecv04(klon)     )
+      ALLOCATE(  dhkecv05(klon)     )
+      ALLOCATE(  d_tr_ds01(klon)     )
+      ALLOCATE(  d_tr_ds02(klon)     )
+      ALLOCATE(  d_tr_ds03(klon)     )
+      ALLOCATE(  d_tr_ds04(klon)     )
+      ALLOCATE(  d_tr_ds05(klon)     )
+      ALLOCATE(  dhkelsc01(klon)     )
+      ALLOCATE(  dhkelsc02(klon)     )
+      ALLOCATE(  dhkelsc03(klon)     )
+      ALLOCATE(  dhkelsc04(klon)     )
+      ALLOCATE(  dhkelsc05(klon)     )
+      ALLOCATE(  d_tr_cv01(klon,klev))
+      ALLOCATE(  d_tr_cv02(klon,klev))
+      ALLOCATE(  d_tr_cv03(klon,klev))
+      ALLOCATE(  d_tr_cv04(klon,klev))
+      ALLOCATE(  d_tr_cv05(klon,klev))
+      ALLOCATE(  d_tr_trsp01(klon,klev))
+      ALLOCATE(  d_tr_trsp02(klon,klev))
+      ALLOCATE(  d_tr_trsp03(klon,klev))
+      ALLOCATE(  d_tr_trsp04(klon,klev))
+      ALLOCATE(  d_tr_trsp05(klon,klev))
+      ALLOCATE(  d_tr_sscav01(klon,klev))
+      ALLOCATE(  d_tr_sscav02(klon,klev))
+      ALLOCATE(  d_tr_sscav03(klon,klev))
+      ALLOCATE(  d_tr_sscav04(klon,klev))
+      ALLOCATE(  d_tr_sscav05(klon,klev))
+      ALLOCATE(  d_tr_sat01(klon,klev))
+      ALLOCATE(  d_tr_sat02(klon,klev))
+      ALLOCATE(  d_tr_sat03(klon,klev))
+      ALLOCATE(  d_tr_sat04(klon,klev))
+      ALLOCATE(  d_tr_sat05(klon,klev))
+      ALLOCATE(  d_tr_uscav01(klon,klev))
+      ALLOCATE(  d_tr_uscav02(klon,klev))
+      ALLOCATE(  d_tr_uscav03(klon,klev))
+      ALLOCATE(  d_tr_uscav04(klon,klev))
+      ALLOCATE(  d_tr_uscav05(klon,klev))
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ALLOCATE(  d_tr_insc01(klon,klev))
+      ALLOCATE(  d_tr_insc02(klon,klev))
+      ALLOCATE(  d_tr_insc03(klon,klev))
+      ALLOCATE(  d_tr_insc04(klon,klev))
+      ALLOCATE(  d_tr_insc05(klon,klev))
+      ALLOCATE(  d_tr_bcscav01(klon,klev))
+      ALLOCATE(  d_tr_bcscav02(klon,klev))
+      ALLOCATE(  d_tr_bcscav03(klon,klev))
+      ALLOCATE(  d_tr_bcscav04(klon,klev))
+      ALLOCATE(  d_tr_bcscav05(klon,klev))
+      ALLOCATE(  d_tr_evapls01(klon,klev))
+      ALLOCATE(  d_tr_evapls02(klon,klev))
+      ALLOCATE(  d_tr_evapls03(klon,klev))
+      ALLOCATE(  d_tr_evapls04(klon,klev))
+      ALLOCATE(  d_tr_evapls05(klon,klev))
+      ALLOCATE(  d_tr_ls01(klon,klev))
+      ALLOCATE(  d_tr_ls02(klon,klev))
+      ALLOCATE(  d_tr_ls03(klon,klev))
+      ALLOCATE(  d_tr_ls04(klon,klev))
+      ALLOCATE(  d_tr_ls05(klon,klev))
+
+      ALLOCATE(  d_tr_dyn01(klon,klev))
+      ALLOCATE(  d_tr_dyn02(klon,klev))
+      ALLOCATE(  d_tr_dyn03(klon,klev))
+      ALLOCATE(  d_tr_dyn04(klon,klev))
+      ALLOCATE(  d_tr_dyn05(klon,klev))
+
+      ALLOCATE(  d_tr_cl01(klon,klev))
+      ALLOCATE(  d_tr_cl02(klon,klev))
+      ALLOCATE(  d_tr_cl03(klon,klev))
+      ALLOCATE(  d_tr_cl04(klon,klev))
+      ALLOCATE(  d_tr_cl05(klon,klev))
+      ALLOCATE(  d_tr_th01(klon,klev))
+      ALLOCATE(  d_tr_th02(klon,klev))
+      ALLOCATE(  d_tr_th03(klon,klev))
+      ALLOCATE(  d_tr_th04(klon,klev))
+      ALLOCATE(  d_tr_th05(klon,klev))
+
+      ALLOCATE( sed_ss(klon))
+      ALLOCATE( sed_dust(klon))
+      ALLOCATE( sed_dustsco(klon))
+      ALLOCATE( his_g2pgas(klon))
+      ALLOCATE( his_g2paer(klon))
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ALLOCATE( sed_ss3D(klon,klev))
+      ALLOCATE( sed_dust3D(klon,klev))
+      ALLOCATE( sed_dustsco3D(klon,klev))
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! histrac_spl
+!
+      ALLOCATE( fluxbb(klon))
+      ALLOCATE( fluxff(klon))
+      ALLOCATE( fluxbcbb(klon))
+      ALLOCATE( fluxbcff(klon))
+      ALLOCATE( fluxbcnff(klon))
+      ALLOCATE( fluxbcba(klon))
+      ALLOCATE( fluxbc(klon))
+      ALLOCATE( fluxombb(klon))
+      ALLOCATE( fluxomff(klon))
+      ALLOCATE( fluxomnff(klon))
+      ALLOCATE( fluxomba(klon))
+      ALLOCATE( fluxomnat(klon))
+      ALLOCATE( fluxom(klon))
+      ALLOCATE( fluxh2sff(klon))
+      ALLOCATE( fluxh2snff(klon))
+      ALLOCATE( fluxso2ff(klon))
+      ALLOCATE( fluxso2nff(klon))
+      ALLOCATE( fluxso2bb(klon))
+      ALLOCATE( fluxso2vol(klon))
+      ALLOCATE( fluxso2ba(klon))
+      ALLOCATE( fluxso2(klon))
+      ALLOCATE( fluxso4ff(klon))
+      ALLOCATE( fluxso4nff(klon))
+      ALLOCATE( fluxso4bb(klon))
+      ALLOCATE( fluxso4ba(klon))
+      ALLOCATE( fluxso4(klon))
+      ALLOCATE( fluxdms(klon))
+      ALLOCATE( fluxh2sbio(klon))
+      ALLOCATE( fluxdustec(klon))
+      ALLOCATE( fluxddfine(klon))
+      ALLOCATE( fluxddcoa(klon))
+      ALLOCATE( fluxddsco(klon))
+      ALLOCATE( fluxdd(klon))
+      ALLOCATE( fluxssfine(klon))
+      ALLOCATE( fluxsscoa(klon))
+      ALLOCATE( fluxss(klon))
+      ALLOCATE( flux_sparam_ind(klon))
+      ALLOCATE( flux_sparam_bb(klon))
+      ALLOCATE( flux_sparam_ff(klon))
+      ALLOCATE( flux_sparam_ddfine(klon))
+      ALLOCATE( flux_sparam_ddcoa(klon))
+      ALLOCATE( flux_sparam_ddsco(klon))
+      ALLOCATE( flux_sparam_ssfine(klon))
+      ALLOCATE( flux_sparam_sscoa(klon))
+      ALLOCATE( u10m_ss(klon))
+      ALLOCATE( v10m_ss(klon))
+
+!AS: dans phys_output_write_spl, hors spla_output_write.h
+!------------------------------------------------------
+      ALLOCATE(d_tr_cl(klon,klev,nbtr))
+      ALLOCATE(d_tr_th(klon,klev,nbtr))
+      ALLOCATE(d_tr_cv(klon,klev,nbtr))
+      ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr))
+      ALLOCATE(d_tr_lessi_nucl(klon,klev,nbtr))
+      ALLOCATE(d_tr_insc(klon,klev,nbtr))
+      ALLOCATE(d_tr_bcscav(klon,klev,nbtr))
+      ALLOCATE(d_tr_evapls(klon,klev,nbtr))
+      ALLOCATE(d_tr_ls(klon,klev,nbtr))
+      ALLOCATE(d_tr_trsp(klon,klev,nbtr))
+      ALLOCATE(d_tr_sscav(klon,klev,nbtr))
+      ALLOCATE(d_tr_sat(klon,klev,nbtr))
+      ALLOCATE(d_tr_uscav(klon,klev,nbtr))
+      
+END SUBROUTINE phytracr_spl_out_init
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 SUBROUTINE phytracr_spl_ini(klon,nbreg_ind,nbreg_bb,nbreg_dust,nbreg_wstardust)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1081,5 +1341,6 @@
   print *,'JE: jD_cur:',jD_cur,' ijulday:',ijulday,' jH_cur:',jH_cur,' pdtphys:',pdtphys
   print *,'JE: now read_newemissions:'
-  print *,'lmt_so2ff_l AVANT' , MINVAL(lmt_so2ff_l), MAXVAL(lmt_so2ff_l)
+!AS: La ligne suivante fait planter a l'execution : lmt_so2ff_l pas initialise
+!  print *,'lmt_so2ff_l AVANT' , MINVAL(lmt_so2ff_l), MAXVAL(lmt_so2ff_l)
   call read_newemissions(ijulday,jH_cur ,edgar, flag_dms,debutphy, & !I
                          pdtphys, lafin, nbjour, pctsrf,  &       !I
@@ -1289,4 +1550,6 @@
 
       ! convective KE lessivage aer params:
+      ! AS: #DFB (Binta) a aussi teste ccntrAA_spla=ccntrENV_spla=0.9/1.0/0.9/0.9
+      !     mais effet negligeable sur l'AOD
       ccntrAA_spla(:)=0.
       if(id_prec>0)  ccntrAA_spla(id_prec)=-9999.
@@ -1302,5 +1565,5 @@
       if(id_codu>0)  ccntrENV_spla(id_codu)=0.7
       if(id_scdu>0)  ccntrENV_spla(id_scdu)=0.7
-
+      ! #DFB
       coefcoli_spla(:)=0.
       if(id_prec>0)  coefcoli_spla(id_prec)=-9999.
@@ -1875,211 +2138,213 @@
 !$OMP MASTER
 
-      ALLOCATE(d_tr_cl(klon,klev,nbtr),d_tr_dry(klon,nbtr))
+      !ALLOCATE(d_tr_cl(klon,klev,nbtr),d_tr_dry(klon,nbtr))
+      ALLOCATE(d_tr_dry(klon,nbtr))
       ALLOCATE(flux_tr_dry(klon,nbtr),d_tr_dec(klon,klev,nbtr))
-      ALLOCATE(d_tr_cv(klon,klev,nbtr))
-      ALLOCATE(d_tr_insc(klon,klev,nbtr),d_tr_bcscav(klon,klev,nbtr))
-      ALLOCATE(d_tr_evapls(klon,klev,nbtr),d_tr_ls(klon,klev,nbtr))
-      ALLOCATE(qPrls(klon,nbtr),d_tr_trsp(klon,klev,nbtr))
-      ALLOCATE(d_tr_sscav(klon,klev,nbtr),d_tr_sat(klon,klev,nbtr))
-      ALLOCATE(d_tr_uscav(klon,klev,nbtr),qPr(klon,klev,nbtr))
+      !ALLOCATE(d_tr_cv(klon,klev,nbtr))
+      !ALLOCATE(d_tr_insc(klon,klev,nbtr),d_tr_bcscav(klon,klev,nbtr))
+      !ALLOCATE(d_tr_evapls(klon,klev,nbtr),d_tr_ls(klon,klev,nbtr))
+      !ALLOCATE(qPrls(klon,nbtr),d_tr_trsp(klon,klev,nbtr))
+      ALLOCATE(qPrls(klon,nbtr),qPr(klon,klev,nbtr))
+      !ALLOCATE(d_tr_sscav(klon,klev,nbtr),d_tr_sat(klon,klev,nbtr))
+      !ALLOCATE(d_tr_uscav(klon,klev,nbtr),qPr(klon,klev,nbtr))
       ALLOCATE(qDi(klon,klev,nbtr))
       ALLOCATE(qPa(klon,klev,nbtr),qMel(klon,klev,nbtr))
       ALLOCATE(qTrdi(klon,klev,nbtr),dtrcvMA(klon,klev,nbtr))
-      ALLOCATE(d_tr_th(klon,klev,nbtr))
-      ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr))
-      ALLOCATE(d_tr_lessi_nucl(klon,klev,nbtr))
-
-      ALLOCATE( diff_aod550_tot(klon)     )
-      ALLOCATE( diag_aod670_tot(klon)     )
-      ALLOCATE( diag_aod865_tot(klon)     )
-      ALLOCATE( diff_aod550_tr2(klon)     )
-      ALLOCATE( diag_aod670_tr2(klon)     )
-      ALLOCATE( diag_aod865_tr2(klon)     )
-      ALLOCATE( diag_aod550_ss(klon)      )
-      ALLOCATE( diag_aod670_ss(klon)      )
-      ALLOCATE( diag_aod865_ss(klon)      )
-      ALLOCATE( diag_aod550_dust(klon)    )
-      ALLOCATE( diag_aod670_dust(klon)    )
-      ALLOCATE( diag_aod865_dust(klon)    )
-      ALLOCATE( diag_aod550_dustsco(klon)  )
-      ALLOCATE( diag_aod670_dustsco(klon)  )
-      ALLOCATE( diag_aod865_dustsco(klon)  )
-
-
-      ALLOCATE(  sconc01(klon)     )
-      ALLOCATE(  trm01(klon)     )
-      ALLOCATE(  sconc02(klon)     )
-      ALLOCATE(  trm02(klon)     )
-      ALLOCATE(  sconc03(klon)     )
-      ALLOCATE(  trm03(klon)     )
-      ALLOCATE(  sconc04(klon)     )
-      ALLOCATE(  trm04(klon)     )
-      ALLOCATE(  sconc05(klon)     )
-      ALLOCATE(  trm05(klon)     )
-
-
-      ALLOCATE(  flux01(klon)     )
-      ALLOCATE(  flux02(klon)     )
-      ALLOCATE(  flux03(klon)     )
-      ALLOCATE(  flux04(klon)     )
-      ALLOCATE(  flux05(klon)     )
-      ALLOCATE(  ds01(klon)     )
-      ALLOCATE(  ds02(klon)     )
-      ALLOCATE(  ds03(klon)     )
-      ALLOCATE(  ds04(klon)     )
-      ALLOCATE(  ds05(klon)     )
-      ALLOCATE(  dh01(klon)     )
-      ALLOCATE(  dh02(klon)     )
-      ALLOCATE(  dh03(klon)     )
-      ALLOCATE(  dh04(klon)     )
-      ALLOCATE(  dh05(klon)     )
-      ALLOCATE(  dtrconv01(klon)     )
-      ALLOCATE(  dtrconv02(klon)     )
-      ALLOCATE(  dtrconv03(klon)     )
-      ALLOCATE(  dtrconv04(klon)     )
-      ALLOCATE(  dtrconv05(klon)     )
-      ALLOCATE(  dtherm01(klon)     )
-      ALLOCATE(  dtherm02(klon)     )
-      ALLOCATE(  dtherm03(klon)     )
-      ALLOCATE(  dtherm04(klon)     )
-      ALLOCATE(  dtherm05(klon)     )
-      ALLOCATE(  dhkecv01(klon)     )
-      ALLOCATE(  dhkecv02(klon)     )
-      ALLOCATE(  dhkecv03(klon)     )
-      ALLOCATE(  dhkecv04(klon)     )
-      ALLOCATE(  dhkecv05(klon)     )
-      ALLOCATE(  d_tr_ds01(klon)     )
-      ALLOCATE(  d_tr_ds02(klon)     )
-      ALLOCATE(  d_tr_ds03(klon)     )
-      ALLOCATE(  d_tr_ds04(klon)     )
-      ALLOCATE(  d_tr_ds05(klon)     )
-      ALLOCATE(  dhkelsc01(klon)     )
-      ALLOCATE(  dhkelsc02(klon)     )
-      ALLOCATE(  dhkelsc03(klon)     )
-      ALLOCATE(  dhkelsc04(klon)     )
-      ALLOCATE(  dhkelsc05(klon)     )
-      ALLOCATE(  d_tr_cv01(klon,klev))
-      ALLOCATE(  d_tr_cv02(klon,klev))
-      ALLOCATE(  d_tr_cv03(klon,klev))
-      ALLOCATE(  d_tr_cv04(klon,klev))
-      ALLOCATE(  d_tr_cv05(klon,klev))
-      ALLOCATE(  d_tr_trsp01(klon,klev))
-      ALLOCATE(  d_tr_trsp02(klon,klev))
-      ALLOCATE(  d_tr_trsp03(klon,klev))
-      ALLOCATE(  d_tr_trsp04(klon,klev))
-      ALLOCATE(  d_tr_trsp05(klon,klev))
-      ALLOCATE(  d_tr_sscav01(klon,klev))
-      ALLOCATE(  d_tr_sscav02(klon,klev))
-      ALLOCATE(  d_tr_sscav03(klon,klev))
-      ALLOCATE(  d_tr_sscav04(klon,klev))
-      ALLOCATE(  d_tr_sscav05(klon,klev))
-      ALLOCATE(  d_tr_sat01(klon,klev))
-      ALLOCATE(  d_tr_sat02(klon,klev))
-      ALLOCATE(  d_tr_sat03(klon,klev))
-      ALLOCATE(  d_tr_sat04(klon,klev))
-      ALLOCATE(  d_tr_sat05(klon,klev))
-      ALLOCATE(  d_tr_uscav01(klon,klev))
-      ALLOCATE(  d_tr_uscav02(klon,klev))
-      ALLOCATE(  d_tr_uscav03(klon,klev))
-      ALLOCATE(  d_tr_uscav04(klon,klev))
-      ALLOCATE(  d_tr_uscav05(klon,klev))
+      !ALLOCATE(d_tr_th(klon,klev,nbtr))
+      !ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr))
+      !ALLOCATE(d_tr_lessi_nucl(klon,klev,nbtr))
+
+      !ALLOCATE( diff_aod550_tot(klon)     )
+      !ALLOCATE( diag_aod670_tot(klon)     )
+      !ALLOCATE( diag_aod865_tot(klon)     )
+      !ALLOCATE( diff_aod550_tr2(klon)     )
+      !ALLOCATE( diag_aod670_tr2(klon)     )
+      !ALLOCATE( diag_aod865_tr2(klon)     )
+      !ALLOCATE( diag_aod550_ss(klon)      )
+      !ALLOCATE( diag_aod670_ss(klon)      )
+      !ALLOCATE( diag_aod865_ss(klon)      )
+      !ALLOCATE( diag_aod550_dust(klon)    )
+      !ALLOCATE( diag_aod670_dust(klon)    )
+      !ALLOCATE( diag_aod865_dust(klon)    )
+      !ALLOCATE( diag_aod550_dustsco(klon)  )
+      !ALLOCATE( diag_aod670_dustsco(klon)  )
+      !ALLOCATE( diag_aod865_dustsco(klon)  )
+
+
+      !ALLOCATE(  sconc01(klon)     )
+      !ALLOCATE(  trm01(klon)     )
+      !ALLOCATE(  sconc02(klon)     )
+      !ALLOCATE(  trm02(klon)     )
+      !ALLOCATE(  sconc03(klon)     )
+      !ALLOCATE(  trm03(klon)     )
+      !ALLOCATE(  sconc04(klon)     )
+      !ALLOCATE(  trm04(klon)     )
+      !ALLOCATE(  sconc05(klon)     )
+      !ALLOCATE(  trm05(klon)     )
+
+
+      !ALLOCATE(  flux01(klon)     )
+      !ALLOCATE(  flux02(klon)     )
+      !ALLOCATE(  flux03(klon)     )
+      !ALLOCATE(  flux04(klon)     )
+      !ALLOCATE(  flux05(klon)     )
+      !ALLOCATE(  ds01(klon)     )
+      !ALLOCATE(  ds02(klon)     )
+      !ALLOCATE(  ds03(klon)     )
+      !ALLOCATE(  ds04(klon)     )
+      !ALLOCATE(  ds05(klon)     )
+      !ALLOCATE(  dh01(klon)     )
+      !ALLOCATE(  dh02(klon)     )
+      !ALLOCATE(  dh03(klon)     )
+      !ALLOCATE(  dh04(klon)     )
+      !ALLOCATE(  dh05(klon)     )
+      !ALLOCATE(  dtrconv01(klon)     )
+      !ALLOCATE(  dtrconv02(klon)     )
+      !ALLOCATE(  dtrconv03(klon)     )
+      !ALLOCATE(  dtrconv04(klon)     )
+      !ALLOCATE(  dtrconv05(klon)     )
+      !ALLOCATE(  dtherm01(klon)     )
+      !ALLOCATE(  dtherm02(klon)     )
+      !ALLOCATE(  dtherm03(klon)     )
+      !ALLOCATE(  dtherm04(klon)     )
+      !ALLOCATE(  dtherm05(klon)     )
+      !ALLOCATE(  dhkecv01(klon)     )
+      !ALLOCATE(  dhkecv02(klon)     )
+      !ALLOCATE(  dhkecv03(klon)     )
+      !ALLOCATE(  dhkecv04(klon)     )
+      !ALLOCATE(  dhkecv05(klon)     )
+      !ALLOCATE(  d_tr_ds01(klon)     )
+      !ALLOCATE(  d_tr_ds02(klon)     )
+      !ALLOCATE(  d_tr_ds03(klon)     )
+      !ALLOCATE(  d_tr_ds04(klon)     )
+      !ALLOCATE(  d_tr_ds05(klon)     )
+      !ALLOCATE(  dhkelsc01(klon)     )
+      !ALLOCATE(  dhkelsc02(klon)     )
+      !ALLOCATE(  dhkelsc03(klon)     )
+      !ALLOCATE(  dhkelsc04(klon)     )
+      !ALLOCATE(  dhkelsc05(klon)     )
+      !ALLOCATE(  d_tr_cv01(klon,klev))
+      !ALLOCATE(  d_tr_cv02(klon,klev))
+      !ALLOCATE(  d_tr_cv03(klon,klev))
+      !ALLOCATE(  d_tr_cv04(klon,klev))
+      !ALLOCATE(  d_tr_cv05(klon,klev))
+      !ALLOCATE(  d_tr_trsp01(klon,klev))
+      !ALLOCATE(  d_tr_trsp02(klon,klev))
+      !ALLOCATE(  d_tr_trsp03(klon,klev))
+      !ALLOCATE(  d_tr_trsp04(klon,klev))
+      !ALLOCATE(  d_tr_trsp05(klon,klev))
+      !ALLOCATE(  d_tr_sscav01(klon,klev))
+      !ALLOCATE(  d_tr_sscav02(klon,klev))
+      !ALLOCATE(  d_tr_sscav03(klon,klev))
+      !ALLOCATE(  d_tr_sscav04(klon,klev))
+      !ALLOCATE(  d_tr_sscav05(klon,klev))
+      !ALLOCATE(  d_tr_sat01(klon,klev))
+      !ALLOCATE(  d_tr_sat02(klon,klev))
+      !ALLOCATE(  d_tr_sat03(klon,klev))
+      !ALLOCATE(  d_tr_sat04(klon,klev))
+      !ALLOCATE(  d_tr_sat05(klon,klev))
+      !ALLOCATE(  d_tr_uscav01(klon,klev))
+      !ALLOCATE(  d_tr_uscav02(klon,klev))
+      !ALLOCATE(  d_tr_uscav03(klon,klev))
+      !ALLOCATE(  d_tr_uscav04(klon,klev))
+      !ALLOCATE(  d_tr_uscav05(klon,klev))
       
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ALLOCATE(  d_tr_insc01(klon,klev))
-      ALLOCATE(  d_tr_insc02(klon,klev))
-      ALLOCATE(  d_tr_insc03(klon,klev))
-      ALLOCATE(  d_tr_insc04(klon,klev))
-      ALLOCATE(  d_tr_insc05(klon,klev))
-      ALLOCATE(  d_tr_bcscav01(klon,klev))
-      ALLOCATE(  d_tr_bcscav02(klon,klev))
-      ALLOCATE(  d_tr_bcscav03(klon,klev))
-      ALLOCATE(  d_tr_bcscav04(klon,klev))
-      ALLOCATE(  d_tr_bcscav05(klon,klev))
-      ALLOCATE(  d_tr_evapls01(klon,klev))
-      ALLOCATE(  d_tr_evapls02(klon,klev))
-      ALLOCATE(  d_tr_evapls03(klon,klev))
-      ALLOCATE(  d_tr_evapls04(klon,klev))
-      ALLOCATE(  d_tr_evapls05(klon,klev))
-      ALLOCATE(  d_tr_ls01(klon,klev))
-      ALLOCATE(  d_tr_ls02(klon,klev))
-      ALLOCATE(  d_tr_ls03(klon,klev))
-      ALLOCATE(  d_tr_ls04(klon,klev))
-      ALLOCATE(  d_tr_ls05(klon,klev))
-      ALLOCATE(  d_tr_dyn01(klon,klev))
-      ALLOCATE(  d_tr_dyn02(klon,klev))
-      ALLOCATE(  d_tr_dyn03(klon,klev))
-      ALLOCATE(  d_tr_dyn04(klon,klev))
-      ALLOCATE(  d_tr_dyn05(klon,klev))
-      ALLOCATE(  d_tr_cl01(klon,klev))
-      ALLOCATE(  d_tr_cl02(klon,klev))
-      ALLOCATE(  d_tr_cl03(klon,klev))
-      ALLOCATE(  d_tr_cl04(klon,klev))
-      ALLOCATE(  d_tr_cl05(klon,klev))
-      ALLOCATE(  d_tr_th01(klon,klev))
-      ALLOCATE(  d_tr_th02(klon,klev))
-      ALLOCATE(  d_tr_th03(klon,klev))
-      ALLOCATE(  d_tr_th04(klon,klev))
-      ALLOCATE(  d_tr_th05(klon,klev))
-
-      ALLOCATE( sed_ss3D(klon,klev))
-      ALLOCATE( sed_dust3D(klon,klev))
-      ALLOCATE( sed_dustsco3D(klon,klev))
+      !ALLOCATE(  d_tr_insc01(klon,klev))
+      !ALLOCATE(  d_tr_insc02(klon,klev))
+      !ALLOCATE(  d_tr_insc03(klon,klev))
+      !ALLOCATE(  d_tr_insc04(klon,klev))
+      !ALLOCATE(  d_tr_insc05(klon,klev))
+      !ALLOCATE(  d_tr_bcscav01(klon,klev))
+      !ALLOCATE(  d_tr_bcscav02(klon,klev))
+      !ALLOCATE(  d_tr_bcscav03(klon,klev))
+      !ALLOCATE(  d_tr_bcscav04(klon,klev))
+      !ALLOCATE(  d_tr_bcscav05(klon,klev))
+      !ALLOCATE(  d_tr_evapls01(klon,klev))
+      !ALLOCATE(  d_tr_evapls02(klon,klev))
+      !ALLOCATE(  d_tr_evapls03(klon,klev))
+      !ALLOCATE(  d_tr_evapls04(klon,klev))
+      !ALLOCATE(  d_tr_evapls05(klon,klev))
+      !ALLOCATE(  d_tr_ls01(klon,klev))
+      !ALLOCATE(  d_tr_ls02(klon,klev))
+      !ALLOCATE(  d_tr_ls03(klon,klev))
+      !ALLOCATE(  d_tr_ls04(klon,klev))
+      !ALLOCATE(  d_tr_ls05(klon,klev))
+      !ALLOCATE(  d_tr_dyn01(klon,klev))
+      !ALLOCATE(  d_tr_dyn02(klon,klev))
+      !ALLOCATE(  d_tr_dyn03(klon,klev))
+      !ALLOCATE(  d_tr_dyn04(klon,klev))
+      !ALLOCATE(  d_tr_dyn05(klon,klev))
+      !ALLOCATE(  d_tr_cl01(klon,klev))
+      !ALLOCATE(  d_tr_cl02(klon,klev))
+      !ALLOCATE(  d_tr_cl03(klon,klev))
+      !ALLOCATE(  d_tr_cl04(klon,klev))
+      !ALLOCATE(  d_tr_cl05(klon,klev))
+      !ALLOCATE(  d_tr_th01(klon,klev))
+      !ALLOCATE(  d_tr_th02(klon,klev))
+      !ALLOCATE(  d_tr_th03(klon,klev))
+      !ALLOCATE(  d_tr_th04(klon,klev))
+      !ALLOCATE(  d_tr_th05(klon,klev))
+
+      !ALLOCATE( sed_ss3D(klon,klev))
+      !ALLOCATE( sed_dust3D(klon,klev))
+      !ALLOCATE( sed_dustsco3D(klon,klev))
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-      ALLOCATE( sed_ss(klon))
-      ALLOCATE( sed_dust(klon))
-      ALLOCATE( sed_dustsco(klon))
-      ALLOCATE( his_g2pgas(klon))
-      ALLOCATE( his_g2paer(klon))
-
-      ALLOCATE( fluxbb(klon))
-      ALLOCATE( fluxff(klon))
-      ALLOCATE( fluxbcbb(klon))
-      ALLOCATE( fluxbcff(klon))
-      ALLOCATE( fluxbcnff(klon))
-      ALLOCATE( fluxbcba(klon))
-      ALLOCATE( fluxbc(klon))
-      ALLOCATE( fluxombb(klon))
-      ALLOCATE( fluxomff(klon))
-      ALLOCATE( fluxomnff(klon))
-      ALLOCATE( fluxomba(klon))
-      ALLOCATE( fluxomnat(klon))
-      ALLOCATE( fluxom(klon))
-      ALLOCATE( fluxh2sff(klon))
-      ALLOCATE( fluxh2snff(klon))
-      ALLOCATE( fluxso2ff(klon))
-      ALLOCATE( fluxso2nff(klon))
-      ALLOCATE( fluxso2bb(klon))
-      ALLOCATE( fluxso2vol(klon))
-      ALLOCATE( fluxso2ba(klon))
-      ALLOCATE( fluxso2(klon))
-      ALLOCATE( fluxso4ff(klon))
-      ALLOCATE( fluxso4nff(klon))
-      ALLOCATE( fluxso4bb(klon))
-      ALLOCATE( fluxso4ba(klon))
-      ALLOCATE( fluxso4(klon))
-      ALLOCATE( fluxdms(klon))
-      ALLOCATE( fluxh2sbio(klon))
-      ALLOCATE( fluxdustec(klon))
-      ALLOCATE( fluxddfine(klon))
-      ALLOCATE( fluxddcoa(klon))
-      ALLOCATE( fluxddsco(klon))
-      ALLOCATE( fluxdd(klon))
-      ALLOCATE( fluxssfine(klon))
-      ALLOCATE( fluxsscoa(klon))
-      ALLOCATE( fluxss(klon))
-      ALLOCATE( flux_sparam_ind(klon))
-      ALLOCATE( flux_sparam_bb(klon))
-      ALLOCATE( flux_sparam_ff(klon))
-      ALLOCATE( flux_sparam_ddfine(klon))
-      ALLOCATE( flux_sparam_ddcoa(klon))
-      ALLOCATE( flux_sparam_ddsco(klon))
-      ALLOCATE( flux_sparam_ssfine(klon))
-      ALLOCATE( flux_sparam_sscoa(klon))
-      ALLOCATE( u10m_ss(klon))
-      ALLOCATE( v10m_ss(klon))
+      !ALLOCATE( sed_ss(klon))
+      !ALLOCATE( sed_dust(klon))
+      !ALLOCATE( sed_dustsco(klon))
+      !ALLOCATE( his_g2pgas(klon))
+      !ALLOCATE( his_g2paer(klon))
+
+      !ALLOCATE( fluxbb(klon))
+      !ALLOCATE( fluxff(klon))
+      !ALLOCATE( fluxbcbb(klon))
+      !ALLOCATE( fluxbcff(klon))
+      !ALLOCATE( fluxbcnff(klon))
+      !ALLOCATE( fluxbcba(klon))
+      !ALLOCATE( fluxbc(klon))
+      !ALLOCATE( fluxombb(klon))
+      !ALLOCATE( fluxomff(klon))
+      !ALLOCATE( fluxomnff(klon))
+      !ALLOCATE( fluxomba(klon))
+      !ALLOCATE( fluxomnat(klon))
+      !ALLOCATE( fluxom(klon))
+      !ALLOCATE( fluxh2sff(klon))
+      !ALLOCATE( fluxh2snff(klon))
+      !ALLOCATE( fluxso2ff(klon))
+      !ALLOCATE( fluxso2nff(klon))
+      !ALLOCATE( fluxso2bb(klon))
+      !ALLOCATE( fluxso2vol(klon))
+      !ALLOCATE( fluxso2ba(klon))
+      !ALLOCATE( fluxso2(klon))
+      !ALLOCATE( fluxso4ff(klon))
+      !ALLOCATE( fluxso4nff(klon))
+      !ALLOCATE( fluxso4bb(klon))
+      !ALLOCATE( fluxso4ba(klon))
+      !ALLOCATE( fluxso4(klon))
+      !ALLOCATE( fluxdms(klon))
+      !ALLOCATE( fluxh2sbio(klon))
+      !ALLOCATE( fluxdustec(klon))
+      !ALLOCATE( fluxddfine(klon))
+      !ALLOCATE( fluxddcoa(klon))
+      !ALLOCATE( fluxddsco(klon))
+      !ALLOCATE( fluxdd(klon))
+      !ALLOCATE( fluxssfine(klon))
+      !ALLOCATE( fluxsscoa(klon))
+      !ALLOCATE( fluxss(klon))
+      !ALLOCATE( flux_sparam_ind(klon))
+      !ALLOCATE( flux_sparam_bb(klon))
+      !ALLOCATE( flux_sparam_ff(klon))
+      !ALLOCATE( flux_sparam_ddfine(klon))
+      !ALLOCATE( flux_sparam_ddcoa(klon))
+      !ALLOCATE( flux_sparam_ddsco(klon))
+      !ALLOCATE( flux_sparam_ssfine(klon))
+      !ALLOCATE( flux_sparam_sscoa(klon))
+      !ALLOCATE( u10m_ss(klon))
+      !ALLOCATE( v10m_ss(klon))
 
 
@@ -2117,35 +2382,35 @@
 !       ALLOCATE(aod865_terra(klon)) 
 
-      ALLOCATE( aod550_terra(klon))  
-      ALLOCATE( aod550_tr2_terra(klon))  
-      ALLOCATE( aod550_ss_terra(klon))   
-      ALLOCATE( aod550_dust_terra(klon))   
-      ALLOCATE( aod550_dustsco_terra(klon))   
-      ALLOCATE( aod670_terra(klon))   
-      ALLOCATE( aod670_tr2_terra(klon))  
-      ALLOCATE( aod670_ss_terra(klon))  
-      ALLOCATE( aod670_dust_terra(klon))  
-      ALLOCATE( aod670_dustsco_terra(klon))  
-      ALLOCATE( aod865_terra(klon))   
-      ALLOCATE( aod865_tr2_terra(klon))  
-      ALLOCATE( aod865_ss_terra(klon))  
-      ALLOCATE( aod865_dust_terra(klon))  
-      ALLOCATE( aod865_dustsco_terra(klon))  
-
-      ALLOCATE( aod550_aqua(klon))  
-      ALLOCATE( aod550_tr2_aqua(klon))  
-      ALLOCATE( aod550_ss_aqua(klon))   
-      ALLOCATE( aod550_dust_aqua(klon))   
-      ALLOCATE( aod550_dustsco_aqua(klon))   
-      ALLOCATE( aod670_aqua(klon))   
-      ALLOCATE( aod670_tr2_aqua(klon))  
-      ALLOCATE( aod670_ss_aqua(klon))  
-      ALLOCATE( aod670_dust_aqua(klon))  
-      ALLOCATE( aod670_dustsco_aqua(klon))  
-      ALLOCATE( aod865_aqua(klon))   
-      ALLOCATE( aod865_tr2_aqua(klon))  
-      ALLOCATE( aod865_ss_aqua(klon))  
-      ALLOCATE( aod865_dust_aqua(klon))  
-      ALLOCATE( aod865_dustsco_aqua(klon))  
+      !ALLOCATE( aod550_terra(klon))  
+      !ALLOCATE( aod550_tr2_terra(klon))  
+      !ALLOCATE( aod550_ss_terra(klon))   
+      !ALLOCATE( aod550_dust_terra(klon))   
+      !ALLOCATE( aod550_dustsco_terra(klon))   
+      !ALLOCATE( aod670_terra(klon))   
+      !ALLOCATE( aod670_tr2_terra(klon))  
+      !ALLOCATE( aod670_ss_terra(klon))  
+      !ALLOCATE( aod670_dust_terra(klon))  
+      !ALLOCATE( aod670_dustsco_terra(klon))  
+      !ALLOCATE( aod865_terra(klon))   
+      !ALLOCATE( aod865_tr2_terra(klon))  
+      !ALLOCATE( aod865_ss_terra(klon))  
+      !ALLOCATE( aod865_dust_terra(klon))  
+      !ALLOCATE( aod865_dustsco_terra(klon))  
+
+      !ALLOCATE( aod550_aqua(klon))  
+      !ALLOCATE( aod550_tr2_aqua(klon))  
+      !ALLOCATE( aod550_ss_aqua(klon))   
+      !ALLOCATE( aod550_dust_aqua(klon))   
+      !ALLOCATE( aod550_dustsco_aqua(klon))   
+      !ALLOCATE( aod670_aqua(klon))   
+      !ALLOCATE( aod670_tr2_aqua(klon))  
+      !ALLOCATE( aod670_ss_aqua(klon))  
+      !ALLOCATE( aod670_dust_aqua(klon))  
+      !ALLOCATE( aod670_dustsco_aqua(klon))  
+      !ALLOCATE( aod865_aqua(klon))   
+      !ALLOCATE( aod865_tr2_aqua(klon))  
+      !ALLOCATE( aod865_ss_aqua(klon))  
+      !ALLOCATE( aod865_dust_aqua(klon))  
+      !ALLOCATE( aod865_dustsco_aqua(klon))  
  
 
@@ -3682,6 +3947,7 @@
 ! choix du lessivage
       IF (iflag_lscav .EQ. 3 .OR. iflag_lscav .EQ. 4) THEN
-      print *,'JE iflag_lscav',iflag_lscav
-       DO it = 1, nbtr
+      !IF (.false.) THEN  ! test #DFB (Binta) sans lsc_scav_spl
+        print *,'JE iflag_lscav',iflag_lscav
+        DO it = 1, nbtr
 
 !       incloud scavenging and removal by large scale rain ! orig : ql_incl
@@ -3694,5 +3960,5 @@
 !     .               t_seri,tr_seri,d_tr_insc, 
 !     .               d_tr_bcscav,d_tr_evapls,qPrls)
-       CALL lsc_scav_spl(pdtphys,it,iflag_lscav,ql_incl,prfl,psfl,  &
+          CALL lsc_scav_spl(pdtphys,it,iflag_lscav,ql_incl,prfl,psfl,  &
                     rneb,beta_fisrt, beta_v1,pplay,paprs,      &
                     t_seri,tr_seri,d_tr_insc,                  &
@@ -3702,27 +3968,33 @@
 
 !large scale scavenging tendency
-       DO k = 1, klev
-        DO i = 1, klon
-         d_tr_ls(i,k,it)=d_tr_insc(i,k,it)+d_tr_bcscav(i,k,it) &
+          DO k = 1, klev
+           DO i = 1, klon
+                d_tr_ls(i,k,it)=d_tr_insc(i,k,it)+d_tr_bcscav(i,k,it) &
                         +d_tr_evapls(i,k,it)
-         tr_seri(i,k,it)=tr_seri(i,k,it)+d_tr_ls(i,k,it)
-          tmp_var(i,k)=d_tr_ls(i,k,it)
-        ENDDO
-       ENDDO
-
-       CALL kg_to_cm3(pplay,t_seri,tmp_var)
-         DO k=1,klev
-            DO i=1,klon
+                tr_seri(i,k,it)=tr_seri(i,k,it)+d_tr_ls(i,k,it)
+                         tmp_var(i,k)=d_tr_ls(i,k,it)
+           ENDDO
+          ENDDO
+
+          CALL kg_to_cm3(pplay,t_seri,tmp_var)
+
+          DO k=1,klev
+           DO i=1,klon
             his_dhkelsc(i,it)=his_dhkelsc(i,it)-tmp_var(i,k)    &
                      /RNAVO*masse(it)*1.e3*1.e6*zdz(i,k)/pdtphys
      
-            END DO
-         END DO
-
-       END DO  !tr
+           END DO
+          END DO
+
+        END DO  !it=1,nbtr
+
       ELSE
-        his_dhkelsc(i,it)=0.0
         print *,'WARNING: NO lsc_scav, Please choose iflag_lscav=3 or 4'
-       ENDIF !iflag_lscav
+        DO it = 1, nbtr
+          DO i=1,klon
+            his_dhkelsc(i,it)=0.0
+          END DO  ! klon
+         END DO  !it=1,nbtr
+      ENDIF !iflag_lscav 
 
        print *,' AFTER lsc_scav '
@@ -5599,4 +5871,12 @@
       d_tr_th04(i,k)=0.
       d_tr_th05(i,k)=0.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+        ENDDO
+      ENDDO
+
+      IF(1==0) THEN 
+      ! calcul in original trunk version; problem: budget not closed. Corrected in "ELSE"
+      DO i=1, klon
+        DO k=1,klev
+
       if(id_prec>0)        d_tr_cv01(i,k)   =d_tr_cv_o(i,k,id_prec)
       if(id_fine>0)        d_tr_cv02(i,k)   =d_tr_cv_o(i,k,id_fine)
@@ -5641,5 +5921,52 @@
         ENDDO
       ENDDO
-      IF(1==0) THEN
+      ELSE ! correction pour fermeture de bilan, par FH dans les simus de Binta pour Habib
+      DO i=1, klon
+        DO k=1,klev
+      if(id_prec>0)        d_tr_cv01(i,k)   =d_tr_cv(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_cv02(i,k)   =d_tr_cv(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_cv03(i,k)   =d_tr_cv(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_cv04(i,k)   =d_tr_cv(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_cv05(i,k)   =d_tr_cv(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_trsp01(i,k) =d_tr_trsp(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_trsp02(i,k) =d_tr_trsp(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_trsp03(i,k) =d_tr_trsp(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_trsp04(i,k) =d_tr_trsp(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_trsp05(i,k) =d_tr_trsp(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_sscav01(i,k)=d_tr_sscav(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_sscav02(i,k)=d_tr_sscav(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_sscav03(i,k)=d_tr_sscav(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_sscav04(i,k)=d_tr_sscav(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_sscav05(i,k)=d_tr_sscav(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_sat01(i,k)  =d_tr_sat(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_sat02(i,k)  =d_tr_sat(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_sat03(i,k)  =d_tr_sat(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_sat04(i,k)  =d_tr_sat(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_sat05(i,k)  =d_tr_sat(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_uscav01(i,k)=d_tr_uscav(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_uscav02(i,k)=d_tr_uscav(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_uscav03(i,k)=d_tr_uscav(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_uscav04(i,k)=d_tr_uscav(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_uscav05(i,k)=d_tr_uscav(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_insc01(i,k)=d_tr_insc(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_insc02(i,k)=d_tr_insc(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_insc03(i,k)=d_tr_insc(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_insc04(i,k)=d_tr_insc(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_insc05(i,k)=d_tr_insc(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_bcscav01(i,k)=d_tr_bcscav(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_bcscav02(i,k)=d_tr_bcscav(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_bcscav03(i,k)=d_tr_bcscav(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_bcscav04(i,k)=d_tr_bcscav(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_bcscav05(i,k)=d_tr_bcscav(i,k,id_scdu)/pdtphys
+      if(id_prec>0)        d_tr_evapls01(i,k)=d_tr_evapls(i,k,id_prec)/pdtphys
+      if(id_fine>0)        d_tr_evapls02(i,k)=d_tr_evapls(i,k,id_fine)/pdtphys
+      if(id_coss>0)        d_tr_evapls03(i,k)=d_tr_evapls(i,k,id_coss)/pdtphys
+      if(id_codu>0)        d_tr_evapls04(i,k)=d_tr_evapls(i,k,id_codu)/pdtphys
+      if(id_scdu>0)        d_tr_evapls05(i,k)=d_tr_evapls(i,k,id_scdu)/pdtphys
+        ENDDO
+      ENDDO
+      ENDIF 
+
+      IF(1==0) THEN  ! This "if" is as in original trunk
       DO i=1, klon
         DO k=1,klev
Index: /LMDZ6/trunk/libf/phylmd/Dust/read_dust.F
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/read_dust.F	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/read_dust.F	(revision 3786)
@@ -14,5 +14,5 @@
       real dust_ec_glo(klon_glo)
 c
-      real dust_nc(iip1,jjp1)
+c as      real dust_nc(iip1,jjp1)
       real dust_nc_glo(nbp_lon+1,nbp_lat)
       real rcode
@@ -59,7 +59,8 @@
 c--upside down + physical grid
 c
-c--OB=change jjp1 to 1 here
+c--OB=change jjp1 to 1 here ; 
+c----AS: OB's change is needed if lats N to S (90 to -90) in dust.nc
 !      dust_ec(1)=MAX(dust_nc(1,jjp1),0.0)
-      dust_ec(1)=MAX(dust_nc(1,nbp_lat),0.0)
+      dust_ec_glo(1)=MAX(dust_nc_glo(1,nbp_lat),0.0)
       ig=2
 !      DO j=2,jjm
Index: /LMDZ6/trunk/libf/phylmd/Dust/read_newemissions.F
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/read_newemissions.F	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/read_newemissions.F	(revision 3786)
@@ -59,5 +59,5 @@
 !$OMP THREADPRIVATE(u10m_ec1, v10m_ec1, dust_ec1)
 !$OMP THREADPRIVATE(u10m_ec2, v10m_ec2, dust_ec2)
-      REAL u10m_nc(iip1,jjp1), v10m_nc(iip1,jjp1)
+c as      REAL u10m_nc(iip1,jjp1), v10m_nc(iip1,jjp1)
       REAL u10m_ec(klon), v10m_ec(klon), dust_ec(klon)
 c      REAL cly(klon), wth(klon), zprecipinsoil(klon)
Index: /LMDZ6/trunk/libf/phylmd/Dust/spla_output_write.h
===================================================================
--- /LMDZ6/trunk/libf/phylmd/Dust/spla_output_write.h	(revision 3785)
+++ /LMDZ6/trunk/libf/phylmd/Dust/spla_output_write.h	(revision 3786)
@@ -9,16 +9,16 @@
       CALL histwrite_phy( o_taue670          , diag_aod670_tot  )
       CALL histwrite_phy( o_taue865          , diag_aod865_tot  ) 
-      IF(id_fine>0) CALL histwrite_phy( o_taue550_tr2      , diff_aod550_tr2  )
-      IF(id_fine>0) CALL histwrite_phy( o_taue670_tr2      , diag_aod670_tr2  )
-      IF(id_fine>0) CALL histwrite_phy( o_taue865_tr2      , diag_aod865_tr2  )
-      IF(id_coss>0) CALL histwrite_phy( o_taue550_ss       , diag_aod550_ss   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue670_ss       , diag_aod670_ss   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue865_ss       , diag_aod865_ss   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue550_dust     , diag_aod550_dust )
-      IF(id_codu>0) CALL histwrite_phy( o_taue670_dust     , diag_aod670_dust )
-      IF(id_codu>0) CALL histwrite_phy( o_taue865_dust     , diag_aod865_dust )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue550_dustsco  , diag_aod550_dustsco )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue670_dustsco  , diag_aod670_dustsco )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue865_dustsco  , diag_aod865_dustsco )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_tr2      , diff_aod550_tr2  )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_tr2      , diag_aod670_tr2  )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_tr2      , diag_aod865_tr2  )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_ss       , diag_aod550_ss   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_ss       , diag_aod670_ss   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_ss       , diag_aod865_ss   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_dust     , diag_aod550_dust )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_dust     , diag_aod670_dust )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_dust     , diag_aod865_dust )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_dustsco  , diag_aod550_dustsco )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_dustsco  , diag_aod670_dustsco )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_dustsco  , diag_aod865_dustsco )
       CALL histwrite_phy( o_taue550_aqua     , aod550_aqua  )
       CALL histwrite_phy( o_taue550_terra    , aod550_terra )
@@ -28,157 +28,157 @@
       CALL histwrite_phy( o_taue865_terra    , aod865_terra )
 
-      IF(id_fine>0) CALL histwrite_phy( o_taue550_fine_aqua     ,aod550_tr2_aqua   )
-      IF(id_fine>0) CALL histwrite_phy( o_taue670_fine_aqua     ,aod670_tr2_aqua   )
-      IF(id_fine>0) CALL histwrite_phy( o_taue865_fine_aqua     ,aod865_tr2_aqua   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue550_coss_aqua      ,aod550_ss_aqua   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue670_coss_aqua      ,aod670_ss_aqua   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue865_coss_aqua      ,aod865_ss_aqua   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue550_codu_aqua    ,aod550_dust_aqua   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue670_codu_aqua    ,aod670_dust_aqua   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue865_codu_aqua    ,aod865_dust_aqua   )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue670_scdu_aqua ,aod670_dustsco_aqua   )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue550_scdu_aqua ,aod550_dustsco_aqua   )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue865_scdu_aqua ,aod865_dustsco_aqua   )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_fine_aqua     ,aod550_tr2_aqua   )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_fine_aqua     ,aod670_tr2_aqua   )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_fine_aqua     ,aod865_tr2_aqua   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_coss_aqua      ,aod550_ss_aqua   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_coss_aqua      ,aod670_ss_aqua   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_coss_aqua      ,aod865_ss_aqua   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_codu_aqua    ,aod550_dust_aqua   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_codu_aqua    ,aod670_dust_aqua   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_codu_aqua    ,aod865_dust_aqua   )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_scdu_aqua ,aod670_dustsco_aqua   )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_scdu_aqua ,aod550_dustsco_aqua   )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_scdu_aqua ,aod865_dustsco_aqua   )
       
-      IF(id_fine>0) CALL histwrite_phy( o_taue550_fine_terra     ,aod550_tr2_terra   )
-      IF(id_fine>0) CALL histwrite_phy( o_taue670_fine_terra     ,aod670_tr2_terra   )
-      IF(id_fine>0) CALL histwrite_phy( o_taue865_fine_terra     ,aod865_tr2_terra   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue550_coss_terra      ,aod550_ss_terra   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue670_coss_terra      ,aod670_ss_terra   )
-      IF(id_coss>0) CALL histwrite_phy( o_taue865_coss_terra      ,aod865_ss_terra   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue550_codu_terra    ,aod550_dust_terra   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue670_codu_terra    ,aod670_dust_terra   )
-      IF(id_codu>0) CALL histwrite_phy( o_taue865_codu_terra    ,aod865_dust_terra   )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue670_scdu_terra ,aod670_dustsco_terra   )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue550_scdu_terra ,aod550_dustsco_terra   )
-      IF(id_scdu>0) CALL histwrite_phy( o_taue865_scdu_terra ,aod865_dustsco_terra   )
-
-
-      IF(id_prec>0) CALL histwrite_phy( o_trm01 , trm01 )
-      IF(id_fine>0) CALL histwrite_phy( o_trm02 , trm02 )
-      IF(id_coss>0) CALL histwrite_phy( o_trm03 , trm03 )
-      IF(id_codu>0) CALL histwrite_phy( o_trm04 , trm04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_trm05 , trm05 )
-      IF(id_prec>0) CALL histwrite_phy( o_sconc01 , sconc01 )
-      IF(id_fine>0) CALL histwrite_phy( o_sconc02 , sconc02 )
-      IF(id_coss>0) CALL histwrite_phy( o_sconc03 , sconc03 )
-      IF(id_codu>0) CALL histwrite_phy( o_sconc04 , sconc04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_sconc05 , sconc05 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_fine_terra     ,aod550_tr2_terra   )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_fine_terra     ,aod670_tr2_terra   )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_fine_terra     ,aod865_tr2_terra   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_coss_terra      ,aod550_ss_terra   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_coss_terra      ,aod670_ss_terra   )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_coss_terra      ,aod865_ss_terra   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_codu_terra    ,aod550_dust_terra   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_codu_terra    ,aod670_dust_terra   )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_codu_terra    ,aod865_dust_terra   )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_scdu_terra ,aod670_dustsco_terra   )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_scdu_terra ,aod550_dustsco_terra   )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_scdu_terra ,aod865_dustsco_terra   )
+
+
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm01 , trm01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm02 , trm02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm03 , trm03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm04 , trm04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm05 , trm05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc01 , sconc01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc02 , sconc02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc03 , sconc03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc04 , sconc04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc05 , sconc05 )
 
 ! Lessivage
 
-      IF(id_prec>0) CALL histwrite_phy( o_flux01       , flux01 )
-      IF(id_fine>0) CALL histwrite_phy( o_flux02       , flux02 )
-      IF(id_coss>0) CALL histwrite_phy( o_flux03       , flux03 )
-      IF(id_codu>0) CALL histwrite_phy( o_flux04       , flux04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_flux05       , flux05 )
-      IF(id_prec>0) CALL histwrite_phy( o_ds01         , ds01 )
-      IF(id_fine>0) CALL histwrite_phy( o_ds02         , ds02 )
-      IF(id_coss>0) CALL histwrite_phy( o_ds03         , ds03 )
-      IF(id_codu>0) CALL histwrite_phy( o_ds04         , ds04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_ds05         , ds05 )
-      IF(id_prec>0) CALL histwrite_phy( o_dh01         , dh01 )
-      IF(id_fine>0) CALL histwrite_phy( o_dh02         , dh02 )
-      IF(id_coss>0) CALL histwrite_phy( o_dh03         , dh03 )
-      IF(id_codu>0) CALL histwrite_phy( o_dh04         , dh04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_dh05         , dh05 )
-      IF(id_prec>0) CALL histwrite_phy( o_dtrconv01    , dtrconv01 )
-      IF(id_fine>0) CALL histwrite_phy( o_dtrconv02    , dtrconv02 )
-      IF(id_coss>0) CALL histwrite_phy( o_dtrconv03    , dtrconv03 )
-      IF(id_codu>0) CALL histwrite_phy( o_dtrconv04    , dtrconv04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_dtrconv05    , dtrconv05 )
-      IF(id_prec>0) CALL histwrite_phy( o_dtherm01     , dtherm01 )
-      IF(id_fine>0) CALL histwrite_phy( o_dtherm02     , dtherm02 )
-      IF(id_coss>0) CALL histwrite_phy( o_dtherm03     , dtherm03 )
-      IF(id_codu>0) CALL histwrite_phy( o_dtherm04     , dtherm04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_dtherm05     , dtherm05 )
-      IF(id_prec>0) CALL histwrite_phy( o_dhkecv01     , dhkecv01 )
-      IF(id_fine>0) CALL histwrite_phy( o_dhkecv02     , dhkecv02 )
-      IF(id_coss>0) CALL histwrite_phy( o_dhkecv03     , dhkecv03 )
-      IF(id_codu>0) CALL histwrite_phy( o_dhkecv04     , dhkecv04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_dhkecv05     , dhkecv05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_ds01     , d_tr_ds01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_ds02     , d_tr_ds02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_ds03     , d_tr_ds03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_ds04     , d_tr_ds04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_ds05     , d_tr_ds05 )
-      IF(id_prec>0) CALL histwrite_phy( o_dhkelsc01    , dhkelsc01 )
-      IF(id_fine>0) CALL histwrite_phy( o_dhkelsc02    , dhkelsc02 )
-      IF(id_coss>0) CALL histwrite_phy( o_dhkelsc03    , dhkelsc03 )
-      IF(id_codu>0) CALL histwrite_phy( o_dhkelsc04    , dhkelsc04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_dhkelsc05    , dhkelsc05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_cv01    , d_tr_cv01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_cv02    , d_tr_cv02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_cv03    , d_tr_cv03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_cv04    , d_tr_cv04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_cv05    , d_tr_cv05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_trsp01  , d_tr_trsp01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_trsp02  , d_tr_trsp02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_trsp03  , d_tr_trsp03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_trsp04  , d_tr_trsp04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_trsp05  , d_tr_trsp05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_sscav01 , d_tr_sscav01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_sscav02 , d_tr_sscav02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_sscav03 , d_tr_sscav03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_sscav04 , d_tr_sscav04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_sscav05 , d_tr_sscav05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_sat01   , d_tr_sat01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_sat02   , d_tr_sat02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_sat03   , d_tr_sat03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_sat04   , d_tr_sat04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_sat05   , d_tr_sat05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_uscav01 , d_tr_uscav01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_uscav02 , d_tr_uscav02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_uscav03 , d_tr_uscav03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_uscav04 , d_tr_uscav04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_uscav05 , d_tr_uscav05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_insc01 , d_tr_insc01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_insc02 , d_tr_insc02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_insc03 , d_tr_insc03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_insc04 , d_tr_insc04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_insc05 , d_tr_insc05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_bcscav01 , d_tr_bcscav01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_bcscav02 , d_tr_bcscav02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_bcscav03 , d_tr_bcscav03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_bcscav04 , d_tr_bcscav04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_bcscav05 , d_tr_bcscav05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_evapls01 , d_tr_evapls01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_evapls02 , d_tr_evapls02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_evapls03 , d_tr_evapls03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_evapls04 , d_tr_evapls04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_evapls05 , d_tr_evapls05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_ls01 , d_tr_ls01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_ls02 , d_tr_ls02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_ls03 , d_tr_ls03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_ls04 , d_tr_ls04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_ls05 , d_tr_ls05 )
-
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_dyn01 , d_tr_dyn01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_dyn02 , d_tr_dyn02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_dyn03 , d_tr_dyn03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_dyn04 , d_tr_dyn04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_dyn05 , d_tr_dyn05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux01       , flux01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux02       , flux02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux03       , flux03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux04       , flux04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux05       , flux05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds01         , ds01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds02         , ds02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds03         , ds03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds04         , ds04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds05         , ds05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh01         , dh01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh02         , dh02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh03         , dh03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh04         , dh04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh05         , dh05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv01    , dtrconv01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv02    , dtrconv02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv03    , dtrconv03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv04    , dtrconv04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv05    , dtrconv05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm01     , dtherm01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm02     , dtherm02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm03     , dtherm03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm04     , dtherm04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm05     , dtherm05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv01     , dhkecv01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv02     , dhkecv02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv03     , dhkecv03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv04     , dhkecv04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv05     , dhkecv05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds01     , d_tr_ds01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds02     , d_tr_ds02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds03     , d_tr_ds03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds04     , d_tr_ds04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds05     , d_tr_ds05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc01    , dhkelsc01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc02    , dhkelsc02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc03    , dhkelsc03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc04    , dhkelsc04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc05    , dhkelsc05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv01    , d_tr_cv01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv02    , d_tr_cv02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv03    , d_tr_cv03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv04    , d_tr_cv04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv05    , d_tr_cv05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp01  , d_tr_trsp01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp02  , d_tr_trsp02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp03  , d_tr_trsp03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp04  , d_tr_trsp04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp05  , d_tr_trsp05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav01 , d_tr_sscav01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav02 , d_tr_sscav02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav03 , d_tr_sscav03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav04 , d_tr_sscav04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav05 , d_tr_sscav05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat01   , d_tr_sat01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat02   , d_tr_sat02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat03   , d_tr_sat03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat04   , d_tr_sat04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat05   , d_tr_sat05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav01 , d_tr_uscav01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav02 , d_tr_uscav02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav03 , d_tr_uscav03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav04 , d_tr_uscav04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav05 , d_tr_uscav05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc01 , d_tr_insc01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc02 , d_tr_insc02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc03 , d_tr_insc03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc04 , d_tr_insc04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc05 , d_tr_insc05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav01 , d_tr_bcscav01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav02 , d_tr_bcscav02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav03 , d_tr_bcscav03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav04 , d_tr_bcscav04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav05 , d_tr_bcscav05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls01 , d_tr_evapls01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls02 , d_tr_evapls02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls03 , d_tr_evapls03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls04 , d_tr_evapls04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls05 , d_tr_evapls05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls01 , d_tr_ls01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls02 , d_tr_ls02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls03 , d_tr_ls03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls04 , d_tr_ls04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls05 , d_tr_ls05 )
+
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn01 , d_tr_dyn01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn02 , d_tr_dyn02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn03 , d_tr_dyn03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn04 , d_tr_dyn04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn05 , d_tr_dyn05 )
       
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_cl01 , d_tr_cl01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_cl02 , d_tr_cl02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_cl03 , d_tr_cl03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_cl04 , d_tr_cl04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_cl05 , d_tr_cl05 )
-      IF(id_prec>0) CALL histwrite_phy( o_d_tr_th01 , d_tr_th01 )
-      IF(id_fine>0) CALL histwrite_phy( o_d_tr_th02 , d_tr_th02 )
-      IF(id_coss>0) CALL histwrite_phy( o_d_tr_th03 , d_tr_th03 )
-      IF(id_codu>0) CALL histwrite_phy( o_d_tr_th04 , d_tr_th04 )
-      IF(id_scdu>0) CALL histwrite_phy( o_d_tr_th05 , d_tr_th05 )
-
-      IF(id_coss>0) CALL histwrite_phy( o_sed_ss , sed_ss)
-      IF(id_codu>0) CALL histwrite_phy( o_sed_dust , sed_dust)
-      IF(id_scdu>0) CALL histwrite_phy( o_sed_dustsco , sed_dustsco)
-      IF(id_prec>0) CALL histwrite_phy( o_g2p_gas , his_g2pgas )
-      IF(id_fine>0) CALL histwrite_phy( o_g2p_aer , his_g2paer)
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl01 , d_tr_cl01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl02 , d_tr_cl02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl03 , d_tr_cl03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl04 , d_tr_cl04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl05 , d_tr_cl05 )
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th01 , d_tr_th01 )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th02 , d_tr_th02 )
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th03 , d_tr_th03 )
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th04 , d_tr_th04 )
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th05 , d_tr_th05 )
+
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_ss , sed_ss)
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dust , sed_dust)
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dustsco , sed_dustsco)
+      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_g2p_gas , his_g2pgas )
+      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_g2p_aer , his_g2paer)
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      IF(id_coss>0) CALL histwrite_phy( o_sed_ss3D , sed_ss3D)
-      IF(id_codu>0) CALL histwrite_phy( o_sed_dust3D , sed_dust3D)
-      IF(id_scdu>0) CALL histwrite_phy( o_sed_dustsco3D , sed_dustsco3D)
+      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_ss3D , sed_ss3D)
+      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dust3D , sed_dust3D)
+      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dustsco3D , sed_dustsco3D)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! histrac_spl
