1 | ! $Id: writehist.f90 5159 2024-08-02 19:58:25Z abarral $ |
---|
2 | |
---|
3 | SUBROUTINE writehist(time, vcov, ucov, teta, phi, q, masse, ps, phis) |
---|
4 | |
---|
5 | USE ioipsl |
---|
6 | USE infotrac, ONLY: nqtot |
---|
7 | USE com_io_dyn_mod, ONLY: histid, histvid, histuid |
---|
8 | USE temps_mod, ONLY: itau_dyn |
---|
9 | USE lmdz_description, ONLY: descript |
---|
10 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
11 | USE lmdz_comgeom |
---|
12 | |
---|
13 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
14 | USE lmdz_paramet |
---|
15 | IMPLICIT NONE |
---|
16 | |
---|
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 | |
---|
34 | ! L. Fairhead, LMD, 03/99 |
---|
35 | |
---|
36 | ! ===================================================================== |
---|
37 | |
---|
38 | ! Declarations |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | ! Arguments |
---|
44 | ! |
---|
45 | |
---|
46 | REAL :: vcov(ip1jm, llm), ucov(ip1jmp1, llm) |
---|
47 | REAL :: teta(ip1jmp1, llm), phi(ip1jmp1, llm) |
---|
48 | REAL :: ps(ip1jmp1), masse(ip1jmp1, llm) |
---|
49 | REAL :: phis(ip1jmp1) |
---|
50 | REAL :: q(ip1jmp1, llm, nqtot) |
---|
51 | INTEGER :: time |
---|
52 | |
---|
53 | |
---|
54 | ! This routine needs IOIPSL to work |
---|
55 | ! Variables locales |
---|
56 | |
---|
57 | INTEGER :: iq, ii, ll |
---|
58 | INTEGER :: ndexu(ip1jmp1 * llm), ndexv(ip1jm * llm), ndex2d(ip1jmp1) |
---|
59 | LOGICAL :: ok_sync |
---|
60 | INTEGER :: itau_w |
---|
61 | REAL :: vnat(ip1jm, llm), unat(ip1jmp1, llm) |
---|
62 | |
---|
63 | |
---|
64 | ! Initialisations |
---|
65 | |
---|
66 | ndexu = 0 |
---|
67 | ndexv = 0 |
---|
68 | ndex2d = 0 |
---|
69 | ok_sync = .TRUE. |
---|
70 | itau_w = itau_dyn + time |
---|
71 | ! Passage aux composantes naturelles du vent |
---|
72 | CALL covnat(llm, ucov, vcov, unat, vnat) |
---|
73 | |
---|
74 | ! Appels a histwrite pour l'ecriture des variables a sauvegarder |
---|
75 | |
---|
76 | ! Vents U |
---|
77 | |
---|
78 | CALL histwrite(histuid, 'u', itau_w, unat, & |
---|
79 | iip1 * jjp1 * llm, ndexu) |
---|
80 | |
---|
81 | ! Vents V |
---|
82 | |
---|
83 | CALL histwrite(histvid, 'v', itau_w, vnat, & |
---|
84 | iip1 * jjm * llm, ndexv) |
---|
85 | |
---|
86 | |
---|
87 | ! Temperature potentielle |
---|
88 | |
---|
89 | CALL histwrite(histid, 'teta', itau_w, teta, & |
---|
90 | iip1 * jjp1 * llm, ndexu) |
---|
91 | |
---|
92 | ! Geopotentiel |
---|
93 | |
---|
94 | CALL histwrite(histid, 'phi', itau_w, phi, & |
---|
95 | iip1 * jjp1 * llm, ndexu) |
---|
96 | |
---|
97 | ! Traceurs |
---|
98 | |
---|
99 | ! DO iq=1,nqtot |
---|
100 | ! CALL histwrite(histid, tracers(iq)%longName, itau_w, |
---|
101 | ! . q(:,:,iq), iip1*jjp1*llm, ndexu) |
---|
102 | ! enddo |
---|
103 | !C |
---|
104 | ! Masse |
---|
105 | |
---|
106 | CALL histwrite(histid, 'masse', itau_w, masse, iip1 * jjp1 * llm, ndexu) |
---|
107 | |
---|
108 | ! Pression au sol |
---|
109 | |
---|
110 | CALL histwrite(histid, 'ps', itau_w, ps, iip1 * jjp1, ndex2d) |
---|
111 | |
---|
112 | ! Geopotentiel au sol |
---|
113 | |
---|
114 | ! CALL histwrite(histid, 'phis', itau_w, phis, iip1*jjp1, ndex2d) |
---|
115 | |
---|
116 | ! Fin |
---|
117 | |
---|
118 | IF (ok_sync) THEN |
---|
119 | CALL histsync(histid) |
---|
120 | CALL histsync(histvid) |
---|
121 | CALL histsync(histuid) |
---|
122 | ENDIF |
---|
123 | RETURN |
---|
124 | END SUBROUTINE writehist |
---|