| [524] | 1 | ! |
|---|
| [1279] | 2 | ! $Id: initfluxsto.f90 5285 2024-10-28 13:33:29Z aborella $ |
|---|
| [524] | 3 | ! |
|---|
| [5246] | 4 | subroutine initfluxsto & |
|---|
| 5 | (infile,tstep,t_ops,t_wrt, & |
|---|
| 6 | fileid,filevid,filedid) |
|---|
| [524] | 7 | |
|---|
| [5282] | 8 | USE iniprint_mod_h |
|---|
| 9 | USE comgeom_mod_h |
|---|
| [5281] | 10 | USE IOIPSL |
|---|
| [5246] | 11 | USE comconst_mod, ONLY: pi |
|---|
| 12 | USE comvert_mod, ONLY: nivsigs |
|---|
| 13 | USE temps_mod, ONLY: annee_ref, day_ref, itau_dyn |
|---|
| [524] | 14 | |
|---|
| [5271] | 15 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
|---|
| [5285] | 16 | USE paramet_mod_h |
|---|
| [5271] | 17 | implicit none |
|---|
| [524] | 18 | |
|---|
| [5246] | 19 | ! |
|---|
| 20 | ! Routine d'initialisation des ecritures des fichiers histoires LMDZ |
|---|
| 21 | ! au format IOIPSL |
|---|
| 22 | ! |
|---|
| 23 | ! Appels succesifs des routines: histbeg |
|---|
| 24 | ! histhori |
|---|
| 25 | ! histver |
|---|
| 26 | ! histdef |
|---|
| 27 | ! histend |
|---|
| 28 | ! |
|---|
| 29 | ! Entree: |
|---|
| 30 | ! |
|---|
| 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 |
|---|
| 36 | ! |
|---|
| 37 | ! Sortie: |
|---|
| 38 | ! fileid: ID du fichier netcdf cree |
|---|
| 39 | ! filevid:ID du fichier netcdf pour la grille v |
|---|
| 40 | ! |
|---|
| 41 | ! L. Fairhead, LMD, 03/99 |
|---|
| 42 | ! |
|---|
| 43 | ! ===================================================================== |
|---|
| 44 | ! |
|---|
| 45 | ! Declarations |
|---|
| [5271] | 46 | |
|---|
| [5272] | 47 | |
|---|
| [5246] | 48 | ! Arguments |
|---|
| 49 | ! |
|---|
| 50 | character(len=*) :: infile |
|---|
| 51 | real :: tstep, t_ops, t_wrt |
|---|
| 52 | integer :: fileid, filevid,filedid |
|---|
| 53 | |
|---|
| 54 | ! This routine needs IOIPSL to work |
|---|
| 55 | ! Variables locales |
|---|
| 56 | ! |
|---|
| 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 |
|---|
| 67 | logical :: ok_sync |
|---|
| 68 | ! |
|---|
| 69 | ! Initialisations |
|---|
| 70 | ! |
|---|
| 71 | pi = 4. * atan (1.) |
|---|
| 72 | str='q ' |
|---|
| 73 | ctrac = 'traceur ' |
|---|
| 74 | ok_sync = .true. |
|---|
| 75 | ! |
|---|
| 76 | ! Appel a histbeg: creation du fichier netcdf et initialisations diverses |
|---|
| 77 | ! |
|---|
| [524] | 78 | |
|---|
| [5246] | 79 | zan = annee_ref |
|---|
| 80 | idayref = day_ref |
|---|
| 81 | CALL ymds2ju(zan, 1, idayref, 0.0, zjulian) |
|---|
| 82 | tau0 = itau_dyn |
|---|
| [524] | 83 | |
|---|
| [5246] | 84 | do jj = 1, jjp1 |
|---|
| 85 | do ii = 1, iip1 |
|---|
| 86 | rlong(ii,jj) = rlonu(ii) * 180. / pi |
|---|
| 87 | rlat(ii,jj) = rlatu(jj) * 180. / pi |
|---|
| 88 | enddo |
|---|
| 89 | enddo |
|---|
| [524] | 90 | |
|---|
| [5246] | 91 | call histbeg(infile, iip1, rlong(:,1), jjp1, rlat(1,:), & |
|---|
| 92 | 1, iip1, 1, jjp1, & |
|---|
| 93 | tau0, zjulian, tstep, uhoriid, fileid) |
|---|
| 94 | ! |
|---|
| 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 | |
|---|
| 99 | |
|---|
| [5246] | 100 | do jj = 1, jjm |
|---|
| 101 | do ii = 1, iip1 |
|---|
| 102 | rlong(ii,jj) = rlonv(ii) * 180. / pi |
|---|
| 103 | rlat(ii,jj) = rlatv(jj) * 180. / pi |
|---|
| 104 | enddo |
|---|
| 105 | enddo |
|---|
| [524] | 106 | |
|---|
| [5246] | 107 | call histbeg('fluxstokev.nc', iip1, rlong(:,1), jjm, rlat(1,:), & |
|---|
| 108 | 1, iip1, 1, jjm, & |
|---|
| 109 | tau0, zjulian, tstep, vhoriid, filevid) |
|---|
| [524] | 110 | |
|---|
| [5246] | 111 | rl(1,1) = 1. |
|---|
| 112 | call histbeg('defstoke.nc', 1, rl, 1, rl, & |
|---|
| 113 | 1, 1, 1, 1, & |
|---|
| 114 | tau0, zjulian, tstep, dhoriid, filedid) |
|---|
| [524] | 115 | |
|---|
| [5246] | 116 | ! |
|---|
| 117 | ! Appel a histhori pour rajouter les autres grilles horizontales |
|---|
| 118 | ! |
|---|
| 119 | do jj = 1, jjp1 |
|---|
| 120 | do ii = 1, iip1 |
|---|
| 121 | rlong(ii,jj) = rlonv(ii) * 180. / pi |
|---|
| 122 | rlat(ii,jj) = rlatu(jj) * 180. / pi |
|---|
| 123 | enddo |
|---|
| 124 | enddo |
|---|
| [524] | 125 | |
|---|
| [5246] | 126 | call histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar', & |
|---|
| 127 | 'Grille points scalaires', thoriid) |
|---|
| [524] | 128 | |
|---|
| [5246] | 129 | ! |
|---|
| 130 | ! Appel a histvert pour la grille verticale |
|---|
| 131 | ! |
|---|
| 132 | call histvert(fileid, 'sig_s', 'Niveaux sigma', & |
|---|
| 133 | 'sigma_level', & |
|---|
| 134 | llm, nivsigs, zvertiid) |
|---|
| 135 | ! Pour le fichier V |
|---|
| 136 | call histvert(filevid, 'sig_s', 'Niveaux sigma', & |
|---|
| 137 | 'sigma_level', & |
|---|
| 138 | llm, nivsigs, zvertiid) |
|---|
| 139 | ! pour le fichier def |
|---|
| 140 | nivd(1) = 1 |
|---|
| 141 | call histvert(filedid, 'sig_s', 'Niveaux sigma', & |
|---|
| 142 | 'sigma_level', & |
|---|
| 143 | 1, nivd, dvertiid) |
|---|
| [524] | 144 | |
|---|
| [5246] | 145 | ! |
|---|
| 146 | ! Appels a histdef pour la definition des variables a sauvegarder |
|---|
| [524] | 147 | |
|---|
| [5246] | 148 | CALL histdef(fileid, "phis", "Surface geop. height", "-", & |
|---|
| 149 | iip1,jjp1,thoriid, 1,1,1, -99, 32, & |
|---|
| 150 | "once", t_ops, t_wrt) |
|---|
| [524] | 151 | |
|---|
| [5246] | 152 | CALL histdef(fileid, "aire", "Grid area", "-", & |
|---|
| 153 | iip1,jjp1,thoriid, 1,1,1, -99, 32, & |
|---|
| 154 | "once", t_ops, t_wrt) |
|---|
| 155 | |
|---|
| 156 | CALL histdef(filedid, "dtvr", "tps dyn", "s", & |
|---|
| 157 | 1,1,dhoriid, 1,1,1, -99, 32, & |
|---|
| 158 | "once", t_ops, t_wrt) |
|---|
| 159 | |
|---|
| 160 | CALL histdef(filedid, "istdyn", "tps stock", "s", & |
|---|
| 161 | 1,1,dhoriid, 1,1,1, -99, 32, & |
|---|
| 162 | "once", t_ops, t_wrt) |
|---|
| 163 | |
|---|
| 164 | CALL histdef(filedid, "istphy", "tps stock phy", "s", & |
|---|
| 165 | 1,1,dhoriid, 1,1,1, -99, 32, & |
|---|
| 166 | "once", t_ops, t_wrt) |
|---|
| 167 | |
|---|
| 168 | |
|---|
| 169 | ! |
|---|
| 170 | ! Masse |
|---|
| 171 | ! |
|---|
| 172 | call histdef(fileid, 'masse', 'Masse', 'kg', & |
|---|
| 173 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 174 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 175 | ! |
|---|
| 176 | ! Pbaru |
|---|
| 177 | ! |
|---|
| 178 | call histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s', & |
|---|
| 179 | iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, & |
|---|
| 180 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 181 | |
|---|
| 182 | ! |
|---|
| 183 | ! Pbarv |
|---|
| 184 | ! |
|---|
| 185 | call histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s', & |
|---|
| 186 | iip1, jjm, vhoriid, llm, 1, llm, zvertiid, & |
|---|
| 187 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 188 | ! |
|---|
| 189 | ! w |
|---|
| 190 | ! |
|---|
| 191 | call histdef(fileid, 'w', 'flx de masse vert', 'kg m/s', & |
|---|
| 192 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 193 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 194 | |
|---|
| 195 | ! |
|---|
| 196 | ! Temperature potentielle |
|---|
| 197 | ! |
|---|
| 198 | call histdef(fileid, 'teta', 'temperature potentielle', '-', & |
|---|
| 199 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 200 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 201 | ! |
|---|
| 202 | |
|---|
| 203 | ! |
|---|
| 204 | ! Geopotentiel |
|---|
| 205 | ! |
|---|
| 206 | call histdef(fileid, 'phi', 'geopotentiel instantane', '-', & |
|---|
| 207 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 208 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 209 | ! |
|---|
| 210 | ! Fin |
|---|
| 211 | ! |
|---|
| 212 | call histend(fileid) |
|---|
| 213 | call histend(filevid) |
|---|
| 214 | call histend(filedid) |
|---|
| 215 | if (ok_sync) then |
|---|
| 216 | call histsync(fileid) |
|---|
| 217 | call histsync(filevid) |
|---|
| 218 | call histsync(filedid) |
|---|
| 219 | endif |
|---|
| 220 | |
|---|
| [5267] | 221 | |
|---|
| 222 | |
|---|
| [5246] | 223 | return |
|---|
| 224 | end subroutine initfluxsto |
|---|