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

Last change on this file since 2547 was 2530, checked in by oboucher, 8 years ago

Changing flag_aerosol_strat from logical (y/n) to
an integer (0/1/2) for CMIP6 needs

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