| 1 |
C $Header: /u/gcmpack/MITgcm_contrib/llc_hires/llc_2160/code-async/initialise_fixed.F,v 1.1 2013/10/29 08:14:41 dimitri Exp $ |
| 2 |
C $Name: $ |
| 3 |
|
| 4 |
#include "PACKAGES_CONFIG.h" |
| 5 |
#include "CPP_OPTIONS.h" |
| 6 |
|
| 7 |
CBOP |
| 8 |
C !ROUTINE: INITIALISE_FIXED |
| 9 |
C !INTERFACE: |
| 10 |
SUBROUTINE INITIALISE_FIXED( myThid ) |
| 11 |
|
| 12 |
C !DESCRIPTION: \bv |
| 13 |
C *==========================================================* |
| 14 |
C | SUBROUTINE INITIALISE_FIXED |
| 15 |
C | o Routine for setting fixed model arrays such as |
| 16 |
C | topography, grid, solver matrices, etc. |
| 17 |
C *==========================================================* |
| 18 |
C | INITIALISE_FIXED is invoked at the start of the model to |
| 19 |
C | set fixed model arrays. It reads data from an input file |
| 20 |
C | and from various binary files. |
| 21 |
C | Each thread invokes an instance of this routine as does |
| 22 |
C | each process in a multi-process parallel environment like |
| 23 |
C | MPI. |
| 24 |
C *==========================================================* |
| 25 |
C \ev |
| 26 |
|
| 27 |
C !CALLING SEQUENCE: |
| 28 |
C INITIALISE_FIXED |
| 29 |
C | |
| 30 |
C |-- INI_PARMS |
| 31 |
C | |
| 32 |
C |-- PACKAGES_BOOT |
| 33 |
C | |
| 34 |
C |-- CPL_IMPORT_CPLPARMS |
| 35 |
C | |
| 36 |
C |-- PACKAGES_READPARMS |
| 37 |
C | |- ${PKG}_READPARMS |
| 38 |
C | |
| 39 |
C |-- SET_PARMS |
| 40 |
C | |
| 41 |
C |-- INI_MODEL_IO |
| 42 |
C | |- MNC_INIT + MNC_CW_INIT |
| 43 |
C | |- MON_INIT |
| 44 |
C | |
| 45 |
C |-- INI_GRID |
| 46 |
C | |
| 47 |
C |-- LOAD_REF_FILES |
| 48 |
C | |
| 49 |
C |-- INI_EOS |
| 50 |
C | |
| 51 |
C |-- SET_REF_STATE |
| 52 |
C | |
| 53 |
C |-- SET_GRID_FACTORS |
| 54 |
C | |
| 55 |
C |-- INI_DEPTHS |
| 56 |
C | |
| 57 |
C |-- INI_MASKS_ETC |
| 58 |
C | |
| 59 |
C |-- PACKAGES_INIT_FIXED |
| 60 |
C | |- ${PKG}_INIT_FIXED |
| 61 |
C | |
| 62 |
C |-- INI_GLOBAL_DOMAIN |
| 63 |
C | |
| 64 |
C |-- INI_LINEAR_PHISURF |
| 65 |
C | |
| 66 |
C |-- INI_CORI |
| 67 |
C | |
| 68 |
C |-- INI_CG2D |
| 69 |
C | |
| 70 |
C |-- INI_CG3D |
| 71 |
C | |
| 72 |
C |-- CONFIG_SUMMARY |
| 73 |
C | |
| 74 |
C |-- PACKAGES_CHECK |
| 75 |
C | |- ${PKG}_CHECK |
| 76 |
C | |
| 77 |
C |-- CONFIG_CHECK |
| 78 |
C | |
| 79 |
C |-- WRITE_GRID |
| 80 |
C | |
| 81 |
C |-- CPL_EXCH_CONFIGS |
| 82 |
|
| 83 |
C !USES: |
| 84 |
IMPLICIT NONE |
| 85 |
C == Global variables == |
| 86 |
#include "SIZE.h" |
| 87 |
#include "EEPARAMS.h" |
| 88 |
#include "PARAMS.h" |
| 89 |
|
| 90 |
C !INPUT/OUTPUT PARAMETERS: |
| 91 |
C == Routine arguments == |
| 92 |
INTEGER myThid |
| 93 |
CEOP |
| 94 |
|
| 95 |
#ifdef ALLOW_DEBUG |
| 96 |
IF (debugMode) CALL DEBUG_ENTER('INITIALISE_FIXED',myThid) |
| 97 |
#endif |
| 98 |
|
| 99 |
C- here is a way to deliberately break the barrier syncronization |
| 100 |
C by adding a BARRIER on thread XXX only ; Used to test BAR_CHECK. |
| 101 |
c IF ( myThid.EQ.XXX ) THEN |
| 102 |
c _BARRIER |
| 103 |
c CALL SYSTEM('sleep 1') |
| 104 |
c ENDIF |
| 105 |
C-- Check barrier synchronization: |
| 106 |
CALL BAR_CHECK( 2, myThid ) |
| 107 |
|
| 108 |
C-- Set model parameters. |
| 109 |
C Parameters are set to defaults and then updates are read from |
| 110 |
C an input file called data. |
| 111 |
#ifdef ALLOW_DEBUG |
| 112 |
IF (debugMode) CALL DEBUG_CALL('INI_PARMS',myThid) |
| 113 |
#endif |
| 114 |
CALL INI_PARMS( myThid ) |
| 115 |
|
| 116 |
C-- Configure packages |
| 117 |
#ifdef ALLOW_DEBUG |
| 118 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_BOOT',myThid) |
| 119 |
#endif |
| 120 |
CALL PACKAGES_BOOT( myThid ) |
| 121 |
|
| 122 |
#ifdef COMPONENT_MODULE |
| 123 |
C-- Import coupling exchange parameters from coupler |
| 124 |
IF ( useCoupler ) THEN |
| 125 |
# ifdef ALLOW_DEBUG |
| 126 |
IF (debugMode) CALL DEBUG_CALL('CPL_IMPORT_CPLPARMS',myThid) |
| 127 |
# endif |
| 128 |
CALL CPL_IMPORT_CPLPARMS( myThid ) |
| 129 |
ENDIF |
| 130 |
#endif /* COMPONENT_MODULE */ |
| 131 |
|
| 132 |
C-- Read configuration parameters for packages |
| 133 |
#ifdef ALLOW_DEBUG |
| 134 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_READPARMS',myThid) |
| 135 |
#endif |
| 136 |
CALL PACKAGES_READPARMS( myThid ) |
| 137 |
|
| 138 |
C-- Set (or reset) parameters (at this point, know which packages are used); |
| 139 |
C after this call, main model parameters are not supposed to be modified. |
| 140 |
#ifdef ALLOW_DEBUG |
| 141 |
IF (debugMode) CALL DEBUG_CALL('SET_PARMS',myThid) |
| 142 |
#endif |
| 143 |
CALL SET_PARMS( myThid ) |
| 144 |
|
| 145 |
C-- Write units/set precision/etc for I/O (pickup, MDS/RW, MNC, MONITOR): |
| 146 |
#ifdef ALLOW_DEBUG |
| 147 |
IF (debugMode) CALL DEBUG_CALL('INI_MODEL_IO',myThid) |
| 148 |
#endif |
| 149 |
CALL INI_MODEL_IO( myThid ) |
| 150 |
|
| 151 |
C-- Set model grid. |
| 152 |
C Variables defining model grid spacing are defined. |
| 153 |
#ifdef ALLOW_DEBUG |
| 154 |
IF (debugMode) CALL DEBUG_CALL('INI_GRID',myThid) |
| 155 |
#endif |
| 156 |
#ifdef ALLOW_OPENAD |
| 157 |
CALL OpenAD_INI_GRID( myThid ) |
| 158 |
#else |
| 159 |
CALL INI_GRID( myThid ) |
| 160 |
#endif |
| 161 |
|
| 162 |
C-- Load reference profiles from files |
| 163 |
#ifdef ALLOW_DEBUG |
| 164 |
IF (debugMode) CALL DEBUG_CALL('LOAD_REF_FILES',myThid) |
| 165 |
#endif |
| 166 |
CALL LOAD_REF_FILES( myThid ) |
| 167 |
|
| 168 |
C-- Set equation of state parameters. |
| 169 |
#ifdef ALLOW_DEBUG |
| 170 |
IF (debugMode) CALL DEBUG_CALL('INI_EOS',myThid) |
| 171 |
#endif |
| 172 |
CALL INI_EOS( myThid ) |
| 173 |
|
| 174 |
C-- Set reference state (vertical reference profiles) |
| 175 |
#ifdef ALLOW_DEBUG |
| 176 |
IF (debugMode) CALL DEBUG_CALL('SET_REF_STATE',myThid) |
| 177 |
#endif |
| 178 |
CALL SET_REF_STATE( myThid ) |
| 179 |
|
| 180 |
C-- Set remaining grid factors |
| 181 |
#ifdef ALLOW_DEBUG |
| 182 |
IF (debugMode) CALL DEBUG_CALL('SET_GRID_FACTORS',myThid) |
| 183 |
#endif |
| 184 |
CALL SET_GRID_FACTORS( myThid ) |
| 185 |
|
| 186 |
C-- Initialise map of depths |
| 187 |
#ifdef ALLOW_DEBUG |
| 188 |
IF (debugMode) CALL DEBUG_CALL('INI_DEPTHS',myThid) |
| 189 |
#endif |
| 190 |
#ifdef ALLOW_OPENAD |
| 191 |
CALL OpenAD_INI_DEPTHS( myThid ) |
| 192 |
#else |
| 193 |
CALL INI_DEPTHS( myThid ) |
| 194 |
#endif |
| 195 |
|
| 196 |
C-- Derive masks, lopping factors and recipricols of quantities. |
| 197 |
C Volumes and areas are set according to grid and depth map. |
| 198 |
#ifdef ALLOW_DEBUG |
| 199 |
IF (debugMode) CALL DEBUG_CALL('INI_MASKS_ETC',myThid) |
| 200 |
#endif |
| 201 |
#ifdef ALLOW_OPENAD |
| 202 |
CALL OpenAD_INI_MASKS_ETC( myThid ) |
| 203 |
#else |
| 204 |
CALL INI_MASKS_ETC( myThid ) |
| 205 |
#endif |
| 206 |
|
| 207 |
C-- Synchronize all threads after setting masks and before pkgs init. |
| 208 |
_BARRIER |
| 209 |
|
| 210 |
C-- Call fixed data initialization phase of packages |
| 211 |
#ifdef ALLOW_DEBUG |
| 212 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_INIT_FIXED',myThid) |
| 213 |
#endif |
| 214 |
CALL PACKAGES_INIT_FIXED( myThid ) |
| 215 |
|
| 216 |
C-- Set some domain-dependent (global) constant (e.g., globalArea) |
| 217 |
#ifdef ALLOW_DEBUG |
| 218 |
IF (debugMode) CALL DEBUG_CALL('INI_GLOBAL_DOMAIN',myThid) |
| 219 |
#endif |
| 220 |
CALL INI_GLOBAL_DOMAIN( myThid ) |
| 221 |
|
| 222 |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
| 223 |
#ifdef ALLOW_DEBUG |
| 224 |
IF (debugMode) CALL DEBUG_CALL('INI_LINEAR_PHISURF',myThid) |
| 225 |
#endif |
| 226 |
#ifdef ALLOW_OPENAD |
| 227 |
CALL OpenAD_INI_LINEAR_PHISURF( myThid ) |
| 228 |
#else |
| 229 |
CALL INI_LINEAR_PHISURF( myThid ) |
| 230 |
#endif |
| 231 |
|
| 232 |
C-- Set coriolis operators |
| 233 |
#ifdef ALLOW_DEBUG |
| 234 |
IF (debugMode) CALL DEBUG_CALL('INI_CORI',myThid) |
| 235 |
#endif |
| 236 |
#ifdef ALLOW_OPENAD |
| 237 |
CALL OpenAD_INI_CORI( myThid ) |
| 238 |
#else |
| 239 |
CALL INI_CORI( myThid ) |
| 240 |
#endif |
| 241 |
|
| 242 |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
| 243 |
#ifdef ALLOW_DEBUG |
| 244 |
IF (debugMode) CALL DEBUG_CALL('INI_CG2D',myThid) |
| 245 |
#endif |
| 246 |
#ifdef ALLOW_OPENAD |
| 247 |
CALL OpenAD_INI_CG2D( myThid ) |
| 248 |
#else |
| 249 |
CALL INI_CG2D( myThid ) |
| 250 |
#endif |
| 251 |
|
| 252 |
#ifdef ALLOW_NONHYDROSTATIC |
| 253 |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
| 254 |
#ifdef ALLOW_DEBUG |
| 255 |
IF (debugMode) CALL DEBUG_CALL('INI_CG3D',myThid) |
| 256 |
#endif |
| 257 |
CALL INI_CG3D( myThid ) |
| 258 |
#endif |
| 259 |
|
| 260 |
C-- Finally summarise the model configuration |
| 261 |
#ifdef ALLOW_DEBUG |
| 262 |
IF (debugMode) CALL DEBUG_CALL('CONFIG_SUMMARY',myThid) |
| 263 |
#endif |
| 264 |
CALL CONFIG_SUMMARY( myThid ) |
| 265 |
|
| 266 |
C-- Check packages configuration (& print summary) |
| 267 |
#ifdef ALLOW_DEBUG |
| 268 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_CHECK',myThid) |
| 269 |
#endif |
| 270 |
CALL PACKAGES_CHECK( myThid ) |
| 271 |
|
| 272 |
C-- Check parameters and model configuration |
| 273 |
#ifdef ALLOW_DEBUG |
| 274 |
IF (debugMode) CALL DEBUG_CALL('CONFIG_CHECK',myThid) |
| 275 |
#endif |
| 276 |
CALL CONFIG_CHECK( myThid ) |
| 277 |
|
| 278 |
C-- Write grid data and geometry arrays |
| 279 |
IF ( debugLevel.GE.debLevA .OR. startTime.EQ.baseTime ) THEN |
| 280 |
#ifdef ALLOW_DEBUG |
| 281 |
IF (debugMode) CALL DEBUG_CALL('WRITE_GRID',myThid) |
| 282 |
#endif |
| 283 |
ch CALL WRITE_GRID( myThid ) |
| 284 |
ENDIF |
| 285 |
|
| 286 |
#ifdef COMPONENT_MODULE |
| 287 |
C-- Post component-model configuration information to coupler |
| 288 |
C and get config. info for other component(s). |
| 289 |
IF ( useCoupler ) THEN |
| 290 |
# ifdef ALLOW_DEBUG |
| 291 |
IF (debugMode) CALL DEBUG_CALL('CPL_EXCH_CONFIGS',myThid) |
| 292 |
# endif |
| 293 |
CALL CPL_EXCH_CONFIGS( myThid ) |
| 294 |
ENDIF |
| 295 |
#endif /* COMPONENT_MODULE */ |
| 296 |
|
| 297 |
C-- Check barrier synchronization: |
| 298 |
CALL BAR_CHECK( 3, myThid ) |
| 299 |
|
| 300 |
#ifdef ALLOW_DEBUG |
| 301 |
IF (debugMode) CALL DEBUG_LEAVE('INITIALISE_FIXED',myThid) |
| 302 |
#endif |
| 303 |
|
| 304 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 305 |
|
| 306 |
RETURN |
| 307 |
END |