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

Last change on this file since 2823 was 2823, checked in by oboucher, 7 years ago

Climatological ASNO3M, CSNO3M, CINO3M aerosol fields can be read and fed
through the aerosol routines for optical properties. The get_aero_fromfile
routine needed some change so that it doesn't stop if a particular field
is not there.

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