| 1 | ! |
|---|
| 2 | ! $Id: inithist.F 1279 2009-12-10 09:02:56Z acozic $ |
|---|
| 3 | ! |
|---|
| 4 | subroutine inithist(infile,day0,anne0,tstep,t_ops,t_wrt,fileid, |
|---|
| 5 | . filevid) |
|---|
| 6 | |
|---|
| 7 | #ifdef CPP_IOIPSL |
|---|
| 8 | USE IOIPSL |
|---|
| 9 | #endif |
|---|
| 10 | USE infotrac, ONLY : nqtot, ttext |
|---|
| 11 | |
|---|
| 12 | implicit none |
|---|
| 13 | |
|---|
| 14 | C |
|---|
| 15 | C Routine d'initialisation des ecritures des fichiers histoires LMDZ |
|---|
| 16 | C au format IOIPSL |
|---|
| 17 | C |
|---|
| 18 | C Appels succesifs des routines: histbeg |
|---|
| 19 | C histhori |
|---|
| 20 | C histver |
|---|
| 21 | C histdef |
|---|
| 22 | C histend |
|---|
| 23 | C |
|---|
| 24 | C Entree: |
|---|
| 25 | C |
|---|
| 26 | C infile: nom du fichier histoire a creer |
|---|
| 27 | C day0,anne0: date de reference |
|---|
| 28 | C tstep: duree du pas de temps en seconde |
|---|
| 29 | C t_ops: frequence de l'operation pour IOIPSL |
|---|
| 30 | C t_wrt: frequence d'ecriture sur le fichier |
|---|
| 31 | C nq: nombre de traceurs |
|---|
| 32 | C |
|---|
| 33 | C Sortie: |
|---|
| 34 | C fileid: ID du fichier netcdf cree |
|---|
| 35 | C filevid:ID du fichier netcdf pour la grille v |
|---|
| 36 | C |
|---|
| 37 | C L. Fairhead, LMD, 03/99 |
|---|
| 38 | C |
|---|
| 39 | C ===================================================================== |
|---|
| 40 | C |
|---|
| 41 | C Declarations |
|---|
| 42 | #include "dimensions.h" |
|---|
| 43 | #include "paramet.h" |
|---|
| 44 | #include "comconst.h" |
|---|
| 45 | #include "comvert.h" |
|---|
| 46 | #include "comgeom.h" |
|---|
| 47 | #include "temps.h" |
|---|
| 48 | #include "ener.h" |
|---|
| 49 | #include "logic.h" |
|---|
| 50 | #include "description.h" |
|---|
| 51 | #include "serre.h" |
|---|
| 52 | #include "iniprint.h" |
|---|
| 53 | |
|---|
| 54 | C Arguments |
|---|
| 55 | C |
|---|
| 56 | character*(*) infile |
|---|
| 57 | integer day0, anne0 |
|---|
| 58 | real tstep, t_ops, t_wrt |
|---|
| 59 | integer fileid, filevid |
|---|
| 60 | |
|---|
| 61 | #ifdef CPP_IOIPSL |
|---|
| 62 | ! This routine needs IOIPSL to work |
|---|
| 63 | C Variables locales |
|---|
| 64 | C |
|---|
| 65 | integer tau0 |
|---|
| 66 | real zjulian |
|---|
| 67 | integer iq |
|---|
| 68 | real rlong(iip1,jjp1), rlat(iip1,jjp1) |
|---|
| 69 | integer uhoriid, vhoriid, thoriid, zvertiid |
|---|
| 70 | integer ii,jj |
|---|
| 71 | integer zan, dayref |
|---|
| 72 | C |
|---|
| 73 | C Initialisations |
|---|
| 74 | C |
|---|
| 75 | pi = 4. * atan (1.) |
|---|
| 76 | C |
|---|
| 77 | C Appel a histbeg: creation du fichier netcdf et initialisations diverses |
|---|
| 78 | C |
|---|
| 79 | |
|---|
| 80 | zan = anne0 |
|---|
| 81 | dayref = day0 |
|---|
| 82 | CALL ymds2ju(zan, 1, dayref, 0.0, zjulian) |
|---|
| 83 | tau0 = itau_dyn |
|---|
| 84 | |
|---|
| 85 | do jj = 1, jjp1 |
|---|
| 86 | do ii = 1, iip1 |
|---|
| 87 | rlong(ii,jj) = rlonu(ii) * 180. / pi |
|---|
| 88 | rlat(ii,jj) = rlatu(jj) * 180. / pi |
|---|
| 89 | enddo |
|---|
| 90 | enddo |
|---|
| 91 | |
|---|
| 92 | call histbeg(infile, iip1, rlong(:,1), jjp1, rlat(1,:), |
|---|
| 93 | . 1, iip1, 1, jjp1, |
|---|
| 94 | . tau0, zjulian, tstep, uhoriid, fileid) |
|---|
| 95 | C |
|---|
| 96 | C Creation du fichier histoire pour la grille en V (oblige pour l'instant, |
|---|
| 97 | C IOIPSL ne permet pas de grilles avec des nombres de point differents dans |
|---|
| 98 | C un meme fichier) |
|---|
| 99 | |
|---|
| 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 |
|---|
| 106 | |
|---|
| 107 | call histbeg('dyn_histv.nc', iip1, rlong(:,1), jjm, rlat(1,:), |
|---|
| 108 | . 1, iip1, 1, jjm, |
|---|
| 109 | . tau0, zjulian, tstep, vhoriid, filevid) |
|---|
| 110 | C |
|---|
| 111 | C Appel a histhori pour rajouter les autres grilles horizontales |
|---|
| 112 | C |
|---|
| 113 | do jj = 1, jjp1 |
|---|
| 114 | do ii = 1, iip1 |
|---|
| 115 | rlong(ii,jj) = rlonv(ii) * 180. / pi |
|---|
| 116 | rlat(ii,jj) = rlatu(jj) * 180. / pi |
|---|
| 117 | enddo |
|---|
| 118 | enddo |
|---|
| 119 | |
|---|
| 120 | call histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar', |
|---|
| 121 | . 'Grille points scalaires', thoriid) |
|---|
| 122 | C |
|---|
| 123 | C Appel a histvert pour la grille verticale |
|---|
| 124 | C |
|---|
| 125 | call histvert(fileid, 'sig_s', 'Niveaux sigma','-', |
|---|
| 126 | . llm, nivsigs, zvertiid) |
|---|
| 127 | C Pour le fichier V |
|---|
| 128 | call histvert(filevid, 'sig_s', 'Niveaux sigma','-', |
|---|
| 129 | . llm, nivsigs, zvertiid) |
|---|
| 130 | C |
|---|
| 131 | C Appels a histdef pour la definition des variables a sauvegarder |
|---|
| 132 | C |
|---|
| 133 | C Vents U |
|---|
| 134 | C |
|---|
| 135 | call histdef(fileid, 'ucov', 'vents u covariants', 'm/s', |
|---|
| 136 | . iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, |
|---|
| 137 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 138 | C |
|---|
| 139 | C Vents V |
|---|
| 140 | C |
|---|
| 141 | call histdef(filevid, 'vcov', 'vents v covariants', 'm/s', |
|---|
| 142 | . iip1, jjm, vhoriid, llm, 1, llm, zvertiid, |
|---|
| 143 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 144 | |
|---|
| 145 | C |
|---|
| 146 | C Temperature potentielle |
|---|
| 147 | C |
|---|
| 148 | call histdef(fileid, 'teta', 'temperature potentielle', '-', |
|---|
| 149 | . iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|---|
| 150 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 151 | C |
|---|
| 152 | C Geopotentiel |
|---|
| 153 | C |
|---|
| 154 | call histdef(fileid, 'phi', 'geopotentiel instantane', '-', |
|---|
| 155 | . iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|---|
| 156 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 157 | C |
|---|
| 158 | C Traceurs |
|---|
| 159 | C |
|---|
| 160 | DO iq=1,nqtot |
|---|
| 161 | call histdef(fileid, ttext(iq), ttext(iq), '-', |
|---|
| 162 | . iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|---|
| 163 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 164 | enddo |
|---|
| 165 | C |
|---|
| 166 | C Masse |
|---|
| 167 | C |
|---|
| 168 | call histdef(fileid, 'masse', 'masse', 'kg', |
|---|
| 169 | . iip1, jjp1, thoriid, 1, 1, 1, -99, |
|---|
| 170 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 171 | C |
|---|
| 172 | C Pression au sol |
|---|
| 173 | C |
|---|
| 174 | call histdef(fileid, 'ps', 'pression naturelle au sol', 'Pa', |
|---|
| 175 | . iip1, jjp1, thoriid, 1, 1, 1, -99, |
|---|
| 176 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 177 | C |
|---|
| 178 | C Pression au sol |
|---|
| 179 | C |
|---|
| 180 | call histdef(fileid, 'phis', 'geopotentiel au sol', '-', |
|---|
| 181 | . iip1, jjp1, thoriid, 1, 1, 1, -99, |
|---|
| 182 | . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 183 | C |
|---|
| 184 | C Fin |
|---|
| 185 | C |
|---|
| 186 | call histend(fileid) |
|---|
| 187 | call histend(filevid) |
|---|
| 188 | #else |
|---|
| 189 | ! tell the user this routine should be run with ioipsl |
|---|
| 190 | write(lunout,*)"inithist: Warning this routine should not be", |
|---|
| 191 | & " used without ioipsl" |
|---|
| 192 | #endif |
|---|
| 193 | ! of #ifdef CPP_IOIPSL |
|---|
| 194 | return |
|---|
| 195 | end |
|---|