1 |
C $Header: /u/u3/gcmpack/MITgcm/model/src/do_the_model_io.F,v 1.31.2.1 2003/10/02 18:10:45 edhill Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: DO_THE_MODEL_IO |
9 |
C !INTERFACE: |
10 |
SUBROUTINE DO_THE_MODEL_IO(myCurrentTime, myIter, myThid) |
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE DO_THE_MODEL_IO |
14 |
C | o Controlling routine for IO in model main time-stepping |
15 |
C | loop. |
16 |
C *==========================================================* |
17 |
C | Many systems do not have thread safe IO so it is easier |
18 |
C | to lump everything together and do dumping of fields |
19 |
C | and updating of forcing terms in a single place. |
20 |
C | The approach to IO used here is that writes are only |
21 |
C | performed by thread 1 and that a process only writes out |
22 |
C | its data ( it does not know about anyone elses data!) |
23 |
C | Reading on the other hand is assumed to be from a file |
24 |
C | containing all the data for all the processes. Only the |
25 |
C | portion of data of interest to this process is actually |
26 |
C | loaded. To work well this assumes the existence of some |
27 |
C | reliable tool to join datasets together at the end of a |
28 |
C | run - see joinds.p |
29 |
C *==========================================================* |
30 |
C \ev |
31 |
|
32 |
C !USES: |
33 |
IMPLICIT NONE |
34 |
C == Global variables === |
35 |
#include "SIZE.h" |
36 |
#include "EEPARAMS.h" |
37 |
#include "PARAMS.h" |
38 |
#include "DYNVARS.h" |
39 |
cswdblk --- add --- |
40 |
#ifdef ALLOW_BULK_FORCE |
41 |
#include "BULKF.h" |
42 |
#include "FFIELDS.h" |
43 |
#endif |
44 |
cswdblk -- end add --- |
45 |
cswdice -- add --- |
46 |
#ifdef ALLOW_THERM_SEAICE |
47 |
#include "ICE.h" |
48 |
#include "ICE_DIAGS.h" |
49 |
#endif |
50 |
cswdice -- end add --- |
51 |
|
52 |
|
53 |
|
54 |
LOGICAL DIFFERENT_MULTIPLE |
55 |
EXTERNAL DIFFERENT_MULTIPLE |
56 |
|
57 |
C !INPUT/OUTPUT PARAMETERS: |
58 |
C == Routine arguments == |
59 |
C myThid - Thread number for this instance of the routine. |
60 |
C myIter - Iteration number |
61 |
C myCurrentTime - Current time of simulation ( s ) |
62 |
INTEGER myThid |
63 |
INTEGER myIter |
64 |
_RL myCurrentTime |
65 |
|
66 |
CEOP |
67 |
|
68 |
C-- Generaly only thread 1 does IO here. It can not start until |
69 |
C-- all threads fields are ready. |
70 |
IF ( |
71 |
& DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime, |
72 |
& myCurrentTime-deltaTClock) |
73 |
& ) THEN |
74 |
|
75 |
_BARRIER |
76 |
|
77 |
IF (debugMode) THEN |
78 |
C-- Write "text-plots" of certain fields |
79 |
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
80 |
& Nr, myIter, myThid ) |
81 |
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
82 |
& Nr, myIter, myThid ) |
83 |
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
84 |
& Nr, myIter, myThid ) |
85 |
CALL PLOT_FIELD_XYRL( etaN , 'Current etaN ' , |
86 |
& myIter, myThid ) |
87 |
ENDIF |
88 |
|
89 |
ENDIF |
90 |
|
91 |
C-- Write model state to binary file |
92 |
CALL WRITE_STATE( myCurrentTime, myIter, myThid ) |
93 |
|
94 |
#ifdef ALLOW_TIMEAVE |
95 |
C-- Do time averages |
96 |
ceh3 should this have an IF ( useTIMEAVE ) THEN |
97 |
IF (taveFreq.GT.0.) THEN |
98 |
CALL TIMEAVE_STATV_WRITE( myCurrentTime, myIter, myThid ) |
99 |
cswdptr -- add --- |
100 |
#ifdef ALLOW_PTRACERS |
101 |
ceh3 this needs an IF ( usePTRACERS ) THEN |
102 |
CALL PTRACERS_STATV_WRITE( myCurrentTime, myIter, myThid ) |
103 |
#endif |
104 |
cswdptr -- end add --- |
105 |
ENDIF |
106 |
#endif |
107 |
#ifdef ALLOW_AIM |
108 |
C-- Do AIM time averages |
109 |
IF (useAIM) |
110 |
& CALL AIM_WRITE_TAVE( myCurrentTime, myIter, myThid ) |
111 |
#endif |
112 |
#ifdef ALLOW_LAND |
113 |
C-- Do LAND time averages |
114 |
IF (useLAND) |
115 |
& CALL LAND_WRITE_TAVE( myCurrentTime, myIter, myThid ) |
116 |
#endif |
117 |
|
118 |
#ifdef ALLOW_OBCS |
119 |
IF (useOBCS) |
120 |
& CALL OBCS_DIAGS( myCurrentTime, myIter, myThid ) |
121 |
#endif |
122 |
|
123 |
#ifdef ALLOW_GMREDI |
124 |
C-- Do KPP diagnostics. |
125 |
IF (useGMRedi) |
126 |
& CALL GMREDI_DIAGS( myCurrentTime, myIter, myThid ) |
127 |
#endif |
128 |
|
129 |
#ifdef ALLOW_KPP |
130 |
C-- Do KPP diagnostics. |
131 |
IF (useKPP) |
132 |
& CALL KPP_DO_DIAGS( myCurrentTime, myIter, myThid ) |
133 |
#endif |
134 |
|
135 |
#ifdef ALLOW_SBO |
136 |
C-- Do SBO diagnostics. |
137 |
IF (useSBO) THEN |
138 |
CALL SBO_CALC ( myCurrentTime, myIter, myThid ) |
139 |
CALL SBO_DIAGS( myCurrentTime, myIter, myThid ) |
140 |
ENDIF |
141 |
#endif |
142 |
|
143 |
cswdblk --- add --- |
144 |
#ifdef ALLOW_BULK_FORCE |
145 |
C-- Do bulkf diagnostics. |
146 |
IF (useBulkforce) |
147 |
& CALL BULKF_DIAGS( myCurrentTime, myIter, myThid ) |
148 |
#endif |
149 |
cswdblk -- end add --- |
150 |
|
151 |
cswdice --- add --- |
152 |
#ifdef ALLOW_THERM_SEAICE |
153 |
C-- Do seaice diagnostics. |
154 |
IF (useThermSeaice) |
155 |
& CALL ICE_DIAGS( myCurrentTime, myIter, myThid ) |
156 |
#endif |
157 |
cswdice -- end add --- |
158 |
|
159 |
cswdptr --- add --- |
160 |
#ifdef ALLOW_GCHEM |
161 |
ceh3 ??? why is one package depending upon another here? |
162 |
C-- Do ptracer diagnostics. |
163 |
IF (usePTRACERS) |
164 |
& CALL GCHEM_DIAGS( myCurrentTime, myIter, myThid ) |
165 |
#endif |
166 |
cswdptr -- end add --- |
167 |
|
168 |
|
169 |
RETURN |
170 |
END |
171 |
|