1 |
C $Header: /u/gcmpack/MITgcm/model/src/main_do_loop.F,v 1.22 2017/03/29 15:44:00 mmazloff Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
#ifdef ALLOW_OPENAD |
7 |
# include "OPENAD_OPTIONS.h" |
8 |
#endif |
9 |
c#ifdef ALLOW_AUTODIFF |
10 |
c# include "AUTODIFF_OPTIONS.h" |
11 |
c#endif |
12 |
#ifdef ALLOW_GENERIC_ADVDIFF |
13 |
# include "GAD_OPTIONS.h" |
14 |
#endif |
15 |
#ifdef ALLOW_GGL90 |
16 |
# include "GGL90_OPTIONS.h" |
17 |
#endif |
18 |
#ifdef ALLOW_GMREDI |
19 |
# include "GMREDI_OPTIONS.h" |
20 |
#endif |
21 |
#ifdef ALLOW_OBCS |
22 |
# include "OBCS_OPTIONS.h" |
23 |
#endif |
24 |
#ifdef ALLOW_SEAICE |
25 |
# include "SEAICE_OPTIONS.h" |
26 |
#endif |
27 |
#ifdef ALLOW_GCHEM |
28 |
# include "GCHEM_OPTIONS.h" |
29 |
#endif |
30 |
#ifdef ALLOW_DIC |
31 |
# include "DIC_OPTIONS.h" |
32 |
#endif |
33 |
#ifdef ALLOW_EXF |
34 |
# include "EXF_OPTIONS.h" |
35 |
#endif |
36 |
#ifdef ALLOW_STREAMICE |
37 |
# include "STREAMICE_OPTIONS.h" |
38 |
#endif |
39 |
#ifdef ALLOW_COST |
40 |
# include "COST_OPTIONS.h" |
41 |
#endif |
42 |
#ifdef ALLOW_CTRL |
43 |
# include "CTRL_OPTIONS.h" |
44 |
#endif |
45 |
c#ifdef ALLOW_ECCO |
46 |
c# include "ECCO_OPTIONS.h" |
47 |
c#endif |
48 |
|
49 |
CBOP |
50 |
C !ROUTINE: MAIN_DO_LOOP |
51 |
C !INTERFACE: |
52 |
SUBROUTINE MAIN_DO_LOOP( iloop, myTime, myIter, myThid ) |
53 |
|
54 |
C !DESCRIPTION: \bv |
55 |
C *================================================================* |
56 |
C | SUBROUTINE the_loop_body |
57 |
C | o Run the ocean model and evaluate the specified cost function. |
58 |
C *================================================================* |
59 |
C | |
60 |
C | MAIN_DO_LOOP is the toplevel routine for the Tangent Linear and |
61 |
C | Adjoint Model Compiler (TAMC). |
62 |
C | For this purpose the initialization |
63 |
C | of the model was split into two parts. Those parameters that do |
64 |
C | not depend on a specific model run are set in INITIALISE_FIXED, |
65 |
C | whereas those that do depend on the specific realization are |
66 |
C | initialized in INITIALISE_VARIA. |
67 |
C | This routine is to be used in conjuction with the MITgcmuv |
68 |
C | checkpoint 37. |
69 |
C *================================================================* |
70 |
C \ev |
71 |
|
72 |
C !USES: |
73 |
IMPLICIT NONE |
74 |
C == Global variables == |
75 |
#include "SIZE.h" |
76 |
#include "EEPARAMS.h" |
77 |
#include "PARAMS.h" |
78 |
|
79 |
c************************************** |
80 |
#ifdef ALLOW_OPENAD |
81 |
|
82 |
# ifdef ALLOW_CTRL |
83 |
# include "CTRL_SIZE.h" |
84 |
# include "ctrl.h" |
85 |
# include "ctrl_dummy.h" |
86 |
# include "CTRL_GENARR.h" |
87 |
# include "CTRL_OBCS.h" |
88 |
# endif |
89 |
# ifdef ALLOW_COST |
90 |
# include "cost.h" |
91 |
# endif |
92 |
|
93 |
# ifdef ALLOW_PTRACERS |
94 |
# include "PTRACERS_SIZE.h" |
95 |
# include "PTRACERS_FIELDS.h" |
96 |
# include "PTRACERS_START.h" |
97 |
# endif |
98 |
# ifdef ALLOW_GCHEM |
99 |
# include "GCHEM_SIZE.h" |
100 |
# include "GCHEM_FIELDS.h" |
101 |
# endif |
102 |
# ifdef ALLOW_CFC |
103 |
# include "CFC.h" |
104 |
# endif |
105 |
# ifdef ALLOW_DIC |
106 |
# include "DIC_VARS.h" |
107 |
# include "DIC_LOAD.h" |
108 |
# include "DIC_ATMOS.h" |
109 |
# include "DIC_CTRL.h" |
110 |
# include "DIC_COST.h" |
111 |
# endif |
112 |
# ifdef ALLOW_BLING |
113 |
# include "BLING_VARS.h" |
114 |
# include "BLING_LOAD.h" |
115 |
# endif |
116 |
# ifdef ALLOW_OBCS |
117 |
# include "OBCS_PARAMS.h" |
118 |
# include "OBCS_FIELDS.h" |
119 |
# include "OBCS_SEAICE.h" |
120 |
# ifdef ALLOW_PTRACERS |
121 |
# include "OBCS_PTRACERS.h" |
122 |
# endif |
123 |
# endif |
124 |
# ifdef ALLOW_SHELFICE |
125 |
# include "SHELFICE.h" |
126 |
# include "SHELFICE_COST.h" |
127 |
# endif |
128 |
# ifdef ALLOW_STREAMICE |
129 |
# include "STREAMICE.h" |
130 |
# include "STREAMICE_ADV.h" |
131 |
# include "STREAMICE_BDRY.h" |
132 |
# include "STREAMICE_CG.h" |
133 |
# endif |
134 |
|
135 |
#endif /* ALLOW_OPENAD */ |
136 |
c************************************** |
137 |
|
138 |
C !INPUT/OUTPUT PARAMETERS: |
139 |
C == Routine arguments == |
140 |
C note: under the multi-threaded model myIter and |
141 |
C myTime are local variables passed around as routine |
142 |
C arguments. Although this is fiddly it saves the need to |
143 |
C impose additional synchronisation points when they are |
144 |
C updated. |
145 |
C myTime :: time counter for this thread |
146 |
C myIter :: iteration counter for this thread |
147 |
C myThid :: thread number for this instance of the routine. |
148 |
_RL myTime |
149 |
INTEGER myIter |
150 |
INTEGER myThid |
151 |
|
152 |
C !FUNCTIONS: |
153 |
C == Functions == |
154 |
|
155 |
C !LOCAL VARIABLES: |
156 |
C == Local variables == |
157 |
INTEGER iloop |
158 |
CEOP |
159 |
|
160 |
#ifdef ALLOW_DEBUG |
161 |
IF (debugMode) CALL DEBUG_ENTER('MAIN_DO_LOOP',myThid) |
162 |
#endif |
163 |
|
164 |
#ifdef ALLOW_OPENAD |
165 |
C >>>>>>>>>>>>>>>>>>>>>>>>>>> LOOP <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
166 |
C >>>>>>>>>>>>>>>>>>>>>>>>>>> STARTS <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
167 |
# ifdef ALLOW_OPENAD_DIVA |
168 |
DO iloop = 1, nTimeSteps_l2 |
169 |
# else |
170 |
DO iloop = 1, nTimeSteps |
171 |
# endif |
172 |
|
173 |
#endif /* ALLOW_OPENAD */ |
174 |
|
175 |
#ifdef ALLOW_DEBUG |
176 |
IF (debugMode) CALL DEBUG_CALL('FORWARD_STEP',myThid) |
177 |
#endif |
178 |
|
179 |
#ifndef ALLOW_OPENAD |
180 |
# ifdef ALLOW_ATM2D |
181 |
CALL TIMER_START('FORWARD_STEP_ATM2D [MAIN_DO_LOOP]',myThid) |
182 |
CALL FORWARD_STEP_ATM2D( iloop, myTime, myIter, myThid ) |
183 |
CALL TIMER_STOP ('FORWARD_STEP_ATM2D [MAIN_DO_LOOP]',myThid) |
184 |
# else |
185 |
CALL TIMER_START('FORWARD_STEP [MAIN_DO_LOOP]',myThid) |
186 |
CALL FORWARD_STEP( iloop, myTime, myIter, myThid ) |
187 |
CALL TIMER_STOP ('FORWARD_STEP [MAIN_DO_LOOP]',myThid) |
188 |
# endif |
189 |
#else |
190 |
# ifdef ALLOW_OPENAD_DIVA |
191 |
CALL TIMER_START('INNER_DO_LOOP [MAIN_DO_LOOP]',myThid) |
192 |
nTimeSteps_l2 = 2 |
193 |
CALL INNER_DO_LOOP( iloop, myTime, myIter, myThid ) |
194 |
CALL TIMER_STOP ('INNER_DO_LOOP [MAIN_DO_LOOP]',myThid) |
195 |
# else |
196 |
CALL TIMER_START('FORWARD_STEP [MAIN_DO_LOOP]',myThid) |
197 |
nTimeSteps_l2 = 2 |
198 |
CALL FORWARD_STEP( iloop, myTime, myIter, myThid ) |
199 |
CALL TIMER_STOP ('FORWARD_STEP [MAIN_DO_LOOP]',myThid) |
200 |
# endif |
201 |
#endif /* ndef ALLOW_OPENAD */ |
202 |
|
203 |
#ifdef ALLOW_OPENAD |
204 |
ENDDO |
205 |
C >>>>>>>>>>>>>>>>>>>>>>>>>>> LOOP <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
206 |
C >>>>>>>>>>>>>>>>>>>>>>>>>>> STOPS <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
207 |
#endif /* ALLOW_OPENAD */ |
208 |
|
209 |
#ifdef ALLOW_DEBUG |
210 |
IF (debugMode) CALL DEBUG_LEAVE('MAIN_DO_LOOP',myThid) |
211 |
#endif |
212 |
|
213 |
RETURN |
214 |
END |