source: LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_mod.F90 @ 3852

Last change on this file since 3852 was 3852, checked in by dcugnet, 3 years ago

Extension of the tracers management.

The tracers files can be:

1) "traceur.def": old format, with:

  • the number of tracers on the first line
  • one line for each tracer: <tracer name> <hadv> <vadv> [<parent name>]

2) "tracer.def": new format with one section each model component.
3) "tracer_<name>.def": new format with a single section.

The formats 2 and 3 reading is driven by the "type_trac" key, which can be a

coma-separated list of components.

  • Format 2: read the sections from the "tracer.def" file.
  • format 3: read one section each "tracer_<section name>.def" file.
  • the first line of a section is "&<section name>
  • the other lines start with a tracer name followed by <key>=<val> pairs.
  • the "default" tracer name is reserved ; the other tracers of the section inherit its <key>=<val>, except for the keys that are redefined locally.

This format helps keeping the tracers files compact, thanks to the "default"
special tracer and the three levels of factorization:

  • on the tracers names: a tracer name can be a coma-separated list of tracers => all the tracers of the list have the same <key>=<val> properties
  • on the parents names: the value of the "parent" property can be a coma-separated list of tracers => only possible for geographic tagging tracers
  • on the phases: the property "phases" is [g](l][s] (gas/liquid/solid)

Read information is stored in the vector "tracers(:)", of derived type "tra".

"isotopes_params.def" is a similar file, with one section each isotopes family.
It contains a database of isotopes properties ; if there are second generation
tracers (isotopes), the corresponding sections are read.

Read information is stored in the vector "isotopes(:)", of derived type "iso".

The "getKey" function helps to get the values of the parameters stored in
"tracers" or "isotopes".

  • 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: 26.6 KB
