| 1 | ! $Id: inithist.F90 5195 2024-09-16 13:18:00Z idelkadi $ |
|---|
| 2 | |
|---|
| 3 | SUBROUTINE inithist(day0, anne0, tstep, t_ops, t_wrt) |
|---|
| 4 | |
|---|
| 5 | USE IOIPSL |
|---|
| 6 | USE lmdz_infotrac, ONLY: nqtot |
|---|
| 7 | USE com_io_dyn_mod, ONLY: histid, histvid, histuid, & |
|---|
| 8 | dynhist_file, dynhistv_file, dynhistu_file |
|---|
| 9 | USE comconst_mod, ONLY: pi |
|---|
| 10 | USE comvert_mod, ONLY: presnivs |
|---|
| 11 | USE temps_mod, ONLY: itau_dyn |
|---|
| 12 | USE lmdz_iniprint, ONLY: lunout, prt_level |
|---|
| 13 | USE lmdz_comgeom |
|---|
| 14 | |
|---|
| 15 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
|---|
| 16 | USE lmdz_paramet |
|---|
| 17 | IMPLICIT NONE |
|---|
| 18 | |
|---|
| 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 | ! nq: nombre de traceurs |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | ! L. Fairhead, LMD, 03/99 |
|---|
| 40 | |
|---|
| 41 | ! ===================================================================== |
|---|
| 42 | |
|---|
| 43 | ! Declarations |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | ! Arguments |
|---|
| 48 | |
|---|
| 49 | INTEGER :: day0, anne0 |
|---|
| 50 | REAL :: tstep, t_ops, t_wrt |
|---|
| 51 | |
|---|
| 52 | ! This routine needs IOIPSL to work |
|---|
| 53 | ! Variables locales |
|---|
| 54 | |
|---|
| 55 | INTEGER :: tau0 |
|---|
| 56 | REAL :: zjulian |
|---|
| 57 | INTEGER :: iq |
|---|
| 58 | REAL :: rlong(iip1, jjp1), rlat(iip1, jjp1) |
|---|
| 59 | INTEGER :: uhoriid, vhoriid, thoriid, zvertiid |
|---|
| 60 | INTEGER :: ii, jj |
|---|
| 61 | INTEGER :: zan, dayref |
|---|
| 62 | |
|---|
| 63 | ! Initialisations |
|---|
| 64 | |
|---|
| 65 | pi = 4. * atan (1.) |
|---|
| 66 | |
|---|
| 67 | ! Appel a histbeg: creation du fichier netcdf et initialisations diverses |
|---|
| 68 | ! |
|---|
| 69 | |
|---|
| 70 | zan = anne0 |
|---|
| 71 | dayref = day0 |
|---|
| 72 | CALL ymds2ju(zan, 1, dayref, 0.0, zjulian) |
|---|
| 73 | tau0 = itau_dyn |
|---|
| 74 | |
|---|
| 75 | ! ------------------------------------------------------------- |
|---|
| 76 | ! Creation des 3 fichiers pour les grilles horizontales U,V,Scal |
|---|
| 77 | ! ------------------------------------------------------------- |
|---|
| 78 | !Grille U |
|---|
| 79 | DO jj = 1, jjp1 |
|---|
| 80 | DO ii = 1, iip1 |
|---|
| 81 | rlong(ii, jj) = rlonu(ii) * 180. / pi |
|---|
| 82 | rlat(ii, jj) = rlatu(jj) * 180. / pi |
|---|
| 83 | enddo |
|---|
| 84 | enddo |
|---|
| 85 | |
|---|
| 86 | CALL histbeg(dynhistu_file, iip1, rlong(:, 1), jjp1, rlat(1, :), & |
|---|
| 87 | 1, iip1, 1, jjp1, & |
|---|
| 88 | tau0, zjulian, tstep, uhoriid, histuid) |
|---|
| 89 | |
|---|
| 90 | ! Grille V |
|---|
| 91 | DO jj = 1, jjm |
|---|
| 92 | DO ii = 1, iip1 |
|---|
| 93 | rlong(ii, jj) = rlonv(ii) * 180. / pi |
|---|
| 94 | rlat(ii, jj) = rlatv(jj) * 180. / pi |
|---|
| 95 | enddo |
|---|
| 96 | enddo |
|---|
| 97 | |
|---|
| 98 | CALL histbeg(dynhistv_file, iip1, rlong(:, 1), jjm, rlat(1, :), & |
|---|
| 99 | 1, iip1, 1, jjm, & |
|---|
| 100 | tau0, zjulian, tstep, vhoriid, histvid) |
|---|
| 101 | |
|---|
| 102 | !Grille Scalaire |
|---|
| 103 | DO jj = 1, jjp1 |
|---|
| 104 | DO ii = 1, iip1 |
|---|
| 105 | rlong(ii, jj) = rlonv(ii) * 180. / pi |
|---|
| 106 | rlat(ii, jj) = rlatu(jj) * 180. / pi |
|---|
| 107 | enddo |
|---|
| 108 | enddo |
|---|
| 109 | |
|---|
| 110 | CALL histbeg(dynhist_file, iip1, rlong(:, 1), jjp1, rlat(1, :), & |
|---|
| 111 | 1, iip1, 1, jjp1, & |
|---|
| 112 | tau0, zjulian, tstep, thoriid, histid) |
|---|
| 113 | ! ------------------------------------------------------------- |
|---|
| 114 | ! Appel a histvert pour la grille verticale |
|---|
| 115 | ! ------------------------------------------------------------- |
|---|
| 116 | CALL histvert(histid, 'presnivs', 'Niveaux pression', 'mb', & |
|---|
| 117 | llm, presnivs / 100., zvertiid, 'down') |
|---|
| 118 | CALL histvert(histvid, 'presnivs', 'Niveaux pression', 'mb', & |
|---|
| 119 | llm, presnivs / 100., zvertiid, 'down') |
|---|
| 120 | CALL histvert(histuid, 'presnivs', 'Niveaux pression', 'mb', & |
|---|
| 121 | llm, presnivs / 100., zvertiid, 'down') |
|---|
| 122 | |
|---|
| 123 | ! ------------------------------------------------------------- |
|---|
| 124 | ! Appels a histdef pour la definition des variables a sauvegarder |
|---|
| 125 | ! ------------------------------------------------------------- |
|---|
| 126 | |
|---|
| 127 | ! Vents U |
|---|
| 128 | |
|---|
| 129 | CALL histdef(histuid, 'u', 'vent u', 'm/s', & |
|---|
| 130 | iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, & |
|---|
| 131 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 132 | |
|---|
| 133 | ! Vents V |
|---|
| 134 | |
|---|
| 135 | CALL histdef(histvid, 'v', 'vent v', 'm/s', & |
|---|
| 136 | iip1, jjm, vhoriid, llm, 1, llm, zvertiid, & |
|---|
| 137 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | ! Temperature potentielle |
|---|
| 141 | |
|---|
| 142 | CALL histdef(histid, 'teta', 'temperature potentielle', '-', & |
|---|
| 143 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 144 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 145 | |
|---|
| 146 | ! Geopotentiel |
|---|
| 147 | |
|---|
| 148 | CALL histdef(histid, 'phi', 'geopotentiel', '-', & |
|---|
| 149 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 150 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 151 | |
|---|
| 152 | ! Traceurs |
|---|
| 153 | ! |
|---|
| 154 | |
|---|
| 155 | ! DO iq=1,nqtot |
|---|
| 156 | ! CALL histdef(histid, tracers(iq)%name, |
|---|
| 157 | ! tracers(iq)%longName, '-', |
|---|
| 158 | ! . iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|---|
| 159 | ! . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 160 | ! enddo |
|---|
| 161 | !C |
|---|
| 162 | ! Masse |
|---|
| 163 | |
|---|
| 164 | CALL histdef(histid, 'masse', 'masse', 'kg', & |
|---|
| 165 | iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & |
|---|
| 166 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 167 | |
|---|
| 168 | ! Pression au sol |
|---|
| 169 | |
|---|
| 170 | CALL histdef(histid, 'ps', 'pression naturelle au sol', 'Pa', & |
|---|
| 171 | iip1, jjp1, thoriid, 1, 1, 1, -99, & |
|---|
| 172 | 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 173 | |
|---|
| 174 | ! Geopotentiel au sol |
|---|
| 175 | !C |
|---|
| 176 | ! CALL histdef(histid, 'phis', 'geopotentiel au sol', '-', |
|---|
| 177 | ! . iip1, jjp1, thoriid, 1, 1, 1, -99, |
|---|
| 178 | ! . 32, 'inst(X)', t_ops, t_wrt) |
|---|
| 179 | !C |
|---|
| 180 | ! Fin |
|---|
| 181 | |
|---|
| 182 | CALL histend(histid) |
|---|
| 183 | CALL histend(histuid) |
|---|
| 184 | CALL histend(histvid) |
|---|
| 185 | END SUBROUTINE inithist |
|---|