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

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

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

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

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22