34 |
C | |
C | |
35 |
C |-THE_MODEL_MAIN :: Primary driver for the MITgcm algorithm |
C |-THE_MODEL_MAIN :: Primary driver for the MITgcm algorithm |
36 |
C | :: Called from WRAPPER level numerical |
C | :: Called from WRAPPER level numerical |
37 |
C | :: code innvocation routine. On entry |
C | :: code invocation routine. On entry |
38 |
C | :: to THE_MODEL_MAIN separate thread and |
C | :: to THE_MODEL_MAIN separate thread and |
39 |
C | :: separate processes will have been established. |
C | :: separate processes will have been established. |
40 |
C | :: Each thread and process will have a unique ID |
C | :: Each thread and process will have a unique ID |
43 |
C | |
C | |
44 |
C |-INITIALISE_FIXED :: Set fixed model arrays such as topography, |
C |-INITIALISE_FIXED :: Set fixed model arrays such as topography, |
45 |
C | | :: grid, solver matrices etc.. |
C | | :: grid, solver matrices etc.. |
46 |
C | | |
C | | |
47 |
C | |-INI_PARMS :: Routine to set kernel model parameters. |
C | |-INI_PARMS :: Routine to set kernel model parameters. |
48 |
C | | :: By default kernel parameters are read from file |
C | | :: By default kernel parameters are read from file |
49 |
C | | :: "data" in directory in which code executes. |
C | | :: "data" in directory in which code executes. |
50 |
C | | |
C | | |
51 |
C | |-MON_INIT :: Initialises monitor pacakge ( see pkg/monitor ) |
C | |-MON_INIT :: Initializes monitor package ( see pkg/monitor ) |
52 |
C | | |
C | | |
53 |
C | |-INI_GRID :: Control grid array (vert. and hori.) initialisation. |
C | |-INI_GRID :: Control grid array (vert. and hori.) initialization. |
54 |
C | | | :: Grid arrays are held and described in GRID.h. |
C | | | :: Grid arrays are held and described in GRID.h. |
55 |
C | | | |
C | | | |
56 |
C | | |-INI_VERTICAL_GRID :: Initialise vertical grid arrays. |
C | | |-INI_VERTICAL_GRID :: Initialize vertical grid arrays. |
57 |
C | | | |
C | | | |
58 |
C | | |-INI_CARTESIAN_GRID :: Cartesian horiz. grid initialisation |
C | | |-INI_CARTESIAN_GRID :: Cartesian horiz. grid initialization |
59 |
C | | | :: (calculate grid from kernel parameters). |
C | | | :: (calculate grid from kernel parameters). |
60 |
C | | | |
C | | | |
61 |
C | | |-INI_SPHERICAL_POLAR_GRID :: Spherical polar horiz. grid |
C | | |-INI_SPHERICAL_POLAR_GRID :: Spherical polar horiz. grid |
62 |
C | | | :: initialisation (calculate grid from |
C | | | :: initialization (calculate grid from |
63 |
C | | | :: kernel parameters). |
C | | | :: kernel parameters). |
64 |
C | | | |
C | | | |
65 |
C | | |-INI_CURVILINEAR_GRID :: General orthogonal, structured horiz. |
C | | |-INI_CURVILINEAR_GRID :: General orthogonal, structured horiz. |
66 |
C | | :: grid initialisations. ( input from raw |
C | | :: grid initializations. ( input from raw |
67 |
C | | :: grid files, LONC.bin, DXF.bin etc... ) |
C | | :: grid files, LONC.bin, DXF.bin etc... ) |
68 |
C | | |
C | | |
69 |
C | |-INI_DEPTHS :: Read (from "bathyFile") or set bathymetry/orgography. |
C | |-INI_DEPTHS :: Read (from "bathyFile") or set bathymetry/orgography. |
74 |
C | |-INI_LINEAR_PHSURF :: Set ref. surface Bo_surf |
C | |-INI_LINEAR_PHSURF :: Set ref. surface Bo_surf |
75 |
C | | |
C | | |
76 |
C | |-INI_CORI :: Set coriolis term. zero, f-plane, beta-plane, |
C | |-INI_CORI :: Set coriolis term. zero, f-plane, beta-plane, |
77 |
C | | :: sphere optins are coded. |
C | | :: sphere options are coded. |
78 |
C | | |
C | | |
79 |
C | |-PACAKGES_BOOT :: Start up the optional package environment. |
C | |-PACAKGES_BOOT :: Start up the optional package environment. |
80 |
C | | :: Runtime selection of active packages. |
C | | :: Runtime selection of active packages. |
91 |
C | | |-OPTIM_READPARMS :: Optimisation support package. see pkg/ctrl |
C | | |-OPTIM_READPARMS :: Optimisation support package. see pkg/ctrl |
92 |
C | | |-GRDCHK_READPARMS :: Gradient check package. see pkg/grdchk |
C | | |-GRDCHK_READPARMS :: Gradient check package. see pkg/grdchk |
93 |
C | | |-ECCO_READPARMS :: ECCO Support Package. see pkg/ecco |
C | | |-ECCO_READPARMS :: ECCO Support Package. see pkg/ecco |
94 |
|
C | | |-PTRACERS_READPARMS :: multiple tracer package, see pkg/ptracers |
95 |
|
C | | |-GCHEM_READPARMS :: tracer interface package, see pkg/gchem |
96 |
C | | |
C | | |
97 |
C | |-PACKAGES_CHECK |
C | |-PACKAGES_CHECK |
98 |
C | | | |
C | | | |
103 |
C | |-PACKAGES_INIT_FIXED |
C | |-PACKAGES_INIT_FIXED |
104 |
C | | |-OBCS_INIT_FIXED :: Open bndy Package. see pkg/obcs |
C | | |-OBCS_INIT_FIXED :: Open bndy Package. see pkg/obcs |
105 |
C | | |-FLT_INIT :: Floats Package. see pkg/flt |
C | | |-FLT_INIT :: Floats Package. see pkg/flt |
106 |
|
C | | |-GCHEM_INIT_FIXED :: tracer interface pachage, see pkg/gchem |
107 |
C | | |
C | | |
108 |
C | |-ZONAL_FILT_INIT :: FFT filter Package. see pkg/zonal_filt |
C | |-ZONAL_FILT_INIT :: FFT filter Package. see pkg/zonal_filt |
109 |
C | | |
C | | |
110 |
C | |-INI_CG2D :: 2d con. grad solver initialisation. |
C | |-INI_CG2D :: 2d con. grad solver initialization. |
111 |
C | | |
C | | |
112 |
C | |-INI_CG3D :: 3d con. grad solver initialisation. |
C | |-INI_CG3D :: 3d con. grad solver initialization. |
113 |
C | | |
C | | |
114 |
C | |-CONFIG_SUMMARY :: Provide synopsis of kernel setup. |
C | |-CONFIG_SUMMARY :: Provide synopsis of kernel setup. |
115 |
C | :: Includes annotated table of kernel |
C | :: Includes annotated table of kernel |
118 |
C |-CTRL_UNPACK :: Control vector support package. see pkg/ctrl |
C |-CTRL_UNPACK :: Control vector support package. see pkg/ctrl |
119 |
C | |
C | |
120 |
C |-ADTHE_MAIN_LOOP :: Derivative evaluating form of main time stepping loop |
C |-ADTHE_MAIN_LOOP :: Derivative evaluating form of main time stepping loop |
121 |
C ! :: Auotmatically gerenrated by TAMC/TAF. |
C ! :: Auotmatically generated by TAMC/TAF. |
122 |
C | |
C | |
123 |
C |-CTRL_PACK :: Control vector support package. see pkg/ctrl |
C |-CTRL_PACK :: Control vector support package. see pkg/ctrl |
124 |
C | |
C | |
132 |
C | | |-INI_LINEAR_PHISURF :: Set ref. surface Bo_surf |
C | | |-INI_LINEAR_PHISURF :: Set ref. surface Bo_surf |
133 |
C | | | |
C | | | |
134 |
C | | |-INI_CORI :: Set coriolis term. zero, f-plane, beta-plane, |
C | | |-INI_CORI :: Set coriolis term. zero, f-plane, beta-plane, |
135 |
C | | | :: sphere optins are coded. |
C | | | :: sphere options are coded. |
136 |
C | | | |
C | | | |
137 |
C | | |-INI_CG2D :: 2d con. grad solver initialisation. |
C | | |-INI_CG2D :: 2d con. grad solver initialization. |
138 |
C | | |-INI_CG3D :: 3d con. grad solver initialisation. |
C | | |-INI_CG3D :: 3d con. grad solver initialization. |
139 |
C | | |-INI_MIXING :: Initialise diapycnal diffusivity. |
C | | |-INI_MIXING :: Initialize diapycnal diffusivity. |
140 |
C | | |-INI_DYNVARS :: Initialise to zero all DYNVARS.h arrays (dynamical |
C | | |-INI_DYNVARS :: Initialize to zero all DYNVARS.h arrays (dynamical |
141 |
C | | | :: fields). |
C | | | :: fields). |
142 |
C | | | |
C | | | |
143 |
C | | |-INI_FIELDS :: Control initialising model fields to non-zero |
C | | |-INI_FIELDS :: Control initializing model fields to non-zero |
144 |
C | | | |-INI_VEL :: Initialize 3D flow field. |
C | | | |-INI_VEL :: Initialize 3D flow field. |
145 |
C | | | |-INI_THETA :: Set model initial temperature field. |
C | | | |-INI_THETA :: Set model initial temperature field. |
146 |
C | | | |-INI_SALT :: Set model initial salinity field. |
C | | | |-INI_SALT :: Set model initial salinity field. |
147 |
C | | | |-INI_PSURF :: Set model initial free-surface height/pressure. |
C | | | |-INI_PSURF :: Set model initial free-surface height/pressure. |
148 |
C | | | |
C | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure |
149 |
C | | |-INI_TR1 :: Set initial tracer 1 distribution. |
C | | | |-READ_CHECKPOINT :: Read the checkpoint |
150 |
C | | | |
C | | | |
151 |
C | | |-THE_CORRECTION_STEP :: Step forward to next time step. |
C | | |-THE_CORRECTION_STEP :: Step forward to next time step. |
152 |
C | | | | :: Here applied to move restart conditions |
C | | | | :: Here applied to move restart conditions |
163 |
C | | | | |-FIND_RHO :: Find adjacent densities. |
C | | | | |-FIND_RHO :: Find adjacent densities. |
164 |
C | | | | |-CONVECT :: Mix static instability. |
C | | | | |-CONVECT :: Mix static instability. |
165 |
C | | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
C | | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
166 |
C | | | | |
C | | | | |
167 |
C | | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
C | | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
168 |
C | | | |
C | | | |
169 |
C | | |-CONVECTIVE_ADJUSTMENT_INI :: Control static instability mixing |
C | | |-CONVECTIVE_ADJUSTMENT_INI :: Control static instability mixing |
170 |
C | | | | :: Extra time history interactions. |
C | | | | :: Extra time history interactions. |
171 |
C | | | | |
C | | | | |
172 |
C | | | |-FIND_RHO :: Find adjacent densities. |
C | | | |-FIND_RHO :: Find adjacent densities. |
173 |
C | | | |-CONVECT :: Mix static instability. |
C | | | |-CONVECT :: Mix static instability. |
174 |
C | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
C | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
175 |
C | | | |
C | | | |
176 |
C | | |-PACKAGES_INIT_VARIABLES :: Does initialisation of time evolving |
C | | |-PACKAGES_INIT_VARIABLES :: Does initialization of time evolving |
177 |
C | | | | :: package data. |
C | | | | :: package data. |
178 |
C | | | | |
C | | | | |
179 |
C | | | |-GMREDI_INIT :: GM package. ( see pkg/gmredi ) |
C | | | |-GMREDI_INIT :: GM package. ( see pkg/gmredi ) |
180 |
C | | | |-KPP_INIT :: KPP package. ( see pkg/kpp ) |
C | | | |-KPP_INIT :: KPP package. ( see pkg/kpp ) |
181 |
C | | | |-KPP_OPEN_DIAGS |
C | | | |-KPP_OPEN_DIAGS |
182 |
C | | | |-OBCS_INIT_VARIABLES :: Open bndy. package. ( see pkg/obcs ) |
C | | | |-OBCS_INIT_VARIABLES :: Open bndy. package. ( see pkg/obcs ) |
183 |
|
C | | | |-PTRACERS_INIT :: multi. tracer package,(see pkg/ptracers) |
184 |
|
C | | | |-GCHEM_INIT :: tracer interface pkg (see pkh/gchem) |
185 |
C | | | |-AIM_INIT :: Interm. atmos package. ( see pkg/aim ) |
C | | | |-AIM_INIT :: Interm. atmos package. ( see pkg/aim ) |
186 |
C | | | |-CTRL_MAP_INI :: Control vector package.( see pkg/ctrl ) |
C | | | |-CTRL_MAP_INI :: Control vector package.( see pkg/ctrl ) |
187 |
C | | | |-COST_INIT :: Cost function package. ( see pkg/cost ) |
C | | | |-COST_INIT :: Cost function package. ( see pkg/cost ) |
220 |
C/\ | | |-CALC_SURF_DR :: Calculate the new surface level thickness. |
C/\ | | |-CALC_SURF_DR :: Calculate the new surface level thickness. |
221 |
C/\ | | |-EXF_GETFORCING :: External forcing package. ( pkg/exf ) |
C/\ | | |-EXF_GETFORCING :: External forcing package. ( pkg/exf ) |
222 |
C/\ | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data. |
C/\ | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data. |
223 |
C/\ | | | | :: Simple interpolcation between end-points |
C/\ | | | | :: Simple interpolation between end-points |
224 |
C/\ | | | | :: for forcing datasets. |
C/\ | | | | :: for forcing datasets. |
225 |
C/\ | | | | |
C/\ | | | | |
226 |
C/\ | | | |-EXCH :: Sync forcing. in overlap regions. |
C/\ | | | |-EXCH :: Sync forcing. in overlap regions. |
227 |
|
C/\ | | |-SEAICE_MODEL :: Compute sea-ice terms. ( pkg/seaice ) |
228 |
|
C/\ | | |-FREEZE :: Limit surface temperature. |
229 |
|
C/\ | | |-GCHEM_FIELD_LOAD :: load tracer forcing fields (pkg/gchem) |
230 |
C/\ | | | |
C/\ | | | |
231 |
C/\ | | |-THERMODYNAMICS :: theta, salt + tracer equations driver. |
C/\ | | |-THERMODYNAMICS :: theta, salt + tracer equations driver. |
232 |
C/\ | | | | |
C/\ | | | | |
233 |
C/\ | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity. |
C/\ | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity. |
234 |
C/\ | | | |-OBCS_APPLY_W :: Open bndy. package ( see pkg/obcs ). |
C/\ | | | |-OBCS_APPLY_W :: Open bndy. package ( see pkg/obcs ). |
235 |
C/\ | | | |-FIND_RHO :: Calculates [rho(S,T,z)-Rhonil] of a slice |
C/\ | | | |-FIND_RHO :: Calculates [rho(S,T,z)-RhoConst] of a slice |
236 |
C/\ | | | |-GRAD_SIGMA :: Calculate isoneutral gradients |
C/\ | | | |-GRAD_SIGMA :: Calculate isoneutral gradients |
237 |
C/\ | | | |-CALC_IVDC :: Set Implicit Vertical Diffusivity for Convection |
C/\ | | | |-CALC_IVDC :: Set Implicit Vertical Diffusivity for Convection |
238 |
C/\ | | | | |
C/\ | | | | |
239 |
C/\ | | | |-OBCS_CALC :: Open bndy. package ( see pkg/obcs ). |
C/\ | | | |-OBCS_CALC :: Open bndy. package ( see pkg/obcs ). |
240 |
C/\ | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned |
C/\ | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned |
241 |
C/\ | | | | :: forcing terms. |
C/\ | | | | | :: forcing terms. |
242 |
|
C/\ | | | | |-PTRACERS_FORCING_SURF :: Tracer package ( see pkg/ptracers ). |
243 |
C/\ | | | | |
C/\ | | | | |
244 |
C/\ | | | |-GMREDI_CALC_TENSOR :: GM package ( see pkg/gmredi ). |
C/\ | | | |-GMREDI_CALC_TENSOR :: GM package ( see pkg/gmredi ). |
245 |
C/\ | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ). |
C/\ | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ). |
257 |
C/\ | | | |-CALC_GT :: Calculate the temperature tendency terms |
C/\ | | | |-CALC_GT :: Calculate the temperature tendency terms |
258 |
C/\ | | | | | |
C/\ | | | | | |
259 |
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
260 |
C/\ | | | | | :: ( see pkg/gad ) |
C/\ | | | | | | :: ( see pkg/gad ) |
261 |
|
C/\ | | | | | |-KPP_TRANSPORT_T :: KPP non-local transport ( see pkg/kpp ). |
262 |
|
C/\ | | | | | |
263 |
C/\ | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature. |
C/\ | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature. |
264 |
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
265 |
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gt for free-surface height. |
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gt for free-surface height. |
269 |
C/\ | | | |-CALC_GS :: Calculate the salinity tendency terms |
C/\ | | | |-CALC_GS :: Calculate the salinity tendency terms |
270 |
C/\ | | | | | |
C/\ | | | | | |
271 |
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
272 |
C/\ | | | | | :: ( see pkg/gad ) |
C/\ | | | | | | :: ( see pkg/gad ) |
273 |
|
C/\ | | | | | |-KPP_TRANSPORT_S :: KPP non-local transport ( see pkg/kpp ). |
274 |
|
C/\ | | | | | |
275 |
C/\ | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt. |
C/\ | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt. |
276 |
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
277 |
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height. |
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height. |
278 |
C/\ | | | | |
C/\ | | | | |
279 |
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
280 |
C/\ | | | | |
C/\ | | | | |
281 |
C/\ | | | |-CALC_GTR1 :: Calculate other tracer(s) tendency terms |
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
282 |
|
C/\ | | | | |
283 |
|
C/\ | | | |-PTRACERS_INTEGRATE :: Integrate other tracer(s) (see pkg/ptracers). |
284 |
C/\ | | | | | |
C/\ | | | | | |
285 |
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
C/\ | | | | |-GAD_CALC_RHS :: Generalised advection package |
286 |
C/\ | | | | | :: ( see pkg/gad ) |
C/\ | | | | | | :: ( see pkg/gad ) |
287 |
C/\ | | | | |-EXTERNAL_FORCING_TR:: Problem specific forcing for tracer. |
C/\ | | | | | |-KPP_TRANSPORT_PTR:: KPP non-local transport ( see pkg/kpp ). |
288 |
|
C/\ | | | | | |
289 |
|
C/\ | | | | |-PTRACERS_FORCING :: Problem specific forcing for tracer. |
290 |
|
C/\ | | | | |-GCHEM_FORCING_INT :: tracer forcing for gchem pkg (if all |
291 |
|
C/\ | | | | | tendency terms calcualted together) |
292 |
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
C/\ | | | | |-ADAMS_BASHFORTH2 :: Extrapolate tendencies forward in time. |
293 |
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height. |
C/\ | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height. |
294 |
|
C/\ | | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
295 |
C/\ | | | | |
C/\ | | | | |
|
C/\ | | | |-TIMESTEP_TRACER :: Step tracer field forward in time |
|
296 |
C/\ | | | |-OBCS_APPLY_TS :: Open bndy. package (see pkg/obcs ). |
C/\ | | | |-OBCS_APPLY_TS :: Open bndy. package (see pkg/obcs ). |
|
C/\ | | | |-FREEZE :: Limit range of temperature. |
|
297 |
C/\ | | | | |
C/\ | | | | |
298 |
C/\ | | | |-IMPLDIFF :: Solve vertical implicit diffusion equation. |
C/\ | | | |-IMPLDIFF :: Solve vertical implicit diffusion equation. |
299 |
C/\ | | | |-OBCS_APPLY_TS :: Open bndy. package (see pkg/obcs ). |
C/\ | | | |-OBCS_APPLY_TS :: Open bndy. package (see pkg/obcs ). |
307 |
C/\ | | | | Potential anomaly. |
C/\ | | | | Potential anomaly. |
308 |
C/\ | | | |-CALC_VISCOSITY :: Calculate net vertical viscosity |
C/\ | | | |-CALC_VISCOSITY :: Calculate net vertical viscosity |
309 |
C/\ | | | | |-KPP_CALC_VISC :: KPP package ( see pkg/kpp ). |
C/\ | | | | |-KPP_CALC_VISC :: KPP package ( see pkg/kpp ). |
310 |
C/\ | | | | |
C/\ | | | | |
311 |
C/\ | | | |-CALC_PHI_HYD :: Integrate the hydrostatic relation. |
C/\ | | | |-CALC_PHI_HYD :: Integrate the hydrostatic relation. |
312 |
C/\ | | | |-MOM_FLUXFORM :: Flux form mom eqn. package ( see |
C/\ | | | |-MOM_FLUXFORM :: Flux form mom eqn. package ( see |
313 |
C/\ | | | | pkg/mom_fluxform ). |
C/\ | | | | pkg/mom_fluxform ). |
314 |
|
C/\ | | | | |-MOM_CALC_VISC :: Calculate Horizontal Viscosities |
315 |
C/\ | | | |-MOM_VECINV :: Vector invariant form mom eqn. package ( see |
C/\ | | | |-MOM_VECINV :: Vector invariant form mom eqn. package ( see |
316 |
C/\ | | | | pkg/mom_vecinv ). |
C/\ | | | | pkg/mom_vecinv ). |
317 |
|
C/\ | | | | |-MOM_CALC_VISC :: Calculate Horizontal Viscosities |
318 |
C/\ | | | |-TIMESTEP :: Step momentum fields forward in time |
C/\ | | | |-TIMESTEP :: Step momentum fields forward in time |
319 |
C/\ | | | |-OBCS_APPLY_UV :: Open bndy. package (see pkg/obcs ). |
C/\ | | | |-OBCS_APPLY_UV :: Open bndy. package (see pkg/obcs ). |
320 |
C/\ | | | | |
C/\ | | | | |
349 |
C/\ | | | | |-CONVECT :: Mix static instability. |
C/\ | | | | |-CONVECT :: Mix static instability. |
350 |
C/\ | | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
C/\ | | | | |-TIMEAVE_CUMULATE :: Update convection statistics. |
351 |
C/\ | | | | |
C/\ | | | | |
352 |
C/\ | | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
C/\ | | | |-CALC_EXACT_ETA :: Change SSH to flow divergence. |
353 |
C/\ | | | |
C/\ | | | |
354 |
C/\ | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions. |
C/\ | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions. |
355 |
C/\ | | | |-EXCH |
C/\ | | | |-EXCH |
356 |
|
C/\ | | | |
357 |
|
C/\ | | |-GCHEM_FORCING_SEP :: tracer forcing for gchem pkg (if |
358 |
|
C/\ | | | tracer dependent tendencies calculated |
359 |
|
C/\ | | | separatly) |
360 |
C/\ | | | |
C/\ | | | |
361 |
C/\ | | |-FLT_MAIN :: Float package ( pkg/flt ). |
C/\ | | |-FLT_MAIN :: Float package ( pkg/flt ). |
362 |
C/\ | | | |
C/\ | | | |
368 |
C/\ | | | |-AIM_WRITE_DIAGS :: Intermed. atmos diags. see pkg/aim |
C/\ | | | |-AIM_WRITE_DIAGS :: Intermed. atmos diags. see pkg/aim |
369 |
C/\ | | | |-GMREDI_DIAGS :: GM diags. see pkg/gmredi |
C/\ | | | |-GMREDI_DIAGS :: GM diags. see pkg/gmredi |
370 |
C/\ | | | |-KPP_DO_DIAGS :: KPP diags. see pkg/kpp |
C/\ | | | |-KPP_DO_DIAGS :: KPP diags. see pkg/kpp |
371 |
|
C/\ | | | |-SBO_CALC :: SBO diags. see pkg/sbo |
372 |
|
C/\ | | | |-SBO_DIAGS :: SBO diags. see pkg/sbo |
373 |
|
C/\ | | | |-SEAICE_DO_DIAGS :: SEAICE diags. see pkg/seaice |
374 |
|
C/\ | | | |-GCHEM_DIAGS :: gchem diags. see pkg/gchem |
375 |
C/\ | | | |
C/\ | | | |
376 |
C/\ | | |-WRITE_CHECKPOINT :: Do I/O for restart files. |
C/\ | | |-WRITE_CHECKPOINT :: Do I/O for restart files. |
377 |
C/\ | | |
C/\ | | |
389 |
C | |
C | |
390 |
C |-COMM_STATS :: Summarise inter-proc and inter-thread communication |
C |-COMM_STATS :: Summarise inter-proc and inter-thread communication |
391 |
C :: events. |
C :: events. |
392 |
|
C |
393 |
C \ev |
C \ev |
394 |
C |
C |
395 |
C |
C |
396 |
CEOI |
CEOI |
397 |
|
|
398 |
|
|
399 |
|
#include "AD_CONFIG.h" |
400 |
|
#include "PACKAGES_CONFIG.h" |
401 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
402 |
|
|
403 |
CBOP |
CBOP |
410 |
|
|
411 |
C !DESCRIPTION: \bv |
C !DESCRIPTION: \bv |
412 |
C *==========================================================* |
C *==========================================================* |
413 |
C | SUBROUTINE THE_MODEL_MAIN |
C | SUBROUTINE THE_MODEL_MAIN |
414 |
C | o Master controlling routine for model using the MITgcm |
C | o Master controlling routine for model using the MITgcm |
415 |
C | UV parallel wrapper. |
C | UV parallel wrapper. |
416 |
C *==========================================================* |
C *==========================================================* |
417 |
C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
418 |
C | wrapper with a single integer argument "myThid". This |
C | wrapper with a single integer argument "myThid". This |
419 |
C | variable identifies the thread number of an instance of |
C | variable identifies the thread number of an instance of |
420 |
C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
421 |
C | on a particular region of the models domain and |
C | on a particular region of the models domain and |
422 |
C | synchronises with other instances as necessary. The |
C | synchronises with other instances as necessary. The |
423 |
C | routine has to "understand" the MITgcm parallel |
C | routine has to "understand" the MITgcm parallel |
424 |
C | environment and the numerical algorithm. Editing this |
C | environment and the numerical algorithm. Editing this |
425 |
C | routine is best done with some knowledge of both aspects. |
C | routine is best done with some knowledge of both aspects. |
426 |
C | Notes |
C | Notes |
427 |
C | ===== |
C | ===== |
428 |
C | C*P* comments indicating place holders for which code is |
C | C*P* comments indicating place holders for which code is |
429 |
C | presently being developed. |
C | presently being developed. |
430 |
C *==========================================================* |
C *==========================================================* |
431 |
C \ev |
C \ev |
432 |
|
|
462 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
463 |
#include "PARAMS.h" |
#include "PARAMS.h" |
464 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
|
#ifdef ALLOW_NONHYDROSTATIC |
|
|
#include "CG3D.h" |
|
|
#endif |
|
465 |
|
|
466 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
467 |
#include "tamc.h" |
# include "tamc.h" |
468 |
|
#endif |
469 |
|
#ifdef ALLOW_CTRL |
470 |
|
# include "ctrl.h" |
471 |
|
# include "optim.h" |
472 |
#endif |
#endif |
473 |
|
|
474 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
475 |
C == Routine arguments == |
C == Routine arguments == |
476 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
477 |
INTEGER myThid |
INTEGER myThid |
478 |
|
|
479 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
480 |
C == Local variables == |
C == Local variables == |
485 |
C updated. |
C updated. |
486 |
C myCurrentTime - Time counter for this thread |
C myCurrentTime - Time counter for this thread |
487 |
C myCurrentIter - Iteration counter for this thread |
C myCurrentIter - Iteration counter for this thread |
|
INTEGER I |
|
|
INTEGER bi,bj |
|
488 |
INTEGER myCurrentIter |
INTEGER myCurrentIter |
489 |
_RL myCurrentTime |
_RL myCurrentTime |
490 |
|
logical exst |
491 |
|
logical lastdiva |
492 |
CEOP |
CEOP |
493 |
|
c-- set default: |
494 |
|
lastdiva = .TRUE. |
495 |
|
|
496 |
|
#ifdef ALLOW_DEBUG |
497 |
|
CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid) |
498 |
|
#endif |
499 |
|
|
500 |
|
#if defined(USE_PAPI) || defined(USE_PCL_FLOPS_SFP) || defined(USE_PCL_FLOPS) || defined(USE_PCL) |
501 |
|
CALL TIMER_CONTROL('','INIT','THE_MODEL_MAIN',myThid) |
502 |
|
#endif |
503 |
C-- This timer encompasses the whole code |
C-- This timer encompasses the whole code |
504 |
CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid) |
CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid) |
505 |
|
|
506 |
|
#ifdef ALLOW_DEBUG |
507 |
|
CALL DEBUG_CALL('INITIALISE_FIXED',myThid) |
508 |
|
#endif |
509 |
|
|
510 |
C-- Set model configuration (fixed arrays) |
C-- Set model configuration (fixed arrays) |
511 |
CALL TIMER_START('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
CALL TIMER_START('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
512 |
CALL INITIALISE_FIXED( myThid ) |
CALL INITIALISE_FIXED( myThid ) |
513 |
CALL TIMER_STOP ('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
CALL TIMER_STOP ('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
514 |
|
|
515 |
|
#ifdef ALLOW_DEBUG |
516 |
|
IF (debugMode) CALL DEBUG_LEAVE('INITIALISE_FIXED',myThid) |
517 |
|
#endif |
518 |
|
|
519 |
myCurrentTime = startTime |
myCurrentTime = startTime |
520 |
myCurrentIter = nIter0 |
myCurrentIter = nIter0 |
521 |
|
|
522 |
#if ( defined (ALLOW_ADJOINT_RUN) || \ |
#if ( defined (ALLOW_ADMTLM) ) |
523 |
defined (ALLOW_GRADIENT_CHECK) || \ |
c |
524 |
defined (ALLOW_ECCO_OPTIMIZATION) ) |
STOP 'should never get here; ADMTLM_DSVD calls ADMTLM_DRIVER' |
525 |
|
c |
526 |
|
#elif ( defined (ALLOW_AUTODIFF)) |
527 |
|
|
528 |
|
# ifndef EXCLUDE_CTRL_PACK |
529 |
_BEGIN_MASTER( mythid ) |
_BEGIN_MASTER( mythid ) |
530 |
IF (myProcId .eq. 0) THEN |
IF (myProcId .eq. 0) THEN |
531 |
CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid ) |
inquire( file='costfinal', exist=exst ) |
532 |
|
IF ( .NOT. exst ) THEN |
533 |
|
IF ( optimcycle.NE.0 .AND. doMainUnpack ) THEN |
534 |
|
CALL TIMER_START('CTRL_UNPACK [THE_MODEL_MAIN]',mythid) |
535 |
|
CALL CTRL_UNPACK( .TRUE. , mythid ) |
536 |
|
CALL TIMER_STOP ('CTRL_UNPACK [THE_MODEL_MAIN]',mythid) |
537 |
|
ENDIF |
538 |
|
ENDIF |
539 |
ENDIF |
ENDIF |
540 |
_END_MASTER( mythid ) |
_END_MASTER( mythid ) |
541 |
_BARRIER |
_BARRIER |
542 |
|
# endif /* EXCLUDE_CTRL_PACK */ |
543 |
|
|
544 |
|
# ifdef ALLOW_COST |
545 |
CALL COST_DEPENDENT_INIT ( mythid ) |
CALL COST_DEPENDENT_INIT ( mythid ) |
546 |
_BARRIER |
_BARRIER |
547 |
|
# endif |
548 |
|
|
549 |
|
# if ( defined (ALLOW_TANGENTLINEAR_RUN) ) |
550 |
|
c |
551 |
|
#ifdef ALLOW_DEBUG |
552 |
|
IF (debugMode) CALL DEBUG_CALL('G_THE_MAIN_LOOP',myThid) |
553 |
|
#endif |
554 |
|
CALL TIMER_START('G_THE_MAIN_LOOP [TANGENT RUN]',mythid) |
555 |
|
CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid ) |
556 |
|
CALL TIMER_STOP ('G_THE_MAIN_LOOP [TANGENT RUN]',mythid) |
557 |
|
c |
558 |
|
# elif ( defined (ALLOW_ADJOINT_RUN) || \ |
559 |
|
defined (ALLOW_ECCO_OPTIMIZATION) ) |
560 |
|
c |
561 |
|
# ifdef ALLOW_DIVIDED_ADJOINT |
562 |
|
c-- The following assumes the TAF option '-pure' |
563 |
|
inquire( file='costfinal', exist=exst ) |
564 |
|
IF ( .NOT. exst) THEN |
565 |
|
#ifdef ALLOW_DEBUG |
566 |
|
IF (debugMode) CALL DEBUG_CALL('MDTHE_MAIN_LOOP',myThid) |
567 |
|
#endif |
568 |
|
CALL TIMER_START('MDTHE_MAIN_LOOP [MD RUN]', mythid) |
569 |
|
CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid ) |
570 |
|
CALL TIMER_STOP ('MDTHE_MAIN_LOOP [MD RUN]', mythid) |
571 |
|
CALL COST_FINAL_STORE ( mythid, lastdiva ) |
572 |
|
ELSE |
573 |
|
#ifdef ALLOW_DEBUG |
574 |
|
IF (debugMode) CALL DEBUG_CALL('ADTHE_MAIN_LOOP',myThid) |
575 |
|
#endif |
576 |
|
CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
577 |
|
CALL ADTHE_MAIN_LOOP ( mythid ) |
578 |
|
CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
579 |
|
CALL COST_FINAL_RESTORE ( mythid, lastdiva ) |
580 |
|
ENDIF |
581 |
|
c-- |
582 |
|
# else /* ALLOW_DIVIDED_ADJOINT undef */ |
583 |
|
#ifdef ALLOW_DEBUG |
584 |
|
IF (debugMode) CALL DEBUG_CALL('ADTHE_MAIN_LOOP',myThid) |
585 |
|
#endif |
586 |
CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
587 |
|
#ifdef ALLOW_ECCO |
588 |
|
CALL ADTHE_MAIN_LOOP ( myCurrentTime, mythid ) |
589 |
|
#else |
590 |
CALL ADTHE_MAIN_LOOP ( mythid ) |
CALL ADTHE_MAIN_LOOP ( mythid ) |
591 |
|
#endif |
592 |
CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid) |
593 |
_BARRIER |
# endif /* ALLOW_DIVIDED_ADJOINT */ |
594 |
|
c |
595 |
|
# else /* forward run only within AD setting */ |
596 |
|
|
597 |
_BEGIN_MASTER( mythid ) |
#ifdef ALLOW_DEBUG |
598 |
IF (myProcId .eq. 0) THEN |
IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid) |
599 |
call CTRL_PACK( mycurrentiter, mycurrenttime, mythid ) |
#endif |
600 |
ENDIF |
C-- Call time stepping loop of full model |
601 |
_END_MASTER( mythid ) |
#ifdef ALLOW_DEBUG |
602 |
_BARRIER |
IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid) |
|
|
|
|
#ifdef ALLOW_GRADIENT_CHECK |
|
|
if (useGrdchk) then |
|
|
CALL TIMER_START('GRDCHK_MAIN [ADJOINT RUN]', mythid) |
|
|
CALL GRDCHK_MAIN( mythid ) |
|
|
CALL TIMER_STOP ('GRDCHK_MAIN [ADJOINT RUN]', mythid) |
|
|
_BARRIER |
|
|
end if |
|
603 |
#endif |
#endif |
604 |
|
CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
605 |
|
CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid ) |
606 |
|
CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
607 |
|
|
608 |
#elif (defined (ALLOW_TANGENTLINEAR_RUN)) |
# endif |
609 |
|
|
610 |
|
# ifndef EXCLUDE_CTRL_PACK |
611 |
_BEGIN_MASTER( mythid ) |
_BEGIN_MASTER( mythid ) |
612 |
IF (myProcId .eq. 0) THEN |
IF ( myProcId .eq. 0 .AND. lastdiva .AND. doMainPack ) THEN |
613 |
CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid ) |
CALL TIMER_START('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
614 |
|
CALL CTRL_PACK( .FALSE. , mythid ) |
615 |
|
CALL TIMER_STOP ('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
616 |
|
IF ( ( optimcycle.EQ.0 .OR. (.NOT. doMainUnpack) ) |
617 |
|
& .AND. mycurrentiter.EQ.niter0 ) THEN |
618 |
|
CALL TIMER_START('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
619 |
|
CALL CTRL_PACK( .TRUE. , mythid ) |
620 |
|
CALL TIMER_STOP ('CTRL_PACK [THE_MODEL_MAIN]',mythid) |
621 |
|
ENDIF |
622 |
ENDIF |
ENDIF |
623 |
_END_MASTER( mythid ) |
_END_MASTER( mythid ) |
624 |
_BARRIER |
_BARRIER |
625 |
|
# endif /* EXCLUDE_CTRL_PACK */ |
626 |
|
|
|
CALL COST_DEPENDENT_INIT ( mythid ) |
|
|
_BARRIER |
|
|
|
|
|
CALL TIMER_START('G_THE_MAIN_LOOP [FTL RUN]', mythid) |
|
|
CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid ) |
|
|
CALL TIMER_STOP ('G_THE_MAIN_LOOP [FTL RUN]', mythid) |
|
|
_BARRIER |
|
627 |
|
|
628 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_GRDCHK |
629 |
IF (myProcId .eq. 0) THEN |
IF ( useGrdchk .AND. lastdiva ) THEN |
630 |
call CTRL_PACK( mycurrentiter, mycurrenttime, mythid ) |
CALL TIMER_START('GRDCHK_MAIN [THE_MODEL_MAIN]',mythid) |
631 |
|
CALL GRDCHK_MAIN( mythid ) |
632 |
|
CALL TIMER_STOP ('GRDCHK_MAIN [THE_MODEL_MAIN]',mythid) |
633 |
|
_BARRIER |
634 |
ENDIF |
ENDIF |
635 |
_END_MASTER( mythid ) |
# endif |
|
_BARRIER |
|
636 |
|
|
637 |
#else /* ALLOW_ADJOINT_RUN undef */ |
#else /* ALL AD-related undef */ |
638 |
|
|
639 |
|
#ifdef ALLOW_DEBUG |
640 |
|
IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid) |
641 |
|
#endif |
642 |
C-- Call time stepping loop of full model |
C-- Call time stepping loop of full model |
643 |
CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
644 |
CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid ) |
CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid ) |
645 |
CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
646 |
|
|
647 |
|
#endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM */ |
648 |
|
|
649 |
#endif /* ALLOW_ADJOINT_RUN */ |
#ifdef ALLOW_DIAGNOSTICS |
650 |
|
IF (useDiagnostics) THEN |
651 |
|
C Close all diagnostics output files |
652 |
|
CALL DIAGSTATS_CLOSE_IO( myThid ) |
653 |
|
ENDIF |
654 |
|
#endif |
655 |
|
|
656 |
C-- Final checkpoint (incase the in-loop checkpoint was missed) |
#ifdef ALLOW_MNC |
657 |
CALL TIMER_START('WRITE_CHECKPOINT [THE_MODEL_MAIN]',myThid) |
IF (useMNC) THEN |
658 |
CALL WRITE_CHECKPOINT( |
C Close all open NetCDF files |
659 |
& .TRUE., myCurrentTime, myCurrentIter, myThid ) |
_BEGIN_MASTER( mythid ) |
660 |
CALL TIMER_STOP ('WRITE_CHECKPOINT [THE_MODEL_MAIN]',myThid) |
CALL MNC_FILE_CLOSE_ALL( myThid ) |
661 |
|
_END_MASTER( mythid ) |
662 |
|
ENDIF |
663 |
|
#endif |
664 |
|
|
665 |
CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid) |
C-- This timer encompasses the whole code |
666 |
|
CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid) |
667 |
|
|
668 |
C-- Write timer statistics |
C-- Write timer statistics |
669 |
IF ( myThid .EQ. 1 ) THEN |
IF ( myThid .EQ. 1 ) THEN |
671 |
CALL COMM_STATS |
CALL COMM_STATS |
672 |
ENDIF |
ENDIF |
673 |
|
|
674 |
|
C-- Check threads synchronization : |
675 |
|
CALL BAR_CHECK( 9, myThid ) |
676 |
|
|
677 |
|
#ifdef ALLOW_DEBUG |
678 |
|
IF (debugMode) CALL DEBUG_LEAVE('THE_MODEL_MAIN',myThid) |
679 |
|
#endif |
680 |
|
|
681 |
RETURN |
RETURN |
682 |
END |
END |