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

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

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

revision 1.4 by heimbach, Mon Sep 16 18:11:58 2002 UTC revision 1.8 by heimbach, Tue Jul 26 13:10:46 2005 UTC
# Line 1  Line 1 
1    
2  #include "CPP_OPTIONS.h"  #include "AUTODIFF_OPTIONS.h"
3    
4  c     ==================================================================  c     ==================================================================
5  c  c
# Line 56  c     == global variables == Line 56  c     == global variables ==
56  #include "EEPARAMS.h"  #include "EEPARAMS.h"
57  #include "SIZE.h"  #include "SIZE.h"
58  #include "PARAMS.h"  #include "PARAMS.h"
59    #include "ctrl.h"
60    
61  c     == routine arguments ==  c     == routine arguments ==
62    
# Line 84  c     == local variables == Line 85  c     == local variables ==
85    
86        logical writeglobalfile        logical writeglobalfile
87    
88        _RL  active_data_t(1-olx:snx+olx,nsx,nsy)        _RL  active_data_t(1-olx:snx+olx,mynr,nsx,nsy)
89    
90  c     == functions ==  c     == functions ==
91    
# Line 94  c     == end of interface == Line 95  c     == end of interface ==
95    
96  c     force 64-bit io  c     force 64-bit io
97        oldPrec        = readBinaryPrec        oldPrec        = readBinaryPrec
98        readBinaryPrec = precFloat64        readBinaryPrec = ctrlprec
99        prec           = precFloat64        prec           = ctrlprec
100    
101        write(adfname(1:80),'(80a)') ' '        write(adfname(1:80),'(80a)') ' '
102        adpref = 'ad'        adpref = 'ad'
# Line 130  c         adjoint variable's file. These Line 131  c         adjoint variable's file. These
131            writeglobalfile = .false.            writeglobalfile = .false.
132            do bj = 1,nsy            do bj = 1,nsy
133               do bi = 1,nsx               do bi = 1,nsx
134                  do i = 1,snx                  do k = 1,mynr
135                     active_data_t(i,bi,bj)= 0. _d 0                     do i = 1,snx
136                          active_data_t(i,k,bi,bj)= 0. _d 0
137                       enddo
138                  enddo                  enddo
139               enddo               enddo
140            enddo            enddo
141    
142            do k = 1,mynr            call mdswritefieldxz(
              call mdswritefieldxz(  
143       &                           adfname,       &                           adfname,
144       &                           prec,       &                           prec,
145       &                           globalfile,       &                           globalfile,
146       &                           'RL',       &                           'RL',
147       &                           1,       &                           mynr,
148       &                           active_data_t,       &                           active_data_t,
149       &                           (irec-1)*mynr+k,       &                           irec,
150       &                           myOptimIter,       &                           myOptimIter,
151       &                           mythid )       &                           mythid )
           enddo  
152          endif          endif
153    
154          _END_MASTER( mythid )          _END_MASTER( mythid )
# Line 163  c     >>>>>>>>>>>>>>>>>>>             << Line 164  c     >>>>>>>>>>>>>>>>>>>             <<
164          _BEGIN_MASTER( mythid )          _BEGIN_MASTER( mythid )
165    
166          writeglobalfile = .false.          writeglobalfile = .false.
167          do k=1,mynr          call mdsreadfieldxz(
 c             Read data from file layer by layer.  
            call mdsreadfieldxz(  
168       &                        active_var_file,       &                        active_var_file,
169       &                        prec,       &                        prec,
170       &                        'RL',       &                        'RL',
171       &                        1,       &                        mynr,
172       &                        active_data_t,       &                        active_data_t,
173       &                        (irec-1)*mynr+k,       &                        irec,
174       &                        mythid )       &                        mythid )
175    
176  c             Add active_var from appropriate location to data.  c             Add active_var from appropriate location to data.
177             do bj = 1,nsy          do bj = 1,nsy
178                do bi = 1,nsx             do bi = 1,nsx
179                  do k = 1,mynr
180                   do i = 1,snx                   do i = 1,snx
181                      active_data_t(i,bi,bj) = active_data_t(i,bi,bj) +                      active_data_t(i,k,bi,bj) =
182         &                   active_data_t(i,k,bi,bj) +
183       &                   active_var(i,k,bi,bj)       &                   active_var(i,k,bi,bj)
184                   enddo                   enddo
185                enddo                enddo
186             enddo             enddo
187            enddo
188            
189  c             Store the result on disk.  c             Store the result on disk.
190             call mdswritefieldxz(          call mdswritefieldxz(
191       &                         active_var_file,       &                         active_var_file,
192       &                         prec,       &                         prec,
193       &                         writeglobalfile,       &                         writeglobalfile,
194       &                         'RL',       &                         'RL',
195       &                         1,       &                         mynr,
196       &                         active_data_t,       &                         active_data_t,
197       &                         (irec-1)*mynr+k,       &                         irec,
198       &                         myOptimIter,       &                         myOptimIter,
199       &                         mythid )       &                         mythid )
         enddo  
   
