Index: LMDZ5/trunk/libf/dyn3dmem/advect_new_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/advect_new_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/advect_new_loc.F	(revision 2603)
@@ -8,4 +8,6 @@
       USE advect_new_mod
       USE comconst_mod, ONLY: daysec
+      USE logic_mod, ONLY: conser
+      
       IMPLICIT NONE
 c=======================================================================
@@ -31,5 +33,4 @@
       include "paramet.h"
       include "comgeom.h"
-      include "logic.h"
       include "ener.h"
 
Index: LMDZ5/trunk/libf/dyn3dmem/advtrac_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/advtrac_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/advtrac_loc.F	(revision 2603)
@@ -34,5 +34,4 @@
       include "comdissip.h"
       include "comgeom2.h"
-      include "logic.h"
       include "ener.h"
       include "description.h"
Index: LMDZ5/trunk/libf/dyn3dmem/bernoui_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/bernoui_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/bernoui_loc.F	(revision 2603)
@@ -24,7 +24,6 @@
 c   -------------
 c
-#include "dimensions.h"
-#include "paramet.h"
-#include "logic.h"
+      include "dimensions.h"
+      include "paramet.h"
 c
 c   Arguments:
Index: LMDZ5/trunk/libf/dyn3dmem/call_calfis_mod.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/call_calfis_mod.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/call_calfis_mod.F90	(revision 2603)
@@ -83,9 +83,9 @@
   USE write_field
   USE comconst_mod, ONLY: dtphys
+  USE logic_mod, ONLY: leapf, forward, ok_strato
   USE comvert_mod, ONLY: ap, bp, pressure_exner
   USE temps_mod, ONLY: day_ini, day_ref, jd_ref, jh_ref, start_time
   
   IMPLICIT NONE
-    INCLUDE "logic.h"
     INCLUDE "iniprint.h"
 
Index: LMDZ5/trunk/libf/dyn3dmem/conf_gcm.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/conf_gcm.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/conf_gcm.F90	(revision 2603)
@@ -20,4 +20,7 @@
                           iflag_top_bound, mode_top_bound, tau_top_bound, &
                           ngroup
+  USE logic_mod, ONLY: fxyhypb, iflag_phys, ok_etat0, ok_gradsfile, &
+                       ok_guide, ok_limit, ok_strato, purmats, read_start, &
+                       ysinus
   USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy, &
                        alphax,alphay,taux,tauy
@@ -41,5 +44,4 @@
   include "dimensions.h"
   include "paramet.h"
-  include "logic.h"
   include "comdissnew.h"
   include "iniprint.h"
Index: LMDZ5/trunk/libf/dyn3dmem/convmas1_loc.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/convmas1_loc.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/convmas1_loc.F90	(revision 2603)
@@ -12,5 +12,4 @@
   include "paramet.h"
   include "comgeom.h"
-  include "logic.h"
 !===============================================================================
 ! Arguments:
Index: LMDZ5/trunk/libf/dyn3dmem/convmas2_loc.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/convmas2_loc.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/convmas2_loc.F90	(revision 2603)
@@ -11,5 +11,4 @@
   include "paramet.h"
   include "comgeom.h"
-  include "logic.h"
 !===============================================================================
 ! Arguments:
Index: LMDZ5/trunk/libf/dyn3dmem/convmas_loc.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/convmas_loc.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/convmas_loc.F90	(revision 2603)
@@ -11,5 +11,4 @@
   include "paramet.h"
   include "comgeom.h"
-  include "logic.h"
 !===============================================================================
 ! Arguments:
Index: LMDZ5/trunk/libf/dyn3dmem/dteta1_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/dteta1_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/dteta1_loc.F	(revision 2603)
@@ -21,7 +21,6 @@
 
 
-#include "dimensions.h"
-#include "paramet.h"
-#include "logic.h"
+      include "dimensions.h"
+      include "paramet.h"
 
       REAL teta( ijb_u:ije_u,llm )
