1 |
gforget |
1.18 |
C $Header: /u/gcmpack/MITgcm/model/src/main_do_loop.F,v 1.17 2014/10/09 00:46:30 gforget Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PACKAGES_CONFIG.h" |
5 |
|
|
#include "CPP_OPTIONS.h" |
6 |
jmc |
1.16 |
c#ifdef ALLOW_AUTODIFF |
7 |
|
|
c# include "AUTODIFF_OPTIONS.h" |
8 |
|
|
c#endif |
9 |
heimbach |
1.1 |
#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 |
jmc |
1.16 |
#ifdef ALLOW_COST |
31 |
|
|
# include "COST_OPTIONS.h" |
32 |
|
|
#endif |
33 |
heimbach |
1.1 |
#ifdef ALLOW_CTRL |
34 |
|
|
# include "CTRL_OPTIONS.h" |
35 |
|
|
#endif |
36 |
gforget |
1.18 |
c#ifdef ALLOW_ECCO |
37 |
|
|
c# include "ECCO_OPTIONS.h" |
38 |
|
|
c#endif |
39 |
heimbach |
1.1 |
|
40 |
|
|
CBOP |
41 |
|
|
C !ROUTINE: MAIN_DO_LOOP |
42 |
|
|
C !INTERFACE: |
43 |
heimbach |
1.11 |
SUBROUTINE MAIN_DO_LOOP( iloop, myTime, myIter, myThid ) |
44 |
heimbach |
1.1 |
|
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 | MAIN_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 |
jmc |
1.16 |
#ifdef ALLOW_OPENAD |
72 |
heimbach |
1.1 |
|
73 |
jmc |
1.15 |
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 |
heimbach |
1.1 |
|
138 |
|
|
# ifdef ALLOW_CTRL |
139 |
jmc |
1.15 |
# include "CTRL_SIZE.h" |
140 |
|
|
# include "ctrl.h" |
141 |
|
|
# include "ctrl_dummy.h" |
142 |
|
|
# include "CTRL_GENARR.h" |
143 |
gforget |
1.17 |
# include "CTRL_OBCS.h" |
144 |
heimbach |
1.1 |
# endif |
145 |
|
|
# ifdef ALLOW_COST |
146 |
|
|
# include "cost.h" |
147 |
|
|
# endif |
148 |
|
|
|
149 |
jmc |
1.15 |
# ifdef ALLOW_PTRACERS |
150 |
|
|
# include "PTRACERS_SIZE.h" |
151 |
|
|
# include "PTRACERS_FIELDS.h" |
152 |
|
|
# include "PTRACERS_START.h" |
153 |
|
|
# endif |
154 |
heimbach |
1.8 |
# 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 |
heimbach |
1.10 |
# 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 |
heimbach |
1.8 |
# endif |
174 |
heimbach |
1.10 |
# 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 |
heimbach |
1.8 |
|
186 |
jmc |
1.16 |
#endif /* ALLOW_OPENAD */ |
187 |
heimbach |
1.1 |
c************************************** |
188 |
|
|
|
189 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
190 |
|
|
C == Routine arguments == |
191 |
jmc |
1.13 |
C note: under the multi-threaded model myIter and |
192 |
|
|
C myTime are local variables passed around as routine |
193 |
heimbach |
1.1 |
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 |
|
|
_RL myTime |
200 |
|
|
INTEGER myIter |
201 |
|
|
INTEGER myThid |
202 |
|
|
|
203 |
|
|
C !FUNCTIONS: |
204 |
|
|
C == Functions == |
205 |
|
|
|
206 |
|
|
C !LOCAL VARIABLES: |
207 |
|
|
C == Local variables == |
208 |
jmc |
1.4 |
INTEGER iloop |
209 |
heimbach |
1.1 |
CEOP |
210 |
|
|
|
211 |
|
|
#ifdef ALLOW_DEBUG |
212 |
|
|
IF (debugMode) CALL DEBUG_ENTER('MAIN_DO_LOOP',myThid) |
213 |
|
|
#endif |
214 |
|
|
|
215 |
jmc |
1.16 |
#ifdef ALLOW_OPENAD |
216 |
jmc |
1.14 |
C >>>>>>>>>>>>>>>>>>>>>>>>>>> LOOP <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
217 |
|
|
C >>>>>>>>>>>>>>>>>>>>>>>>>>> STARTS <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
218 |
utke |
1.3 |
DO iloop = 1, nTimeSteps |
219 |
heimbach |
1.1 |
#endif |
220 |
|
|
|
221 |
|
|
#ifdef ALLOW_DEBUG |
222 |
|
|
IF (debugMode) CALL DEBUG_CALL('FORWARD_STEP',myThid) |
223 |
|
|
#endif |
224 |
|
|
|
225 |
|
|
#ifdef ALLOW_ATM2D |
226 |
jmc |
1.13 |
CALL TIMER_START('FORWARD_STEP_ATM2D [MAIN_DO_LOOP]',myThid) |
227 |
|
|
CALL FORWARD_STEP_ATM2D( iloop, myTime, myIter, myThid ) |
228 |
|
|
CALL TIMER_STOP ('FORWARD_STEP_ATM2D [MAIN_DO_LOOP]',myThid) |
229 |
heimbach |
1.1 |
#else |
230 |
jmc |
1.13 |
CALL TIMER_START('FORWARD_STEP [MAIN_DO_LOOP]',myThid) |
231 |
|
|
CALL FORWARD_STEP( iloop, myTime, myIter, myThid ) |
232 |
|
|
CALL TIMER_STOP ('FORWARD_STEP [MAIN_DO_LOOP]',myThid) |
233 |
heimbach |
1.1 |
#endif |
234 |
|
|
|
235 |
jmc |
1.16 |
#ifdef ALLOW_OPENAD |
236 |
jmc |
1.4 |
ENDDO |
237 |
jmc |
1.14 |
C >>>>>>>>>>>>>>>>>>>>>>>>>>> LOOP <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
238 |
|
|
C >>>>>>>>>>>>>>>>>>>>>>>>>>> STOPS <<<<<<<<<<<<<<<<<<<<<<<<<<<< |
239 |
heimbach |
1.11 |
#endif |
240 |
heimbach |
1.1 |
|
241 |
|
|
#ifdef ALLOW_DEBUG |
242 |
|
|
IF (debugMode) CALL DEBUG_LEAVE('MAIN_DO_LOOP',myThid) |
243 |
|
|
#endif |
244 |
|
|
|
245 |
|
|
RETURN |
246 |
|
|
END |