Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1524)
+++ trunk/LMDZ.GENERIC/README	(revision 1525)
@@ -1148,2 +1148,6 @@
   to module "time_phylmdz_mod".
 - made "inifis" a module.
+
+== 30/03/2016 == EM
+- Got rid of references to "control_mod" from the physics. Added a couple
+  of relevent variables for outputs in time_phylmdz_mod.
Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/iniphysiq_mod.F90	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/iniphysiq_mod.F90	(revision 1525)
@@ -14,5 +14,5 @@
                                klon_omp_end, & ! end index of local omp subgrid
                                klon_mpi_begin ! start indes of columns (on local mpi grid)
-
+use control_mod, only: nday 
 use comgeomphy, only : initcomgeomphy, &
                        airephy, & ! physics grid area (m2)
@@ -176,5 +176,5 @@
 ! copy some fundamental parameters to physics 
 ! and do some initializations 
-call inifis(klon_omp,nlayer,nqtot,pdayref,punjours,ptimestep, &
+call inifis(klon_omp,nlayer,nqtot,pdayref,punjours,nday,ptimestep, &
             rlatd,rlond,airephy,prad,pg,pr,pcpp)
 
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90	(revision 1525)
@@ -9,5 +9,5 @@
   use planete_mod
   use callkeys_mod, only: check_cpp_match, pceil, tstrat, tracer
-!  use control_mod
+  use inifis_mod, only: inifis
   use comcstfi_mod
   implicit none
@@ -203,5 +203,7 @@
   call calc_cpp_mugaz
 
-  call inifis(1,llm,0,86400.0,1.0,0.0,0.0,1.0,rad,g,r,cpp)
+  call inifis(1,llm,0,1,86400.0,1,1.0,&
+              (/0.0/),(/0.0/),(/1.0/),&
+              rad,g,r,cpp)
 
   ! Tracer initialisation
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 1525)
@@ -12,5 +12,4 @@
       use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat, volcapa
       USE comgeomfi_h, only: lati, long, area
-      use control_mod, only: day_step, ecritphy
       use phyredem, only: physdem0,physdem1
       use comgeomphy, only: initcomgeomphy
@@ -21,5 +20,6 @@
       use comcstfi_mod, only: pi, cpp, rad, g, r,
      &                        mugaz, rcp, omeg
-      use time_phylmdz_mod, only: daysec, dtphys
+      use time_phylmdz_mod, only: daysec, dtphys, day_step, ecritphy,
+     &                            nday
       use callkeys_mod, only: tracer,check_cpp_match,rings_shadow,
      &	                      specOLR,water,pceil,ok_slab_ocean
@@ -488,4 +488,5 @@
       call getin("ndt",ndt)
       write(*,*) " ndt = ",ndt
+      nday=ndt
 
       ndt=ndt*day_step     
@@ -505,5 +506,5 @@
 !!! - physical frequency: nevermind, in inifis this is a simple print
       cpp=1.d-7 !JL because we divide by cpp in inifis, there may be a more elegant solution
-      CALL inifis(1,llm,nq,day0,daysec,dtphys,
+      CALL inifis(1,llm,nq,day0,daysec,nday,dtphys,
      .            latitude,longitude,area,rad,g,r,cpp)
 !!! We check everything is OK.
Index: trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90	(revision 1525)
@@ -5,5 +5,5 @@
 
   SUBROUTINE inifis(ngrid,nlayer,nq, &
-             day_ini,pdaysec,ptimestep, &
+             day_ini,pdaysec,nday,ptimestep, &
              plat,plon,parea, &
              prad,pg,pr,pcpp)
@@ -14,5 +14,6 @@
   use comgeomfi_h, only: long, lati, area, totarea, totarea_planet
   use comsoil_h, only: ini_comsoil_h
-  use control_mod, only: ecritphy
+  use time_phylmdz_mod, only: ecritphy,day_step,iphysiq, &
+                              init_time, daysec, dtphys
   use comcstfi_mod, only: rad, cpp, g, r, rcp, &
                           mugaz, pi, avocado
@@ -20,5 +21,4 @@
   use planetwide_mod, only: planetwide_sumval
   use callkeys_mod
-  use time_phylmdz_mod, only: init_time, daysec, dtphys
 
 !=======================================================================
@@ -64,5 +64,5 @@
 
   REAL,INTENT(IN) :: prad,pg,pr,pcpp,pdaysec,ptimestep
- 
+  INTEGER,INTENT(IN) :: nday
   INTEGER,INTENT(IN) :: ngrid,nlayer,nq
   REAL,INTENT(IN) :: plat(ngrid),plon(ngrid),parea(ngrid)
@@ -91,9 +91,12 @@
 
   ! Initialize some "temporal and calendar" related variables
-  CALL init_time(day_ini,pdaysec,ptimestep)
-
-  ! read in 'ecritphy' (frequency of calls to physics, in dynamical steps)
-  ! (also done in dyn3d/defrun_new but not in LMDZ.COMMON)
-  call getin_p("ecritphy",ecritphy)
+  CALL init_time(day_ini,pdaysec,nday,ptimestep)
+
+  ! read in some parameters from "run.def" for physics,
+  ! or shared between dynamics and physics.
+  call getin_p("ecritphy",ecritphy) ! frequency of outputs in physics,
+                                    ! in dynamical steps
+  call getin_p("day_step",day_step) ! number of dynamical steps per day
+  call getin_p("iphysiq",iphysiq) ! call physics every iphysiq dyn step
 
 ! --------------------------------------------------------------
Index: trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1525)
@@ -24,5 +24,5 @@
                           igcm_h2o_ice, igcm_h2o_vap, igcm_dustbin, &
                           igcm_co2_ice
