Index: /trunk/LMDZ.MARS/README
===================================================================
--- /trunk/LMDZ.MARS/README	(revision 2577)
+++ /trunk/LMDZ.MARS/README	(revision 2578)
@@ -3503,2 +3503,6 @@
 == 27/10/2021 == JL+EM
 Fixes in the utilities for the picky gfortran 10+ compiler
+
+== 29/10/2021 == RV
+First stage of implementing Open_MP in the physic. 
+So far it can initialyse physic and run with all routines at .FALSE.
Index: /trunk/LMDZ.MARS/libf/aeronomars/calchim_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/calchim_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/aeronomars/calchim_mod.F90	(revision 2578)
@@ -6,4 +6,6 @@
   REAL,SAVE,ALLOCATABLE :: zdqchim(:,:,:) ! Tendancy on pq due to photochemistry
   REAL,SAVE,ALLOCATABLE :: zdqschim(:,:) ! Tendancy on qsurf due to photochemistry
+
+!$OMP THREADPRIVATE(ichemistry,zdqchim,zdqschim)
 
   CONTAINS
Index: /trunk/LMDZ.MARS/libf/phymars/comgeomfi_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/comgeomfi_h.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/comgeomfi_h.F90	(revision 2578)
@@ -8,4 +8,6 @@
        REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: sinlat
        REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: coslat
+
+!$OMP THREADPRIVATE(sinlon,coslon,sinlat,coslat)
 
        contains
Index: /trunk/LMDZ.MARS/libf/phymars/comsaison_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/comsaison_h.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/comsaison_h.F90	(revision 2578)
@@ -10,4 +10,6 @@
   real,save,allocatable :: fract(:)
   real,save,allocatable :: local_time(:) ! local solar time as fraction of day (0,1)
+
+!$OMP THREADPRIVATE(callsais,isaison,dist_sol,declin,mu0,fract,local_time)
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90	(revision 2578)
@@ -14,4 +14,6 @@
        !                 soil_settings.F)
 
+!$OMP THREADPRIVATE(layer,mlayer,inertiedat)
+
   ! variables (FC: built in firstcall in soil.F)
   REAL,SAVE,ALLOCATABLE :: tsoil(:,:)       ! sub-surface temperatures (K)
@@ -23,4 +25,6 @@
   real,save,allocatable :: beta(:,:)        ! beta_k coefficients
   real,save :: mu
+
+!$OMP THREADPRIVATE(tsoil,mthermdiff,thermdiff,coefq,coefd,alph,beta,mu )
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/conc_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/conc_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/conc_mod.F90	(revision 2578)
@@ -7,4 +7,6 @@
   real,save,allocatable :: cpnew(:,:)  ! specicic heat
   real,save,allocatable :: rnew(:,:)   ! specific gas constant
+
+!$OMP THREADPRIVATE(mmean,Akknew,cpnew,rnew)
   
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90	(revision 2578)
@@ -13,4 +13,5 @@
   integer,save :: NDLO2 !=NDLON
 
+!$OMP THREADPRIVATE(NFLEV,ndomainsz,NDLON,NDLO2)
 
 ! Number of kind of tracer radiative properties
@@ -24,4 +25,7 @@
   ! AS: previously in aerkind.h
   character*20, SAVE, ALLOCATABLE :: name_iaer(:)  ! name of the scatterers
+
+!$OMP THREADPRIVATE(naerkind,name_iaer)
+
   integer iaer_dust_conrath ! Typical dust profiles using a
                             ! Conrath type analytical equation
@@ -44,10 +48,15 @@
   INTEGER,SAVE,ALLOCATABLE :: iaerdust(:)
 
+!$OMP THREADPRIVATE(iaerdust)
+
   ! AS: was in suaer
   CHARACTER(LEN=30), SAVE, ALLOCATABLE :: file_id(:,:)
+
+!$OMP THREADPRIVATE(file_id)
 
 ! Reference wavelengths used to compute reference optical depth (m)
 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   REAL,SAVE,ALLOCATABLE :: longrefir(:),longrefvis(:)
+!$OMP THREADPRIVATE(longrefir,longrefvis)
   
 ! Definition of spectral intervals at thermal infrared wavelengths (LW)
@@ -73,4 +82,6 @@
   real,save :: sunfr(2) = (/ 0.274490 , 0.725509 /)
 
