| 1 |
C $Header: /u/gcmpack/MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/initialise_fixed.F,v 1.3 2007/05/08 14:04:56 utke 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 |-- PACKAGES_READPARMS |
| 35 |
C | | |
| 36 |
C | | - MNC_INIT + MNC_CW_INIT |
| 37 |
C | | |
| 38 |
C | | - ${PKG}_READPARMS |
| 39 |
C | |
| 40 |
C |-- SET_PARMS |
| 41 |
C | |
| 42 |
C |-- INI_MODEL_IO |
| 43 |
C | |
| 44 |
C |-- MON_INIT |
| 45 |
C | |
| 46 |
C |-- INI_GRID |
| 47 |
C | |
| 48 |
C |-- INI_EOS |
| 49 |
C | |
| 50 |
C |-- INI_PHIREF |
| 51 |
C | |
| 52 |
C |-- INI_DEPTHS |
| 53 |
C | |
| 54 |
C |-- INI_MASKS_ETC |
| 55 |
C | |
| 56 |
C |-- PACKAGES_INIT_FIXED |
| 57 |
C | |
| 58 |
C |-- PACKAGES_CHECK |
| 59 |
C | |
| 60 |
C |-- INI_LINEAR_PHSURF |
| 61 |
C | |
| 62 |
C |-- INI_CORI |
| 63 |
C | |
| 64 |
C |-- INI_CG2D |
| 65 |
C | |
| 66 |
C |-- INI_CG3D |
| 67 |
C | |
| 68 |
C |-- CONFIG_CHECK |
| 69 |
C | |
| 70 |
C |-- CONFIG_SUMMARY |
| 71 |
C | |
| 72 |
C |-- WRITE_GRID |
| 73 |
C | |
| 74 |
C |-- CPL_EXCH_CONFIGS |
| 75 |
|
| 76 |
C !USES: |
| 77 |
IMPLICIT NONE |
| 78 |
C == Global variables == |
| 79 |
#include "SIZE.h" |
| 80 |
#include "EEPARAMS.h" |
| 81 |
#include "PARAMS.h" |
| 82 |
|
| 83 |
C !INPUT/OUTPUT PARAMETERS: |
| 84 |
C == Routine arguments == |
| 85 |
INTEGER myThid |
| 86 |
CEOP |
| 87 |
|
| 88 |
C- here is a way to deliberately break the barrier syncronization |
| 89 |
C by adding a BARRIER on thread XXX only ; Used to test BAR_CHECK. |
| 90 |
c IF ( myThid.EQ.XXX ) THEN |
| 91 |
c _BARRIER |
| 92 |
c CALL SYSTEM('sleep 1') |
| 93 |
c ENDIF |
| 94 |
C-- Check barrier synchronization: |
| 95 |
CALL BAR_CHECK( 2, myThid ) |
| 96 |
|
| 97 |
C-- Set model parameters. |
| 98 |
C Parameters are set to defaults and then updates are read from |
| 99 |
C an input file called data. |
| 100 |
CALL INI_PARMS( myThid ) |
| 101 |
|
| 102 |
C-- Configure packages |
| 103 |
CALL PACKAGES_BOOT( myThid ) |
| 104 |
|
| 105 |
C-- Read configuration parameters for packages |
| 106 |
CALL PACKAGES_READPARMS( myThid ) |
| 107 |
|
| 108 |
C-- Set (or reset) parameters (at this point, know which packages are used); |
| 109 |
C after this call, main model parameters are not supposed to be modified. |
| 110 |
CALL SET_PARMS( myThid ) |
| 111 |
|
| 112 |
C-- Write units/set precision/etc for I/O of variables/arrays belonging |
| 113 |
C to the core dynamical model |
| 114 |
CALL INI_MODEL_IO( myThid ) |
| 115 |
|
| 116 |
#ifdef ALLOW_MONITOR |
| 117 |
C-- Initialise MONITOR I/O streams so we can report config. info |
| 118 |
CALL MON_INIT( myThid ) |
| 119 |
#endif |
| 120 |
|
| 121 |
C-- Set model grid. |
| 122 |
C Variables defining model grid spacing are defined. |
| 123 |
CALL OpenAD_INI_GRID( myThid ) |
| 124 |
|
| 125 |
C-- Set equation of state parameters. |
| 126 |
CALL INI_EOS( myThid ) |
| 127 |
|
| 128 |
C-- Set pressure/geopotential reference profile |
| 129 |
CALL INI_PHIREF( myThid ) |
| 130 |
|
| 131 |
C-- Initialise map of depths |
| 132 |
CALL OpenAD_INI_DEPTHS( myThid ) |
| 133 |
|
| 134 |
C-- Derive masks, lopping factors and recipricols of quantities. |
| 135 |
C Volumes and areas are set according to grid and depth map. |
| 136 |
CALL OpenAD_INI_MASKS_ETC( myThid ) |
| 137 |
|
| 138 |
C-- Synchronize all threads after setting masks and before pkgs init. |
| 139 |
_BARRIER |
| 140 |
|
| 141 |
C-- Call fixed data initialization phase of packages |
| 142 |
CALL PACKAGES_INIT_FIXED( myThid ) |
| 143 |
|
| 144 |
C-- Check dependances between packages |
| 145 |
CALL PACKAGES_CHECK( myThid ) |
| 146 |
|
| 147 |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
| 148 |
CALL OpenAD_INI_LINEAR_PHISURF( myThid ) |
| 149 |
|
| 150 |
C-- Set coriolis operators |
| 151 |
CALL OpenAD_INI_CORI( myThid ) |
| 152 |
|
| 153 |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
| 154 |
CALL OpenAD_INI_CG2D( myThid ) |
| 155 |
|
| 156 |
#ifdef ALLOW_NONHYDROSTATIC |
| 157 |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
| 158 |
ceh3 needs an IF ( useNONHYDROSTATIC ) THEN |
| 159 |
CALL INI_CG3D( myThid ) |
| 160 |
#endif |
| 161 |
|
| 162 |
C-- Check parameters and model cofiguration |
| 163 |
CALL CONFIG_CHECK( myThid ) |
| 164 |
|
| 165 |
C-- Finally summarise the model cofiguration |
| 166 |
CALL CONFIG_SUMMARY( myThid ) |
| 167 |
|
| 168 |
C-- Write grid data and geometry arrays |
| 169 |
IF ( debugLevel.GE.debLevA .OR. |
| 170 |
& startTime.EQ.baseTime ) CALL WRITE_GRID( myThid ) |
| 171 |
|
| 172 |
#ifdef COMPONENT_MODULE |
| 173 |
C-- Post component-model configuration information to coupler |
| 174 |
C and get config. info for other component(s). |
| 175 |
IF ( useCoupler ) CALL CPL_EXCH_CONFIGS( myThid ) |
| 176 |
#endif |
| 177 |
|
| 178 |
C-- Check barrier synchronization: |
| 179 |
CALL BAR_CHECK( 3, myThid ) |
| 180 |
|
| 181 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 182 |
|
| 183 |
RETURN |
| 184 |
END |