/[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.1 - (show annotations) (download)
Sun Mar 25 22:33:53 2001 UTC (23 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint40pre3, checkpoint40pre1, checkpoint40pre7, checkpoint40pre6, checkpoint40pre9, checkpoint40pre8, checkpoint38, checkpoint40pre2, checkpoint40pre4, c37_adj, checkpoint39, checkpoint40pre5, checkpoint42, checkpoint40, checkpoint41
Modifications and additions to enable automatic differentiation.
Detailed info's in doc/notes_c37_adj.txt

1
2 CADJ SUBROUTINE active_read_rl INPUT = 1, 2, 3, 4, 5, 6, 7, 8, 9
3 CADJ SUBROUTINE active_read_rl OUTPUT = 2
4
5 CADJ SUBROUTINE active_write_rl INPUT = 1, 2, 3, 4, 5, 6, 7, 8
6 CADJ SUBROUTINE active_write_rl OUTPUT = 2
7
8 CADJ SUBROUTINE active_read_tile_rl INPUT = 1, 2, 3, 4, 5, 6, 7, 8, 9
9 CADJ SUBROUTINE active_read_tile_rl INPUT += 10, 11
10 CADJ SUBROUTINE active_read_tile_rl OUTPUT = 2
11
12 CADJ SUBROUTINE active_write_tile_rl INPUT = 1, 2, 3, 4, 5, 6, 7, 8, 9
13 CADJ SUBROUTINE active_write_tile_rl INPUT += 10
14 CADJ SUBROUTINE active_write_tile_rl OUTPUT = 2
15
16 #include "CPP_OPTIONS.h"
17
18 c ==================================================================
19 c
20 c active_files_ad.F: Routines to handle the I/O of the active file
21 c for the adjoint calculations. All files are
22 c direct access files.
23 c
24 c Routines
25 c
26 c o adactive_read_xy - Adjoint of active_read_xy
27 c o adactive_read_xyz - Adjoint of active_read_xyz
28 c o adactive_write_xy - Adjoint of active_write_xy
29 c o adactive_write_xyz - Adjoint of active_write_xyz
30 c
31 c o adactive_read_tile_xy - Adjoint of active_read_tile_xy
32 c o adactive_read_tile_xyz - Adjoint of active_read_tile_xyz
33 c o adactive_write_tile_xy - Adjoint of active_write_tile_xy
34 c o adactive_write_tile_xyz - Adjoint of active_write_tile_xyz
35 c
36 c
37 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
38 c
39 c - Added routines that do active writes on tiles
40 c instead of a whole thread.
41 c
42 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
43 c
44 c - changed suboutine argument list:
45 c dropped mycurrentiter, mycurrenttime
46 c
47 c ==================================================================
48
49 subroutine adactive_read_xy(
50 I active_var_file,
51 I irec,
52 I doglobalread,
53 I lAdInit,
54 I myiter,
55 I mythid,
56 I adactive_var
57 & )
58
59 c ==================================================================
60 c SUBROUTINE active_read_xy
61 c ==================================================================
62 c
63 c o Adjoint of active_read_xy.
64 c
65 c started: Christian Eckert eckert@mit.edu 24-May-1999
66 c
67 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
68 c
69 c - Restructured the code in order to create a package
70 c for the MITgcmUV.
71 c
72 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
73 c
74 c - changed suboutine argument list:
75 c dropped mycurrentiter, mycurrenttime
76 c
77 c ==================================================================
78 c SUBROUTINE active_read_xy
79 c ==================================================================
80
81 implicit none
82
83 c == global variables ==
84
85 #include "EEPARAMS.h"
86 #include "SIZE.h"
87
88 c == routine arguments ==
89
90 character*(*) active_var_file
91 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
92 integer irec
93 integer myiter,mythid
94 logical doglobalread
95 logical lAdInit
96
97 c == local variables ==
98
99 integer mynr
100 integer il
101 integer ilnblnk
102 character*(2) adpref
103 character*(80) fname
104
105 c == functions ==
106
107 external ilnblnk
108
109 c == end of interface ==
110
111 mynr = 1
112 adpref = 'ad'
113 write(fname(1:80),'(a)') ' '
114
115 il = ilnblnk(active_var_file)
116
117 write(fname(1:2),'(a)') adpref
118 write(fname(3:2+il),'(a)') active_var_file(1:il)
119
120 call active_read_rl( fname, adactive_var,
121 & doglobalread, lAdInit, irec, mynr,
122 & REVERSE_SIMULATION, myiter, mythid )
123
124 end
125
126 subroutine adactive_read_xyz(
127 I active_var_file,
128 I irec,
129 I doglobalread,
130 I lAdInit,
131 I myiter,
132 I mythid,
133 I adactive_var
134 & )
135
136 c ==================================================================
137 c SUBROUTINE adactive_read_xyz
138 c ==================================================================
139 c
140 c o Adjoint of active_read_xyz.
141 c
142 c started: Christian Eckert eckert@mit.edu 24-May-1999
143 c
144 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
145 c
146 c - Restructured the code in order to create a package
147 c for the MITgcmUV.
148 c
149 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
150 c
151 c - changed suboutine argument list:
152 c dropped mycurrentiter, mycurrenttime
153 c
154 c ==================================================================
155 c SUBROUTINE adactive_read_xyz
156 c ==================================================================
157
158 implicit none
159
160 c == global variables ==
161
162 #include "EEPARAMS.h"
163 #include "SIZE.h"
164
165 c == routine arguments ==
166
167 character*(*) active_var_file
168 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
169 integer irec
170 integer myiter,mythid
171 logical doglobalread
172 logical lAdInit
173
174 c == local variables ==
175
176 integer mynr
177 integer il
178 integer ilnblnk
179 character*(2) adpref
180 character*(80) fname
181
182 c == functions ==
183
184 external ilnblnk
185
186 c == end of interface ==
187
188 mynr = nr
189 adpref = 'ad'
190 write(fname(1:80),'(a)') ' '
191
192 il = ilnblnk(active_var_file)
193
194 write(fname(1:2),'(a)') adpref
195 write(fname(3:2+il),'(a)') active_var_file(1:il)
196
197 call active_read_rl( fname, adactive_var,
198 & doglobalread, lAdInit, irec, mynr,
199 & REVERSE_SIMULATION, myiter, mythid )
200
201 end
202
203 subroutine adactive_write_xy(
204 I active_var_file,
205 I irec,
206 I myiter,
207 I mythid,
208 U adactive_var,
209 I dummy
210 & )
211
212
213 c ==================================================================
214 c SUBROUTINE adactive_write_xy
215 c ==================================================================
216 c
217 c o Adjoint of active_write_xy.
218 c
219 c started: Christian Eckert eckert@mit.edu 24-May-1999
220 c
221 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
222 c
223 c - Restructured the code in order to create a package
224 c for the MITgcmUV.
225 c
226 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
227 c
228 c - changed suboutine argument list:
229 c dropped mycurrentiter, mycurrenttime
230 c
231 c ==================================================================
232 c SUBROUTINE adactive_write_xy
233 c ==================================================================
234
235 implicit none
236
237 c == global variables ==
238
239 #include "EEPARAMS.h"
240 #include "SIZE.h"
241
242 c == routine arguments ==
243
244 character*(*) active_var_file
245 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
246 integer irec
247 integer myiter,mythid
248 _RL dummy
249
250 c == local variables ==
251
252 integer mynr
253 integer il
254 integer ilnblnk
255 character*(2) adpref
256 character*(80) fname
257 logical globalfile
258
259 c == functions ==
260
261 external ilnblnk
262
263 c == end of interface ==
264
265 mynr = 1
266 adpref = 'ad'
267 write(fname(1:80),'(a)') ' '
268
269 il = ilnblnk(active_var_file)
270
271 write(fname(1:2),'(a)') adpref
272 write(fname(3:2+il),'(a)') active_var_file(1:il)
273
274 globalfile = .false.
275
276 call active_write_rl( fname, adactive_var,
277 & globalfile, irec, mynr,
278 & REVERSE_SIMULATION, myiter, mythid )
279
280 end
281
282
283 subroutine adactive_write_xyz(
284 I active_var_file,
285 I irec,
286 I myiter,
287 I mythid,
288 U adactive_var,
289 I dummy
290 & )
291
292
293 c ==================================================================
294 c SUBROUTINE adactive_write_xyz
295 c ==================================================================
296 c
297 c o Adjoint of active_write_xyz.
298 c
299 c started: Christian Eckert eckert@mit.edu 24-May-1999
300 c
301 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
302 c
303 c - Restructured the code in order to create a package
304 c for the MITgcmUV.
305 c
306 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
307 c
308 c - changed suboutine argument list:
309 c dropped mycurrentiter, mycurrenttime
310 c
311 c ==================================================================
312 c SUBROUTINE adactive_write_xyz
313 c ==================================================================
314
315 implicit none
316
317 c == global variables ==
318
319 #include "EEPARAMS.h"
320 #include "SIZE.h"
321
322 c == routine arguments ==
323
324 character*(*) active_var_file
325 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
326 integer irec
327 integer myiter,mythid
328 _RL dummy
329
330 c == local variables ==
331
332 integer mynr
333 integer il
334 integer ilnblnk
335 character*(2) adpref
336 character*(80) fname
337 logical globalfile
338
339 c == functions ==
340
341 external ilnblnk
342
343 c == end of interface ==
344
345 mynr = nr
346 adpref = 'ad'
347 write(fname(1:80),'(a)') ' '
348
349 il = ilnblnk(active_var_file)
350
351 write(fname(1:2),'(a)') adpref
352 write(fname(3:2+il),'(a)') active_var_file(1:il)
353
354 globalfile = .false.
355
356 call active_write_rl( fname, adactive_var,
357 & globalfile, irec, mynr,
358 & REVERSE_SIMULATION, myiter, mythid )
359
360 end
361
362
363
364 subroutine adactive_read_tile_xy(
365 I active_var_file,
366 I irec,
367 I doglobalread,
368 I bi,
369 I bj,
370 I lAdInit,
371 I myOptimIter,
372 I mythid,
373 U adactive_var
374 & )
375
376 c ==================================================================
377 c SUBROUTINE active_read_tile_xy
378 c ==================================================================
379 c
380 c o Adjoint of active_read_tile_xy.
381 c
382 c started: Christian Eckert eckert@mit.edu 24-May-1999
383 c
384 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
385 c
386 c - Restructured the code in order to create a package
387 c for the MITgcmUV.c
388 c
389 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
390 c
391 c - Added routines that do active writes on tiles
392 c instead of a whole thread.
393 c
394 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
395 c
396 c - changed suboutine argument list:
397 c dropped mycurrentiter, mycurrenttime
398 c
399 c ==================================================================
400 c SUBROUTINE active_read_tile_xy
401 c ==================================================================
402
403 implicit none
404
405 c == global variables ==
406
407 #include "EEPARAMS.h"
408 #include "SIZE.h"
409
410 c == routine arguments ==
411
412 character*(*) active_var_file
413 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
414 integer irec
415 integer myOptimIter
416 integer mythid
417 integer bi
418 integer bj
419 logical doglobalread
420 logical lAdInit
421
422 c == local variables ==
423
424 integer mynr
425 integer il
426 integer ilnblnk
427 character*(2) adpref
428 character*(80) fname
429
430 c == functions ==
431
432 external ilnblnk
433
434 c == end of interface ==
435
436 mynr = 1
437 adpref = 'ad'
438 write(fname(1:80),'(a)') ' '
439
440 il = ilnblnk(active_var_file)
441
442 write(fname(1:2), '(a)') adpref
443 write(fname(3:2+il),'(a)') active_var_file(1:il)
444
445 call active_read_tile_rl(
446 I fname,
447 U adactive_var,
448 I doglobalread,
449 I lAdInit,
450 I irec,
451 I mynr,
452 I bi,
453 I bj,
454 I REVERSE_SIMULATION,
455 I myOptimIter,
456 I mythid
457 & )
458
459 end
460
461
462 subroutine adactive_read_tile_xyz(
463 I active_var_file,
464 I irec,
465 I doglobalread,
466 I bi,
467 I bj,
468 I lAdInit,
469 I myOptimIter,
470 I mythid,
471 U adactive_var
472 & )
473
474 c ==================================================================
475 c SUBROUTINE adactive_read_tile_xyz
476 c ==================================================================
477 c
478 c o Adjoint of active_read_tile_xyz.
479 c
480 c started: Christian Eckert eckert@mit.edu 24-May-1999
481 c
482 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
483 c
484 c - Restructured the code in order to create a package
485 c for the MITgcmUV.c
486 c
487 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
488 c
489 c - Added routines that do active writes on tiles
490 c instead of a whole thread.
491 c
492 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
493 c
494 c - changed suboutine argument list:
495 c dropped mycurrentiter, mycurrenttime
496 c
497 c ==================================================================
498 c SUBROUTINE adactive_read_tile_xyz
499 c ==================================================================
500
501 implicit none
502
503 c == global variables ==
504
505 #include "EEPARAMS.h"
506 #include "SIZE.h"
507
508 c == routine arguments ==
509
510 character*(*) active_var_file
511 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
512 integer irec
513 integer myOptimIter
514 integer mythid
515 integer bi
516 integer bj
517 logical doglobalread
518 logical lAdInit
519
520 c == local variables ==
521
522 integer mynr
523 integer il
524 integer ilnblnk
525 character*(2) adpref
526 character*(80) fname
527
528 c == functions ==
529
530 external ilnblnk
531
532 c == end of interface ==
533
534 mynr = nr
535 adpref = 'ad'
536 write(fname(1:80),'(a)') ' '
537
538 il = ilnblnk(active_var_file)
539
540 write(fname(1:2), '(a)') adpref
541 write(fname(3:2+il),'(a)') active_var_file(1:il)
542
543 call active_read_tile_rl(
544 I fname,
545 U adactive_var,
546 I doglobalread,
547 I lAdInit,
548 I irec,
549 I mynr,
550 I bi,
551 I bj,
552 I REVERSE_SIMULATION,
553 I myOptimIter,
554 I mythid
555 & )
556
557 end
558
559
560 subroutine adactive_write_tile_xy(
561 I active_var_file,
562 I irec,
563 I bi,
564 I bj,
565 I myOptimIter,
566 I mythid,
567 U adactive_var
568 & )
569
570
571 c ==================================================================
572 c SUBROUTINE adactive_write_tile_xy
573 c ==================================================================
574 c
575 c o Adjoint of active_write_tile_xy.
576 c
577 c started: Christian Eckert eckert@mit.edu 24-May-1999
578 c
579 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
580 c
581 c - Restructured the code in order to create a package
582 c for the MITgcmUV.c
583 c
584 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
585 c
586 c - Added routines that do active writes on tiles
587 c instead of a whole thread.
588 c
589 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
590 c
591 c - changed suboutine argument list:
592 c dropped mycurrentiter, mycurrenttime
593 c
594 c ==================================================================
595 c SUBROUTINE adactive_write_tile_xy
596 c ==================================================================
597
598 implicit none
599
600 c == global variables ==
601
602 #include "EEPARAMS.h"
603 #include "SIZE.h"
604
605 c == routine arguments ==
606
607 character*(*) active_var_file
608 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
609 integer irec
610 integer bi
611 integer bj
612 integer myOptimIter
613 integer mythid
614
615 c == local variables ==
616
617 integer mynr
618 integer il
619 integer ilnblnk
620 character*(2) adpref
621 character*(80) fname
622 logical globalfile
623
624 c == functions ==
625
626 external ilnblnk
627
628 c == end of interface ==
629
630 mynr = 1
631 adpref = 'ad'
632 write(fname(1:80),'(a)') ' '
633
634 il = ilnblnk(active_var_file)
635
636 write(fname(1:2), '(a)') adpref
637 write(fname(3:2+il),'(a)') active_var_file(1:il)
638
639 globalfile = .false.
640
641 call active_write_tile_rl(
642 I fname,
643 U adactive_var,
644 I globalfile,
645 I irec,
646 I mynr,
647 I bi,
648 I bj,
649 I REVERSE_SIMULATION,
650 I myOptimIter,
651 I mythid
652 & )
653
654 end
655
656
657 subroutine adactive_write_tile_xyz(
658 I active_var_file,
659 I irec,
660 I bi,
661 I bj,
662 I myOptimIter,
663 I mythid,
664 U adactive_var
665 & )
666
667
668 c ==================================================================
669 c SUBROUTINE adactive_write_tile_xyz
670 c ==================================================================
671 c
672 c o Adjoint of active_write_tile_xyz.
673 c
674 c started: Christian Eckert eckert@mit.edu 24-May-1999
675 c
676 c changed: Christian Eckert eckert@mit.edu 11-Feb-2000
677 c
678 c - Restructured the code in order to create a package
679 c for the MITgcmUV.c
680 c
681 c changed: Christian Eckert eckert@mit.edu 24-Apr-2000
682 c
683 c - Added routines that do active writes on tiles
684 c instead of a whole thread.
685 c
686 c changed: Patrick Heimbach heimbach@mit.edu 27-May-2000
687 c
688 c - changed suboutine argument list:
689 c dropped mycurrentiter, mycurrenttime
690 c
691 c ==================================================================
692 c SUBROUTINE adactive_write_tile_xyz
693 c ==================================================================
694
695 implicit none
696
697 c == global variables ==
698
699 #include "EEPARAMS.h"
700 #include "SIZE.h"
701
702 c == routine arguments ==
703
704 character*(*) active_var_file
705 _RL adactive_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
706 integer irec
707 integer bi
708 integer bj
709 integer myOptimIter
710 integer mythid
711
712 c == local variables ==
713
714 integer mynr
715 integer il
716 integer ilnblnk
717 character*(2) adpref
718 character*(80) fname
719 logical globalfile
720
721 c == functions ==
722
723 external ilnblnk
724
725 c == end of interface ==
726
727 mynr = nr
728 adpref = 'ad'
729 write(fname(1:80),'(a)') ' '
730
731 il = ilnblnk(active_var_file)
732
733 write(fname(1:2),'(a)') adpref
734 write(fname(3:2+il),'(a)') active_var_file(1:il)
735
736 globalfile = .false.
737
738 call active_write_tile_rl(
739 I fname,
740 U adactive_var,
741 I globalfile,
742 I irec,
743 I mynr,
744 I bi,
745 I bj,
746 I REVERSE_SIMULATION,
747 I myOptimIter,
748 I mythid
749 & )
750
751 end

  ViewVC Help
Powered by ViewVC 1.1.22