/[MITgcm]/MITgcm/tools/OAD_support/ad_template.revolve.F
ViewVC logotype

Diff of /MITgcm/tools/OAD_support/ad_template.revolve.F

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

revision 1.2 by utke, Sat Mar 9 14:55:51 2013 UTC revision 1.8 by heimbach, Sat Jul 4 02:21:15 2015 UTC
# Line 1  Line 1 
1    #include "PACKAGES_CONFIG.h"
2    #include "OPENAD_OPTIONS.h"
3    
4        subroutine template()        subroutine template()
5        use OAD_cp        use OAD_cp
6        use OAD_tape        use OAD_tape
# Line 10  c we may need these for the checkpointin Line 13  c we may need these for the checkpointin
13        use PARAMS_mod        use PARAMS_mod
14        use BAR2_mod        use BAR2_mod
15        use BARRIER_mod        use BARRIER_mod
16    #ifdef ALLOW_CD_CODE
17        use CD_CODE_VARS_mod        use CD_CODE_VARS_mod
18    #endif
19        use CG2D_mod        use CG2D_mod
20        use CG3D_mod        use CG3D_mod
21        use DYNVARS_mod        use DYNVARS_mod
# Line 19  c we may need these for the checkpointin Line 24  c we may need these for the checkpointin
24        use EXCH_mod        use EXCH_mod
25        use FC_NAMEMANGLE_mod        use FC_NAMEMANGLE_mod
26        use FFIELDS_mod        use FFIELDS_mod
27    #ifdef ALLOW_GENERIC_ADVDIFF
28        use GAD_mod        use GAD_mod
29    #endif
30        use GLOBAL_MAX_mod        use GLOBAL_MAX_mod
31        use GLOBAL_SUM_mod        use GLOBAL_SUM_mod
32    #ifdef ALLOW_GGL90
33          use GGL90_mod
34          use GGL90_TAVE_mod
35    #endif
36    #ifdef ALLOW_GMREDI
37        use GMREDI_mod        use GMREDI_mod
38        use GMREDI_TAVE_mod        use GMREDI_TAVE_mod
39    #endif
40        use GRID_mod        use GRID_mod
41    #ifdef ALLOW_KPP
42          use KPP_mod
43          use KPP_PARAMS_mod
44          use KPP_TAVE_mod
45    #endif
46    #ifdef ALLOW_MOM_COMMON
47          use MOM_VISC_mod
48    #endif
49        use MPI_INFO_mod        use MPI_INFO_mod
50    #ifdef ALLOW_SHAP_FILT
51          use SHAP_FILT_mod
52    #endif
53    #ifdef ALLOW_STREAMICE
54          use STREAMICE_mod
55          use STREAMICE_ADV_mod
56          use STREAMICE_BDRY_mod
57          use STREAMICE_CG_mod
58    #endif
59        use SOLVE_FOR_PRESSURE3D_mod        use SOLVE_FOR_PRESSURE3D_mod
60        use SOLVE_FOR_PRESSURE_mod        use SOLVE_FOR_PRESSURE_mod
61        use SURFACE_mod        use SURFACE_mod
# Line 92  c we may need these for the checkpointin Line 122  c we may need these for the checkpointin
122       +'OAD:',indentation(1:our_indent),       +'OAD:',indentation(1:our_indent),
123       +' __SRNAME__: run plain, down plain'       +' __SRNAME__: run plain, down plain'
124  #endif  #endif
125    #ifdef ALLOW_OPENAD_DIVA
126          DO iloop1 = 1, nTimeSteps
127            PROD = (ILOOP1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
128            print *, 'DIVA Revolve Plain PROD = ', PROD
129            CALL OpenAD_forward_step( PROD, mytime, myiter, mythid )
130          enddo
131    #else
132        DO iloop = 1, nTimeSteps        DO iloop = 1, nTimeSteps
133          CALL OpenAD_forward_step( iloop, mytime, myiter, mythid )          CALL OpenAD_forward_step( iloop, mytime, myiter, mythid )
134        enddo        enddo
135    #endif
136        end if        end if
137        if (our_rev_mode%tape) then        if (our_rev_mode%tape) then
138  #ifdef OAD_DEBUG_JOINT  #ifdef OAD_DEBUG_JOINT
# Line 117  c we may need these for the checkpointin Line 155  c we may need these for the checkpointin
155               case (rvForward)               case (rvForward)
156                  call OAD_revPlain                  call OAD_revPlain
157                  do currIter=currIter,theAction%iteration-1                  do currIter=currIter,theAction%iteration-1
158                     CALL OpenAD_forward_step( currIter+1, mytime,  #ifdef ALLOW_OPENAD_DIVA
159                       PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
160                       print *, 'DIVA Revolve Tape rvForward PROD = ', PROD
161                       CALL OpenAD_forward_step( PROD, mytime,
162       +myiter, mythid )       +myiter, mythid )
163    #else
164                       CALL OpenAD_forward_step( currIter+1, mytime,
165         +myiter, mythid )
166    #endif
167                  end do                  end do
168                  call OAD_revTape                  call OAD_revTape
169               case (rvFirstUTurn)               case (rvFirstUTurn)
170                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,  #ifdef ALLOW_OPENAD_DIVA
171                    PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
172                    print *, 'DIVA Revolve Tape rvFirstUTurn PROD = ', PROD
173                    CALL OpenAD_forward_step( PROD, mytime, myiter,
174       +mythid )       +mythid )
175    #else
176                    CALL OpenAD_forward_step( currIter+1, mytime, myiter,
177         +mythid )
178    #endif
179  ! get out now ...  ! get out now ...
180                  exit                                  exit                
181               end select                 end select  
# Line 135  c we may need these for the checkpointin Line 187  c we may need these for the checkpointin
187             select case (theAction%actionFlag)             select case (theAction%actionFlag)
188               case (rvFirstUTurn)               case (rvFirstUTurn)
189  !we taped already ... see above  !we taped already ... see above
190    #ifdef ALLOW_OPENAD_DIVA
191                    PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
192                    print *, 'DIVA Revolve Adjoint rvFirstUTurn PROD = ', PROD
193                    CALL OpenAD_forward_step( PROD, mytime, myiter,
194         +mythid )
195    #else
196                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,
197       +mythid )       +mythid )
198    #endif
199               case (rvStore)               case (rvStore)
200                  call cp_write_open(theAction%cpNum+jointCPCount)                  call cp_write_open(theAction%cpNum+jointCPCount)
201  !$PLACEHOLDER_PRAGMA$ id=8  !$PLACEHOLDER_PRAGMA$ id=8
# Line 149  c we may need these for the checkpointin Line 208  c we may need these for the checkpointin
208               case (rvForward)               case (rvForward)
209                  call OAD_revPlain                  call OAD_revPlain
210                  do currIter=currIter,theAction%iteration-1                  do currIter=currIter,theAction%iteration-1
211    #ifdef ALLOW_OPENAD_DIVA
212                       PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
213                       print *, 'DIVA Revolve Adjoint rvForward PROD = ', PROD
214                       CALL OpenAD_forward_step( PROD, mytime, myiter,
215         + mythid )
216    #else
217                     CALL OpenAD_forward_step( currIter+1, mytime, myiter,                     CALL OpenAD_forward_step( currIter+1, mytime, myiter,
218       + mythid )       + mythid )
219    #endif
220                  end do                  end do
221                  call OAD_revAdjoint                  call OAD_revAdjoint
222               case (rvUTurn)               case (rvUTurn)
223    #ifdef ALLOW_OPENAD_DIVA
224                    PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
225    #endif
226                  call OAD_revTape                  call OAD_revTape
227                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,  #ifdef ALLOW_OPENAD_DIVA
228                    print *, 'DIVA Revolve Adjoint rvUTurn tp PROD = ', PROD
229                    CALL OpenAD_forward_step( PROD, mytime, myiter,
230         +mythid )
231    #else
232                    CALL OpenAD_forward_step( currIter+1, mytime, myiter,
233       +mythid )       +mythid )
234    #endif
235                  call OAD_revAdjoint                  call OAD_revAdjoint
236                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,  #ifdef ALLOW_OPENAD_DIVA
237                    print *, 'DIVA Revolve Adjoint rvUTurn ad PROD = ', PROD
238                    CALL OpenAD_forward_step( PROD, mytime, myiter,
239         +mythid )
240    #else
241                    CALL OpenAD_forward_step( currIter+1, mytime, myiter,
242       +mythid )       +mythid )
243    #endif
244             end select               end select  
245             theAction=rvNextAction()             theAction=rvNextAction()
246          end do          end do

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

  ViewVC Help
Powered by ViewVC 1.1.22