Index: LMDZ5/branches/testing/libf/phylmd/initphysto.F90
===================================================================
--- LMDZ5/branches/testing/libf/phylmd/initphysto.F90	(revision 1910)
+++ LMDZ5/branches/testing/libf/phylmd/initphysto.F90	(revision 2408)
@@ -8,6 +8,7 @@
   USE IOIPSL
   USE iophy
-  USE control_mod
   USE indice_sol_mod
+  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev
+  USE time_phylmdz_mod, ONLY: day_ref, annee_ref
   
   IMPLICIT NONE
@@ -37,14 +38,4 @@
 !
 ! =====================================================================
-!
-!   Declarations
-  INCLUDE "dimensions.h"
-  INCLUDE "paramet.h"
-  INCLUDE "comconst.h"
-  INCLUDE "comgeom.h"
-  INCLUDE "temps.h"
-  INCLUDE "logic.h"
-  INCLUDE "description.h"
-  INCLUDE "serre.h"
 
 !   Arguments
@@ -58,5 +49,5 @@
   INTEGER nhoriid, i
   INTEGER l,k
-  REAL nivsigs(llm)
+  REAL nivsigs(nbp_lev)
   INTEGER tau0
   REAL zjulian
@@ -66,10 +57,9 @@
   INTEGER zan, idayref
   LOGICAL ok_sync
-  REAL zx_lon(iim,jjm+1), zx_lat(iim,jjm+1)
+  REAL zx_lon(nbp_lon,nbp_lat), zx_lat(nbp_lon,nbp_lat)
   CHARACTER(len=12) :: nvar
 
 !  Initialisations
 !
-  pi = 4. * ATAN (1.)
   ok_sync= .TRUE.
 !
@@ -88,5 +78,5 @@
 !  Appel a histvert pour la grille verticale
 !
-  DO l=1,llm
+  DO l=1,nbp_lev
      nivsigs(l)=REAL(l)
   ENDDO
@@ -94,107 +84,107 @@
   CALL histvert(fileid, 'sig_s', 'Niveaux sigma', &
        'sigma_level', &
-       llm, nivsigs, zvertiid)
+       nbp_lev, nivsigs, zvertiid)
 !
 !  Appels a histdef pour la definition des variables a sauvegarder
 !
   CALL histdef(fileid, "phis", "Surface geop. height", "-", &
-       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
+       nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, &
        "once", t_ops, t_wrt)
   
   CALL histdef(fileid, "aire", "Grid area", "-", &
-       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
+       nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, &
        "once", t_ops, t_wrt)
 
   CALL histdef(fileid, "longitudes", "longitudes", "-", &
-       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
+       nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, &
        "once", t_ops, t_wrt)
 
   CALL histdef(fileid, "latitudes", "latitudes", "-", &
-       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
+       nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, &
        "once", t_ops, t_wrt)
 ! T 
