1 |
molod |
1.54 |
C $Header: /u/gcmpack/MITgcm/model/src/do_the_model_io.F,v 1.53 2005/05/15 03:02:08 jmc Exp $ |
2 |
adcroft |
1.21 |
C $Name: $ |
3 |
cnh |
1.1 |
|
4 |
edhill |
1.32 |
#include "PACKAGES_CONFIG.h" |
5 |
cnh |
1.11 |
#include "CPP_OPTIONS.h" |
6 |
cnh |
1.1 |
|
7 |
edhill |
1.43 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
8 |
cnh |
1.22 |
CBOP |
9 |
|
|
C !ROUTINE: DO_THE_MODEL_IO |
10 |
edhill |
1.43 |
|
11 |
cnh |
1.22 |
C !INTERFACE: |
12 |
edhill |
1.43 |
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 |
cnh |
1.22 |
|
30 |
|
|
C !USES: |
31 |
adcroft |
1.12 |
IMPLICIT NONE |
32 |
cnh |
1.1 |
#include "SIZE.h" |
33 |
|
|
#include "EEPARAMS.h" |
34 |
|
|
#include "PARAMS.h" |
35 |
|
|
#include "DYNVARS.h" |
36 |
jmc |
1.53 |
LOGICAL DIFFERENT_MULTIPLE |
37 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
38 |
cnh |
1.3 |
|
39 |
cnh |
1.22 |
C !INPUT/OUTPUT PARAMETERS: |
40 |
cnh |
1.1 |
C myThid - Thread number for this instance of the routine. |
41 |
|
|
C myIter - Iteration number |
42 |
jmc |
1.34 |
C myTime - Current time of simulation ( s ) |
43 |
cnh |
1.1 |
INTEGER myThid |
44 |
|
|
INTEGER myIter |
45 |
jmc |
1.34 |
_RL myTime |
46 |
edhill |
1.43 |
CEOP |
47 |
cnh |
1.1 |
|
48 |
|
|
|
49 |
edhill |
1.43 |
C Generaly only thread 1 does IO here. It can not start until |
50 |
|
|
C all threads fields are ready. |
51 |
jmc |
1.34 |
IF (debugMode) THEN |
52 |
jmc |
1.53 |
IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime,deltaTClock) |
53 |
molod |
1.54 |
& .AND. (.not. nodumps) ) THEN |
54 |
cnh |
1.6 |
|
55 |
edhill |
1.43 |
_BARRIER |
56 |
cnh |
1.1 |
|
57 |
edhill |
1.43 |
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 |
cnh |
1.3 |
ENDIF |
69 |
|
|
|
70 |
edhill |
1.43 |
C Write model state to binary file |
71 |
molod |
1.54 |
if( .not. nodumps ) then |
72 |
|
|
CALL WRITE_STATE( myTime, myIter, myThid ) |
73 |
|
|
endif |
74 |
cnh |
1.5 |
|
75 |
jmc |
1.19 |
#ifdef ALLOW_TIMEAVE |
76 |
edhill |
1.43 |
C Do time averages |
77 |
jmc |
1.34 |
IF (taveFreq.GT.0. .AND. myIter.NE.nIter0 ) THEN |
78 |
edhill |
1.43 |
CALL TIMEAVE_STATV_WRITE( myTime, myIter, myThid ) |
79 |
jmc |
1.26 |
ENDIF |
80 |
molod |
1.38 |
#endif |
81 |
|
|
|
82 |
|
|
#ifdef ALLOW_FIZHI |
83 |
molod |
1.54 |
if( .not. nodumps ) then |
84 |
molod |
1.38 |
if(useFIZHI) call fizhi_write_state( myTime, myIter, myThid ) |
85 |
molod |
1.54 |
endif |
86 |
jmc |
1.26 |
#endif |
87 |
jmc |
1.34 |
|
88 |
adcroft |
1.21 |
#ifdef ALLOW_AIM |
89 |
edhill |
1.43 |
C Do AIM time averages |
90 |
jmc |
1.37 |
IF ( useAIM ) |
91 |
edhill |
1.43 |
& CALL AIM_WRITE_TAVE( myTime, myIter, myThid ) |
92 |
jmc |
1.28 |
#endif |
93 |
|
|
#ifdef ALLOW_LAND |
94 |
edhill |
1.43 |
C Do LAND time averages |
95 |
jmc |
1.37 |
IF ( useLAND ) |
96 |
edhill |
1.43 |
& CALL LAND_WRITE_DIAGS( myTime, myIter, myThid ) |
97 |
adcroft |
1.21 |
#endif |
98 |
heimbach |
1.29 |
|
99 |
|
|
#ifdef ALLOW_OBCS |
100 |
jmc |
1.34 |
IF (useOBCS .AND. myIter.NE.nIter0 ) |
101 |
edhill |
1.43 |
& CALL OBCS_DIAGS( myTime, myIter, myThid ) |
102 |
heimbach |
1.29 |
#endif |
103 |
adcroft |
1.16 |
|
104 |
|
|
#ifdef ALLOW_GMREDI |
105 |
jmc |
1.49 |
C Do GMRedi output. |
106 |
jmc |
1.34 |
IF (useGMRedi .AND. myIter.NE.nIter0 ) |
107 |
jmc |
1.49 |
& CALL GMREDI_OUTPUT( myTime, myIter, myThid ) |
108 |
adcroft |
1.16 |
#endif |
109 |
|
|
|
110 |
|
|
#ifdef ALLOW_KPP |
111 |
edhill |
1.43 |
C Do KPP diagnostics. |
112 |
jmc |
1.45 |
IF ( useKPP ) |
113 |
edhill |
1.43 |
& CALL KPP_DO_DIAGS( myTime, myIter, myThid ) |
114 |
adcroft |
1.16 |
#endif |
115 |
cheisey |
1.23 |
|
116 |
mlosch |
1.42 |
#ifdef ALLOW_PP81 |
117 |
edhill |
1.43 |
C Do PP81 diagnostics. |
118 |
mlosch |
1.42 |
IF (usePP81 .AND. myIter.NE.nIter0 ) |
119 |
edhill |
1.43 |
& CALL PP81_DO_DIAGS( myTime, myIter, myThid ) |
120 |
mlosch |
1.42 |
#endif |
121 |
|
|
|
122 |
|
|
#ifdef ALLOW_MY82 |
123 |
edhill |
1.43 |
C Do MY82 diagnostics. |
124 |
mlosch |
1.42 |
IF (useMY82 .AND. myIter.NE.nIter0 ) |
125 |
edhill |
1.43 |
& CALL MY82_DO_DIAGS( myTime, myIter, myThid ) |
126 |
mlosch |
1.42 |
#endif |
127 |
|
|
|
128 |
mlosch |
1.44 |
#ifdef ALLOW_OPPS |
129 |
|
|
C-- Do OPPS diagnostics. |
130 |
|
|
IF (useOPPS .AND. myIter.NE.nIter0 ) |
131 |
|
|
& CALL OPPS_DO_DIAGS( myTime, myIter, myThid ) |
132 |
|
|
#endif |
133 |
|
|
|
134 |
|
|
#ifdef ALLOW_GGL90 |
135 |
|
|
C-- Do GGL90 diagnostics. |
136 |
|
|
IF (useGGL90 .AND. myIter.NE.nIter0 ) |
137 |
|
|
& CALL GGL90_DO_DIAGS( myTime, myIter, myThid ) |
138 |
|
|
#endif |
139 |
|
|
|
140 |
dimitri |
1.27 |
#ifdef ALLOW_SBO |
141 |
edhill |
1.43 |
C Do SBO diagnostics. |
142 |
jmc |
1.34 |
IF (useSBO .AND. myIter.NE.nIter0 ) THEN |
143 |
edhill |
1.43 |
CALL SBO_CALC ( myTime, myIter, myThid ) |
144 |
|
|
CALL SBO_DIAGS( myTime, myIter, myThid ) |
145 |
dimitri |
1.27 |
ENDIF |
146 |
|
|
#endif |
147 |
dimitri |
1.40 |
|
148 |
|
|
#ifdef ALLOW_SEAICE |
149 |
edhill |
1.43 |
IF ( useSEAICE ) THEN |
150 |
|
|
CALL SEAICE_DO_DIAGS( myTime, myIter, myThid ) |
151 |
|
|
ENDIF |
152 |
dimitri |
1.40 |
#endif /* ALLOW_SEAICE */ |
153 |
dimitri |
1.27 |
|
154 |
cheisey |
1.24 |
#ifdef ALLOW_BULK_FORCE |
155 |
edhill |
1.43 |
C Do bulkf diagnostics. |
156 |
jmc |
1.35 |
IF (useBulkForce .AND. myIter.NE.nIter0 ) |
157 |
edhill |
1.43 |
& CALL BULKF_DIAGS( myTime, myIter, myThid ) |
158 |
cheisey |
1.23 |
#endif |
159 |
|
|
|
160 |
jmc |
1.35 |
#ifdef ALLOW_THSICE |
161 |
jmc |
1.49 |
C Do seaice output. |
162 |
jmc |
1.35 |
IF (useThSIce) |
163 |
jmc |
1.49 |
& CALL THSICE_OUTPUT( myTime, myIter, myThid ) |
164 |
cheisey |
1.23 |
#endif |
165 |
stephd |
1.30 |
|
166 |
mlosch |
1.47 |
#ifdef ALLOW_PTRACERS |
167 |
|
|
C-- Do ptracer output. |
168 |
|
|
IF ( usePTRACERS ) |
169 |
|
|
& CALL PTRACERS_OUTPUT( myTime, myIter, myThid ) |
170 |
|
|
#endif |
171 |
|
|
|
172 |
spk |
1.52 |
#ifdef ALLOW_MATRIX |
173 |
|
|
C-- Do matrix output |
174 |
|
|
IF (useMATRIX) |
175 |
|
|
& CALL MATRIX_OUTPUT( myTime, myIter, myThid ) |
176 |
|
|
#endif |
177 |
|
|
|
178 |
heimbach |
1.31 |
#ifdef ALLOW_GCHEM |
179 |
mlosch |
1.47 |
C-- Do GCHEM diagnostics. |
180 |
mlosch |
1.46 |
IF (useGCHEM) |
181 |
jmc |
1.34 |
& CALL GCHEM_DIAGS( myTime, myIter, myThid ) |
182 |
stephd |
1.30 |
#endif |
183 |
jmc |
1.36 |
|
184 |
|
|
#ifdef COMPONENT_MODULE |
185 |
|
|
IF ( useCoupler ) |
186 |
edhill |
1.43 |
& CALL CPL_WRITE_DIAGS( myTime, myIter, myThid ) |
187 |
molod |
1.39 |
#endif |
188 |
|
|
|
189 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
190 |
jmc |
1.50 |
IF ( usediagnostics ) |
191 |
|
|
& CALL DIAGNOSTICS_WRITE( myTime, myIter, myThid ) |
192 |
jmc |
1.36 |
#endif |
193 |
adcroft |
1.16 |
|
194 |
cnh |
1.1 |
RETURN |
195 |
|
|
END |