Index: trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F	(revision 3713)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F	(revision 3714)
@@ -35,5 +35,5 @@
       use dimphy
       USE geometry_mod, only: cell_area
-      USE chemparam_mod,only:M_tr
+      USE chemparam_mod,only:M_tr,type_tr
       USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
       IMPLICIT none
@@ -70,8 +70,15 @@
       real :: deltatr(klon,klev,nqtot)
 
-
-
-
-      integer,parameter :: nblat=3,nblon=3,nbaire=3,nbflux=2,maxcell=16 
+c several identical tracers emitted at different places, with different
+c fluxes, at the same time : 
+c same_tracer=.true. and various number of areas and fluxes
+c      logical,parameter :: same_tracer=.true.
+c      integer,parameter :: nblat=3,nblon=3,nbaire=3,nbflux=2,maxcell=16 
+c Otherwise, emission of one of the tracers only, in one area only
+      logical,parameter :: same_tracer=.false.
+      integer,parameter :: nblat=1,nblon=1,nbaire=1,nbflux=1
+      integer,save :: iq_co2,iq_n2
+
+      integer,parameter :: maxcell=10000
       integer,parameter :: Nheight=3 ! layer emission (150m)
       integer,save :: Ncell(nbaire) 
@@ -81,5 +88,4 @@
       integer,save :: ig_zone(nblat,nblon,nbaire,nbflux,maxcell) 
       integer,save :: numcell(nblat,nblon,nbaire,nbflux)
-        
 
       INTEGER i, k, it
@@ -102,9 +108,22 @@
 
         ALLOCATE(M_tr(nqtot))
-        M_tr(:)=44.                ! CO2
+        ALLOCATE(type_tr(nqtot))
+        do i=1,nqtot
+           if (tname(i)(1:3).eq.'co2') then   ! CO2
+               M_tr(i)=44.
+               iq_co2 =i
+               type_tr(i)=1
+           endif
+           if (tname(i)(1:2).eq.'n2')  then   ! N2
+               M_tr(i)=28.
+               iq_n2 =i
+               type_tr(i)=1
+           endif
+        enddo
 
 C=========================================================================
 c Caracteristiques des traceurs emis:
 C=========================================================================
+
 
 c nombre total de traceur
@@ -115,26 +134,16 @@
          endif 
                  
-
-
-
 c flux de CO2 (kg/s/m2)
-         flux_surface_co2(1) = 5.*10.**-9.
-         flux_surface_co2(2) = 5.*10.**-15.
+c 4.5e-7 correspond a 1% (en masse) d une couche de 2E6 Pa en 500 jV
+c donc avec 5E-7, on vide le N2 en 1000 jV
+c         flux_surface_co2(1) = 5.E-5
+         flux_surface_co2(1) = 0.
 
 c nombre de cellule pour le cote du carre d'aire 
-         Ncell(1)= 2
-         Ncell(2)= 3
-         Ncell(3)= 4
-      
-
+         Ncell(1)= 9999
 
 c localisation zone emission
-         lat_zone(1) = 08.
-         lat_zone(2) = -50.
-         lat_zone(3) = 35.
-         lon_zone(1) = -172.
-         lon_zone(2) = -20.
-         lon_zone(3) = 70.
-
+         lat_zone(1) = 0.
+         lon_zone(1) = 0.
  
          if ((nbp_lon*nbp_lat)==1) then ! running a 1D simulation
@@ -153,10 +162,13 @@
             do iaire=1,nbaire
 
-             if ((xlat(i).ge.lat_zone(ilat))
+            if (  
+     &       (Ncell(iaire).ne.9999)
+c emission on some areas only
+     &      .and.((xlat(i).ge.lat_zone(ilat))
      &      .and.((xlat(i)-Ncell(iaire)*deltalat)
      &      .lt.lat_zone(ilat))
      &      .and.(xlon(i).le.lon_zone(ilon))
      &      .and.((xlon(i)+Ncell(iaire)*deltalon)
-     &      .gt.lon_zone(ilon))) then
+     &      .gt.lon_zone(ilon))) ) then
 
               do iflux=1,nbflux
@@ -178,9 +190,14 @@
           tr_seri(:,:,:)=0.
 
-
            do i=1,klon
             do k=1,klev
-              tr_seri(i,k,:)=1.-28/43.44*max(min(0.035,
-     &           0.035*(1.-log(paprs(i,k)/6.e6)/log(9.e6/6.e6))),0.)
+c Profile for VeGa2
+c              tr_seri(i,k,iq_n2) = M_tr(i_n2)/43.44*max(min(0.035,
+c     &           0.035*(1.-log(paprs(i,k)/6.e6)/log(9.e6/6.e6))),0.)
+c              tr_seri(i,k,iq_co2)= 1. - tr_seri(i,k,iq_n2)
+
+c Uniform initialization, yN2=3.5%, regular mean mol mass = 43.44 g/mol
+              tr_seri(i,k,iq_n2) = 0.035*M_tr(iq_n2)/43.44
+              tr_seri(i,k,iq_co2)= 1. - tr_seri(i,k,iq_n2)
             end do
            end do