Index: LMDZ5/trunk/libf/dyn3dmem/dynetat0_loc.f90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/dynetat0_loc.f90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/dynetat0_loc.f90	(revision 2603)
@@ -15,4 +15,5 @@
   USE comconst_mod, ONLY: cpp, daysec, dtvr, g, im, jm, kappa, lllm, &
                           omeg, rad
+  USE logic_mod, ONLY: fxyhypb, ysinus
   USE serre_mod, ONLY: clon, clat, grossismx, grossismy
   USE temps_mod, ONLY: annee_ref,day_ref,itau_dyn, &
@@ -25,5 +26,4 @@
   include "ener.h"
   include "description.h"
-  include "logic.h"
   include "iniprint.h"
 !===============================================================================
Index: LMDZ5/trunk/libf/dyn3dmem/dynredem_loc.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/dynredem_loc.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/dynredem_loc.F90	(revision 2603)
@@ -16,4 +16,5 @@
                          nivsig,nivsigs
   USE comconst_mod, ONLY: cpp, daysec, dtvr, g, kappa, omeg, rad
+  USE logic_mod, ONLY: fxyhypb, ysinus
   USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy, &
                        taux,tauy
@@ -25,5 +26,4 @@
   include "comgeom.h"
   include "ener.h"
-  include "logic.h"
   include "description.h"
   include "iniprint.h"
Index: LMDZ5/trunk/libf/dyn3dmem/gcm.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/gcm.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/gcm.F90	(revision 2603)
@@ -22,4 +22,5 @@
 #endif
   USE comconst_mod, ONLY: cpp, daysec, dtphys, dtvr, g, r, rad
+  USE logic_mod ! all of it, because of copyin clause when calling leapfrog
   USE temps_mod, ONLY: calend,start_time,annee_ref,day_ref, &
                        itau_dyn,itau_phy,day_ini,jD_ref,jH_ref,day_end, &
@@ -61,5 +62,4 @@
   include "comdissnew.h"
   include "comgeom.h"
-  include "logic.h"
   include "ener.h"
   include "description.h"
@@ -453,8 +453,13 @@
 
   !!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/)
-  !$OMP PARALLEL DEFAULT(SHARED) COPYIN(/logici/,/logicl/) &
+  !$OMP PARALLEL DEFAULT(SHARED) &
   !     Copy all threadprivate variables in temps_mod
   !$OMP COPYIN(dt,jD_ref,jH_ref,start_time,hour_ini,day_ini,day_end) &
-  !$OMP COPYIN(annee_ref,day_ref,itau_dyn,itau_phy,itaufin,calend)
+  !$OMP COPYIN(annee_ref,day_ref,itau_dyn,itau_phy,itaufin,calend) &
+  !     Copy all threadprivate variables from logic_mod
+  !$OMP COPYIN(purmats,forward,leapf,apphys,statcl,conser,apdiss,apdelq) &
+  !$OMP COPYIN(saison,ecripar,fxyhypb,ysinus,read_start,ok_guide) &
+  !$OMP COPYIN(ok_strato,ok_gradsfile,ok_limit,ok_etat0) &
+  !$OMP COPYIN(iflag_phys,iflag_trac)
   CALL leapfrog_loc(ucov,vcov,teta,ps,masse,phis,q,time_0)
   !$OMP END PARALLEL
Index: LMDZ5/trunk/libf/dyn3dmem/iniacademic_loc.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/iniacademic_loc.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/iniacademic_loc.F90	(revision 2603)
@@ -19,4 +19,5 @@
   USE Write_Field
   USE comconst_mod, ONLY: cpp, kappa, g, daysec, dtvr, pi, im, jm
+  USE logic_mod, ONLY: iflag_phys, read_start
   USE comvert_mod, ONLY: ap, bp, preff, presnivs, pressure_exner
   USE temps_mod, ONLY: annee_ref, day_ini, day_ref
@@ -37,5 +38,4 @@
   include "ener.h"
   include "iniprint.h"
-  include "logic.h"
 
   !   Arguments:
Index: LMDZ5/trunk/libf/dyn3dmem/initdynav_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/initdynav_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/initdynav_loc.F	(revision 2603)
@@ -49,5 +49,4 @@
       include "comgeom.h"
       include "ener.h"
