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