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