1 |
utke |
1.1 |
C $Header: /u/gcmpack/MITgcm_contrib/heimbach/OpenAD/code_common/the_model_main.F,v 1.2 2008/10/13 13:54:03 utke Exp $ |
2 |
|
|
|
3 |
|
|
CBOI |
4 |
|
|
C |
5 |
|
|
C !TITLE: MITGCM KERNEL CODE SYNOPSIS |
6 |
|
|
C !AUTHORS: mitgcm developers ( support@mitgcm.org ) |
7 |
|
|
C !AFFILIATION: Massachussetts Institute of Technology |
8 |
|
|
C !DATE: |
9 |
|
|
C !INTRODUCTION: Kernel dynamical routines |
10 |
|
|
C This document summarises MITgcm code under the model/ subdirectory. |
11 |
|
|
C The code under model/ ( src/ and inc/ ) contains most of |
12 |
|
|
C the driver routines for the baseline forms of the kernel equations in the |
13 |
|
|
C MITgcm algorithm. Numerical code for much of the baseline forms of |
14 |
|
|
C these equations is also under the model/ directory. Other numerical code |
15 |
|
|
C used for the kernel equations is contained in packages in the pkg/ |
16 |
|
|
C directory tree. |
17 |
|
|
C Code for auxilliary equations and alternate dicretizations of the kernel |
18 |
|
|
C equations and algorithm can also be found in the pkg/ directory tree. |
19 |
|
|
C |
20 |
|
|
C \subsection{Getting Help and Reporting Errors and Problems} |
21 |
|
|
C If you have questions please e-mail support@mitgcm.org. We also welcome |
22 |
|
|
C reports of errors and inconsistencies in the code or in the accompanying |
23 |
|
|
C documentation. Please feel free to send these |
24 |
|
|
C to support@mitgcm.org. For further information and to review |
25 |
|
|
C problems reported to support@mitgcm.org please visit http://mitgcm.org. |
26 |
|
|
C |
27 |
|
|
C \subsection{MITgcm Kernel Code Calling Sequence} |
28 |
|
|
C \bv |
29 |
|
|
C |
30 |
|
|
C Invocation from WRAPPER level... |
31 |
|
|
C : |
32 |
|
|
C : |
33 |
|
|
C | |
34 |
|
|
C |-THE_MODEL_MAIN :: Primary driver for the MITgcm algorithm |
35 |
|
|
C | :: Called from WRAPPER level numerical |
36 |
|
|
C | :: code invocation routine. On entry |
37 |
|
|
C | :: to THE_MODEL_MAIN separate thread and |
38 |
|
|
C | :: separate processes will have been established. |
39 |
|
|
C | :: Each thread and process will have a unique ID |
40 |
|
|
C | :: but as yet it will not be associated with a |
41 |
|
|
C | :: specific region in decomposed discrete space. |
42 |
|
|
C | |
43 |
|
|
C |-INITIALISE_FIXED :: Set fixed model arrays such as topography, |
44 |
|
|
C | | :: grid, solver matrices etc.. |
45 |
|
|
C | | |
46 |
|
|
C | |-INI_PARMS :: Routine to set kernel model parameters. |
47 |
|
|
C | | :: By default kernel parameters are read from file |
48 |
|
|
C | | :: "data" in directory in which code executes. |
49 |
|
|
C | | |
50 |
|
|
C | |-MON_INIT :: Initializes monitor package ( see pkg/monitor ) |
51 |
|
|
C | | |
52 |
|
|
C | |-INI_GRID :: Control grid array (vert. and hori.) initialization. |
53 |
|
|
C | | | :: Grid arrays are held and described in GRID.h. |
54 |
|
|
C | | | |
55 |
|
|
C | | |-INI_VERTICAL_GRID :: Initialize vertical grid arrays. |
56 |
|
|
C | | | |
57 |
|
|
C | | |-INI_CARTESIAN_GRID :: Cartesian horiz. grid initialization |
58 |
|
|
C | | | :: (calculate grid from kernel parameters). |
59 |
|
|
C | | | |
60 |
|
|
C | | |-INI_SPHERICAL_POLAR_GRID :: Spherical polar horiz. grid |
61 |
|
|
C | | | :: initialization (calculate grid from |
62 |
|
|
C | | | :: kernel parameters). |
63 |
|
|
C | | | |
64 |
|
|
C | | |-INI_CURVILINEAR_GRID :: General orthogonal, structured horiz. |
65 |
|
|
C | | :: grid initializations. ( input from raw |
66 |
|
|
C | | :: grid files, LONC.bin, DXF.bin etc... ) |
67 |
|
|
C | | |
68 |
|
|
C | |-INI_DEPTHS :: Read (from "bathyFile") or set bathymetry/orgography. |
69 |
|
|
C | | |
70 |
|
|
C | |-INI_MASKS_ETC :: Derive horizontal and vertical cell fractions and |
71 |
|
|
C | | :: land masking for solid-fluid boundaries. |
72 |
|
|
C | | |
73 |
|
|
C | |-INI_LINEAR_PHSURF :: Set ref. surface Bo_surf |
74 |
|
|
C | | |
75 |
|
|
C | |-INI_CORI :: Set coriolis term. zero, f-plane, beta-plane, |
76 |
|
|
C | | :: sphere options are coded. |
77 |
|
|
C | | |
78 |
|
|
C | |-PACAKGES_BOOT :: Start up the optional package environment. |
79 |
|
|
C | | :: Runtime selection of active packages. |
80 |
|
|
C | | |
81 |
|
|
C | |-PACKAGES_READPARMS :: Call active package internal parameter load. |
82 |
|
|
C | | | |
83 |
|
|
C | | |-GMREDI_READPARMS :: GM Package. see pkg/gmredi |
84 |
|
|
C | | |-KPP_READPARMS :: KPP Package. see pkg/kpp |
85 |
|
|
C | | |-SHAP_FILT_READPARMS :: Shapiro filter package. see pkg/shap_filt |
86 |
|
|
C | | |-OBCS_READPARMS :: Open bndy package. see pkg/obcs |
87 |
|
|
C | | |-AIM_READPARMS :: Intermediate Atmos. pacakage. see pkg/aim |
88 |
|
|
C | | |-COST_READPARMS :: Cost function package. see pkg/cost |
89 |
|
|
C | | |-CTRL_INIT :: Control vector support package. see pkg/ctrl |
90 |
|
|
C | | |-OPTIM_READPARMS :: Optimisation support package. see pkg/ctrl |
91 |
|
|
C | | |-GRDCHK_READPARMS :: Gradient check package. see pkg/grdchk |
92 |
|
|
C | | |-ECCO_READPARMS :: ECCO Support Package. see pkg/ecco |
93 |
|
|
C | | |-PTRACERS_READPARMS :: multiple tracer package, see pkg/ptracers |
94 |
|
|
C | | |-GCHEM_READPARMS :: tracer interface package, see pkg/gchem |
95 |
|
|
C | | |
96 |
|
|
C | |-PACKAGES_CHECK |
97 |
|
|
C | | | |
98 |
|
|
C | | |-KPP_CHECK :: KPP Package. pkg/kpp |
99 |
|
|
C | | |-OBCS_CHECK :: Open bndy Pacakge. pkg/obcs |
100 |
|
|
C | | |-GMREDI_CHECK :: GM Package. pkg/gmredi |
101 |
|
|
C | | |
102 |
|
|
C | |-PACKAGES_INIT_FIXED |
103 |
|
|
C | | |-OBCS_INIT_FIXED :: Open bndy Package. see pkg/obcs |
104 |
|
|
C | | |-FLT_INIT :: Floats Package. see pkg/flt |
105 |
|
|
C | | |-GCHEM_INIT_FIXED :: tracer interface pachage, see pkg/gchem |
106 |
|
|
C | | |
107 |
|
|
C | |-ZONAL_FILT_INIT :: FFT filter Package. see pkg/zonal_filt |
108 |
|
|
C | | |
109 |
|
|
C | |-INI_CG2D :: 2d con. grad solver initialization. |
110 |
|
|
C | | |
111 |
|
|
C | |-INI_CG3D :: 3d con. grad solver initialization. |
112 |
|
|
C | | |
113 |
|
|
C | |-CONFIG_SUMMARY :: Provide synopsis of kernel setup. |
114 |
|
|
C | :: Includes annotated table of kernel |
115 |
|
|
C | :: parameter settings. |
116 |
|
|
C | |
117 |
|
|
C |-CTRL_UNPACK :: Control vector support package. see pkg/ctrl |
118 |
|
|
C | |
119 |
|
|
C |-ADTHE_MAIN_LOOP :: Derivative evaluating form of main time stepping loop |
120 |
|
|
C ! :: Auotmatically generated by TAMC/TAF. |
121 |
|
|
C | |
122 |
|
|
C |-CTRL_PACK :: Control vector support package. see pkg/ctrl |
123 |
|
|
C | |
124 |
|
|
C |-GRDCHK_MAIN :: Gradient check package. see pkg/grdchk |
125 |
|
|
C | |
126 |
|
|
C |-THE_MAIN_LOOP :: Main timestepping loop routine. |
127 |
|
|
C | | |
128 |
|
|
C | |-INITIALISE_VARIA :: Set the initial conditions for time evolving |
129 |
|
|
C | | | :: variables |
130 |
|
|
C | | | |
131 |
|
|
C | | |-INI_LINEAR_PHISURF :: Set ref. surface Bo_surf |
132 |
|
|
C | | | |
133 |
|
|
C | | |-INI_CORI :: Set coriolis term. zero, f-plane, beta-plane, |
134 |
|
|
C | | | :: sphere options are coded. |
135 |
|
|
C | | | |
136 |
|
|
C | | |-INI_CG2D :: 2d con. grad solver initialization. |
137 |
|
|
C | | |-INI_CG3D :: 3d con. grad solver initialization. |
138 |
|
|
C | | |-INI_MIXING :: Initialize diapycnal diffusivity. |
139 |
|
|
C | | |-INI_DYNVARS :: Initialize to zero all DYNVARS.h arrays (dynamical |
140 |
|
|
C | | | :: fields). |
141 |
|
|
C | | | |
142 |
|
|
C | | |-INI_FIELDS :: Control initializing model fields to non-zero |
143 |
|
|
C | | | |-INI_VEL :: Initialize 3D flow field. |
144 |
|
|
C | | | |-INI_THETA :: Set model initial temperature field. |
145 |
|
|
C | | | |-INI_SALT :: Set model initial salinity field. |
146 |
|
|
C | | | |-INI_PSURF :: Set model initial free-surface height/pressure. |
147 |
|
|
C | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure |
148 |
|
|
C | | | |-READ_CHECKPOINT :: Read the checkpoint |
149 |
|
|
C | | | |
150 |
|
|
C | | |-THE_CORRECTION_STEP :: Step forward to next time step. |
151 |
|
|
C | | | | :: Here applied to move restart conditions |
152 |
|
|
C | | | | :: (saved in mid timestep) to correct level in |
153 |
|
|
C | | | | :: time (only used for pre-c35). |
154 |
|
|
C | | | | |
155 |
|
|
C | | | |-CALC_GRAD_PHI_SURF :: Return DDx and DDy of surface pressure |
156 |
|
|
C | | | |-CORRECTION_STEP :: Pressure correction to momentum |
157 |
|
|
C | | | |-CYCLE_TRACER :: Move tracers forward in time. |
158 |
|
|
C | | | |-OBCS_APPLY :: Open bndy package. see pkg/obcs |
159 |
|
|
C | | | |-SHAP_FILT_APPLY :: Shapiro filter package. see pkg/shap_filt |
160 |
|
|
C | | | |-ZONAL_FILT_APPLY :: FFT filter package. see pkg/zonal_filt |
161 |
|
|
C | | | |-CONVECTIVE_ADJUSTMENT :: Control static instability mixing. |
162 |
|
|
C | | | | |-FIND_RHO :: Find adjacent densities. |
163 |
|
|
C | | | | |-CONVECT :: Mix static instability. |
164 |
|
|
C | | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
165 |
|
|
C | | | | |
166 |
|
|
C | | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
167 |
|
|
C | | | |
168 |
|
|
C | | |-CONVECTIVE_ADJUSTMENT_INI :: Control static instability mixing |
169 |
|
|
C | | | | :: Extra time history interactions. |
170 |
|
|
C | | | | |
171 |
|
|
C | | | |-FIND_RHO :: Find adjacent densities. |
172 |
|
|
C | | | |-CONVECT :: Mix static instability. |
173 |
|
|
C | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
174 |
|
|
C | | | |
175 |
|
|
C | | |-PACKAGES_INIT_VARIABLES :: Does initialization of time evolving |
176 |
|
|
C | | | | :: package data. |
177 |
|
|
C | | | | |
178 |
|
|
C | | | |-GMREDI_INIT :: GM package. ( see pkg/gmredi ) |
179 |
|
|
C | | | |-KPP_INIT :: KPP package. ( see pkg/kpp ) |
180 |
|
|
C | | | |-KPP_OPEN_DIAGS |
181 |
|
|
C | | | |-OBCS_INIT_VARIABLES :: Open bndy. package. ( see pkg/obcs ) |
182 |
|
|
C | | | |-PTRACERS_INIT :: multi. tracer package,(see pkg/ptracers) |
183 |
|
|
C | | | |-GCHEM_INIT :: tracer interface pkg (see pkh/gchem) |
184 |
|
|
C | | | |-AIM_INIT :: Interm. atmos package. ( see pkg/aim ) |
185 |
|
|
C | | | |-CTRL_MAP_INI :: Control vector package.( see pkg/ctrl ) |
186 |
|
|
C | | | |-COST_INIT :: Cost function package. ( see pkg/cost ) |
187 |
|
|
C | | | |-ECCO_INIT :: ECCO support package. ( see pkg/ecco ) |
188 |
|
|
C | | | |-INI_FORCING :: Set model initial forcing fields. |
189 |
|
|
C | | | | :: Either set in-line or from file as shown. |
190 |
|
|
C | | | |-READ_FLD_XY_RS(zonalWindFile) |
191 |
|
|
C | | | |-READ_FLD_XY_RS(meridWindFile) |
192 |
|
|
C | | | |-READ_FLD_XY_RS(surfQFile) |
193 |
|
|
C | | | |-READ_FLD_XY_RS(EmPmRfile) |
194 |
|
|
C | | | |-READ_FLD_XY_RS(thetaClimFile) |
195 |
|
|
C | | | |-READ_FLD_XY_RS(saltClimFile) |
196 |
|
|
C | | | |-READ_FLD_XY_RS(surfQswFile) |
197 |
|
|
C | | | |
198 |
|
|
C | | |-CALC_SURF_DR :: Calculate the new surface level thickness. |
199 |
|
|
C | | |-UPDATE_SURF_DR :: Update the surface-level thickness fraction. |
200 |
|
|
C | | |-UPDATE_CG2D :: Update 2d conjugate grad. for Free-Surf. |
201 |
|
|
C | | |-STATE_SUMMARY :: Summarize model prognostic variables. |
202 |
|
|
C | | |-TIMEAVE_STATVARS :: Time averaging package ( see pkg/timeave ). |
203 |
|
|
C | | |
204 |
|
|
C | |-WRITE_STATE :: Controlling routine for IO to dump model state. |
205 |
|
|
C | | |-WRITE_REC_XYZ_RL :: Single file I/O |
206 |
|
|
C | | |-WRITE_FLD_XYZ_RL :: Multi-file I/O |
207 |
|
|
C | | |
208 |
|
|
C | |-MONITOR :: Monitor state ( see pkg/monitor ) |
209 |
|
|
C | |-CTRL_MAP_FORCING :: Control vector support package. ( see pkg/ctrl ) |
210 |
|
|
C====|>| |
211 |
|
|
C====|>| **************************** |
212 |
|
|
C====|>| BEGIN MAIN TIMESTEPPING LOOP |
213 |
|
|
C====|>| **************************** |
214 |
|
|
C====|>| |
215 |
|
|
C/\ | |-FORWARD_STEP :: Step forward a time-step ( AT LAST !!! ) |
216 |
|
|
C/\ | | | |
217 |
|
|
C/\ | | |-DUMMY_IN_STEPPING :: autodiff package ( pkg/autoduff ). |
218 |
|
|
C/\ | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
219 |
|
|
C/\ | | |-CALC_SURF_DR :: Calculate the new surface level thickness. |
220 |
|
|
C/\ | | |-EXF_GETFORCING :: External forcing package. ( pkg/exf ) |
221 |
|
|
C/\ | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data. |
222 |
|
|
C/\ | | | | :: Simple interpolation between end-points |
223 |
|
|
C/\ | | | | :: for forcing datasets. |
224 |
|
|
C/\ | | | | |
225 |
|
|
C/\ | | | |-EXCH :: Sync forcing. in overlap regions. |
226 |
|
|
C/\ | | |-SEAICE_MODEL :: Compute sea-ice terms. ( pkg/seaice ) |
227 |
|
|
C/\ | | |-FREEZE :: Limit surface temperature. |
228 |
|
|
C/\ | | |-GCHEM_FIELD_LOAD :: load tracer forcing fields (pkg/gchem) |
229 |
|
|
C/\ | | | |
230 |
|
|
C/\ | | |-THERMODYNAMICS :: theta, salt + tracer equations driver. |
231 |
|
|
C/\ | | | | |
232 |
|
|
C/\ | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity. |
233 |
|
|
C/\ | | | |-OBCS_APPLY_W :: Open bndy. package ( see pkg/obcs ). |
234 |
|
|
C/\ | | | |-FIND_RHO :: Calculates [rho(S,T,z)-RhoConst] of a slice |
235 |
|
|
C/\ | | | |-GRAD_SIGMA :: Calculate isoneutral gradients |
236 |
|
|
C/\ | | | |-CALC_IVDC :: Set Implicit Vertical Diffusivity for Convection |
237 |
|
|
C/\ | | | | |
238 |
|
|
C/\ | | | |-OBCS_CALC :: Open bndy. package ( see pkg/obcs ). |
239 |
|
|
C/\ | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned |
240 |
|
|
C/\ | | | | | :: forcing terms. |
241 |
|
|
C/\ | | | | |-PTRACERS_FORCING_SURF :: Tracer package ( see pkg/ptracers ). |
242 |
|
|
C/\ | | | | |
243 |
|
|
C/\ | | | |-GMREDI_CALC_TENSOR :: GM package ( see pkg/gmredi ). |
244 |
|
|
C/\ | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ). |
245 |
|
|
C/\ | | | |-KPP_CALC :: KPP package ( see pkg/kpp ). |
246 |
|
|
C/\ | | | |-KPP_CALC_DUMMY :: KPP package ( see pkg/kpp ). |
247 |
|
|
C/\ | | | |-AIM_DO_ATMOS_PHYSICS :: Intermed. atmos package ( see pkg/aim ). |
248 |
|
|
C/\ | | | |-GAD_ADVECTION :: Generalised advection driver (multi-dim |
249 |
|
|
C/\ | | | | advection case) (see pkg/gad). |
250 |
|
|
C/\ | | | |-CALC_COMMON_FACTORS :: Calculate common data (such as volume flux) |
251 |
|
|
C/\ | | | |-CALC_DIFFUSIVITY :: Calculate net vertical diffusivity |
252 |
|
|
C/\ | | | | | |
253 |
|
|
C/\ | | | | |-GMREDI_CALC_DIFF :: GM package ( see pkg/gmredi ). |
254 |
|
|
C/\ | | | | |-KPP_CALC_DIFF :: KPP package ( see pkg/kpp ). |
255 |
|
|
C/\ | | | | |
256 |
|
|
C/\ | | | |-CALC_GT :: Calculate the temperature tendency terms |
257 |
|
|
C/\ | | | | | |
258 |
|
|
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
259 |
|
|
C/\ | | | | | | :: ( see pkg/gad ) |
260 |
|
|
C/\ | | | | | |-KPP_TRANSPORT_T :: KPP non-local transport ( see pkg/kpp ). |
261 |
|
|
C/\ | | | | | |
262 |
|
|
C/\ | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature. |
263 |
|
|
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
264 |
|
|
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gt for free-surface height. |
265 |
|
|
C/\ | | | | |
266 |
|
|
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
267 |
|
|
C/\ | | | | |
268 |
|
|
C/\ | | | |-CALC_GS :: Calculate the salinity tendency terms |
269 |
|
|
C/\ | | | | | |
270 |
|
|
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
271 |
|
|
C/\ | | | | | | :: ( see pkg/gad ) |
272 |
|
|
C/\ | | | | | |-KPP_TRANSPORT_S :: KPP non-local transport ( see pkg/kpp ). |
273 |
|
|
C/\ | | | | | |
274 |
|
|
C/\ | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt. |
275 |
|
|
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
276 |
|
|
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height. |
277 |
|
|
C/\ | | | | |
278 |
|
|
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
279 |
|
|
C/\ | | | | |
280 |
|
|
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
281 |
|
|
C/\ | | | | |
282 |
|
|
C/\ | | | |-PTRACERS_INTEGRATE :: Integrate other tracer(s) (see pkg/ptracers). |
283 |
|
|
C/\ | | | | | |
284 |
|
|
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
285 |
|
|
C/\ | | | | | | :: ( see pkg/gad ) |
286 |
|
|
C/\ | | | | | |-KPP_TRANSPORT_PTR:: KPP non-local transport ( see pkg/kpp ). |
287 |
|
|
C/\ | | | | | |
288 |
|
|
C/\ | | | | |-PTRACERS_FORCING :: Problem specific forcing for tracer. |
289 |
|
|
C/\ | | | | |-GCHEM_FORCING_INT :: tracer forcing for gchem pkg (if all |
290 |
|
|
C/\ | | | | | tendency terms calcualted together) |
291 |
|
|
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
292 |
|
|
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height. |
293 |
|
|
C/\ | | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
294 |
|
|
C/\ | | | | |
295 |
|
|
C/\ | | | |-OBCS_APPLY_TS :: Open bndy. package (see pkg/obcs ). |
296 |
|
|
C/\ | | | | |
297 |
|
|
C/\ | | | |-IMPLDIFF :: Solve vertical implicit diffusion equation. |
298 |
|
|
C/\ | | | |-OBCS_APPLY_TS :: Open bndy. package (see pkg/obcs ). |
299 |
|
|
C/\ | | | | |
300 |
|
|
C/\ | | | |-AIM_AIM2DYN_EXCHANGES :: Inetermed. atmos (see pkg/aim). |
301 |
|
|
C/\ | | | |-EXCH :: Update overlaps |
302 |
|
|
C/\ | | | |
303 |
|
|
C/\ | | |-DYNAMICS :: Momentum equations driver. |
304 |
|
|
C/\ | | | | |
305 |
|
|
C/\ | | | |-CALC_GRAD_PHI_SURF :: Calculate the gradient of the surface |
306 |
|
|
C/\ | | | | Potential anomaly. |
307 |
|
|
C/\ | | | |-CALC_VISCOSITY :: Calculate net vertical viscosity |
308 |
|
|
C/\ | | | | |-KPP_CALC_VISC :: KPP package ( see pkg/kpp ). |
309 |
|
|
C/\ | | | | |
310 |
|
|
C/\ | | | |-CALC_PHI_HYD :: Integrate the hydrostatic relation. |
311 |
|
|
C/\ | | | |-MOM_FLUXFORM :: Flux form mom eqn. package ( see |
312 |
|
|
C/\ | | | | pkg/mom_fluxform ). |
313 |
|
|
C/\ | | | | |-MOM_CALC_VISC :: Calculate Horizontal Viscosities |
314 |
|
|
C/\ | | | |-MOM_VECINV :: Vector invariant form mom eqn. package ( see |
315 |
|
|
C/\ | | | | pkg/mom_vecinv ). |
316 |
|
|
C/\ | | | | |-MOM_CALC_VISC :: Calculate Horizontal Viscosities |
317 |
|
|
C/\ | | | |-TIMESTEP :: Step momentum fields forward in time |
318 |
|
|
C/\ | | | |-OBCS_APPLY_UV :: Open bndy. package (see pkg/obcs ). |
319 |
|
|
C/\ | | | | |
320 |
|
|
C/\ | | | |-IMPLDIFF :: Solve vertical implicit diffusion equation. |
321 |
|
|
C/\ | | | |-OBCS_APPLY_UV :: Open bndy. package (see pkg/obcs ). |
322 |
|
|
C/\ | | | | |
323 |
|
|
C/\ | | | |-TIMEAVE_CUMUL_1T :: Time averaging package ( see pkg/timeave ). |
324 |
|
|
C/\ | | | |-TIMEAVE_CUMUATE :: Time averaging package ( see pkg/timeave ). |
325 |
|
|
C/\ | | | |-DEBUG_STATS_RL :: Quick debug package ( see pkg/debug ). |
326 |
|
|
C/\ | | | |
327 |
|
|
C/\ | | |-CALC_GW :: vert. momentum tendency terms ( NH, QH only ). |
328 |
|
|
C/\ | | | |
329 |
|
|
C/\ | | |-UPDATE_SURF_DR :: Update the surface-level thickness fraction. |
330 |
|
|
C/\ | | | |
331 |
|
|
C/\ | | |-UPDATE_CG2D :: Update 2d conjugate grad. for Free-Surf. |
332 |
|
|
C/\ | | | |
333 |
|
|
C/\ | | |-SOLVE_FOR_PRESSURE :: Find surface pressure. |
334 |
|
|
C/\ | | | |-CALC_DIV_GHAT :: Form the RHS of the surface pressure eqn. |
335 |
|
|
C/\ | | | |-CG2D :: Two-dim pre-con. conjugate-gradient. |
336 |
|
|
C/\ | | | |-CG3D :: Three-dim pre-con. conjugate-gradient solver. |
337 |
|
|
C/\ | | | |
338 |
|
|
C/\ | | |-THE_CORRECTION_STEP :: Step forward to next time step. |
339 |
|
|
C/\ | | | | |
340 |
|
|
C/\ | | | |-CALC_GRAD_PHI_SURF :: Return DDx and DDy of surface pressure |
341 |
|
|
C/\ | | | |-CORRECTION_STEP :: Pressure correction to momentum |
342 |
|
|
C/\ | | | |-CYCLE_TRACER :: Move tracers forward in time. |
343 |
|
|
C/\ | | | |-OBCS_APPLY :: Open bndy package. see pkg/obcs |
344 |
|
|
C/\ | | | |-SHAP_FILT_APPLY :: Shapiro filter package. see pkg/shap_filt |
345 |
|
|
C/\ | | | |-ZONAL_FILT_APPLY :: FFT filter package. see pkg/zonal_filt |
346 |
|
|
C/\ | | | |-CONVECTIVE_ADJUSTMENT :: Control static instability mixing. |
347 |
|
|
C/\ | | | | |-FIND_RHO :: Find adjacent densities. |
348 |
|
|
C/\ | | | | |-CONVECT :: Mix static instability. |
349 |
|
|
C/\ | | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
350 |
|
|
C/\ | | | | |
351 |
|
|
C/\ | | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
352 |
|
|
C/\ | | | |
353 |
|
|
C/\ | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions. |
354 |
|
|
C/\ | | | |-EXCH |
355 |
|
|
C/\ | | | |
356 |
|
|
C/\ | | |-GCHEM_FORCING_SEP :: tracer forcing for gchem pkg (if |
357 |
|
|
C/\ | | | tracer dependent tendencies calculated |
358 |
|
|
C/\ | | | separatly) |
359 |
|
|
C/\ | | | |
360 |
|
|
C/\ | | |-FLT_MAIN :: Float package ( pkg/flt ). |
361 |
|
|
C/\ | | | |
362 |
|
|
C/\ | | |-MONITOR :: Monitor package ( pkg/monitor ). |
363 |
|
|
C/\ | | | |
364 |
|
|
C/\ | | |-DO_THE_MODEL_IO :: Standard diagnostic I/O. |
365 |
|
|
C/\ | | | |-WRITE_STATE :: Core state I/O |
366 |
|
|
C/\ | | | |-TIMEAVE_STATV_WRITE :: Time averages. see pkg/timeave |
367 |
|
|
C/\ | | | |-AIM_WRITE_DIAGS :: Intermed. atmos diags. see pkg/aim |
368 |
|
|
C/\ | | | |-GMREDI_DIAGS :: GM diags. see pkg/gmredi |
369 |
|
|
C/\ | | | |-KPP_DO_DIAGS :: KPP diags. see pkg/kpp |
370 |
|
|
C/\ | | | |-SBO_CALC :: SBO diags. see pkg/sbo |
371 |
|
|
C/\ | | | |-SBO_DIAGS :: SBO diags. see pkg/sbo |
372 |
|
|
C/\ | | | |-SEAICE_DO_DIAGS :: SEAICE diags. see pkg/seaice |
373 |
|
|
C/\ | | | |-GCHEM_DIAGS :: gchem diags. see pkg/gchem |
374 |
|
|
C/\ | | | |
375 |
|
|
C/\ | | |-WRITE_CHECKPOINT :: Do I/O for restart files. |
376 |
|
|
C/\ | | |
377 |
|
|
C/\ | |-COST_TILE :: Cost function package. ( see pkg/cost ) |
378 |
|
|
C<===|=| |
379 |
|
|
C<===|=| ************************** |
380 |
|
|
C<===|=| END MAIN TIMESTEPPING LOOP |
381 |
|
|
C<===|=| ************************** |
382 |
|
|
C<===|=| |
383 |
|
|
C | |-COST_FINAL :: Cost function package. ( see pkg/cost ) |
384 |
|
|
C | |
385 |
|
|
C |-WRITE_CHECKPOINT :: Final state storage, for restart. |
386 |
|
|
C | |
387 |
|
|
C |-TIMER_PRINTALL :: Computational timing summary |
388 |
|
|
C | |
389 |
|
|
C |-COMM_STATS :: Summarise inter-proc and inter-thread communication |
390 |
|
|
C :: events. |
391 |
|
|
C |
392 |
|
|
C \ev |
393 |
|
|
C |
394 |
|
|
C |
395 |
|
|
CEOI |
396 |
|
|
|
397 |
|
|
|
398 |
|
|
#include "AD_CONFIG.h" |
399 |
|
|
#include "PACKAGES_CONFIG.h" |
400 |
|
|
#include "CPP_OPTIONS.h" |
401 |
|
|
|
402 |
|
|
CBOP |
403 |
|
|
|
404 |
|
|
C !ROUTINE: THE_MODEL_MAIN |
405 |
|
|
|
406 |
|
|
C !INTERFACE: |
407 |
|
|
SUBROUTINE THE_MODEL_MAIN(myThid) |
408 |
|
|
IMPLICIT NONE |
409 |
|
|
|
410 |
|
|
C !DESCRIPTION: \bv |
411 |
|
|
C *==========================================================* |
412 |
|
|
C | SUBROUTINE THE_MODEL_MAIN |
413 |
|
|
C | o Master controlling routine for model using the MITgcm |
414 |
|
|
C | UV parallel wrapper. |
415 |
|
|
C *==========================================================* |
416 |
|
|
C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
417 |
|
|
C | wrapper with a single integer argument "myThid". This |
418 |
|
|
C | variable identifies the thread number of an instance of |
419 |
|
|
C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
420 |
|
|
C | on a particular region of the models domain and |
421 |
|
|
C | synchronises with other instances as necessary. The |
422 |
|
|
C | routine has to "understand" the MITgcm parallel |
423 |
|
|
C | environment and the numerical algorithm. Editing this |
424 |
|
|
C | routine is best done with some knowledge of both aspects. |
425 |
|
|
C | Notes |
426 |
|
|
C | ===== |
427 |
|
|
C | C*P* comments indicating place holders for which code is |
428 |
|
|
C | presently being developed. |
429 |
|
|
C *==========================================================* |
430 |
|
|
C \ev |
431 |
|
|
|
432 |
|
|
C !CALLING SEQUENCE: |
433 |
|
|
C THE_MODEL_MAIN() |
434 |
|
|
C | |
435 |
|
|
C | |
436 |
|
|
C |--INITIALISE_FIXED |
437 |
|
|
C | o Set model configuration (fixed arrays) |
438 |
|
|
C | Topography, hydrography, timestep, grid, etc.. |
439 |
|
|
C | |
440 |
|
|
C |--CTRL_UNPACK o Derivative mode. Unpack control vector. |
441 |
|
|
C | |
442 |
|
|
C |--ADTHE_MAIN_LOOP o Main timestepping loop for combined |
443 |
|
|
C | prognostic and reverse mode integration. |
444 |
|
|
C | |
445 |
|
|
C |--CTRL_PACK o Derivative mode. Unpack control vector. |
446 |
|
|
C | |
447 |
|
|
C |--GRDCHK_MAIN o Gradient check control routine. |
448 |
|
|
C | |
449 |
|
|
C |--THE_MAIN_LOOP o Main timestepping loop for pure prognostic |
450 |
|
|
C | integration. |
451 |
|
|
C | |
452 |
|
|
C |--WRITE_CHECKPOINT o Write retsart information. |
453 |
|
|
C | |
454 |
|
|
C |--TIMER_PRINTALL o Print out timing statistics. |
455 |
|
|
C | |
456 |
|
|
C |--COMM_STATS o Print out communication statistics. |
457 |
|
|
|
458 |
|
|
C !USES: |
459 |
|
|
C == Global variables === |
460 |
|
|
|
461 |
|
|
use OAD_active |
462 |
|
|
use OAD_rev |
463 |
|
|
use OAD_tape |
464 |
|
|
use OAD_cp |
465 |
|
|
#include "cost.h" |
466 |
|
|
|
467 |
|
|
#include "SIZE.h" |
468 |
|
|
#include "EEPARAMS.h" |
469 |
|
|
#include "PARAMS.h" |
470 |
|
|
#include "DYNVARS.h" |
471 |
|
|
|
472 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
473 |
|
|
# include "tamc.h" |
474 |
|
|
#endif |
475 |
|
|
#ifdef ALLOW_CTRL |
476 |
|
|
# include "ctrl.h" |
477 |
|
|
# include "optim.h" |
478 |
|
|
#endif |
479 |
|
|
|
480 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
481 |
|
|
C == Routine arguments == |
482 |
|
|
C myThid - Thread number for this instance of the routine. |
483 |
|
|
INTEGER myThid |
484 |
|
|
|
485 |
|
|
C !LOCAL VARIABLES: |
486 |
|
|
C == Local variables == |
487 |
|
|
C Note: Under the multi-threaded model myCurrentIter and |
488 |
|
|
C myCurrentTime are local variables passed around as routine |
489 |
|
|
C arguments. Although this is fiddly it saves the need to |
490 |
|
|
C impose additional synchronisation points when they are |
491 |
|
|
C updated. |
492 |
|
|
C myCurrentTime - Time counter for this thread |
493 |
|
|
C myCurrentIter - Iteration counter for this thread |
494 |
|
|
INTEGER myCurrentIter |
495 |
|
|
_RL myCurrentTime |
496 |
|
|
logical exst |
497 |
|
|
logical lastdiva |
498 |
|
|
_RL foo(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
499 |
|
|
_RL fooEtan(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
500 |
|
|
CHARACTER*(10) suff |
501 |
|
|
C Temprarily change precision to agree with ctrlprec |
502 |
|
|
INTEGER tmpprec |
503 |
|
|
|
504 |
|
|
CEOP |
505 |
|
|
c-- set default: |
506 |
|
|
lastdiva = .TRUE. |
507 |
|
|
|
508 |
|
|
c set the execution mode |
509 |
|
|
our_rev_mode%arg_store=.FALSE. |
510 |
|
|
our_rev_mode%arg_restore=.FALSE. |
511 |
|
|
our_rev_mode%res_store=.FALSE. |
512 |
|
|
our_rev_mode%res_restore=.FALSE. |
513 |
|
|
our_rev_mode%plain=.TRUE. |
514 |
|
|
our_rev_mode%tape=.FALSE. |
515 |
|
|
our_rev_mode%adjoint=.FALSE. |
516 |
|
|
our_rev_mode%switchedToCheckpoint=.FALSE. |
517 |
|
|
c initialize the tape |
518 |
|
|
call oad_tape_init() |
519 |
|
|
c initialize the checkpoint areas |
520 |
|
|
call cp_init() |
521 |
|
|
|
522 |
|
|
#ifdef ALLOW_DEBUG |
523 |
|
|
IF (debugMode) CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid) |
524 |
|
|
#endif |
525 |
|
|
|
526 |
|
|
#if defined(USE_PAPI) || defined(USE_PCL_FLOPS_SFP) || defined(USE_PCL_FLOPS) || defined(USE_PCL) |
527 |
|
|
CALL TIMER_CONTROL('','INIT','THE_MODEL_MAIN',myThid) |
528 |
|
|
#endif |
529 |
|
|
C-- This timer encompasses the whole code |
530 |
|
|
CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid) |
531 |
|
|
|
532 |
|
|
#ifdef ALLOW_DEBUG |
533 |
|
|
IF (debugMode) CALL DEBUG_CALL('INITIALISE_FIXED',myThid) |
534 |
|
|
#endif |
535 |
|
|
|
536 |
|
|
C-- Set model configuration (fixed arrays) |
537 |
|
|
CALL TIMER_START('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
538 |
|
|
CALL OpenAD_INITIALISE_FIXED( myThid ) |
539 |
|
|
CALL TIMER_STOP ('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
540 |
|
|
|
541 |
|
|
myCurrentTime = startTime |
542 |
|
|
myCurrentIter = nIter0 |
543 |
|
|
|
544 |
|
|
#if ( defined (ALLOW_ADMTLM) ) |
545 |
|
|
c |
546 |
|
|
STOP 'should never get here; ADMTLM_DSVD calls ADMTLM_DRIVER' |
547 |
|
|
c |
548 |
|
|
#elif ( defined (ALLOW_AUTODIFF)) |
549 |
|
|
|
550 |
|
|
# ifndef EXCLUDE_CTRL_PACK |
551 |
|
|
_BEGIN_MASTER( mythid ) |
552 |
|
|
IF (myProcId .eq. 0) THEN |
553 |
|
|
inquire( file='costfinal', exist=exst ) |
554 |
|
|
IF ( .NOT. exst ) THEN |
555 |
|
|
IF ( optimcycle.NE.0 .AND. doMainUnpack ) THEN |
556 |
|
|
CALL TIMER_START('CTRL_UNPACK [THE_MODEL_MAIN]',mythid) |
557 |
|
|
CALL CTRL_UNPACK( .TRUE. , mythid ) |
558 |
|
|
CALL TIMER_STOP ('CTRL_UNPACK [THE_MODEL_MAIN]',mythid) |
559 |
|
|
ENDIF |
560 |
|
|
ENDIF |
561 |
|
|
ENDIF |
562 |
|
|
_END_MASTER( mythid ) |
563 |
|
|
_BARRIER |
564 |
|
|
# endif /* EXCLUDE_CTRL_PACK */ |
565 |
|
|
|
566 |
|
|
# ifdef ALLOW_COST |
567 |
|
|
CALL COST_DEPENDENT_INIT ( mythid ) |
568 |
|
|
_BARRIER |
569 |
|
|
# endif |
570 |
|
|
|
571 |
|
|
# if ( defined (ALLOW_TANGENTLINEAR_RUN) ) |
572 |
|
|
c |
573 |
|
|
CALL TIMER_START('G_THE_MAIN_LOOP [TANGENT RUN]',mythid) |
574 |
|
|
CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid ) |
575 |
|
|
CALL TIMER_STOP ('G_THE_MAIN_LOOP [TANGENT RUN]',mythid) |
576 |
|
|
c |
577 |
|
|
# elif ( defined (ALLOW_ADJOINT_RUN) || \ |
578 |
|
|
defined (ALLOW_ECCO_OPTIMIZATION) ) |
579 |
|
|
c |
580 |
|
|
# ifdef ALLOW_DIVIDED_ADJOINT |
581 |
|
|
c-- The following assumes the TAF option '-pure' |
582 |
|
|
inquire( file='costfinal', exist=exst ) |
583 |
|
|
IF ( .NOT. exst) THEN |
584 |
|
|
CALL TIMER_START('MDTHE_MAIN_LOOP [MD RUN]', mythid) |
585 |
|
|
CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid ) |
586 |
|
|
CALL TIMER_STOP ('MDTHE_MAIN_LOOP [MD RUN]', mythid) |
587 |
|
|
CALL COST_FINAL_STORE ( mythid, lastdiva ) |
588 |
|
|
ELSE |
589 |
|
|
CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
590 |
|
|
CALL ADTHE_MAIN_LOOP ( mythid ) |
591 |
|
|
CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
592 |
|
|
CALL COST_FINAL_RESTORE ( mythid, lastdiva ) |
593 |
|
|
ENDIF |
594 |
|
|
c-- |
595 |
|
|
# else /* ALLOW_DIVIDED_ADJOINT undef */ |
596 |
|
|
CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
597 |
|
|
#ifdef ALLOW_ECCO |
598 |
|
|
CALL ADTHE_MAIN_LOOP ( myCurrentTime, mythid ) |
599 |
|
|
#else |
600 |
|
|
CALL ADTHE_MAIN_LOOP ( mythid ) |
601 |
|
|
#endif |
602 |
|
|
CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
603 |
|
|
# endif /* ALLOW_DIVIDED_ADJOINT */ |
604 |
|
|
c |
605 |
|
|
# else /* forward run only within AD setting */ |
606 |
|
|
|
607 |
|
|
#ifdef ALLOW_DEBUG |
608 |
|
|
IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid) |
609 |
|
|
#endif |
610 |
|
|
C-- Call time stepping loop of full model |
611 |
|
|
CALL TIMER_START('THE_MAIN_LOOP (F) [THE_MODEL_MAIN]',myThid) |
612 |
|
|
our_rev_mode%plain=.FALSE. |
613 |
|
|
our_rev_mode%tape=.TRUE. |
614 |
|
|
call timeratio() |
615 |
|
|
CALL OpenAD_THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid ) |
616 |
|
|
CALL TIMER_STOP ('THE_MAIN_LOOP (F) [THE_MODEL_MAIN]',myThid) |
617 |
|
|
CALL TIMER_START('THE_MAIN_LOOP (A) [THE_MODEL_MAIN]',myThid) |
618 |
|
|
our_rev_mode%arg_store=.FALSE. |
619 |
|
|
our_rev_mode%arg_restore=.FALSE. |
620 |
|
|
our_rev_mode%plain=.FALSE. |
621 |
|
|
our_rev_mode%tape=.FALSE. |
622 |
|
|
our_rev_mode%adjoint=.TRUE. |
623 |
|
|
fc%d=1.0 |
624 |
|
|
call timeratio() |
625 |
|
|
CALL OpenAD_THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid ) |
626 |
|
|
call timeratio() |
627 |
|
|
our_rev_mode%arg_store=.FALSE. |
628 |
|
|
our_rev_mode%arg_restore=.FALSE. |
629 |
|
|
our_rev_mode%plain=.TRUE. |
630 |
|
|
our_rev_mode%tape=.FALSE. |
631 |
|
|
our_rev_mode%adjoint=.FALSE. |
632 |
|
|
do i1=1-olx,snx+olx |
633 |
|
|
do i2=1-oly,sny+oly |
634 |
|
|
do i3=1,nr |
635 |
|
|
do i4=1,nsx |
636 |
|
|
do i5=1,nsy |
637 |
|
|
write (*,'(A,5(I3,A),E25.17E3,A,E25.17E3)') 'JU: (', |
638 |
|
|
+i1,',',i2,',',i3,',',i4,',',i5,') salt/theta ', |
639 |
|
|
+xx_salt(i1,i2,i3,i4,i5)%d,'/',xx_theta(i1,i2,i3,i4,i5)%d |
640 |
|
|
end do |
641 |
|
|
end do |
642 |
|
|
end do |
643 |
|
|
end do |
644 |
|
|
end do |
645 |
|
|
C Temporarily change setting of writeBinaryPrec |
646 |
|
|
tmpprec = writeBinaryPrec |
647 |
|
|
writeBinaryPrec = ctrlprec |
648 |
|
|
WRITE(suff,'(I10.10)') 0 |
649 |
|
|
foo=xx_theta%d |
650 |
|
|
call write_fld_xyz_rl('adxx_theta.',suff,foo,myiter,1) |
651 |
|
|
foo=xx_salt%d |
652 |
|
|
call write_fld_xyz_rl('adxx_salt.',suff,foo,myiter,1) |
653 |
|
|
fooEtan=etan%d |
654 |
|
|
call write_fld_xy_rl('adxx_etan.',suff,fooEtan,myiter,1) |
655 |
|
|
C Change back to original writeBinaryPrec |
656 |
|
|
writeBinaryPrec = tmpprec |
657 |
|
|
our_rev_mode%plain=.TRUE. |
658 |
|
|
our_rev_mode%tape=.FALSE. |
659 |
|
|
our_rev_mode%adjoint=.FALSE. |
660 |
|
|
CALL TIMER_STOP ('THE_MAIN_LOOP (A) [THE_MODEL_MAIN]',myThid) |
661 |
|
|
|
662 |
|
|
# endif |
663 |
|
|
|
664 |
|
|
# ifndef EXCLUDE_CTRL_PACK |
665 |
|
|
_BEGIN_MASTER( mythid ) |
666 |
|
|
IF ( myProcId .eq. 0 .AND. lastdiva .AND. doMainPack ) THEN |
667 |
|
|
CALL TIMER_START('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
668 |
|
|
CALL CTRL_PACK( .FALSE. , mythid ) |
669 |
|
|
CALL TIMER_STOP ('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
670 |
|
|
IF ( ( optimcycle.EQ.0 .OR. (.NOT. doMainUnpack) ) |
671 |
|
|
& .AND. mycurrentiter.EQ.niter0 ) THEN |
672 |
|
|
CALL TIMER_START('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
673 |
|
|
CALL CTRL_PACK( .TRUE. , mythid ) |
674 |
|
|
CALL TIMER_STOP ('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
675 |
|
|
ENDIF |
676 |
|
|
ENDIF |
677 |
|
|
_END_MASTER( mythid ) |
678 |
|
|
_BARRIER |
679 |
|
|
# endif /* EXCLUDE_CTRL_PACK */ |
680 |
|
|
|
681 |
|
|
|
682 |
|
|
# ifdef ALLOW_GRDCHK |
683 |
|
|
IF ( useGrdchk .AND. lastdiva ) THEN |
684 |
|
|
CALL TIMER_START('GRDCHK_MAIN [THE_MODEL_MAIN]',mythid) |
685 |
|
|
CALL GRDCHK_MAIN( mythid ) |
686 |
|
|
CALL TIMER_STOP ('GRDCHK_MAIN [THE_MODEL_MAIN]',mythid) |
687 |
|
|
_BARRIER |
688 |
|
|
ENDIF |
689 |
|
|
# endif |
690 |
|
|
|
691 |
|
|
#else /* ALL AD-related undef */ |
692 |
|
|
|
693 |
|
|
#ifdef ALLOW_DEBUG |
694 |
|
|
IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid) |
695 |
|
|
#endif |
696 |
|
|
C-- Call time stepping loop of full model |
697 |
|
|
CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
698 |
|
|
CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid ) |
699 |
|
|
CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
700 |
|
|
|
701 |
|
|
#endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM */ |
702 |
|
|
|
703 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
704 |
|
|
IF (useDiagnostics) THEN |
705 |
|
|
C Close all diagnostics output files |
706 |
|
|
CALL DIAGSTATS_CLOSE_IO( myThid ) |
707 |
|
|
ENDIF |
708 |
|
|
#endif |
709 |
|
|
|
710 |
|
|
#ifdef ALLOW_MNC |
711 |
|
|
IF (useMNC) THEN |
712 |
|
|
C Close all open NetCDF files |
713 |
|
|
_BEGIN_MASTER( mythid ) |
714 |
|
|
CALL MNC_FILE_CLOSE_ALL( myThid ) |
715 |
|
|
_END_MASTER( mythid ) |
716 |
|
|
ENDIF |
717 |
|
|
#endif |
718 |
|
|
|
719 |
|
|
C-- This timer encompasses the whole code |
720 |
|
|
CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid) |
721 |
|
|
|
722 |
|
|
C-- Write timer statistics |
723 |
|
|
IF ( myThid .EQ. 1 ) THEN |
724 |
|
|
CALL TIMER_PRINTALL( myThid ) |
725 |
|
|
CALL COMM_STATS |
726 |
|
|
ENDIF |
727 |
|
|
|
728 |
|
|
C-- Check threads synchronization : |
729 |
|
|
CALL BAR_CHECK( 9, myThid ) |
730 |
|
|
|
731 |
|
|
#ifdef ALLOW_DEBUG |
732 |
|
|
IF (debugMode) CALL DEBUG_LEAVE('THE_MODEL_MAIN',myThid) |
733 |
|
|
#endif |
734 |
|
|
|
735 |
|
|
RETURN |
736 |
|
|
END |