[1279] | 1 | ! $Id: initfluxsto.f90 5195 2024-09-16 13:18:00Z 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 |
---|
[5118] | 11 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5136] | 12 | USE lmdz_comgeom |
---|
[524] | 13 | |
---|
[5159] | 14 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 15 | USE lmdz_paramet |
---|
[5113] | 16 | IMPLICIT NONE |
---|
[524] | 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 |
---|
[524] | 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 |
---|
[524] | 53 | |
---|
[5105] | 54 | ! This routine needs IOIPSL to work |
---|
| 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 |
---|
[5159] | 68 | |
---|
[5105] | 69 | ! Initialisations |
---|
[5159] | 70 | |
---|
[5105] | 71 | pi = 4. * atan (1.) |
---|
[5114] | 72 | str = 'q ' |
---|
[5105] | 73 | ctrac = 'traceur ' |
---|
| 74 | ok_sync = .TRUE. |
---|
[5159] | 75 | |
---|
[5105] | 76 | ! Appel a histbeg: creation du fichier netcdf et initialisations diverses |
---|
| 77 | ! |
---|
[5103] | 78 | |
---|
[5105] | 79 | zan = annee_ref |
---|
| 80 | idayref = day_ref |
---|
| 81 | CALL ymds2ju(zan, 1, idayref, 0.0, zjulian) |
---|
| 82 | tau0 = itau_dyn |
---|
[5103] | 83 | |
---|
[5158] | 84 | DO jj = 1, jjp1 |
---|
| 85 | DO ii = 1, iip1 |
---|
[5114] | 86 | rlong(ii, jj) = rlonu(ii) * 180. / pi |
---|
| 87 | rlat(ii, jj) = rlatu(jj) * 180. / pi |
---|
[5105] | 88 | enddo |
---|
| 89 | enddo |
---|
[524] | 90 | |
---|
[5114] | 91 | CALL histbeg(infile, iip1, rlong(:, 1), jjp1, rlat(1, :), & |
---|
| 92 | 1, iip1, 1, jjp1, & |
---|
| 93 | tau0, zjulian, tstep, uhoriid, fileid) |
---|
[5159] | 94 | |
---|
[5105] | 95 | ! Creation du fichier histoire pour la grille en V (oblige pour l'instant, |
---|
| 96 | ! IOIPSL ne permet pas de grilles avec des nombres de point differents dans |
---|
| 97 | ! un meme fichier) |
---|
[524] | 98 | |
---|
[5158] | 99 | DO jj = 1, jjm |
---|
| 100 | DO ii = 1, iip1 |
---|
[5114] | 101 | rlong(ii, jj) = rlonv(ii) * 180. / pi |
---|
| 102 | rlat(ii, jj) = rlatv(jj) * 180. / pi |
---|
[5105] | 103 | enddo |
---|
| 104 | enddo |
---|
[5103] | 105 | |
---|
[5114] | 106 | CALL histbeg('fluxstokev.nc', iip1, rlong(:, 1), jjm, rlat(1, :), & |
---|
| 107 | 1, iip1, 1, jjm, & |
---|
| 108 | tau0, zjulian, tstep, vhoriid, filevid) |
---|
[524] | 109 | |
---|
[5114] | 110 | rl(1, 1) = 1. |
---|
[5105] | 111 | CALL histbeg('defstoke.nc', 1, rl, 1, rl, & |
---|
[5114] | 112 | 1, 1, 1, 1, & |
---|
| 113 | tau0, zjulian, tstep, dhoriid, filedid) |
---|
[524] | 114 | |
---|
[5159] | 115 | |
---|
[5105] | 116 | ! Appel a histhori pour rajouter les autres grilles horizontales |
---|
[5159] | 117 | |
---|
[5158] | 118 | DO jj = 1, jjp1 |
---|
| 119 | DO ii = 1, iip1 |
---|
[5114] | 120 | rlong(ii, jj) = rlonv(ii) * 180. / pi |
---|
| 121 | rlat(ii, jj) = rlatu(jj) * 180. / pi |
---|
[5105] | 122 | enddo |
---|
| 123 | enddo |
---|
[5103] | 124 | |
---|
[5105] | 125 | CALL histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar', & |
---|
[5114] | 126 | 'Grille points scalaires', thoriid) |
---|
[524] | 127 | |
---|
[5159] | 128 | |
---|
[5105] | 129 | ! Appel a histvert pour la grille verticale |
---|
[5159] | 130 | |
---|
[5105] | 131 | CALL histvert(fileid, 'sig_s', 'Niveaux sigma', & |
---|
[5114] | 132 | 'sigma_level', & |
---|
| 133 | llm, nivsigs, zvertiid) |
---|
[5105] | 134 | ! Pour le fichier V |
---|
| 135 | CALL histvert(filevid, 'sig_s', 'Niveaux sigma', & |
---|
[5114] | 136 | 'sigma_level', & |
---|
| 137 | llm, nivsigs, zvertiid) |
---|
[5105] | 138 | ! pour le fichier def |
---|
| 139 | nivd(1) = 1 |
---|
| 140 | CALL histvert(filedid, 'sig_s', 'Niveaux sigma', & |
---|
[5114] | 141 | 'sigma_level', & |
---|
| 142 | 1, nivd, dvertiid) |
---|
[5103] | 143 | |
---|
[5159] | 144 | |
---|
[5105] | 145 | ! Appels a histdef pour la definition des variables a sauvegarder |
---|
[524] | 146 | |
---|
[5114] | 147 | CALL histdef(fileid, "phis", "Surface geop. height", "-", & |
---|
| 148 | iip1, jjp1, thoriid, 1, 1, 1, -99, 32, & |
---|
[5105] | 149 | "once", t_ops, t_wrt) |
---|
[5103] | 150 | |
---|
[5114] | 151 | CALL histdef(fileid, "aire", "Grid area", "-", & |
---|
| 152 | iip1, jjp1, thoriid, 1, 1, 1, -99, 32, & |
---|
| 153 | "once", t_ops, t_wrt) |
---|
[5103] | 154 | |
---|
[5114] | 155 | CALL histdef(filedid, "dtvr", "tps dyn", "s", & |
---|
| 156 | 1, 1, dhoriid, 1, 1, 1, -99, 32, & |
---|
[5105] | 157 | "once", t_ops, t_wrt) |
---|
[5103] | 158 | |
---|
[5114] | 159 | CALL histdef(filedid, "istdyn", "tps stock", "s", & |
---|
| 160 | 1, 1, dhoriid, 1, 1, 1, -99, 32, & |
---|
| 161 | "once", t_ops, t_wrt) |
---|
[524] | 162 | |
---|
[5114] | 163 | CALL histdef(filedid, "istphy", "tps stock phy", "s", & |
---|
| 164 | 1, 1, dhoriid, 1, 1, 1, -99, 32, & |
---|
| 165 | "once", t_ops, t_wrt) |
---|
[524] | 166 | |
---|
| 167 | |
---|
[5159] | 168 | |
---|
[5105] | 169 | ! Masse |
---|
[5159] | 170 | |
---|
[5105] | 171 | CALL histdef(fileid, 'masse', 'Masse', 'kg', & |
---|
[5114] | 172 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
---|
| 173 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5159] | 174 | |
---|
[5105] | 175 | ! Pbaru |
---|
[5159] | 176 | |
---|
[5105] | 177 | CALL histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s', & |
---|
[5114] | 178 | iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, & |
---|
| 179 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[524] | 180 | |
---|
[5159] | 181 | |
---|
[5105] | 182 | ! Pbarv |
---|
[5159] | 183 | |
---|
[5105] | 184 | CALL histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s', & |
---|
[5114] | 185 | iip1, jjm, vhoriid, llm, 1, llm, zvertiid, & |
---|
| 186 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5159] | 187 | |
---|
[5105] | 188 | ! w |
---|
[5159] | 189 | |
---|
[5105] | 190 | CALL histdef(fileid, 'w', 'flx de masse vert', 'kg m/s', & |
---|
[5114] | 191 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
---|
| 192 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[524] | 193 | |
---|
[5159] | 194 | |
---|
[5105] | 195 | ! Temperature potentielle |
---|
[5159] | 196 | |
---|
[5105] | 197 | CALL histdef(fileid, 'teta', 'temperature potentielle', '-', & |
---|
[5114] | 198 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
---|
| 199 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5105] | 200 | ! |
---|
[5103] | 201 | |
---|
[5159] | 202 | |
---|
[5105] | 203 | ! Geopotentiel |
---|
[5159] | 204 | |
---|
[5105] | 205 | CALL histdef(fileid, 'phi', 'geopotentiel instantane', '-', & |
---|
[5114] | 206 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
---|
| 207 | 32, 'inst(X)', t_ops, t_wrt) |
---|
[5159] | 208 | |
---|
[5105] | 209 | ! Fin |
---|
[5159] | 210 | |
---|
[5105] | 211 | CALL histend(fileid) |
---|
| 212 | CALL histend(filevid) |
---|
| 213 | CALL histend(filedid) |
---|
[5117] | 214 | IF (ok_sync) THEN |
---|
[5105] | 215 | CALL histsync(fileid) |
---|
| 216 | CALL histsync(filevid) |
---|
| 217 | CALL histsync(filedid) |
---|
[5117] | 218 | ENDIF |
---|
[5105] | 219 | |
---|
[5116] | 220 | RETURN |
---|
| 221 | END SUBROUTINE initfluxsto |
---|