Line 
1! $Id: phys_output_mod.F90 3852 2021-02-22 16:28:31Z dcugnet $
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       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, tracers, type_trac
38    USE ioipsl
39    USE phys_cal_mod, only : hour, calend
40    USE mod_phys_lmdz_para
41    !Martin
42    USE surface_data, ONLY : landice_opt
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, aps, bps, pseudoalt
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                               :: 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    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    INTEGER                               :: iflag_pbl_split
102    CHARACTER(LEN=4)                      :: bb2
103    CHARACTER(LEN=2)                      :: bb3
104    CHARACTER(LEN=6)                      :: type_ocean
105    INTEGER, DIMENSION(nbp_lon*jjmp1)         ::  ndex2d
106    INTEGER, DIMENSION(nbp_lon*jjmp1*klev)    :: ndex3d
107    INTEGER                               :: imin_ins, imax_ins
108    INTEGER                               :: jmin_ins, jmax_ins
109    INTEGER, DIMENSION(nfiles)            :: phys_out_levmin, phys_out_levmax
110    INTEGER, DIMENSION(nfiles)            :: phys_out_filelevels
111    CHARACTER(LEN=20), DIMENSION(nfiles)  :: chtimestep = (/ 'Default', 'Default', 'Default', 'Default', 'Default', &
112                                                             'Default', 'Default', 'Default', 'Default', 'Default' /)
113    LOGICAL, DIMENSION(nfiles)            :: phys_out_filekeys
114    LOGICAL, DIMENSION(nfiles)            :: phys_out_filestations
115
116!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
117    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
118
119    LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., &
120                                                                     .FALSE., .FALSE., .FALSE., .FALSE., .FALSE. /)
121    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., &
122                                                                     -180., -180., -180., -180., -180. /)
123    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/  180.,  180.,  180.,  180.,  180., &
124                                                                      180.,  180.,  180.,  180.,  180. /)
125    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/  -90.,  -90.,  -90.,  -90.,  -90., &
126                                                                      -90.,  -90.,  -90.,  -90.,  -90. /)
127    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/   90.,   90.,   90.,   90.,   90., &
128                                                                       90.,   90.,   90.,   90.,   90. /)
129    REAL, DIMENSION(klev,2) :: Ahyb_bounds, Bhyb_bounds
130    REAL, DIMENSION(klev+1)   :: lev_index
131               
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    INTEGER                         :: ISW
140    REAL, DIMENSION(NSW)            :: wl1_sun, wl2_sun !wavelength bounds (in um) for SW
141    REAL, DIMENSION(NSW)            :: wn1_sun, wn2_sun !wavenumber bounds (in m-1) for SW
142    REAL, DIMENSION(NSW)            :: spectband  !mean wavenumb. of each sp.band
143    REAL, DIMENSION(NSW,2)          :: spbnds_sun !bounds of spectband
144
145    CHARACTER(LEN=256), POINTER :: tname(:), ttext(:)
146
147    WRITE(lunout,*) 'Debut phys_output_mod.F90'
148    tname => tracers(:)%name
149    ttext => tracers(:)%lnam
150
151    ! Initialisations (Valeurs par defaut
152
153    DO ilev=1,klev
154      Ahyb_bounds(ilev,1) = ap(ilev)
155      Ahyb_bounds(ilev,2) = ap(ilev+1)
156      Bhyb_bounds(ilev,1) = bp(ilev)
157      Bhyb_bounds(ilev,2) = bp(ilev+1)
158      lev_index(ilev) = REAL(ilev)
159    END DO
160      lev_index(klev+1) = REAL(klev+1)
161
162    IF (.NOT. ALLOCATED(o_trac)) ALLOCATE(o_trac(nqtot))
163    IF (.NOT. ALLOCATED(o_trac_cum)) ALLOCATE(o_trac_cum(nqtot))
164    ALLOCATE(o_dtr_the(nqtot),o_dtr_con(nqtot),o_dtr_lessi_impa(nqtot))
165    ALLOCATE(o_dtr_lessi_nucl(nqtot),o_dtr_insc(nqtot),o_dtr_bcscav(nqtot))
166    ALLOCATE(o_dtr_evapls(nqtot),o_dtr_ls(nqtot),o_dtr_trsp(nqtot))
167    ALLOCATE(o_dtr_sscav(nqtot),o_dtr_sat(nqtot),o_dtr_uscav(nqtot))
168    ALLOCATE(o_dtr_dry(nqtot),o_dtr_vdf(nqtot))
169
170    levmax = (/ klev, klev, klev, klev, klev, klev, nlevSTD, nlevSTD, nlevSTD, klev /)
171
172    phys_out_filenames(1) = 'histmth'
173    phys_out_filenames(2) = 'histday'
174    phys_out_filenames(3) = 'histhf6h'
175    phys_out_filenames(4) = 'histhf3h'
176    phys_out_filenames(5) = 'histhf3hm'
177    phys_out_filenames(6) = 'histstn'
178    phys_out_filenames(7) = 'histmthNMC'
179    phys_out_filenames(8) = 'histdayNMC'
180    phys_out_filenames(9) = 'histhfNMC'
181    phys_out_filenames(10)= 'histstrataer'
182
183    type_ecri(1) = 'ave(X)'
184    type_ecri(2) = 'ave(X)'
185    type_ecri(3) = 'inst(X)'
186    type_ecri(4) = 'inst(X)'
187    type_ecri(5) = 'ave(X)'
188    type_ecri(6) = 'inst(X)'
189    type_ecri(7) = 'inst(X)'
190    type_ecri(8) = 'inst(X)'
191    type_ecri(9) = 'inst(X)'
192    type_ecri(10)= 'ave(X)'
193
194    clef_files(1) = ok_mensuel
195    clef_files(2) = ok_journe
196    clef_files(3) = ok_hf
197    clef_files(4) = ok_instan
198    clef_files(5) = ok_LES
199    clef_files(6) = ok_instan
200    clef_files(7) = ok_histNMC(1)
201    clef_files(8) = ok_histNMC(2)
202    clef_files(9) = ok_histNMC(3)
203#ifdef CPP_StratAer
204    clef_files(10)= .TRUE.
205#else
206    clef_files(10)= .FALSE.
207#endif
208
209    !sortir des fichiers "stations" si clef_stations(:)=.TRUE.
210    clef_stations(1) = .FALSE.
211    clef_stations(2) = .FALSE.
212    clef_stations(3) = .FALSE.
213    clef_stations(4) = .FALSE.
214    clef_stations(5) = .FALSE.
215    clef_stations(6) = .FALSE.
216    clef_stations(7) = .FALSE.
217    clef_stations(8) = .FALSE.
218    clef_stations(9) = .FALSE.
219    clef_stations(10)= .FALSE.
220
221    lev_files(1) = lev_histmth
222    lev_files(2) = lev_histday
223    lev_files(3) = lev_histhf
224    lev_files(4) = lev_histins
225    lev_files(5) = lev_histLES
226    lev_files(6) = lev_histins
227    lev_files(7) = levout_histNMC(1)
228    lev_files(8) = levout_histNMC(2)
229    lev_files(9) = levout_histNMC(3)
230    lev_files(10)= 5
231
232    ecrit_files(1) = ecrit_mth
233    ecrit_files(2) = ecrit_day
234    ecrit_files(3) = ecrit_hf
235    ecrit_files(4) = ecrit_ins
236    ecrit_files(5) = ecrit_LES
237    ecrit_files(6) = ecrit_ins
238    ecrit_files(7) = freq_outNMC(1)
239    ecrit_files(8) = freq_outNMC(2)
240    ecrit_files(9) = freq_outNMC(3)
241    ecrit_files(10)= ecrit_mth
242
243    !! Lectures des parametres de sorties dans physiq.def
244
245    CALL getin('phys_out_regfkey',phys_out_regfkey)
246    CALL getin('phys_out_lonmin',phys_out_lonmin)
247    CALL getin('phys_out_lonmax',phys_out_lonmax)
248    CALL getin('phys_out_latmin',phys_out_latmin)
249    CALL getin('phys_out_latmax',phys_out_latmax)
250    phys_out_levmin(:)=levmin(:)
251    CALL getin('phys_out_levmin',levmin)
252    phys_out_levmax(:)=levmax(:)
253    CALL getin('phys_out_levmax',levmax)
254    CALL getin('phys_out_filenames',phys_out_filenames)
255    phys_out_filekeys(:)=clef_files(:)
256    CALL getin('phys_out_filekeys',clef_files)
257    phys_out_filestations(:)=clef_stations(:)
258    CALL getin('phys_out_filestations',clef_stations)
259    phys_out_filelevels(:)=lev_files(:)
260    CALL getin('phys_out_filelevels',lev_files)
261    CALL getin('phys_out_filetimesteps',chtimestep)
262    phys_out_filetypes(:)=type_ecri(:)
263    CALL getin('phys_out_filetypes',type_ecri)
264
265    type_ecri_files(:)=type_ecri(:)
266
267!    if (ok_all_xml) phys_out_filelevels = 999
268
269    WRITE(lunout,*)'phys_out_lonmin=',phys_out_lonmin
270    WRITE(lunout,*)'phys_out_lonmax=',phys_out_lonmax
271    WRITE(lunout,*)'phys_out_latmin=',phys_out_latmin
272    WRITE(lunout,*)'phys_out_latmax=',phys_out_latmax
273    WRITE(lunout,*)'phys_out_filenames=',phys_out_filenames
274    WRITE(lunout,*)'phys_out_filetypes=',type_ecri
275    WRITE(lunout,*)'phys_out_filekeys=',clef_files
276    WRITE(lunout,*)'phys_out_filestations=',clef_stations
277    WRITE(lunout,*)'phys_out_filelevels=',lev_files
278    WRITE(lunout,*)'phys_out_regfkey=',phys_out_regfkey
279
280! A noter pour
281! l heure initiale - dans les fichiers histoire hist* - on met comme 
282! heure de debut soit la vraie heure (pour le 1D) soit 0h (pour le 3D)
283! afin d avoir une seule sortie mensuelle par mois lorsque l on tourne
284! par annee (IM).
285!
286     idayref = day_ref
287     IF (klon_glo==1) THEN
288       ! current_time (used to compute hour) is updated at the begining of
289       ! the physics; to set the correct outputs "initial time" we thus
290       ! have to use (hour-dtphys).
291         CALL ymds2ju(annee_ref, 1, idayref, hour-pdtphys, zjulian)
292         print *,'phys_output_mod: annee,iday,hour,zjulian=',annee_ref,idayref, hour, zjulian
293     ELSE
294         CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
295         CALL ymds2ju(annee_ref, 1, day_ini, start_time*rday, zjulian_start)
296     ENDIF
297
298#ifdef CPP_XIOS
299    ! ug R\'eglage du calendrier xios
300    !Temps julian => an, mois, jour, heure
301    CALL ju2ymds(zjulian, x_an, x_mois, x_jour, x_heure)
302    CALL ju2ymds(zjulian_start, ini_an, ini_mois, ini_jour, ini_heure)
303    CALL wxios_set_cal(dtime, calend, x_an, x_mois, x_jour, x_heure, ini_an, &
304                       ini_mois, ini_jour, ini_heure )
305#endif
306
307!!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
308    ! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
309    ! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
310!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
311
312    zdtime_moy = dtime         ! Frequence ou l on moyenne
313
314
315  ecrit_files(7) = ecrit_files(1)
316  ecrit_files(8) = ecrit_files(2)
317  ecrit_files(9) = ecrit_files(3)
318
319  DO iff=1,nfiles
320
321       ! Calculate ecrit_files for all files
322      IF ( chtimestep(iff).eq.'Default' ) THEN
323          ! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf
324          ! ...)*86400.
325          ecrit_files(iff)=ecrit_files(iff)*86400.
326      ELSE IF (chtimestep(iff).eq.'-1') THEN
327          PRINT*,'ecrit_files(',iff,') < 0 so IOIPSL work on different'
328          PRINT*,'months length'
329          ecrit_files(iff)=-1.
330      ELSE
331       CALL convers_timesteps(chtimestep(iff),dtime,ecrit_files(iff))
332      ENDIF
333
334       WRITE(lunout,*)'ecrit_files(',iff,')= ',ecrit_files(iff)
335       zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
336
337
338#ifdef CPP_XIOS
339!!! Ouverture de chaque fichier XIOS !!!!!!!!!!!
340    IF (.not. ok_all_xml) THEN
341      IF (prt_level >= 10) THEN
342        print*,'phys_output_open: call wxios_add_file with phys_out_filenames(iff)=',trim(phys_out_filenames(iff))   
343      ENDIF
344      CALL wxios_add_file(phys_out_filenames(iff),chtimestep(iff),lev_files(iff)) 
345    ENDIF
346
347!!! Declaration des axes verticaux de chaque fichier:
348    IF (prt_level >= 10) THEN
349      print*,'phys_output_open: Declare vertical axes for each file'
350    ENDIF
351
352   IF (iff.LE.6.OR.iff.EQ.10) THEN
353    CALL wxios_add_vaxis("presnivs", &
354            levmax(iff) - levmin(iff) + 1, presnivs(levmin(iff):levmax(iff)))
355    CALL wxios_add_vaxis("Ahyb", &
356            levmax(iff) - levmin(iff) + 1, aps(levmin(iff):levmax(iff)), positif='down', &
357            bnds=Ahyb_bounds(levmin(iff):levmax(iff),:))
358    CALL wxios_add_vaxis("Bhyb", &
359            levmax(iff) - levmin(iff) + 1, bps(levmin(iff):levmax(iff)), positif='down', &
360            bnds=Bhyb_bounds(levmin(iff):levmax(iff),:))
361    CALL wxios_add_vaxis("klev", levmax(iff) - levmin(iff) + 1, &
362                          lev_index(levmin(iff):levmax(iff)))
363    CALL wxios_add_vaxis("klevp1", klev+1, &
364                          lev_index(1:klev+1))
365    CALL wxios_add_vaxis("bnds", 2, (/1.,2./))
366
367     CALL wxios_add_vaxis("Alt", &
368            levmax(iff) - levmin(iff) + 1, pseudoalt)
369
370    IF (NSW.EQ.6) THEN
371!
372!wl1_sun: minimum bound of wavelength (in um)
373!
374      wl1_sun(1)=0.180
375      wl1_sun(2)=0.250
376      wl1_sun(3)=0.440
377      wl1_sun(4)=0.690
378      wl1_sun(5)=1.190
379      wl1_sun(6)=2.380
380!
381!wl2_sun: maximum bound of wavelength (in um)
382!
383      wl2_sun(1)=0.250
384      wl2_sun(2)=0.440
385      wl2_sun(3)=0.690
386      wl2_sun(4)=1.190
387      wl2_sun(5)=2.380
388      wl2_sun(6)=4.000
389!
390    ELSE IF(NSW.EQ.2) THEN
391!
392!wl1_sun: minimum bound of wavelength (in um)
393!
394      wl1_sun(1)=0.250
395      wl1_sun(2)=0.690
396!
397!wl2_sun: maximum bound of wavelength (in um)
398!
399      wl2_sun(1)=0.690
400      wl2_sun(2)=4.000
401    ENDIF
402
403    DO ISW=1, NSW
404     wn1_sun(ISW)=1.e+6/wl1_sun(ISW)
405     wn2_sun(ISW)=1.e+6/wl2_sun(ISW)
406     spbnds_sun(ISW,1)=wn2_sun(ISW)
407     spbnds_sun(ISW,2)=wn1_sun(ISW)
408     spectband(ISW)=(wn1_sun(ISW)+wn2_sun(ISW))/2
409    ENDDO
410!
411!!! ajout axe vertical spectband : solar band number
412    CALL wxios_add_vaxis("spectband", NSW, spectband, positif='down')
413   ELSE
414    ! NMC files
415    CALL wxios_add_vaxis("plev", &
416            levmax(iff) - levmin(iff) + 1, rlevSTD(levmin(iff):levmax(iff)))
417   ENDIF
418#endif
419
420        IF (clef_files(iff)) THEN
421!!!!!!!!!!!!!!!!! Traitement dans le cas ou l'on veut stocker sur un domaine limite !!
422!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
423          IF (phys_out_regfkey(iff)) THEN
424             imin_ins=1
425             imax_ins=nbp_lon
426             jmin_ins=1
427             jmax_ins=jjmp1
428
429             ! correction abderr       
430             DO i=1,nbp_lon
431                WRITE(lunout,*)'io_lon(i)=',io_lon(i)
432                IF (io_lon(i).le.phys_out_lonmin(iff)) imin_ins=i
433                IF (io_lon(i).le.phys_out_lonmax(iff)) imax_ins=i+1
434             ENDDO
435
436             DO j=1,jjmp1
437                WRITE(lunout,*)'io_lat(j)=',io_lat(j)
438                IF (io_lat(j).ge.phys_out_latmin(iff)) jmax_ins=j+1
439                IF (io_lat(j).ge.phys_out_latmax(iff)) jmin_ins=j
440             ENDDO
441
442             WRITE(lunout,*)'On stoke le fichier histoire numero ',iff,' sur ', &
443                  imin_ins,imax_ins,jmin_ins,jmax_ins
444             WRITE(lunout,*)'longitudes : ', &
445                  io_lon(imin_ins),io_lon(imax_ins), &
446                  'latitudes : ', &
447                  io_lat(jmax_ins),io_lat(jmin_ins)
448
449             CALL histbeg(phys_out_filenames(iff),nbp_lon,io_lon,jjmp1,io_lat, &
450                  imin_ins,imax_ins-imin_ins+1, &
451                  jmin_ins,jmax_ins-jmin_ins+1, &
452                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
453!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
454             !IM fichiers stations
455          ELSE IF (clef_stations(iff)) THEN
456
457             IF (prt_level >= 10) THEN
458             WRITE(lunout,*)'phys_output_open: iff=',iff,'  phys_out_filenames(iff)=',phys_out_filenames(iff)
459             ENDIF
460             
461             CALL histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
462                  phys_out_filenames(iff), &
463                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
464          ELSE
465
466             IF (prt_level >= 10) THEN
467             WRITE(lunout,*)'phys_output_open: iff=',iff,'  phys_out_filenames(iff)=',phys_out_filenames(iff)
468             ENDIF
469
470             CALL histbeg_phy_all(phys_out_filenames(iff),itau_phy,zjulian,&
471                 dtime,nhorim(iff),nid_files(iff))
472          ENDIF
473
474#ifndef CPP_IOIPSL_NO_OUTPUT
475          IF (iff.LE.6.OR.iff.EQ.10) THEN
476             CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", & 
477               levmax(iff) - levmin(iff) + 1, &
478               presnivs(levmin(iff):levmax(iff)), nvertm(iff),"down")
479!!!! Composantes de la coordonnee sigma-hybride
480          CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
481               levmax(iff) - levmin(iff) + 1,aps,nvertap(iff))
482
483          CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", &
484               levmax(iff) - levmin(iff) + 1,bps,nvertbp(iff))
485
486          CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &                       
487               levmax(iff) - levmin(iff) + 1,pseudoalt,nvertAlt(iff))
488
489          ELSE
490          ! NMC files
491             CALL histvert(nid_files(iff), "plev", "pressure", "Pa", &
492               levmax(iff) - levmin(iff) + 1, &
493              rlevSTD(levmin(iff):levmax(iff)), nvertm(iff), "down")
494          ENDIF
495#endif
496
497     ENDIF ! clef_files
498
499       IF (nqtot>=nqo+1) THEN
500!
501            DO iq=nqo+1,nqtot
502            iiq=niadv(iq)
503            o_trac(iq-nqo) = ctrl_out((/ 1, 5, 5, 5, 10, 10, 11, 11, 11, 11 /), &
504                           tname(iiq),'Tracer '//ttext(iiq), "-",  &
505                           (/ '', '', '', '', '', '', '', '', '', '' /))
506            o_dtr_vdf(iq-nqo) = ctrl_out((/ 4, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
507                              'd'//trim(tname(iq))//'_vdf',  &
508                              'Tendance tracer '//ttext(iiq), "-" , &
509                              (/ '', '', '', '', '', '', '', '', '', '' /))
510
511            o_dtr_the(iq-nqo) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
512                              'd'//trim(tname(iq))//'_the', &
513                              'Tendance tracer '//ttext(iiq), "-", &
514                              (/ '', '', '', '', '', '', '', '', '', '' /))
515
516            o_dtr_con(iq-nqo) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
517                              'd'//trim(tname(iq))//'_con', &
518                              'Tendance tracer '//ttext(iiq), "-", &
519                              (/ '', '', '', '', '', '', '', '', '', '' /))
520
521            o_dtr_lessi_impa(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
522                                     'd'//trim(tname(iq))//'_lessi_impa', &
523                                     'Tendance tracer '//ttext(iiq), "-", &
524                                     (/ '', '', '', '', '', '', '', '', '', '' /))
525
526            o_dtr_lessi_nucl(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
527                                     'd'//trim(tname(iq))//'_lessi_nucl', &
528                                     'Tendance tracer '//ttext(iiq), "-", &
529                                     (/ '', '', '', '', '', '', '', '', '', '' /))
530
531            o_dtr_insc(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
532                               'd'//trim(tname(iq))//'_insc', &
533                               'Tendance tracer '//ttext(iiq), "-", &
534                               (/ '', '', '', '', '', '', '', '', '', '' /))
535
536            o_dtr_bcscav(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
537                                 'd'//trim(tname(iq))//'_bcscav', &
538                                 'Tendance tracer '//ttext(iiq), "-", &
539                                 (/ '', '', '', '', '', '', '', '', '', '' /))
540
541            o_dtr_evapls(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
542                                 'd'//trim(tname(iq))//'_evapls', &
543                                 'Tendance tracer '//ttext(iiq), "-", &
544                                 (/ '', '', '', '', '', '', '', '', '', '' /))
545
546            o_dtr_ls(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
547                             'd'//trim(tname(iq))//'_ls', &
548                             'Tendance tracer '//ttext(iiq), "-", &
549                             (/ '', '', '', '', '', '', '', '', '', '' /))
550
551            o_dtr_trsp(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
552                               'd'//trim(tname(iq))//'_trsp', &
553                               'Tendance tracer '//ttext(iiq), "-", &
554                               (/ '', '', '', '', '', '', '', '', '', '' /))
555
556            o_dtr_sscav(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
557                                'd'//trim(tname(iq))//'_sscav', &
558                                'Tendance tracer '//ttext(iiq), "-", &
559                                (/ '', '', '', '', '', '', '', '', '', '' /))
560
561            o_dtr_sat(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
562                               'd'//trim(tname(iq))//'_sat', &
563                               'Tendance tracer '//ttext(iiq), "-", &
564                               (/ '', '', '', '', '', '', '', '', '', '' /))
565
566            o_dtr_uscav(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
567                                'd'//trim(tname(iq))//'_uscav', &
568                                'Tendance tracer '//ttext(iiq), "-", &
569                                 (/ '', '', '', '', '', '', '', '', '', '' /))
570
571            o_dtr_dry(iq-nqo) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11, 11 /), &
572                              'cum'//'d'//trim(tname(iq))//'_dry', &
573                              'tracer tendency dry deposition'//ttext(iiq), "-", &
574                              (/ '', '', '', '', '', '', '', '', '', '' /))
575
576            o_trac_cum(iq-nqo) = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11 /), &
577                               'cum'//tname(iiq),&
578                               'Cumulated tracer '//ttext(iiq), "-", &
579                               (/ '', '', '', '', '', '', '', '', '', '' /))
580            ENDDO
581      ENDIF
582
583   ENDDO !  iff
584
585    ! Updated write frequencies due to phys_out_filetimesteps.
586    ! Write frequencies are now in seconds. 
587    ecrit_mth = ecrit_files(1)
588    ecrit_day = ecrit_files(2)
589    ecrit_hf  = ecrit_files(3)
590    ecrit_ins = ecrit_files(4)
591    ecrit_LES = ecrit_files(5)
592    ecrit_ins = ecrit_files(6)
593
594    IF (prt_level >= 10) THEN
595      WRITE(lunout,*)'swaerofree_diag=',swaerofree_diag
596      WRITE(lunout,*)'swaero_diag=',swaero_diag
597      WRITE(lunout,*)'dryaod_diag=',dryaod_diag
598      WRITE(lunout,*)'ok_4xCO2atm=',ok_4xCO2atm
599      WRITE(lunout,*)'phys_output_open: ends here'
600    ENDIF
601
602  END SUBROUTINE phys_output_open
603
604  SUBROUTINE convers_timesteps(str,dtime,timestep)
605
606    use ioipsl
607    USE phys_cal_mod
608    USE time_phylmdz_mod, ONLY: day_ref, annee_ref
609    USE print_control_mod, ONLY: lunout
610
611    IMPLICIT NONE
612
613    CHARACTER(LEN=20)   :: str
614    CHARACTER(LEN=10)   :: type
615    INTEGER             :: ipos,il
616    real                :: ttt,xxx,timestep,dayseconde,dtime
617    parameter (dayseconde=86400.)
618
619    ipos=scan(str,'0123456789.',.TRUE.)
620    ! 
621    il=len_trim(str)
622    WRITE(lunout,*) "ipos = ", ipos
623    WRITE(lunout,*) "il = ", il
624    IF (ipos == 0) CALL abort_physic("convers_timesteps", "bad str", 1)
625    read(str(1:ipos),*) ttt
626    WRITE(lunout,*)ttt
627    type=str(ipos+1:il)
628
629    IF ( il == ipos ) THEN
630       type='day'
631    ENDIF
632
633    IF ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
634    IF ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) THEN
635       WRITE(lunout,*)'annee_ref,day_ref mon_len',annee_ref,day_ref,mth_len
636       timestep = ttt * dayseconde * mth_len
637    ENDIF
638    IF ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
639    IF ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
640    IF ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
641    IF ( type == 'TS' ) timestep = ttt * dtime
642
643    WRITE(lunout,*)'type =      ',type
644    WRITE(lunout,*)'nb j/h/m =  ',ttt
645    WRITE(lunout,*)'timestep(s)=',timestep
646
647  END SUBROUTINE convers_timesteps
648
649END MODULE phys_output_mod
Note: See TracBrowser for help on using the repository browser.