-      use control_mod, only: ecritphy, iphysiq, nday
+      use time_phylmdz_mod, only: ecritphy, iphysiq, nday
       use phyredem, only: physdem0, physdem1
       use slab_ice_h
Index: trunk/LMDZ.GENERIC/libf/phystd/time_phylmdz_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/time_phylmdz_mod.F90	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/time_phylmdz_mod.F90	(revision 1525)
@@ -4,4 +4,9 @@
     REAL,SAVE    :: dtphys     ! physics time step (s)
 !$OMP THREADPRIVATE(dtphys)
+    INTEGER,SAVE :: day_step    ! number of dynamical steps per day
+                                ! (set via inifis)
+!$OMP THREADPRIVATE(day_step)
+    INTEGER,SAVE :: nday       ! number of days to run
+!$OMP THREADPRIVATE(nday)
     REAL,SAVE    :: daysec     ! length of day (s)
 !$OMP THREADPRIVATE(daysec)
@@ -9,14 +14,23 @@
 !$OMP THREADPRIVATE(day_ini)
 
+    INTEGER,SAVE :: ecritphy  ! for diagfi.nc outputs, write every ecritphy
+                              ! dynamical steps (set via inifis)
+!$OMP THREADPRIVATE(ecritphy)
+    INTEGER,SAVE :: iphysiq   ! call physics every iphysiq dynamical step
+                              ! (set via inifis)
+!$OMP THREADPRIVATE(iphysiq)
+
 CONTAINS
 
-  SUBROUTINE init_time(day_ini_, daysec_, dtphys_)
+  SUBROUTINE init_time(day_ini_, daysec_, nday_, dtphys_)
     IMPLICIT NONE
     INTEGER,INTENT(IN) :: day_ini_
     REAL,INTENT(IN) :: daysec_
+    INTEGER,INTENT(IN) :: nday_
     REAL,INTENT(IN) :: dtphys_
     
     day_ini=day_ini_
     daysec=daysec_
+    nday=nday_
     dtphys=dtphys_
 
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1525)
@@ -40,9 +40,8 @@
 !=================================================================
       use surfdat_h, only: phisfi
-      use control_mod, only: ecritphy, day_step, iphysiq
+      use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini
       USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root,
      &                               is_master, gather
       USE mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo
-      USE time_phylmdz_mod, ONLY: day_ini
       implicit none
 
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1525)
@@ -13,5 +13,5 @@
 
 use comsoil_h, only: nsoilmx
-use control_mod, only: ecritphy, day_step, iphysiq
+use time_phylmdz_mod, only: ecritphy, day_step, iphysiq
 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1525)
@@ -48,7 +48,6 @@
       use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo
 #endif
-      use control_mod, only: ecritphy, iphysiq, day_step
+      use time_phylmdz_mod, only: ecritphy, iphysiq, day_step, day_ini
       use callkeys_mod, only: iradia
-      use time_phylmdz_mod, ONLY: day_ini
 
       implicit none
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1524)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1525)
@@ -48,7 +48,6 @@
       use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo
 #endif
-      use control_mod, only: ecritphy, iphysiq, day_step
+      use time_phylmdz_mod, only: ecritphy, iphysiq, day_step, day_ini
       use callkeys_mod, only: iradia
-      use time_phylmdz_mod, ONLY: day_ini
 
       implicit none
