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