1 | SUBROUTINE writerestartphy(fichnom,tab_cntrl, |
---|
2 | . rlat,rlon, tsol,tsoil, |
---|
3 | . albedo, |
---|
4 | . solsw, sollw,fder, |
---|
5 | . radsol, |
---|
6 | . t_ancien) |
---|
7 | |
---|
8 | |
---|
9 | c====================================================================== |
---|
10 | c Ecriture de l'etat de redemarrage pour la physique (pour newstart) |
---|
11 | c====================================================================== |
---|
12 | use dimphy |
---|
13 | IMPLICIT none |
---|
14 | #include "dimensions.h" |
---|
15 | #include "netcdf.inc" |
---|
16 | #include "dimsoil.h" |
---|
17 | c====================================================================== |
---|
18 | CHARACTER*13 fichnom |
---|
19 | INTEGER length |
---|
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 radsol(klon) |
---|
30 | REAL t_ancien(klon,klev) |
---|
31 | c |
---|
32 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
33 | INTEGER ierr |
---|
34 | c |
---|
35 | INTEGER isoil |
---|
36 | CHARACTER*2 str2 |
---|
37 | c |
---|
38 | c----------------------------------------------------------------------- |
---|
39 | c Creation du fichier: |
---|
40 | c----------------------------------------------------------------------- |
---|
41 | c |
---|
42 | c print*,'fichnom',fichnom |
---|
43 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
44 | IF (ierr.NE.NF_NOERR) THEN |
---|
45 | write(6,*)' Pb d''ouverture du fichier '//fichnom |
---|
46 | write(6,*)' ierr = ', ierr |
---|
47 | CALL ABORT |
---|
48 | ENDIF |
---|
49 | c |
---|
50 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 28, |
---|
51 | . "Fichier redemarrage physique") |
---|
52 | c |
---|
53 | ierr = NF_DEF_DIM (nid, "index", length, idim1) |
---|
54 | ierr = NF_DEF_DIM (nid, "points_physiques", klon, idim2) |
---|
55 | ierr = NF_DEF_DIM (nid, "horizon_vertical", klon*klev, idim3) |
---|
56 | c |
---|
57 | |
---|
58 | #ifdef NC_DOUBLE |
---|
59 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid) |
---|
60 | #else |
---|
61 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid) |
---|
62 | #endif |
---|
63 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
64 | . "Parametres de controle") |
---|
65 | ierr = NF_ENDDEF(nid) |
---|
66 | #ifdef NC_DOUBLE |
---|
67 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
68 | #else |
---|
69 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
70 | #endif |
---|
71 | c |
---|
72 | ierr = NF_REDEF (nid) |
---|
73 | #ifdef NC_DOUBLE |
---|
74 | ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
75 | #else |
---|
76 | ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid) |
---|
77 | #endif |
---|
78 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
79 | . "Longitudes de la grille physique") |
---|
80 | ierr = NF_ENDDEF(nid) |
---|
81 | #ifdef NC_DOUBLE |
---|
82 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlon) |
---|
83 | #else |
---|
84 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlon) |
---|
85 | #endif |
---|
86 | c |
---|
87 | ierr = NF_REDEF (nid) |
---|
88 | #ifdef NC_DOUBLE |
---|
89 | ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
90 | #else |
---|
91 | ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid) |
---|
92 | #endif |
---|
93 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31, |
---|
94 | . "Latitudes de la grille physique") |
---|
95 | ierr = NF_ENDDEF(nid) |
---|
96 | #ifdef NC_DOUBLE |
---|
97 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlat) |
---|
98 | #else |
---|
99 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlat) |
---|
100 | #endif |
---|
101 | c |
---|
102 | c----------------------------------------------------------------------- |
---|
103 | c Ecriture des variables: |
---|
104 | c----------------------------------------------------------------------- |
---|
105 | c |
---|
106 | ierr = NF_REDEF (nid) |
---|
107 | #ifdef NC_DOUBLE |
---|
108 | ierr = NF_DEF_VAR (nid, "TS", NF_DOUBLE, 1, idim2,nvarid) |
---|
109 | #else |
---|
110 | ierr = NF_DEF_VAR (nid, "TS", NF_FLOAT, 1, idim2,nvarid) |
---|
111 | #endif |
---|
112 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
113 | . "Temperature de surface") |
---|
114 | ierr = NF_ENDDEF(nid) |
---|
115 | #ifdef NC_DOUBLE |
---|
116 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsol) |
---|
117 | #else |
---|
118 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsol) |
---|
119 | #endif |
---|
120 | c |
---|
121 | DO isoil=1, nsoilmx |
---|
122 | IF (isoil.LE.99) THEN |
---|
123 | WRITE(str2,'(i2.2)') isoil |
---|
124 | ierr = NF_REDEF (nid) |
---|
125 | #ifdef NC_DOUBLE |
---|
126 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_DOUBLE,1,idim2,nvarid) |
---|
127 | #else |
---|
128 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_FLOAT,1,idim2,nvarid) |
---|
129 | #endif |
---|
130 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24, |
---|
131 | . "Temperature du sol No."//str2) |
---|
132 | ierr = NF_ENDDEF(nid) |
---|
133 | ELSE |
---|
134 | PRINT*, "Trop de couches" |
---|
135 | CALL abort |
---|
136 | ENDIF |
---|
137 | #ifdef NC_DOUBLE |
---|
138 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsoil(1,isoil)) |
---|
139 | #else |
---|
140 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsoil(1,isoil)) |
---|
141 | #endif |
---|
142 | ENDDO |
---|
143 | c |
---|
144 | ierr = NF_REDEF (nid) |
---|
145 | #ifdef NC_DOUBLE |
---|
146 | ierr = NF_DEF_VAR (nid,"ALBE",NF_DOUBLE,1,idim2,nvarid) |
---|
147 | #else |
---|
148 | ierr = NF_DEF_VAR (nid,"ALBE",NF_FLOAT,1,idim2,nvarid) |
---|
149 | #endif |
---|
150 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
151 | . "albedo de surface") |
---|
152 | ierr = NF_ENDDEF(nid) |
---|
153 | #ifdef NC_DOUBLE |
---|
154 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,albedo) |
---|
155 | #else |
---|
156 | ierr = NF_PUT_VAR_REAL (nid,nvarid,albedo) |
---|
157 | #endif |
---|
158 | c |
---|
159 | ierr = NF_REDEF (nid) |
---|
160 | #ifdef NC_DOUBLE |
---|
161 | ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid) |
---|
162 | #else |
---|
163 | ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid) |
---|
164 | #endif |
---|
165 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
166 | . "Rayonnement solaire a la surface") |
---|
167 | ierr = NF_ENDDEF(nid) |
---|
168 | #ifdef NC_DOUBLE |
---|
169 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,solsw) |
---|
170 | #else |
---|
171 | ierr = NF_PUT_VAR_REAL (nid,nvarid,solsw) |
---|
172 | #endif |
---|
173 | c |
---|
174 | ierr = NF_REDEF (nid) |
---|
175 | #ifdef NC_DOUBLE |
---|
176 | ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid) |
---|
177 | #else |
---|
178 | ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid) |
---|
179 | #endif |
---|
180 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27, |
---|
181 | . "Rayonnement IF a la surface") |
---|
182 | ierr = NF_ENDDEF(nid) |
---|
183 | #ifdef NC_DOUBLE |
---|
184 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,sollw) |
---|
185 | #else |
---|
186 | ierr = NF_PUT_VAR_REAL (nid,nvarid,sollw) |
---|
187 | #endif |
---|
188 | c |
---|
189 | ierr = NF_REDEF (nid) |
---|
190 | #ifdef NC_DOUBLE |
---|
191 | ierr = NF_DEF_VAR (nid, "fder", NF_DOUBLE, 1, idim2,nvarid) |
---|
192 | #else |
---|
193 | ierr = NF_DEF_VAR (nid, "fder", NF_FLOAT, 1, idim2,nvarid) |
---|
194 | #endif |
---|
195 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14, |
---|
196 | . "Derive de flux") |
---|
197 | ierr = NF_ENDDEF(nid) |
---|
198 | #ifdef NC_DOUBLE |
---|
199 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,fder) |
---|
200 | #else |
---|
201 | ierr = NF_PUT_VAR_REAL (nid,nvarid,fder) |
---|
202 | #endif |
---|
203 | c |
---|
204 | ierr = NF_REDEF (nid) |
---|
205 | #ifdef NC_DOUBLE |
---|
206 | ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid) |
---|
207 | #else |
---|
208 | ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid) |
---|
209 | #endif |
---|
210 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
211 | . "Rayonnement net a la surface") |
---|
212 | ierr = NF_ENDDEF(nid) |
---|
213 | #ifdef NC_DOUBLE |
---|
214 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,radsol) |
---|
215 | #else |
---|
216 | ierr = NF_PUT_VAR_REAL (nid,nvarid,radsol) |
---|
217 | #endif |
---|
218 | c |
---|
219 | ierr = NF_REDEF (nid) |
---|
220 | #ifdef NC_DOUBLE |
---|
221 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid) |
---|
222 | #else |
---|
223 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid) |
---|
224 | #endif |
---|
225 | ierr = NF_ENDDEF(nid) |
---|
226 | #ifdef NC_DOUBLE |
---|
227 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,t_ancien) |
---|
228 | #else |
---|
229 | ierr = NF_PUT_VAR_REAL (nid,nvarid,t_ancien) |
---|
230 | #endif |
---|
231 | c |
---|
232 | ierr = NF_CLOSE(nid) |
---|
233 | c |
---|
234 | RETURN |
---|
235 | END |
---|