/[MITgcm]/MITgcm/pkg/ctrl/ctrl_pack.F
ViewVC logotype

Contents of /MITgcm/pkg/ctrl/ctrl_pack.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Fri Jul 13 13:40:17 2001 UTC (22 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint40pre3, checkpoint40pre2, checkpoint40pre4, checkpoint40pre5
Changes since 1.1: +95 -1 lines
o Added prototype routines to handle optimization
o Extended control vector to add passive tracer

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

  ViewVC Help
Powered by ViewVC 1.1.22