Index: /trunk/LMDZ.MARS/README
===================================================================
--- /trunk/LMDZ.MARS/README	(revision 2614)
+++ /trunk/LMDZ.MARS/README	(revision 2615)
@@ -3593,2 +3593,5 @@
 == 18/01/2022 == RV
 Open_MP Correction for previous commit: commision of photolysis_mod
+
+== 18/01/2022 == RV
+Put all the "save" variables as "!$OMP THREADPRIVATE" in aeronomars
Index: /trunk/LMDZ.MARS/libf/aeronomars/chemthermos.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/chemthermos.F90	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/chemthermos.F90	(revision 2615)
@@ -55,4 +55,6 @@
       logical,save :: firstcall=.true.
 
+!$OMP THREADPRIVATE(nesptherm,firstcall)
+
 ! Tracer indexes in the GCM:
       integer,save :: g_co2=0
@@ -84,4 +86,7 @@
       integer,save :: g_hco2plus=0
       integer,save :: g_elec=0
+
+!$OMP THREADPRIVATE(g_co2,g_co,g_o,g_o1d,g_o2,g_o3,g_h,g_h2,g_oh,g_ho2,g_h2o2,g_n2,g_h2o_vap)
+!$OMP THREADPRIVATE(g_n,g_no,g_no2,g_n2d,g_co2plus,g_oplus,g_o2plus,g_coplus,g_cplus,g_nplus,g_noplus,g_n2plus,g_hplus,g_hco2plus,g_elec)
       
 ! Tracer indexes in the thermospheric chemistry:
Index: /trunk/LMDZ.MARS/libf/aeronomars/concentrations.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/concentrations.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/concentrations.F	(revision 2615)
@@ -54,4 +54,6 @@
       logical, save :: firstcall = .true.
 
+!$OMP THREADPRIVATE(nbq,niq,aki,cpi,firstcall)
+
       if (firstcall) then
 
Index: /trunk/LMDZ.MARS/libf/aeronomars/conduction.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/conduction.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/conduction.F	(revision 2615)
@@ -58,4 +58,6 @@
       
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(phitop,firstcall)
 
 c-----------------------------------------------------------------------
Index: /trunk/LMDZ.MARS/libf/aeronomars/euvheat.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/euvheat.F90	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/euvheat.F90	(revision 2615)
@@ -56,7 +56,12 @@
       integer,save :: nespeuv    ! Number of species considered
 
+!$OMP THREADPRIVATE(nespeuv)
+
       INTEGER :: l,ig,n
       integer,save :: euvmod
       real, allocatable, save :: rm(:,:)   ! number density (cm-3)
+
+!$OMP THREADPRIVATE(euvmod,rm)
+
       real :: zq(ngrid,nlayer,nq) ! local updated tracer quantity
       real :: zt(ngrid,nlayer)      ! local updated atmospheric temperature
@@ -126,6 +131,9 @@
       integer,save :: g_n2d=0
 
+!$OMP THREADPRIVATE(g_co2,g_o,g_o2,g_h2,g_h2o2,g_h2o,g_o3,g_n2,g_n,g_no,g_co,g_h,g_no2,g_oh,g_ho2,g_o1d,g_n2d)
 
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(firstcall)
 
 ! Initializations and sanity checks:
@@ -416,4 +424,6 @@
          call hrtherm (ig,nlayer,euvmod,rm,nespeuv,tx,zlocal,zenit,zday,jtot)
 
+
+
 !        euveff=0.16    !UV heating efficiency. Following Fox et al. ASR 1996
                        !should vary between 19% and 23%. Lower values 
Index: /trunk/LMDZ.MARS/libf/aeronomars/hrtherm.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/hrtherm.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/hrtherm.F	(revision 2615)
@@ -80,4 +80,5 @@
          dn='d'
       end if
+
       if(dn.eq.'n') then
         do i=1,nlayer                                    
Index: /trunk/LMDZ.MARS/libf/aeronomars/iono_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/iono_h.F90	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/iono_h.F90	(revision 2615)
@@ -48,4 +48,8 @@
       real*8,save,allocatable ::   tauhplus(:,:)
       real*8,save,allocatable ::   tauhco2plus(:,:)
+
+!$OMP THREADPRIVATE(o1d_eq,ho2_eq,oh_eq,h_eq,n2d_eq,no2_eq,o3_eq,no_eq,cplus_eq,coplus_eq,oplus_eq)
+!$OMP THREADPRIVATE(n2plus_eq,hplus_eq,co2plus_eq,o2plus_eq,noplus_eq,nplus_eq,hco2plus_eq,tauco2,tauo2,tauo3p,tauco,tauh,tauoh,tauho2,tauh2)
+!$OMP THREADPRIVATE(tauh2o,tauo1d,tauh2o2,tauo3,taun,tauno,taun2,taun2d,tauno2,tauco2plus,tauoplus,tauo2plus,taucoplus,taucplus,taunplus,taunoplus,taun2plus,tauhplus,tauhco2plus)
 
       CONTAINS
