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

Last change on this file since 1912 was 1912, checked in by musat, 10 years ago

1) Modifications pour faire des simulations par an avec un calendrier realiste (365 jours ou autre).

Il faut mettre une frequence de sortie de -1 (variable phys_out_filetimesteps dans config.def) pour
que IOIPSL calcule les moyennes mensuels en prenant en compte des longuers variables de chaque
mois. Par exemple, pour le fichier histmth (1er fichier) et histmthNMC (7eme).
phys_out_filetimesteps= -1 1day 6hr 6hr 6hr 1d -1 1day 6hr

2) Corrections titres variables niveaux de pression des fichiers histmth, histday, etc

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