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