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