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

Last change on this file since 1826 was 1825, checked in by Ehouarn Millour, 13 years ago

Première étape de l'implémentation de XIOS. Modifications isolées dans des flags CPP_XIOS. Sorties opérationnelles (sauf stations et régionalisation) en modes séquentiel et omp, pas mpi.
UG
...........................................
First step of the XIOS implementation. Modifications are confined into CPP_XIOS flags. Output is operationnal (except for stations and regionalization) in sequential and omp modes (not mpi).
UG

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.9 KB
Line 
1! $Id: phys_output_mod.F90 1825 2013-08-02 14:36:53Z fairhead $
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,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    USE phys_output_ctrlout_mod
44
45#ifdef CPP_XIOS
46    ! ug Pour les sorties XIOS
47    USE wxios
48#endif
49
50    IMPLICIT NONE
51    include "dimensions.h"
52    include "temps.h"
53    include "clesphys.h"
54    include "thermcell.h"
55    include "comvert.h"
56    include "iniprint.h"
57
58    ! ug Nouveaux arguments nécessaires au histwrite_mod:
59    INTEGER, INTENT(IN)                         :: ivap
60    INTEGER, DIMENSION(klon), INTENT(IN)        :: lmax_th
61    LOGICAL, INTENT(IN)                         :: ok_sync
62    LOGICAL, DIMENSION(klon, klev), INTENT(IN)  :: ptconv, ptconvth
63    REAL, INTENT(IN)                            :: pdtphys
64    REAL, DIMENSION(klon), INTENT(IN)           :: pphis
65    REAL, DIMENSION(klon, klev), INTENT(IN)     :: pplay, d_t
66    REAL, DIMENSION(klon, klev+1), INTENT(IN)   :: paprs
67    REAL, DIMENSION(klon,klev,nqtot), INTENT(IN):: qx, d_qx
68    REAL, DIMENSION(klon, llm), INTENT(IN)      :: zmasse
69
70
71    REAL,DIMENSION(klon),INTENT(IN) :: rlon
72    REAL,DIMENSION(klon),INTENT(IN) :: rlat
73    INTEGER, INTENT(IN)             :: pim
74    INTEGER, DIMENSION(pim)            :: tabij
75    INTEGER,DIMENSION(pim), INTENT(IN) :: ipt, jpt
76    REAL,DIMENSION(pim), INTENT(IN) :: plat, plon
77    REAL,DIMENSION(pim,2) :: plat_bounds, plon_bounds
78
79    INTEGER                               :: jjmp1
80    INTEGER                               :: nbteta, nlevSTD, radpas
81    LOGICAL                               :: ok_mensuel, ok_journe, ok_hf, ok_instan
82    LOGICAL                               :: ok_LES,ok_ade,ok_aie,flag_aerosol_strat
83    LOGICAL                               :: new_aod, aerosol_couple
84    INTEGER, INTENT(IN)::  read_climoz ! read ozone climatology
85    !     Allowed values are 0, 1 and 2
86    !     0: do not read an ozone climatology
87    !     1: read a single ozone climatology that will be used day and night
88    !     2: read two ozone climatologies, the average day and night
89    !     climatology and the daylight climatology
90
91    REAL                                  :: dtime
92    INTEGER                               :: idayref
93    REAL                                  :: zjulian
94    REAL, DIMENSION(klev)                 :: Ahyb, Bhyb, Alt
95    CHARACTER(LEN=4), DIMENSION(nlevSTD)  :: clevSTD
96    INTEGER                               :: nsrf, k, iq, iiq, iff, i, j, ilev
97    INTEGER                               :: naero
98    LOGICAL                               :: ok_veget
99    INTEGER                               :: iflag_pbl
100    CHARACTER(LEN=4)                      :: bb2
101    CHARACTER(LEN=2)                      :: bb3
102    CHARACTER(LEN=6)                      :: type_ocean
103    CHARACTER(LEN=3)                      :: ctetaSTD(nbteta)
104    REAL, DIMENSION(nfiles)               :: ecrit_files
105    INTEGER, DIMENSION(iim*jjmp1)         ::  ndex2d
106    INTEGER, DIMENSION(iim*jjmp1*klev)    :: ndex3d
107    INTEGER                               :: imin_ins, imax_ins
108    INTEGER                               :: jmin_ins, jmax_ins
109    INTEGER, DIMENSION(nfiles)            :: phys_out_levmin, phys_out_levmax
110    INTEGER, DIMENSION(nfiles)            :: phys_out_filelevels
111    CHARACTER(LEN=20), DIMENSION(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq', 'DefFreq' /)
112    LOGICAL, DIMENSION(nfiles)            :: phys_out_filekeys
113    LOGICAL, DIMENSION(nfiles)            :: phys_out_filestations
114
115!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
116    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
117
118    LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE.,  .FALSE., .FALSE., .FALSE. /)
119    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/   -180.,   -180.,   -180.,    -180.,   -180.,   -180. /)
120    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/    180.,    180.,    180.,     180.,    180.,    180. /)
121    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/    -90.,    -90.,    -90.,     -90.,    -90.,    -90. /)
122    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/     90.,     90.,     90.,     90.,     90.,     90. /)
123
124#ifdef CPP_XIOS
125    ! ug Variables utilisées pour récupérer le calendrier pour xios
126    INTEGER :: x_an, x_mois, x_jour
127    REAL :: x_heure
128#endif
129
130    WRITE(lunout,*) 'Debut phys_output_mod.F90'
131    ! Initialisations (Valeurs par defaut
132
133    IF (.NOT. ALLOCATED(o_trac)) ALLOCATE(o_trac(nqtot))
134    IF (.NOT. ALLOCATED(o_trac_cum)) ALLOCATE(o_trac_cum(nqtot))
135    ALLOCATE(o_dtr_the(nqtot),o_dtr_con(nqtot),o_dtr_lessi_impa(nqtot))
136    ALLOCATE(o_dtr_lessi_nucl(nqtot),o_dtr_insc(nqtot),o_dtr_bcscav(nqtot))
137    ALLOCATE(o_dtr_evapls(nqtot),o_dtr_ls(nqtot),o_dtr_trsp(nqtot))
138    ALLOCATE(o_dtr_sscav(nqtot),o_dtr_sat(nqtot),o_dtr_uscav(nqtot))
139    ALLOCATE(o_dtr_dry(nqtot),o_dtr_vdf(nqtot))
140
141
142    levmax = (/ klev, klev, klev, klev, klev, klev /)
143
144    phys_out_filenames(1) = 'histmth'
145    phys_out_filenames(2) = 'histday'
146    phys_out_filenames(3) = 'histhf'
147    phys_out_filenames(4) = 'histins'
148    phys_out_filenames(5) = 'histLES'
149    phys_out_filenames(6) = 'histstn'
150
151    type_ecri(1) = 'ave(X)'
152    type_ecri(2) = 'ave(X)'
153    type_ecri(3) = 'ave(X)'
154    type_ecri(4) = 'inst(X)'
155    type_ecri(5) = 'ave(X)'
156    type_ecri(6) = 'inst(X)'
157
158    clef_files(1) = ok_mensuel
159    clef_files(2) = ok_journe
160    clef_files(3) = ok_hf
161    clef_files(4) = ok_instan
162    clef_files(5) = ok_LES
163    clef_files(6) = ok_instan
164
165    !sortir des fichiers "stations" si clef_stations(:)=.TRUE.
166    clef_stations(1) = .FALSE.
167    clef_stations(2) = .FALSE.
168    clef_stations(3) = .FALSE.
169    clef_stations(4) = .FALSE.
170    clef_stations(5) = .FALSE.
171    clef_stations(6) = .FALSE.
172
173    lev_files(1) = lev_histmth
174    lev_files(2) = lev_histday
175    lev_files(3) = lev_histhf
176    lev_files(4) = lev_histins
177    lev_files(5) = lev_histLES
178    lev_files(6) = lev_histins
179
180    ecrit_files(1) = ecrit_mth
181    ecrit_files(2) = ecrit_day
182    ecrit_files(3) = ecrit_hf
183    ecrit_files(4) = ecrit_ins
184    ecrit_files(5) = ecrit_LES
185    ecrit_files(6) = ecrit_ins
186
187    !! Lectures des parametres de sorties dans physiq.def
188
189    CALL getin('phys_out_regfkey',phys_out_regfkey)
190    CALL getin('phys_out_lonmin',phys_out_lonmin)
191    CALL getin('phys_out_lonmax',phys_out_lonmax)
192    CALL getin('phys_out_latmin',phys_out_latmin)
193    CALL getin('phys_out_latmax',phys_out_latmax)
194    phys_out_levmin(:)=levmin(:)
195    CALL getin('phys_out_levmin',levmin)
196    phys_out_levmax(:)=levmax(:)
197    CALL getin('phys_out_levmax',levmax)
198    CALL getin('phys_out_filenames',phys_out_filenames)
199    phys_out_filekeys(:)=clef_files(:)
200    CALL getin('phys_out_filekeys',clef_files)
201    phys_out_filestations(:)=clef_stations(:)
202    CALL getin('phys_out_filestations',clef_stations)
203    phys_out_filelevels(:)=lev_files(:)
204    CALL getin('phys_out_filelevels',lev_files)
205    CALL getin('phys_out_filetimesteps',chtimestep)
206    phys_out_filetypes(:)=type_ecri(:)
207    CALL getin('phys_out_filetypes',type_ecri)
208
209    type_ecri_files(:)=type_ecri(:)
210
211    WRITE(lunout,*)'phys_out_lonmin=',phys_out_lonmin
212    WRITE(lunout,*)'phys_out_lonmax=',phys_out_lonmax
213    WRITE(lunout,*)'phys_out_latmin=',phys_out_latmin
214    WRITE(lunout,*)'phys_out_latmax=',phys_out_latmax
215    WRITE(lunout,*)'phys_out_filenames=',phys_out_filenames
216    WRITE(lunout,*)'phys_out_filetypes=',type_ecri
217    WRITE(lunout,*)'phys_out_filekeys=',clef_files
218    WRITE(lunout,*)'phys_out_filestations=',clef_stations
219    WRITE(lunout,*)'phys_out_filelevels=',lev_files
220
221#ifdef CPP_XIOS
222    ! ug Réglage du calendrier xios
223    !Temps julian => an, mois, jour, heure
224    CALL ymds2ju(annee_ref, 1, day_ref, 0.0, zjulian)
225    CALL ju2ymds(zjulian, x_an, x_mois, x_jour, x_heure)
226    CALL wxios_set_cal(dtime, calend, x_an, x_mois, x_jour, x_heure)
227#endif
228
229!!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
230    ! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
231    ! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
232!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
233
234    zdtime_moy = dtime         ! Frequence ou l on moyenne
235
236    ! Calcul des Ahyb, Bhyb et Alt
237    DO k=1,klev
238       Ahyb(k)=(ap(k)+ap(k+1))/2.
239       Bhyb(k)=(bp(k)+bp(k+1))/2.
240       Alt(k)=log(preff/presnivs(k))*8.
241    ENDDO
242    !          if(prt_level.ge.1) then
243    WRITE(lunout,*)'Ap Hybrid = ',Ahyb(1:klev)
244    WRITE(lunout,*)'Bp Hybrid = ',Bhyb(1:klev)
245    WRITE(lunout,*)'Alt approx des couches pour une haut d echelle de 8km = ',Alt(1:klev)
246    !          endif
247    DO iff=1,nfiles
248
249       ! Calculate ecrit_files for all files
250       IF ( chtimestep(iff).eq.'DefFreq' ) then
251          ! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf ...)*86400.
252          ecrit_files(iff)=ecrit_files(iff)*86400.
253       ELSE
254          CALL convers_timesteps(chtimestep(iff),dtime,ecrit_files(iff))
255       ENDIF
256       WRITE(lunout,*)'ecrit_files(',iff,')= ',ecrit_files(iff)
257
258       zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
259
260       IF (clef_files(iff)) THEN
261
262          idayref = day_ref
263!          CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)       
264! correction pour l heure initiale                               !jyg
265!                                                                !jyg
266          CALL ymds2ju(annee_ref, 1, idayref, hour, zjulian)         !jyg
267! correction pour l heure initiale                               !jyg
268!                                                                !jyg
269!!!      CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)       !jyg
270! correction pour l heure initiale                               !jyg
271!                                                                !jyg
272!      CALL ymds2ju(annee_ref, 1, idayref, hour, zjulian)         !jyg
273
274!!!!!!!!!!!!!!!!! Traitement dans le cas ou l'on veut stocker sur un domaine limite !!
275!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
276          IF (phys_out_regfkey(iff)) then
277             imin_ins=1
278             imax_ins=iim
279             jmin_ins=1
280             jmax_ins=jjmp1
281
282             ! correction abderr       
283             do i=1,iim
284                WRITE(lunout,*)'io_lon(i)=',io_lon(i)
285                IF (io_lon(i).le.phys_out_lonmin(iff)) imin_ins=i
286                IF (io_lon(i).le.phys_out_lonmax(iff)) imax_ins=i+1
287             enddo
288
289             do j=1,jjmp1
290                WRITE(lunout,*)'io_lat(j)=',io_lat(j)
291                IF (io_lat(j).ge.phys_out_latmin(iff)) jmax_ins=j+1
292                IF (io_lat(j).ge.phys_out_latmax(iff)) jmin_ins=j
293             enddo
294
295             WRITE(lunout,*)'On stoke le fichier histoire numero ',iff,' sur ', &
296                  imin_ins,imax_ins,jmin_ins,jmax_ins
297             WRITE(lunout,*)'longitudes : ', &
298                  io_lon(imin_ins),io_lon(imax_ins), &
299                  'latitudes : ', &
300                  io_lat(jmax_ins),io_lat(jmin_ins)
301
302             CALL histbeg(phys_out_filenames(iff),iim,io_lon,jjmp1,io_lat, &
303                  imin_ins,imax_ins-imin_ins+1, &
304                  jmin_ins,jmax_ins-jmin_ins+1, &
305                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
306!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
307             !IM fichiers stations
308          else IF (clef_stations(iff)) THEN
309
310             WRITE(lunout,*)'phys_output_mod phys_out_filenames=',phys_out_filenames(iff)
311
312             CALL histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
313                  phys_out_filenames(iff), &
314                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
315          else
316             CALL histbeg_phy_all(phys_out_filenames(iff),itau_phy,zjulian,&
317                 dtime,chtimestep(iff),lev_files(iff),nhorim(iff),nid_files(iff))
318          endif
319
320          CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", &
321               levmax(iff) - levmin(iff) + 1, &
322               presnivs(levmin(iff):levmax(iff)), nvertm(iff),"down")
323
324!!!!!!!!!!!!! Traitement des champs 3D pour histhf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
325!!!!!!!!!!!!!!! A Revoir plus tard !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
326          !          IF (iff.eq.3.and.lev_files(iff).ge.4) THEN
327          !          CALL histbeg_phy("histhf3d",itau_phy, &
328          !     &                     zjulian, dtime, &
329          !     &                     nhorim, nid_hf3d)
330
331          !         CALL histvert(nid_hf3d, "presnivs", &
332          !     &                 "Vertical levels", "mb", &
333          !     &                 klev, presnivs/100., nvertm)
334          !          ENDIF
335          !
336!!!! Composantes de la coordonnee sigma-hybride
337          CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
338               levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
339
340          CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", &
341               levmax(iff) - levmin(iff) + 1,Bhyb,nvertbp(iff))
342
343          CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &
344               levmax(iff) - levmin(iff) + 1,Alt,nvertAlt(iff))
345
346          !   CALL histvert(nid_files(iff), "preff","Reference pressure", "Pa", &
347          !                 1,preff,nvertp0(iff))
348
349#ifdef CPP_XIOS
350    ! ug déclaration des axes verticaux de chaque fichier:
351    CALL wxios_add_vaxis("presnivs", nid_files(iff), levmax(iff) - levmin(iff) + 1, presnivs(levmin(iff):levmax(iff)))
352    CALL wxios_add_vaxis("Ahyb", nid_files(iff), levmax(iff) - levmin(iff) + 1, Ahyb)
353    CALL wxios_add_vaxis("Bhyb", nid_files(iff), levmax(iff) - levmin(iff) + 1, Bhyb)
354    CALL wxios_add_vaxis("Ahyb", nid_files(iff), levmax(iff) - levmin(iff) + 1, Alt)
355#endif
356
357      IF (nqtot>=3) THEN
358            DO iq=3,nqtot 
359            iiq=niadv(iq)
360            o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq),'Tracer '//ttext(iiq), "-",&
361                  (/ '', '', '', '', '', '' /))
362
363            o_dtr_vdf(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_vdf' &
364               ,'Tendance tracer '//ttext(iiq), "-" , (/ '', '', '', '', '', '' /))
365
366            o_dtr_the(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_the' &
367               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
368
369            o_dtr_con(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_con' &
370               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
371
372            o_dtr_lessi_impa(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_lessi_impa' &
373               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
374
375            o_dtr_lessi_nucl(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_lessi_nucl' &
376               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
377
378            o_dtr_insc(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_insc' &
379               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
380
381            o_dtr_bcscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_bcscav' &
382               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
383
384            o_dtr_evapls(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_evapls' &
385               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
386
387            o_dtr_ls(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_ls' &
388               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
389
390            o_dtr_trsp(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_trsp' &
391               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
392
393            o_dtr_sscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_sscav' &
394               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
395
396            o_dtr_sat(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_sat' &
397               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
398
399            o_dtr_uscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'d'//trim(tname(iq))//'_uscav' &
400               ,'Tendance tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
401
402            o_dtr_dry(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10 /),'cum'//'d'//trim(tname(iq))//'_dry' &
403               ,'tracer tendency dry deposition'//ttext(iiq), "-", (/ '', '', '', '', '', '' /) )
404
405            o_trac_cum(iq-2) = ctrl_out((/ 3, 4, 10, 10, 10, 10 /),'cum'//tname(iiq),&
406                  'Cumulated tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /))
407            ENDDO
408      ENDIF
409
410    ENDIF ! clef_files
411
412    ENDDO !  iff
413
414
415    ! Updated write frequencies due to phys_out_filetimesteps.
416    ! Write frequencies are now in seconds. 
417    ecrit_mth = ecrit_files(1)
418    ecrit_day = ecrit_files(2)
419    ecrit_hf  = ecrit_files(3)
420    ecrit_ins = ecrit_files(4)
421    ecrit_LES = ecrit_files(5)
422    ecrit_ins = ecrit_files(6)
423
424    WRITE(lunout,*)'swaero_diag=',swaero_diag
425    WRITE(lunout,*)'Fin phys_output_mod.F90'
426  end SUBROUTINE phys_output_open
427
428
429
430  SUBROUTINE convers_timesteps(str,dtime,timestep)
431
432    use ioipsl
433    USE phys_cal_mod
434
435    IMPLICIT NONE
436
437    CHARACTER(LEN=20)   :: str
438    CHARACTER(LEN=10)   :: type
439    INTEGER             :: ipos,il
440    real                :: ttt,xxx,timestep,dayseconde,dtime
441    parameter (dayseconde=86400.)
442    include "temps.h"
443    include "comconst.h"
444    include "iniprint.h"
445
446    ipos=scan(str,'0123456789.',.TRUE.)
447    ! 
448    il=len_trim(str)
449    WRITE(lunout,*)ipos,il
450    read(str(1:ipos),*) ttt
451    WRITE(lunout,*)ttt
452    type=str(ipos+1:il)
453
454
455    IF ( il == ipos ) then
456       type='day'
457    endif
458
459    IF ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
460    IF ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) then
461       WRITE(lunout,*)'annee_ref,day_ref mon_len',annee_ref,day_ref,mth_len
462       timestep = ttt * dayseconde * mth_len
463    endif
464    IF ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
465    IF ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
466    IF ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
467    IF ( type == 'TS' ) timestep = ttt * dtime
468
469    WRITE(lunout,*)'type =      ',type
470    WRITE(lunout,*)'nb j/h/m =  ',ttt
471    WRITE(lunout,*)'timestep(s)=',timestep
472
473  END SUBROUTINE convers_timesteps
474
475END MODULE phys_output_mod
476
Note: See TracBrowser for help on using the repository browser.