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

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

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


Revision 1.1 - (hide annotations) (download)
Tue May 19 21:32:23 2015 UTC (10 years, 2 months ago) by snarayan
Branch: MAIN
Divided adjoints

Files for the implementing divided adjoints using OpenAD

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

  ViewVC Help
Powered by ViewVC 1.1.22