/[MITgcm]/MITgcm_contrib/snarayan/divided_adjoint/model/src/main_do_loop.F
ViewVC logotype

Annotation of /MITgcm_contrib/snarayan/divided_adjoint/model/src/main_do_loop.F

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


Revision 1.2 - (hide annotations) (download)
Fri Jul 3 04:10:13 2015 UTC (10 years, 1 month ago) by snarayan
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +26 -9 lines
Changes to support both divided adjoints and plain adjoints.

1 snarayan 1.1 C $Header: /u/gcmpack/MITgcm/model/src/main_do_loop.F,v 1.18 2014/10/20 03:09:03 gforget Exp $
2     C $Name: $
3    
4     #include "PACKAGES_CONFIG.h"
5     #include "CPP_OPTIONS.h"
6 snarayan 1.2 #include "OPENAD_OPTIONS.h"
7 snarayan 1.1 c#ifdef ALLOW_AUTODIFF
8     c# include "AUTODIFF_OPTIONS.h"
9     c#endif
10     #ifdef ALLOW_OBCS
11     # include "OBCS_OPTIONS.h"
12     #endif
13     #ifdef ALLOW_SEAICE
14     # include "SEAICE_OPTIONS.h"
15     #endif
16     #ifdef ALLOW_GENERIC_ADVDIFF
17     # include "GAD_OPTIONS.h"
18     #endif
19     #ifdef ALLOW_GMREDI
20     # include "GMREDI_OPTIONS.h"
21     #endif
22     #ifdef ALLOW_STREAMICE
23     # include "STREAMICE_OPTIONS.h"
24     #endif
25     #ifdef ALLOW_GGL90
26     # include "GGL90_OPTIONS.h"
27     #endif
28     #ifdef ALLOW_EXF
29     # include "EXF_OPTIONS.h"
30     #endif
31     #ifdef ALLOW_COST
32     # include "COST_OPTIONS.h"
33     #endif
34     #ifdef ALLOW_CTRL
35     # include "CTRL_OPTIONS.h"
36     #endif
37     c#ifdef ALLOW_ECCO
38     c# include "ECCO_OPTIONS.h"
39     c#endif
40    
41     CBOP
42     C !ROUTINE: MAIN_DO_LOOP
43     C !INTERFACE:
44     SUBROUTINE MAIN_DO_LOOP( iloop, myTime, myIter, myThid )
45    
46     C !DESCRIPTION: \bv
47     C *================================================================*
48     C | SUBROUTINE the_loop_body
49     C | o Run the ocean model and evaluate the specified cost function.
50     C *================================================================*
51     C |
52     C | MAIN_DO_LOOP is the toplevel routine for the Tangent Linear and
53     C | Adjoint Model Compiler (TAMC).
54     C | For this purpose the initialization
55     C | of the model was split into two parts. Those parameters that do
56     C | not depend on a specific model run are set in INITIALISE_FIXED,
57     C | whereas those that do depend on the specific realization are
58     C | initialized in INITIALISE_VARIA.
59     C | This routine is to be used in conjuction with the MITgcmuv
60     C | checkpoint 37.
61     C *================================================================*
62     C \ev
63    
64     C !USES:
65     IMPLICIT NONE
66     C == Global variables ==
67     #include "SIZE.h"
68     #include "EEPARAMS.h"
69     #include "PARAMS.h"
70    
71     c**************************************
72     #ifdef ALLOW_OPENAD
73    
74     C-- The folowing header files are included in the_main_loop.F for TAF
75     C and might be needed here (where the iloop is done) for OpenAD
76     c# include "AUTODIFF_MYFIELDS.h"
77     c# include "GRID.h"
78     c# include "DYNVARS.h"
79     c# include "SURFACE.h"
80     c# include "FFIELDS.h"
81     c# include "EOS.h"
82     c# include "AUTODIFF.h"
83     c# ifdef ALLOW_GENERIC_ADVDIFF
84     c# include "GAD.h"
85     c# include "GAD_SOM_VARS.h"
86     c# endif
87     c# ifdef ALLOW_MOM_FLUXFORM
88     c# include "MOM_FLUXFORM.h"
89     c# endif
90     c# ifdef ALLOW_CD_CODE
91     c# include "CD_CODE_VARS.h"
92     c# endif
93     c# ifdef ALLOW_EXF
94     c# include "EXF_FIELDS.h"
95     c# ifdef ALLOW_BULKFORMULAE
96     c# include "EXF_CONSTANTS.h"
97     c# endif
98     c# endif /* ALLOW_EXF */
99     c# ifdef ALLOW_SEAICE
100     c# include "SEAICE_SIZE.h"
101     c# include "SEAICE.h"
102     c# include "SEAICE_PARAMS.h"
103     c# include "SEAICE_COST.h"
104     c# include "SEAICE_TRACER.h"
105     c# endif
106     c# ifdef ALLOW_SALT_PLUME
107     c# include "SALT_PLUME.h"
108     c# endif
109     c# ifdef ALLOW_THSICE
110     c# include "THSICE_SIZE.h"
111     c# include "THSICE_VARS.h"
112     c# include "THSICE_COST.h"
113     c# endif
114     c# ifdef ALLOW_EBM
115     c# include "EBM.h"
116     c# endif
117     c# ifdef ALLOW_RBCS
118     c# include "RBCS_SIZE.h"
119     c# include "RBCS_FIELDS.h"
120     c# endif
121     c# ifdef ALLOW_OFFLINE
122     c# include "OFFLINE.h"
123     c# endif
124     c# ifdef ALLOW_CG2D_NSA
125     c# include "CG2D.h"
126     c# endif
127     c# ifdef ALLOW_GGL90
128     c# include "GGL90.h"
129     c# endif
130     c# ifdef ALLOW_PROFILES
131     c# include "profiles.h"
132     c# endif
133     c# ifdef ALLOW_ECCO_EVOLUTION
134     c# ifdef ALLOW_ECCO
135     c# include "ecco_cost.h"
136     c# endif
137     c# endif
138    
139     # ifdef ALLOW_CTRL
140     # include "CTRL_SIZE.h"
141     # include "ctrl.h"
142     # include "ctrl_dummy.h"
143     # include "CTRL_GENARR.h"
144     # include "CTRL_OBCS.h"
145     # endif
146     # ifdef ALLOW_COST
147     # include "cost.h"
148     # endif
149    
150     # ifdef ALLOW_PTRACERS
151     # include "PTRACERS_SIZE.h"
152     # include "PTRACERS_FIELDS.h"
153     # include "PTRACERS_START.h"
154     # endif
155     # ifdef ALLOW_GCHEM
156     # include "GCHEM_FIELDS.h"
157     # endif
158     # ifdef ALLOW_CFC
159     # include "CFC.h"
160     # endif
161     # ifdef ALLOW_DIC
162     # include "DIC_VARS.h"
163     # include "DIC_LOAD.h"
164     # include "DIC_ATMOS.h"
165     # include "DIC_CTRL.h"
166     # include "DIC_COST.h"
167     # endif
168     # ifdef ALLOW_OBCS
169     # include "OBCS_PARAMS.h"
170     # include "OBCS_FIELDS.h"
171     # include "OBCS_SEAICE.h"
172     # ifdef ALLOW_PTRACERS
173     # include "OBCS_PTRACERS.h"
174     # endif
175     # endif
176     # ifdef ALLOW_SHELFICE
177     # include "SHELFICE.h"
178     # include "SHELFICE_COST.h"
179     # endif
180     # ifdef ALLOW_STREAMICE
181     # include "STREAMICE.h"
182     # include "STREAMICE_ADV.h"
183     # include "STREAMICE_BDRY.h"
184     # include "STREAMICE_CG.h"
185     # endif
186    
187     #endif /* ALLOW_OPENAD */
188     c**************************************
189    
190     C !INPUT/OUTPUT PARAMETERS:
191     C == Routine arguments ==
192     C note: under the multi-threaded model myIter and
193     C myTime are local variables passed around as routine
194     C arguments. Although this is fiddly it saves the need to
195     C impose additional synchronisation points when they are
196     C updated.
197     C myTime :: time counter for this thread
198     C myIter :: iteration counter for this thread
199     C myThid :: thread number for this instance of the routine.
200     _RL myTime
201     INTEGER myIter
202     INTEGER myThid
203    
204     C !FUNCTIONS:
205     C == Functions ==
206    
207     C !LOCAL VARIABLES:
208     C == Local variables ==
209     INTEGER iloop
210     CEOP
211    
212     #ifdef ALLOW_DEBUG
213     IF (debugMode) CALL DEBUG_ENTER('MAIN_DO_LOOP',myThid)
214     #endif
215    
216     #ifdef ALLOW_OPENAD
217     C >>>>>>>>>>>>>>>>>>>>>>>>>>> LOOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<
218     C >>>>>>>>>>>>>>>>>>>>>>>>>>> STARTS <<<<<<<<<<<<<<<<<<<<<<<<<<<<
219 snarayan 1.2 #ifdef ALLOW_OPENAD_DIVA
220 snarayan 1.1 DO iloop = 1, nTimeSteps_l2
221 snarayan 1.2 #else
222     DO iloop = 1, nTimeSteps
223     #endif
224    
225 snarayan 1.1 #endif
226    
227     #ifdef ALLOW_DEBUG
228     IF (debugMode) CALL DEBUG_CALL('FORWARD_STEP',myThid)
229     #endif
230    
231     #ifndef ALLOW_OPENAD
232     #ifdef ALLOW_ATM2D
233     CALL TIMER_START('FORWARD_STEP_ATM2D [MAIN_DO_LOOP]',myThid)
234     CALL FORWARD_STEP_ATM2D( iloop, myTime, myIter, myThid )
235     CALL TIMER_STOP ('FORWARD_STEP_ATM2D [MAIN_DO_LOOP]',myThid)
236     #else
237     CALL TIMER_START('FORWARD_STEP [MAIN_DO_LOOP]',myThid)
238     CALL FORWARD_STEP( iloop, myTime, myIter, myThid )
239     CALL TIMER_STOP ('FORWARD_STEP [MAIN_DO_LOOP]',myThid)
240     #endif
241     #else
242 snarayan 1.2 C#ifdef ALLOW_ATM2D
243     C CALL TIMER_START('INNER_DO_LOOP_ATM2D [MAIN_DO_LOOP]',myThid)
244     C nTimeSteps_l2 = 2
245     C CALL INNER_DO_LOOP( iloop, myTime, myIter, myThid )
246     C CALL TIMER_STOP ('INNER_DO_LOOP_ATM2D [MAIN_DO_LOOP]',myThid)
247     C#else
248     C CALL TIMER_START('INNER_DO_LOOP [MAIN_DO_LOOP]',myThid)
249     C nTimeSteps_l2 = 2
250     C CALL INNER_DO_LOOP( iloop, myTime, myIter, myThid )
251     C CALL TIMER_STOP ('INNER_DO_LOOP [MAIN_DO_LOOP]',myThid)
252     C#endif
253     #ifdef ALLOW_OPENAD_DIVA
254     CALL TIMER_START('INNER_DO_LOOP [MAIN_DO_LOOP]',myThid)
255     nTimeSteps_l2 = 2
256     CALL INNER_DO_LOOP( iloop, myTime, myIter, myThid )
257     CALL TIMER_STOP ('INNER_DO_LOOP [MAIN_DO_LOOP]',myThid)
258 snarayan 1.1 #else
259 snarayan 1.2 CALL TIMER_START('FORWARD_STEP [MAIN_DO_LOOP]',myThid)
260     nTimeSteps_l2 = 2
261     CALL FORWARD_STEP( iloop, myTime, myIter, myThid )
262     CALL TIMER_STOP ('FORWARD_STEP [MAIN_DO_LOOP]',myThid)
263 snarayan 1.1 #endif
264     #endif
265    
266     #ifdef ALLOW_OPENAD
267     ENDDO
268     C >>>>>>>>>>>>>>>>>>>>>>>>>>> LOOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<
269     C >>>>>>>>>>>>>>>>>>>>>>>>>>> STOPS <<<<<<<<<<<<<<<<<<<<<<<<<<<<
270     #endif
271    
272     #ifdef ALLOW_DEBUG
273     IF (debugMode) CALL DEBUG_LEAVE('MAIN_DO_LOOP',myThid)
274     #endif
275    
276     RETURN
277     END

  ViewVC Help
Powered by ViewVC 1.1.22