Index: /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_mod.F90
===================================================================
--- /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_mod.F90	(revision 1217)
+++ /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_mod.F90	(revision 1218)
@@ -494,5 +494,5 @@
   integer                               :: jmin_ins, jmax_ins
   CHARACTER(len=20), dimension(nfiles)  :: type_ecri_files
-  character(len=20), dimension(nfiles)  :: chtimestep   = (/ '1mth', '1day', '3hor', '30mn', '3hor' /)
+  character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq' /)
 
 !!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -505,4 +505,7 @@
   real, dimension(nfiles), save     :: latmax_reg        = (/ 90., 90., 90., 90., 21. /)
 
+! 
+   print*,'Debut phys_output_mod.F90'
+! Initialisations (Valeurs par defaut
    levmax = (/ klev, klev, klev, klev, klev /)
 
@@ -513,9 +516,9 @@
    name_files(5) = 'histLES'
 
-   type_ecri_files(1) = 'ave(X)'
-   type_ecri_files(2) = 'ave(X)'
-   type_ecri_files(3) = 'ave(X)'
-   type_ecri_files(4) = 'inst(X)'
-   type_ecri_files(5) = 'inst(X)'
+   type_ecri(1) = 'ave(X)'
+   type_ecri(2) = 'ave(X)'
+   type_ecri(3) = 'ave(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'inst(X)'
 
    clef_files(1) = ok_mensuel
@@ -548,11 +551,10 @@
    call getin('phys_out_levmax',levmax)
    call getin('phys_out_filenames',name_files)
-   call getin('phys_out_filetypes',type_ecri_files)
    call getin('phys_out_filekeys',clef_files)
    call getin('phys_out_filelevels',lev_files)
    call getin('phys_out_filetimesteps',chtimestep)
-
-
-   type_ecri(:) = type_ecri_files(:)
+   call getin('phys_out_filetypes',type_ecri_files)
+
+   type_ecri_files(:)=type_ecri(:)
 
    print*,'phys_out_lonmin=',lonmin_reg
@@ -561,8 +563,7 @@
    print*,'phys_out_latmax=',latmax_reg
    print*,'phys_out_filenames=',name_files
-   print*,'phys_out_filetypes=',type_ecri_files
+   print*,'phys_out_filetypes=',type_ecri
    print*,'phys_out_filekeys=',clef_files
    print*,'phys_out_filelevels=',lev_files
-   print*,'phys_out_filetimesteps=',ecrit_files
 
 !!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -588,6 +589,12 @@
     IF (clef_files(iff)) THEN
 
-      call convers_timesteps(chtimestep(iff),ecrit_files(iff)) 
-      
+      if ( chtimestep(iff).eq.'DefFreq' ) then
+! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf ...)*86400.
+        ecrit_files(iff)=ecrit_files(iff)*86400.
+      else
+        call convers_timesteps(chtimestep(iff),ecrit_files(iff)) 
+      endif
+       print*,'ecrit_files(',iff,')= ',ecrit_files(iff)
+
       zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
 
@@ -1029,4 +1036,5 @@
 
          ENDDO !  iff
+     print*,'Fin phys_output_mod.F90'
       end subroutine phys_output_open
 
@@ -1127,4 +1135,6 @@
       SUBROUTINE convers_timesteps(str,timestep)
 
+        use ioipsl
+
         IMPLICIT NONE
 
@@ -1134,4 +1144,6 @@
         real                :: ttt,xxx,timestep,dayseconde
         parameter (dayseconde=86400.)
+        include "temps.h"
+        include "comconst.h"
 
         ipos=scan(str,'0123456789.',.true.)
@@ -1148,9 +1160,13 @@
         endif
 
-        if ( type == 'day' ) timestep = ttt * dayseconde
-        if ( type == 'mth' ) timestep = ttt * dayseconde * 30.
-        if ( type == 'hor' ) timestep = ttt * dayseconde / 24.
-        if ( type == 'mn'  ) timestep = ttt * 60.
-        if ( type == 's'   ) timestep = ttt
+        if ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
+        if ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) then
+           print*,'annee_ref,day_ref mon_len',annee_ref,day_ref,ioget_mon_len(annee_ref,day_ref)
+           timestep = ttt * dayseconde * ioget_mon_len(annee_ref,day_ref)
+        endif
+        if ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
+        if ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
+        if ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
+        if ( type == 'TS' ) timestep = dtphys
 
         print*,'type =      ',type
