source: LMDZ6/trunk/libf/phylmd/phys_output_mod.F90 @ 3205

Last change on this file since 3205 was 3125, checked in by acozic, 7 years ago

Update some routines to coupled LMDZ6 with REPROBUS

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