Index: /trunk/LMDZ.MARS/libf/aeronomars/jthermcalc_e107.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/jthermcalc_e107.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/jthermcalc_e107.F	(revision 2615)
@@ -224,4 +224,5 @@
       call interfast 
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+      
       do i=1,nlayer
          ind=auxind(i)
@@ -314,4 +315,5 @@
           call interfast(wm,wp,auxind,auxcolinp,nlayer,
      $        auxcoltab,nz2,limdown,limup)
+
           do i=1,nlayer
              ind=auxind(i)
@@ -428,4 +430,5 @@
       call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
       do i=1,nlayer
          ind=auxind(i)
@@ -518,4 +521,5 @@
          call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
          !Correction to include T variation of CO2 cross section
          if(indexint.eq.24) then
@@ -631,4 +635,5 @@
          call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
          do i=1,nlayer
             ind=auxind(i)
@@ -738,4 +743,5 @@
          call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
          do i=1,nlayer
             ind=auxind(i)
@@ -835,4 +841,5 @@
       call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
       do i=1,nlayer
          ind=auxind(i)
@@ -919,4 +926,5 @@
       call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
       do i=1,nlayer
          ind=auxind(i)
@@ -980,4 +988,5 @@
       call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
       do i=1,nlayer
          ind=auxind(i)
@@ -1041,4 +1050,5 @@
       call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
       do i=1,nlayer
          ind=auxind(i)
@@ -1095,4 +1105,5 @@
       call interfast
      $     (wm,wp,auxind,auxcolinp,nlayer,auxcoltab,nz2,limdown,limup)
+
       do i=1,nlayer
          ind=auxind(i)
Index: /trunk/LMDZ.MARS/libf/aeronomars/moldiff.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/moldiff.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/moldiff.F	(revision 2615)
@@ -102,4 +102,8 @@
       real abfac(ncompmoldiff)
       real,save :: dij(ncompmoldiff,ncompmoldiff)
+
+!$OMP THREADPRIVATE(g_co2,g_co,g_o,g_o1d,g_o2,g_o3,g_h,g_h2)
+!$OMP THREADPRIVATE(g_oh,g_ho2,g_h2o2,g_n2,g_ar,g_h2o,gcmind)
+!$OMP THREADPRIVATE(firstcall,dij)
 
 ! Initializations at first call
Index: /trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff.F	(revision 2615)
@@ -63,8 +63,13 @@
       integer,save :: g_h2o=0
 
+!$OMP THREADPRIVATE(g_co2,g_co,g_o,g_o1d,g_o2,g_o3,g_h,g_h2,g_oh)
+!$OMP THREADPRIVATE(g_ho2,g_h2o2,g_n2,g_ar,g_h2o)
+
       integer,save :: gcmind(ncompmoldiff)
 
       real dnh
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(gcmind,firstcall)
 
 ! Initializations at first call (and some sanity checks)
Index: /trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F	(revision 2615)
@@ -82,4 +82,7 @@
       real dnh
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(firstcall)
+
       logical,parameter :: outputcoeffs=.false. ! to output 'coeffs.dat' file,
                                                 ! set outputcoeffs=.true.
Index: /trunk/LMDZ.MARS/libf/aeronomars/molvis.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/molvis.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/molvis.F	(revision 2615)
@@ -70,4 +70,6 @@
       
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(firstcall)
 
 c-----------------------------------------------------------------------
Index: /trunk/LMDZ.MARS/libf/aeronomars/param_v4_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/param_v4_h.F90	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/param_v4_h.F90	(revision 2615)
@@ -65,4 +65,6 @@
    REAL,SAVE,ALLOCATABLE :: jdistot_b(:,:)
    REAL,SAVE,ALLOCATABLE :: jion(:,:,:)
+
+!$OMP THREADPRIVATE(jfotsout,jdistot,jdistot_b,jion)
 
    REAL*8,SAVE,ALLOCATABLE :: Pco2(:,:)
@@ -205,4 +207,11 @@
    REAL*8,SAVE,ALLOCATABLE :: tminhplus(:)
    REAL*8,SAVE,ALLOCATABLE :: tminhco2plus(:)
