Index: /trunk/LMDZ.MARS/README
===================================================================
--- /trunk/LMDZ.MARS/README	(revision 2613)
+++ /trunk/LMDZ.MARS/README	(revision 2614)
@@ -3590,2 +3590,5 @@
 == 18/01/2022 == RV
 Open_MP files reading for PHOTOCHEMISTRY : photochem = .true.
+
+== 18/01/2022 == RV
+Open_MP Correction for previous commit: commision of photolysis_mod
Index: /trunk/LMDZ.MARS/libf/aeronomars/photolysis_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/photolysis_mod.F90	(revision 2613)
+++ /trunk/LMDZ.MARS/libf/aeronomars/photolysis_mod.F90	(revision 2614)
@@ -7,4 +7,7 @@
   integer, save :: nphot = 13             ! number of photolysis 
                                           ! is incremented by +2 in calchim if deuterium chemisty)
+
+!$OMP THREADPRIVATE(nphot)
+
   integer, parameter :: nabs  = 10        ! number of absorbing gases
 
@@ -14,5 +17,9 @@
   integer, save :: mopt                   ! high-res/low-res switch
 
+!$OMP THREADPRIVATE(mopt)
+
   real, dimension(nw), save :: wl, wc, wu ! lower, center, upper wavelength for each interval
+
+!$OMP THREADPRIVATE(wl, wc, wu)
 
 ! solar flux
@@ -40,4 +47,7 @@
   real, dimension(nw), save :: xshdo                                  ! hdo absorption cross-section (cm2)
   real, dimension(nw), save :: albedo                                 ! surface albedo
+
+!$OMP THREADPRIVATE(f,xsco2_195, xsco2_295, xsco2_370,yieldco2,xso2_150, xso2_200, xso2_250, xso2_300,yieldo2,xso3_218, xso3_298,xsh2o,xsh2o2,xsho2,xsh2,yieldh2,xsno2, xsno2_220, xsno2_294,yldno2_248,yldno2_298)
+!$OMP THREADPRIVATE(xsno,yieldno,xsn2,yieldn2,xshdo,albedo)
 
 contains
@@ -362,4 +372,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -399,4 +411,7 @@
          fil = trim(datadir)//'/solar_fluxes/atlas3_thuillier_tuv.txt'
          print*, 'solar flux : ', fil
+
+      if(is_master) then
+
          open(kin, file=fil, status='old', iostat=ierr)
 
@@ -440,4 +455,7 @@
 !           write(25,*) iw, wc(iw), f(iw)
          ENDDO
+
+      endif !is_master
+     call bcast(f)
 
       end if
@@ -717,4 +735,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -771,4 +791,6 @@
       print*, 'section efficace CO2 195K: ', fil
 
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
       DO i = 1,11 
@@ -795,8 +817,14 @@
       END DO
 
+      endif !is_master
+
+      call bcast(xsco2_195)
+
 !     295K:
 
       fil = trim(datadir)//'/cross_sections/co2_euv_uv_2018_295k.txt'
       print*, 'section efficace CO2 295K: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
@@ -824,8 +852,14 @@
       END DO
 
+      endif !is_master
+
+      call bcast(xsco2_295)
+
 !     370K:
 
       fil = trim(datadir)//'/cross_sections/co2_euv_uv_2018_370k.txt'
       print*, 'section efficace CO2 370K: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
@@ -853,8 +887,14 @@
       END DO
 
+      endif !is_master
+
+      call bcast(xsco2_370)
+
 !     photodissociation yield:
 
       fil = trim(datadir)//'/cross_sections/efdis_co2-o2_schunkandnagy2000.txt'
       print*, 'photodissociation yield CO2: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
@@ -882,4 +922,8 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(yieldco2)
+
 !     DO l = 1, nw-1
 !        write(kout,*) wl(l), xsco2_195(l),
@@ -908,4 +952,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -942,4 +988,7 @@
       fil = trim(datadir)//'/cross_sections/o2_composite_2018_150K.txt'
       print*, 'section efficace O2 150K: ', fil
+
+      if(is_master) then
+
       open(kin, file=fil, status='old', iostat=ierr)
 
@@ -975,6 +1024,13 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(xso2_150)
+
       fil = trim(datadir)//'/cross_sections/o2_composite_2018_200K.txt'
       print*, 'section efficace O2 200K: ', fil
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -999,6 +1055,13 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(xso2_200)
+
       fil = trim(datadir)//'/cross_sections/o2_composite_2018_250K.txt'
       print*, 'section efficace O2 250K: ', fil
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -1023,6 +1086,13 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(xso2_250)
+
       fil = trim(datadir)//'/cross_sections/o2_composite_2018_300K.txt'
       print*, 'section efficace O2 300K: ', fil
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -1047,7 +1117,14 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(xso2_300)
+
 !     photodissociation yield
 
       fil = trim(datadir)//'/cross_sections/efdis_co2-o2_schunkandnagy2000.txt'
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -1073,4 +1150,8 @@
          STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yieldo2)
 
       end subroutine rdxso2
@@ -1097,4 +1178,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -1129,4 +1212,6 @@
       print*, 'section efficace O3 218K: ', fil
 
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
       n1 = 167
@@ -1151,8 +1236,14 @@
       END DO
 
+      endif !is_master
+
+      call bcast(xso3_218)
+
 !     JPL 2006 298 K
 
       fil = trim(datadir)//'/cross_sections/o3_cross-sections_jpl_2006_298K.txt' 
       print*, 'section efficace O3 298K: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
@@ -1177,4 +1268,8 @@
          xso3_298(iw) = yg(iw)
       END DO