-      include "logic.h"
       include "description.h"
       include "iniprint.h"
Index: LMDZ5/trunk/libf/dyn3dmem/initfluxsto_p.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/initfluxsto_p.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/initfluxsto_p.F	(revision 2603)
@@ -50,5 +50,4 @@
       include "comgeom.h"
       include "ener.h"
-      include "logic.h"
       include "description.h"
       include "iniprint.h"
Index: LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F	(revision 2603)
@@ -48,5 +48,4 @@
       include "comgeom.h"
       include "ener.h"
-      include "logic.h"
       include "description.h"
       include "iniprint.h"
Index: LMDZ5/trunk/libf/dyn3dmem/integrd_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/integrd_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/integrd_loc.F	(revision 2603)
@@ -13,4 +13,5 @@
       USE infotrac, ONLY: ok_iso_verif ! ajout CRisi
       USE comconst_mod, ONLY: pi
+      USE logic_mod, ONLY: leapf
       USE comvert_mod, ONLY: ap, bp
       USE temps_mod, ONLY: dt
@@ -37,5 +38,4 @@
       include "paramet.h"
       include "comgeom.h"
-      include "logic.h"
       include "iniprint.h"
 
Index: LMDZ5/trunk/libf/dyn3dmem/leapfrog_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/leapfrog_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/leapfrog_loc.F	(revision 2603)
@@ -34,4 +34,6 @@
        USE comconst_mod, ONLY: cpp, dtvr, ihf
        USE comvert_mod, ONLY: ap, bp, pressure_exner
+       USE logic_mod, ONLY: iflag_phys,ok_guide,forward,leapf,apphys,
+     &                      statcl,conser,apdiss,purmats,ok_strato
        USE temps_mod, ONLY: itaufin,jD_ref,jH_ref,day_ini,
      &                        day_ref,start_time,dt
@@ -74,5 +76,4 @@
       include "comdissnew.h"
       include "comgeom.h"
-      include "logic.h"
       include "ener.h"
       include "description.h"
Index: LMDZ5/trunk/libf/dyn3dmem/logic.h
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/logic.h	(revision 2601)
+++ 	(revision )
@@ -1,28 +1,0 @@
-!
-! $Id: $
-!
-!
-! NB: keep items of different kinds in seperate common blocs to avoid
-!     "misaligned commons" issues
-!-----------------------------------------------------------------------
-! INCLUDE 'logic.h'
-
-      COMMON/logicl/ purmats,forward,leapf,apphys,                      &
-     &  statcl,conser,apdiss,apdelq,saison,ecripar,fxyhypb,ysinus       &
-     &  ,read_start,ok_guide,ok_strato,ok_gradsfile                     &
-     &  ,ok_limit,ok_etat0,hybrid
-
-      COMMON/logici/ iflag_phys,iflag_trac
-      
-      LOGICAL purmats,forward,leapf,apphys,statcl,conser,               &
-     & apdiss,apdelq,saison,ecripar,fxyhypb,ysinus                      &
-     &  ,read_start,ok_guide,ok_strato,ok_gradsfile                     &
-     &  ,ok_limit,ok_etat0
-     
-      logical hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
-                     ! (only used if disvert_type==2)
-
-      integer iflag_phys,iflag_trac
-!$OMP THREADPRIVATE(/logicl/)
-!$OMP THREADPRIVATE(/logici/)
-!-----------------------------------------------------------------------
Index: LMDZ5/trunk/libf/dyn3dmem/logic_mod.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/logic_mod.F90	(revision 2603)
+++ LMDZ5/trunk/libf/dyn3dmem/logic_mod.F90	(revision 2603)
@@ -0,0 +1,45 @@
+!
+! $Id: $
+!
+MODULE logic_mod
+
+IMPLICIT NONE
+
+  LOGICAL purmats ! true if time stepping is purely Matsuno scheme
+                  ! false implies Matsuno-Leapfrog time stepping scheme
+  LOGICAL forward ! true if during forward phase of Matsuno step
+  LOGICAL leapf ! true if during a leapfrog time stepping step
+  LOGICAL apphys ! true if during a time step when physics will be called
+  LOGICAL statcl
+  LOGICAL conser
+  LOGICAL apdiss ! true if during a time step when dissipation will be called
+  LOGICAL apdelq
+  LOGICAL saison
+  LOGICAL ecripar
+  LOGICAL fxyhypb ! true if using hyperbolic function discretization
+                  ! for latitudinal grid 
+  LOGICAL ysinus ! true if using sine function discretiation
+                 ! for latitudinal grid
+  LOGICAL read_start ! true if reading a start.nc file to initialize fields
+  LOGICAL ok_guide ! true if nudging
+  LOGICAL ok_strato
+  LOGICAL ok_gradsfile
+  LOGICAL ok_limit
+  LOGICAL ok_etat0
+  LOGICAL hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
+                 ! (only used if disvert_type==2)
+  INTEGER iflag_phys ! type of physics to call: 0 none, 1: phy*** package,
+                     ! 2: Held & Suarez, 101-200: aquaplanets & terraplanets
+  INTEGER iflag_trac
+
+!$OMP THREADPRIVATE(purmats,forward,leapf,apphys,statcl,conser, &
+!$OMP     apdiss,apdelq,saison,ecripar,fxyhypb,ysinus, &
+!$OMP     read_start,ok_guide,ok_strato,ok_gradsfile, &
+!$OMP     ok_limit,ok_etat0,hybrid)
+!$OMP THREADPRIVATE(iflag_phys,iflag_trac)
+
+!WARNING: when adding a threadprivate variable in this module
+!        do not forget to add it to the copyin clause when opening an OpenMP
+!        parallel section. e.g. in gcm before call leapfrog_loc 
+
+END MODULE logic_mod
Index: LMDZ5/trunk/libf/dyn3dmem/tourpot_loc.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/tourpot_loc.F90	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/tourpot_loc.F90	(revision 2603)
@@ -11,5 +11,4 @@
   include "paramet.h"
   include "comgeom.h"
