1 |
C $Header: /u/gcmpack/MITgcm/model/src/do_the_model_io.F,v 1.55 2005/08/24 23:10:36 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 myThid - Thread number for this instance of the routine. |
41 |
C myIter - Iteration number |
42 |
C myTime - Current time of simulation ( s ) |
43 |
INTEGER myThid |
44 |
INTEGER myIter |
45 |
_RL myTime |
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 |
CALL WRITE_STATE( myTime, myIter, myThid ) |
72 |
|
73 |
#ifdef ALLOW_TIMEAVE |
74 |
C Do time averages |
75 |
IF (taveFreq.GT.0. .AND. myIter.NE.nIter0 ) THEN |
76 |
CALL TIMEAVE_STATV_WRITE( myTime, myIter, myThid ) |
77 |
ENDIF |
78 |
#endif |
79 |
|
80 |
#ifdef ALLOW_FIZHI |
81 |
IF ( useFIZHI ) |
82 |
& CALL FIZHI_WRITE_STATE( myTime, myIter, myThid ) |
83 |
#endif |
84 |
|
85 |
#ifdef ALLOW_AIM |
86 |
C Do AIM time averages |
87 |
IF ( useAIM ) |
88 |
& CALL AIM_WRITE_TAVE( myTime, myIter, myThid ) |
89 |
#endif |
90 |
#ifdef ALLOW_LAND |
91 |
C Do LAND time averages |
92 |
IF ( useLAND ) |
93 |
& CALL LAND_WRITE_DIAGS( myTime, myIter, myThid ) |
94 |
#endif |
95 |
|
96 |
#ifdef ALLOW_OBCS |
97 |
IF (useOBCS .AND. myIter.NE.nIter0 ) |
98 |
& CALL OBCS_DIAGS( myTime, myIter, myThid ) |
99 |
#endif |
100 |
|
101 |
#ifdef ALLOW_GMREDI |
102 |
C Do GMRedi output. |
103 |
IF (useGMRedi .AND. myIter.NE.nIter0 ) |
104 |
& CALL GMREDI_OUTPUT( myTime, myIter, myThid ) |
105 |
#endif |
106 |
|
107 |
#ifdef ALLOW_KPP |
108 |
C Do KPP diagnostics. |
109 |
IF ( useKPP ) |
110 |
& CALL KPP_DO_DIAGS( myTime, myIter, myThid ) |
111 |
#endif |
112 |
|
113 |
#ifdef ALLOW_PP81 |
114 |
C Do PP81 diagnostics. |
115 |
IF (usePP81 .AND. myIter.NE.nIter0 ) |
116 |
& CALL PP81_DO_DIAGS( myTime, myIter, myThid ) |
117 |
#endif |
118 |
|
119 |
#ifdef ALLOW_MY82 |
120 |
C Do MY82 diagnostics. |
121 |
IF (useMY82 .AND. myIter.NE.nIter0 ) |
122 |
& CALL MY82_DO_DIAGS( myTime, myIter, myThid ) |
123 |
#endif |
124 |
|
125 |
#ifdef ALLOW_OPPS |
126 |
C-- Do OPPS diagnostics. |
127 |
IF (useOPPS .AND. myIter.NE.nIter0 ) |
128 |
& CALL OPPS_DO_DIAGS( myTime, myIter, myThid ) |
129 |
#endif |
130 |
|
131 |
#ifdef ALLOW_GGL90 |
132 |
C-- Do GGL90 diagnostics. |
133 |
IF (useGGL90 .AND. myIter.NE.nIter0 ) |
134 |
& CALL GGL90_DO_DIAGS( myTime, myIter, myThid ) |
135 |
#endif |
136 |
|
137 |
#ifdef ALLOW_SBO |
138 |
C Do SBO diagnostics. |
139 |
IF (useSBO .AND. myIter.NE.nIter0 ) THEN |
140 |
CALL SBO_CALC ( myTime, myIter, myThid ) |
141 |
CALL SBO_DIAGS( myTime, myIter, myThid ) |
142 |
ENDIF |
143 |
#endif |
144 |
|
145 |
#ifdef ALLOW_SEAICE |
146 |
IF ( useSEAICE ) THEN |
147 |
CALL SEAICE_DO_DIAGS( myTime, myIter, myThid ) |
148 |
ENDIF |
149 |
#endif /* ALLOW_SEAICE */ |
150 |
|
151 |
#ifdef ALLOW_SHELFICE |
152 |
IF ( useShelfIce ) THEN |
153 |
CALL SHELFICE_DO_DIAGS( myTime, myIter, myThid ) |
154 |
ENDIF |
155 |
#endif /* ALLOW_SHELFICE */ |
156 |
|
157 |
#ifdef ALLOW_BULK_FORCE |
158 |
C Do bulkf diagnostics. |
159 |
IF (useBulkForce .AND. myIter.NE.nIter0 ) |
160 |
& CALL BULKF_DIAGS( myTime, myIter, myThid ) |
161 |
#endif |
162 |
|
163 |
#ifdef ALLOW_THSICE |
164 |
C Do seaice output. |
165 |
IF (useThSIce) |
166 |
& CALL THSICE_OUTPUT( myTime, myIter, myThid ) |
167 |
#endif |
168 |
|
169 |
#ifdef ALLOW_PTRACERS |
170 |
C-- Do ptracer output. |
171 |
IF ( usePTRACERS ) |
172 |
& CALL PTRACERS_OUTPUT( myTime, myIter, myThid ) |
173 |
#endif |
174 |
|
175 |
#ifdef ALLOW_MATRIX |
176 |
C-- Do matrix output |
177 |
IF (useMATRIX) |
178 |
& CALL MATRIX_OUTPUT( myTime, myIter, myThid ) |
179 |
#endif |
180 |
|
181 |
#ifdef ALLOW_GCHEM |
182 |
C-- Do GCHEM diagnostics. |
183 |
IF (useGCHEM) |
184 |
& CALL GCHEM_DIAGS( myTime, myIter, myThid ) |
185 |
#endif |
186 |
|
187 |
#ifdef COMPONENT_MODULE |
188 |
IF ( useCoupler ) |
189 |
& CALL CPL_WRITE_DIAGS( myTime, myIter, myThid ) |
190 |
#endif |
191 |
|
192 |
#ifdef ALLOW_DIAGNOSTICS |
193 |
IF ( usediagnostics ) |
194 |
& CALL DIAGNOSTICS_WRITE( myTime, myIter, myThid ) |
195 |
#endif |
196 |
|
197 |
RETURN |
198 |
END |