1 | SUBROUTINE iniwrite_spec(nid,idayref,phis) |
---|
2 | |
---|
3 | use radinc_h, only: L_NSPECTI |
---|
4 | use radcommon_h, only: WAVEI |
---|
5 | use comsoil_h |
---|
6 | |
---|
7 | implicit none |
---|
8 | |
---|
9 | c======================================================================= |
---|
10 | c |
---|
11 | c Auteur: L. Fairhead , P. Le Van, Y. Wanherdrick, F. Forget |
---|
12 | c ------- |
---|
13 | c |
---|
14 | c Objet: |
---|
15 | c ------ |
---|
16 | c |
---|
17 | c 'Initialize' the diagfi_spec.nc file: write down dimensions as well |
---|
18 | c as time-independent fields (e.g: geopotential, mesh area, ...) |
---|
19 | c |
---|
20 | c======================================================================= |
---|
21 | c----------------------------------------------------------------------- |
---|
22 | c Declarations: |
---|
23 | c ------------- |
---|
24 | |
---|
25 | #include "dimensions.h" |
---|
26 | #include "paramet.h" |
---|
27 | !include "comconst.h" |
---|
28 | #include "comcstfi.h" |
---|
29 | #include "comvert.h" |
---|
30 | #include "comgeom.h" |
---|
31 | #include "temps.h" |
---|
32 | #include "ener.h" |
---|
33 | #include "logic.h" |
---|
34 | #include "netcdf.inc" |
---|
35 | #include "description.h" |
---|
36 | #include "serre.h" |
---|
37 | #include"dimphys.h" |
---|
38 | !#include"comsoil.h" |
---|
39 | |
---|
40 | c Arguments: |
---|
41 | c ---------- |
---|
42 | |
---|
43 | integer nid ! NetCDF file ID |
---|
44 | INTEGER*4 idayref ! date (initial date for this run) |
---|
45 | REAL phis(ip1jmp1) ! surface geopotential |
---|
46 | |
---|
47 | c Local: |
---|
48 | c ------ |
---|
49 | INTEGER length,l |
---|
50 | parameter (length = 100) |
---|
51 | REAL tab_cntrl(length) ! run parameters are stored in this array |
---|
52 | INTEGER ierr |
---|
53 | |
---|
54 | integer :: nvarid,idim_index,idim_rlonu,idim_rlonv |
---|
55 | integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm |
---|
56 | ! integer :: idim_nsoilmx ! "subsurface_layers" dimension ID # |
---|
57 | integer :: idim_bandsIR ! "bandsIR" dimension ID # |
---|
58 | integer, dimension(2) :: id |
---|
59 | |
---|
60 | c----------------------------------------------------------------------- |
---|
61 | |
---|
62 | DO l=1,length |
---|
63 | tab_cntrl(l)=0. |
---|
64 | ENDDO |
---|
65 | tab_cntrl(1) = FLOAT(iim) |
---|
66 | tab_cntrl(2) = FLOAT(jjm) |
---|
67 | tab_cntrl(3) = FLOAT(llm) |
---|
68 | tab_cntrl(4) = FLOAT(idayref) |
---|
69 | tab_cntrl(5) = rad |
---|
70 | tab_cntrl(6) = omeg |
---|
71 | tab_cntrl(7) = g |
---|
72 | tab_cntrl(8) = mugaz |
---|
73 | tab_cntrl(9) = rcp |
---|
74 | tab_cntrl(10) = daysec |
---|
75 | tab_cntrl(11) = dtphys |
---|
76 | tab_cntrl(12) = etot0 |
---|
77 | tab_cntrl(13) = ptot0 |
---|
78 | tab_cntrl(14) = ztot0 |
---|
79 | tab_cntrl(15) = stot0 |
---|
80 | tab_cntrl(16) = ang0 |
---|
81 | c |
---|
82 | c .......... P.Le Van ( ajout le 8/04/96 ) ......... |
---|
83 | c ..... parametres pour le zoom ...... |
---|
84 | tab_cntrl(17) = clon |
---|
85 | tab_cntrl(18) = clat |
---|
86 | tab_cntrl(19) = grossismx |
---|
87 | tab_cntrl(20) = grossismy |
---|
88 | c |
---|
89 | c ..... ajout le 6/05/97 et le 15/10/97 ....... |
---|
90 | c |
---|
91 | IF ( fxyhypb ) THEN |
---|
92 | tab_cntrl(21) = 1. |
---|
93 | tab_cntrl(22) = dzoomx |
---|
94 | tab_cntrl(23) = dzoomy |
---|
95 | ELSE |
---|
96 | tab_cntrl(21) = 0. |
---|
97 | tab_cntrl(22) = dzoomx |
---|
98 | tab_cntrl(23) = dzoomy |
---|
99 | tab_cntrl(24) = 0. |
---|
100 | IF( ysinus ) tab_cntrl(24) = 1. |
---|
101 | ENDIF |
---|
102 | |
---|
103 | c ......................................................... |
---|
104 | |
---|
105 | ! Define dimensions |
---|
106 | |
---|
107 | ierr = NF_REDEF (nid) |
---|
108 | |
---|
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, "latitude", jjp1, idim_rlatu) |
---|
112 | ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv) |
---|
113 | ! ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
114 | ! ierr = NF_DEF_DIM (nid, "interlayer", (llm+1), idim_llmp1) |
---|
115 | ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm) |
---|
116 | ! ierr = NF_DEF_DIM (nid, "subsurface_layers",nsoilmx,idim_nsoilmx) |
---|
117 | ierr = NF_DEF_DIM (nid, "bandsIR",L_NSPECTI,idim_bandsIR) |
---|
118 | |
---|
119 | ierr = NF_ENDDEF(nid) |
---|
120 | |
---|
121 | c Contol parameters for this run |
---|
122 | ierr = NF_REDEF (nid) |
---|
123 | #ifdef NC_DOUBLE |
---|
124 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, |
---|
125 | . idim_index,nvarid) |
---|
126 | #else |
---|
127 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, |
---|
128 | . idim_index,nvarid) |
---|
129 | #endif |
---|
130 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
131 | . "Control parameters") |
---|
132 | ierr = NF_ENDDEF(nid) |
---|
133 | #ifdef NC_DOUBLE |
---|
134 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
135 | #else |
---|
136 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
137 | #endif |
---|
138 | |
---|
139 | c -------------------------- |
---|
140 | c longitudes and latitudes |
---|
141 | |
---|
142 | |
---|
143 | c$$$ ierr = NF_REDEF (nid) |
---|
144 | c$$$#ifdef NC_DOUBLE |
---|
145 | c$$$ ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) |
---|
146 | c$$$#else |
---|
147 | c$$$ ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) |
---|
148 | c$$$#endif |
---|
149 | c$$$ ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, |
---|
150 | c$$$ . "Longitudes at u nodes") |
---|
151 | c$$$ ierr = NF_ENDDEF(nid) |
---|
152 | c$$$#ifdef NC_DOUBLE |
---|
153 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) |
---|
154 | c$$$#else |
---|
155 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) |
---|
156 | c$$$#endif |
---|
157 | |
---|
158 | c -------------------------- |
---|
159 | ierr = NF_REDEF (nid) |
---|
160 | #ifdef NC_DOUBLE |
---|
161 | ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid) |
---|
162 | #else |
---|
163 | ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid) |
---|
164 | #endif |
---|
165 | ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north") |
---|
166 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
167 | . "North latitude") |
---|
168 | ierr = NF_ENDDEF(nid) |
---|
169 | #ifdef NC_DOUBLE |
---|
170 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) |
---|
171 | #else |
---|
172 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) |
---|
173 | #endif |
---|
174 | c |
---|
175 | c -------------------------- |
---|
176 | ierr = NF_REDEF (nid) |
---|
177 | #ifdef NC_DOUBLE |
---|
178 | ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid) |
---|
179 | #else |
---|
180 | ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid) |
---|
181 | #endif |
---|
182 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
183 | . "East longitude") |
---|
184 | ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east") |
---|
185 | ierr = NF_ENDDEF(nid) |
---|
186 | #ifdef NC_DOUBLE |
---|
187 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180) |
---|
188 | #else |
---|
189 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180) |
---|
190 | #endif |
---|
191 | c |
---|
192 | c -------------------------- |
---|
193 | ierr = NF_REDEF (nid) |
---|
194 | #ifdef NC_DOUBLE |
---|
195 | ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1, |
---|
196 | . idim_llm,nvarid) |
---|
197 | #else |
---|
198 | ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1, |
---|
199 | . idim_llm,nvarid) |
---|
200 | #endif |
---|
201 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",10,"pseudo-alt") |
---|
202 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'units',2,"km") |
---|
203 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',2,"up") |
---|
204 | |
---|
205 | ierr = NF_ENDDEF(nid) |
---|
206 | #ifdef NC_DOUBLE |
---|
207 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pseudoalt) |
---|
208 | #else |
---|
209 | ierr = NF_PUT_VAR_REAL (nid,nvarid,pseudoalt) |
---|
210 | #endif |
---|
211 | |
---|
212 | |
---|
213 | c$$$c -------------------------- |
---|
214 | c$$$ ierr = NF_REDEF (nid) |
---|
215 | c$$$#ifdef NC_DOUBLE |
---|
216 | c$$$ ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid) |
---|
217 | c$$$#else |
---|
218 | c$$$ ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid) |
---|
219 | c$$$#endif |
---|
220 | c$$$ ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20, |
---|
221 | c$$$ . "Latitudes at v nodes") |
---|
222 | c$$$ ierr = NF_ENDDEF(nid) |
---|
223 | c$$$#ifdef NC_DOUBLE |
---|
224 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180) |
---|
225 | c$$$#else |
---|
226 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180) |
---|
227 | c$$$#endif |
---|
228 | |
---|
229 | |
---|
230 | c$$$c -------------------------- |
---|
231 | c$$$c Vertical levels |
---|
232 | c$$$ call def_var(nid,"aps","hybrid pressure at midlayers ","Pa", |
---|
233 | c$$$ . 1,idim_llm,nvarid,ierr) |
---|
234 | c$$$#ifdef NC_DOUBLE |
---|
235 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aps) |
---|
236 | c$$$#else |
---|
237 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,aps) |
---|
238 | c$$$#endif |
---|
239 | c$$$ |
---|
240 | c$$$ call def_var(nid,"bps","hybrid sigma at midlayers"," ", |
---|
241 | c$$$ . 1,idim_llm,nvarid,ierr) |
---|
242 | c$$$#ifdef NC_DOUBLE |
---|
243 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bps) |
---|
244 | c$$$#else |
---|
245 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,bps) |
---|
246 | c$$$#endif |
---|
247 | c$$$ |
---|
248 | c$$$ call def_var(nid,"ap","hybrid pressure at interlayers","Pa", |
---|
249 | c$$$ . 1,idim_llmp1,nvarid,ierr) |
---|
250 | c$$$#ifdef NC_DOUBLE |
---|
251 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
252 | c$$$#else |
---|
253 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
254 | c$$$#endif |
---|
255 | c$$$ |
---|
256 | c$$$ call def_var(nid,"bp","hybrid sigma at interlayers"," ", |
---|
257 | c$$$ . 1,idim_llmp1,nvarid,ierr) |
---|
258 | c$$$#ifdef NC_DOUBLE |
---|
259 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
260 | c$$$#else |
---|
261 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
262 | c$$$#endif |
---|
263 | |
---|
264 | c$$$!------------------------------- |
---|
265 | c$$$! (soil) depth variable mlayer() (known from comsoil.h) |
---|
266 | c$$$!------------------------------- |
---|
267 | c$$$ ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
268 | c$$$ ! define variable |
---|
269 | c$$$#ifdef NC_DOUBLE |
---|
270 | c$$$ ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,idim_nsoilmx,nvarid) |
---|
271 | c$$$#else |
---|
272 | c$$$ ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,idim_nsoilmx,nvarid) |
---|
273 | c$$$#endif |
---|
274 | c$$$ ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 20, |
---|
275 | c$$$ . "Soil mid-layer depth") |
---|
276 | c$$$ ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",1,"m") |
---|
277 | c$$$ ierr=NF_PUT_ATT_TEXT (nid,nvarid,"positive",4,"down") |
---|
278 | c$$$ ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
279 | c$$$ ! write variable |
---|
280 | c$$$#ifdef NC_DOUBLE |
---|
281 | c$$$ ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,mlayer) |
---|
282 | c$$$#else |
---|
283 | c$$$ ierr=NF_PUT_VAR_REAL (nid,nvarid,mlayer) |
---|
284 | c$$$#endif |
---|
285 | |
---|
286 | !------------------------------- |
---|
287 | ! Number of bands in the IR |
---|
288 | !------------------------------- |
---|
289 | |
---|
290 | ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
291 | ! define variable |
---|
292 | #ifdef NC_DOUBLE |
---|
293 | ierr=NF_DEF_VAR(nid,"bandsIR",NF_DOUBLE,1,idim_bandsIR,nvarid) |
---|
294 | #else |
---|
295 | ierr=NF_DEF_VAR(nid,"bandsIR",NF_FLOAT,1,idim_bandsIR,nvarid) |
---|
296 | #endif |
---|
297 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 27, |
---|
298 | . "Band limits in the infrared") |
---|
299 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",1,"cm^-1") |
---|
300 | ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
301 | ! write variable |
---|
302 | #ifdef NC_DOUBLE |
---|
303 | ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WAVEI)) |
---|
304 | #else |
---|
305 | ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WAVEI)) |
---|
306 | #endif |
---|
307 | |
---|
308 | c |
---|
309 | c -------------------------- |
---|
310 | c Mesh area and conversion coefficients cov. <-> contra. <--> natural |
---|
311 | |
---|
312 | id(1)=idim_rlonu |
---|
313 | id(2)=idim_rlatu |
---|
314 | c |
---|
315 | ierr = NF_REDEF (nid) |
---|
316 | #ifdef NC_DOUBLE |
---|
317 | ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid) |
---|
318 | #else |
---|
319 | ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid) |
---|
320 | #endif |
---|
321 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, |
---|
322 | . "Conversion coefficients cov <--> natural") |
---|
323 | ierr = NF_ENDDEF(nid) |
---|
324 | #ifdef NC_DOUBLE |
---|
325 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
326 | #else |
---|
327 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
328 | #endif |
---|
329 | c |
---|
330 | id(1)=idim_rlonv |
---|
331 | id(2)=idim_rlatv |
---|
332 | c |
---|
333 | c -------------------------- |
---|
334 | ierr = NF_REDEF (nid) |
---|
335 | #ifdef NC_DOUBLE |
---|
336 | ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid) |
---|
337 | #else |
---|
338 | ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid) |
---|
339 | #endif |
---|
340 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, |
---|
341 | . "Conversion coefficients cov <--> natural") |
---|
342 | ierr = NF_ENDDEF(nid) |
---|
343 | #ifdef NC_DOUBLE |
---|
344 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
345 | #else |
---|
346 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
347 | #endif |
---|
348 | c |
---|
349 | id(1)=idim_rlonv |
---|
350 | id(2)=idim_rlatu |
---|
351 | c |
---|
352 | c -------------------------- |
---|
353 | ierr = NF_REDEF (nid) |
---|
354 | #ifdef NC_DOUBLE |
---|
355 | ierr = NF_DEF_VAR (nid, "aire", NF_DOUBLE, 2, id,nvarid) |
---|
356 | #else |
---|
357 | ierr = NF_DEF_VAR (nid, "aire", NF_FLOAT, 2, id,nvarid) |
---|
358 | #endif |
---|
359 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
360 | . "Mesh area") |
---|
361 | ierr = NF_ENDDEF(nid) |
---|
362 | #ifdef NC_DOUBLE |
---|
363 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
364 | #else |
---|
365 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
366 | #endif |
---|
367 | |
---|
368 | c Surface geopotential |
---|
369 | id(1)=idim_rlonv |
---|
370 | id(2)=idim_rlatu |
---|
371 | |
---|
372 | ierr = NF_REDEF (nid) |
---|
373 | #ifdef NC_DOUBLE |
---|
374 | ierr = NF_DEF_VAR (nid, "phisinit", NF_DOUBLE, 2, id,nvarid) |
---|
375 | #else |
---|
376 | ierr = NF_DEF_VAR (nid, "phisinit", NF_FLOAT, 2, id,nvarid) |
---|
377 | #endif |
---|
378 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 27, |
---|
379 | . "Geopotential at the surface") |
---|
380 | ierr = NF_ENDDEF(nid) |
---|
381 | #ifdef NC_DOUBLE |
---|
382 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
383 | #else |
---|
384 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
385 | #endif, |
---|
386 | |
---|
387 | |
---|
388 | ! write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref |
---|
389 | ! write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp',rad,omeg,g,mugaz,rcp |
---|
390 | ! write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys |
---|
391 | |
---|
392 | END |
---|