1 |
heimbach |
1.1 |
C $Header: /u/gcmpack/development/heimbach/div/c34_adj/pkg/ctrl/ctrl_pack.F,v 1.1.1.1 2001/02/13 17:55:14 heimbach Exp $ |
2 |
|
|
|
3 |
|
|
#include "CTRL_CPPOPTIONS.h" |
4 |
|
|
|
5 |
|
|
|
6 |
|
|
subroutine ctrl_pack( |
7 |
|
|
I myiter, |
8 |
|
|
I mytime, |
9 |
|
|
I mythid |
10 |
|
|
& ) |
11 |
|
|
|
12 |
|
|
c ================================================================== |
13 |
|
|
c SUBROUTINE ctrl_pack |
14 |
|
|
c ================================================================== |
15 |
|
|
c |
16 |
|
|
c o Compress the control vector such that only ocean points are |
17 |
|
|
c written to file. |
18 |
|
|
c |
19 |
|
|
c started: Christian Eckert eckert@mit.edu 10-Mar=2000 |
20 |
|
|
c |
21 |
|
|
c changed: Patrick Heimbach heimbach@mit.edu 06-Jun-2000 |
22 |
|
|
c - Transferred some filename declarations |
23 |
|
|
c from here to namelist in ctrl_init |
24 |
|
|
c |
25 |
|
|
c Patrick Heimbach heimbach@mit.edu 16-Jun-2000 |
26 |
|
|
c - single file name convention with or without |
27 |
|
|
c ALLOW_ECCO_OPTIMIZATION |
28 |
|
|
c |
29 |
|
|
c |
30 |
|
|
c ================================================================== |
31 |
|
|
c SUBROUTINE ctrl_pack |
32 |
|
|
c ================================================================== |
33 |
|
|
|
34 |
|
|
implicit none |
35 |
|
|
|
36 |
|
|
c == global variables == |
37 |
|
|
|
38 |
|
|
#include "EEPARAMS.h" |
39 |
|
|
#include "SIZE.h" |
40 |
|
|
#include "PARAMS.h" |
41 |
|
|
#include "GRID.h" |
42 |
|
|
|
43 |
|
|
#include "ctrl.h" |
44 |
|
|
#include "cost.h" |
45 |
|
|
|
46 |
|
|
c == routine arguments == |
47 |
|
|
|
48 |
|
|
integer myiter |
49 |
|
|
_RL mytime |
50 |
|
|
integer mythid |
51 |
|
|
|
52 |
|
|
c == local variables == |
53 |
|
|
|
54 |
|
|
integer bi,bj |
55 |
|
|
integer ip,jp |
56 |
|
|
integer i,j,k |
57 |
|
|
integer ii |
58 |
|
|
integer il |
59 |
|
|
integer irec |
60 |
|
|
integer itlo,ithi |
61 |
|
|
integer jtlo,jthi |
62 |
|
|
integer jmin,jmax |
63 |
|
|
integer imin,imax |
64 |
|
|
|
65 |
|
|
logical doglobalread |
66 |
|
|
logical ladinit |
67 |
|
|
integer cbuffindex |
68 |
|
|
|
69 |
|
|
integer cunit |
70 |
|
|
_RL cbuff( snx*nsx*npx*sny*nsy*npy ) |
71 |
|
|
_RL globfld3d( snx,nsx,npx,sny,nsy,npy,nr ) |
72 |
|
|
_RL globfld2d( snx,nsx,npx,sny,nsy,npy ) |
73 |
|
|
_RL globmsk( snx,nsx,npx,sny,nsy,npy,nr ) |
74 |
|
|
_RL tmpvar |
75 |
|
|
|
76 |
|
|
character*(128) cfile |
77 |
|
|
character*( 80) fname |
78 |
|
|
|
79 |
|
|
integer prec |
80 |
|
|
|
81 |
|
|
c == external == |
82 |
|
|
|
83 |
|
|
integer ilnblnk |
84 |
|
|
external ilnblnk |
85 |
|
|
|
86 |
|
|
c == end of interface == |
87 |
|
|
|
88 |
|
|
prec = precFloat64 |
89 |
|
|
tmpvar = -9999. _d 0 |
90 |
|
|
|
91 |
|
|
jtlo = 1 |
92 |
|
|
jthi = nsy |
93 |
|
|
itlo = 1 |
94 |
|
|
ithi = nsx |
95 |
|
|
jmin = 1 |
96 |
|
|
jmax = sny |
97 |
|
|
imin = 1 |
98 |
|
|
imax = snx |
99 |
|
|
|
100 |
|
|
c-- Tiled files are used. |
101 |
|
|
doglobalread = .false. |
102 |
|
|
|
103 |
|
|
c-- Initialise adjoint variables on active files. |
104 |
|
|
ladinit = .false. |
105 |
|
|
|
106 |
|
|
c |
107 |
|
|
c-- Only the master thread will do I/O. |
108 |
|
|
_BEGIN_MASTER( mythid ) |
109 |
|
|
|
110 |
|
|
c-- read global mask file |
111 |
|
|
call MDSREADFIELD_3D_GL( "hFacC", |
112 |
|
|
& prec, 'RL', Nr, globmsk, |
113 |
|
|
& 1, mythid) |
114 |
|
|
|
115 |
|
|
|
116 |
|
|
c >>> Write control vector <<< |
117 |
|
|
|
118 |
|
|
call mdsfindunit( cunit, mythid ) |
119 |
|
|
write(cfile(1:128),'(2a,i4.4)') |
120 |
|
|
& ctrlname(1:9),'.opt', |
121 |
|
|
& optimcycle |
122 |
|
|
|
123 |
|
|
open( cunit, file = cfile, |
124 |
|
|
& status = 'unknown', |
125 |
|
|
& form = 'unformatted', |
126 |
|
|
& access = 'sequential' ) |
127 |
|
|
|
128 |
|
|
c-- Header information. |
129 |
|
|
|
130 |
|
|
write(cunit) nvartype |
131 |
|
|
write(cunit) nvarlength |
132 |
|
|
write(cunit) expId |
133 |
|
|
write(cunit) optimCycle |
134 |
|
|
write(cunit) tmpvar |
135 |
|
|
write(cunit) 1 |
136 |
|
|
write(cunit) 1 |
137 |
|
|
write(cunit) 1 |
138 |
|
|
write(cunit) 1 |
139 |
|
|
write(cunit) (nWetcTile(1,1,k), k=1,nr) |
140 |
|
|
write(cunit) (nWetsTile(1,1,k), k=1,nr) |
141 |
|
|
write(cunit) (nWetwTile(1,1,k), k=1,nr) |
142 |
|
|
write(cunit) (ncvarindex(i), i=1,maxcvars) |
143 |
|
|
write(cunit) (ncvarrecs(i), i=1,maxcvars) |
144 |
|
|
write(cunit) (nx, i=1,maxcvars) |
145 |
|
|
write(cunit) (ny, i=1,maxcvars) |
146 |
|
|
write(cunit) (ncvarnrmax(i), i=1,maxcvars) |
147 |
|
|
write(cunit) (ncvargrd(i), i=1,maxcvars) |
148 |
|
|
write(cunit) |
149 |
|
|
|
150 |
|
|
#ifdef ALLOW_THETA0_CONTROL |
151 |
|
|
|
152 |
|
|
il=ilnblnk( xx_theta_file) |
153 |
|
|
write(fname(1:80),'(80a)') ' ' |
154 |
|
|
write(fname(1:80),'(2a,i10.10)') |
155 |
|
|
& xx_theta_file(1:il),'.',optimcycle |
156 |
|
|
call MDSREADFIELD_3D_GL( fname, |
157 |
|
|
& prec, 'RL', Nr, globfld3d, |
158 |
|
|
& 1, mythid) |
159 |
|
|
|
160 |
|
|
write(cunit) ncvarindex(1) |
161 |
|
|
write(cunit) 1 |
162 |
|
|
write(cunit) 1 |
163 |
|
|
do k = 1,nr |
164 |
|
|
cbuffindex = 0 |
165 |
|
|
do jp = 1,nPy |
166 |
|
|
do bj = jtlo,jthi |
167 |
|
|
do j = jmin,jmax |
168 |
|
|
do ip = 1,nPx |
169 |
|
|
do bi = itlo,ithi |
170 |
|
|
do i = imin,imax |
171 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
172 |
|
|
cbuffindex = cbuffindex + 1 |
173 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
174 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
175 |
|
|
& * sqrt(wtheta(k,bi,bj)) |
176 |
|
|
#else |
177 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
178 |
|
|
#endif |
179 |
|
|
endif |
180 |
|
|
enddo |
181 |
|
|
enddo |
182 |
|
|
enddo |
183 |
|
|
enddo |
184 |
|
|
enddo |
185 |
|
|
enddo |
186 |
|
|
c --> check cbuffindex. |
187 |
|
|
if ( cbuffindex .gt. 0) then |
188 |
|
|
write(cunit) cbuffindex |
189 |
|
|
write(cunit) k |
190 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
191 |
|
|
endif |
192 |
|
|
enddo |
193 |
|
|
|
194 |
|
|
#endif |
195 |
|
|
|
196 |
|
|
#ifdef ALLOW_SALT0_CONTROL |
197 |
|
|
|
198 |
|
|
il=ilnblnk( xx_salt_file) |
199 |
|
|
write(fname(1:80),'(80a)') ' ' |
200 |
|
|
write(fname(1:80),'(2a,i10.10)') |
201 |
|
|
& xx_salt_file(1:il),'.',optimcycle |
202 |
|
|
call MDSREADFIELD_3D_GL( fname, |
203 |
|
|
& prec, 'RL', Nr, globfld3d, |
204 |
|
|
& 1, mythid) |
205 |
|
|
|
206 |
|
|
write(cunit) ncvarindex(2) |
207 |
|
|
write(cunit) 1 |
208 |
|
|
write(cunit) 1 |
209 |
|
|
do k = 1,nr |
210 |
|
|
cbuffindex = 0 |
211 |
|
|
do jp = 1,nPy |
212 |
|
|
do bj = jtlo,jthi |
213 |
|
|
do j = jmin,jmax |
214 |
|
|
do ip = 1,nPx |
215 |
|
|
do bi = itlo,ithi |
216 |
|
|
do i = imin,imax |
217 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
218 |
|
|
cbuffindex = cbuffindex + 1 |
219 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
220 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
221 |
|
|
& * sqrt(wsalt(k,bi,bj)) |
222 |
|
|
#else |
223 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
224 |
|
|
#endif |
225 |
|
|
endif |
226 |
|
|
enddo |
227 |
|
|
enddo |
228 |
|
|
enddo |
229 |
|
|
enddo |
230 |
|
|
enddo |
231 |
|
|
enddo |
232 |
|
|
c --> check cbuffindex. |
233 |
|
|
if ( cbuffindex .gt. 0) then |
234 |
|
|
write(cunit) cbuffindex |
235 |
|
|
write(cunit) k |
236 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
237 |
|
|
endif |
238 |
|
|
enddo |
239 |
|
|
|
240 |
|
|
#endif |
241 |
|
|
|
242 |
|
|
#ifdef ALLOW_HFLUX0_CONTROL |
243 |
|
|
|
244 |
|
|
il=ilnblnk( xx_hflux_file) |
245 |
|
|
write(fname(1:80),'(80a)') ' ' |
246 |
|
|
write(fname(1:80),'(2a,i10.10)') |
247 |
|
|
& xx_hflux_file(1:il),'.',optimcycle |
248 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
249 |
|
|
call MDSREADFIELD_2D_GL( "whflux", |
250 |
|
|
& prec, 'RL', 1, |
251 |
|
|
& globfld2d, |
252 |
|
|
& 1, mythid) |
253 |
|
|
#endif |
254 |
|
|
call MDSREADFIELD_2D_GL( fname, |
255 |
|
|
& prec, 'RL', 1, |
256 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
257 |
|
|
& 1, mythid) |
258 |
|
|
|
259 |
|
|
write(cunit) ncvarindex(3) |
260 |
|
|
write(cunit) 1 |
261 |
|
|
write(cunit) 1 |
262 |
|
|
k = 1 |
263 |
|
|
cbuffindex = 0 |
264 |
|
|
do jp = 1,nPy |
265 |
|
|
do bj = jtlo,jthi |
266 |
|
|
do j = jmin,jmax |
267 |
|
|
do ip = 1,nPx |
268 |
|
|
do bi = itlo,ithi |
269 |
|
|
do i = imin,imax |
270 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
271 |
|
|
cbuffindex = cbuffindex + 1 |
272 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
273 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
274 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
275 |
|
|
#else |
276 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
277 |
|
|
#endif |
278 |
|
|
endif |
279 |
|
|
enddo |
280 |
|
|
enddo |
281 |
|
|
enddo |
282 |
|
|
enddo |
283 |
|
|
enddo |
284 |
|
|
enddo |
285 |
|
|
c --> check cbuffindex. |
286 |
|
|
if ( cbuffindex .gt. 0) then |
287 |
|
|
write(cunit) cbuffindex |
288 |
|
|
write(cunit) k |
289 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
290 |
|
|
endif |
291 |
|
|
|
292 |
|
|
#endif |
293 |
|
|
|
294 |
|
|
#ifdef ALLOW_SFLUX0_CONTROL |
295 |
|
|
|
296 |
|
|
il=ilnblnk( xx_sflux_file) |
297 |
|
|
write(fname(1:80),'(80a)') ' ' |
298 |
|
|
write(fname(1:80),'(2a,i10.10)') |
299 |
|
|
& xx_sflux_file(1:il),'.',optimcycle |
300 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
301 |
|
|
call MDSREADFIELD_2D_GL( "wsflux", |
302 |
|
|
& prec, 'RL', 1, |
303 |
|
|
& globfld2d, |
304 |
|
|
& 1, mythid) |
305 |
|
|
#endif |
306 |
|
|
call MDSREADFIELD_2D_GL( fname, |
307 |
|
|
& prec, 'RL', 1, |
308 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
309 |
|
|
& 1, mythid) |
310 |
|
|
|
311 |
|
|
write(cunit) ncvarindex(4) |
312 |
|
|
write(cunit) 1 |
313 |
|
|
write(cunit) 1 |
314 |
|
|
k = 1 |
315 |
|
|
cbuffindex = 0 |
316 |
|
|
do jp = 1,nPy |
317 |
|
|
do bj = jtlo,jthi |
318 |
|
|
do j = jmin,jmax |
319 |
|
|
do ip = 1,nPx |
320 |
|
|
do bi = itlo,ithi |
321 |
|
|
do i = imin,imax |
322 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
323 |
|
|
cbuffindex = cbuffindex + 1 |
324 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
325 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
326 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
327 |
|
|
#else |
328 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
329 |
|
|
#endif |
330 |
|
|
endif |
331 |
|
|
enddo |
332 |
|
|
enddo |
333 |
|
|
enddo |
334 |
|
|
enddo |
335 |
|
|
enddo |
336 |
|
|
enddo |
337 |
|
|
c --> check cbuffindex. |
338 |
|
|
if ( cbuffindex .gt. 0) then |
339 |
|
|
write(cunit) cbuffindex |
340 |
|
|
write(cunit) k |
341 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
342 |
|
|
endif |
343 |
|
|
|
344 |
|
|
#endif |
345 |
|
|
|
346 |
|
|
#ifdef ALLOW_TAUU0_CONTROL |
347 |
|
|
|
348 |
|
|
il=ilnblnk( xx_tauu_file) |
349 |
|
|
write(fname(1:80),'(80a)') ' ' |
350 |
|
|
write(fname(1:80),'(2a,i10.10)') |
351 |
|
|
& xx_tauu_file(1:il),'.',optimcycle |
352 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
353 |
|
|
call MDSREADFIELD_2D_GL( "wtauu", |
354 |
|
|
& prec, 'RL', 1, |
355 |
|
|
& globfld2d, |
356 |
|
|
& 1, mythid) |
357 |
|
|
#endif |
358 |
|
|
call MDSREADFIELD_2D_GL( fname, |
359 |
|
|
& prec, 'RL', 1, |
360 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
361 |
|
|
& 1, mythid) |
362 |
|
|
|
363 |
|
|
write(cunit) ncvarindex(5) |
364 |
|
|
write(cunit) 1 |
365 |
|
|
write(cunit) 1 |
366 |
|
|
k = 1 |
367 |
|
|
cbuffindex = 0 |
368 |
|
|
do jp = 1,nPy |
369 |
|
|
do bj = jtlo,jthi |
370 |
|
|
do j = jmin,jmax |
371 |
|
|
do ip = 1,nPx |
372 |
|
|
do bi = itlo,ithi |
373 |
|
|
do i = imin,imax |
374 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
375 |
|
|
cbuffindex = cbuffindex + 1 |
376 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
377 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
378 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
379 |
|
|
#else |
380 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
381 |
|
|
#endif |
382 |
|
|
endif |
383 |
|
|
enddo |
384 |
|
|
enddo |
385 |
|
|
enddo |
386 |
|
|
enddo |
387 |
|
|
enddo |
388 |
|
|
enddo |
389 |
|
|
c --> check cbuffindex. |
390 |
|
|
if ( cbuffindex .gt. 0) then |
391 |
|
|
write(cunit) cbuffindex |
392 |
|
|
write(cunit) k |
393 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
394 |
|
|
endif |
395 |
|
|
|
396 |
|
|
#endif |
397 |
|
|
|
398 |
|
|
#ifdef ALLOW_TAUV0_CONTROL |
399 |
|
|
|
400 |
|
|
il=ilnblnk( xx_tauv_file) |
401 |
|
|
write(fname(1:80),'(80a)') ' ' |
402 |
|
|
write(fname(1:80),'(2a,i10.10)') |
403 |
|
|
& xx_tauv_file(1:il),'.',optimcycle |
404 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
405 |
|
|
call MDSREADFIELD_2D_GL( "wtauv", |
406 |
|
|
& prec, 'RL', 1, |
407 |
|
|
& globfld2d, |
408 |
|
|
& 1, mythid) |
409 |
|
|
#endif |
410 |
|
|
call MDSREADFIELD_2D_GL( fname, |
411 |
|
|
& prec, 'RL', 1, |
412 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
413 |
|
|
& 1, mythid) |
414 |
|
|
|
415 |
|
|
write(cunit) ncvarindex(6) |
416 |
|
|
write(cunit) 1 |
417 |
|
|
write(cunit) 1 |
418 |
|
|
k = 1 |
419 |
|
|
cbuffindex = 0 |
420 |
|
|
do jp = 1,nPy |
421 |
|
|
do bj = jtlo,jthi |
422 |
|
|
do j = jmin,jmax |
423 |
|
|
do ip = 1,nPx |
424 |
|
|
do bi = itlo,ithi |
425 |
|
|
do i = imin,imax |
426 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
427 |
|
|
cbuffindex = cbuffindex + 1 |
428 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
429 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
430 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
431 |
|
|
#else |
432 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
433 |
|
|
#endif |
434 |
|
|
endif |
435 |
|
|
enddo |
436 |
|
|
enddo |
437 |
|
|
enddo |
438 |
|
|
enddo |
439 |
|
|
enddo |
440 |
|
|
enddo |
441 |
|
|
c --> check cbuffindex. |
442 |
|
|
if ( cbuffindex .gt. 0) then |
443 |
|
|
write(cunit) cbuffindex |
444 |
|
|
write(cunit) k |
445 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
446 |
|
|
endif |
447 |
|
|
|
448 |
|
|
#endif |
449 |
|
|
|
450 |
|
|
#ifdef ALLOW_SST0_CONTROL |
451 |
|
|
|
452 |
|
|
il=ilnblnk( xx_sst_file) |
453 |
|
|
write(fname(1:80),'(80a)') ' ' |
454 |
|
|
write(fname(1:80),'(2a,i10.10)') |
455 |
|
|
& xx_sst_file(1:il),'.',optimcycle |
456 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
457 |
|
|
call MDSREADFIELD_2D_GL( "wsst", |
458 |
|
|
& prec, 'RL', 1, |
459 |
|
|
& globfld2d, |
460 |
|
|
& 1, mythid) |
461 |
|
|
#endif |
462 |
|
|
call MDSREADFIELD_2D_GL( fname, |
463 |
|
|
& prec, 'RL', 1, |
464 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
465 |
|
|
& 1, mythid) |
466 |
|
|
|
467 |
|
|
write(cunit) ncvarindex(7) |
468 |
|
|
write(cunit) 1 |
469 |
|
|
write(cunit) 1 |
470 |
|
|
k = 1 |
471 |
|
|
cbuffindex = 0 |
472 |
|
|
do jp = 1,nPy |
473 |
|
|
do bj = jtlo,jthi |
474 |
|
|
do j = jmin,jmax |
475 |
|
|
do ip = 1,nPx |
476 |
|
|
do bi = itlo,ithi |
477 |
|
|
do i = imin,imax |
478 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
479 |
|
|
cbuffindex = cbuffindex + 1 |
480 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
481 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
482 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
483 |
|
|
#else |
484 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
485 |
|
|
#endif |
486 |
|
|
endif |
487 |
|
|
enddo |
488 |
|
|
enddo |
489 |
|
|
enddo |
490 |
|
|
enddo |
491 |
|
|
enddo |
492 |
|
|
enddo |
493 |
|
|
c --> check cbuffindex. |
494 |
|
|
if ( cbuffindex .gt. 0) then |
495 |
|
|
write(cunit) cbuffindex |
496 |
|
|
write(cunit) k |
497 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
498 |
|
|
endif |
499 |
|
|
|
500 |
|
|
#endif |
501 |
|
|
|
502 |
|
|
#ifdef ALLOW_SSS0_CONTROL |
503 |
|
|
|
504 |
|
|
il=ilnblnk( xx_sss_file) |
505 |
|
|
write(fname(1:80),'(80a)') ' ' |
506 |
|
|
write(fname(1:80),'(2a,i10.10)') |
507 |
|
|
& xx_sss_file(1:il),'.',optimcycle |
508 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
509 |
|
|
call MDSREADFIELD_2D_GL( "wsss", |
510 |
|
|
& prec, 'RL', 1, |
511 |
|
|
& globfld2d, |
512 |
|
|
& 1, mythid) |
513 |
|
|
#endif |
514 |
|
|
call MDSREADFIELD_2D_GL( fname, |
515 |
|
|
& prec, 'RL', 1, |
516 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
517 |
|
|
& 1, mythid) |
518 |
|
|
|
519 |
|
|
write(cunit) ncvarindex(8) |
520 |
|
|
write(cunit) 1 |
521 |
|
|
write(cunit) 1 |
522 |
|
|
k = 1 |
523 |
|
|
cbuffindex = 0 |
524 |
|
|
do jp = 1,nPy |
525 |
|
|
do bj = jtlo,jthi |
526 |
|
|
do j = jmin,jmax |
527 |
|
|
do ip = 1,nPx |
528 |
|
|
do bi = itlo,ithi |
529 |
|
|
do i = imin,imax |
530 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
531 |
|
|
cbuffindex = cbuffindex + 1 |
532 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
533 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
534 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
535 |
|
|
#else |
536 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
537 |
|
|
#endif |
538 |
|
|
endif |
539 |
|
|
enddo |
540 |
|
|
enddo |
541 |
|
|
enddo |
542 |
|
|
enddo |
543 |
|
|
enddo |
544 |
|
|
enddo |
545 |
|
|
c --> check cbuffindex. |
546 |
|
|
if ( cbuffindex .gt. 0) then |
547 |
|
|
write(cunit) cbuffindex |
548 |
|
|
write(cunit) k |
549 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
550 |
|
|
endif |
551 |
|
|
|
552 |
|
|
#endif |
553 |
|
|
|
554 |
|
|
|
555 |
|
|
close ( cunit ) |
556 |
|
|
|
557 |
|
|
_END_MASTER( mythid ) |
558 |
|
|
|
559 |
|
|
c====================================================================== |
560 |
|
|
|
561 |
|
|
c-- read global mask file |
562 |
|
|
call MDSREADFIELD_3D_GL( "hFacC", |
563 |
|
|
& prec, 'RL', Nr, globmsk, |
564 |
|
|
& 1, mythid) |
565 |
|
|
|
566 |
|
|
c >>> Write gradient vector <<< |
567 |
|
|
|
568 |
|
|
call mdsfindunit( cunit, mythid ) |
569 |
|
|
write(cfile(1:128),'(2a,i4.4)') |
570 |
|
|
& costname(1:9),'.opt', |
571 |
|
|
& optimcycle |
572 |
|
|
|
573 |
|
|
open( cunit, file = cfile, |
574 |
|
|
& status = 'unknown', |
575 |
|
|
& form = 'unformatted', |
576 |
|
|
& access = 'sequential' ) |
577 |
|
|
|
578 |
|
|
c-- Header information. |
579 |
|
|
write(cunit) nvartype |
580 |
|
|
write(cunit) nvarlength |
581 |
|
|
write(cunit) expId |
582 |
|
|
write(cunit) optimCycle |
583 |
|
|
write(cunit) fc |
584 |
|
|
write(cunit) 1 |
585 |
|
|
write(cunit) 1 |
586 |
|
|
write(cunit) 1 |
587 |
|
|
write(cunit) 1 |
588 |
|
|
write(cunit) (nWetcTile(1,1,k), k=1,nr) |
589 |
|
|
write(cunit) (nWetsTile(1,1,k), k=1,nr) |
590 |
|
|
write(cunit) (nWetwTile(1,1,k), k=1,nr) |
591 |
|
|
write(cunit) (ncvarindex(i), i=1,maxcvars) |
592 |
|
|
write(cunit) (ncvarrecs(i), i=1,maxcvars) |
593 |
|
|
write(cunit) (nx, i=1,maxcvars) |
594 |
|
|
write(cunit) (ny, i=1,maxcvars) |
595 |
|
|
write(cunit) (ncvarnrmax(i), i=1,maxcvars) |
596 |
|
|
write(cunit) (ncvargrd(i), i=1,maxcvars) |
597 |
|
|
write(cunit) |
598 |
|
|
|
599 |
|
|
#ifdef ALLOW_THETA0_CONTROL |
600 |
|
|
|
601 |
|
|
il=ilnblnk( xx_theta_file) |
602 |
|
|
write(fname(1:80),'(80a)') ' ' |
603 |
|
|
write(fname(1:80),'(3a,i10.10)') |
604 |
|
|
& yadmark,xx_theta_file(1:il),'.',optimcycle |
605 |
|
|
|
606 |
|
|
call MDSREADFIELD_3D_GL( fname, |
607 |
|
|
& prec, 'RL', Nr, |
608 |
|
|
& globfld3d, |
609 |
|
|
& 1, mythid) |
610 |
|
|
|
611 |
|
|
write(cunit) ncvarindex(1) |
612 |
|
|
write(cunit) 1 |
613 |
|
|
write(cunit) 1 |
614 |
|
|
do k = 1,nr |
615 |
|
|
cbuffindex = 0 |
616 |
|
|
do jp = 1,nPy |
617 |
|
|
do bj = jtlo,jthi |
618 |
|
|
do j = jmin,jmax |
619 |
|
|
do ip = 1,nPx |
620 |
|
|
do bi = itlo,ithi |
621 |
|
|
do i = imin,imax |
622 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
623 |
|
|
cbuffindex = cbuffindex + 1 |
624 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
625 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
626 |
|
|
& * sqrt(wtheta(k,bi,bj)) |
627 |
|
|
#else |
628 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
629 |
|
|
#endif |
630 |
|
|
endif |
631 |
|
|
enddo |
632 |
|
|
enddo |
633 |
|
|
enddo |
634 |
|
|
enddo |
635 |
|
|
enddo |
636 |
|
|
enddo |
637 |
|
|
c --> check cbuffindex. |
638 |
|
|
if ( cbuffindex .gt. 0) then |
639 |
|
|
write(cunit) cbuffindex |
640 |
|
|
write(cunit) k |
641 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
642 |
|
|
endif |
643 |
|
|
enddo |
644 |
|
|
|
645 |
|
|
#endif |
646 |
|
|
|
647 |
|
|
#ifdef ALLOW_SALT0_CONTROL |
648 |
|
|
|
649 |
|
|
il=ilnblnk( xx_salt_file) |
650 |
|
|
write(fname(1:80),'(80a)') ' ' |
651 |
|
|
write(fname(1:80),'(3a,i10.10)') |
652 |
|
|
& yadmark,xx_salt_file(1:il),'.',optimcycle |
653 |
|
|
|
654 |
|
|
call MDSREADFIELD_3D_GL( fname, |
655 |
|
|
& prec, 'RL', Nr, |
656 |
|
|
& globfld3d, |
657 |
|
|
& 1, mythid) |
658 |
|
|
|
659 |
|
|
write(cunit) ncvarindex(2) |
660 |
|
|
write(cunit) 1 |
661 |
|
|
write(cunit) 1 |
662 |
|
|
do k = 1,nr |
663 |
|
|
cbuffindex = 0 |
664 |
|
|
do jp = 1,nPy |
665 |
|
|
do bj = jtlo,jthi |
666 |
|
|
do j = jmin,jmax |
667 |
|
|
do ip = 1,nPx |
668 |
|
|
do bi = itlo,ithi |
669 |
|
|
do i = imin,imax |
670 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
671 |
|
|
cbuffindex = cbuffindex + 1 |
672 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
673 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
674 |
|
|
& * sqrt(wsalt(k,bi,bj)) |
675 |
|
|
#else |
676 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
677 |
|
|
#endif |
678 |
|
|
endif |
679 |
|
|
enddo |
680 |
|
|
enddo |
681 |
|
|
enddo |
682 |
|
|
enddo |
683 |
|
|
enddo |
684 |
|
|
enddo |
685 |
|
|
c --> check cbuffindex. |
686 |
|
|
if ( cbuffindex .gt. 0) then |
687 |
|
|
write(cunit) cbuffindex |
688 |
|
|
write(cunit) k |
689 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
690 |
|
|
endif |
691 |
|
|
enddo |
692 |
|
|
|
693 |
|
|
#endif |
694 |
|
|
|
695 |
|
|
|
696 |
|
|
#ifdef ALLOW_HFLUX0_CONTROL |
697 |
|
|
|
698 |
|
|
il=ilnblnk( xx_hflux_file) |
699 |
|
|
write(fname(1:80),'(80a)') ' ' |
700 |
|
|
write(fname(1:80),'(3a,i10.10)') |
701 |
|
|
& yadmark,xx_hflux_file(1:il),'.',optimcycle |
702 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
703 |
|
|
call MDSREADFIELD_2D_GL( "whflux", |
704 |
|
|
& prec, 'RL', 1, |
705 |
|
|
& globfld2d, |
706 |
|
|
& 1, mythid) |
707 |
|
|
#endif |
708 |
|
|
call MDSREADFIELD_2D_GL( fname, |
709 |
|
|
& prec, 'RL', 1, |
710 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
711 |
|
|
& 1, mythid) |
712 |
|
|
|
713 |
|
|
write(cunit) ncvarindex(3) |
714 |
|
|
write(cunit) 1 |
715 |
|
|
write(cunit) 1 |
716 |
|
|
k = 1 |
717 |
|
|
cbuffindex = 0 |
718 |
|
|
do jp = 1,nPy |
719 |
|
|
do bj = jtlo,jthi |
720 |
|
|
do j = jmin,jmax |
721 |
|
|
do ip = 1,nPx |
722 |
|
|
do bi = itlo,ithi |
723 |
|
|
do i = imin,imax |
724 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
725 |
|
|
cbuffindex = cbuffindex + 1 |
726 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
727 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
728 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
729 |
|
|
#else |
730 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
731 |
|
|
#endif |
732 |
|
|
endif |
733 |
|
|
enddo |
734 |
|
|
enddo |
735 |
|
|
enddo |
736 |
|
|
enddo |
737 |
|
|
enddo |
738 |
|
|
enddo |
739 |
|
|
c --> check cbuffindex. |
740 |
|
|
if ( cbuffindex .gt. 0) then |
741 |
|
|
write(cunit) cbuffindex |
742 |
|
|
write(cunit) k |
743 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
744 |
|
|
endif |
745 |
|
|
|
746 |
|
|
#endif |
747 |
|
|
|
748 |
|
|
#ifdef ALLOW_SFLUX0_CONTROL |
749 |
|
|
|
750 |
|
|
il=ilnblnk( xx_sflux_file) |
751 |
|
|
write(fname(1:80),'(80a)') ' ' |
752 |
|
|
write(fname(1:80),'(3a,i10.10)') |
753 |
|
|
& yadmark,xx_sflux_file(1:il),'.',optimcycle |
754 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
755 |
|
|
call MDSREADFIELD_2D_GL( "wsflux", |
756 |
|
|
& prec, 'RL', 1, |
757 |
|
|
& globfld2d, |
758 |
|
|
& 1, mythid) |
759 |
|
|
#endif |
760 |
|
|
call MDSREADFIELD_2D_GL( fname, |
761 |
|
|
& prec, 'RL', 1, |
762 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
763 |
|
|
& 1, mythid) |
764 |
|
|
|
765 |
|
|
write(cunit) ncvarindex(4) |
766 |
|
|
write(cunit) 1 |
767 |
|
|
write(cunit) 1 |
768 |
|
|
k = 1 |
769 |
|
|
cbuffindex = 0 |
770 |
|
|
do jp = 1,nPy |
771 |
|
|
do bj = jtlo,jthi |
772 |
|
|
do j = jmin,jmax |
773 |
|
|
do ip = 1,nPx |
774 |
|
|
do bi = itlo,ithi |
775 |
|
|
do i = imin,imax |
776 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
777 |
|
|
cbuffindex = cbuffindex + 1 |
778 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
779 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
780 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
781 |
|
|
#else |
782 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
783 |
|
|
#endif |
784 |
|
|
endif |
785 |
|
|
enddo |
786 |
|
|
enddo |
787 |
|
|
enddo |
788 |
|
|
enddo |
789 |
|
|
enddo |
790 |
|
|
enddo |
791 |
|
|
c --> check cbuffindex. |
792 |
|
|
if ( cbuffindex .gt. 0) then |
793 |
|
|
write(cunit) cbuffindex |
794 |
|
|
write(cunit) k |
795 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
796 |
|
|
endif |
797 |
|
|
|
798 |
|
|
#endif |
799 |
|
|
|
800 |
|
|
#ifdef ALLOW_TAUU0_CONTROL |
801 |
|
|
|
802 |
|
|
il=ilnblnk( xx_tauu_file) |
803 |
|
|
write(fname(1:80),'(80a)') ' ' |
804 |
|
|
write(fname(1:80),'(3a,i10.10)') |
805 |
|
|
& yadmark,xx_tauu_file(1:il),'.',optimcycle |
806 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
807 |
|
|
call MDSREADFIELD_2D_GL( "wtauu", |
808 |
|
|
& prec, 'RL', 1, |
809 |
|
|
& globfld2d, |
810 |
|
|
& 1, mythid) |
811 |
|
|
#endif |
812 |
|
|
call MDSREADFIELD_2D_GL( fname, |
813 |
|
|
& prec, 'RL', 1, |
814 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
815 |
|
|
& 1, mythid) |
816 |
|
|
|
817 |
|
|
write(cunit) ncvarindex(5) |
818 |
|
|
write(cunit) 1 |
819 |
|
|
write(cunit) 1 |
820 |
|
|
k = 1 |
821 |
|
|
cbuffindex = 0 |
822 |
|
|
do jp = 1,nPy |
823 |
|
|
do bj = jtlo,jthi |
824 |
|
|
do j = jmin,jmax |
825 |
|
|
do ip = 1,nPx |
826 |
|
|
do bi = itlo,ithi |
827 |
|
|
do i = imin,imax |
828 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
829 |
|
|
cbuffindex = cbuffindex + 1 |
830 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
831 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
832 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
833 |
|
|
#else |
834 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
835 |
|
|
#endif |
836 |
|
|
endif |
837 |
|
|
enddo |
838 |
|
|
enddo |
839 |
|
|
enddo |
840 |
|
|
enddo |
841 |
|
|
enddo |
842 |
|
|
enddo |
843 |
|
|
c --> check cbuffindex. |
844 |
|
|
if ( cbuffindex .gt. 0) then |
845 |
|
|
write(cunit) cbuffindex |
846 |
|
|
write(cunit) k |
847 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
848 |
|
|
endif |
849 |
|
|
|
850 |
|
|
#endif |
851 |
|
|
|
852 |
|
|
#ifdef ALLOW_TAUV0_CONTROL |
853 |
|
|
|
854 |
|
|
il=ilnblnk( xx_tauv_file) |
855 |
|
|
write(fname(1:80),'(80a)') ' ' |
856 |
|
|
write(fname(1:80),'(3a,i10.10)') |
857 |
|
|
& yadmark,xx_tauv_file(1:il),'.',optimcycle |
858 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
859 |
|
|
call MDSREADFIELD_2D_GL( "wtauv", |
860 |
|
|
& prec, 'RL', 1, |
861 |
|
|
& globfld2d, |
862 |
|
|
& 1, mythid) |
863 |
|
|
#endif |
864 |
|
|
call MDSREADFIELD_2D_GL( fname, |
865 |
|
|
& prec, 'RL', 1, |
866 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
867 |
|
|
& 1, mythid) |
868 |
|
|
|
869 |
|
|
write(cunit) ncvarindex(6) |
870 |
|
|
write(cunit) 1 |
871 |
|
|
write(cunit) 1 |
872 |
|
|
k = 1 |
873 |
|
|
cbuffindex = 0 |
874 |
|
|
do jp = 1,nPy |
875 |
|
|
do bj = jtlo,jthi |
876 |
|
|
do j = jmin,jmax |
877 |
|
|
do ip = 1,nPx |
878 |
|
|
do bi = itlo,ithi |
879 |
|
|
do i = imin,imax |
880 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
881 |
|
|
cbuffindex = cbuffindex + 1 |
882 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
883 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
884 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
885 |
|
|
#else |
886 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
887 |
|
|
#endif |
888 |
|
|
endif |
889 |
|
|
enddo |
890 |
|
|
enddo |
891 |
|
|
enddo |
892 |
|
|
enddo |
893 |
|
|
enddo |
894 |
|
|
enddo |
895 |
|
|
c --> check cbuffindex. |
896 |
|
|
if ( cbuffindex .gt. 0) then |
897 |
|
|
write(cunit) cbuffindex |
898 |
|
|
write(cunit) k |
899 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
900 |
|
|
endif |
901 |
|
|
|
902 |
|
|
#endif |
903 |
|
|
|
904 |
|
|
#ifdef ALLOW_SST0_CONTROL |
905 |
|
|
|
906 |
|
|
il=ilnblnk( xx_sst_file) |
907 |
|
|
write(fname(1:80),'(80a)') ' ' |
908 |
|
|
write(fname(1:80),'(3a,i10.10)') |
909 |
|
|
& yadmark,xx_sst_file(1:il),'.',optimcycle |
910 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
911 |
|
|
call MDSREADFIELD_2D_GL( "wsst", |
912 |
|
|
& prec, 'RL', 1, |
913 |
|
|
& globfld2d, |
914 |
|
|
& 1, mythid) |
915 |
|
|
#endif |
916 |
|
|
call MDSREADFIELD_2D_GL( fname, |
917 |
|
|
& prec, 'RL', 1, |
918 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
919 |
|
|
& 1, mythid) |
920 |
|
|
|
921 |
|
|
write(cunit) ncvarindex(7) |
922 |
|
|
write(cunit) 1 |
923 |
|
|
write(cunit) 1 |
924 |
|
|
k = 1 |
925 |
|
|
cbuffindex = 0 |
926 |
|
|
do jp = 1,nPy |
927 |
|
|
do bj = jtlo,jthi |
928 |
|
|
do j = jmin,jmax |
929 |
|
|
do ip = 1,nPx |
930 |
|
|
do bi = itlo,ithi |
931 |
|
|
do i = imin,imax |
932 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
933 |
|
|
cbuffindex = cbuffindex + 1 |
934 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
935 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
936 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
937 |
|
|
#else |
938 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
939 |
|
|
#endif |
940 |
|
|
endif |
941 |
|
|
enddo |
942 |
|
|
enddo |
943 |
|
|
enddo |
944 |
|
|
enddo |
945 |
|
|
enddo |
946 |
|
|
enddo |
947 |
|
|
c --> check cbuffindex. |
948 |
|
|
if ( cbuffindex .gt. 0) then |
949 |
|
|
write(cunit) cbuffindex |
950 |
|
|
write(cunit) k |
951 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
952 |
|
|
endif |
953 |
|
|
|
954 |
|
|
#endif |
955 |
|
|
|
956 |
|
|
#ifdef ALLOW_SSS0_CONTROL |
957 |
|
|
|
958 |
|
|
il=ilnblnk( xx_sss_file) |
959 |
|
|
write(fname(1:80),'(80a)') ' ' |
960 |
|
|
write(fname(1:80),'(3a,i10.10)') |
961 |
|
|
& yadmark,xx_sss_file(1:il),'.',optimcycle |
962 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
963 |
|
|
call MDSREADFIELD_2D_GL( "wsss", |
964 |
|
|
& prec, 'RL', 1, |
965 |
|
|
& globfld2d, |
966 |
|
|
& 1, mythid) |
967 |
|
|
#endif |
968 |
|
|
call MDSREADFIELD_2D_GL( fname, |
969 |
|
|
& prec, 'RL', 1, |
970 |
|
|
& globfld3d(1,1,1,1,1,1,1), |
971 |
|
|
& 1, mythid) |
972 |
|
|
|
973 |
|
|
write(cunit) ncvarindex(8) |
974 |
|
|
write(cunit) 1 |
975 |
|
|
write(cunit) 1 |
976 |
|
|
k = 1 |
977 |
|
|
cbuffindex = 0 |
978 |
|
|
do jp = 1,nPy |
979 |
|
|
do bj = jtlo,jthi |
980 |
|
|
do j = jmin,jmax |
981 |
|
|
do ip = 1,nPx |
982 |
|
|
do bi = itlo,ithi |
983 |
|
|
do i = imin,imax |
984 |
|
|
if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then |
985 |
|
|
cbuffindex = cbuffindex + 1 |
986 |
|
|
#ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO |
987 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
988 |
|
|
& * sqrt(globfld2d(i,bi,ip,j,bj,jp)) |
989 |
|
|
#else |
990 |
|
|
cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k) |
991 |
|
|
#endif |
992 |
|
|
endif |
993 |
|
|
enddo |
994 |
|
|
enddo |
995 |
|
|
enddo |
996 |
|
|
enddo |
997 |
|
|
enddo |
998 |
|
|
enddo |
999 |
|
|
c --> check cbuffindex. |
1000 |
|
|
if ( cbuffindex .gt. 0) then |
1001 |
|
|
write(cunit) cbuffindex |
1002 |
|
|
write(cunit) k |
1003 |
|
|
write(cunit) (cbuff(ii), ii=1,cbuffindex) |
1004 |
|
|
endif |
1005 |
|
|
|
1006 |
|
|
#endif |
1007 |
|
|
|
1008 |
|
|
close ( cunit ) |
1009 |
|
|
|
1010 |
|
|
return |
1011 |
|
|
end |
1012 |
|
|
|