200    
201  c       Set active_var to zero.  c       Set active_var to zero.
202          do k=1,mynr          do bj = 1,nsy
203             do bj = 1,nsy             do bi = 1,nsx
204                do bi = 1,nsx                do k=1,mynr
205                   do i = 1,snx                   do i = 1,snx
206                      active_var(i,k,bi,bj) = 0. _d 0                      active_var(i,k,bi,bj) = 0. _d 0
207                   enddo                   enddo
# Line 275  c     == global variables == Line 275  c     == global variables ==
275  #include "EEPARAMS.h"  #include "EEPARAMS.h"
276  #include "SIZE.h"  #include "SIZE.h"
277  #include "PARAMS.h"  #include "PARAMS.h"
278    #include "ctrl.h"
279    
280  c     == routine arguments ==  c     == routine arguments ==
281    
# Line 292  c     == local variables == Line 293  c     == local variables ==
293    
294        integer  i,j,k        integer  i,j,k
295        integer  bi,bj        integer  bi,bj
296        _RL  active_data_t(1-olx:snx+olx,nsx,nsy)        _RL  active_data_t(1-olx:snx+olx,mynr,nsx,nsy)
297        integer  oldprec        integer  oldprec
298        integer  prec        integer  prec
299    
# Line 300  c     == end of interface == Line 301  c     == end of interface ==
301    
302  c     force 64-bit io  c     force 64-bit io
303        oldPrec        = readBinaryPrec        oldPrec        = readBinaryPrec
304        readBinaryPrec = precFloat64        readBinaryPrec = ctrlprec
305        prec           = precFloat64        prec           = ctrlprec
306    
307  c     >>>>>>>>>>>>>>>>>>>             <<<<<<<<<<<<<<<<<<<  c     >>>>>>>>>>>>>>>>>>>             <<<<<<<<<<<<<<<<<<<
308  c     >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<  c     >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
# Line 334  c     >>>>>>>>>>>>>>>>>>>             << Line 335  c     >>>>>>>>>>>>>>>>>>>             <<
335    
336          _BEGIN_MASTER( mythid )          _BEGIN_MASTER( mythid )
337    
338              do k=1,mynr          call mdsreadfieldxz(
 c             Read data from file layer by layer.  
               call mdsreadfieldxz(  
339       &                           active_var_file,       &                           active_var_file,
340       &                           prec,       &                           prec,
341       &                           'RL',       &                           'RL',
342       &                            1,       &                            mynr,
343       &                            active_data_t,       &                            active_data_t,
344       &                            (irec-1)*mynr+k,       &                            irec,
345       &                            mythid )       &                            mythid )
346    
347  c             Add active_var from appropriate location to data.  c             Add active_var from appropriate location to data.
348                do bj = 1,nsy          do bj = 1,nsy
349                   do bi = 1,nsx             do bi = 1,nsx
350                      do i = 1,snx                do k = 1,nr
351                         active_var(i,k,bi,bj) =                   do i = 1,snx
352       &                      active_var(i,k,bi,bj) +                      active_var(i,k,bi,bj) =
353       &                      active_data_t(i,bi,bj)       &                   active_var(i,k,bi,bj) +
354                         active_data_t(i,bi,bj) = 0. _d 0       &                   active_data_t(i,k,bi,bj)
355                      enddo                      active_data_t(i,k,bi,bj) = 0. _d 0
356                   enddo                   enddo
357                enddo                enddo
358                call mdswritefieldxz(             enddo
359            enddo
360            call mdswritefieldxz(
361       &                            active_var_file,       &                            active_var_file,
362       &                            prec,       &                            prec,
363       &                            globalfile,       &                            globalfile,
364       &                            'RL',       &                            'RL',
365       &                            1,       &                            mynr,
366       &                            active_data_t,       &                            active_data_t,
367       &                            (irec-1)*mynr+k,       &                            irec,
368       &                            myOptimIter,       &                            myOptimIter,
369       &                            mythid )       &                            mythid )
         enddo  
