/[MITgcm]/MITgcm/model/src/ini_model_io.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_model_io.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.45 - (show annotations) (download)
Tue Sep 4 22:16:09 2012 UTC (11 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64f, checkpoint63s, checkpoint64
Changes since 1.44: +1 -4 lines
remove unused variables

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_model_io.F,v 1.44 2012/06/22 02:03:03 gforget 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 Initialisation and setting of I/O:
15 C - Check size and initialise global I/O buffer
16 C - Initialise flags for pickup and for mdsio/rw.
17 C - Do MNC model-IO initialisation
18 C - Do Monitor-IO initialisation
19
20 C !USES:
21 IMPLICIT NONE
22 #include "SIZE.h"
23 #include "EEPARAMS.h"
24 #include "EESUPPORT.h"
25 #include "PARAMS.h"
26 #include "RESTART.h"
27 #ifdef ALLOW_EXCH2
28 # include "W2_EXCH2_SIZE.h"
29 # include "W2_EXCH2_TOPOLOGY.h"
30 # include "W2_EXCH2_PARAMS.h"
31 #endif /* ALLOW_EXCH2 */
32 #include "EEBUFF_SCPU.h"
33
34 C !INPUT/OUTPUT PARAMETERS:
35 C myThid :: my Thread Id number
36 INTEGER myThid
37
38 C !FUNCTIONS
39 INTEGER ILNBLNK
40 EXTERNAL ILNBLNK
41
42 C !LOCAL VARIABLES:
43 C msgBuf :: Informational/error message buffer
44 CHARACTER*(MAX_LEN_MBUF) msgBuf
45 CHARACTER*(MAX_LEN_FNAM) namBuf
46 INTEGER i, iL, pIL
47 LOGICAL useGlobalBuff
48 #ifdef ALLOW_EXCH2
49 INTEGER xySize
50 #endif /* ALLOW_EXCH2 */
51 CEOP
52
53 C- Safety check:
54 IF ( nPx*nPy.NE.1 .AND. globalFiles
55 & .AND. .NOT.useSingleCpuIO ) THEN
56 _BEGIN_MASTER( myThid )
57 c WRITE(msgBuf,'(2A)')
58 c & 'INI_MODEL_IO: globalFiles=TRUE is not safe',
59 c & ' in Multi-processors (MPI) run'
60 c CALL PRINT_ERROR( msgBuf , myThid)
61 c WRITE(msgBuf,'(2A)')
62 c & 'INI_MODEL_IO: use instead "useSingleCpuIO=.TRUE."'
63 c CALL PRINT_ERROR( msgBuf , myThid)
64 c STOP 'ABNORMAL END: S/R INI_MODEL_IO'
65 C------
66 C GlobalFiles option with Multi-processors execution (with MPI) is not
67 C safe: dependending on the platform & compiler, it may produce:
68 C - incomplete output files (wrong size)
69 C - wrong isolated values in some output files
70 C - missing tiles (all zeros) in some output files.
71 C A safe alternative is to set "useSingleCpuIO=.TRUE." in file "data",
72 C namelist PARAM01 (and to keep the default value of globalFiles=FALSE)
73 C or if you are really sure that the globalFile works well on our platform
74 C & compiler, comment out the above "stop"
75 C-----
76 WRITE(msgBuf,'(2A)')
77 & '** WARNING ** INI_MODEL_IO: globalFiles=TRUE is not safe',
78 & ' in Multi-processors (MPI) run'
79 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
80 & SQUEEZE_RIGHT, myThid )
81 WRITE(msgBuf,'(2A)') '** WARNING ** INI_MODEL_IO:',
82 & ' use instead "useSingleCpuIO=.TRUE."'
83 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
84 & SQUEEZE_RIGHT, myThid )
85 _END_MASTER( myThid )
86 ENDIF
87
88 C- Check size of IO buffers:
89 useGlobalBuff = useSingleCpuIO
90 #ifdef CG2D_SINGLECPU_SUM
91 useGlobalBuff = .TRUE.
92 #endif /* CG2D_SINGLECPU_SUM */
93 #ifdef ALLOW_EXCH2
94 IF ( useGlobalBuff ) THEN
95 xySize = exch2_global_Nx*exch2_global_Ny
96 #ifndef CG2D_SINGLECPU_SUM
97 IF ( .NOT.W2_useE2ioLayOut ) xySize = Nx*Ny
98 #endif /* ndef CG2D_SINGLECPU_SUM */
99 IF ( xySize.GT.W2_ioBufferSize ) THEN
100 WRITE(msgBuf,'(A,2(I10,A))')
101 & 'W2_ioBufferSize=', W2_ioBufferSize,
102 & ' <', xySize, ' = Size of Global 2-D map'
103 CALL PRINT_ERROR( msgBuf, myThid )
104 WRITE(msgBuf,'(2A)')
105 & 'INI_MODEL_IO: increase W2_ioBufferSize',
106 & ' in "W2_EXCH2_SIZE.h" + recompile'
107 CALL PRINT_ERROR( msgBuf, myThid )
108 STOP 'ABNORMAL END: S/R INI_MODEL_IO (buffer size)'
109 ENDIF
110 ENDIF
111 #endif /* ALLOW_EXCH2 */
112 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
113
114 C- Only Master-thread updates IO-parameter in Common blocks:
115 _BEGIN_MASTER( myThid )
116
117 C- Initialise AB starting level
118 C notes: those could be modified when reading a pickup that does
119 C not correspond to what is actually needed.
120 tempStartAB = nIter0
121 saltStartAB = nIter0
122 mom_StartAB = nIter0
123 nHydStartAB = nIter0
124 IF ( startFromPickupAB2 ) tempStartAB = MIN( nIter0 , 1 )
125 saltStartAB = tempStartAB
126 mom_StartAB = tempStartAB
127 nHydStartAB = tempStartAB
128 dPhiNHstatus= 0
129
130 C- Initialise Alternating pickup-suffix
131 nCheckLev = 1
132 checkPtSuff(1) = 'ckptA'
133 checkPtSuff(2) = 'ckptB'
134
135 C- Flags specific to RW and MDSIO (and PLOT_FIELDS)
136 printDomain = debugLevel.GE.debLevB
137
138 C- now we make local directories with myProcessStr appended
139 IF ( mdsioLocalDir .NE. ' ' ) THEN
140 iL = ILNBLNK( mdsioLocalDir )
141 WRITE(namBuf,'(3A)')
142 & ' mkdir -p ', mdsioLocalDir(1:iL),myProcessStr(1:4)
143 pIL = 1 + ILNBLNK( namBuf )
144 WRITE(standardMessageUnit,'(3A)')
145 & '==> SYSTEM CALL (from INI_MODEL_IO): >',namBuf(1:pIL),'<'
146 CALL SYSTEM( namBuf(1:pIL) )
147 namBuf(1:iL) = mdsioLocalDir(1:iL)
148 WRITE(mdsioLocalDir,'(3A)') namBuf(1:iL),myProcessStr(1:4),'/'
149 ENDIF
150
151 C- Initialise MFLDS variables in common block
152 CALL READ_MFLDS_INIT( myThid )
153
154 C Set globalFiles flag for READ_WRITE_FLD package
155 CALL SET_WRITE_GLOBAL_FLD( globalFiles )
156 C Set globalFiles flag for READ_WRITE_REC package
157 CALL SET_WRITE_GLOBAL_REC( globalFiles )
158 C Set globalFiles flag for READ_WRITE_SEC package
159 IF ( useOBCS .AND. globalFiles ) THEN
160 WRITE(msgBuf,'(2A)') '** WARNING ** INI_MODEL_IO:',
161 & ' use tiled-files to write sections (for OBCS)'
162 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
163 & SQUEEZE_RIGHT, myThid )
164 CALL SET_WRITE_GLOBAL_SEC( .FALSE. )
165 ELSE
166 CALL SET_WRITE_GLOBAL_SEC( globalFiles )
167 ENDIF
168 C Set globalFiles flag for READ_WRITE_PICKUP
169 CALL SET_WRITE_GLOBAL_PICKUP( globalFiles )
170
171 _END_MASTER( myThid )
172 C- Everyone else must wait for the IO-parameters to be set
173 _BARRIER
174
175 C- Global IO-buffers initialisation
176 IF ( useGlobalBuff ) THEN
177 _BEGIN_MASTER( myThid )
178 DO i=1,xyBuffer_size
179 xy_buffer_r8(i) = 0. _d 0
180 xy_buffer_r4(i) = 0.
181 ENDDO
182 _END_MASTER( myThid )
183 ENDIF
184
185 C- MNC model-io initialisation
186
187 #ifdef ALLOW_MNC
188 IF (useMNC) THEN
189
190 C- Initialize look-up tables for MNC
191 CALL MNC_INIT( myThid )
192 CALL MNC_CW_INIT( sNx,sNy,OLx,OLy,nSx,nSy,nPx,nPy,
193 & Nr,myThid )
194 CEH3 IF ( mnc_echo_gvtypes ) THEN
195 CEH3 CALL MNC_CW_DUMP( myThid )
196 CEH3 ENDIF
197
198 C Write units/set precision/etc for I/O of variables/arrays
199 C belonging to the core dynamical model
200 CALL INI_MNC_VARS( myThid )
201
202 ENDIF
203 #endif /* ALLOW_MNC */
204
205 #ifdef ALLOW_AUTODIFF
206 CALL AUTODIFF_INI_MODEL_IO( myThid )
207 #endif
208
209 #ifdef ALLOW_PROFILES
210 IF ( usePROFILES ) THEN
211 CALL PROFILES_INI_IO( myThid )
212 ENDIF
213 #endif
214
215 #ifdef ALLOW_MONITOR
216 C-- Initialise MONITOR I/O streams so we can report config. info
217 CALL MON_INIT( myThid )
218 #endif
219
220 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
221
222 RETURN
223 END

  ViewVC Help
Powered by ViewVC 1.1.22