-  include "logic.h"
 !===============================================================================
 ! Arguments:
Index: LMDZ5/trunk/libf/dyn3dmem/vlsplt_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/vlsplt_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/vlsplt_loc.F	(revision 2603)
@@ -19,5 +19,4 @@
       include "dimensions.h"
       include "paramet.h"
-      include "logic.h"
 c
 c
@@ -420,5 +419,4 @@
       include "dimensions.h"
       include "paramet.h"
-      include "logic.h"
       include "comgeom.h"
 c
@@ -874,5 +872,4 @@
       include "dimensions.h"
       include "paramet.h"
-      include "logic.h"
 c
 c
Index: LMDZ5/trunk/libf/dyn3dmem/vlspltgen_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/vlspltgen_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/vlspltgen_loc.F	(revision 2603)
@@ -37,5 +37,4 @@
       include "dimensions.h"
       include "paramet.h"
-      include "logic.h"
 
 c
Index: LMDZ5/trunk/libf/dyn3dmem/vlspltqs_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/vlspltqs_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/vlspltqs_loc.F	(revision 2603)
@@ -14,5 +14,4 @@
       include "dimensions.h"
       include "paramet.h"
-      include "logic.h"
 c
 c
@@ -423,5 +422,4 @@
       include "dimensions.h"
       include "paramet.h"
-      include "logic.h"
       include "comgeom.h"
 c
Index: LMDZ5/trunk/libf/dyn3dmem/writedynav_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/writedynav_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/writedynav_loc.F	(revision 2603)
@@ -48,5 +48,4 @@
       include "comgeom.h"
       include "ener.h"
-      include "logic.h"
       include "description.h"
       include "iniprint.h"
Index: LMDZ5/trunk/libf/dyn3dmem/writehist_loc.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dmem/writehist_loc.F	(revision 2601)
+++ LMDZ5/trunk/libf/dyn3dmem/writehist_loc.F	(revision 2603)
@@ -48,5 +48,4 @@
       include "comgeom.h"
       include "ener.h"
-      include "logic.h"
       include "description.h"
       include "iniprint.h"
