/[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.2 - (show annotations) (download)
Fri Sep 28 04:19:27 2001 UTC (22 years, 7 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint44e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint46f_post, checkpoint48e_post, checkpoint44f_post, checkpoint46b_post, checkpoint43a-release1mods, release1_p13, checkpoint48i_post, checkpoint46l_pre, chkpt44d_post, release1_p8, release1_p9, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint44e_pre, release1_b1, checkpoint48b_post, checkpoint43, checkpoint48c_pre, checkpoint47d_pre, release1_chkpt44d_post, checkpoint47a_post, checkpoint48d_pre, checkpoint47i_post, checkpoint47d_post, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint46j_pre, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, checkpoint46a_post, checkpoint47g_post, checkpoint46j_post, checkpoint46k_post, chkpt44c_pre, checkpoint48a_post, checkpoint45a_post, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47j_post, branch-exfmods-tag, checkpoint44g_post, checkpoint46e_pre, checkpoint48c_post, checkpoint45b_post, checkpoint46b_pre, release1-branch-end, release1_final_v1, checkpoint46c_pre, checkpoint46, checkpoint47b_post, checkpoint44b_post, checkpoint46h_pre, checkpoint46m_post, checkpoint46a_pre, checkpoint45c_post, checkpoint44h_post, checkpoint46g_post, release1_p12_pre, checkpoint47f_post, chkpt44a_pre, checkpoint46i_post, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, checkpoint46e_post, release1_beta1, checkpoint44b_pre, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, chkpt44c_post, checkpoint48g_post, checkpoint47h_post, checkpoint44f_pre, checkpoint46d_post, release1-branch_branchpoint
Branch point for: branch-exfmods-curt, release1_final, release1-branch, release1, ecco-branch, release1_50yr, release1_coupled
Changes since 1.1: +63 -87 lines
Started to add comments...

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

  ViewVC Help
Powered by ViewVC 1.1.22