/[MITgcm]/MITgcm/pkg/autodiff/active_file_ad.F
ViewVC logotype

Contents of /MITgcm/pkg/autodiff/active_file_ad.F

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


Revision 1.5 - (show annotations) (download)
Thu Mar 23 23:06:47 2006 UTC (18 years, 1 month ago) by heimbach
Branch: MAIN
Changes since 1.4: +115 -0 lines
Adding Gael Forget profile cost code.

1
2 #include "AUTODIFF_OPTIONS.h"
3
4 c ==================================================================
5 c
6 c active_files_ad.F: Routines to handle the I/O of the active file
7 c for the adjoint calculations. All files are
8 c direct access files.
9 c
10 c Routines
11 c
12 c o adactive_read_xy - Adjoint of active_read_xy
13 c o adactive_read_xyz - Adjoint of active_read_xyz
14 c o adactive_write_xy - Adjoint of active_write_xy
15 c o adactive_write_xyz - Adjoint of active_write_xyz
16 c
17 c o adactive_read_xz - Adjoint of active_read_xz
18 c o adactive_read_yz - Adjoint of active_read_yz
19 c o adactive_write_xz - Adjoint of active_write_xz
20 c o adactive_write_yz - Adjoint of active_write_yz
21 c
22 c o adactive_read_tile_xy - Adjoint of active_read_tile_xy
23 c o adactive_read_tile_xyz - Adjoint of active_read_tile_xyz
24 c o adactive_write_tile_xy - Adjoint of active_write_tile_xy
25 c o adactive_write_tile_xyz - Adjoint of active_write_tile_xyz
26 c
27 c o adactive_read_profile - Adjoint of active_read_profile
28 c o adactive_write_profile - Adjoint of active_write_profile
29 c
30 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
31 c - Added routines that do active writes on tiles
32 c instead of a whole thread.
33 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
34 c - changed suboutine argument list:
35 c dropped mycurrentiter, mycurrenttime
36 c changed: heimbach@mit.edu 25-Mar-2002
37 c - added active file handling of xz-/yz-arrays
38 c
39 c ==================================================================
40
41 CBOP
42 C !ROUTINE: adactive_read_xy
43 C !INTERFACE:
44 subroutine adactive_read_xy(
45 I active_var_file,
46 I irec,
47 I doglobalread,
48 I lAdInit,
49 I myiter,
50 I mythid,
51 I adactive_var
52 & )
53
54 C !DESCRIPTION: \bv
55 c ==================================================================
56 c SUBROUTINE adactive_read_xy
57 c ==================================================================
58 c o Adjoint of active_read_xy.
59 c started: Christian Eckert eckert@mit.edu 24-May-1999
60 c ==================================================================
61 c SUBROUTINE adactive_read_xy
62 c ==================================================================
63 C \ev
64
65 C !USES:
66 implicit none
67
68 c == global variables ==
69 #include "EEPARAMS.h"
70 #include "SIZE.h"
71
72 C !INPUT/OUTPUT PARAMETERS:
73 c == routine arguments ==
74 c active_var_file: filename
75 c adactive_var: array
76 c irec: record number
77 c myIter: number of optimization iteration (default: 0)
78 c mythid: thread number for this instance
79 c doglobalread: flag for global or local read/write
80 c (default: .false.)
81 c lAdInit: initialisation of corresponding adjoint
82 c variable and write to active file
83 character*(*) active_var_file
84 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
85 integer irec
86 integer myiter,mythid
87 logical doglobalread
88 logical lAdInit
89
90 C !LOCAL VARIABLES:
91 c == local variables ==
92 integer mynr
93 integer il
94 integer ilnblnk
95 character*(2) adpref
96 character*(80) fname
97
98 c == functions ==
99 external ilnblnk
100
101 c == end of interface ==
102 CEOP
103
104 mynr = 1
105 adpref = 'ad'
106 write(fname(1:80),'(a)') ' '
107
108 il = ilnblnk(active_var_file)
109
110 write(fname(1:2),'(a)') adpref
111 write(fname(3:2+il),'(a)') active_var_file(1:il)
112
113 call active_read_rl( fname, adactive_var,
114 & doglobalread, lAdInit, irec, mynr,
115 & REVERSE_SIMULATION, myiter, mythid )
116
117 end
118
119 CBOP
120 C !ROUTINE: adactive_read_xyz
121 C !INTERFACE:
122 subroutine adactive_read_xyz(
123 I active_var_file,
124 I irec,
125 I doglobalread,
126 I lAdInit,
127 I myiter,
128 I mythid,
129 I adactive_var
130 & )
131
132 C !DESCRIPTION: \bv
133 c ==================================================================
134 c SUBROUTINE adactive_read_xyz
135 c ==================================================================
136 c o Adjoint of active_read_xyz.
137 c started: Christian Eckert eckert@mit.edu 24-May-1999
138 c ==================================================================
139 c SUBROUTINE adactive_read_xyz
140 c ==================================================================
141 C \ev
142
143 C !USES:
144 implicit none
145
146 c == global variables ==
147 #include "EEPARAMS.h"
148 #include "SIZE.h"
149
150 c == routine arguments ==
151 c active_var_file: filename
152 c adactive_var: array
153 c irec: record number
154 c myIter: number of optimization iteration (default: 0)
155 c mythid: thread number for this instance
156 c doglobalread: flag for global or local read/write
157 c (default: .false.)
158 c lAdInit: initialisation of corresponding adjoint
159 c variable and write to active file
160 character*(*) active_var_file
161 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
162 integer irec
163 integer myiter,mythid
164 logical doglobalread
165 logical lAdInit
166
167 C !LOCAL VARIABLES:
168 c == local variables ==
169 integer mynr
170 integer il
171 integer ilnblnk
172 character*(2) adpref
173 character*(80) fname
174
175 c == functions ==
176 external ilnblnk
177
178 c == end of interface ==
179 CEOP
180
181 mynr = nr
182 adpref = 'ad'
183 write(fname(1:80),'(a)') ' '
184
185 il = ilnblnk(active_var_file)
186
187 write(fname(1:2),'(a)') adpref
188 write(fname(3:2+il),'(a)') active_var_file(1:il)
189
190 call active_read_rl( fname, adactive_var,
191 & doglobalread, lAdInit, irec, mynr,
192 & REVERSE_SIMULATION, myiter, mythid )
193
194 end
195
196 CBOP
197 C !ROUTINE: adactive_read_xz
198 C !INTERFACE:
199 subroutine adactive_read_xz(
200 I active_var_file,
201 I irec,
202 I doglobalread,
203 I lAdInit,
204 I myiter,
205 I mythid,
206 I adactive_var
207 & )
208
209 C !DESCRIPTION: \bv
210 c ==================================================================
211 c SUBROUTINE adactive_read_xz
212 c ==================================================================
213 c o Adjoint of active_read_xz.
214 c started: heimbach@mit.edu 05-Mar-2001
215 c ==================================================================
216 c SUBROUTINE adactive_read_xz
217 c ==================================================================
218 C \ev
219
220 C !USES:
221 implicit none
222
223 c == global variables ==
224 #include "EEPARAMS.h"
225 #include "SIZE.h"
226
227 c == routine arguments ==
228 c active_var_file: filename
229 c adactive_var: array
230 c irec: record number
231 c myIter: number of optimization iteration (default: 0)
232 c mythid: thread number for this instance
233 c doglobalread: flag for global or local read/write
234 c (default: .false.)
235 c lAdInit: initialisation of corresponding adjoint
236 c variable and write to active file
237 character*(*) active_var_file
238 _RL adactive_var(1-olx:snx+olx,nr,nsx,nsy)
239 integer irec
240 integer myiter,mythid
241 logical doglobalread
242 logical lAdInit
243
244 C !LOCAL VARIABLES:
245 c == local variables ==
246 integer mynr
247 integer il
248 integer ilnblnk
249 character*(2) adpref
250 character*(80) fname
251
252 c == functions ==
253 external ilnblnk
254
255 c == end of interface ==
256 CEOP
257
258 mynr = nr
259 adpref = 'ad'
260 write(fname(1:80),'(a)') ' '
261
262 il = ilnblnk(active_var_file)
263
264 write(fname(1:2),'(a)') adpref
265 write(fname(3:2+il),'(a)') active_var_file(1:il)
266
267 call active_read_xz_rl( fname, adactive_var,
268 & doglobalread, lAdInit, irec, mynr,
269 & REVERSE_SIMULATION, myiter, mythid )
270
271 end
272
273 CBOP
274 C !ROUTINE: adactive_read_yz
275 C !INTERFACE:
276 subroutine adactive_read_yz(
277 I active_var_file,
278 I irec,
279 I doglobalread,
280 I lAdInit,
281 I myiter,
282 I mythid,
283 I adactive_var
284 & )
285
286 C !DESCRIPTION: \bv
287 c ==================================================================
288 c SUBROUTINE adactive_read_yz
289 c ==================================================================
290 c o Adjoint of active_read_yz.
291 c started: heimbach@mit.edu 05-Mar-2001
292 c ==================================================================
293 c SUBROUTINE adactive_read_yz
294 c ==================================================================
295 C \ev
296
297 C !USES:
298 implicit none
299
300 c == global variables ==
301 #include "EEPARAMS.h"
302 #include "SIZE.h"
303
304 c == routine arguments ==
305 c active_var_file: filename
306 c adactive_var: array
307 c irec: record number
308 c myIter: number of optimization iteration (default: 0)
309 c mythid: thread number for this instance
310 c doglobalread: flag for global or local read/write
311 c (default: .false.)
312 c lAdInit: initialisation of corresponding adjoint
313 c variable and write to active file
314 character*(*) active_var_file
315 _RL adactive_var(1-oly:sny+oly,nr,nsx,nsy)
316 integer irec
317 integer myiter,mythid
318 logical doglobalread
319 logical lAdInit
320
321 C !LOCAL VARIABLES:
322 c == local variables ==
323 integer mynr
324 integer il
325 integer ilnblnk
326 character*(2) adpref
327 character*(80) fname
328
329 c == functions ==
330 external ilnblnk
331
332 c == end of interface ==
333 CEOP
334
335 mynr = nr
336 adpref = 'ad'
337 write(fname(1:80),'(a)') ' '
338
339 il = ilnblnk(active_var_file)
340
341 write(fname(1:2),'(a)') adpref
342 write(fname(3:2+il),'(a)') active_var_file(1:il)
343
344 call active_read_yz_rl( fname, adactive_var,
345 & doglobalread, lAdInit, irec, mynr,
346 & REVERSE_SIMULATION, myiter, mythid )
347
348 end
349
350 CBOP
351 C !ROUTINE: adactive_read_xy
352 C !INTERFACE:
353 subroutine adactive_write_xy(
354 I active_var_file,
355 I irec,
356 I myiter,
357 I mythid,
358 U adactive_var,
359 I dummy
360 & )
361
362
363 C !DESCRIPTION: \bv
364 c ==================================================================
365 c SUBROUTINE adactive_write_xy
366 c ==================================================================
367 c o Adjoint of active_write_xy.
368 c started: Christian Eckert eckert@mit.edu 24-May-1999
369 c ==================================================================
370 c SUBROUTINE adactive_write_xy
371 c ==================================================================
372 C \ev
373
374 C !USES:
375 implicit none
376
377 c == global variables ==
378 #include "EEPARAMS.h"
379 #include "SIZE.h"
380
381 c == routine arguments ==
382 c active_var_file: filename
383 c adactive_var: array
384 c irec: record number
385 c myIter: number of optimization iteration (default: 0)
386 c mythid: thread number for this instance
387 character*(*) active_var_file
388 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
389 integer irec
390 integer myiter,mythid
391 _RL dummy
392
393 C !LOCAL VARIABLES:
394 c == local variables ==
395 integer mynr
396 integer il
397 integer ilnblnk
398 character*(2) adpref
399 character*(80) fname
400 logical globalfile
401
402 c == functions ==
403 external ilnblnk
404
405 c == end of interface ==
406 CEOP
407
408 mynr = 1
409 adpref = 'ad'
410 write(fname(1:80),'(a)') ' '
411
412 il = ilnblnk(active_var_file)
413
414 write(fname(1:2),'(a)') adpref
415 write(fname(3:2+il),'(a)') active_var_file(1:il)
416
417 globalfile = .false.
418
419 call active_write_rl( fname, adactive_var,
420 & globalfile, irec, mynr,
421 & REVERSE_SIMULATION, myiter, mythid )
422
423 end
424
425 CBOP
426 C !ROUTINE: adactive_read_xyz
427 C !INTERFACE:
428 subroutine adactive_write_xyz(
429 I active_var_file,
430 I irec,
431 I myiter,
432 I mythid,
433 U adactive_var,
434 I dummy
435 & )
436
437
438 C !DESCRIPTION: \bv
439 c ==================================================================
440 c SUBROUTINE adactive_write_xyz
441 c ==================================================================
442 c o Adjoint of active_write_xyz.
443 c started: Christian Eckert eckert@mit.edu 24-May-1999
444 c ==================================================================
445 c SUBROUTINE adactive_write_xyz
446 c ==================================================================
447 C \ev
448
449 C !USES:
450 implicit none
451
452 c == global variables ==
453 #include "EEPARAMS.h"
454 #include "SIZE.h"
455
456 c == routine arguments ==
457 c active_var_file: filename
458 c adactive_var: array
459 c irec: record number
460 c myIter: number of optimization iteration (default: 0)
461 c mythid: thread number for this instance
462 character*(*) active_var_file
463 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
464 integer irec
465 integer myiter,mythid
466 _RL dummy
467
468 C !LOCAL VARIABLES:
469 c == local variables ==
470 integer mynr
471 integer il
472 integer ilnblnk
473 character*(2) adpref
474 character*(80) fname
475 logical globalfile
476
477 c == functions ==
478 external ilnblnk
479
480 c == end of interface ==
481 CEOP
482
483 mynr = nr
484 adpref = 'ad'
485 write(fname(1:80),'(a)') ' '
486
487 il = ilnblnk(active_var_file)
488
489 write(fname(1:2),'(a)') adpref
490 write(fname(3:2+il),'(a)') active_var_file(1:il)
491
492 globalfile = .false.
493
494 call active_write_rl( fname, adactive_var,
495 & globalfile, irec, mynr,
496 & REVERSE_SIMULATION, myiter, mythid )
497
498 end
499
500 CBOP
501 C !ROUTINE: adactive_read_xz
502 C !INTERFACE:
503 subroutine adactive_write_xz(
504 I active_var_file,
505 I irec,
506 I myiter,
507 I mythid,
508 U adactive_var,
509 I dummy
510 & )
511
512
513 C !DESCRIPTION: \bv
514 c ==================================================================
515 c SUBROUTINE adactive_write_xz
516 c ==================================================================
517 c o Adjoint of active_write_xz.
518 c started: heimbach@mit.edu 05-Mar-2001
519 c ==================================================================
520 c SUBROUTINE adactive_write_xz
521 c ==================================================================
522 C \ev
523
524 C !USES:
525 implicit none
526
527 c == global variables ==
528 #include "EEPARAMS.h"
529 #include "SIZE.h"
530
531 c == routine arguments ==
532 c active_var_file: filename
533 c adactive_var: array
534 c irec: record number
535 c myIter: number of optimization iteration (default: 0)
536 c mythid: thread number for this instance
537 character*(*) active_var_file
538 _RL adactive_var(1-olx:snx+olx,nr,nsx,nsy)
539 integer irec
540 integer myiter,mythid
541 _RL dummy
542
543 C !LOCAL VARIABLES:
544 c == local variables ==
545 integer mynr
546 integer il
547 integer ilnblnk
548 character*(2) adpref
549 character*(80) fname
550 logical globalfile
551
552 c == functions ==
553 external ilnblnk
554
555 c == end of interface ==
556 CEOP
557
558 mynr = nr
559 adpref = 'ad'
560 write(fname(1:80),'(a)') ' '
561
562 il = ilnblnk(active_var_file)
563
564 write(fname(1:2),'(a)') adpref
565 write(fname(3:2+il),'(a)') active_var_file(1:il)
566
567 globalfile = .false.
568
569 call active_write_xz_rl( fname, adactive_var,
570 & globalfile, irec, mynr,
571 & REVERSE_SIMULATION, myiter, mythid )
572
573 end
574
575 CBOP
576 C !ROUTINE: adactive_read_yz
577 C !INTERFACE:
578 subroutine adactive_write_yz(
579 I active_var_file,
580 I irec,
581 I myiter,
582 I mythid,
583 U adactive_var,
584 I dummy
585 & )
586
587
588 C !DESCRIPTION: \bv
589 c ==================================================================
590 c SUBROUTINE adactive_write_yz
591 c ==================================================================
592 c o Adjoint of active_write_yz.
593 c started: heimbach@mit.edu 05-Mar-2001
594 c ==================================================================
595 c SUBROUTINE adactive_write_yz
596 c ==================================================================
597 C \ev
598
599 C !USES:
600 implicit none
601
602 c == global variables ==
603 #include "EEPARAMS.h"
604 #include "SIZE.h"
605
606 c == routine arguments ==
607 c active_var_file: filename
608 c adactive_var: array
609 c irec: record number
610 c myIter: number of optimization iteration (default: 0)
611 c mythid: thread number for this instance
612 character*(*) active_var_file
613 _RL adactive_var(1-oly:sny+oly,nr,nsx,nsy)
614 integer irec
615 integer myiter,mythid
616 _RL dummy
617
618 C !LOCAL VARIABLES:
619 c == local variables ==
620 integer mynr
621 integer il
622 integer ilnblnk
623 character*(2) adpref
624 character*(80) fname
625 logical globalfile
626
627 c == functions ==
628 external ilnblnk
629
630 c == end of interface ==
631 CEOP
632
633 mynr = nr
634 adpref = 'ad'
635 write(fname(1:80),'(a)') ' '
636
637 il = ilnblnk(active_var_file)
638
639 write(fname(1:2),'(a)') adpref
640 write(fname(3:2+il),'(a)') active_var_file(1:il)
641
642 globalfile = .false.
643
644 call active_write_yz_rl( fname, adactive_var,
645 & globalfile, irec, mynr,
646 & REVERSE_SIMULATION, myiter, mythid )
647
648 end
649
650
651
652 subroutine adactive_read_tile_xy(
653 I active_var_file,
654 I irec,
655 I doglobalread,
656 I bi,
657 I bj,
658 I lAdInit,
659 I myOptimIter,
660 I mythid,
661 U adactive_var
662 & )
663
664 c ==================================================================
665 c SUBROUTINE active_read_tile_xy
666 c ==================================================================
667 c
668 c o Adjoint of active_read_tile_xy.
669 c
670 c started: Christian Eckert eckert@mit.edu 24-May-1999
671 c
672 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
673 c
674 c - Restructured the code in order to create a package
675 c for the MITgcmUV.c
676 c
677 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
678 c
679 c - Added routines that do active writes on tiles
680 c instead of a whole thread.
681 c
682 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
683 c
684 c - changed suboutine argument list:
685 c dropped mycurrentiter, mycurrenttime
686 c
687 c ==================================================================
688 c SUBROUTINE active_read_tile_xy
689 c ==================================================================
690
691 implicit none
692
693 c == global variables ==
694
695 #include "EEPARAMS.h"
696 #include "SIZE.h"
697
698 c == routine arguments ==
699
700 character*(*) active_var_file
701 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
702 integer irec
703 integer myOptimIter
704 integer mythid
705 integer bi
706 integer bj
707 logical doglobalread
708 logical lAdInit
709
710 c == local variables ==
711
712 integer mynr
713 integer il
714 integer ilnblnk
715 character*(2) adpref
716 character*(80) fname
717
718 c == functions ==
719
720 external ilnblnk
721
722 c == end of interface ==
723
724 mynr = 1
725 adpref = 'ad'
726 write(fname(1:80),'(a)') ' '
727
728 il = ilnblnk(active_var_file)
729
730 write(fname(1:2), '(a)') adpref
731 write(fname(3:2+il),'(a)') active_var_file(1:il)
732
733 call active_read_tile_rl(
734 I fname,
735 U adactive_var,
736 I doglobalread,
737 I lAdInit,
738 I irec,
739 I mynr,
740 I bi,
741 I bj,
742 I REVERSE_SIMULATION,
743 I myOptimIter,
744 I mythid
745 & )
746
747 end
748
749
750 subroutine adactive_read_tile_xyz(
751 I active_var_file,
752 I irec,
753 I doglobalread,
754 I bi,
755 I bj,
756 I lAdInit,
757 I myOptimIter,
758 I mythid,
759 U adactive_var
760 & )
761
762 c ==================================================================
763 c SUBROUTINE adactive_read_tile_xyz
764 c ==================================================================
765 c
766 c o Adjoint of active_read_tile_xyz.
767 c
768 c started: Christian Eckert eckert@mit.edu 24-May-1999
769 c
770 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
771 c
772 c - Restructured the code in order to create a package
773 c for the MITgcmUV.c
774 c
775 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
776 c
777 c - Added routines that do active writes on tiles
778 c instead of a whole thread.
779 c
780 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
781 c
782 c - changed suboutine argument list:
783 c dropped mycurrentiter, mycurrenttime
784 c
785 c ==================================================================
786 c SUBROUTINE adactive_read_tile_xyz
787 c ==================================================================
788
789 implicit none
790
791 c == global variables ==
792
793 #include "EEPARAMS.h"
794 #include "SIZE.h"
795
796 c == routine arguments ==
797
798 character*(*) active_var_file
799 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
800 integer irec
801 integer myOptimIter
802 integer mythid
803 integer bi
804 integer bj
805 logical doglobalread
806 logical lAdInit
807
808 c == local variables ==
809
810 integer mynr
811 integer il
812 integer ilnblnk
813 character*(2) adpref
814 character*(80) fname
815
816 c == functions ==
817
818 external ilnblnk
819
820 c == end of interface ==
821
822 mynr = nr
823 adpref = 'ad'
824 write(fname(1:80),'(a)') ' '
825
826 il = ilnblnk(active_var_file)
827
828 write(fname(1:2), '(a)') adpref
829 write(fname(3:2+il),'(a)') active_var_file(1:il)
830
831 call active_read_tile_rl(
832 I fname,
833 U adactive_var,
834 I doglobalread,
835 I lAdInit,
836 I irec,
837 I mynr,
838 I bi,
839 I bj,
840 I REVERSE_SIMULATION,
841 I myOptimIter,
842 I mythid
843 & )
844
845 end
846
847
848 subroutine adactive_write_tile_xy(
849 I active_var_file,
850 I irec,
851 I bi,
852 I bj,
853 I myOptimIter,
854 I mythid,
855 U adactive_var
856 & )
857
858
859 c ==================================================================
860 c SUBROUTINE adactive_write_tile_xy
861 c ==================================================================
862 c
863 c o Adjoint of active_write_tile_xy.
864 c
865 c started: Christian Eckert eckert@mit.edu 24-May-1999
866 c
867 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
868 c
869 c - Restructured the code in order to create a package
870 c for the MITgcmUV.c
871 c
872 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
873 c
874 c - Added routines that do active writes on tiles
875 c instead of a whole thread.
876 c
877 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
878 c
879 c - changed suboutine argument list:
880 c dropped mycurrentiter, mycurrenttime
881 c
882 c ==================================================================
883 c SUBROUTINE adactive_write_tile_xy
884 c ==================================================================
885
886 implicit none
887
888 c == global variables ==
889
890 #include "EEPARAMS.h"
891 #include "SIZE.h"
892
893 c == routine arguments ==
894
895 character*(*) active_var_file
896 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
897 integer irec
898 integer bi
899 integer bj
900 integer myOptimIter
901 integer mythid
902
903 c == local variables ==
904
905 integer mynr
906 integer il
907 integer ilnblnk
908 character*(2) adpref
909 character*(80) fname
910 logical globalfile
911
912 c == functions ==
913
914 external ilnblnk
915
916 c == end of interface ==
917
918 mynr = 1
919 adpref = 'ad'
920 write(fname(1:80),'(a)') ' '
921
922 il = ilnblnk(active_var_file)
923
924 write(fname(1:2), '(a)') adpref
925 write(fname(3:2+il),'(a)') active_var_file(1:il)
926
927 globalfile = .false.
928
929 call active_write_tile_rl(
930 I fname,
931 U adactive_var,
932 I globalfile,
933 I irec,
934 I mynr,
935 I bi,
936 I bj,
937 I REVERSE_SIMULATION,
938 I myOptimIter,
939 I mythid
940 & )
941
942 end
943
944
945 subroutine adactive_write_tile_xyz(
946 I active_var_file,
947 I irec,
948 I bi,
949 I bj,
950 I myOptimIter,
951 I mythid,
952 U adactive_var
953 & )
954
955
956 c ==================================================================
957 c SUBROUTINE adactive_write_tile_xyz
958 c ==================================================================
959 c
960 c o Adjoint of active_write_tile_xyz.
961 c
962 c started: Christian Eckert eckert@mit.edu 24-May-1999
963 c
964 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
965 c
966 c - Restructured the code in order to create a package
967 c for the MITgcmUV.c
968 c
969 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
970 c
971 c - Added routines that do active writes on tiles
972 c instead of a whole thread.
973 c
974 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
975 c
976 c - changed suboutine argument list:
977 c dropped mycurrentiter, mycurrenttime
978 c
979 c ==================================================================
980 c SUBROUTINE adactive_write_tile_xyz
981 c ==================================================================
982
983 implicit none
984
985 c == global variables ==
986
987 #include "EEPARAMS.h"
988 #include "SIZE.h"
989
990 c == routine arguments ==
991
992 character*(*) active_var_file
993 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
994 integer irec
995 integer bi
996 integer bj
997 integer myOptimIter
998 integer mythid
999
1000 c == local variables ==
1001
1002 integer mynr
1003 integer il
1004 integer ilnblnk
1005 character*(2) adpref
1006 character*(80) fname
1007 logical globalfile
1008
1009 c == functions ==
1010
1011 external ilnblnk
1012
1013 c == end of interface ==
1014
1015 mynr = nr
1016 adpref = 'ad'
1017 write(fname(1:80),'(a)') ' '
1018
1019 il = ilnblnk(active_var_file)
1020
1021 write(fname(1:2),'(a)') adpref
1022 write(fname(3:2+il),'(a)') active_var_file(1:il)
1023
1024 globalfile = .false.
1025
1026 call active_write_tile_rl(
1027 I fname,
1028 U adactive_var,
1029 I globalfile,
1030 I irec,
1031 I mynr,
1032 I bi,
1033 I bj,
1034 I REVERSE_SIMULATION,
1035 I myOptimIter,
1036 I mythid
1037 & )
1038
1039 end
1040
1041 subroutine adactive_read_profile(
1042 I active_num_file,
1043 I nadactive_var,
1044 I active_varnum,
1045 I irec,
1046 I lAdInit,
1047 I myiter,
1048 I mythid,
1049 I adactive_var
1050 & )
1051
1052 C !DESCRIPTION: \bv
1053 c ==================================================================
1054 c SUBROUTINE adactive_read_profile
1055 c ==================================================================
1056 c o Adjoint of active_read_profile.
1057 c ==================================================================
1058 implicit none
1059
1060 c == global variables ==
1061 #include "EEPARAMS.h"
1062 #include "SIZE.h"
1063 #include "profiles.h"
1064
1065 c == routine arguments ==
1066 c active_var_file: filename
1067 c nadactive_var: integer size of adactive_var
1068 c adactive_var: array
1069 c irec: record number
1070 c myIter: number of optimization iteration (default: 0)
1071 c mythid: thread number for this instance
1072 c doglobalread: flag for global or local read/write
1073 c (default: .false.)
1074 c lAdInit: initialisation of corresponding adjoint
1075 c variable and write to active file
1076 integer nadactive_var,active_num_file
1077 _RL adactive_var(nadactive_var)
1078 integer irec,active_varnum
1079 integer myiter
1080 integer mythid
1081 logical lAdInit
1082
1083 call active_read_profile_rl( fidadjoint(active_num_file) ,
1084 & active_num_file,
1085 & nadactive_var, adactive_var, active_varnum, lAdInit,
1086 & irec, prof_ind_glob(active_num_file,irec),
1087 & REVERSE_SIMULATION, myiter, mythid)
1088
1089 end
1090
1091 c ==================================================================
1092 c ==================================================================
1093 c ==================================================================
1094
1095
1096 subroutine adactive_write_profile(
1097 I active_num_file,
1098 I nadactive_var,
1099 I active_varnum,
1100 I irec,
1101 I myiter,
1102 I mythid,
1103 I adactive_var,
1104 I dummy
1105 & )
1106
1107 C !DESCRIPTION: \bv
1108 c ==================================================================
1109 c SUBROUTINE adactive_write_profile
1110 c ==================================================================
1111 c o Adjoint of active_write_profile.
1112 c ==================================================================
1113
1114 implicit none
1115
1116 c == global variables ==
1117 #include "EEPARAMS.h"
1118 #include "SIZE.h"
1119 #include "profiles.h"
1120
1121 c == routine arguments ==
1122 c active_var_file: filename
1123 c nadactive_var: integer size of adactive_var
1124 c adactive_var: array
1125 c irec: record number
1126 c myIter: number of optimization iteration (default: 0)
1127 c mythid: thread number for this instance
1128 c doglobalread: flag for global or local read/write
1129 c (default: .false.)
1130 c lAdInit: initialisation of corresponding adjoint
1131 c variable and write to active file
1132 integer nadactive_var,active_num_file
1133 _RL adactive_var(nadactive_var)
1134 integer irec,active_varnum
1135 integer myiter
1136 integer mythid
1137 _RL dummy
1138
1139
1140 c == end of interface ==
1141
1142 call active_write_profile_rl( fidadjoint(active_num_file) ,
1143 & active_num_file,
1144 & nadactive_var, adactive_var, active_varnum,
1145 & irec, prof_ind_glob(active_num_file,irec),
1146 & REVERSE_SIMULATION, myiter, mythid)
1147
1148 end
1149
1150 c ==================================================================
1151
1152

  ViewVC Help
Powered by ViewVC 1.1.22