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