+
+      endif !is_master
+
+      call bcast(xso3_298)
 
       end subroutine rdxso3
@@ -1199,4 +1294,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       IMPLICIT NONE
@@ -1227,4 +1324,6 @@
       print*, 'section efficace H2O: ', fil
 
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old') 
 
@@ -1248,4 +1347,8 @@
          STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yg)
       
       end subroutine rdxsh2o
@@ -1270,4 +1373,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       IMPLICIT NONE
@@ -1298,4 +1403,6 @@
       print*, 'section efficace HDO: ', fil
 
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old') 
 
@@ -1319,4 +1426,8 @@
          STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yg)
       
       end subroutine rdxshdo
@@ -1341,4 +1452,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -1369,4 +1482,6 @@
       fil = trim(datadir)//'/cross_sections/h2o2_composite.txt'
       print*, 'section efficace H2O2: ', fil
+
+      if(is_master) then
 
       OPEN(kin,FILE=fil,STATUS='OLD')
@@ -1394,4 +1509,8 @@
       END DO
 
+      endif !is_master
+
+      call bcast(xsh2o2)
+
       end subroutine rdxsh2o2
 
@@ -1411,4 +1530,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       IMPLICIT NONE
@@ -1439,4 +1560,6 @@
       print*, 'section efficace HO2: ', fil
 
+      if(is_master) then
+
       OPEN(kin,FILE=fil,STATUS='OLD')
       READ(kin,*) n
@@ -1457,4 +1580,8 @@
         STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yg)
  
       end subroutine rdxsho2
@@ -1474,4 +1601,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -1504,4 +1633,6 @@
       print*, 'section efficace H2: ', fil
 
+      if(is_master) then
+
       OPEN(kin,FILE=fil,STATUS='OLD')
 
@@ -1523,8 +1654,15 @@
         STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yg)
  
 !     photodissociation yield
 
       fil = trim(datadir)//'/cross_sections/h2_ionef_schunknagy2000.txt'
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -1547,4 +1685,8 @@
         STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yieldh2)
 
       end subroutine rdxsh2
@@ -1573,4 +1715,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -1606,4 +1750,6 @@
       print*, 'section efficace NO2: ', fil
 
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,status='old')
       DO i = 1, 3
@@ -1621,6 +1767,12 @@
       CALL inter2(nw,wl,yg1,n1,x1,y1,ierr)
 
+      endif !is_master
+
+      call bcast(yg1)
+
       fil = trim(datadir)//'/cross_sections/no2_xs_vandaele_294K.txt'
       print*, 'section efficace NO2: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,status='old')
@@ -1639,6 +1791,12 @@
       CALL inter2(nw,wl,yg2,n2,x2,y2,ierr)
 
+      endif !is_master
+
+      call bcast(yg2)
+
       fil = trim(datadir)//'/cross_sections/no2_xs_vandaele_220K.txt'
       print*, 'section efficace NO2: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,status='old')
@@ -1663,8 +1821,17 @@
       end do
 
+      endif !is_master
+
+      call bcast(yg3)
+      call bcast(xsno2)
+      call bcast(xsno2_294)
+      call bcast(xsno2_220)
+
 !     photodissociation efficiency from jpl 2006
 
       fil = trim(datadir)//'/cross_sections/no2_yield_jpl2006.txt'
       print*, 'quantum yield NO2: ', fil
+
+      if(is_master) then
 
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
@@ -1691,4 +1858,10 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(yg4)
+
+      if(is_master) then
+
       CALL addpnt(x5,y5,kdata,n5,x5(1)*(1.-deltax),y5(1))
       CALL addpnt(x5,y5,kdata,n5,               0.,y5(1))
@@ -1705,4 +1878,10 @@
          yldno2_248(iw) = yg5(iw)
       end do
+
+      endif !is_master
+
+      call bcast(yg5)
+      call bcast(yldno2_298)
+      call bcast(yldno2_248)
       
       end subroutine rdxsno2
@@ -1723,4 +1902,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -1751,4 +1932,7 @@
       fil = trim(datadir)//'/cross_sections/no_xs_francisco.txt'
       print*, 'section efficace NO: ', fil
+
+      if(is_master) then
+
       OPEN(kin,FILE=fil,STATUS='OLD')
 
@@ -1769,8 +1953,15 @@
          STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yg)
   
 !     photodissociation yield
 
       fil = trim(datadir)//'/cross_sections/noefdis.txt'
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -1791,4 +1982,8 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(yieldno)
+
       end subroutine rdxsno
 
@@ -1807,4 +2002,6 @@
 
       use datafile_mod, only: datadir
+      USE mod_phys_lmdz_para, ONLY: is_master
+      USE mod_phys_lmdz_transfert_para, ONLY: bcast
 
       implicit none
@@ -1836,4 +2033,7 @@
       fil = trim(datadir)//'/cross_sections/n2secef_01nm.txt'
       print*, 'section efficace N2: ', fil
+
+      if(is_master) then
+
       OPEN(kin,FILE=fil,STATUS='OLD')
 
@@ -1855,8 +2055,15 @@
         STOP
       ENDIF
+
+      endif !is_master
+
+      call bcast(yg)
  
 !     photodissociation yield
 
       fil = trim(datadir)//'/cross_sections/n2_ionef_schunknagy2000.txt'
+
+      if(is_master) then
+
       OPEN(UNIT=kin,FILE=fil,STATUS='old')
 
@@ -1880,4 +2087,8 @@
       ENDIF
 
+      endif !is_master
+
+      call bcast(yieldn2)
+
       end subroutine rdxsn2
 