@@ -202,24 +219,16 @@
        flux(:,:)=0.
 
+        if (same_tracer) then
 c emet les traceurs qui sont presents sur la grille
-      do ilat  = 1,nblat
-       do ilon  = 1,nblon
+        do ilat  = 1,nblat
+        do ilon  = 1,nblon
         do iaire = 1,nbaire
-         do iflux = 1,nbflux
+        do iflux = 1,nbflux
      
               it=min( (ilat-1)*nblon*nbflux*nbaire+(iaire-1)*nbflux
      &         +(ilon-1)*nbaire*nbflux+iflux , nqtot )   
  
-
-c injection dans une seule cellule:
-c source en kg/kg/s
-c            deltatr(i,Nheight(iz),it) = so2_quantity/(86400.*Nemiss) ! kg/s
-c     $ *RG/( area_emiss(ilat,ilon)
-c     $      *(paprs(i,Nheight(iz))-paprs(i,Nheight(iz)+1)) )    ! /kg (masse cellule)
-     
-c            tr_seri(i,Nheight(iz),it) = tr_seri(i,Nheight(iz),it)
-c     $      + deltatr(i,Nheight(iz),it)*pdtphys
-
-c injection dans toute la colonne (a faire):
+         if (Ncell(iaire).ne.9999) then
+c column injection
           do ipos=1,maxcell
  
@@ -231,33 +240,49 @@
             do k=1,Nheight
              deltatr(i,k,it) = flux_surface_co2(iflux) ! kg/s/m2
-     $         *RG/(paprs(i,1)-paprs(i,Nheight+1))    ! /kg (masse colonne)
-     
-               tr_seri(i,k,it) = tr_seri(i,k,it)+deltatr(i,k,it)*pdtphys
+     $         *RG/(paprs(i,1)-paprs(i,Nheight+1))    ! / (kg/m2) (masse colonne)
+     
+             tr_seri(i,k,it) = tr_seri(i,k,it)+deltatr(i,k,it)*pdtphys
             end do
 
            end if 
           end do
- 
-        end do
-        end do
-        end do
-        end do
-
+         endif
+        end do
+        end do
+        end do
+        end do
+
+        else  ! same_tracer=.false.
+
+c column injection !! with constant mass !!
+          do i=1,nlon
+ 
+             flux(i,iq_co2)=flux_surface_co2(1)  
+              
+            do k=1,Nheight
+          deltatr(i,k,iq_co2) = min((1.-tr_seri(i,k,iq_co2))/pdtphys,
+     $                                flux(i,iq_co2)) ! kg/s/m2
+     $         *RG/(paprs(i,1)-paprs(i,Nheight+1))    ! / (kg/m2) (masse colonne)
+             deltatr(i,k,iq_n2)  = -deltatr(i,k,iq_co2)
+             tr_seri(i,k,iq_co2) = tr_seri(i,k,iq_co2)
+     $                            +deltatr(i,k,iq_co2)*pdtphys
+             tr_seri(i,k,iq_n2)  = tr_seri(i,k,iq_n2)
+     $                            +deltatr(i,k,iq_n2)*pdtphys
+            end do
+
+          end do
+
+        endif ! same_tracer
+ 
        
 c======================================================================
 c======================================================================
 
-   
-      
-
-     
 #ifdef CPP_XIOS      
-       do it=1,nqtot
-       CALL  send_xios_field("flux_"//tname(it),
-     &                     flux(:,it)) 
-      end do 
+!      do it=1,nqtot
+!      CALL  send_xios_field("flux_"//tname(it),
+!    &                     flux(:,it)) 
+!     end do 
 #endif
-
-
 
       RETURN
Index: trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.F	(revision 3713)
+++ trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.F	(revision 3714)
@@ -62,5 +62,5 @@
       INTEGER k, kk, i, j, band
       integer,save :: i_sw
-      integer,parameter :: subloop=100
+      integer,save :: subloop
 
       REAL   PPB(klev+1)
@@ -101,4 +101,11 @@
 
       if (firstcall) then
+
+c s2: solar only 240 times per Vd if diurnal cycle
+        if (cycle_diurne) then
+            subloop = nbapp_rad/240
+        else
+            subloop = nbapp_rad  ! no diurnal cycle, once per Vd is enough
+        endif
 
 c ---------- ksive --------------
