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

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

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


Revision 1.9 - (hide annotations) (download)
Sat Aug 2 23:16:58 2008 UTC (15 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62c, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint62, checkpoint63, checkpoint63d, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint62b, checkpoint61f, checkpoint61n, checkpoint61q, checkpoint61e, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.8: +3 -1 lines
add cvs Header & Name

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

  ViewVC Help
Powered by ViewVC 1.1.22