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