+!$OMP THREADPRIVATE(sunfr)
+
 ! Maximum number of grain size classes
 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -111,4 +122,7 @@
   REAL,SAVE,ALLOCATABLE :: nueffdust(:,:) ! Dust effective variance
 
+!$OMP THREADPRIVATE(dtrad,fluxrad_sky,fluxrad,albedo,totcloudfrac,aerosol,      &
+!$OMP                nueffdust)
+
 !! ------------------------------------------------------
 !! AS: what was previously in yomaer
@@ -139,4 +153,7 @@
   real,save,allocatable :: omegaIR(:,:,:)
   real,save,allocatable :: gIR(:,:,:)
+
+!$OMP THREADPRIVATE(tauvis,QVISsQREF,omegavis,gvis,QIRsQREF,omegaIR,gIR)
+
 ! Actual number of grain size classes in each domain for a
 !   given aerosol:
@@ -152,4 +169,7 @@
   real,save,allocatable :: omegaREFvis(:,:)
   real,save,allocatable :: omegaREFir(:,:)
+
+!$OMP THREADPRIVATE(nsize,radiustab,QREFvis,QREFir,omegaREFvis,omegaREFir)
+
 !! ------------------------------------------------------
 
Index: /trunk/LMDZ.MARS/libf/phymars/dust_param_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dust_param_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/dust_param_mod.F90	(revision 2578)
@@ -8,6 +8,11 @@
   LOGICAL,SAVE :: freedust ! if true: no rescaling (via tauscaling) of the dust mass and number
   LOGICAL,SAVE :: callddevil ! flag to activate dust devil (dust lifing/injection) parametrization
+
+!$OMP THREADPRIVATE(active, doubleq,submicron,lifting,freedust,     &
+!$OMP                callddevil)
   
   INTEGER,SAVE :: dustbin ! number of bins of dust tracers
+
+!$OMP THREADPRIVATE(dustbin)
 
   REAL,PARAMETER :: odpref = 610. ! Reference pressure (Pa) of
@@ -22,4 +27,6 @@
   REAL,PARAMETER :: t_scenario_sol=14/24. ! time of day (sol) at which
                     ! tau_pref_scenario is deemed exact
+
+!$OMP THREADPRIVATE(tauscaling, dustscaling_mode,dust_rad_adjust)
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/nonoro_gwd_ran_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/nonoro_gwd_ran_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/nonoro_gwd_ran_mod.F90	(revision 2578)
@@ -7,4 +7,6 @@
 REAL,ALLOCATABLE,SAVE :: east_gwstress(:,:) ! Profile of eastward stress
 REAL,ALLOCATABLE,SAVE :: west_gwstress(:,:) ! Profile of westward stress
+
+!$OMP THREADPRIVATE(du_nonoro_gwd,dv_nonoro_gwd,east_gwstress,west_gwstress)
 
 CONTAINS
Index: /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 2578)
@@ -3,4 +3,6 @@
 implicit none
   real,save :: tab_cntrl_mod(100)
+
+!$OMP THREADPRIVATE(tab_cntrl_mod)
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2578)
@@ -246,4 +246,7 @@
       INTEGER,SAVE :: day_ini ! Initial date of the run (sol since Ls=0)
       INTEGER,SAVE :: icount     ! counter of calls to physiq during the run.
+      REAL,SAVE :: time_phys
+
+!$OMP THREADPRIVATE(day_ini,icount,time_phys)
 
 #ifdef DUSTSTORM
@@ -447,5 +450,5 @@
       REAL satuco2(ngrid,nlayer)  ! co2 satu ratio for output
       REAL zqsatco2(ngrid,nlayer) ! saturation co2
-      REAL,SAVE :: time_phys
+
 
 ! Added for new NLTE scheme
Index: /trunk/LMDZ.MARS/libf/phymars/slope_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/slope_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/slope_mod.F90	(revision 2578)
@@ -5,4 +5,6 @@
   real,save,allocatable :: theta_sl(:) ! slope angle versus horizontal (deg)
   real,save,allocatable :: psi_sl(:)   ! slope orientation (deg)
+
+!$OMP THREADPRIVATE(theta_sl,psi_sl)
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90	(revision 2578)
@@ -10,6 +10,11 @@
   logical,save,allocatable :: watercaptag(:) ! flag for water ice surface
   real, save, allocatable :: dryness(:)
