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