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