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