1 |
C $Header: /u/gcmpack/MITgcm/model/src/do_the_model_io.F,v 1.40 2004/03/02 08:45:46 dimitri 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( myTime, 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 |
|
40 |
|
41 |
LOGICAL DIFFERENT_MULTIPLE |
42 |
EXTERNAL DIFFERENT_MULTIPLE |
43 |
|
44 |
C !INPUT/OUTPUT PARAMETERS: |
45 |
C == Routine arguments == |
46 |
C myThid - Thread number for this instance of the routine. |
47 |
C myIter - Iteration number |
48 |
C myTime - Current time of simulation ( s ) |
49 |
INTEGER myThid |
50 |
INTEGER myIter |
51 |
_RL myTime |
52 |
|
53 |
CEOP |
54 |
|
55 |
C-- Generaly only thread 1 does IO here. It can not start until |
56 |
C-- all threads fields are ready. |
57 |
IF (debugMode) THEN |
58 |
IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime, myTime-deltaTClock) |
59 |
& ) THEN |
60 |
|
61 |
_BARRIER |
62 |
|
63 |
C-- Write "text-plots" of certain fields |
64 |
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
65 |
& Nr, myIter, myThid ) |
66 |
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
67 |
& Nr, myIter, myThid ) |
68 |
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
69 |
& Nr, myIter, myThid ) |
70 |
CALL PLOT_FIELD_XYRL( etaN , 'Current etaN ' , |
71 |
& myIter, myThid ) |
72 |
|
73 |
ENDIF |
74 |
ENDIF |
75 |
|
76 |
C-- Write model state to binary file |
77 |
CALL WRITE_STATE( myTime, myIter, myThid ) |
78 |
|
79 |
#ifdef ALLOW_TIMEAVE |
80 |
C-- Do time averages |
81 |
IF (taveFreq.GT.0. .AND. myIter.NE.nIter0 ) THEN |
82 |
CALL TIMEAVE_STATV_WRITE( myTime, myIter, myThid ) |
83 |
#ifdef ALLOW_PTRACERS |
84 |
IF ( usePTRACERS ) |
85 |
& CALL PTRACERS_STATV_WRITE( myTime, myIter, myThid ) |
86 |
#endif |
87 |
ENDIF |
88 |
#endif |
89 |
|
90 |
#ifdef ALLOW_FIZHI |
91 |
if(useFIZHI) call fizhi_write_state( myTime, myIter, myThid ) |
92 |
#endif |
93 |
|
94 |
#ifdef ALLOW_AIM |
95 |
C-- Do AIM time averages |
96 |
IF ( useAIM ) |
97 |
& CALL AIM_WRITE_TAVE( myTime, myIter, myThid ) |
98 |
#endif |
99 |
#ifdef ALLOW_LAND |
100 |
C-- Do LAND time averages |
101 |
IF ( useLAND ) |
102 |
& CALL LAND_WRITE_DIAGS( myTime, myIter, myThid ) |
103 |
#endif |
104 |
|
105 |
#ifdef ALLOW_OBCS |
106 |
IF (useOBCS .AND. myIter.NE.nIter0 ) |
107 |
& CALL OBCS_DIAGS( myTime, myIter, myThid ) |
108 |
#endif |
109 |
|
110 |
#ifdef ALLOW_GMREDI |
111 |
C-- Do KPP diagnostics. |
112 |
IF (useGMRedi .AND. myIter.NE.nIter0 ) |
113 |
& CALL GMREDI_DIAGS( myTime, myIter, myThid ) |
114 |
#endif |
115 |
|
116 |
#ifdef ALLOW_KPP |
117 |
C-- Do KPP diagnostics. |
118 |
IF (useKPP .AND. myIter.NE.nIter0 ) |
119 |
& CALL KPP_DO_DIAGS( myTime, myIter, myThid ) |
120 |
#endif |
121 |
|
122 |
#ifdef ALLOW_SBO |
123 |
C-- Do SBO diagnostics. |
124 |
IF (useSBO .AND. myIter.NE.nIter0 ) THEN |
125 |
CALL SBO_CALC ( myTime, myIter, myThid ) |
126 |
CALL SBO_DIAGS( myTime, myIter, myThid ) |
127 |
ENDIF |
128 |
#endif |
129 |
|
130 |
#ifdef ALLOW_SEAICE |
131 |
IF ( useSEAICE ) THEN |
132 |
CALL SEAICE_DO_DIAGS( myTime, myIter, myThid ) |
133 |
ENDIF |
134 |
#endif /* ALLOW_SEAICE */ |
135 |
|
136 |
#ifdef ALLOW_BULK_FORCE |
137 |
C-- Do bulkf diagnostics. |
138 |
IF (useBulkForce .AND. myIter.NE.nIter0 ) |
139 |
& CALL BULKF_DIAGS( myTime, myIter, myThid ) |
140 |
#endif |
141 |
|
142 |
#ifdef ALLOW_THSICE |
143 |
C-- Do seaice diagnostics. |
144 |
IF (useThSIce) |
145 |
& CALL THSICE_DIAGS( myTime, myIter, myThid ) |
146 |
#endif |
147 |
|
148 |
cswdptr --- add --- |
149 |
#ifdef ALLOW_GCHEM |
150 |
ceh3 ??? why is one package depending upon another here? |
151 |
C-- Do ptracer diagnostics. |
152 |
IF (usePTRACERS) |
153 |
& CALL GCHEM_DIAGS( myTime, myIter, myThid ) |
154 |
#endif |
155 |
cswdptr -- end add --- |
156 |
|
157 |
#ifdef COMPONENT_MODULE |
158 |
IF ( useCoupler ) |
159 |
& CALL CPL_WRITE_DIAGS( myTime, myIter, myThid ) |
160 |
#endif |
161 |
|
162 |
#ifdef ALLOW_DIAGNOSTICS |
163 |
IF ( usediagnostics ) call diagnostics_write (myThid, myIter) |
164 |
#endif |
165 |
|
166 |
RETURN |
167 |
END |