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