1 |
C $Header: /u/gcmpack/MITgcm/model/src/ini_model_io.F,v 1.24 2007/10/19 14:36:47 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: INI_MODEL_IO |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE INI_MODEL_IO( myThid ) |
12 |
|
13 |
C !DESCRIPTION: |
14 |
C Pass specific setup data for mdsio/rw. |
15 |
|
16 |
C !USES: |
17 |
IMPLICIT NONE |
18 |
#include "SIZE.h" |
19 |
#include "EEPARAMS.h" |
20 |
#include "EESUPPORT.h" |
21 |
#include "PARAMS.h" |
22 |
#include "RESTART.h" |
23 |
|
24 |
C !INPUT/OUTPUT PARAMETERS: |
25 |
C myThid :: my Thread Id number |
26 |
INTEGER myThid |
27 |
|
28 |
C !FUNCTIONS |
29 |
INTEGER ILNBLNK |
30 |
EXTERNAL ILNBLNK |
31 |
|
32 |
C !LOCAL VARIABLES: |
33 |
C msgBuf :: Informational/error meesage buffer |
34 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
35 |
CHARACTER*(MAX_LEN_FNAM) namBuf |
36 |
INTEGER pIL |
37 |
CEOP |
38 |
|
39 |
C- Safety check: |
40 |
IF ( nPx*nPy.NE.1 .AND. globalFiles ) THEN |
41 |
_BEGIN_MASTER( myThid ) |
42 |
c WRITE(msgBuf,'(2A)') |
43 |
c & 'INI_MODEL_IO: globalFiles=TRUE is not safe', |
44 |
c & ' in Multi-processors (MPI) run' |
45 |
c CALL PRINT_ERROR( msgBuf , myThid) |
46 |
c WRITE(msgBuf,'(2A)') |
47 |
c & 'INI_MODEL_IO: use instead "useSingleCpuIO=.TRUE."' |
48 |
c CALL PRINT_ERROR( msgBuf , myThid) |
49 |
c STOP 'ABNORMAL END: S/R INI_MODEL_IO' |
50 |
C------ |
51 |
C GlobalFiles option with Multi-processors execution (with MPI) is not |
52 |
C safe: dependending on the platform & compiler, it may produce: |
53 |
C - incomplete output files (wrong size) |
54 |
C - wrong isolated values in some output files |
55 |
C - missing tiles (all zeros) in some output files. |
56 |
C A safe alternative is to set "useSingleCpuIO=.TRUE." in file "data", |
57 |
C namelist PARAM01 (and to keep the default value of globalFiles=FALSE) |
58 |
C or if you are really sure that the globalFile works well on our platform |
59 |
C & compiler, comment out the above "stop" |
60 |
C----- |
61 |
WRITE(msgBuf,'(2A)') |
62 |
& '** WARNING ** INI_MODEL_IO: globalFiles=TRUE is not safe', |
63 |
& ' in Multi-processors (MPI) run' |
64 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
65 |
& SQUEEZE_RIGHT , myThid) |
66 |
WRITE(msgBuf,'(2A)') '** WARNING ** INI_MODEL_IO:', |
67 |
& ' use instead "useSingleCpuIO=.TRUE."' |
68 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
69 |
& SQUEEZE_RIGHT , myThid) |
70 |
_END_MASTER( myThid ) |
71 |
ENDIF |
72 |
|
73 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
74 |
|
75 |
C- Only Master-thread updates IO-parameter in Common blocks: |
76 |
_BEGIN_MASTER( myThid ) |
77 |
|
78 |
C- Initialise AB starting level |
79 |
C notes: those could be modified when reading a pickup that does |
80 |
C correspond to what is actually needed. |
81 |
tempStartAB = nIter0 |
82 |
saltStartAB = nIter0 |
83 |
mom_StartAB = nIter0 |
84 |
nHydStartAB = nIter0 |
85 |
IF ( startFromPickupAB2 ) tempStartAB = MIN( nIter0 , 1 ) |
86 |
saltStartAB = tempStartAB |
87 |
mom_StartAB = tempStartAB |
88 |
|
89 |
C- Initialise Alternating pickup-suffix |
90 |
nCheckLev = 1 |
91 |
checkPtSuff(1) = 'ckptA' |
92 |
checkPtSuff(2) = 'ckptB' |
93 |
|
94 |
C- Flags specific to RW and MDSIO |
95 |
|
96 |
C- now we make local directories with myProcessStr appended |
97 |
IF ( mdsioLocalDir .NE. ' ' ) THEN |
98 |
pIL = ILNBLNK( mdsioLocalDir ) |
99 |
namBuf(1:pIL) = mdsioLocalDir(1:pIL) |
100 |
WRITE(mdsioLocalDir,'(3A)') namBuf(1:pIL),myProcessStr(1:4),'/' |
101 |
ENDIF |
102 |
|
103 |
C- Initialise MFLDS variables in common block |
104 |
CALL READ_MFLDS_INIT( myThid ) |
105 |
|
106 |
C Set globalFiles flag for READ_WRITE_FLD package |
107 |
CALL SET_WRITE_GLOBAL_FLD( globalFiles ) |
108 |
C Set globalFiles flag for READ_WRITE_REC package |
109 |
CALL SET_WRITE_GLOBAL_REC( globalFiles ) |
110 |
C Set globalFiles flag for READ_WRITE_PICKUP |
111 |
CALL SET_WRITE_GLOBAL_PICKUP( globalFiles ) |
112 |
|
113 |
_END_MASTER( myThid ) |
114 |
C- Everyone else must wait for the IO-parameters to be set |
115 |
_BARRIER |
116 |
|
117 |
C- MNC model-io initialisation |
118 |
|
119 |
#ifdef ALLOW_MNC |
120 |
IF (useMNC) THEN |
121 |
|
122 |
C Write units/set precision/etc for I/O of variables/arrays |
123 |
C belonging to the core dynamical model |
124 |
CALL INI_MNC_VARS( myThid ) |
125 |
|
126 |
#ifdef ALLOW_AUTODIFF_MONITOR |
127 |
CALL AUTODIFF_INI_MODEL_IO( myThid ) |
128 |
#endif |
129 |
|
130 |
ENDIF |
131 |
#endif /* ALLOW_MNC */ |
132 |
|
133 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
134 |
|
135 |
RETURN |
136 |
END |