+
+!$OMP THREADPRIVATE(albedodat, phisfi,albedice,emisice,emissiv,TESicealbedo,     &
+!$OMP                watercaptag,dryness)
       
   logical,save :: temptag !temp tag for water caps
+
+!$OMP THREADPRIVATE(temptag)
       
   real,save :: albedo_h2o_cap ! water cap albedo
@@ -26,4 +31,9 @@
   real,save :: z0_default ! default (constant over planet) surface roughness (m)
 
+!$OMP THREADPRIVATE(albedo_h2o_cap,albedo_h2o_frost,inert_h2o_ice,               &
+!$OMP                frost_albedo_threshold,frost_metam_threshold,TESice_Ncoef,  &
+!$OMP                TESice_Scoef,iceradius,dtemisice,                           &
+!$OMP                zmea,zstd,zsig,zgam,zthe,hmons,summit,base,z0,z0_default )
+
   !! variables
   REAL,SAVE,ALLOCATABLE :: tsurf(:)   ! Surface temperature (K)
@@ -34,4 +44,6 @@
   REAL,ALLOCATABLE,SAVE :: qsurf(:,:) ! tracer on surface (e.g. kg.m-2)
   REAL,SAVE,ALLOCATABLE :: watercap(:) ! Surface water ice (kg.m-2)
+
+!$OMP THREADPRIVATE(tsurf,co2ice,emis,capcal,fluxgrd,qsurf,watercap)
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/tracer_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/tracer_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/tracer_mod.F90	(revision 2578)
@@ -5,4 +5,6 @@
       ! number of tracers:
       integer,save :: nqmx ! initialized in conf_phys
+
+!$OMP THREADPRIVATE(nqmx)  
    
       character*30,allocatable,save ::  noms(:)  ! name of the tracer
@@ -12,4 +14,7 @@
       real,allocatable,save :: alpha_lift(:) ! saltation vertical flux/horiz flux ratio (m-1)
       real,allocatable,save :: alpha_devil(:) ! lifting coeeficient by dust devil
+
+!$OMP THREADPRIVATE(noms,mmol,radius,rho_q,alpha_lift,                           &
+!$OMP                alpha_devil)  
 
       real,save :: varian      ! Characteristic variance of log-normal distribution
@@ -23,9 +28,16 @@
       real,save :: nuiceco2_sed   ! Sedimentation effective variance of the co2 ice dist.
       real,save :: nuiceco2_ref   ! Effective variance of the co2 ice dist.
+
+!$OMP THREADPRIVATE(varian,r3n_q,rho_dust,rho_ice,nuice_ref,                     &
+!$OMP                nuice_sed,ref_r0,rho_ice_co2,nuiceco2_sed,nuiceco2_ref)  
       
       real,save :: ccn_factor  ! ratio of nuclei for water ice particles
+
+!$OMP THREADPRIVATE(ccn_factor)  
 
       INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers (cf aeropacity)
       real,allocatable,save :: dryness(:)!"Dryness coefficient" for grnd water ice sublimation
+
+!$OMP THREADPRIVATE(nqdust,dryness)  
 
 
@@ -47,4 +59,8 @@
       integer,save :: igcm_topdust_number !  topdust number mixing ratio
 
+!$OMP THREADPRIVATE(igcm_dustbin,igcm_dust_mass,igcm_dust_number,igcm_ccn_mass,  &
+!$OMP                igcm_ccn_number,igcm_dust_submicron,igcm_stormdust_mass,    &
+!$OMP                igcm_stormdust_number,igcm_topdust_mass,igcm_topdust_number)  
+
       integer,save :: igcm_ccnco2_mass   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
       integer,save :: igcm_ccnco2_number ! CCN (dust and/or water ice) for CO2 number mixing ratio
@@ -52,4 +68,8 @@
       integer,save :: igcm_ccnco2_h2o_mass_ccn   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
       integer,save :: igcm_ccnco2_h2o_number ! CCN (dust and/or water ice) for CO2 number mixing ratio
+
+!$OMP THREADPRIVATE(igcm_ccnco2_mass,igcm_ccnco2_number,                         &
+!$OMP                igcm_ccnco2_h2o_mass_ice,igcm_ccnco2_h2o_mass_ccn,          &
+!$OMP                igcm_ccnco2_h2o_number)  
 
       ! water
