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