source: LMDZ5/branches/IPSLCM6.0.8/libf/phylmd/phys_output_mod.F90 @ 3907

Last change on this file since 3907 was 2787, checked in by Laurent Fairhead, 7 years ago

Merged trunk changes r2727:2785 into testing branch

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