[1632] | 1 | ! $Id: writedynav_p.F 1279 2009-12-10 09:02:56Z fairhead $ |
---|
[5099] | 2 | |
---|
[5114] | 3 | SUBROUTINE writehist_loc(time, vcov, ucov, teta, ppk, phi, q, masse, ps, phis) |
---|
[5105] | 4 | USE ioipsl |
---|
| 5 | USE parallel_lmdz |
---|
| 6 | USE misc_mod |
---|
[5182] | 7 | USE lmdz_infotrac, ONLY: nqtot |
---|
[5117] | 8 | USE com_io_dyn_mod, ONLY: histid, histvid, histuid |
---|
[5105] | 9 | USE comconst_mod, ONLY: cpp |
---|
| 10 | USE temps_mod, ONLY: itau_dyn |
---|
[5118] | 11 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5136] | 12 | USE lmdz_comgeom |
---|
[1632] | 13 | |
---|
[5159] | 14 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 15 | USE lmdz_paramet |
---|
[5113] | 16 | IMPLICIT NONE |
---|
[1632] | 17 | |
---|
[5159] | 18 | |
---|
[5105] | 19 | ! Ecriture du fichier histoire au format IOIPSL |
---|
[5159] | 20 | |
---|
[5105] | 21 | ! Appels succesifs des routines: histwrite |
---|
[5159] | 22 | |
---|
[5105] | 23 | ! Entree: |
---|
| 24 | ! histid: ID du fichier histoire |
---|
| 25 | ! time: temps de l'ecriture |
---|
| 26 | ! vcov: vents v covariants |
---|
| 27 | ! ucov: vents u covariants |
---|
| 28 | ! teta: temperature potentielle |
---|
| 29 | ! phi : geopotentiel instantane |
---|
| 30 | ! q : traceurs |
---|
| 31 | ! masse: masse |
---|
| 32 | ! ps :pression au sol |
---|
| 33 | ! phis : geopotentiel au sol |
---|
[5159] | 34 | |
---|
| 35 | |
---|
[5105] | 36 | ! Sortie: |
---|
| 37 | ! fileid: ID du fichier netcdf cree |
---|
[5159] | 38 | |
---|
[5105] | 39 | ! L. Fairhead, LMD, 03/99 |
---|
[5159] | 40 | |
---|
[5105] | 41 | ! ===================================================================== |
---|
[5159] | 42 | |
---|
[5105] | 43 | ! Declarations |
---|
[1632] | 44 | |
---|
[5159] | 45 | |
---|
| 46 | |
---|
| 47 | |
---|
[5105] | 48 | ! Arguments |
---|
| 49 | ! |
---|
[1632] | 50 | |
---|
[5114] | 51 | REAL :: vcov(ijb_v:ije_v, llm), ucov(ijb_u:ije_u, llm) |
---|
| 52 | REAL :: teta(ijb_u:ije_u, llm), phi(ijb_u:ije_u, llm) |
---|
| 53 | REAL :: ppk(ijb_u:ije_u, llm) |
---|
| 54 | REAL :: ps(ijb_u:ije_u), masse(ijb_u:ije_u, llm) |
---|
[5105] | 55 | REAL :: phis(ijb_u:ije_u) |
---|
[5114] | 56 | REAL :: q(ijb_u:ije_u, llm, nqtot) |
---|
[5116] | 57 | INTEGER :: time |
---|
[1632] | 58 | |
---|
[5105] | 59 | |
---|
| 60 | ! This routine needs IOIPSL |
---|
| 61 | ! Variables locales |
---|
[5159] | 62 | |
---|
[5114] | 63 | INTEGER, SAVE, ALLOCATABLE :: ndex2d(:), ndexu(:), ndexv(:) |
---|
[5105] | 64 | INTEGER :: iq, ii, ll |
---|
[5114] | 65 | REAL, SAVE, ALLOCATABLE :: tm(:, :) |
---|
| 66 | REAL, SAVE, ALLOCATABLE :: vnat(:, :), unat(:, :) |
---|
[5117] | 67 | LOGICAL :: ok_sync |
---|
[5116] | 68 | INTEGER :: itau_w |
---|
| 69 | INTEGER :: ijb, ije, jjn |
---|
[5114] | 70 | LOGICAL, SAVE :: first = .TRUE. |
---|
| 71 | !$OMP THREADPRIVATE(first) |
---|
[1632] | 72 | |
---|
[5159] | 73 | |
---|
[5105] | 74 | ! Initialisations |
---|
[5159] | 75 | |
---|
[5117] | 76 | IF (adjust) return |
---|
[5103] | 77 | |
---|
[5105] | 78 | IF (first) THEN |
---|
[5114] | 79 | !$OMP BARRIER |
---|
| 80 | !$OMP MASTER |
---|
| 81 | ALLOCATE(unat(ijb_u:ije_u, llm)) |
---|
| 82 | ALLOCATE(vnat(ijb_v:ije_v, llm)) |
---|
| 83 | ALLOCATE(tm(ijb_u:ije_u, llm)) |
---|
| 84 | ALLOCATE(ndex2d(ijnb_u * llm)) |
---|
| 85 | ALLOCATE(ndexu(ijnb_u * llm)) |
---|
| 86 | ALLOCATE(ndexv(ijnb_v * llm)) |
---|
[5105] | 87 | ndex2d = 0 |
---|
| 88 | ndexu = 0 |
---|
| 89 | ndexv = 0 |
---|
[5114] | 90 | !$OMP END MASTER |
---|
| 91 | !$OMP BARRIER |
---|
| 92 | first = .FALSE. |
---|
[5105] | 93 | ENDIF |
---|
[5103] | 94 | |
---|
[5105] | 95 | ok_sync = .TRUE. |
---|
| 96 | itau_w = itau_dyn + time |
---|
[1632] | 97 | |
---|
[5105] | 98 | ! Passage aux composantes naturelles du vent |
---|
| 99 | CALL covnat_loc(llm, ucov, vcov, unat, vnat) |
---|
[1632] | 100 | |
---|
[5159] | 101 | |
---|
[5105] | 102 | ! Appels a histwrite pour l'ecriture des variables a sauvegarder |
---|
[5159] | 103 | |
---|
[5105] | 104 | ! Vents U |
---|
| 105 | ! |
---|
[1632] | 106 | |
---|
[5114] | 107 | !$OMP BARRIER |
---|
| 108 | !$OMP MASTER |
---|
| 109 | ijb = ij_begin |
---|
| 110 | ije = ij_end |
---|
| 111 | jjn = jj_nb |
---|
[5103] | 112 | |
---|
[5114] | 113 | CALL histwrite(histuid, 'u', itau_w, unat(ijb:ije, :), & |
---|
| 114 | iip1 * jjn * llm, ndexu) |
---|
| 115 | !$OMP END MASTER |
---|
[1632] | 116 | |
---|
[5159] | 117 | |
---|
[5105] | 118 | ! Vents V |
---|
[5159] | 119 | |
---|
[5114] | 120 | ije = ij_end |
---|
[5117] | 121 | IF (pole_sud) jjn = jj_nb - 1 |
---|
| 122 | IF (pole_sud) ije = ij_end - iip1 |
---|
[5114] | 123 | !$OMP BARRIER |
---|
| 124 | !$OMP MASTER |
---|
| 125 | CALL histwrite(histvid, 'v', itau_w, vnat(ijb:ije, :), & |
---|
| 126 | iip1 * jjn * llm, ndexv) |
---|
| 127 | !$OMP END MASTER |
---|
[1632] | 128 | |
---|
| 129 | |
---|
[5159] | 130 | |
---|
[5105] | 131 | ! Temperature potentielle |
---|
[5159] | 132 | |
---|
[5114] | 133 | ijb = ij_begin |
---|
| 134 | ije = ij_end |
---|
| 135 | jjn = jj_nb |
---|
| 136 | !$OMP MASTER |
---|
| 137 | CALL histwrite(histid, 'theta', itau_w, teta(ijb:ije, :), & |
---|
| 138 | iip1 * jjn * llm, ndexu) |
---|
| 139 | !$OMP END MASTER |
---|
[1632] | 140 | |
---|
[5159] | 141 | |
---|
[5105] | 142 | ! Temperature |
---|
| 143 | ! |
---|
[1632] | 144 | |
---|
[5114] | 145 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[5158] | 146 | DO ll = 1, llm |
---|
| 147 | DO ii = ijb, ije |
---|
[5114] | 148 | tm(ii, ll) = teta(ii, ll) * ppk(ii, ll) / cpp |
---|
[5105] | 149 | enddo |
---|
| 150 | enddo |
---|
[5114] | 151 | !$OMP ENDDO |
---|
[1632] | 152 | |
---|
[5114] | 153 | !$OMP MASTER |
---|
| 154 | CALL histwrite(histid, 'temp', itau_w, tm(ijb:ije, :), & |
---|
| 155 | iip1 * jjn * llm, ndexu) |
---|
| 156 | !$OMP END MASTER |
---|
[1632] | 157 | |
---|
| 158 | |
---|
[5159] | 159 | |
---|
[5105] | 160 | ! Geopotentiel |
---|
[5159] | 161 | |
---|
[5114] | 162 | !$OMP MASTER |
---|
| 163 | CALL histwrite(histid, 'phi', itau_w, phi(ijb:ije, :), & |
---|
| 164 | iip1 * jjn * llm, ndexu) |
---|
| 165 | !$OMP END MASTER |
---|
[1632] | 166 | |
---|
| 167 | |
---|
[5159] | 168 | |
---|
[5105] | 169 | ! Traceurs |
---|
[5159] | 170 | |
---|
[5105] | 171 | !!$OMP MASTER |
---|
| 172 | ! DO iq=1,nqtot |
---|
| 173 | ! CALL histwrite(histid, tracers(iq)%longName, itau_w, |
---|
| 174 | ! . q(ijb:ije,:,iq), iip1*jjn*llm, ndexu) |
---|
| 175 | ! enddo |
---|
| 176 | !!$OMP END MASTER |
---|
[1632] | 177 | |
---|
| 178 | |
---|
[5159] | 179 | |
---|
[5105] | 180 | ! Masse |
---|
[5159] | 181 | |
---|
[5114] | 182 | !$OMP MASTER |
---|
| 183 | CALL histwrite(histid, 'masse', itau_w, masse(ijb:ije, :), & |
---|
| 184 | iip1 * jjn * llm, ndexu) |
---|
| 185 | !$OMP END MASTER |
---|
[1632] | 186 | |
---|
| 187 | |
---|
[5159] | 188 | |
---|
[5105] | 189 | ! Pression au sol |
---|
[5159] | 190 | |
---|
[5114] | 191 | !$OMP MASTER |
---|
| 192 | CALL histwrite(histid, 'ps', itau_w, ps(ijb:ije), & |
---|
| 193 | iip1 * jjn, ndex2d) |
---|
| 194 | !$OMP END MASTER |
---|
[1632] | 195 | |
---|
[5159] | 196 | |
---|
[5105] | 197 | ! Geopotentiel au sol |
---|
[5159] | 198 | |
---|
[5114] | 199 | !$OMP MASTER |
---|
| 200 | ! CALL histwrite(histid, 'phis', itau_w, phis(ijb:ije), |
---|
[5105] | 201 | ! . iip1*jjn, ndex2d) |
---|
[5114] | 202 | !$OMP END MASTER |
---|
[1632] | 203 | |
---|
[5159] | 204 | |
---|
[5105] | 205 | ! Fin |
---|
[5159] | 206 | |
---|
[5114] | 207 | !$OMP MASTER |
---|
[5117] | 208 | IF (ok_sync) THEN |
---|
[5105] | 209 | CALL histsync(histid) |
---|
| 210 | CALL histsync(histvid) |
---|
| 211 | CALL histsync(histuid) |
---|
[5117] | 212 | ENDIF |
---|
[5114] | 213 | !$OMP END MASTER |
---|
[5116] | 214 | END SUBROUTINE writehist_loc |
---|