1 | ! |
---|
2 | ! $Id: writedynav.F 1357 2010-04-14 14:03:19Z emillour $ |
---|
3 | ! |
---|
4 | subroutine writedynav(time, vcov, |
---|
5 | , ucov,teta,ppk,phi,q,masse,ps,phis) |
---|
6 | |
---|
7 | #ifdef CPP_IOIPSL |
---|
8 | USE ioipsl |
---|
9 | #endif |
---|
10 | USE infotrac, ONLY : nqtot, ttext |
---|
11 | use com_io_dyn_mod, only : histaveid,histvaveid,histuaveid |
---|
12 | implicit none |
---|
13 | |
---|
14 | C |
---|
15 | C Ecriture du fichier histoire au format IOIPSL |
---|
16 | C |
---|
17 | C Appels succesifs des routines: histwrite |
---|
18 | C |
---|
19 | C Entree: |
---|
20 | C time: temps de l'ecriture |
---|
21 | C vcov: vents v covariants |
---|
22 | C ucov: vents u covariants |
---|
23 | C teta: temperature potentielle |
---|
24 | C phi : geopotentiel instantane |
---|
25 | C q : traceurs |
---|
26 | C masse: masse |
---|
27 | C ps :pression au sol |
---|
28 | C phis : geopotentiel au sol |
---|
29 | C |
---|
30 | C |
---|
31 | C |
---|
32 | C L. Fairhead, LMD, 03/99 |
---|
33 | C |
---|
34 | C ===================================================================== |
---|
35 | C |
---|
36 | C Declarations |
---|
37 | #include "dimensions.h" |
---|
38 | #include "paramet.h" |
---|
39 | #include "comconst.h" |
---|
40 | #include "comvert.h" |
---|
41 | #include "comgeom.h" |
---|
42 | #include "temps.h" |
---|
43 | #include "ener.h" |
---|
44 | #include "logic.h" |
---|
45 | #include "description.h" |
---|
46 | #include "serre.h" |
---|
47 | #include "iniprint.h" |
---|
48 | |
---|
49 | C |
---|
50 | C Arguments |
---|
51 | C |
---|
52 | |
---|
53 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) |
---|
54 | REAL teta(ip1jmp1*llm),phi(ip1jmp1,llm),ppk(ip1jmp1*llm) |
---|
55 | REAL ps(ip1jmp1),masse(ip1jmp1,llm) |
---|
56 | REAL phis(ip1jmp1) |
---|
57 | REAL q(ip1jmp1,llm,nqtot) |
---|
58 | integer time |
---|
59 | |
---|
60 | |
---|
61 | #ifdef CPP_IOIPSL |
---|
62 | ! This routine needs IOIPSL to work |
---|
63 | C Variables locales |
---|
64 | C |
---|
65 | integer ndex2d(ip1jmp1),ndexu(ip1jmp1*llm),ndexv(ip1jm*llm) |
---|
66 | INTEGER iq, ii, ll |
---|
67 | real tm(ip1jmp1*llm) |
---|
68 | REAL vnat(ip1jm,llm),unat(ip1jmp1,llm) |
---|
69 | logical ok_sync |
---|
70 | integer itau_w |
---|
71 | C |
---|
72 | C Initialisations |
---|
73 | C |
---|
74 | ndexu = 0 |
---|
75 | ndexv = 0 |
---|
76 | ndex2d = 0 |
---|
77 | ok_sync = .TRUE. |
---|
78 | tm = 999.999 |
---|
79 | vnat = 999.999 |
---|
80 | unat = 999.999 |
---|
81 | itau_w = itau_dyn + time |
---|
82 | |
---|
83 | C Passage aux composantes naturelles du vent |
---|
84 | call covnat(llm, ucov, vcov, unat, vnat) |
---|
85 | |
---|
86 | C |
---|
87 | C Appels a histwrite pour l'ecriture des variables a sauvegarder |
---|
88 | C |
---|
89 | C Vents U |
---|
90 | C |
---|
91 | call histwrite(histuaveid, 'u', itau_w, unat, |
---|
92 | . iip1*jjp1*llm, ndexu) |
---|
93 | C |
---|
94 | C Vents V |
---|
95 | C |
---|
96 | call histwrite(histvaveid, 'v', itau_w, vnat, |
---|
97 | . iip1*jjm*llm, ndexv) |
---|
98 | C |
---|
99 | C Temperature potentielle moyennee |
---|
100 | C |
---|
101 | call histwrite(histaveid, 'theta', itau_w, teta, |
---|
102 | . iip1*jjp1*llm, ndexu) |
---|
103 | C |
---|
104 | C Temperature moyennee |
---|
105 | C |
---|
106 | do ii = 1, ijp1llm |
---|
107 | tm(ii) = teta(ii) * ppk(ii)/cpp |
---|
108 | enddo |
---|
109 | call histwrite(histaveid, 'temp', itau_w, tm, |
---|
110 | . iip1*jjp1*llm, ndexu) |
---|
111 | C |
---|
112 | C Geopotentiel |
---|
113 | C |
---|
114 | call histwrite(histaveid, 'phi', itau_w, phi, |
---|
115 | . iip1*jjp1*llm, ndexu) |
---|
116 | C |
---|
117 | C Traceurs |
---|
118 | C |
---|
119 | ! DO iq=1,nqtot |
---|
120 | ! call histwrite(histaveid, ttext(iq), itau_w, q(:,:,iq), |
---|
121 | ! . iip1*jjp1*llm, ndexu) |
---|
122 | ! enddo |
---|
123 | C |
---|
124 | C Masse |
---|
125 | C |
---|
126 | call histwrite(histaveid, 'masse', itau_w, masse, |
---|
127 | $ iip1*jjp1*llm, ndexu) |
---|
128 | C |
---|
129 | C Pression au sol |
---|
130 | C |
---|
131 | call histwrite(histaveid, 'ps', itau_w, ps, iip1*jjp1, ndex2d) |
---|
132 | C |
---|
133 | C Geopotentiel au sol |
---|
134 | C |
---|
135 | ! call histwrite(histaveid,'phis',itau_w, phis,iip1*jjp1, ndex2d) |
---|
136 | C |
---|
137 | C Fin |
---|
138 | C |
---|
139 | if (ok_sync) then |
---|
140 | call histsync(histaveid) |
---|
141 | call histsync(histvaveid) |
---|
142 | call histsync(histuaveid) |
---|
143 | ENDIF |
---|
144 | |
---|
145 | #else |
---|
146 | ! tell the user this routine should be run with ioipsl |
---|
147 | write(lunout,*)"writedynav: Warning this routine should not be", |
---|
148 | & " used without ioipsl" |
---|
149 | #endif |
---|
150 | ! of #ifdef CPP_IOIPSL |
---|
151 | return |
---|
152 | end |
---|