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