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