+
+!$OMP THREADPRIVATE(Pco2,Po2,Po3p,Pco,Ph,Poh,Pho2,Ph2,Ph2o,Po1d,Ph2o2,Po3,Pn,Pno,Pno2,Pn2,Pn2d,Pco2plus,Poplus,Po2plus,Pelect,Pcoplus,Pcplus,Pnplus,Pnoplus,Pn2plus,Phplus,Phco2plus,Pco2tot,Po2tot,Po3ptot,Pcotot)
+!$OMP THREADPRIVATE(Phtot,Pohtot,Pho2tot,Ph2tot,Ph2otot,Po1dtot,Ph2o2tot,Po3tot,Pntot,Pnotot,Pno2tot,Pn2tot,Pn2dtot,Pco2plustot,Poplustot,Po2plustot,Pelecttot,Pcoplustot,Pcplustot,Pnplustot,Pnoplustot,Pn2plustot)
+!$OMP THREADPRIVATE(Phplustot,Phco2plustot,Lco2,Lo2,Lo3p,Lco,Lh,Loh,Lho2,Lh2,Lh2o,Lo1d,Lh2o2,Lo3,Ln,Lno,Lno2,Ln2,Ln2d, Lco2plus,Loplus,Lo2plus,Lelect,Lcoplus,Lcplus,Lnplus,Lnoplus,Ln2plus,Lhplus,Lhco2plus,Lco2tot)
+!$OMP THREADPRIVATE(Lo2tot,Lo3ptot,Lcotot,Lhtot,Lohtot,Lho2tot,Lh2tot,Lh2otot,Lo1dtot,Lh2o2tot,Lo3tot,Lntot,Lnotot,Lno2tot,Ln2tot,Ln2dtot,Lco2plustot,Loplustot,Lo2plustot,Lelecttot,Lcoplustot,Lcplustot,Lnplustot)
+!$OMP THREADPRIVATE(Lnoplustot,Ln2plustot,Lhplustot,Lhco2plustot,tminco2,tmino2,tmino3p,tminco,tminh,tminoh,tminho2,tminh2,tminh2o,tmino1d,tminh2o2,tmino3,tminn,tminno,tminno2,tminn2,tminn2d,tminco2plus,tminoplus)
+!$OMP THREADPRIVATE(tmino2plus,tmincoplus,tmincplus,tminnplus,tminnoplus,tminn2plus,tminhplus,tminhco2plus)
 
    CONTAINS
Index: /trunk/LMDZ.MARS/libf/aeronomars/paramfoto_compact.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/paramfoto_compact.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/paramfoto_compact.F	(revision 2615)
@@ -2945,4 +2945,7 @@
       logical firstcall
       save firstcall
+
+!$OMP THREADPRIVATE(firstcall)
+
       data firstcall /.true./
 
Index: /trunk/LMDZ.MARS/libf/aeronomars/perosat.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/perosat.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/perosat.F	(revision 2615)
@@ -54,4 +54,6 @@
       REAL psat_hpa                    ! pression saturante (hPa)
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(firstcall)
 
 c     Pour diagnostique :
Index: /trunk/LMDZ.MARS/libf/aeronomars/photochemistry.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/photochemistry.F90	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/photochemistry.F90	(revision 2615)
@@ -89,4 +89,7 @@
 integer :: lswitch
 logical, save :: firstcall = .true.
+
+!$OMP THREADPRIVATE(firstcall)
+
 logical :: jionos                ! switch for J parameterization
 
@@ -133,4 +136,6 @@
 integer,save      :: i_do2      = 0
 integer,save      :: i_hdo2     = 0
+
+!$OMP THREADPRIVATE(i_co2plus,i_oplus,i_o2plus,i_noplus,i_coplus,i_cplus,i_n2plus,i_nplus,i_hplus ,i_hco2plus,i_hcoplus,i_h2oplus,i_h3oplus,i_ohplus,i_elec,i_hdo,i_od,i_d,i_hd,i_do2,i_hdo2)
 
 !integer,parameter :: i_co2plus = 18
@@ -3915,4 +3920,6 @@
       integer      :: l, iesp
       logical,save :: firstcall = .true.
+
+!$OMP THREADPRIVATE(firstcall)
       
 !     first call initializations
Index: /trunk/LMDZ.MARS/libf/aeronomars/photolysis_online.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/photolysis_online.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/photolysis_online.F	(revision 2615)
@@ -979,4 +979,6 @@
 
       logical, save :: delta = .true.
+
+!$OMP THREADPRIVATE(delta)
 
 !_______________________________________________________________________
Index: /trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F	(revision 2615)
@@ -56,4 +56,6 @@
 
       logical, save :: firstcall = .true.
+
+!$OMP THREADPRIVATE(factor_ice, factor_dust,firstcall)
 
 !==========================================================================
Index: /trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F	(revision 2615)
@@ -39,4 +39,6 @@
       INTEGER :: l,ig
       logical,save :: firstcall=.true.
+
+!$OMP THREADPRIVATE(firstcall)
 
       if (firstcall) then
Index: /trunk/LMDZ.MARS/libf/aeronomars/types_asis.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/types_asis.F90	(revision 2614)
+++ /trunk/LMDZ.MARS/libf/aeronomars/types_asis.F90	(revision 2615)
@@ -31,3 +31,5 @@
 type(z4spec), allocatable, save :: indice_4(:)
 
+!$OMP THREADPRIVATE(indice_phot,indice_3,indice_4)
+
 end module types_asis
