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

Last change on this file since 1852 was 1852, checked in by Ehouarn Millour, 11 years ago

Implémentation des sorties XIOS dans LMDZ. Activation via -cpp CPP_XIOS.
ATTENTION: un problème de raccord subsiste en mode MPI !
UG
................................
Adding XIOS output to LMDZ. Activated by the CPP_XIOS key.
WARNING: buggy for now in MPI mode.
UG

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