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

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

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


Revision 1.5 - (show annotations) (download)
Fri Jun 20 21:43:19 2008 UTC (15 years, 11 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint61, checkpoint61a
Changes since 1.4: +93 -7 lines
o autodiff
  Change default for TAF usage by removing argument '-nonew_arg'
  This changes TAF subroutine argument list (ordering of active var.)
  Omission of this flag leads to incompatibility w.r.t. TAMC
  To restore TAMC-compatibility, need following modifs:
  * use adoptfile tools/adjoint_options/adjoint_tamc_compatibility
  * use CPP option #define AUTODIFF_TAMC_COMPATIBILITY
  Tested TAF version is 1.9.22
  N.B.: exch2 hand-written adjoint code currently not TAMC compatible

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

  ViewVC Help
Powered by ViewVC 1.1.22