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