source: LMDZ6/branches/IPSLCM6.0.13/libf/phylmd/phys_output_mod.F90 @ 5442

Last change on this file since 5442 was 3052, checked in by musat, 7 years ago

Set up lwoff configuration : add ok_lwoff=y to activate it.
Add solbnd CMIP6 output.
Enable 3D outputs of SW/LW total sky and clear sky.
IM

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