@@ -59,4 +79,7 @@
       integer,save :: igcm_hdo_ice ! hdo ice
       integer,save :: igcm_co2_ice ! co2 ice
+
+!$OMP THREADPRIVATE(igcm_h2o_vap, igcm_h2o_ice, igcm_hdo_vap, igcm_hdo_ice,      &
+!$OMP                igcm_co2_ice)  
 
       ! chemistry:
@@ -80,4 +103,9 @@
       integer,save :: igcm_he
       integer,save :: igcm_ch4
+
+!$OMP THREADPRIVATE(igcm_co2,igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h,   &
+!$OMP                igcm_h2,igcm_oh,igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_n,&
+!$OMP               igcm_no,igcm_no2,igcm_n2d,igcm_he,igcm_ch4)
+
       !Deuterated species derived from HDO
       integer,save :: igcm_od
@@ -86,4 +114,7 @@
       integer,save :: igcm_do2
       integer,save :: igcm_hdo2
+
+!$OMP THREADPRIVATE(igcm_od,igcm_d,igcm_hd, igcm_do2,igcm_hdo2)
+
       ! Ions
       integer,save :: igcm_co2plus
@@ -102,4 +133,9 @@
       integer,save :: igcm_ohplus
       integer,save :: igcm_elec
+
+!$OMP THREADPRIVATE(igcm_co2plus,igcm_oplus,igcm_o2plus,igcm_coplus,igcm_cplus,   &
+!$OMP                igcm_nplus,igcm_noplus,igcm_n2plus,igcm_hplus,igcm_hco2plus,&
+!$OMP                igcm_hcoplus,igcm_h2oplus,igcm_h3oplus,igcm_ohplus,igcm_elec) 
+
       ! other tracers
       integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas
@@ -107,4 +143,7 @@
       integer, save                 :: nqperes ! numbers of tracers defined as "peres"
       integer, allocatable, save    :: nqfils(:) ! numbers of sons ("fils") of the considered tracer
+
+!$OMP THREADPRIVATE(igcm_ar_n2,nqperes,nqfils)  
+
       real, parameter               :: qperemin=1.e-16 ! threschold for the "pere" mixing ratio qpere to calculate Ratio=qfils/qpere
       real, parameter               :: masseqmin=1.e-16 ! threschold for the "pere" transporting masse martian case as there are no gran-sons
Index: /trunk/LMDZ.MARS/libf/phymars/turb_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/turb_mod.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/turb_mod.F90	(revision 2578)
@@ -13,4 +13,7 @@
       ! this is a flag to say 'turbulence is resolved'
       ! mostly for LES use. default is FALSE (for GCM and mesoscale)
+
+!$OMP THREADPRIVATE(q2, l0,ustar,wstar,tstar,hfmax_th,zmax_th,     &
+!$OMP                sensibFlux)
 
 contains
Index: /trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F	(revision 2578)
@@ -5,4 +5,6 @@
        REAL,SAVE,ALLOCATABLE :: zdqcloud(:,:,:) ! tendencies on pq due to condensation of H2O(kg/kg.s-1)
        REAL,SAVE,ALLOCATABLE :: zdqscloud(:,:) ! tendencies on qsurf (calculated only by calchim but declared here)
+
+!$OMP THREADPRIVATE(zdqcloud,zdqscloud)
 
        CONTAINS
Index: /trunk/LMDZ.MARS/libf/phymars/yomlw_h.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/yomlw_h.F90	(revision 2577)
+++ /trunk/LMDZ.MARS/libf/phymars/yomlw_h.F90	(revision 2578)
@@ -14,4 +14,6 @@
   real,save :: gcp ! = g/cpp (set in callradite)
 
+!$OMP THREADPRIVATE(at,bt,tref,xp,tstand,ga,gb,cst_voigt,gcp)
+
 ! Number of layers on which LTE calculations (in lw and sw) are performed 
 ! (Computed in nlthermeq) :
@@ -21,4 +23,6 @@
   real,save,allocatable :: xi_ground(:,:)
   real,save,allocatable :: xi_emis(:,:,:)
+
+!$OMP THREADPRIVATE(nlaylte,xi,xi_ground,xi_emis)
 
 contains
