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

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

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

  ViewVC Help
Powered by ViewVC 1.1.22