370    
371          _END_MASTER( mythid )          _END_MASTER( mythid )
372    
# Line 440  c     == global variables == Line 440  c     == global variables ==
440  #include "EEPARAMS.h"  #include "EEPARAMS.h"
441  #include "SIZE.h"  #include "SIZE.h"
442  #include "PARAMS.h"  #include "PARAMS.h"
443    #include "ctrl.h"
444    
445  c     == routine arguments ==  c     == routine arguments ==
446    
# Line 468  c     == local variables == Line 469  c     == local variables ==
469    
470        logical writeglobalfile        logical writeglobalfile
471    
472        _RL  active_data_t(1-oly:sny+oly,nsx,nsy)        _RL  active_data_t(1-oly:sny+oly,mynr,nsx,nsy)
473    
474  c     == functions ==  c     == functions ==
475    
# Line 478  c     == end of interface == Line 479  c     == end of interface ==
479    
480  c     force 64-bit io  c     force 64-bit io
481        oldPrec        = readBinaryPrec        oldPrec        = readBinaryPrec
482        readBinaryPrec = precFloat64        readBinaryPrec = ctrlprec
483        prec           = precFloat64        prec           = ctrlprec
484    
485        write(adfname(1:80),'(80a)') ' '        write(adfname(1:80),'(80a)') ' '
486        adpref = 'ad'        adpref = 'ad'
# Line 514  c         adjoint variable's file. These Line 515  c         adjoint variable's file. These
515            writeglobalfile = .false.            writeglobalfile = .false.
516            do bj = 1,nsy            do bj = 1,nsy
517               do bi = 1,nsx               do bi = 1,nsx
518                  do j = 1,sny                  do k = 1, mynr
519                     active_data_t(j,bi,bj)= 0. _d 0                     do j = 1,sny
520                          active_data_t(j,k,bi,bj)= 0. _d 0
521                       enddo
522                  enddo                  enddo
523               enddo               enddo
524            enddo            enddo
525    
526            do k = 1,mynr            call mdswritefieldyz(
              call mdswritefieldyz(  
527       &                           adfname,       &                           adfname,
528       &                           prec,       &                           prec,
529       &                           globalfile,       &                           globalfile,
530       &                           'RL',       &                           'RL',
531       &                           1,       &                           mynr,
532       &                           active_data_t,       &                           active_data_t,
533       &                           (irec-1)*mynr+k,       &                           irec,
534       &                           myOptimIter,       &                           myOptimIter,
535       &                           mythid )       &                           mythid )
           enddo  
536          endif          endif
537    
538          _END_MASTER( mythid )          _END_MASTER( mythid )
# Line 547  c     >>>>>>>>>>>>>>>>>>>             << Line 548  c     >>>>>>>>>>>>>>>>>>>             <<
548          _BEGIN_MASTER( mythid )          _BEGIN_MASTER( mythid )
549    
550          writeglobalfile = .false.          writeglobalfile = .false.
551          do k=1,mynr          call mdsreadfieldyz(
 c             Read data from file layer by layer.  
            call mdsreadfieldyz(  
552       &                        active_var_file,       &                        active_var_file,
553       &                        prec,       &                        prec,
554       &                        'RL',       &                        'RL',
555       &                        1,       &                        mynr,
556       &                        active_data_t,       &                        active_data_t,
557       &                        (irec-1)*mynr+k,       &                        irec,
558       &                        mythid )       &                        mythid )
559    
560  c             Add active_var from appropriate location to data.  c             Add active_var from appropriate location to data.
561             do bj = 1,nsy          do bj = 1,nsy
562                do bi = 1,nsx             do bi = 1,nsx
563                  do k = 1,mynr
564                   do j = 1,sny                   do j = 1,sny
565                      active_data_t(j,bi,bj) = active_data_t(j,bi,bj) +                      active_data_t(j,k,bi,bj) =
566         &                   active_data_t(j,k,bi,bj) +
567       &                   active_var(j,k,bi,bj)       &                   active_var(j,k,bi,bj)
568                   enddo                   enddo
569                enddo                enddo
570             enddo             enddo
571            enddo
572            
573  c             Store the result on disk.  c             Store the result on disk.
574             call mdswritefieldyz(          call mdswritefieldyz(
575       &                         active_var_file,       &                         active_var_file,
576       &                         prec,       &                         prec,
577       &                         writeglobalfile,       &                         writeglobalfile,
578       &                         'RL',       &                         'RL',
579       &                         1,       &                         mynr,
580       &                         active_data_t,       &                         active_data_t,
581       &                         (irec-1)*mynr+k,       &                         irec,
582       &                         myOptimIter,       &                         myOptimIter,
583       &                         mythid )       &                         mythid )
         enddo  
   
