Index: LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/ini_histmth.h
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/ini_histmth.h	(revision 861)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/ini_histmth.h	(revision 862)
@@ -832,4 +832,49 @@
          ENDIF
 C
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+         CALL histdef(nid_mth, "tau", "cloud opt thickness", "-",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "CCM1", "CCM1", "",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "CCM2", "CCM2", "",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "taupi", "cloud opt thickn. (pi)", "-",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "cldemi", "emissivite IR", "-",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_ZERO", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_AER", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_NAT", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_AD", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_AI", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_ZERO", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_AER", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_AD", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_NAT", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+#endif
+#ifndef INCA
          if (nqmax.GE.3) THEN
            DO iq=3,nqmax
@@ -840,4 +885,5 @@
            ENDDO
          ENDIF
+#endif
 c
       ENDIF !lev_histmth.GE.4
@@ -1739,4 +1785,49 @@
          ENDIF
 C
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+         CALL histdef(nid_mth, "tau", "cloud opt thickness", "-",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "CCM1", "CCM1", "",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "CCM2", "CCM2", "",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "taupi", "cloud opt thickn. (pi)", "-",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+         CALL histdef(nid_mth, "cldemi", "emissivite IR", "-",
+     .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_ZERO", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_AER", "?", "?",
+     .                iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_NAT", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_AD", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOAAS_AI", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_ZERO", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_AER", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_AD", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+	 CALL histdef(nid_mth, "SWTOACS_NAT", "?", "?",
+     .        iim,jj_nb,nhori, 1,1,1, -99, 32,
+     .        "ave(X)", zstophy,zout)
+#endif
+#ifndef INCA
          if (nqmax.GE.3) THEN
            DO iq=3,nqmax
@@ -1747,5 +1838,5 @@
              ENDDO
            ENDIF
-
+#endif
       ENDIF !lev_histmth.GE.4
 c
Index: LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/physiq.F
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/physiq.F	(revision 861)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/physiq.F	(revision 862)
@@ -1305,4 +1305,20 @@
 c$OMP THREADPRIVATE(cg_ae)
 
+#ifdef INCA_AER
+#ifdef CPP_COUPLE
+! Aerosol optical properties by INCA model 
+      REAL, SAVE, ALLOCATABLE  ::    tau_inca(:,:,:,:)
+      REAL, SAVE, ALLOCATABLE  ::    piz_inca(:,:,:,:)
+      REAL, SAVE, ALLOCATABLE  ::    cg_inca(:,:,:,:)
+      REAL, SAVE, ALLOCATABLE  ::    ccm(:,:,:) 
+      CHARACTER*4              ::    rfname(9) 
+
+      REAL,SAVE,ALLOCATABLE :: topswad_inca(:), solswad_inca(:) ! Aerosol direct effect.
+      REAL,SAVE,ALLOCATABLE :: topswad0_inca(:), solswad0_inca(:) ! Aerosol direct effect.
+      REAL,SAVE,ALLOCATABLE :: topswai_inca(:), solswai_inca(:) ! Aerosol indirect effect.
+      REAL,SAVE,ALLOCATABLE :: topsw_inca(:,:), solsw_inca(:,:) 
+      REAL,SAVE,ALLOCATABLE :: topsw0_inca(:,:), solsw0_inca(:,:)
+#endif
+#endif
       REAL,SAVE,ALLOCATABLE :: topswad(:), solswad(:) ! Aerosol direct effect.
 c$OMP THREADPRIVATE(topswad,solswad)
@@ -1441,4 +1457,17 @@
       allocate( topswad(klon), solswad(klon))
       allocate( topswai(klon), solswai(klon) )
+#ifdef INCA_AER
+#ifdef CPP_COUPLE
+      allocate( topswad_inca(klon), solswad_inca(klon))
+      allocate( topswad0_inca(klon), solswad0_inca(klon))
+      allocate( topswai_inca(klon), solswai_inca(klon))
+      allocate( topsw_inca(klon,9), solsw_inca(klon,9))
+      allocate( topsw0_inca(klon,9), solsw0_inca(klon,9))
+      allocate( tau_inca(klon,klev,9,2))
+      allocate( piz_inca(klon,klev,9,2))
+      allocate( cg_inca(klon,klev,9,2))
+      allocate( ccm(klon,klev,2) )
+#endif
+#endif
       allocate( clwcon0(klon,klev),rnebcon0(klon,klev))
       allocate( tau_ae(klon,klev,2), piz_ae(klon,klev,2))
@@ -1502,6 +1531,24 @@
          solswai(:)=0.
          solswad(:)=0.
+#ifdef INCA_AER
+#ifdef CPP_COUPLE
+         tau_inca(:,:,:,:) = 0.
+         piz_inca(:,:,:,:) = 0.
+         cg_inca(:,:,:,:)  = 0.
+         ccm(:,:,:)        = 0.
+         topswai_inca(:)   = 0.
+         topswad_inca(:)   = 0.
+         topswad0_inca(:)  = 0.
+         topsw_inca(:,:)   = 0.
+         topsw0_inca(:,:)  = 0.
+         solswai_inca(:)   = 0.
+         solswad_inca(:)   = 0.
+         solswad0_inca(:)  = 0.
+         solsw_inca(:,:)   = 0.
+         solsw0_inca(:,:)  = 0.
+#endif
+#endif
 !rv
-! anne
+!ACo
          d_u_con(:,:) = 0.0
          d_v_con(:,:) = 0.0
@@ -1513,5 +1560,4 @@
 c        nhistoW(:,:,:,:) = 0.0
 c        histoW(:,:,:,:) = 0.0
-! fin anne
 
 cIM      
@@ -2517,4 +2563,5 @@
 cjq - Johannes Quaas, 27/11/2003 (quaas@lmd.jussieu.fr)
       IF (ok_ade.OR.ok_aie) THEN
+#if defined(CPP_COUPLE) && !defined(INCA_AER)
          ! Get sulfate aerosol distribution
          CALL readsulfate(rjourvrai, debut, sulfate)
@@ -2524,4 +2571,14 @@
          CALL aeropt(pplay, paprs, t_seri, sulfate, rhcl,
      .        tau_ae, piz_ae, cg_ae, aerindex)
+#endif
+#if !defined(CPP_COUPLE)
+         ! Get sulfate aerosol distribution
+         CALL readsulfate(rjourvrai, debut, sulfate)
+         CALL readsulfate_preind(rjourvrai, debut, sulfate_pi)
+
+         ! Calculate aerosol optical properties (Olivier Boucher)
+         CALL aeropt(pplay, paprs, t_seri, sulfate, rhcl,
+     .        tau_ae, piz_ae, cg_ae, aerindex)
+#endif
 cym
       ELSE
@@ -2700,5 +2757,9 @@
      .            flwp, fiwp, flwc, fiwc,
      e            ok_aie,
+#if defined(CPP_COUPLE) && defined(INCA_AER)  
+     e            ccm(:,:,1), ccm(:,:,2),
+#else
      e            sulfate, sulfate_pi,
+#endif
      e            bl95_b0, bl95_b1,
      s            cldtaupi, re, fl)
@@ -2736,4 +2797,26 @@
       endif
       
+
+#if defined(CPP_COUPLE) && defined(INCA_AER)
+      CALL radlwsw_inca ! nouveau rayonnement (compatible Arpege-IFS)
+     e            (kdlon,kflev,dist, rmu0, fract, 
+     e             paprs, pplay,zxtsol,albsol, albsollw, t_seri,q_seri,
+     e             wo,
+     e             cldfra, cldemi, cldtau,
+     s             heat,heat0,cool,cool0,radsol,albpla,
+     s             topsw,toplw,solsw,sollw,
+     s             sollwdown,
+     s             topsw0,toplw0,solsw0,sollw0,
+     s             lwdn0, lwdn, lwup0, lwup, 
+     s             swdn0, swdn, swup0, swup,
+     e             ok_ade, ok_aie, ! new for aerosol radiative effects
+     e             tau_inca, piz_inca, cg_inca, ! ="=
+     s             topswad_inca, solswad_inca, ! ="=
+     s             topswad0_inca, solswad0_inca, ! ="=
+     s             topsw_inca, topsw0_inca,
+     s             solsw_inca, solsw0_inca,
+     e             cldtaupi, ! ="=
+     s             topswai_inca, solswai_inca) ! ="=
+#else
       CALL radlwsw ! nouveau rayonnement (compatible Arpege-IFS)
      e            (dist, rmu0, fract, 
@@ -2752,4 +2835,5 @@
      e             cldtaupi, ! ="=
      s             topswai, solswai) ! ="=
+#endif
       itaprad = 0
       ENDIF
@@ -2985,4 +3069,11 @@
 #ifdef INCA
      I                   flxmass_w,
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+     I                   tau_inca, 
+     I                   piz_inca, 
+     I                   cg_inca,
+     I                   ccm,
+     I                   rfname,
+#endif
 #endif
      O                   tr_seri)
Index: LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/phytrac.F
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/phytrac.F	(revision 861)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/phytrac.F	(revision 862)
@@ -59,4 +59,11 @@
 #ifdef INCA
      I                    flxmass_w,
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+     I                   tau_inca, 
+     I                   piz_inca, 
+     I                   cg_inca,
+     I                   ccm,
+     I                   rfname,
+#endif
 #endif
      O                    tr_seri)
