1 |
C $Header: /u/gcmpack/MITgcm/model/src/ini_model_io.F,v 1.22 2006/08/04 01:22:18 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 |
|
23 |
C !INPUT/OUTPUT PARAMETERS: |
24 |
C myThid :: my Thread Id number |
25 |
INTEGER myThid |
26 |
|
27 |
C !FUNCTIONS |
28 |
INTEGER ILNBLNK |
29 |
EXTERNAL ILNBLNK |
30 |
|
31 |
C !LOCAL VARIABLES: |
32 |
C msgBuf :: Informational/error meesage buffer |
33 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
34 |
CHARACTER*(MAX_LEN_FNAM) namBuf |
35 |
INTEGER pIL |
36 |
CEOP |
37 |
|
38 |
C- Safety check: |
39 |
IF ( nPx*nPy.NE.1 .AND. globalFiles ) THEN |
40 |
_BEGIN_MASTER( myThid ) |
41 |
c WRITE(msgBuf,'(2A)') |
42 |
c & 'INI_MODEL_IO: globalFiles=TRUE is not safe', |
43 |
c & ' in Multi-processors (MPI) run' |
44 |
c CALL PRINT_ERROR( msgBuf , myThid) |
45 |
c WRITE(msgBuf,'(2A)') |
46 |
c & 'INI_MODEL_IO: use instead "useSingleCpuIO=.TRUE."' |
47 |
c CALL PRINT_ERROR( msgBuf , myThid) |
48 |
c STOP 'ABNORMAL END: S/R INI_MODEL_IO' |
49 |
C------ |
50 |
C GlobalFiles option with Multi-processors execution (with MPI) is not |
51 |
C safe: dependending on the platform & compiler, it may produce: |
52 |
C - incomplete output files (wrong size) |
53 |
C - wrong isolated values in some output files |
54 |
C - missing tiles (all zeros) in some output files. |
55 |
C A safe alternative is to set "useSingleCpuIO=.TRUE." in file "data", |
56 |
C namelist PARAM01 (and to keep the default value of globalFiles=FALSE) |
57 |
C or if you are really sure that the globalFile works well on our platform |
58 |
C & compiler, comment out the above "stop" |
59 |
C----- |
60 |
WRITE(msgBuf,'(2A)') |
61 |
& '** WARNING ** INI_MODEL_IO: globalFiles=TRUE is not safe', |
62 |
& ' in Multi-processors (MPI) run' |
63 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
64 |
& SQUEEZE_RIGHT , myThid) |
65 |
WRITE(msgBuf,'(2A)') '** WARNING ** INI_MODEL_IO:', |
66 |
& ' use instead "useSingleCpuIO=.TRUE."' |
67 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
68 |
& SQUEEZE_RIGHT , myThid) |
69 |
_END_MASTER( myThid ) |
70 |
ENDIF |
71 |
|
72 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
73 |
|
74 |
C- Flags specific to RW and MDSIO |
75 |
|
76 |
C- Only Master-thread updates IO-parameter in Common blocks: |
77 |
_BEGIN_MASTER( myThid ) |
78 |
|
79 |
C- now we make local directories with myProcessStr appended |
80 |
IF ( mdsioLocalDir .NE. ' ' ) THEN |
81 |
pIL = ILNBLNK( mdsioLocalDir ) |
82 |
namBuf(1:pIL) = mdsioLocalDir(1:pIL) |
83 |
WRITE(mdsioLocalDir,'(3A)') namBuf(1:pIL),myProcessStr(1:4),'/' |
84 |
ENDIF |
85 |
|
86 |
C Set globalFiles flag for READ_WRITE_FLD package |
87 |
CALL SET_WRITE_GLOBAL_FLD( globalFiles ) |
88 |
C Set globalFiles flag for READ_WRITE_REC package |
89 |
CALL SET_WRITE_GLOBAL_REC( globalFiles ) |
90 |
C Set globalFiles flag for READ_WRITE_PICKUP |
91 |
CALL SET_WRITE_GLOBAL_PICKUP( globalFiles ) |
92 |
|
93 |
_END_MASTER( myThid ) |
94 |
C- Everyone else must wait for the IO-parameters to be set |
95 |
_BARRIER |
96 |
|
97 |
C- MNC model-io initialisation |
98 |
|
99 |
#ifdef ALLOW_MNC |
100 |
IF (useMNC) THEN |
101 |
|
102 |
C Write units/set precision/etc for I/O of variables/arrays |
103 |
C belonging to the core dynamical model |
104 |
CALL INI_MNC_VARS( myThid ) |
105 |
|
106 |
#ifdef ALLOW_AUTODIFF_MONITOR |
107 |
CALL AUTODIFF_INI_MODEL_IO( myThid ) |
108 |
#endif |
109 |
|
110 |
ENDIF |
111 |
#endif /* ALLOW_MNC */ |
112 |
|
113 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
114 |
|
115 |
RETURN |
116 |
END |