1 |
C $Header: /u/gcmpack/MITgcm/verification/OpenAD/code_ad_openad/the_second_level_loop.F,v 1.1 2006/07/13 19:39:05 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
#ifdef ALLOW_OBCS |
7 |
# include "OBCS_OPTIONS.h" |
8 |
#endif |
9 |
#ifdef ALLOW_SEAICE |
10 |
# include "SEAICE_OPTIONS.h" |
11 |
#endif |
12 |
#ifdef ALLOW_GMREDI |
13 |
# include "GMREDI_OPTIONS.h" |
14 |
#endif |
15 |
|
16 |
C start with a copy of THE_MAIN_LOOP |
17 |
C and remove some the obvious extras |
18 |
SUBROUTINE THE_SECOND_LEVEL_LOOP(iLev_4, iLev_3, iLev_2, |
19 |
+uCheckLev1, uCheckLev2, uCheckLev3,uCheckLev4, |
20 |
+myTime, myIter, myThid ) |
21 |
IMPLICIT NONE |
22 |
|
23 |
C == Global variables == |
24 |
#include "SIZE.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "PARAMS.h" |
27 |
|
28 |
c************************************** |
29 |
#ifdef ALLOW_AUTODIFF_TAMC |
30 |
|
31 |
c These includes are needed for |
32 |
c AD-checkpointing. |
33 |
c They provide the fields to be stored. |
34 |
|
35 |
# include "GRID.h" |
36 |
# include "DYNVARS.h" |
37 |
# include "FFIELDS.h" |
38 |
# include "EOS.h" |
39 |
# include "GAD.h" |
40 |
# ifdef ALLOW_CD_CODE |
41 |
# include "CD_CODE_VARS.h" |
42 |
# endif |
43 |
# ifdef ALLOW_PTRACERS |
44 |
# include "PTRACERS_SIZE.h" |
45 |
# include "PTRACERS.h" |
46 |
# endif |
47 |
# ifdef EXACT_CONSERV |
48 |
# include "SURFACE.h" |
49 |
# endif |
50 |
# ifdef ALLOW_OBCS |
51 |
# include "OBCS.h" |
52 |
# endif |
53 |
# ifdef ALLOW_EXF |
54 |
# include "exf_fields.h" |
55 |
# include "exf_clim_fields.h" |
56 |
# ifdef ALLOW_BULKFORMULAE |
57 |
# include "exf_constants.h" |
58 |
# endif |
59 |
# endif /* ALLOW_EXF */ |
60 |
# ifdef ALLOW_SEAICE |
61 |
# include "SEAICE.h" |
62 |
# endif |
63 |
# ifdef ALLOW_EBM |
64 |
# include "EBM.h" |
65 |
# endif |
66 |
# ifdef ALLOW_DIVIDED_ADJOINT_MPI |
67 |
# include "mpif.h" |
68 |
# endif |
69 |
|
70 |
# include "tamc.h" |
71 |
# include "ctrl.h" |
72 |
# include "ctrl_dummy.h" |
73 |
# include "cost.h" |
74 |
|
75 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
76 |
|
77 |
integer iLev_4 |
78 |
integer iLev_3 |
79 |
integer ilev_2 |
80 |
integer uCheckLev1, uCheckLev2, uCheckLev3,uCheckLev4 |
81 |
INTEGER myThid |
82 |
INTEGER myIter |
83 |
_RL myTime |
84 |
|
85 |
C !LOCAL VARIABLES: |
86 |
C == Local variables == |
87 |
integer ilev_1 |
88 |
|
89 |
#ifdef ALLOW_DEBUG |
90 |
IF (debugMode) CALL DEBUG_ENTER('THE_SECOND_LEVEL_LOOP',myThid) |
91 |
#endif |
92 |
|
93 |
print *, 'JU: THE_SECOND_LEVEL_LOOP(',iLev_4,',',iLev_3,',',iLev_2,')' |
94 |
do ilev_1 = 0,uCheckLev1-1 |
95 |
iloop = ilev_1 |
96 |
& + (ilev_2)*uCheckLev1 |
97 |
& + (ilev_3)*uCheckLev2*uCheckLev1 |
98 |
& + (ilev_4)*uCheckLev3*uCheckLev2*uCheckLev1 |
99 |
if ( iloop .le. nTimeSteps ) then |
100 |
#ifdef ALLOW_DEBUG |
101 |
IF (debugMode) CALL DEBUG_CALL('THE_FIRST_LEVEL_LOOP',myThid) |
102 |
#endif |
103 |
CALL THE_FIRST_LEVEL_LOOP( iLoop, |
104 |
+mytime, myiter, mythid ) |
105 |
end if |
106 |
enddo |
107 |
|
108 |
#ifdef ALLOW_DEBUG |
109 |
IF (debugMode) CALL DEBUG_LEAVE('THE_SECOND_LEVEL_LOOP',myThid) |
110 |
#endif |
111 |
|
112 |
END |
113 |
|
114 |
SUBROUTINE THE_SECOND_LEVEL_PLAIN(iLev_4, iLev_3, |
115 |
+uCheckLev1, uCheckLev2, uCheckLev3,uCheckLev4, |
116 |
+myTime, myIter, myThid ) |
117 |
IMPLICIT NONE |
118 |
|
119 |
C == Global variables == |
120 |
#include "SIZE.h" |
121 |
#include "EEPARAMS.h" |
122 |
#include "PARAMS.h" |
123 |
|
124 |
c************************************** |
125 |
#ifdef ALLOW_AUTODIFF_TAMC |
126 |
|
127 |
c These includes are needed for |
128 |
c AD-checkpointing. |
129 |
c They provide the fields to be stored. |
130 |
|
131 |
# include "GRID.h" |
132 |
# include "DYNVARS.h" |
133 |
# include "FFIELDS.h" |
134 |
# include "EOS.h" |
135 |
# include "GAD.h" |
136 |
# ifdef ALLOW_CD_CODE |
137 |
# include "CD_CODE_VARS.h" |
138 |
# endif |
139 |
# ifdef ALLOW_PTRACERS |
140 |
# include "PTRACERS_SIZE.h" |
141 |
# include "PTRACERS.h" |
142 |
# endif |
143 |
# ifdef EXACT_CONSERV |
144 |
# include "SURFACE.h" |
145 |
# endif |
146 |
# ifdef ALLOW_OBCS |
147 |
# include "OBCS.h" |
148 |
# endif |
149 |
# ifdef ALLOW_EXF |
150 |
# include "exf_fields.h" |
151 |
# include "exf_clim_fields.h" |
152 |
# ifdef ALLOW_BULKFORMULAE |
153 |
# include "exf_constants.h" |
154 |
# endif |
155 |
# endif /* ALLOW_EXF */ |
156 |
# ifdef ALLOW_SEAICE |
157 |
# include "SEAICE.h" |
158 |
# endif |
159 |
# ifdef ALLOW_EBM |
160 |
# include "EBM.h" |
161 |
# endif |
162 |
# ifdef ALLOW_DIVIDED_ADJOINT_MPI |
163 |
# include "mpif.h" |
164 |
# endif |
165 |
|
166 |
# include "tamc.h" |
167 |
# include "ctrl.h" |
168 |
# include "ctrl_dummy.h" |
169 |
# include "cost.h" |
170 |
|
171 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
172 |
|
173 |
integer iLev_4 |
174 |
integer iLev_3 |
175 |
integer uCheckLev1, uCheckLev2, uCheckLev3,uCheckLev4 |
176 |
INTEGER myThid |
177 |
INTEGER myIter |
178 |
_RL myTime |
179 |
|
180 |
C !LOCAL VARIABLES: |
181 |
C == Local variables == |
182 |
integer ilev_1 |
183 |
integer iLoop |
184 |
|
185 |
#ifdef ALLOW_DEBUG |
186 |
IF (debugMode) CALL DEBUG_ENTER('THE_SECOND_LEVEL_PLAIN',myThid) |
187 |
#endif |
188 |
|
189 |
print *, 'JU: THE_SECOND_LEVEL_PLAIN(',iLev_4,',',iLev_3,')' |
190 |
do ilev_1 = 0,uCheckLev1-1 |
191 |
iloop = ilev_1 |
192 |
& + (ilev_3)*uCheckLev2*uCheckLev1 |
193 |
& + (ilev_4)*uCheckLev3*uCheckLev2*uCheckLev1 |
194 |
if ( iloop .le. nTimeSteps ) then |
195 |
|
196 |
#ifdef ALLOW_DEBUG |
197 |
IF (debugMode) CALL DEBUG_CALL('THE_FIRST_LEVEL_LOOP',myThid) |
198 |
#endif |
199 |
CALL THE_FIRST_LEVEL_LOOP( iLoop, |
200 |
+mytime, myiter, mythid ) |
201 |
end if |
202 |
enddo |
203 |
#ifdef ALLOW_DEBUG |
204 |
IF (debugMode) CALL DEBUG_LEAVE('THE_SECOND_LEVEL_PLAIN',myThid) |
205 |
#endif |
206 |
|
207 |
END |
208 |
|