[1673] | 1 | ! $Id$ |
---|
[5099] | 2 | |
---|
[5114] | 3 | SUBROUTINE initfluxsto_p(infile, tstep, t_ops, t_wrt, fileid, filevid, filedid) |
---|
| 4 | USE IOIPSL |
---|
| 5 | USE parallel_lmdz |
---|
[5117] | 6 | USE lmdz_write_field |
---|
| 7 | USE misc_mod |
---|
[5114] | 8 | USE comconst_mod, ONLY: pi |
---|
| 9 | USE comvert_mod, ONLY: nivsigs |
---|
| 10 | USE temps_mod, ONLY: annee_ref, day_ref, itau_dyn |
---|
[5118] | 11 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5136] | 12 | USE lmdz_comgeom |
---|
[1632] | 13 | |
---|
[5159] | 14 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 15 | USE lmdz_paramet |
---|
[5113] | 16 | IMPLICIT NONE |
---|
[1632] | 17 | |
---|
[5159] | 18 | |
---|
[5105] | 19 | ! Routine d'initialisation des ecritures des fichiers histoires LMDZ |
---|
| 20 | ! au format IOIPSL |
---|
[5159] | 21 | |
---|
[5105] | 22 | ! Appels succesifs des routines: histbeg |
---|
| 23 | ! histhori |
---|
| 24 | ! histver |
---|
| 25 | ! histdef |
---|
| 26 | ! histend |
---|
[5159] | 27 | |
---|
[5105] | 28 | ! Entree: |
---|
[5159] | 29 | |
---|
[5105] | 30 | ! infile: nom du fichier histoire a creer |
---|
| 31 | ! day0,anne0: date de reference |
---|
| 32 | ! tstep: duree du pas de temps en seconde |
---|
| 33 | ! t_ops: frequence de l'operation pour IOIPSL |
---|
| 34 | ! t_wrt: frequence d'ecriture sur le fichier |
---|
[5159] | 35 | |
---|
[5105] | 36 | ! Sortie: |
---|
| 37 | ! fileid: ID du fichier netcdf cree |
---|
| 38 | ! filevid:ID du fichier netcdf pour la grille v |
---|
[5159] | 39 | |
---|
[5105] | 40 | ! L. Fairhead, LMD, 03/99 |
---|
[5159] | 41 | |
---|
[5105] | 42 | ! ===================================================================== |
---|
[5159] | 43 | |
---|
[5105] | 44 | ! Declarations |
---|
[1632] | 45 | |
---|
[5159] | 46 | |
---|
| 47 | |
---|
[5105] | 48 | ! Arguments |
---|
[5159] | 49 | |
---|
[5116] | 50 | CHARACTER(LEN = *) :: infile |
---|
| 51 | REAL :: tstep, t_ops, t_wrt |
---|
| 52 | INTEGER :: fileid, filevid, filedid |
---|
[1632] | 53 | |
---|
[5105] | 54 | ! This routine needs IOIPSL |
---|
| 55 | ! Variables locales |
---|
[5159] | 56 | |
---|
[5116] | 57 | REAL :: nivd(1) |
---|
| 58 | INTEGER :: tau0 |
---|
| 59 | REAL :: zjulian |
---|
| 60 | CHARACTER(LEN = 3) :: str |
---|
| 61 | CHARACTER(LEN = 10) :: ctrac |
---|
| 62 | INTEGER :: iq |
---|
| 63 | REAL :: rlong(iip1, jjp1), rlat(iip1, jjp1), rl(1, 1) |
---|
| 64 | INTEGER :: uhoriid, vhoriid, thoriid, zvertiid, dhoriid, dvertiid |
---|
| 65 | INTEGER :: ii, jj |
---|
| 66 | INTEGER :: zan, idayref |
---|
[5117] | 67 | LOGICAL :: ok_sync |
---|
[5116] | 68 | INTEGER :: jjb, jje, jjn |
---|
[1632] | 69 | |
---|
[5105] | 70 | ! definition du domaine d'ecriture pour le rebuild |
---|
[5103] | 71 | |
---|
[5114] | 72 | INTEGER, DIMENSION(2) :: ddid |
---|
| 73 | INTEGER, DIMENSION(2) :: dsg |
---|
| 74 | INTEGER, DIMENSION(2) :: dsl |
---|
| 75 | INTEGER, DIMENSION(2) :: dpf |
---|
| 76 | INTEGER, DIMENSION(2) :: dpl |
---|
| 77 | INTEGER, DIMENSION(2) :: dhs |
---|
| 78 | INTEGER, DIMENSION(2) :: dhe |
---|
[1632] | 79 | |
---|
[5105] | 80 | INTEGER :: dynu_domain_id |
---|
| 81 | INTEGER :: dynv_domain_id |
---|
[1632] | 82 | |
---|
[5159] | 83 | |
---|
[5105] | 84 | ! Initialisations |
---|
[5159] | 85 | |
---|
[5105] | 86 | pi = 4. * atan (1.) |
---|
[5114] | 87 | str = 'q ' |
---|
[5105] | 88 | ctrac = 'traceur ' |
---|
| 89 | ok_sync = .TRUE. |
---|
[5159] | 90 | |
---|
[5105] | 91 | ! Appel a histbeg: creation du fichier netcdf et initialisations diverses |
---|
| 92 | ! |
---|
[5103] | 93 | |
---|
[5105] | 94 | zan = annee_ref |
---|
| 95 | idayref = day_ref |
---|
| 96 | CALL ymds2ju(zan, 1, idayref, 0.0, zjulian) |
---|
| 97 | tau0 = itau_dyn |
---|
[1632] | 98 | |
---|
[5158] | 99 | DO jj = 1, jjp1 |
---|
| 100 | DO ii = 1, iip1 |
---|
[5114] | 101 | rlong(ii, jj) = rlonu(ii) * 180. / pi |
---|
| 102 | rlat(ii, jj) = rlatu(jj) * 180. / pi |
---|
[5105] | 103 | enddo |
---|
| 104 | enddo |
---|
[1632] | 105 | |
---|
[5114] | 106 | jjb = jj_begin |
---|
| 107 | jje = jj_end |
---|
| 108 | jjn = jj_nb |
---|
[1632] | 109 | |
---|
[5114] | 110 | ddid = (/ 1, 2 /) |
---|
| 111 | dsg = (/ iip1, jjp1 /) |
---|
| 112 | dsl = (/ iip1, jjn /) |
---|
| 113 | dpf = (/ 1, jjb /) |
---|
| 114 | dpl = (/ iip1, jje /) |
---|
| 115 | dhs = (/ 0, 0 /) |
---|
| 116 | dhe = (/ 0, 0 /) |
---|
[5103] | 117 | |
---|
[5114] | 118 | CALL flio_dom_set(mpi_size, mpi_rank, ddid, dsg, dsl, dpf, dpl, dhs, dhe, & |
---|
| 119 | 'box', dynu_domain_id) |
---|
[1632] | 120 | |
---|
[5114] | 121 | CALL histbeg(trim(infile), iip1, rlong(:, 1), jjn, rlat(1, jjb:jje), & |
---|
| 122 | 1, iip1, 1, jjn, tau0, zjulian, tstep, uhoriid, & |
---|
| 123 | fileid, dynu_domain_id) |
---|
[5159] | 124 | |
---|
[5105] | 125 | ! Creation du fichier histoire pour la grille en V (oblige pour l'instant, |
---|
| 126 | ! IOIPSL ne permet pas de grilles avec des nombres de point differents dans |
---|
| 127 | ! un meme fichier) |
---|
[1632] | 128 | |
---|
[5158] | 129 | DO jj = 1, jjm |
---|
| 130 | DO ii = 1, iip1 |
---|
[5114] | 131 | rlong(ii, jj) = rlonv(ii) * 180. / pi |
---|
| 132 | rlat(ii, jj) = rlatv(jj) * 180. / pi |
---|
[5105] | 133 | enddo |
---|
| 134 | enddo |
---|
[1632] | 135 | |
---|
[5114] | 136 | jjb = jj_begin |
---|
| 137 | jje = jj_end |
---|
| 138 | jjn = jj_nb |
---|
[5117] | 139 | IF (pole_sud) jje = jj_end - 1 |
---|
| 140 | IF (pole_sud) jjn = jj_nb - 1 |
---|
[1632] | 141 | |
---|
[5114] | 142 | ddid = (/ 1, 2 /) |
---|
| 143 | dsg = (/ iip1, jjm /) |
---|
| 144 | dsl = (/ iip1, jjn /) |
---|
| 145 | dpf = (/ 1, jjb /) |
---|
| 146 | dpl = (/ iip1, jje /) |
---|
| 147 | dhs = (/ 0, 0 /) |
---|
| 148 | dhe = (/ 0, 0 /) |
---|
[5103] | 149 | |
---|
[5114] | 150 | CALL flio_dom_set(mpi_size, mpi_rank, ddid, dsg, dsl, dpf, dpl, dhs, dhe, & |
---|
| 151 | 'box', dynv_domain_id) |
---|
[5103] | 152 | |
---|
[5114] | 153 | CALL histbeg('fluxstokev', iip1, rlong(:, 1), jjn, rlat(1, jjb:jje), & |
---|
| 154 | 1, iip1, 1, jjn, tau0, zjulian, tstep, vhoriid, & |
---|
| 155 | filevid, dynv_domain_id) |
---|
[5103] | 156 | |
---|
[5114] | 157 | rl(1, 1) = 1. |
---|
[5103] | 158 | |
---|
[5117] | 159 | IF (mpi_rank==0) THEN |
---|
[5105] | 160 | CALL histbeg('defstoke.nc', 1, rl, 1, rl, & |
---|
[5114] | 161 | 1, 1, 1, 1, & |
---|
| 162 | tau0, zjulian, tstep, dhoriid, filedid) |
---|
[1632] | 163 | |
---|
[5117] | 164 | ENDIF |
---|
[5159] | 165 | |
---|
[5105] | 166 | ! Appel a histhori pour rajouter les autres grilles horizontales |
---|
[5159] | 167 | |
---|
[5158] | 168 | DO jj = 1, jjp1 |
---|
| 169 | DO ii = 1, iip1 |
---|
[5114] | 170 | rlong(ii, jj) = rlonv(ii) * 180. / pi |
---|
| 171 | rlat(ii, jj) = rlatu(jj) * 180. / pi |
---|
[5105] | 172 | enddo |
---|
| 173 | enddo |
---|
[1632] | 174 | |
---|
[5114] | 175 | jjb = jj_begin |
---|
| 176 | jje = jj_end |
---|
| 177 | jjn = jj_nb |
---|
[5103] | 178 | |
---|
[5114] | 179 | CALL histhori(fileid, iip1, rlong(:, jjb:jje), jjn, rlat(:, jjb:jje), & |
---|
| 180 | 'scalar', 'Grille points scalaires', thoriid) |
---|
[5103] | 181 | |
---|
[5159] | 182 | |
---|
[5105] | 183 | ! Appel a histvert pour la grille verticale |
---|
[5159] | 184 | |
---|
[5105] | 185 | CALL histvert(fileid, 'sig_s', 'Niveaux sigma', & |
---|
[5114] | 186 | 'sigma_level', & |
---|
| 187 | llm, nivsigs, zvertiid) |
---|
[5105] | 188 | ! Pour le fichier V |
---|
| 189 | CALL histvert(filevid, 'sig_s', 'Niveaux sigma', & |
---|
[5114] | 190 | 'sigma_level', & |
---|
| 191 | llm, nivsigs, zvertiid) |
---|
[5105] | 192 | ! pour le fichier def |
---|
[5117] | 193 | IF (mpi_rank==0) THEN |
---|
[5114] | 194 | nivd(1) = 1 |
---|
| 195 | CALL histvert(filedid, 'sig_s', 'Niveaux sigma', & |
---|
| 196 | 'sigma_level', & |
---|
| 197 | 1, nivd, dvertiid) |
---|
[5117] | 198 | ENDIF |
---|
[5159] | 199 | |
---|
[5105] | 200 | ! Appels a histdef pour la definition des variables a sauvegarder |
---|
[1632] | 201 | |
---|
[5114] | 202 | CALL histdef(fileid, "phis", "Surface geop. height", "-", & |
---|
| 203 | iip1, jjn, thoriid, 1, 1, 1, -99, 32, & |
---|
[5105] | 204 | "once", t_ops, t_wrt) |
---|
[5103] | 205 | |
---|
[5114] | 206 | CALL histdef(fileid, "aire", "Grid area", "-", & |
---|
| 207 | iip1, jjn, thoriid, 1, 1, 1, -99, 32, & |
---|
| 208 | "once", t_ops, t_wrt) |
---|
[5103] | 209 | |
---|
[5117] | 210 | IF (mpi_rank==0) THEN |
---|
[5105] | 211 | CALL histdef(filedid, "dtvr", "tps dyn", "s", & |
---|
[5114] | 212 | 1, 1, dhoriid, 1, 1, 1, -99, 32, & |
---|
| 213 | "once", t_ops, t_wrt) |
---|
[5103] | 214 | |
---|
[5114] | 215 | CALL histdef(filedid, "istdyn", "tps stock", "s", & |
---|
| 216 | 1, 1, dhoriid, 1, 1, 1, -99, 32, & |
---|
| 217 | "once", t_ops, t_wrt) |
---|
[1632] | 218 | |
---|
[5114] | 219 | CALL histdef(filedid, "istphy", "tps stock phy", "s", & |
---|
| 220 | 1, 1, dhoriid, 1, 1, 1, -99, 32, & |
---|
| 221 | "once", t_ops, t_wrt) |
---|
[1632] | 222 | |
---|
[5117] | 223 | ENDIF |
---|
[5159] | 224 | |
---|
[5105] | 225 | ! Masse |
---|
[5159] | 226 | |
---|
[5105] | 227 | CALL histdef(fileid, 'masse', 'Masse', 'kg', & |
---|
[5114] | 228 | iip1, jjn, thoriid, llm, 1, llm, zvertiid, & |
---|
| 229 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5159] | 230 | |
---|
[5105] | 231 | ! Pbaru |
---|
[5159] | 232 | |
---|
[5105] | 233 | CALL histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s', & |
---|
[5114] | 234 | iip1, jjn, uhoriid, llm, 1, llm, zvertiid, & |
---|
| 235 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5103] | 236 | |
---|
[5159] | 237 | |
---|
[5105] | 238 | ! Pbarv |
---|
[5159] | 239 | |
---|
[5117] | 240 | IF (pole_sud) jjn = jj_nb - 1 |
---|
[1632] | 241 | |
---|
[5105] | 242 | CALL histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s', & |
---|
[5114] | 243 | iip1, jjn, vhoriid, llm, 1, llm, zvertiid, & |
---|
| 244 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5159] | 245 | |
---|
[5105] | 246 | ! w |
---|
[5159] | 247 | |
---|
[5117] | 248 | IF (pole_sud) jjn = jj_nb |
---|
[5105] | 249 | CALL histdef(fileid, 'w', 'flx de masse vert', 'kg m/s', & |
---|
[5114] | 250 | iip1, jjn, thoriid, llm, 1, llm, zvertiid, & |
---|
| 251 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[1632] | 252 | |
---|
[5159] | 253 | |
---|
[5105] | 254 | ! Temperature potentielle |
---|
[5159] | 255 | |
---|
[5105] | 256 | CALL histdef(fileid, 'teta', 'temperature potentielle', '-', & |
---|
[5114] | 257 | iip1, jjn, thoriid, llm, 1, llm, zvertiid, & |
---|
| 258 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5105] | 259 | ! |
---|
[5103] | 260 | |
---|
[5159] | 261 | |
---|
[5105] | 262 | ! Geopotentiel |
---|
[5159] | 263 | |
---|
[5105] | 264 | CALL histdef(fileid, 'phi', 'geopotentiel instantane', '-', & |
---|
[5114] | 265 | iip1, jjn, thoriid, llm, 1, llm, zvertiid, & |
---|
| 266 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5159] | 267 | |
---|
[5105] | 268 | ! Fin |
---|
[5159] | 269 | |
---|
[5105] | 270 | CALL histend(fileid) |
---|
| 271 | CALL histend(filevid) |
---|
[5117] | 272 | IF (mpi_rank==0) CALL histend(filedid) |
---|
| 273 | IF (ok_sync) THEN |
---|
[5105] | 274 | CALL histsync(fileid) |
---|
| 275 | CALL histsync(filevid) |
---|
[5117] | 276 | IF (mpi_rank==0) CALL histsync(filedid) |
---|
| 277 | ENDIF |
---|
[5105] | 278 | |
---|
[5116] | 279 | END SUBROUTINE initfluxsto_p |
---|