-  CALL histdef(fileid, 't', 'Temperature', 'K', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 't', 'Temperature', 'K', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! mfu 
-  CALL histdef(fileid, 'mfu', 'flx m. pan. mt', 'kg m/s',iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'mfu', 'flx m. pan. mt', 'kg m/s',nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt)
 ! mfd 
-  CALL histdef(fileid, 'mfd', 'flx m. pan. des', 'kg m/s',iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'mfd', 'flx m. pan. des', 'kg m/s',nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! en_u 
-  CALL histdef(fileid, 'en_u', 'flx ent pan mt', 'kg m/s', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'en_u', 'flx ent pan mt', 'kg m/s', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt)
 ! de_u 
-  CALL histdef(fileid, 'de_u', 'flx det pan mt', 'kg m/s',iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'de_u', 'flx det pan mt', 'kg m/s',nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt)
 ! en_d 
-  CALL histdef(fileid, 'en_d', 'flx ent pan dt', 'kg m/s', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'en_d', 'flx ent pan dt', 'kg m/s', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt)
 ! de_d 
-  CALL histdef(fileid, 'de_d', 'flx det pan dt', 'kg m/s', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'de_d', 'flx det pan dt', 'kg m/s', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! coefh
-  CALL histdef(fileid, "coefh", " ", " ", iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
+  CALL histdef(fileid, "coefh", " ", " ", nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, "inst(X)", t_ops, t_wrt)
 ! fm_th
-  CALL histdef(fileid, "fm_th", " ", " ",iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
+  CALL histdef(fileid, "fm_th", " ", " ",nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, "inst(X)", t_ops, t_wrt)
 ! en_th
-  CALL histdef(fileid, "en_th", " ", " ",iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
+  CALL histdef(fileid, "en_th", " ", " ",nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, "inst(X)", t_ops, t_wrt)
 ! frac_impa
-  CALL histdef(fileid, 'frac_impa', ' ', ' ',iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'frac_impa', ' ', ' ',nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt)
 ! frac_nucl
-  CALL histdef(fileid, 'frac_nucl', ' ', ' ',iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'frac_nucl', ' ', ' ',nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt)
 ! pyu1
-  CALL histdef(fileid, "pyu1", " ", " ", iim,jj_nb,nhoriid, &
+  CALL histdef(fileid, "pyu1", " ", " ", nbp_lon,jj_nb,nhoriid, &
        1,1,1, -99, 32, "inst(X)", t_ops, t_wrt)
 ! pyv1
-  CALL histdef(fileid, "pyv1", " ", " ", iim,jj_nb,nhoriid, &
+  CALL histdef(fileid, "pyv1", " ", " ", nbp_lon,jj_nb,nhoriid, &
        1,1,1, -99, 32,"inst(X)", t_ops, t_wrt)    
 ! ftsol1
-  CALL histdef(fileid, "ftsol1", " ", " ",iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "ftsol1", " ", " ",nbp_lon, jj_nb, nhoriid, &
        1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
 ! ftsol2
-  CALL histdef(fileid, "ftsol2", " ", " ",iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "ftsol2", " ", " ",nbp_lon, jj_nb, nhoriid, &
        1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
 ! ftsol3
-  CALL histdef(fileid, "ftsol3", " ", " ", iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "ftsol3", " ", " ", nbp_lon, jj_nb, nhoriid, &
        1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
 ! ftsol4
-  CALL histdef(fileid, "ftsol4", " ", " ",iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "ftsol4", " ", " ",nbp_lon, jj_nb, nhoriid, &
        1, 1,1, -99, 32, "inst(X)", t_ops, t_wrt)
 ! psrf1
-  CALL histdef(fileid, "psrf1", " ", " ",iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "psrf1", " ", " ",nbp_lon, jj_nb, nhoriid, &
        1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt)
 ! psrf2
-  CALL histdef(fileid, "psrf2", " ", " ",iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "psrf2", " ", " ",nbp_lon, jj_nb, nhoriid, &
        1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt)
 ! psrf3
-  CALL histdef(fileid, "psrf3", " ", " ",iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "psrf3", " ", " ",nbp_lon, jj_nb, nhoriid, &
        1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt)
 ! psrf4
-  CALL histdef(fileid, "psrf4", " ", " ", iim, jj_nb, nhoriid, &
+  CALL histdef(fileid, "psrf4", " ", " ", nbp_lon, jj_nb, nhoriid, &
        1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt)
 ! sh
-  CALL histdef(fileid, 'sh', '', '', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'sh', '', '', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! da
-  CALL histdef(fileid, 'da', '', '', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'da', '', '', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! mp
-  CALL histdef(fileid, 'mp', '', '', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'mp', '', '', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! upwd
-  CALL histdef(fileid, 'upwd', '', '', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'upwd', '', '', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 ! dnwd
-  CALL histdef(fileid, 'dnwd', '', '', iim, jj_nb, nhoriid, &
-       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+  CALL histdef(fileid, 'dnwd', '', '', nbp_lon, jj_nb, nhoriid, &
+       nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
 
 ! phi
-  DO k=1,llm
+  DO k=1,nbp_lev
      IF (k<10) THEN
         WRITE(nvar,'(i1)') k
@@ -206,6 +196,6 @@
      nvar='phi_lev'//trim(nvar)
      
-     CALL histdef(fileid, nvar, '', '', iim, jj_nb, nhoriid, &
-          llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
+     CALL histdef(fileid, nvar, '', '', nbp_lon, jj_nb, nhoriid, &
+          nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
   END DO
 
