source: LMDZ5/trunk/libf/phylmd/phys_output_mod.F90 @ 1838

Last change on this file since 1838 was 1828, checked in by idelkadi, 11 years ago

Gestion des fichiers de sorties sur les niveaux de pression NMC (hist*NMC.nc) via le meme mecanisme utilise pour les fichiers histoires (phys_output_mod, ...)
Ces sorties sont ainsi controles par les memes flags : phys_out_filekeys, phys_out_filenames, phys_out_filetimesteps, phys_out_filelevels, ...
(exemple dans config.def : phys_out_filenames=histmth histday histhf histins histLES histstn histmthNMC histdayNMC histhfNMC)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.5 KB
Line 
1! $Id: phys_output_mod.F90 1828 2013-08-06 16:06:40Z fairhead $
2!
3
4MODULE phys_output_mod
5  USE indice_sol_mod
6  USE phys_output_var_mod
7  USE aero_mod, only : naero_spc,name_aero
8  USE phys_output_write_mod, ONLY : phys_output_write
9
10! Abderrahmane 12 2007
11!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12!!! Ecreture des Sorties du modele dans les fichiers Netcdf :
13! histmth.nc : moyennes mensuelles
14! histday.nc : moyennes journalieres
15! histhf.nc  : moyennes toutes les 3 heures
16! histins.nc : valeurs instantanees
17!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
18
19CONTAINS
20
21!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22!!!!!!!!! Ouverture des fichier et definition des variable de sortie !!!!!!!!
23  !! histbeg, histvert et histdef
24!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
26  SUBROUTINE phys_output_open(rlon,rlat,pim,tabij,ipt,jpt,plon,plat, &
27       jjmp1,nlevSTD,clevSTD,rlevSTD,nbteta, &
28       ctetaSTD, dtime, ok_veget, &
29       type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
30       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
31       phys_out_filestations, &
32       new_aod, aerosol_couple, flag_aerosol_strat, &
33       pdtphys, paprs, pphis, pplay, lmax_th, ptconv, ptconvth, ivap, &
34       d_t, qx, d_qx, zmasse, ok_sync)   
35
36    USE iophy
37    USE dimphy
38    USE infotrac
39    USE ioipsl
40    USE phys_cal_mod, only : hour
41    USE mod_phys_lmdz_para
42    USE aero_mod, only : naero_spc,name_aero
43    USE phys_output_ctrlout_mod
44
45#ifdef CPP_XIOS
46    ! ug Pour les sorties XIOS
47    USE wxios
48#endif
49
50    IMPLICIT NONE
51    include "dimensions.h"
52    include "temps.h"
53    include "clesphys.h"
54    include "thermcell.h"
55    include "comvert.h"
56    include "iniprint.h"
57
58    ! ug Nouveaux arguments nécessaires au histwrite_mod:
59    INTEGER, INTENT(IN)                         :: ivap
60    INTEGER, DIMENSION(klon), INTENT(IN)        :: lmax_th
61    LOGICAL, INTENT(IN)                         :: ok_sync
62    LOGICAL, DIMENSION(klon, klev), INTENT(IN)  :: ptconv, ptconvth
63    REAL, INTENT(IN)                            :: pdtphys
64    REAL, DIMENSION(klon), INTENT(IN)           :: pphis
65    REAL, DIMENSION(klon, klev), INTENT(IN)     :: pplay, d_t
66    REAL, DIMENSION(klon, klev+1), INTENT(IN)   :: paprs
67    REAL, DIMENSION(klon,klev,nqtot), INTENT(IN):: qx, d_qx
68    REAL, DIMENSION(klon, llm), INTENT(IN)      :: zmasse
69
70
71    REAL,DIMENSION(klon),INTENT(IN) :: rlon
72    REAL,DIMENSION(klon),INTENT(IN) :: rlat
73    INTEGER, INTENT(IN)             :: pim
74    INTEGER, DIMENSION(pim)            :: tabij
75    INTEGER,DIMENSION(pim), INTENT(IN) :: ipt, jpt
76    REAL,DIMENSION(pim), INTENT(IN) :: plat, plon
77    REAL,DIMENSION(pim,2) :: plat_bounds, plon_bounds
78
79    INTEGER                               :: jjmp1
80    INTEGER                               :: nbteta, nlevSTD, radpas
81    LOGICAL                               :: ok_mensuel, ok_journe, ok_hf, ok_instan
82    LOGICAL                               :: ok_LES,ok_ade,ok_aie,flag_aerosol_strat
83    LOGICAL                               :: new_aod, aerosol_couple
84    INTEGER, INTENT(IN)::  read_climoz ! read ozone climatology
85    !     Allowed values are 0, 1 and 2
86    !     0: do not read an ozone climatology
87    !     1: read a single ozone climatology that will be used day and night
88    !     2: read two ozone climatologies, the average day and night
89    !     climatology and the daylight climatology
90
91    REAL                                  :: dtime
92    INTEGER                               :: idayref
93    REAL                                  :: zjulian
94    REAL, DIMENSION(klev)                 :: Ahyb, Bhyb, Alt
95    CHARACTER(LEN=4), DIMENSION(nlevSTD)  :: clevSTD
96    REAL, DIMENSION(nlevSTD)              :: rlevSTD
97    INTEGER                               :: nsrf, k, iq, iiq, iff, i, j, ilev
98    INTEGER                               :: naero
99    LOGICAL                               :: ok_veget
100    INTEGER                               :: iflag_pbl
101    CHARACTER(LEN=4)                      :: bb2
102    CHARACTER(LEN=2)                      :: bb3
103    CHARACTER(LEN=6)                      :: type_ocean
104    CHARACTER(LEN=3)                      :: ctetaSTD(nbteta)
105    REAL, DIMENSION(nfiles)               :: ecrit_files
106    INTEGER, DIMENSION(iim*jjmp1)         ::  ndex2d
107    INTEGER, DIMENSION(iim*jjmp1*klev)    :: ndex3d
108    INTEGER                               :: imin_ins, imax_ins
109    INTEGER                               :: jmin_ins, jmax_ins
110    INTEGER, DIMENSION(nfiles)            :: phys_out_levmin, phys_out_levmax
111    INTEGER, DIMENSION(nfiles)            :: phys_out_filelevels
112    CHARACTER(LEN=20), DIMENSION(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', &
113                                                        'DefFreq', 'DefFreq', 'DefFreq','DefFreq', 'DefFreq' /)
114    LOGICAL, DIMENSION(nfiles)            :: phys_out_filekeys
115    LOGICAL, DIMENSION(nfiles)            :: phys_out_filestations
116
117!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
118    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
119
120    LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE.,  .FALSE., &
121                                                                    .FALSE., .FALSE., .FALSE., .FALSE.,  .FALSE. /)
122    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/   -180.,   -180.,   -180.,    -180., &
123                                                                     -180.,   -180., -180.,   -180.,    -180. /)
124    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/    180.,    180.,    180.,     180., &
125                                                                      180.,    180., 180.,    180.,     180. /)
126    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/    -90.,    -90.,    -90.,     -90., &
127                                                                    -90., -90., -90.,    -90.,     -90. /)
128    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/  90.,     90.,     90.,     90., &
129                                                                    90., 90., 90., 90., 90. /)                       
130#ifdef CPP_XIOS
131    ! ug Variables utilisées pour récupérer le calendrier pour xios
132    INTEGER :: x_an, x_mois, x_jour
133    REAL :: x_heure
134#endif
135
136    WRITE(lunout,*) 'Debut phys_output_mod.F90'
137    ! Initialisations (Valeurs par defaut
138
139    IF (.NOT. ALLOCATED(o_trac)) ALLOCATE(o_trac(nqtot))
140    IF (.NOT. ALLOCATED(o_trac_cum)) ALLOCATE(o_trac_cum(nqtot))
141    ALLOCATE(o_dtr_the(nqtot),o_dtr_con(nqtot),o_dtr_lessi_impa(nqtot))
142    ALLOCATE(o_dtr_lessi_nucl(nqtot),o_dtr_insc(nqtot),o_dtr_bcscav(nqtot))
143    ALLOCATE(o_dtr_evapls(nqtot),o_dtr_ls(nqtot),o_dtr_trsp(nqtot))
144    ALLOCATE(o_dtr_sscav(nqtot),o_dtr_sat(nqtot),o_dtr_uscav(nqtot))
145    ALLOCATE(o_dtr_dry(nqtot),o_dtr_vdf(nqtot))
146
147
148    levmax = (/ klev, klev, klev, klev, klev, klev, nlevSTD, nlevSTD, nlevSTD /)
149
150    phys_out_filenames(1) = 'histmth'
151    phys_out_filenames(2) = 'histday'
152    phys_out_filenames(3) = 'histhf'
153    phys_out_filenames(4) = 'histins'
154    phys_out_filenames(5) = 'histLES'
155    phys_out_filenames(6) = 'histstn'
156    phys_out_filenames(7) = 'histmthNMC'
157    phys_out_filenames(8) = 'histdayNMC'
158    phys_out_filenames(9) = 'histhfNMC.nc'
159
160    type_ecri(1) = 'ave(X)'
161    type_ecri(2) = 'ave(X)'
162    type_ecri(3) = 'ave(X)'
163    type_ecri(4) = 'inst(X)'
164    type_ecri(5) = 'ave(X)'
165    type_ecri(6) = 'inst(X)'
166    type_ecri(7) = 'inst(X)'
167    type_ecri(8) = 'inst(X)'
168    type_ecri(9) = 'inst(X)'
169
170    clef_files(1) = ok_mensuel
171    clef_files(2) = ok_journe
172    clef_files(3) = ok_hf
173    clef_files(4) = ok_instan
174    clef_files(5) = ok_LES
175    clef_files(6) = ok_instan
176    clef_files(7) = ok_histNMC(1)
177    clef_files(8) = ok_histNMC(2)
178    clef_files(9) = ok_histNMC(3)
179
180    !sortir des fichiers "stations" si clef_stations(:)=.TRUE.
181    clef_stations(1) = .FALSE.
182    clef_stations(2) = .FALSE.
183    clef_stations(3) = .FALSE.
184    clef_stations(4) = .FALSE.
185    clef_stations(5) = .FALSE.
186    clef_stations(6) = .FALSE.
187    clef_stations(7) = .FALSE.
188    clef_stations(8) = .FALSE.
189    clef_stations(9) = .FALSE.
190
191    lev_files(1) = lev_histmth
192    lev_files(2) = lev_histday
193    lev_files(3) = lev_histhf
194    lev_files(4) = lev_histins
195    lev_files(5) = lev_histLES
196    lev_files(6) = lev_histins
197    lev_files(7) = levout_histNMC(1)
198    lev_files(8) = levout_histNMC(2)
199    lev_files(9) = levout_histNMC(3)
200
201    ecrit_files(1) = ecrit_mth
202    ecrit_files(2) = ecrit_day
203    ecrit_files(3) = ecrit_hf
204    ecrit_files(4) = ecrit_ins
205    ecrit_files(5) = ecrit_LES
206    ecrit_files(6) = ecrit_ins
207    ecrit_files(7) = freq_outNMC(1)
208    ecrit_files(8) = freq_outNMC(2)
209    ecrit_files(9) = freq_outNMC(3)
210
211    !! Lectures des parametres de sorties dans physiq.def
212
213    CALL getin('phys_out_regfkey',phys_out_regfkey)
214    CALL getin('phys_out_lonmin',phys_out_lonmin)
215    CALL getin('phys_out_lonmax',phys_out_lonmax)
216    CALL getin('phys_out_latmin',phys_out_latmin)
217    CALL getin('phys_out_latmax',phys_out_latmax)
218    phys_out_levmin(:)=levmin(:)
219    CALL getin('phys_out_levmin',levmin)
220    phys_out_levmax(:)=levmax(:)
221    CALL getin('phys_out_levmax',levmax)
222    CALL getin('phys_out_filenames',phys_out_filenames)
223    phys_out_filekeys(:)=clef_files(:)
224    CALL getin('phys_out_filekeys',clef_files)
225    phys_out_filestations(:)=clef_stations(:)
226    CALL getin('phys_out_filestations',clef_stations)
227    phys_out_filelevels(:)=lev_files(:)
228    CALL getin('phys_out_filelevels',lev_files)
229    CALL getin('phys_out_filetimesteps',chtimestep)
230    phys_out_filetypes(:)=type_ecri(:)
231    CALL getin('phys_out_filetypes',type_ecri)
232
233    type_ecri_files(:)=type_ecri(:)
234
235    WRITE(lunout,*)'phys_out_lonmin=',phys_out_lonmin
236    WRITE(lunout,*)'phys_out_lonmax=',phys_out_lonmax
237    WRITE(lunout,*)'phys_out_latmin=',phys_out_latmin
238    WRITE(lunout,*)'phys_out_latmax=',phys_out_latmax
239    WRITE(lunout,*)'phys_out_filenames=',phys_out_filenames
240    WRITE(lunout,*)'phys_out_filetypes=',type_ecri
241    WRITE(lunout,*)'phys_out_filekeys=',clef_files
242    WRITE(lunout,*)'phys_out_filestations=',clef_stations
243    WRITE(lunout,*)'phys_out_filelevels=',lev_files
244
245#ifdef CPP_XIOS
246    ! ug Réglage du calendrier xios
247    !Temps julian => an, mois, jour, heure
248    CALL ymds2ju(annee_ref, 1, day_ref, 0.0, zjulian)
249    CALL ju2ymds(zjulian, x_an, x_mois, x_jour, x_heure)
250    CALL wxios_set_cal(dtime, calend, x_an, x_mois, x_jour, x_heure)
251#endif
252
253!!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
254    ! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
255    ! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
256!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
257
258    zdtime_moy = dtime         ! Frequence ou l on moyenne
259
260    ! Calcul des Ahyb, Bhyb et Alt
261    DO k=1,klev
262       Ahyb(k)=(ap(k)+ap(k+1))/2.
263       Bhyb(k)=(bp(k)+bp(k+1))/2.
264       Alt(k)=log(preff/presnivs(k))*8.
265    ENDDO
266    !          if(prt_level.ge.1) then
267    WRITE(lunout,*)'Ap Hybrid = ',Ahyb(1:klev)
268    WRITE(lunout,*)'Bp Hybrid = ',Bhyb(1:klev)
269    WRITE(lunout,*)'Alt approx des couches pour une haut d echelle de 8km = ',Alt(1:klev)
270    !          endif
271    DO iff=1,nfiles
272
273       ! Calculate ecrit_files for all files
274       IF ( chtimestep(iff).eq.'DefFreq' ) then
275          ! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf ...)*86400.
276          ecrit_files(iff)=ecrit_files(iff)*86400.
277       ELSE
278          CALL convers_timesteps(chtimestep(iff),dtime,ecrit_files(iff))
279       ENDIF
280       WRITE(lunout,*)'ecrit_files(',iff,')= ',ecrit_files(iff)
281
282       zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
283
284       IF (clef_files(iff)) THEN
285
286          idayref = day_ref
287!          CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)       
288! correction pour l heure initiale                               !jyg
289!                                                                !jyg
290          CALL ymds2ju(annee_ref, 1, idayref, hour, zjulian)         !jyg
291! correction pour l heure initiale                               !jyg
292!                                                                !jyg
293!!!      CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)       !jyg
294! correction pour l heure initiale                               !jyg
295!                                                                !jyg
296!      CALL ymds2ju(annee_ref, 1, idayref, hour, zjulian)         !jyg
297
298!!!!!!!!!!!!!!!!! Traitement dans le cas ou l'on veut stocker sur un domaine limite !!
299!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
300          IF (phys_out_regfkey(iff)) then
301
302             imin_ins=1
303             imax_ins=iim
304             jmin_ins=1
305             jmax_ins=jjmp1
306
307             ! correction abderr       
308             do i=1,iim
309                WRITE(lunout,*)'io_lon(i)=',io_lon(i)
310                IF (io_lon(i).le.phys_out_lonmin(iff)) imin_ins=i
311                IF (io_lon(i).le.phys_out_lonmax(iff)) imax_ins=i+1
312             enddo
313
314             do j=1,jjmp1
315                WRITE(lunout,*)'io_lat(j)=',io_lat(j)
316                IF (io_lat(j).ge.phys_out_latmin(iff)) jmax_ins=j+1
317                IF (io_lat(j).ge.phys_out_latmax(iff)) jmin_ins=j
318             enddo
319
320             WRITE(lunout,*)'On stoke le fichier histoire numero ',iff,' sur ', &
321                  imin_ins,imax_ins,jmin_ins,jmax_ins
322             WRITE(lunout,*)'longitudes : ', &
323                  io_lon(imin_ins),io_lon(imax_ins), &
324                  'latitudes : ', &
325                  io_lat(jmax_ins),io_lat(jmin_ins)
326
327             CALL histbeg(phys_out_filenames(iff),iim,io_lon,jjmp1,io_lat, &
328                  imin_ins,imax_ins-imin_ins+1, &
329                  jmin_ins,jmax_ins-jmin_ins+1, &
330                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
331!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
332             !IM fichiers stations
333          else IF (clef_stations(iff)) THEN
334
335             WRITE(lunout,*)'phys_output_mod phys_out_filenames=',phys_out_filenames(iff)
336
337             CALL histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
338                  phys_out_filenames(iff), &
339                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
340          else
341             CALL histbeg_phy_all(phys_out_filenames(iff),itau_phy,zjulian,&
342                 dtime,chtimestep(iff),lev_files(iff),nhorim(iff),nid_files(iff))
343          endif
344
345          if (iff.le.6) then
346             CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", & 
347               levmax(iff) - levmin(iff) + 1, &
348               presnivs(levmin(iff):levmax(iff)), nvertm(iff),"down")
349!!!! Composantes de la coordonnee sigma-hybride
350          CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
351               levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
352
353          CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", &
354               levmax(iff) - levmin(iff) + 1,Bhyb,nvertbp(iff))
355
356          CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &                       
357               levmax(iff) - levmin(iff) + 1,Alt,nvertAlt(iff))
358
359
360          else
361             CALL histvert(nid_files(iff), "plev", "pressure", "Pa", &
362               levmax(iff) - levmin(iff) + 1, &
363              rlevSTD(levmin(iff):levmax(iff)), nvertm(iff), "down")
364          endif
365#ifdef CPP_XIOS
366    ! ug déclaration des axes verticaux de chaque fichier:
367    CALL wxios_add_vaxis("presnivs", nid_files(iff), levmax(iff) - levmin(iff) + 1, presnivs(levmin(iff):levmax(iff)))                                         
368    CALL wxios_add_vaxis("Ahyb", nid_files(iff), levmax(iff) - levmin(iff) + 1, Ahyb)                             
369    CALL wxios_add_vaxis("Bhyb", nid_files(iff), levmax(iff) - levmin(iff) + 1, Bhyb)         
370    CALL wxios_add_vaxis("Ahyb", nid_files(iff), levmax(iff) - levmin(iff) + 1, Alt)             
371#endif
372
373      IF (nqtot>=3) THEN
374            DO iq=3,nqtot 
375            iiq=niadv(iq)
376            o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10, 11, 11, 11 /), &
377                           tname(iiq),'Tracer '//ttext(iiq), "-",  &
378                           (/ '', '', '', '', '', '', '', '', '' /))
379
380            o_dtr_vdf(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11 /), &
381                              'd'//trim(tname(iq))//'_vdf',  &
382                              'Tendance tracer '//ttext(iiq), "-" , &
383                              (/ '', '', '', '', '', '', '', '', '' /))
384
385            o_dtr_the(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11 /), &
386                              'd'//trim(tname(iq))//'_the', &
387                              'Tendance tracer '//ttext(iiq), "-", &
388                              (/ '', '', '', '', '', '', '', '', '' /))
389
390            o_dtr_con(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11 /), &
391                              'd'//trim(tname(iq))//'_con', &
392                              'Tendance tracer '//ttext(iiq), "-", &
393                              (/ '', '', '', '', '', '', '', '', '' /))
394
395            o_dtr_lessi_impa(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
396                                     'd'//trim(tname(iq))//'_lessi_impa', &
397                                     'Tendance tracer '//ttext(iiq), "-", &
398                                     (/ '', '', '', '', '', '', '', '', '' /))
399
400            o_dtr_lessi_nucl(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
401                                     'd'//trim(tname(iq))//'_lessi_nucl', &
402                                     'Tendance tracer '//ttext(iiq), "-", &
403                                     (/ '', '', '', '', '', '', '', '', '' /))
404
405            o_dtr_insc(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
406                               'd'//trim(tname(iq))//'_insc', &
407                               'Tendance tracer '//ttext(iiq), "-", &
408                               (/ '', '', '', '', '', '', '', '', '' /))
409
410            o_dtr_bcscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
411                                 'd'//trim(tname(iq))//'_bcscav', &
412                                 'Tendance tracer '//ttext(iiq), "-", &
413                                 (/ '', '', '', '', '', '', '', '', '' /))
414
415            o_dtr_evapls(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
416                                 'd'//trim(tname(iq))//'_evapls', &
417                                 'Tendance tracer '//ttext(iiq), "-", &
418                                 (/ '', '', '', '', '', '', '', '', '' /))
419
420            o_dtr_ls(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
421                             'd'//trim(tname(iq))//'_ls', &
422                             'Tendance tracer '//ttext(iiq), "-", &
423                             (/ '', '', '', '', '', '', '', '', '' /))
424
425            o_dtr_trsp(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
426                               'd'//trim(tname(iq))//'_trsp', &
427                               'Tendance tracer '//ttext(iiq), "-", &
428                               (/ '', '', '', '', '', '', '', '', '' /))
429
430            o_dtr_sscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
431                                'd'//trim(tname(iq))//'_sscav', &
432                                'Tendance tracer '//ttext(iiq), "-", &
433                                (/ '', '', '', '', '', '', '', '', '' /))
434
435            o_dtr_sat(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
436                               'd'//trim(tname(iq))//'_sat', &
437                               'Tendance tracer '//ttext(iiq), "-", &
438                               (/ '', '', '', '', '', '', '', '', '' /))
439
440            o_dtr_uscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
441                                'd'//trim(tname(iq))//'_uscav', &
442                                'Tendance tracer '//ttext(iiq), "-", &
443                                 (/ '', '', '', '', '', '', '', '', '' /))
444
445            o_dtr_dry(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
446                              'cum'//'d'//trim(tname(iq))//'_dry', &
447                              'tracer tendency dry deposition'//ttext(iiq), "-", &
448                              (/ '', '', '', '', '', '', '', '', '' /))
449
450            o_trac_cum(iq-2) = ctrl_out((/ 3, 4, 10, 10, 10, 10, 11, 11, 11 /), &
451                               'cum'//tname(iiq),&
452                               'Cumulated tracer '//ttext(iiq), "-", &
453                               (/ '', '', '', '', '', '', '', '', '' /))
454            ENDDO
455      ENDIF
456
457    ENDIF ! clef_files
458
459    ENDDO !  iff
460
461    ! Updated write frequencies due to phys_out_filetimesteps.
462    ! Write frequencies are now in seconds. 
463    ecrit_mth = ecrit_files(1)
464    ecrit_day = ecrit_files(2)
465    ecrit_hf  = ecrit_files(3)
466    ecrit_ins = ecrit_files(4)
467    ecrit_LES = ecrit_files(5)
468    ecrit_ins = ecrit_files(6)
469    freq_outNMC(1) = ecrit_files(7)
470    freq_outNMC(2) = ecrit_files(8)
471    freq_outNMC(3) = ecrit_files(9)
472
473    WRITE(lunout,*)'swaero_diag=',swaero_diag
474    WRITE(lunout,*)'Fin phys_output_mod.F90'
475  end SUBROUTINE phys_output_open
476
477
478
479  SUBROUTINE convers_timesteps(str,dtime,timestep)
480
481    use ioipsl
482    USE phys_cal_mod
483
484    IMPLICIT NONE
485
486    CHARACTER(LEN=20)   :: str
487    CHARACTER(LEN=10)   :: type
488    INTEGER             :: ipos,il
489    real                :: ttt,xxx,timestep,dayseconde,dtime
490    parameter (dayseconde=86400.)
491    include "temps.h"
492    include "comconst.h"
493    include "iniprint.h"
494
495    ipos=scan(str,'0123456789.',.TRUE.)
496    ! 
497    il=len_trim(str)
498    WRITE(lunout,*)ipos,il
499    read(str(1:ipos),*) ttt
500    WRITE(lunout,*)ttt
501    type=str(ipos+1:il)
502
503
504    IF ( il == ipos ) then
505       type='day'
506    endif
507
508    IF ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
509    IF ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) then
510       WRITE(lunout,*)'annee_ref,day_ref mon_len',annee_ref,day_ref,mth_len
511       timestep = ttt * dayseconde * mth_len
512    endif
513    IF ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
514    IF ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
515    IF ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
516    IF ( type == 'TS' ) timestep = ttt * dtime
517
518    WRITE(lunout,*)'type =      ',type
519    WRITE(lunout,*)'nb j/h/m =  ',ttt
520    WRITE(lunout,*)'timestep(s)=',timestep
521
522  END SUBROUTINE convers_timesteps
523
524END MODULE phys_output_mod
525
Note: See TracBrowser for help on using the repository browser.