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