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