@@ -140,4 +147,12 @@
       REAL flxmass_w(klon,klev)
       CHARACTER(len=8) :: solsym(nqmax)
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+      integer la
+      REAL              ::    tau_inca(klon,klev,9,2)
+      REAL              ::    piz_inca(klon,klev,9,2)
+      REAL              ::    cg_inca(klon,klev,9,2)
+      character*4       ::    rfname(9) 
+      REAL              ::    ccm(klon,klev,2) 
+#endif
 #endif
 c      integer iflag_con
@@ -348,7 +363,4 @@
       REAL              :: dummy(klon,klev)
 #endif
-#ifdef INCA_AER
-      integer la
-#endif
 c
 c======================================================================
@@ -509,6 +521,4 @@
 
 #ifdef INCA_AER
-
-! Changement Anne 01/04/2005
         CALL aerosolmain (tr_seri,
      $                 pdtphys,
@@ -528,7 +538,12 @@
      $                 t_seri,       ! for chimiaq
      $                 rh,
+#ifdef CPP_COUPLE
+     $                 tau_inca,
+     $                 piz_inca,
+     $                 cg_inca,
+     $                 rfname,
+     $                 ccm,
+#endif
      $                 lafin)
-! fin changement anne
-
 #endif
 
Index: LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/write_histmth.h
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/write_histmth.h	(revision 861)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/phylmd/write_histmth.h	(revision 862)
@@ -819,4 +819,22 @@
       ENDIF
 C
