1 | c======================================================================= |
---|
2 | subroutine ini_archive(nid,phis,tab_cntrl_dyn,tab_cntrl_fi) |
---|
3 | c======================================================================= |
---|
4 | c |
---|
5 | c |
---|
6 | c Date: 01/1997 |
---|
7 | c ---- |
---|
8 | c |
---|
9 | c Objet: ecriture de l'entete du fichier "start_archive" |
---|
10 | c ----- |
---|
11 | c |
---|
12 | c Proche de iniwrite.F |
---|
13 | c |
---|
14 | c Arguments: |
---|
15 | c --------- |
---|
16 | c |
---|
17 | c Inputs: |
---|
18 | c ------ |
---|
19 | c |
---|
20 | c nid unite logique du fichier "start_archive" |
---|
21 | c phis geopotentiel au sol |
---|
22 | c tab_cntrl_dyn tableau des param dynamiques |
---|
23 | c tab_cntrl_fi tableau des param physiques |
---|
24 | c |
---|
25 | |
---|
26 | c======================================================================= |
---|
27 | |
---|
28 | USE control_mod |
---|
29 | |
---|
30 | implicit none |
---|
31 | |
---|
32 | #include "dimensions.h" |
---|
33 | #include "paramet.h" |
---|
34 | #include "comconst.h" |
---|
35 | #include "comvert.h" |
---|
36 | #include "comgeom.h" |
---|
37 | #include "temps.h" |
---|
38 | #include "ener.h" |
---|
39 | #include "logic.h" |
---|
40 | #include "description.h" |
---|
41 | #include "serre.h" |
---|
42 | #include "netcdf.inc" |
---|
43 | |
---|
44 | c----------------------------------------------------------------------- |
---|
45 | c Declarations |
---|
46 | c----------------------------------------------------------------------- |
---|
47 | |
---|
48 | c Local: |
---|
49 | c ------ |
---|
50 | INTEGER length,l |
---|
51 | parameter (length = 100) |
---|
52 | REAL tab_cntrl(2*length) ! tableau des parametres du run |
---|
53 | INTEGER loop |
---|
54 | INTEGER ierr, setvdim, putvdim, putdat, setname,cluvdb |
---|
55 | INTEGER setdim |
---|
56 | INTEGER ind1,indlast |
---|
57 | |
---|
58 | c Arguments: |
---|
59 | c ---------- |
---|
60 | REAL phis(ip1jmp1) |
---|
61 | REAL tab_cntrl_dyn(length) |
---|
62 | REAL tab_cntrl_fi(length) |
---|
63 | |
---|
64 | !Mars --------Ajouts----------- |
---|
65 | c Variables locales pour NetCDF: |
---|
66 | c |
---|
67 | INTEGER dims2(2), dims3(3), dims4(4) |
---|
68 | INTEGER idim_index |
---|
69 | INTEGER idim_rlonu, idim_rlonv, idim_rlatu, idim_rlatv |
---|
70 | INTEGER idim_llmp1,idim_llm |
---|
71 | INTEGER idim_tim |
---|
72 | INTEGER nid,nvarid |
---|
73 | real sig_s(llm),s(llm) |
---|
74 | |
---|
75 | pi = 2. * ASIN(1.) |
---|
76 | |
---|
77 | |
---|
78 | c----------------------------------------------------------------------- |
---|
79 | c Remplissage du tableau des parametres de controle du RUN |
---|
80 | c----------------------------------------------------------------------- |
---|
81 | |
---|
82 | DO l=1,length |
---|
83 | tab_cntrl(l) = tab_cntrl_dyn(l) |
---|
84 | tab_cntrl(length+l)= tab_cntrl_fi(l) |
---|
85 | ENDDO |
---|
86 | |
---|
87 | c======================================================================= |
---|
88 | c Ecriture NetCDF de l''entete du fichier "start_archive" |
---|
89 | c======================================================================= |
---|
90 | |
---|
91 | c |
---|
92 | c Preciser quelques attributs globaux: |
---|
93 | c |
---|
94 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 27, |
---|
95 | . "Fichier start_archive") |
---|
96 | c |
---|
97 | c Definir les dimensions du fichiers: |
---|
98 | c |
---|
99 | c CHAMPS AJOUTES POUR LA VISUALISATION T,ps, etc... avec Grads ou ferret: |
---|
100 | ierr = NF_DEF_DIM (nid,"index", 2*length, idim_index) |
---|
101 | ierr = NF_DEF_DIM (nid,"rlonu", iip1, idim_rlonu) |
---|
102 | ierr = NF_DEF_DIM (nid,"rlatu", jjp1, idim_rlatu) |
---|
103 | ierr = NF_DEF_DIM (nid,"rlonv", iip1, idim_rlonv) |
---|
104 | ierr = NF_DEF_DIM (nid,"rlatv", jjm, idim_rlatv) |
---|
105 | ierr = NF_DEF_DIM (nid,"sigs", llm, idim_llm) |
---|
106 | ierr = NF_DEF_DIM (nid,"sig", llmp1, idim_llmp1) |
---|
107 | ierr = NF_DEF_DIM (nid,"Time", NF_UNLIMITED, idim_tim) |
---|
108 | |
---|
109 | c |
---|
110 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
111 | |
---|
112 | c----------------------------------------------------------------------- |
---|
113 | c Ecriture du tableau des parametres du run |
---|
114 | c----------------------------------------------------------------------- |
---|
115 | |
---|
116 | call def_var(nid,"Time","Time","days since 00:00:00",1, |
---|
117 | . idim_tim,nvarid,ierr) |
---|
118 | |
---|
119 | ierr = NF_REDEF (nid) |
---|
120 | #ifdef NC_DOUBLE |
---|
121 | ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,idim_index,nvarid) |
---|
122 | #else |
---|
123 | ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid) |
---|
124 | #endif |
---|
125 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
126 | . "Parametres de controle") |
---|
127 | ierr = NF_ENDDEF(nid) |
---|
128 | #ifdef NC_DOUBLE |
---|
129 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
130 | #else |
---|
131 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
132 | #endif |
---|
133 | |
---|
134 | c----------------------------------------------------------------------- |
---|
135 | c Ecriture des longitudes et latitudes |
---|
136 | c----------------------------------------------------------------------- |
---|
137 | |
---|
138 | ierr = NF_REDEF (nid) |
---|
139 | #ifdef NC_DOUBLE |
---|
140 | ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,idim_rlonu,nvarid) |
---|
141 | #else |
---|
142 | ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid) |
---|
143 | #endif |
---|
144 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
145 | . "Longitudes des points U") |
---|
146 | ierr = NF_ENDDEF(nid) |
---|
147 | #ifdef NC_DOUBLE |
---|
148 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) |
---|
149 | #else |
---|
150 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) |
---|
151 | #endif |
---|
152 | c |
---|
153 | ierr = NF_REDEF (nid) |
---|
154 | #ifdef NC_DOUBLE |
---|
155 | ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,idim_rlatu,nvarid) |
---|
156 | #else |
---|
157 | ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid) |
---|
158 | #endif |
---|
159 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
160 | . "Latitudes des points U") |
---|
161 | ierr = NF_ENDDEF(nid) |
---|
162 | #ifdef NC_DOUBLE |
---|
163 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) |
---|
164 | #else |
---|
165 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) |
---|
166 | #endif |
---|
167 | c |
---|
168 | ierr = NF_REDEF (nid) |
---|
169 | #ifdef NC_DOUBLE |
---|
170 | ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,idim_rlonv,nvarid) |
---|
171 | #else |
---|
172 | ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid) |
---|
173 | #endif |
---|
174 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
175 | . "Longitudes des points V") |
---|
176 | ierr = NF_ENDDEF(nid) |
---|
177 | #ifdef NC_DOUBLE |
---|
178 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) |
---|
179 | #else |
---|
180 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) |
---|
181 | #endif |
---|
182 | c |
---|
183 | ierr = NF_REDEF (nid) |
---|
184 | #ifdef NC_DOUBLE |
---|
185 | ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,idim_rlatv,nvarid) |
---|
186 | #else |
---|
187 | ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid) |
---|
188 | #endif |
---|
189 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
190 | . "Latitudes des points V") |
---|
191 | ierr = NF_ENDDEF(nid) |
---|
192 | #ifdef NC_DOUBLE |
---|
193 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) |
---|
194 | #else |
---|
195 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) |
---|
196 | #endif |
---|
197 | |
---|
198 | c----------------------------------------------------------------------- |
---|
199 | c Ecriture des niveaux verticaux |
---|
200 | c----------------------------------------------------------------------- |
---|
201 | |
---|
202 | ierr = NF_REDEF (nid) |
---|
203 | #ifdef NC_DOUBLE |
---|
204 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_llm,nvarid) |
---|
205 | #else |
---|
206 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_llm,nvarid) |
---|
207 | #endif |
---|
208 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, |
---|
209 | . "Numero naturel des couches s") |
---|
210 | ierr = NF_ENDDEF(nid) |
---|
211 | #ifdef NC_DOUBLE |
---|
212 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) |
---|
213 | #else |
---|
214 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) |
---|
215 | #endif |
---|
216 | c |
---|
217 | ierr = NF_REDEF (nid) |
---|
218 | #ifdef NC_DOUBLE |
---|
219 | ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_llmp1,nvarid) |
---|
220 | #else |
---|
221 | ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_llmp1,nvarid) |
---|
222 | #endif |
---|
223 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, |
---|
224 | . "Numero naturel des couches sigma") |
---|
225 | ierr = NF_ENDDEF(nid) |
---|
226 | #ifdef NC_DOUBLE |
---|
227 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) |
---|
228 | #else |
---|
229 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) |
---|
230 | #endif |
---|
231 | c |
---|
232 | ierr = NF_REDEF (nid) |
---|
233 | #ifdef NC_DOUBLE |
---|
234 | ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,idim_llmp1,nvarid) |
---|
235 | #else |
---|
236 | ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_llmp1,nvarid) |
---|
237 | #endif |
---|
238 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32, |
---|
239 | . "Coef A: niveaux pression hybride") |
---|
240 | ierr = NF_ENDDEF(nid) |
---|
241 | #ifdef NC_DOUBLE |
---|
242 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
243 | #else |
---|
244 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
245 | #endif |
---|
246 | c |
---|
247 | ierr = NF_REDEF (nid) |
---|
248 | #ifdef NC_DOUBLE |
---|
249 | ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,idim_llmp1,nvarid) |
---|
250 | #else |
---|
251 | ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_llmp1,nvarid) |
---|
252 | #endif |
---|
253 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 35, |
---|
254 | . "Coefficient B niveaux sigma hybride") |
---|
255 | ierr = NF_ENDDEF(nid) |
---|
256 | #ifdef NC_DOUBLE |
---|
257 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
258 | #else |
---|
259 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
260 | #endif |
---|
261 | c |
---|
262 | c ---------------------- |
---|
263 | ierr = NF_REDEF (nid) |
---|
264 | #ifdef NC_DOUBLE |
---|
265 | ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,idim_llm,nvarid) |
---|
266 | #else |
---|
267 | ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_llm,nvarid) |
---|
268 | #endif |
---|
269 | ierr = NF_ENDDEF(nid) |
---|
270 | #ifdef NC_DOUBLE |
---|
271 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) |
---|
272 | #else |
---|
273 | ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) |
---|
274 | #endif |
---|
275 | |
---|
276 | c----------------------------------------------------------------------- |
---|
277 | c Ecriture aire et coefficients de passage cov. <-> contra. <--> naturel |
---|
278 | c----------------------------------------------------------------------- |
---|
279 | |
---|
280 | ierr = NF_REDEF (nid) |
---|
281 | dims2(1) = idim_rlonu |
---|
282 | dims2(2) = idim_rlatu |
---|
283 | #ifdef NC_DOUBLE |
---|
284 | ierr = NF_DEF_VAR (nid,"cu",NF_DOUBLE,2,dims2,nvarid) |
---|
285 | #else |
---|
286 | ierr = NF_DEF_VAR (nid,"cu",NF_FLOAT,2,dims2,nvarid) |
---|
287 | #endif |
---|
288 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
289 | . "Coefficient de passage pour U") |
---|
290 | ierr = NF_ENDDEF(nid) |
---|
291 | #ifdef NC_DOUBLE |
---|
292 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
293 | #else |
---|
294 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
295 | #endif |
---|
296 | c |
---|
297 | ierr = NF_REDEF (nid) |
---|
298 | dims2(1) = idim_rlonv |
---|
299 | dims2(2) = idim_rlatv |
---|
300 | #ifdef NC_DOUBLE |
---|
301 | ierr = NF_DEF_VAR (nid,"cv",NF_DOUBLE,2,dims2,nvarid) |
---|
302 | #else |
---|
303 | ierr = NF_DEF_VAR (nid,"cv",NF_FLOAT,2,dims2,nvarid) |
---|
304 | #endif |
---|
305 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
306 | . "Coefficient de passage pour V") |
---|
307 | ierr = NF_ENDDEF(nid) |
---|
308 | #ifdef NC_DOUBLE |
---|
309 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
310 | #else |
---|
311 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
312 | #endif |
---|
313 | c |
---|
314 | c Aire de chaque maille: |
---|
315 | c |
---|
316 | ierr = NF_REDEF (nid) |
---|
317 | dims2(1) = idim_rlonv |
---|
318 | dims2(2) = idim_rlatu |
---|
319 | #ifdef NC_DOUBLE |
---|
320 | ierr = NF_DEF_VAR (nid,"aire",NF_DOUBLE,2,dims2,nvarid) |
---|
321 | #else |
---|
322 | ierr = NF_DEF_VAR (nid,"aire",NF_FLOAT,2,dims2,nvarid) |
---|
323 | #endif |
---|
324 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
325 | . "Aires de chaque maille") |
---|
326 | ierr = NF_ENDDEF(nid) |
---|
327 | #ifdef NC_DOUBLE |
---|
328 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
329 | #else |
---|
330 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
331 | #endif |
---|
332 | |
---|
333 | c----------------------------------------------------------------------- |
---|
334 | c Ecriture du geopentiel au sol |
---|
335 | c----------------------------------------------------------------------- |
---|
336 | |
---|
337 | ierr = NF_REDEF (nid) |
---|
338 | dims2(1) = idim_rlonv |
---|
339 | dims2(2) = idim_rlatu |
---|
340 | #ifdef NC_DOUBLE |
---|
341 | ierr = NF_DEF_VAR (nid,"phisinit",NF_DOUBLE,2,dims2,nvarid) |
---|
342 | #else |
---|
343 | ierr = NF_DEF_VAR (nid,"phisinit",NF_FLOAT,2,dims2,nvarid) |
---|
344 | #endif |
---|
345 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
346 | . "Geopotentiel au sol") |
---|
347 | ierr = NF_ENDDEF(nid) |
---|
348 | #ifdef NC_DOUBLE |
---|
349 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
350 | #else |
---|
351 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
352 | #endif |
---|
353 | |
---|
354 | RETURN |
---|
355 | END |
---|