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