1 |
C $Header: /u/gcmpack/MITgcm/model/src/do_the_model_io.F,v 1.59 2006/08/04 22:16:33 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
8 |
CBOP |
9 |
C !ROUTINE: DO_THE_MODEL_IO |
10 |
|
11 |
C !INTERFACE: |
12 |
SUBROUTINE DO_THE_MODEL_IO( |
13 |
I myTime, |
14 |
I myIter, |
15 |
I myThid ) |
16 |
|
17 |
C !DESCRIPTION: |
18 |
C This is the controlling routine for IO in the model main |
19 |
C time--stepping loop. Many systems do not have thread safe IO so it |
20 |
C is easier to lump everything together and do dumping of fields and |
21 |
C updating of forcing terms in a single place. The approach to IO |
22 |
C used here is that writes are only performed by thread 1 and that a |
23 |
C process only writes out its data (it does not know about anyone |
24 |
C elses data!) Reading on the other hand is assumed to be from a |
25 |
C file containing all the data for all the processes. Only the |
26 |
C portion of data of interest to this process is actually loaded. To |
27 |
C work well this assumes the existence of some reliable tool to join |
28 |
C datasets together at the end of a run -- see joinds. |
29 |
|
30 |
C !USES: |
31 |
IMPLICIT NONE |
32 |
#include "SIZE.h" |
33 |
#include "EEPARAMS.h" |
34 |
#include "PARAMS.h" |
35 |
#include "DYNVARS.h" |
36 |
LOGICAL DIFFERENT_MULTIPLE |
37 |
EXTERNAL DIFFERENT_MULTIPLE |
38 |
|
39 |
C !INPUT/OUTPUT PARAMETERS: |
40 |
C myTime :: Current time of simulation ( s ) |
41 |
C myIter :: Iteration number |
42 |
C myThid :: Thread number for this instance of the routine. |
43 |
_RL myTime |
44 |
INTEGER myThid |
45 |
INTEGER myIter |
46 |
CEOP |
47 |
|
48 |
|
49 |
C Generaly only thread 1 does IO here. It can not start until |
50 |
C all threads fields are ready. |
51 |
IF (debugMode) THEN |
52 |
IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime,deltaTClock) |
53 |
& ) THEN |
54 |
|
55 |
_BARRIER |
56 |
|
57 |
C Write "text-plots" of certain fields |
58 |
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
59 |
& Nr, myIter, myThid ) |
60 |
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
61 |
& Nr, myIter, myThid ) |
62 |
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
63 |
& Nr, myIter, myThid ) |
64 |
CALL PLOT_FIELD_XYRL( etaN , 'Current etaN ' , |
65 |
& myIter, myThid ) |
66 |
|
67 |
ENDIF |
68 |
ENDIF |
69 |
|
70 |
C Write model state to binary file |
71 |
IF ( .NOT.useOffLine ) THEN |
72 |
CALL WRITE_STATE( myTime, myIter, myThid ) |
73 |
ENDIF |
74 |
|
75 |
#ifdef ALLOW_TIMEAVE |
76 |
C Do time averages |
77 |
IF (taveFreq.GT.0. .AND. myIter.NE.nIter0 ) THEN |
78 |
CALL TIMEAVE_STATV_WRITE( myTime, myIter, myThid ) |
79 |
ENDIF |
80 |
#endif |
81 |
|
82 |
#ifdef ALLOW_FIZHI |
83 |
IF ( useFIZHI ) |
84 |
& CALL FIZHI_WRITE_STATE( myTime, myIter, myThid ) |
85 |
#endif |
86 |
|
87 |
#ifdef ALLOW_AIM |
88 |
C Do AIM time averages |
89 |
IF ( useAIM ) |
90 |
& CALL AIM_WRITE_TAVE( myTime, myIter, myThid ) |
91 |
#endif |
92 |
#ifdef ALLOW_LAND |
93 |
C Do LAND output |
94 |
IF ( useLAND ) |
95 |
& CALL LAND_OUTPUT( myTime, myIter, myThid ) |
96 |
#endif |
97 |
|
98 |
#ifdef ALLOW_OBCS |
99 |
IF (useOBCS .AND. myIter.NE.nIter0 ) |
100 |
& CALL OBCS_OUTPUT( myTime, myIter, myThid ) |
101 |
#endif |
102 |
|
103 |
#ifdef ALLOW_GMREDI |
104 |
C Do GMRedi output. |
105 |
IF (useGMRedi .AND. myIter.NE.nIter0 .AND. .NOT.useOffLine ) |
106 |
& CALL GMREDI_OUTPUT( myTime, myIter, myThid ) |
107 |
#endif |
108 |
|
109 |
#ifdef ALLOW_KPP |
110 |
C Do KPP diagnostics. |
111 |
IF ( useKPP .AND. .NOT.useOffLine ) |
112 |
& CALL KPP_OUTPUT( myTime, myIter, myThid ) |
113 |
#endif |
114 |
|
115 |
#ifdef ALLOW_PP81 |
116 |
C Do PP81 diagnostics. |
117 |
IF (usePP81 .AND. myIter.NE.nIter0 ) |
118 |
& CALL PP81_OUTPUT( myTime, myIter, myThid ) |
119 |
#endif |
120 |
|
121 |
#ifdef ALLOW_MY82 |
122 |
C Do MY82 diagnostics. |
123 |
IF (useMY82 .AND. myIter.NE.nIter0 ) |
124 |
& CALL MY82_OUTPUT( myTime, myIter, myThid ) |
125 |
#endif |
126 |
|
127 |
#ifdef ALLOW_OPPS |
128 |
C-- Do OPPS diagnostics. |
129 |
IF (useOPPS .AND. myIter.NE.nIter0 ) |
130 |
& CALL OPPS_OUTPUT( myTime, myIter, myThid ) |
131 |
#endif |
132 |
|
133 |
#ifdef ALLOW_GGL90 |
134 |
C-- Do GGL90 diagnostics. |
135 |
IF (useGGL90 .AND. myIter.NE.nIter0 ) |
136 |
& CALL GGL90_OUTPUT( myTime, myIter, myThid ) |
137 |
#endif |
138 |
|
139 |
#ifdef ALLOW_SBO |
140 |
C Do SBO diagnostics. |
141 |
IF (useSBO .AND. myIter.NE.nIter0 ) THEN |
142 |
CALL SBO_CALC ( myTime, myIter, myThid ) |
143 |
CALL SBO_OUTPUT( myTime, myIter, myThid ) |
144 |
ENDIF |
145 |
#endif |
146 |
|
147 |
#ifdef ALLOW_SEAICE |
148 |
IF ( useSEAICE ) THEN |
149 |
CALL SEAICE_OUTPUT( myTime, myIter, myThid ) |
150 |
ENDIF |
151 |
#endif /* ALLOW_SEAICE */ |
152 |
|
153 |
#ifdef ALLOW_SHELFICE |
154 |
IF ( useShelfIce ) THEN |
155 |
CALL SHELFICE_OUTPUT( myTime, myIter, myThid ) |
156 |
ENDIF |
157 |
#endif /* ALLOW_SHELFICE */ |
158 |
|
159 |
#ifdef ALLOW_BULK_FORCE |
160 |
C Do bulkf output. |
161 |
IF ( useBulkForce .AND. myIter.NE.nIter0 ) |
162 |
& CALL BULKF_OUTPUT( myTime, myIter, myThid ) |
163 |
#endif |
164 |
|
165 |
#ifdef ALLOW_THSICE |
166 |
C Do seaice output. |
167 |
IF (useThSIce) |
168 |
& CALL THSICE_OUTPUT( myTime, myIter, myThid ) |
169 |
#endif |
170 |
|
171 |
#ifdef ALLOW_PTRACERS |
172 |
C-- Do ptracer output. |
173 |
IF ( usePTRACERS ) |
174 |
& CALL PTRACERS_OUTPUT( myTime, myIter, myThid ) |
175 |
#endif |
176 |
|
177 |
#ifdef ALLOW_MATRIX |
178 |
C-- Do matrix output |
179 |
IF (useMATRIX) |
180 |
& CALL MATRIX_OUTPUT( myTime, myIter, myThid ) |
181 |
#endif |
182 |
|
183 |
#ifdef ALLOW_GCHEM |
184 |
C-- Do GCHEM diagnostics. |
185 |
IF (useGCHEM) |
186 |
& CALL GCHEM_OUTPUT( myTime, myIter, myThid ) |
187 |
#endif |
188 |
|
189 |
#ifdef ALLOW_OFFLINE |
190 |
C-- Do Off-Line variables output |
191 |
c IF (useOffLine) |
192 |
c & CALL OFFLINE_STATE( myTime, myIter, myThid ) |
193 |
#endif |
194 |
|
195 |
#ifdef COMPONENT_MODULE |
196 |
IF ( useCoupler ) |
197 |
& CALL CPL_OUTPUT( myTime, myIter, myThid ) |
198 |
#endif |
199 |
|
200 |
#ifdef ALLOW_DIAGNOSTICS |
201 |
IF ( useDiagnostics ) |
202 |
& CALL DIAGNOSTICS_WRITE( myTime, myIter, myThid ) |
203 |
#endif |
204 |
|
205 |
RETURN |
206 |
END |