1 | ! |
---|
2 | ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/phyredem.F,v 1.2 2004/06/22 11:45:34 lmdzadmin Exp $ |
---|
3 | ! |
---|
4 | c |
---|
5 | SUBROUTINE phyredem (fichnom,dtime,radpas,chimpas, |
---|
6 | . rlat,rlon, tsol,tsoil, |
---|
7 | . albedo, |
---|
8 | . solsw, sollw,fder, |
---|
9 | . radsol,resch4, |
---|
10 | . t_ancien) |
---|
11 | |
---|
12 | USE control_mod |
---|
13 | use dimphy |
---|
14 | IMPLICIT none |
---|
15 | c====================================================================== |
---|
16 | c Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818 |
---|
17 | c Objet: Ecriture de l'etat de redemarrage pour la physique |
---|
18 | c====================================================================== |
---|
19 | #include "dimensions.h" |
---|
20 | #include "netcdf.inc" |
---|
21 | #include "dimsoil.h" |
---|
22 | #include "clesphys.h" |
---|
23 | #include "temps.h" |
---|
24 | c====================================================================== |
---|
25 | CHARACTER*13 fichnom |
---|
26 | REAL dtime |
---|
27 | INTEGER radpas,chimpas |
---|
28 | REAL rlat(klon), rlon(klon) |
---|
29 | REAL tsol(klon) |
---|
30 | REAL tsoil(klon,nsoilmx) |
---|
31 | REAL albedo(klon) |
---|
32 | real solsw(klon) |
---|
33 | real sollw(klon) |
---|
34 | real fder(klon) |
---|
35 | REAL radsol(klon) |
---|
36 | real resch4(klon) |
---|
37 | REAL t_ancien(klon,klev) |
---|
38 | c |
---|
39 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
40 | INTEGER ierr |
---|
41 | INTEGER length |
---|
42 | PARAMETER (length=100) |
---|
43 | REAL tab_cntrl(length) |
---|
44 | c |
---|
45 | INTEGER isoil |
---|
46 | CHARACTER*2 str2 |
---|
47 | c |
---|
48 | c print*,'fichnom',fichnom |
---|
49 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
50 | IF (ierr.NE.NF_NOERR) THEN |
---|
51 | write(6,*)' Pb d''ouverture du fichier '//fichnom |
---|
52 | write(6,*)' ierr = ', ierr |
---|
53 | CALL ABORT |
---|
54 | ENDIF |
---|
55 | c |
---|
56 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 28, |
---|
57 | . "Fichier redemarrage physique") |
---|
58 | c |
---|
59 | ierr = NF_DEF_DIM (nid, "index", length, idim1) |
---|
60 | ierr = NF_DEF_DIM (nid, "points_physiques", klon, idim2) |
---|
61 | ierr = NF_DEF_DIM (nid, "horizon_vertical", klon*klev, idim3) |
---|
62 | c |
---|
63 | ierr = NF_ENDDEF(nid) |
---|
64 | c |
---|
65 | DO ierr = 1, length |
---|
66 | tab_cntrl(ierr) = 0.0 |
---|
67 | ENDDO |
---|
68 | tab_cntrl(1) = dtime |
---|
69 | tab_cntrl(2) = radpas |
---|
70 | tab_cntrl(3) = chimpas |
---|
71 | tab_cntrl(4) = solaire |
---|
72 | tab_cntrl(5) = 0 |
---|
73 | tab_cntrl(6) = nbapp_rad |
---|
74 | tab_cntrl(16)= nbapp_chim |
---|
75 | |
---|
76 | IF( cycle_diurne ) tab_cntrl( 7 ) = 1. |
---|
77 | IF( soil_model ) tab_cntrl( 8 ) = 1. |
---|
78 | IF( ok_orodr ) tab_cntrl(10 ) = 1. |
---|
79 | IF( ok_orolf ) tab_cntrl(11 ) = 1. |
---|
80 | IF( ok_gw_nonoro ) tab_cntrl(12 ) = 1. |
---|
81 | |
---|
82 | tab_cntrl(13) = day_end |
---|
83 | tab_cntrl(14) = annee_ref |
---|
84 | tab_cntrl(15) = itau_phy |
---|
85 | c |
---|
86 | ierr = NF_REDEF (nid) |
---|
87 | #ifdef NC_DOUBLE |
---|
88 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid) |
---|
89 | #else |
---|
90 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid) |
---|
91 | #endif |
---|
92 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
93 | . "Parametres de controle") |
---|
94 | ierr = NF_ENDDEF(nid) |
---|
95 | #ifdef NC_DOUBLE |
---|
96 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
97 | #else |
---|
98 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
99 | #endif |
---|
100 | c |
---|
101 | ierr = NF_REDEF (nid) |
---|
102 | #ifdef NC_DOUBLE |
---|
103 | ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
104 | #else |
---|
105 | ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid) |
---|
106 | #endif |
---|
107 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
108 | . "Longitudes de la grille physique") |
---|
109 | ierr = NF_ENDDEF(nid) |
---|
110 | #ifdef NC_DOUBLE |
---|
111 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlon) |
---|
112 | #else |
---|
113 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlon) |
---|
114 | #endif |
---|
115 | c |
---|
116 | ierr = NF_REDEF (nid) |
---|
117 | #ifdef NC_DOUBLE |
---|
118 | ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid) |
---|
119 | #else |
---|
120 | ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid) |
---|
121 | #endif |
---|
122 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31, |
---|
123 | . "Latitudes de la grille physique") |
---|
124 | ierr = NF_ENDDEF(nid) |
---|
125 | #ifdef NC_DOUBLE |
---|
126 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlat) |
---|
127 | #else |
---|
128 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlat) |
---|
129 | #endif |
---|
130 | c |
---|
131 | ierr = NF_REDEF (nid) |
---|
132 | #ifdef NC_DOUBLE |
---|
133 | ierr = NF_DEF_VAR (nid, "TS", NF_DOUBLE, 1, idim2,nvarid) |
---|
134 | #else |
---|
135 | ierr = NF_DEF_VAR (nid, "TS", NF_FLOAT, 1, idim2,nvarid) |
---|
136 | #endif |
---|
137 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22, |
---|
138 | . "Temperature de surface") |
---|
139 | ierr = NF_ENDDEF(nid) |
---|
140 | #ifdef NC_DOUBLE |
---|
141 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsol(1)) |
---|
142 | #else |
---|
143 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsol(1)) |
---|
144 | #endif |
---|
145 | c |
---|
146 | DO isoil=1, nsoilmx |
---|
147 | IF (isoil.LE.99) THEN |
---|
148 | WRITE(str2,'(i2.2)') isoil |
---|
149 | ierr = NF_REDEF (nid) |
---|
150 | #ifdef NC_DOUBLE |
---|
151 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_DOUBLE,1,idim2,nvarid) |
---|
152 | #else |
---|
153 | ierr = NF_DEF_VAR (nid, "Tsoil"//str2,NF_FLOAT,1,idim2,nvarid) |
---|
154 | #endif |
---|
155 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24, |
---|
156 | . "Temperature du sol No."//str2) |
---|
157 | ierr = NF_ENDDEF(nid) |
---|
158 | ELSE |
---|
159 | PRINT*, "Trop de couches" |
---|
160 | CALL abort |
---|
161 | ENDIF |
---|
162 | #ifdef NC_DOUBLE |
---|
163 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsoil(1,isoil)) |
---|
164 | #else |
---|
165 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tsoil(1,isoil)) |
---|
166 | #endif |
---|
167 | ENDDO |
---|
168 | c |
---|
169 | ierr = NF_REDEF (nid) |
---|
170 | #ifdef NC_DOUBLE |
---|
171 | ierr = NF_DEF_VAR (nid,"ALBE",NF_DOUBLE,1,idim2,nvarid) |
---|
172 | #else |
---|
173 | ierr = NF_DEF_VAR (nid,"ALBE",NF_FLOAT,1,idim2,nvarid) |
---|
174 | #endif |
---|
175 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
176 | . "albedo de surface") |
---|
177 | ierr = NF_ENDDEF(nid) |
---|
178 | #ifdef NC_DOUBLE |
---|
179 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,albedo(1)) |
---|
180 | #else |
---|
181 | ierr = NF_PUT_VAR_REAL (nid,nvarid,albedo(1)) |
---|
182 | #endif |
---|
183 | c |
---|
184 | ierr = NF_REDEF (nid) |
---|
185 | #ifdef NC_DOUBLE |
---|
186 | ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid) |
---|
187 | #else |
---|
188 | ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid) |
---|
189 | #endif |
---|
190 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32, |
---|
191 | . "Rayonnement solaire a la surface") |
---|
192 | ierr = NF_ENDDEF(nid) |
---|
193 | #ifdef NC_DOUBLE |
---|
194 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,solsw) |
---|
195 | #else |
---|
196 | ierr = NF_PUT_VAR_REAL (nid,nvarid,solsw) |
---|
197 | #endif |
---|
198 | c |
---|
199 | ierr = NF_REDEF (nid) |
---|
200 | #ifdef NC_DOUBLE |
---|
201 | ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid) |
---|
202 | #else |
---|
203 | ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid) |
---|
204 | #endif |
---|
205 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27, |
---|
206 | . "Rayonnement IF a la surface") |
---|
207 | ierr = NF_ENDDEF(nid) |
---|
208 | #ifdef NC_DOUBLE |
---|
209 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,sollw) |
---|
210 | #else |
---|
211 | ierr = NF_PUT_VAR_REAL (nid,nvarid,sollw) |
---|
212 | #endif |
---|
213 | c |
---|
214 | ierr = NF_REDEF (nid) |
---|
215 | #ifdef NC_DOUBLE |
---|
216 | ierr = NF_DEF_VAR (nid, "fder", NF_DOUBLE, 1, idim2,nvarid) |
---|
217 | #else |
---|
218 | ierr = NF_DEF_VAR (nid, "fder", NF_FLOAT, 1, idim2,nvarid) |
---|
219 | #endif |
---|
220 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14, |
---|
221 | . "Derive de flux") |
---|
222 | ierr = NF_ENDDEF(nid) |
---|
223 | #ifdef NC_DOUBLE |
---|
224 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,fder) |
---|
225 | #else |
---|
226 | ierr = NF_PUT_VAR_REAL (nid,nvarid,fder) |
---|
227 | #endif |
---|
228 | c |
---|
229 | ierr = NF_REDEF (nid) |
---|
230 | #ifdef NC_DOUBLE |
---|
231 | ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid) |
---|
232 | #else |
---|
233 | ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid) |
---|
234 | #endif |
---|
235 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28, |
---|
236 | . "Rayonnement net a la surface") |
---|
237 | ierr = NF_ENDDEF(nid) |
---|
238 | #ifdef NC_DOUBLE |
---|
239 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,radsol) |
---|
240 | #else |
---|
241 | ierr = NF_PUT_VAR_REAL (nid,nvarid,radsol) |
---|
242 | #endif |
---|
243 | c |
---|
244 | ierr = NF_REDEF (nid) |
---|
245 | #ifdef NC_DOUBLE |
---|
246 | ierr = NF_DEF_VAR (nid, "RESCH4", NF_DOUBLE, 1, idim2,nvarid) |
---|
247 | #else |
---|
248 | ierr = NF_DEF_VAR (nid, "RESCH4", NF_FLOAT, 1, idim2,nvarid) |
---|
249 | #endif |
---|
250 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 26, |
---|
251 | . "Reservoir CH4 a la surface") |
---|
252 | ierr = NF_ENDDEF(nid) |
---|
253 | #ifdef NC_DOUBLE |
---|
254 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,resch4) |
---|
255 | #else |
---|
256 | ierr = NF_PUT_VAR_REAL (nid,nvarid,resch4) |
---|
257 | #endif |
---|
258 | c |
---|
259 | ierr = NF_REDEF (nid) |
---|
260 | #ifdef NC_DOUBLE |
---|
261 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid) |
---|
262 | #else |
---|
263 | ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid) |
---|
264 | #endif |
---|
265 | ierr = NF_ENDDEF(nid) |
---|
266 | #ifdef NC_DOUBLE |
---|
267 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,t_ancien) |
---|
268 | #else |
---|
269 | ierr = NF_PUT_VAR_REAL (nid,nvarid,t_ancien) |
---|
270 | #endif |
---|
271 | c |
---|
272 | ierr = NF_CLOSE(nid) |
---|
273 | c |
---|
274 | RETURN |
---|
275 | END |
---|