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