584    
585  c       Set active_var to zero.  c       Set active_var to zero.
586          do k=1,mynr          do bj = 1,nsy
587             do bj = 1,nsy             do bi = 1,nsx
588                do bi = 1,nsx                do k=1,mynr
589                   do j = 1,sny                   do j = 1,sny
590                      active_var(j,k,bi,bj) = 0. _d 0                      active_var(j,k,bi,bj) = 0. _d 0
591                   enddo                   enddo
# Line 659  c     == global variables == Line 659  c     == global variables ==
659  #include "EEPARAMS.h"  #include "EEPARAMS.h"
660  #include "SIZE.h"  #include "SIZE.h"
661  #include "PARAMS.h"  #include "PARAMS.h"
662    #include "ctrl.h"
663    
664  c     == routine arguments ==  c     == routine arguments ==
665    
# Line 676  c     == local variables == Line 677  c     == local variables ==
677    
678        integer  i,j,k        integer  i,j,k
679        integer  bi,bj        integer  bi,bj
680        _RL  active_data_t(1-oly:sny+oly,nsx,nsy)        _RL  active_data_t(1-oly:sny+oly,mynr,nsx,nsy)
681        integer  oldprec        integer  oldprec
682        integer  prec        integer  prec
683    
# Line 684  c     == end of interface == Line 685  c     == end of interface ==
685    
686  c     force 64-bit io  c     force 64-bit io
687        oldPrec        = readBinaryPrec        oldPrec        = readBinaryPrec
688        readBinaryPrec = precFloat64        readBinaryPrec = ctrlprec
689        prec           = precFloat64        prec           = ctrlprec
690    
691  c     >>>>>>>>>>>>>>>>>>>             <<<<<<<<<<<<<<<<<<<  c     >>>>>>>>>>>>>>>>>>>             <<<<<<<<<<<<<<<<<<<
692  c     >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<  c     >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
# Line 718  c     >>>>>>>>>>>>>>>>>>>             << Line 719  c     >>>>>>>>>>>>>>>>>>>             <<
719    
720          _BEGIN_MASTER( mythid )          _BEGIN_MASTER( mythid )
721    
722              do k=1,mynr          call mdsreadfieldyz(
 c             Read data from file layer by layer.  
               call mdsreadfieldyz(  
723       &                           active_var_file,       &                           active_var_file,
724       &                           prec,       &                           prec,
725       &                           'RL',       &                           'RL',
726       &                            1,       &                            mynr,
727       &                            active_data_t,       &                            active_data_t,
728       &                            (irec-1)*mynr+k,       &                            irec,
729       &                            mythid )       &                            mythid )
730    
731  c             Add active_var from appropriate location to data.  c             Add active_var from appropriate location to data.
732                do bj = 1,nsy          do bj = 1,nsy
733                   do bi = 1,nsx             do bi = 1,nsx
734                      do j = 1,sny                do k = 1, mynr
735                         active_var(j,k,bi,bj) =                   do j = 1,sny
736       &                      active_var(j,k,bi,bj) +                      active_var(j,k,bi,bj) =
737       &                      active_data_t(j,bi,bj)       &                   active_var(j,k,bi,bj) +
738                         active_data_t(j,bi,bj) = 0. _d 0       &                   active_data_t(j,k,bi,bj)
739                      enddo                      active_data_t(j,k,bi,bj) = 0. _d 0
740                   enddo                   enddo
741                enddo                enddo
742                call mdswritefieldyz(             enddo
743            enddo
744            call mdswritefieldyz(
745       &                            active_var_file,       &                            active_var_file,
746       &                            prec,       &                            prec,
747       &                            globalfile,       &                            globalfile,
748       &                            'RL',       &                            'RL',
749       &                            1,       &                            mynr,
750       &                            active_data_t,       &                            active_data_t,
751       &                            (irec-1)*mynr+k,       &                            irec,
752       &                            myOptimIter,       &                            myOptimIter,
753       &                            mythid )       &                            mythid )
         enddo  
754    
755          _END_MASTER( mythid )          _END_MASTER( mythid )
756    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.22