1 | SUBROUTINE writerestartphy(fichnom,tab_cntrl,klon,klev, |
---|
2 | . rlat,rlon, tsol,tsoil, |
---|
3 | . albedo, |
---|
4 | . solsw, sollw,fder,dlw, |
---|
5 | . sollwdown,radsol, |
---|
6 | . zmea, zstd, zsig, zgam, zthe, zpic, zval, |
---|
7 | . t_ancien) |
---|
8 | |
---|
9 | |
---|
10 | c====================================================================== |
---|
11 | c Ecriture de l'etat de redemarrage pour la physique (pour newstart) |
---|
12 | c====================================================================== |
---|
13 | IMPLICIT none |
---|
14 | #include "dimensions.h" |
---|
15 | #include "netcdf.inc" |
---|
16 | #include "dimsoil.h" |
---|
17 | c====================================================================== |
---|
18 | CHARACTER*13 fichnom |
---|
19 | INTEGER length,klon,klev |
---|
20 | PARAMETER (length=100) |
---|
21 | REAL tab_cntrl(length) |
---|
22 | REAL rlat(klon), rlon(klon) |
---|
23 | REAL tsol(klon) |
---|
24 | REAL tsoil(klon,nsoilmx) |
---|
25 | REAL albedo(klon) |
---|
26 | real solsw(klon) |
---|
27 | real sollw(klon) |
---|
28 | real fder(klon) |
---|
29 | real dlw(klon) |
---|
30 | real sollwdown(klon) |
---|
31 | REAL radsol(klon) |
---|
32 | REAL zmea(klon), zstd(klon) |
---|
33 | REAL zsig(klon), zgam(klon), zthe(klon) |
---|
34 | REAL zpic(klon), zval(klon) |
---|
35 | REAL t_ancien(klon,klev) |
---|
36 | c |
---|
37 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
38 | INTEGER ierr |
---|
39 | c |
---|
40 | INTEGER isoil |
---|
41 | CHARACTER*2 str2 |
---|
42 | c |
---|
43 | c----------------------------------------------------------------------- |
---|
44 | c Creation du fichier: |
---|
45 | c----------------------------------------------------------------------- |
---|
46 | c |
---|
47 | c print*,'fichnom',fichnom |
---|
48 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
49 | IF (ierr.NE.NF_NOERR) THEN |
---|
50 | write(6,*)' Pb d''ouverture du fichier '//fichnom |
---|
51 | write(6,*)' ierr = ', ierr |
---|
52 | CALL ABORT |
---|
53 | ENDIF |
---|
54 | c |
---|
55 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 28, |
---|
56 | . "Fichier redemarrage physique") |
---|
57 | c |
---|
58 | ierr = NF_DEF_DIM (nid, "index", length, idim1) |
---|
59 | ierr = NF_DEF_DIM (nid, "points_physiques", klon, idim2) |
---|
60 | ierr = NF_DEF_DIM (nid, "horizon_vertical", klon*klev, idim3) |
---|
61 | c |
---|
62 | |
---|
63 | #ifdef NC_DOUBLE |
---|
64 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid) |
---|
65 | #else |
---|
66 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid) |
---|
67 | #endif |
---|
68 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
69 | . "Parametres de controle") |
---|
70 | ierr = NF_ENDDEF(nid) |
---|
71 | #ifdef NC_DOUBLE |
---|
72 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
73 | #else |
---|
74 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
75 | #endif |
---|
76 | c |
---|
77 | ierr = NF_REDEF (nid) |
---|
78 | #ifdef NC_DOUBLE |
---|
79 | ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
80 | #else |
---|
81 | ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid) |
---|
82 | #endif |
---|
83 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
84 | . "Longitudes de la grille physique") |
---|
85 | ierr = NF_ENDDEF(nid) |
---|
86 | #ifdef NC_DOUBLE |
---|
87 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlon) |
---|
88 | #else |
---|
89 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlon) |
---|
90 | #endif |
---|
91 | c |
---|
92 | ierr = NF_REDEF (nid) |
---|
93 | #ifdef NC_DOUBLE |
---|
94 | ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
95 | #else |
---|
96 | ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid) |
---|
97 | #endif |
---|
98 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31, |
---|
99 | . "Latitudes de la grille physique") |
---|
100 | ierr = NF_ENDDEF(nid) |
---|
101 | #ifdef NC_DOUBLE |
---|
102 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlat) |
---|
103 | #else |
---|
104 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlat) |
---|
105 | #endif |
---|
106 | c |
---|
107 | c----------------------------------------------------------------------- |
---|
108 | c Ecriture des variables: |
---|
109 | c----------------------------------------------------------------------- |
---|
110 | c |
---|
111 | ierr = NF_REDEF (nid) |
---|
112 | #ifdef NC_DOUBLE |
---|
113 | ierr = NF_DEF_VAR (nid, "TS", NF_DOUBLE, 1, idim2,nvarid) |
---|
114 | #else |
---|
115 | ierr = NF_DEF_VAR (nid, "TS", NF_FLOAT, 1, idim2,nvarid) |
---|
116 | #endif |
---|
117 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
118 | . "Temperature de surface") |
---|
119 | ierr = NF_ENDDEF(nid) |
---|
120 | #ifdef NC_DOUBLE |
---|
121 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsol) |
---|
122 | #else |
---|
123 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsol) |
---|
124 | #endif |
---|
125 | c |
---|
126 | DO isoil=1, nsoilmx |
---|
127 | IF (isoil.LE.99) THEN |
---|
128 | WRITE(str2,'(i2.2)') isoil |
---|
129 | ierr = NF_REDEF (nid) |
---|
130 | #ifdef NC_DOUBLE |
---|
131 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_DOUBLE,1,idim2,nvarid) |
---|
132 | #else |
---|
133 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_FLOAT,1,idim2,nvarid) |
---|
134 | #endif |
---|
135 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24, |
---|
136 | . "Temperature du sol No."//str2) |
---|
137 | ierr = NF_ENDDEF(nid) |
---|
138 | ELSE |
---|
139 | PRINT*, "Trop de couches" |
---|
140 | CALL abort |
---|
141 | ENDIF |
---|
142 | #ifdef NC_DOUBLE |
---|
143 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsoil(1,isoil)) |
---|
144 | #else |
---|
145 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsoil(1,isoil)) |
---|
146 | #endif |
---|
147 | ENDDO |
---|
148 | c |
---|
149 | ierr = NF_REDEF (nid) |
---|
150 | #ifdef NC_DOUBLE |
---|
151 | ierr = NF_DEF_VAR (nid,"ALBE",NF_DOUBLE,1,idim2,nvarid) |
---|
152 | #else |
---|
153 | ierr = NF_DEF_VAR (nid,"ALBE",NF_FLOAT,1,idim2,nvarid) |
---|
154 | #endif |
---|
155 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
156 | . "albedo de surface") |
---|
157 | ierr = NF_ENDDEF(nid) |
---|
158 | #ifdef NC_DOUBLE |
---|
159 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,albedo) |
---|
160 | #else |
---|
161 | ierr = NF_PUT_VAR_REAL (nid,nvarid,albedo) |
---|
162 | #endif |
---|
163 | c |
---|
164 | ierr = NF_REDEF (nid) |
---|
165 | #ifdef NC_DOUBLE |
---|
166 | ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid) |
---|
167 | #else |
---|
168 | ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid) |
---|
169 | #endif |
---|
170 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
171 | . "Rayonnement solaire a la surface") |
---|
172 | ierr = NF_ENDDEF(nid) |
---|
173 | #ifdef NC_DOUBLE |
---|
174 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,solsw) |
---|
175 | #else |
---|
176 | ierr = NF_PUT_VAR_REAL (nid,nvarid,solsw) |
---|
177 | #endif |
---|
178 | c |
---|
179 | ierr = NF_REDEF (nid) |
---|
180 | #ifdef NC_DOUBLE |
---|
181 | ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid) |
---|
182 | #else |
---|
183 | ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid) |
---|
184 | #endif |
---|
185 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27, |
---|
186 | . "Rayonnement IR a la surface") |
---|
187 | ierr = NF_ENDDEF(nid) |
---|
188 | #ifdef NC_DOUBLE |
---|
189 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,sollw) |
---|
190 | #else |
---|
191 | ierr = NF_PUT_VAR_REAL (nid,nvarid,sollw) |
---|
192 | #endif |
---|
193 | c |
---|
194 | ierr = NF_REDEF (nid) |
---|
195 | #ifdef NC_DOUBLE |
---|
196 | ierr = NF_DEF_VAR (nid, "fder", NF_DOUBLE, 1, idim2,nvarid) |
---|
197 | #else |
---|
198 | ierr = NF_DEF_VAR (nid, "fder", NF_FLOAT, 1, idim2,nvarid) |
---|
199 | #endif |
---|
200 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14, |
---|
201 | . "Derive de flux") |
---|
202 | ierr = NF_ENDDEF(nid) |
---|
203 | #ifdef NC_DOUBLE |
---|
204 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,fder) |
---|
205 | #else |
---|
206 | ierr = NF_PUT_VAR_REAL (nid,nvarid,fder) |
---|
207 | #endif |
---|
208 | c |
---|
209 | ierr = NF_REDEF (nid) |
---|
210 | #ifdef NC_DOUBLE |
---|
211 | ierr = NF_DEF_VAR (nid, "dlw", NF_DOUBLE, 1, idim2,nvarid) |
---|
212 | #else |
---|
213 | ierr = NF_DEF_VAR (nid, "dlw", NF_FLOAT, 1, idim2,nvarid) |
---|
214 | #endif |
---|
215 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14, |
---|
216 | . "Derivee flux IR") |
---|
217 | ierr = NF_ENDDEF(nid) |
---|
218 | #ifdef NC_DOUBLE |
---|
219 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,dlw) |
---|
220 | #else |
---|
221 | ierr = NF_PUT_VAR_REAL (nid,nvarid,dlw) |
---|
222 | #endif |
---|
223 | c |
---|
224 | ierr = NF_REDEF (nid) |
---|
225 | #ifdef NC_DOUBLE |
---|
226 | ierr = NF_DEF_VAR (nid, "sollwdown", NF_DOUBLE, 1, idim2,nvarid) |
---|
227 | #else |
---|
228 | ierr = NF_DEF_VAR (nid, "sollwdown", NF_FLOAT, 1, idim2,nvarid) |
---|
229 | #endif |
---|
230 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14, |
---|
231 | . "Flux IR vers le bas a la surface") |
---|
232 | ierr = NF_ENDDEF(nid) |
---|
233 | #ifdef NC_DOUBLE |
---|
234 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,sollwdown) |
---|
235 | #else |
---|
236 | ierr = NF_PUT_VAR_REAL (nid,nvarid,sollwdown) |
---|
237 | #endif |
---|
238 | c |
---|
239 | ierr = NF_REDEF (nid) |
---|
240 | #ifdef NC_DOUBLE |
---|
241 | ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid) |
---|
242 | #else |
---|
243 | ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid) |
---|
244 | #endif |
---|
245 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
246 | . "Rayonnement net a la surface") |
---|
247 | ierr = NF_ENDDEF(nid) |
---|
248 | #ifdef NC_DOUBLE |
---|
249 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,radsol) |
---|
250 | #else |
---|
251 | ierr = NF_PUT_VAR_REAL (nid,nvarid,radsol) |
---|
252 | #endif |
---|
253 | c |
---|
254 | ierr = NF_REDEF (nid) |
---|
255 | #ifdef NC_DOUBLE |
---|
256 | ierr = NF_DEF_VAR (nid, "ZMEA", NF_DOUBLE, 1, idim2,nvarid) |
---|
257 | #else |
---|
258 | ierr = NF_DEF_VAR (nid, "ZMEA", NF_FLOAT, 1, idim2,nvarid) |
---|
259 | #endif |
---|
260 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
261 | . "zmea Orographie sous-maille") |
---|
262 | ierr = NF_ENDDEF(nid) |
---|
263 | #ifdef NC_DOUBLE |
---|
264 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zmea) |
---|
265 | #else |
---|
266 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zmea) |
---|
267 | #endif |
---|
268 | c |
---|
269 | ierr = NF_REDEF (nid) |
---|
270 | #ifdef NC_DOUBLE |
---|
271 | ierr = NF_DEF_VAR (nid, "ZSTD", NF_DOUBLE, 1, idim2,nvarid) |
---|
272 | #else |
---|
273 | ierr = NF_DEF_VAR (nid, "ZSTD", NF_FLOAT, 1, idim2,nvarid) |
---|
274 | #endif |
---|
275 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
276 | . "zstd Orographie sous-maille") |
---|
277 | ierr = NF_ENDDEF(nid) |
---|
278 | #ifdef NC_DOUBLE |
---|
279 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zstd) |
---|
280 | #else |
---|
281 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zstd) |
---|
282 | #endif |
---|
283 | c |
---|
284 | ierr = NF_REDEF (nid) |
---|
285 | #ifdef NC_DOUBLE |
---|
286 | ierr = NF_DEF_VAR (nid, "ZSIG", NF_DOUBLE, 1, idim2,nvarid) |
---|
287 | #else |
---|
288 | ierr = NF_DEF_VAR (nid, "ZSIG", NF_FLOAT, 1, idim2,nvarid) |
---|
289 | #endif |
---|
290 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
291 | . "zsig Orographie sous-maille") |
---|
292 | ierr = NF_ENDDEF(nid) |
---|
293 | #ifdef NC_DOUBLE |
---|
294 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zsig) |
---|
295 | #else |
---|
296 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zsig) |
---|
297 | #endif |
---|
298 | c |
---|
299 | ierr = NF_REDEF (nid) |
---|
300 | #ifdef NC_DOUBLE |
---|
301 | ierr = NF_DEF_VAR (nid, "ZGAM", NF_DOUBLE, 1, idim2,nvarid) |
---|
302 | #else |
---|
303 | ierr = NF_DEF_VAR (nid, "ZGAM", NF_FLOAT, 1, idim2,nvarid) |
---|
304 | #endif |
---|
305 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
306 | . "zgam Orographie sous-maille") |
---|
307 | ierr = NF_ENDDEF(nid) |
---|
308 | #ifdef NC_DOUBLE |
---|
309 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zgam) |
---|
310 | #else |
---|
311 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zgam) |
---|
312 | #endif |
---|
313 | c |
---|
314 | ierr = NF_REDEF (nid) |
---|
315 | #ifdef NC_DOUBLE |
---|
316 | ierr = NF_DEF_VAR (nid, "ZTHE", NF_DOUBLE, 1, idim2,nvarid) |
---|
317 | #else |
---|
318 | ierr = NF_DEF_VAR (nid, "ZTHE", NF_FLOAT, 1, idim2,nvarid) |
---|
319 | #endif |
---|
320 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
321 | . "zthe Orographie sous-maille") |
---|
322 | ierr = NF_ENDDEF(nid) |
---|
323 | #ifdef NC_DOUBLE |
---|
324 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zthe) |
---|
325 | #else |
---|
326 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zthe) |
---|
327 | #endif |
---|
328 | c |
---|
329 | ierr = NF_REDEF (nid) |
---|
330 | #ifdef NC_DOUBLE |
---|
331 | ierr = NF_DEF_VAR (nid, "ZPIC", NF_DOUBLE, 1, idim2,nvarid) |
---|
332 | #else |
---|
333 | ierr = NF_DEF_VAR (nid, "ZPIC", NF_FLOAT, 1, idim2,nvarid) |
---|
334 | #endif |
---|
335 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
336 | . "zpic Orographie sous-maille") |
---|
337 | ierr = NF_ENDDEF(nid) |
---|
338 | #ifdef NC_DOUBLE |
---|
339 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zpic) |
---|
340 | #else |
---|
341 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zpic) |
---|
342 | #endif |
---|
343 | c |
---|
344 | ierr = NF_REDEF (nid) |
---|
345 | #ifdef NC_DOUBLE |
---|
346 | ierr = NF_DEF_VAR (nid, "ZVAL", NF_DOUBLE, 1, idim2,nvarid) |
---|
347 | #else |
---|
348 | ierr = NF_DEF_VAR (nid, "ZVAL", NF_FLOAT, 1, idim2,nvarid) |
---|
349 | #endif |
---|
350 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
351 | . "zval Orographie sous-maille") |
---|
352 | ierr = NF_ENDDEF(nid) |
---|
353 | #ifdef NC_DOUBLE |
---|
354 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zval) |
---|
355 | #else |
---|
356 | ierr = NF_PUT_VAR_REAL (nid,nvarid,zval) |
---|
357 | #endif |
---|
358 | c |
---|
359 | ierr = NF_REDEF (nid) |
---|
360 | #ifdef NC_DOUBLE |
---|
361 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid) |
---|
362 | #else |
---|
363 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid) |
---|
364 | #endif |
---|
365 | ierr = NF_ENDDEF(nid) |
---|
366 | #ifdef NC_DOUBLE |
---|
367 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,t_ancien) |
---|
368 | #else |
---|
369 | ierr = NF_PUT_VAR_REAL (nid,nvarid,t_ancien) |
---|
370 | #endif |
---|
371 | c |
---|
372 | ierr = NF_CLOSE(nid) |
---|
373 | c |
---|
374 | RETURN |
---|
375 | END |
---|