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