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