1 | SUBROUTINE dynredem0(fichnom,idayref,anneeref,phis,nq) |
---|
2 | IMPLICIT NONE |
---|
3 | c======================================================================= |
---|
4 | c Ecriture du fichier de redemarrage sous format NetCDF (initialisation) |
---|
5 | c======================================================================= |
---|
6 | c Declarations: |
---|
7 | c ------------- |
---|
8 | #include "dimensions.h" |
---|
9 | #include "paramet.h" |
---|
10 | #include "comconst.h" |
---|
11 | #include "comvert.h" |
---|
12 | #include "comgeom.h" |
---|
13 | #include "temps.h" |
---|
14 | #include "ener.h" |
---|
15 | #include "logic.h" |
---|
16 | #include "netcdf.inc" |
---|
17 | #include "description.h" |
---|
18 | #include "serre.h" |
---|
19 | |
---|
20 | c Arguments: |
---|
21 | c ---------- |
---|
22 | INTEGER*4 idayref,anneeref |
---|
23 | REAL phis(ip1jmp1) |
---|
24 | CHARACTER*(*) fichnom |
---|
25 | INTEGER nq |
---|
26 | |
---|
27 | c Local: |
---|
28 | c ------ |
---|
29 | INTEGER iq,l |
---|
30 | CHARACTER str3*3 |
---|
31 | INTEGER length |
---|
32 | PARAMETER (length = 100) |
---|
33 | REAL tab_cntrl(length) ! tableau des parametres du run |
---|
34 | INTEGER ierr |
---|
35 | character*20 modname |
---|
36 | character*80 abort_message |
---|
37 | |
---|
38 | c Variables locales pour NetCDF: |
---|
39 | c |
---|
40 | INTEGER dims2(2), dims3(3), dims4(4) |
---|
41 | INTEGER idim_index |
---|
42 | INTEGER idim_rlonu, idim_rlonv, idim_rlatu, idim_rlatv |
---|
43 | INTEGER idim_s, idim_sig |
---|
44 | INTEGER idim_tim |
---|
45 | INTEGER nid,nvarid |
---|
46 | c----------------------------------------------------------------------- |
---|
47 | modname='dynredem' |
---|
48 | |
---|
49 | DO l=1,length |
---|
50 | tab_cntrl(l) = 0. |
---|
51 | ENDDO |
---|
52 | tab_cntrl(1) = FLOAT(iim) |
---|
53 | tab_cntrl(2) = FLOAT(jjm) |
---|
54 | tab_cntrl(3) = FLOAT(llm) |
---|
55 | tab_cntrl(4) = FLOAT(idayref) |
---|
56 | tab_cntrl(5) = FLOAT(anneeref) |
---|
57 | tab_cntrl(6) = rad |
---|
58 | tab_cntrl(7) = omeg |
---|
59 | tab_cntrl(8) = g |
---|
60 | tab_cntrl(9) = cpp |
---|
61 | tab_cntrl(10) = kappa |
---|
62 | tab_cntrl(11) = daysec |
---|
63 | tab_cntrl(12) = dtvr |
---|
64 | tab_cntrl(13) = etot0 |
---|
65 | tab_cntrl(14) = ptot0 |
---|
66 | tab_cntrl(15) = ztot0 |
---|
67 | tab_cntrl(16) = stot0 |
---|
68 | tab_cntrl(17) = ang0 |
---|
69 | tab_cntrl(18) = pa |
---|
70 | tab_cntrl(19) = preff |
---|
71 | c |
---|
72 | c ..... parametres pour le zoom ...... |
---|
73 | |
---|
74 | tab_cntrl(20) = clon |
---|
75 | tab_cntrl(21) = clat |
---|
76 | tab_cntrl(22) = grossismx |
---|
77 | tab_cntrl(23) = grossismy |
---|
78 | c |
---|
79 | IF ( fxyhypb ) THEN |
---|
80 | tab_cntrl(24) = 1. |
---|
81 | tab_cntrl(25) = dzoomx |
---|
82 | tab_cntrl(26) = dzoomy |
---|
83 | ELSE |
---|
84 | tab_cntrl(24) = 0. |
---|
85 | tab_cntrl(25) = dzoomx |
---|
86 | tab_cntrl(26) = dzoomy |
---|
87 | tab_cntrl(27) = 0. |
---|
88 | IF( ysinus ) tab_cntrl(27) = 1. |
---|
89 | ENDIF |
---|
90 | c |
---|
91 | c ......................................................... |
---|
92 | c |
---|
93 | c Creation du fichier: |
---|
94 | c |
---|
95 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
96 | IF (ierr.NE.NF_NOERR) THEN |
---|
97 | WRITE(6,*)" Pb d ouverture du fichier "//fichnom |
---|
98 | WRITE(6,*)' ierr = ', ierr |
---|
99 | CALL ABORT |
---|
100 | ENDIF |
---|
101 | c |
---|
102 | c Preciser quelques attributs globaux: |
---|
103 | c |
---|
104 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 27, |
---|
105 | . "Fichier demmarage dynamique") |
---|
106 | c |
---|
107 | c Definir les dimensions du fichiers: |
---|
108 | c |
---|
109 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
110 | ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) |
---|
111 | ierr = NF_DEF_DIM (nid, "rlatu", jjp1, idim_rlatu) |
---|
112 | ierr = NF_DEF_DIM (nid, "rlonv", iip1, idim_rlonv) |
---|
113 | ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
114 | ierr = NF_DEF_DIM (nid, "sigs", llm, idim_s) |
---|
115 | ierr = NF_DEF_DIM (nid, "sig", llmp1, idim_sig) |
---|
116 | ierr = NF_DEF_DIM (nid, "temps", NF_UNLIMITED, idim_tim) |
---|
117 | c |
---|
118 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
119 | c |
---|
120 | c Definir et enregistrer certains champs invariants: |
---|
121 | c |
---|
122 | ierr = NF_REDEF (nid) |
---|
123 | #ifdef NC_DOUBLE |
---|
124 | ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,idim_index,nvarid) |
---|
125 | #else |
---|
126 | ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid) |
---|
127 | #endif |
---|
128 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
129 | . "Parametres de controle") |
---|
130 | ierr = NF_ENDDEF(nid) |
---|
131 | #ifdef NC_DOUBLE |
---|
132 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
133 | #else |
---|
134 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
135 | #endif |
---|
136 | c |
---|
137 | ierr = NF_REDEF (nid) |
---|
138 | #ifdef NC_DOUBLE |
---|
139 | ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,idim_rlonu,nvarid) |
---|
140 | #else |
---|
141 | ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid) |
---|
142 | #endif |
---|
143 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
144 | . "Longitudes des points U") |
---|
145 | ierr = NF_ENDDEF(nid) |
---|
146 | #ifdef NC_DOUBLE |
---|
147 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) |
---|
148 | #else |
---|
149 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) |
---|
150 | #endif |
---|
151 | c |
---|
152 | ierr = NF_REDEF (nid) |
---|
153 | #ifdef NC_DOUBLE |
---|
154 | ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,idim_rlatu,nvarid) |
---|
155 | #else |
---|
156 | ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid) |
---|
157 | #endif |
---|
158 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
159 | . "Latitudes des points U") |
---|
160 | ierr = NF_ENDDEF(nid) |
---|
161 | #ifdef NC_DOUBLE |
---|
162 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) |
---|
163 | #else |
---|
164 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) |
---|
165 | #endif |
---|
166 | c |
---|
167 | ierr = NF_REDEF (nid) |
---|
168 | #ifdef NC_DOUBLE |
---|
169 | ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,idim_rlonv,nvarid) |
---|
170 | #else |
---|
171 | ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid) |
---|
172 | #endif |
---|
173 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
174 | . "Longitudes des points V") |
---|
175 | ierr = NF_ENDDEF(nid) |
---|
176 | #ifdef NC_DOUBLE |
---|
177 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) |
---|
178 | #else |
---|
179 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) |
---|
180 | #endif |
---|
181 | c |
---|
182 | ierr = NF_REDEF (nid) |
---|
183 | #ifdef NC_DOUBLE |
---|
184 | ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,idim_rlatv,nvarid) |
---|
185 | #else |
---|
186 | ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid) |
---|
187 | #endif |
---|
188 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
189 | . "Latitudes des points V") |
---|
190 | ierr = NF_ENDDEF(nid) |
---|
191 | #ifdef NC_DOUBLE |
---|
192 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) |
---|
193 | #else |
---|
194 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) |
---|
195 | #endif |
---|
196 | c |
---|
197 | ierr = NF_REDEF (nid) |
---|
198 | #ifdef NC_DOUBLE |
---|
199 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_s,nvarid) |
---|
200 | #else |
---|
201 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid) |
---|
202 | #endif |
---|
203 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, |
---|
204 | . "Numero naturel des couches s") |
---|
205 | ierr = NF_ENDDEF(nid) |
---|
206 | #ifdef NC_DOUBLE |
---|
207 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) |
---|
208 | #else |
---|
209 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) |
---|
210 | #endif |
---|
211 | c |
---|
212 | ierr = NF_REDEF (nid) |
---|
213 | #ifdef NC_DOUBLE |
---|
214 | ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_sig,nvarid) |
---|
215 | #else |
---|
216 | ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid) |
---|
217 | #endif |
---|
218 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32, |
---|
219 | . "Numero naturel des couches sigma") |
---|
220 | ierr = NF_ENDDEF(nid) |
---|
221 | #ifdef NC_DOUBLE |
---|
222 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) |
---|
223 | #else |
---|
224 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) |
---|
225 | #endif |
---|
226 | c |
---|
227 | ierr = NF_REDEF (nid) |
---|
228 | #ifdef NC_DOUBLE |
---|
229 | ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,idim_sig,nvarid) |
---|
230 | #else |
---|
231 | ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_sig,nvarid) |
---|
232 | #endif |
---|
233 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
234 | . "Coefficient A pour hybride") |
---|
235 | ierr = NF_ENDDEF(nid) |
---|
236 | #ifdef NC_DOUBLE |
---|
237 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
238 | #else |
---|
239 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
240 | #endif |
---|
241 | c |
---|
242 | ierr = NF_REDEF (nid) |
---|
243 | #ifdef NC_DOUBLE |
---|
244 | ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,idim_sig,nvarid) |
---|
245 | #else |
---|
246 | ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_sig,nvarid) |
---|
247 | #endif |
---|
248 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
249 | . "Coefficient B pour hybride") |
---|
250 | ierr = NF_ENDDEF(nid) |
---|
251 | #ifdef NC_DOUBLE |
---|
252 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
253 | #else |
---|
254 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
255 | #endif |
---|
256 | c |
---|
257 | ierr = NF_REDEF (nid) |
---|
258 | #ifdef NC_DOUBLE |
---|
259 | ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,idim_s,nvarid) |
---|
260 | #else |
---|
261 | ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_s,nvarid) |
---|
262 | #endif |
---|
263 | ierr = NF_ENDDEF(nid) |
---|
264 | #ifdef NC_DOUBLE |
---|
265 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) |
---|
266 | #else |
---|
267 | ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) |
---|
268 | #endif |
---|
269 | c |
---|
270 | c Coefficients de passage cov. <-> contra. <--> naturel |
---|
271 | c |
---|
272 | ierr = NF_REDEF (nid) |
---|
273 | dims2(1) = idim_rlonu |
---|
274 | dims2(2) = idim_rlatu |
---|
275 | #ifdef NC_DOUBLE |
---|
276 | ierr = NF_DEF_VAR (nid,"cu",NF_DOUBLE,2,dims2,nvarid) |
---|
277 | #else |
---|
278 | ierr = NF_DEF_VAR (nid,"cu",NF_FLOAT,2,dims2,nvarid) |
---|
279 | #endif |
---|
280 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
281 | . "Coefficient de passage pour U") |
---|
282 | ierr = NF_ENDDEF(nid) |
---|
283 | #ifdef NC_DOUBLE |
---|
284 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
285 | #else |
---|
286 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
287 | #endif |
---|
288 | c |
---|
289 | ierr = NF_REDEF (nid) |
---|
290 | dims2(1) = idim_rlonv |
---|
291 | dims2(2) = idim_rlatv |
---|
292 | #ifdef NC_DOUBLE |
---|
293 | ierr = NF_DEF_VAR (nid,"cv",NF_DOUBLE,2,dims2,nvarid) |
---|
294 | #else |
---|
295 | ierr = NF_DEF_VAR (nid,"cv",NF_FLOAT,2,dims2,nvarid) |
---|
296 | #endif |
---|
297 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
298 | . "Coefficient de passage pour V") |
---|
299 | ierr = NF_ENDDEF(nid) |
---|
300 | #ifdef NC_DOUBLE |
---|
301 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
302 | #else |
---|
303 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
304 | #endif |
---|
305 | c |
---|
306 | c Aire de chaque maille: |
---|
307 | c |
---|
308 | ierr = NF_REDEF (nid) |
---|
309 | dims2(1) = idim_rlonv |
---|
310 | dims2(2) = idim_rlatu |
---|
311 | #ifdef NC_DOUBLE |
---|
312 | ierr = NF_DEF_VAR (nid,"aire",NF_DOUBLE,2,dims2,nvarid) |
---|
313 | #else |
---|
314 | ierr = NF_DEF_VAR (nid,"aire",NF_FLOAT,2,dims2,nvarid) |
---|
315 | #endif |
---|
316 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
317 | . "Aires de chaque maille") |
---|
318 | ierr = NF_ENDDEF(nid) |
---|
319 | #ifdef NC_DOUBLE |
---|
320 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
321 | #else |
---|
322 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
323 | #endif |
---|
324 | c |
---|
325 | c Geopentiel au sol: |
---|
326 | c |
---|
327 | ierr = NF_REDEF (nid) |
---|
328 | dims2(1) = idim_rlonv |
---|
329 | dims2(2) = idim_rlatu |
---|
330 | #ifdef NC_DOUBLE |
---|
331 | ierr = NF_DEF_VAR (nid,"phisinit",NF_DOUBLE,2,dims2,nvarid) |
---|
332 | #else |
---|
333 | ierr = NF_DEF_VAR (nid,"phisinit",NF_FLOAT,2,dims2,nvarid) |
---|
334 | #endif |
---|
335 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
336 | . "Geopotentiel au sol") |
---|
337 | ierr = NF_ENDDEF(nid) |
---|
338 | #ifdef NC_DOUBLE |
---|
339 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
340 | #else |
---|
341 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
342 | #endif |
---|
343 | c |
---|
344 | c Definir les variables pour pouvoir les enregistrer plus tard: |
---|
345 | c |
---|
346 | ierr = NF_REDEF (nid) ! entrer dans le mode de definition |
---|
347 | c |
---|
348 | #ifdef NC_DOUBLE |
---|
349 | ierr = NF_DEF_VAR (nid,"temps",NF_DOUBLE,1,idim_tim,nvarid) |
---|
350 | #else |
---|
351 | ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid) |
---|
352 | #endif |
---|
353 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
354 | . "Temps de simulation") |
---|
355 | c |
---|
356 | dims4(1) = idim_rlonu |
---|
357 | dims4(2) = idim_rlatu |
---|
358 | dims4(3) = idim_s |
---|
359 | dims4(4) = idim_tim |
---|
360 | #ifdef NC_DOUBLE |
---|
361 | ierr = NF_DEF_VAR (nid,"ucov",NF_DOUBLE,4,dims4,nvarid) |
---|
362 | #else |
---|
363 | ierr = NF_DEF_VAR (nid,"ucov",NF_FLOAT,4,dims4,nvarid) |
---|
364 | #endif |
---|
365 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
366 | . "Vitesse U") |
---|
367 | c |
---|
368 | dims4(1) = idim_rlonv |
---|
369 | dims4(2) = idim_rlatv |
---|
370 | dims4(3) = idim_s |
---|
371 | dims4(4) = idim_tim |
---|
372 | #ifdef NC_DOUBLE |
---|
373 | ierr = NF_DEF_VAR (nid,"vcov",NF_DOUBLE,4,dims4,nvarid) |
---|
374 | #else |
---|
375 | ierr = NF_DEF_VAR (nid,"vcov",NF_FLOAT,4,dims4,nvarid) |
---|
376 | #endif |
---|
377 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
378 | . "Vitesse V") |
---|
379 | c |
---|
380 | dims4(1) = idim_rlonv |
---|
381 | dims4(2) = idim_rlatu |
---|
382 | dims4(3) = idim_s |
---|
383 | dims4(4) = idim_tim |
---|
384 | #ifdef NC_DOUBLE |
---|
385 | ierr = NF_DEF_VAR (nid,"teta",NF_DOUBLE,4,dims4,nvarid) |
---|
386 | #else |
---|
387 | ierr = NF_DEF_VAR (nid,"teta",NF_FLOAT,4,dims4,nvarid) |
---|
388 | #endif |
---|
389 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 11, |
---|
390 | . "Temperature") |
---|
391 | c |
---|
392 | dims4(1) = idim_rlonv |
---|
393 | dims4(2) = idim_rlatu |
---|
394 | dims4(3) = idim_s |
---|
395 | dims4(4) = idim_tim |
---|
396 | IF(nq.GE.1) THEN |
---|
397 | DO iq=1,nq |
---|
398 | IF (iq.GT.99) THEN |
---|
399 | PRINT*, "Trop de traceurs" |
---|
400 | CALL abort |
---|
401 | ELSE |
---|
402 | str3(1:1)='q' |
---|
403 | WRITE(str3(2:3),'(i2.2)') iq |
---|
404 | #ifdef NC_DOUBLE |
---|
405 | ierr = NF_DEF_VAR (nid,str3,NF_DOUBLE,4,dims4,nvarid) |
---|
406 | #else |
---|
407 | ierr = NF_DEF_VAR (nid,str3,NF_FLOAT,4,dims4,nvarid) |
---|
408 | #endif |
---|
409 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
410 | . "Traceurs "//str3) |
---|
411 | ENDIF |
---|
412 | ENDDO |
---|
413 | ENDIF |
---|
414 | c |
---|
415 | dims4(1) = idim_rlonv |
---|
416 | dims4(2) = idim_rlatu |
---|
417 | dims4(3) = idim_s |
---|
418 | dims4(4) = idim_tim |
---|
419 | #ifdef NC_DOUBLE |
---|
420 | ierr = NF_DEF_VAR (nid,"masse",NF_DOUBLE,4,dims4,nvarid) |
---|
421 | #else |
---|
422 | ierr = NF_DEF_VAR (nid,"masse",NF_FLOAT,4,dims4,nvarid) |
---|
423 | #endif |
---|
424 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
425 | . "C est quoi ?") |
---|
426 | c |
---|
427 | dims3(1) = idim_rlonv |
---|
428 | dims3(2) = idim_rlatu |
---|
429 | dims3(3) = idim_tim |
---|
430 | #ifdef NC_DOUBLE |
---|
431 | ierr = NF_DEF_VAR (nid,"ps",NF_DOUBLE,3,dims3,nvarid) |
---|
432 | #else |
---|
433 | ierr = NF_DEF_VAR (nid,"ps",NF_FLOAT,3,dims3,nvarid) |
---|
434 | #endif |
---|
435 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 15, |
---|
436 | . "Pression au sol") |
---|
437 | c |
---|
438 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
439 | ierr = NF_CLOSE(nid) ! fermer le fichier |
---|
440 | |
---|
441 | PRINT*,'iim,jjm,llm,idayref',iim,jjm,llm,idayref |
---|
442 | PRINT*,'rad,omeg,g,cpp,kappa', |
---|
443 | , rad,omeg,g,cpp,kappa |
---|
444 | |
---|
445 | RETURN |
---|
446 | END |
---|
447 | SUBROUTINE dynredem1(fichnom,time, |
---|
448 | . vcov,ucov,teta,q,nq,masse,ps) |
---|
449 | IMPLICIT NONE |
---|
450 | c================================================================= |
---|
451 | c Ecriture du fichier de redemarrage sous format NetCDF |
---|
452 | c================================================================= |
---|
453 | #include "dimensions.h" |
---|
454 | #include "paramet.h" |
---|
455 | #include "description.h" |
---|
456 | #include "netcdf.inc" |
---|
457 | #include "comvert.h" |
---|
458 | #include "comgeom.h" |
---|
459 | |
---|
460 | INTEGER nq, l |
---|
461 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) |
---|
462 | REAL teta(ip1jmp1,llm) |
---|
463 | REAL ps(ip1jmp1),masse(ip1jmp1,llm) |
---|
464 | REAL q(ip1jmp1,llm,nq) |
---|
465 | CHARACTER*(*) fichnom |
---|
466 | |
---|
467 | REAL time |
---|
468 | INTEGER nid, nvarid |
---|
469 | INTEGER ierr |
---|
470 | INTEGER iq |
---|
471 | CHARACTER str3*3 |
---|
472 | character*20 modname |
---|
473 | character*80 abort_message |
---|
474 | c |
---|
475 | INTEGER nb |
---|
476 | SAVE nb |
---|
477 | DATA nb / 0 / |
---|
478 | |
---|
479 | modname = 'dynredem1' |
---|
480 | ierr = NF_OPEN(fichnom, NF_WRITE, nid) |
---|
481 | IF (ierr .NE. NF_NOERR) THEN |
---|
482 | PRINT*, "Pb. d ouverture "//fichnom |
---|
483 | CALL abort |
---|
484 | ENDIF |
---|
485 | |
---|
486 | c Ecriture/extension de la coordonnee temps |
---|
487 | |
---|
488 | nb = nb + 1 |
---|
489 | ierr = NF_INQ_VARID(nid, "temps", nvarid) |
---|
490 | IF (ierr .NE. NF_NOERR) THEN |
---|
491 | print *, NF_STRERROR(ierr) |
---|
492 | abort_message='Variable temps n est pas definie' |
---|
493 | CALL abort_gcm(modname,abort_message,ierr) |
---|
494 | ENDIF |
---|
495 | #ifdef NC_DOUBLE |
---|
496 | ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time) |
---|
497 | #else |
---|
498 | ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time) |
---|
499 | #endif |
---|
500 | PRINT*, "Enregistrement pour ", nb, time |
---|
501 | |
---|
502 | c Ecriture des champs |
---|
503 | c |
---|
504 | ierr = NF_INQ_VARID(nid, "ucov", nvarid) |
---|
505 | IF (ierr .NE. NF_NOERR) THEN |
---|
506 | PRINT*, "Variable ucov n est pas definie" |
---|
507 | CALL abort |
---|
508 | ENDIF |
---|
509 | #ifdef NC_DOUBLE |
---|
510 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) |
---|
511 | #else |
---|
512 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) |
---|
513 | #endif |
---|
514 | |
---|
515 | ierr = NF_INQ_VARID(nid, "vcov", nvarid) |
---|
516 | IF (ierr .NE. NF_NOERR) THEN |
---|
517 | PRINT*, "Variable vcov n est pas definie" |
---|
518 | CALL abort |
---|
519 | ENDIF |
---|
520 | #ifdef NC_DOUBLE |
---|
521 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) |
---|
522 | #else |
---|
523 | ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) |
---|
524 | #endif |
---|
525 | |
---|
526 | ierr = NF_INQ_VARID(nid, "teta", nvarid) |
---|
527 | IF (ierr .NE. NF_NOERR) THEN |
---|
528 | PRINT*, "Variable teta n est pas definie" |
---|
529 | CALL abort |
---|
530 | ENDIF |
---|
531 | #ifdef NC_DOUBLE |
---|
532 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) |
---|
533 | #else |
---|
534 | ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) |
---|
535 | #endif |
---|
536 | |
---|
537 | IF(nq.GE.1) THEN |
---|
538 | DO iq=1,nq |
---|
539 | IF (iq.GT.99) THEN |
---|
540 | PRINT*, "Trop de traceurs" |
---|
541 | CALL abort |
---|
542 | ELSE |
---|
543 | str3(1:1)='q' |
---|
544 | WRITE(str3(2:3),'(i2.2)') iq |
---|
545 | ierr = NF_INQ_VARID(nid, str3, nvarid) |
---|
546 | IF (ierr .NE. NF_NOERR) THEN |
---|
547 | PRINT*, "Variable "//str3//" n est pas definie" |
---|
548 | CALL abort |
---|
549 | ENDIF |
---|
550 | #ifdef NC_DOUBLE |
---|
551 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) |
---|
552 | #else |
---|
553 | ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) |
---|
554 | #endif |
---|
555 | ENDIF |
---|
556 | ENDDO |
---|
557 | ENDIF |
---|
558 | c |
---|
559 | ierr = NF_INQ_VARID(nid, "masse", nvarid) |
---|
560 | IF (ierr .NE. NF_NOERR) THEN |
---|
561 | PRINT*, "Variable masse n est pas definie" |
---|
562 | CALL abort |
---|
563 | ENDIF |
---|
564 | #ifdef NC_DOUBLE |
---|
565 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) |
---|
566 | #else |
---|
567 | ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) |
---|
568 | #endif |
---|
569 | c |
---|
570 | ierr = NF_INQ_VARID(nid, "ps", nvarid) |
---|
571 | IF (ierr .NE. NF_NOERR) THEN |
---|
572 | PRINT*, "Variable ps n est pas definie" |
---|
573 | CALL abort |
---|
574 | ENDIF |
---|
575 | #ifdef NC_DOUBLE |
---|
576 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) |
---|
577 | #else |
---|
578 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) |
---|
579 | #endif |
---|
580 | |
---|
581 | ierr = NF_CLOSE(nid) |
---|
582 | c |
---|
583 | RETURN |
---|
584 | END |
---|
585 | |
---|