Index: LMDZ6/branches/IPSLCM6.0.15/libf/phylmd/physiq_mod.F90
===================================================================
--- LMDZ6/branches/IPSLCM6.0.15/libf/phylmd/physiq_mod.F90	(revision 3235)
+++ LMDZ6/branches/IPSLCM6.0.15/libf/phylmd/physiq_mod.F90	(revision 3240)
@@ -1652,34 +1652,4 @@
 
 #ifdef CPP_XIOS 
-       !--setting up swaero_diag to TRUE in XIOS case 
-       IF (xios_field_is_active("topswad").OR.xios_field_is_active("topswad0").OR. & 
-           xios_field_is_active("solswad").OR.xios_field_is_active("solswad0").OR. & 
-           xios_field_is_active("topswai").OR.xios_field_is_active("solswai").OR.  & 
-             (iflag_rrtm==1.AND.(xios_field_is_active("toplwad").OR.xios_field_is_active("toplwad0").OR. & 
-                                 xios_field_is_active("sollwad").OR.xios_field_is_active("sollwad0"))))  & 
-           !!!--for now these fields are not in the XML files so they are omitted 
-           !!!  xios_field_is_active("toplwai").OR.xios_field_is_active("sollwai") !))) & 
-           swaero_diag=.TRUE. 
-
-       !--setting up swaerofree_diag to TRUE in XIOS case 
-       IF (xios_field_is_active("SWdnSFCcleanclr").OR.xios_field_is_active("SWupSFCcleanclr").OR. &
-           xios_field_is_active("SWupTOAcleanclr").OR.xios_field_is_active("rsucsaf").OR.   &
-           xios_field_is_active("rsdcsaf") .OR. xios_field_is_active("LWdnSFCcleanclr").OR. &
-           xios_field_is_active("LWupTOAcleanclr")) &
-           swaerofree_diag=.TRUE. 
-
-       !--setting up dryaod_diag to TRUE in XIOS case 
-       DO naero = 1, naero_tot-1
-         IF (xios_field_is_active("dryod550_"//name_aero_tau(naero))) dryaod_diag=.TRUE. 
-       ENDDO
-       !
-       !--setting up ok_4xCO2atm to TRUE in XIOS case 
-       IF (xios_field_is_active("rsut4co2").OR.xios_field_is_active("rlut4co2").OR. & 
-           xios_field_is_active("rsutcs4co2").OR.xios_field_is_active("rlutcs4co2").OR. &
-           xios_field_is_active("rsu4co2").OR.xios_field_is_active("rsucs4co2").OR. &
-           xios_field_is_active("rsd4co2").OR.xios_field_is_active("rsdcs4co2").OR. &
-           xios_field_is_active("rlu4co2").OR.xios_field_is_active("rlucs4co2").OR. &
-           xios_field_is_active("rld4co2").OR.xios_field_is_active("rldcs4co2")) &
-           ok_4xCO2atm=.TRUE. 
 ! Need to put this initialisation after phyetat0 as in the coupled model the XIOS context is only
 ! initialised at that moment
@@ -4830,4 +4800,46 @@
 #endif
 
+! On remet des variables a .false. apres un premier appel
+    if (debut) then
+#ifdef CPP_XIOS
+      swaero_diag=.FALSE.
+      swaerofree_diag=.FALSE.
+      dryaod_diag=.FALSE.
+      ok_4xCO2atm= .FALSE.
+      if (is_master) write (lunout,*)'ok_4xCO2atm= ',swaero_diag, swaerofree_diag, dryaod_diag, ok_4xCO2atm
+
+       !--setting up swaero_diag to TRUE in XIOS case 
+       IF (xios_field_is_active("topswad").OR.xios_field_is_active("topswad0").OR. & 
+           xios_field_is_active("solswad").OR.xios_field_is_active("solswad0").OR. & 
+           xios_field_is_active("topswai").OR.xios_field_is_active("solswai").OR.  & 
+             (iflag_rrtm==1.AND.(xios_field_is_active("toplwad").OR.xios_field_is_active("toplwad0").OR. & 
+                                 xios_field_is_active("sollwad").OR.xios_field_is_active("sollwad0"))))  & 
+           !!!--for now these fields are not in the XML files so they are omitted 
+           !!!  xios_field_is_active("toplwai").OR.xios_field_is_active("sollwai") !))) & 
+           swaero_diag=.TRUE. 
+
+       !--setting up swaerofree_diag to TRUE in XIOS case 
+       IF (xios_field_is_active("SWdnSFCcleanclr").OR.xios_field_is_active("SWupSFCcleanclr").OR. &
+           xios_field_is_active("SWupTOAcleanclr").OR.xios_field_is_active("rsucsaf").OR.   &
+           xios_field_is_active("rsdcsaf") .OR. xios_field_is_active("LWdnSFCcleanclr").OR. &
+           xios_field_is_active("LWupTOAcleanclr")) &
+           swaerofree_diag=.TRUE. 
+
+       !--setting up dryaod_diag to TRUE in XIOS case 
+       DO naero = 1, naero_tot-1
+         IF (xios_field_is_active("dryod550_"//name_aero_tau(naero))) dryaod_diag=.TRUE. 
+       ENDDO
+       !
+       !--setting up ok_4xCO2atm to TRUE in XIOS case 
+       IF (xios_field_is_active("rsut4co2").OR.xios_field_is_active("rlut4co2").OR. & 
+           xios_field_is_active("rsutcs4co2").OR.xios_field_is_active("rlutcs4co2").OR. &
+           xios_field_is_active("rsu4co2").OR.xios_field_is_active("rsucs4co2").OR. &
+           xios_field_is_active("rsd4co2").OR.xios_field_is_active("rsdcs4co2").OR. &
+           xios_field_is_active("rlu4co2").OR.xios_field_is_active("rlucs4co2").OR. &
+           xios_field_is_active("rld4co2").OR.xios_field_is_active("rldcs4co2")) &
+           ok_4xCO2atm=.TRUE. 
+      if (is_master) write (lunout,*)'ok_4xCO2atm= ',swaero_diag, swaerofree_diag, dryaod_diag, ok_4xCO2atm
+#endif
+    endif
 
     !====================================================================