+
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+      CALL histwrite_phy(nid_mth,"tau",itau_w,cldtau)
+      CALL histwrite_phy(nid_mth,"CCM1",itau_w,ccm(:,:,1))
+      CALL histwrite_phy(nid_mth,"CCM2",itau_w,ccm(:,:,2))
+      CALL histwrite_phy(nid_mth,"taupi",itau_w,cldtaupi)
+      CALL histwrite_phy(nid_mth,"cldemi",itau_w,cldemi)
+      CALL histwrite_phy(nid_mth,"SWTOAAS_ZERO",itau_w,topsw_inca(:,1))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_AER",itau_w,topsw_inca(:,2))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_NAT",itau_w,topsw_inca(:,3))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_AD",itau_w,topswad_inca(:))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_AI",itau_w,topswai_inca(:))
+      CALL histwrite_phy(nid_mth,"SWTOACS_ZERO",itau_w,topsw0_inca(:,1))
+      CALL histwrite_phy(nid_mth,"SWTOACS_AER",itau_w,topsw0_inca(:,2))
+      CALL histwrite_phy(nid_mth,"SWTOACS_AD",itau_w,topswad0_inca(:))
+      CALL histwrite_phy(nid_mth,"SWTOACS_NAT",itau_w,topsw0_inca(:,3))
+#endif
+#ifndef INCA
       IF (nqmax.GE.3) THEN
       DO iq=3,nqmax
@@ -825,5 +843,5 @@
       ENDDO
       ENDIF
-c
+#endif
       ENDIF !lev_histmth.GE.4
 c
@@ -1797,4 +1815,21 @@
       ENDIF
 C
+#if defined(INCA_AER) && defined(CPP_COUPLE)
+      CALL histwrite_phy(nid_mth,"tau",itau_w,cldtau)
+      CALL histwrite_phy(nid_mth,"CCM1",itau_w,ccm(:,:,1))
+      CALL histwrite_phy(nid_mth,"CCM2",itau_w,ccm(:,:,2))
+      CALL histwrite_phy(nid_mth,"taupi",itau_w,cldtaupi)
+      CALL histwrite_phy(nid_mth,"cldemi",itau_w,cldemi)
+      CALL histwrite_phy(nid_mth,"SWTOAAS_ZERO",itau_w,topsw_inca(:,1))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_AER",itau_w,topsw_inca(:,2))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_NAT",itau_w,topsw_inca(:,3))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_AD",itau_w,topswad_inca(:))
+      CALL histwrite_phy(nid_mth,"SWTOAAS_AI",itau_w,topswai_inca(:))
+      CALL histwrite_phy(nid_mth,"SWTOACS_ZERO",itau_w,topsw0_inca(:,1))
+      CALL histwrite_phy(nid_mth,"SWTOACS_AER",itau_w,topsw0_inca(:,2))
+      CALL histwrite_phy(nid_mth,"SWTOACS_AD",itau_w,topswad0_inca(:))
+      CALL histwrite_phy(nid_mth,"SWTOACS_NAT",itau_w,topsw0_inca(:,3))
+#endif
+#ifndef INCA
       IF (nqmax.GE.3) THEN
       DO iq=3,nqmax
@@ -1804,4 +1839,5 @@
       ENDIF
 c
+#endif
       ENDIF !lev_histmth.GE.4
 c
