1 |
jmc |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/opps/opps_do_diags.F,v 1.1 2004/09/16 11:28:16 mlosch Exp $ |
2 |
mlosch |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "OPPS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
#undef MULTIPLE_RECORD_OPPS_STATE_FILES |
7 |
|
|
CBOP |
8 |
|
|
C !ROUTINE: OPPS_DO_DIAGS |
9 |
|
|
C !INTERFACE: |
10 |
|
|
SUBROUTINE OPPS_DO_DIAGS( myCurrentTime, myIter, myThid ) |
11 |
|
|
C !DESCRIPTION: \bv |
12 |
|
|
C *==========================================================* |
13 |
|
|
C | SUBROUTINE OPPS_DO_DIAGS |
14 |
|
|
C | o Do OPPS diagnostic output. |
15 |
|
|
C *========================================================== |
16 |
|
|
C | The following CPP flag (MULTIPLE_RECORD_OPPS_STATE_FILES) is |
17 |
|
|
C | #define/#undefed here since it is specific to this routine |
18 |
|
|
C | and very user-preference specific. |
19 |
|
|
C | |
20 |
|
|
C | If #undefed (default) the state files are written as in all versions |
21 |
|
|
C | prior to checkpoint32, where a file is created per variable, per time |
22 |
|
|
C | and per tile. This *has* to be the default because most users use this |
23 |
|
|
C | mode and all utilities and scripts (diagnostic) assume this form. |
24 |
|
|
C | It is also robust, as explained below. |
25 |
|
|
C | |
26 |
|
|
C | If #defined, subsequent snap-shots are written as records in the |
27 |
|
|
C | same file (no iteration number in filenames). |
28 |
|
|
C | Advantages: - fewer files |
29 |
|
|
C | - for small problems, is easy to copy the output around |
30 |
|
|
C | Disadvantages: |
31 |
|
|
C | - breaks a lot of diagnostic scripts |
32 |
|
|
C | - for large or long problems this creates huge files |
33 |
|
|
C | - is an unexpected, unsolicited change in behaviour which came |
34 |
|
|
C | as a surprise (in c32) and inconvenience to several users |
35 |
|
|
C | - can not accomodate changing the frequency of output |
36 |
|
|
C | after a pickup (this is trivial in previous method |
37 |
|
|
C | but needs new code and parameters in this new method) |
38 |
|
|
C *==========================================================* |
39 |
|
|
C \ev |
40 |
|
|
|
41 |
|
|
C !USES: |
42 |
|
|
IMPLICIT NONE |
43 |
|
|
C === Global variables === |
44 |
|
|
#include "SIZE.h" |
45 |
|
|
#include "EEPARAMS.h" |
46 |
|
|
#include "PARAMS.h" |
47 |
|
|
#include "OPPS.h" |
48 |
|
|
#include "OPPS_DIAGS.h" |
49 |
|
|
|
50 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
51 |
|
|
C == Routine arguments == |
52 |
|
|
C myCurrentTime - Current time of simulation ( s ) |
53 |
|
|
C myIter - Iteration number |
54 |
|
|
C myThid - Number of this instance of INI_FORCING |
55 |
|
|
_RL myCurrentTime |
56 |
|
|
INTEGER myIter |
57 |
|
|
INTEGER myThid |
58 |
|
|
|
59 |
|
|
#ifdef ALLOW_OPPS |
60 |
|
|
|
61 |
|
|
C !LOCAL VARIABLES: |
62 |
|
|
C == Local variables == |
63 |
|
|
CHARACTER*(MAX_LEN_MBUF) suff |
64 |
jmc |
1.2 |
LOGICAL DIFF_BASE_MULTIPLE |
65 |
|
|
EXTERNAL DIFF_BASE_MULTIPLE |
66 |
mlosch |
1.1 |
INTEGER bi, bj, K |
67 |
|
|
_RL DDTT |
68 |
|
|
CEOP |
69 |
|
|
|
70 |
|
|
CMLC---------------------------------------------------------------- |
71 |
|
|
CMLC Dump snapshot of OPPS variables. |
72 |
|
|
CMLC---------------------------------------------------------------- |
73 |
|
|
CML |
74 |
|
|
CML IF ( |
75 |
jmc |
1.2 |
CML & DIFF_BASE_MULTIPLE(baseTime,OPPSdumpFreq, |
76 |
|
|
CML & myCurrentTime,deltaTClock) |
77 |
mlosch |
1.1 |
CML & ) THEN |
78 |
|
|
CML |
79 |
|
|
CML if (OPPSwriteState) then |
80 |
|
|
CML#ifdef MULTIPLE_RECORD_OPPS_STATE_FILES |
81 |
|
|
CMLC Write each snap-shot as a new record in one file per variable |
82 |
|
|
CMLC - creates relatively few files but these files can become huge |
83 |
|
|
CML CALL WRITE_REC_XYZ_RL('OPPSconv',OPPSconvectCount,opps_drctrec, |
84 |
|
|
CML & myIter,myThid) |
85 |
|
|
CML#else /* MULTIPLE_RECORD_OPPS_STATE_FILES */ |
86 |
|
|
CMLC Write each snap-shot as a new file |
87 |
|
|
CMLC - creates many files but for large configurations is easier to |
88 |
|
|
CMLC transfer analyse a particular snap-shots |
89 |
|
|
CML WRITE(suff,'(I10.10)') myIter |
90 |
|
|
CML CALL WRITE_FLD_XYZ_RL('OPPSconv.',suff,OPPSconvectCount, |
91 |
|
|
CML & myIter,myThid) |
92 |
|
|
CML#endif /* MULTIPLE_RECORD_OPPS_STATE_FILES */ |
93 |
|
|
CML endif |
94 |
|
|
CML |
95 |
|
|
CMLC-- Increment record counter |
96 |
|
|
CML opps_drctrec = opps_drctrec + 1 |
97 |
|
|
CML |
98 |
|
|
CML ENDIF |
99 |
|
|
|
100 |
|
|
C---------------------------------------------------------------- |
101 |
|
|
C Do OPPS time averaging. |
102 |
|
|
C---------------------------------------------------------------- |
103 |
|
|
|
104 |
|
|
#ifdef ALLOW_TIMEAVE |
105 |
|
|
|
106 |
|
|
C Initialize averages to zero |
107 |
|
|
IF ( myIter.EQ.nIter0 ) THEN |
108 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
109 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
110 |
|
|
CALL TIMEAVE_RESET(OPPSconvectCountTave,Nr,bi,bj,myThid) |
111 |
|
|
DO k=1,Nr |
112 |
|
|
opps_TimeAve(k,bi,bj)=0. |
113 |
|
|
ENDDO |
114 |
|
|
ENDDO |
115 |
|
|
ENDDO |
116 |
|
|
ENDIF |
117 |
|
|
|
118 |
|
|
C Time Average OPPS fields |
119 |
|
|
IF ( myIter .EQ. nIter0 .OR. |
120 |
jmc |
1.2 |
& DIFF_BASE_MULTIPLE |
121 |
|
|
& (baseTime,OPPStaveFreq,myCurrentTime,deltaTClock) ) |
122 |
mlosch |
1.1 |
& THEN |
123 |
|
|
DDTT=0.5*deltaTclock |
124 |
|
|
ELSE |
125 |
|
|
DDTT=deltaTclock |
126 |
|
|
ENDIF |
127 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
128 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
129 |
|
|
C Keep record of how much time has been integrated over |
130 |
|
|
DO k=1,Nr |
131 |
|
|
opps_TimeAve(k,bi,bj)=opps_TimeAve(k,bi,bj)+DDTT |
132 |
|
|
ENDDO |
133 |
|
|
ENDDO |
134 |
|
|
ENDDO |
135 |
|
|
|
136 |
|
|
C Dump files and restart average computation if needed |
137 |
|
|
IF ( myIter.NE.nIter0 .AND. |
138 |
jmc |
1.2 |
& DIFF_BASE_MULTIPLE(baseTime,OPPStaveFreq, |
139 |
|
|
& myCurrentTime,deltaTClock) |
140 |
mlosch |
1.1 |
& ) THEN |
141 |
|
|
|
142 |
|
|
C Normalize by integrated time |
143 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
144 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
145 |
|
|
CALL TIMEAVE_NORMALIZ(OPPSconvectCountTave,opps_timeave, |
146 |
|
|
& Nr, bi,bj,myThid) |
147 |
|
|
ENDDO |
148 |
|
|
ENDDO |
149 |
|
|
|
150 |
|
|
#ifdef MULTIPLE_RECORD_OPPS_STATE_FILES |
151 |
|
|
C Write each snap-shot as a new record in one file per variable |
152 |
|
|
C - creates relatively few files but these files can become huge |
153 |
|
|
CALL WRITE_REC_XYZ_RL('OPPSconvtave',OPPSconvectCountTave, |
154 |
|
|
& opps_drctrecTave,myIter,myThid) |
155 |
|
|
C-- Increment record counter |
156 |
|
|
opps_drctrecTave = opps_drctrecTave + 1 |
157 |
|
|
|
158 |
|
|
#else /* MULTIPLE_RECORD_OPPS_STATE_FILES */ |
159 |
|
|
|
160 |
|
|
C Write each snap-shot as a new file |
161 |
|
|
C - creates many files but for large configurations is easier to |
162 |
|
|
C transfer analyse a particular snap-shots |
163 |
|
|
WRITE(suff,'(I10.10)') myIter |
164 |
|
|
CALL WRITE_FLD_XYZ_RL('OPPSconvtave.',suff,OPPSconvectCountTave, |
165 |
|
|
& myIter,myThid) |
166 |
|
|
#endif /* MULTIPLE_RECORD_OPPS_STATE_FILES */ |
167 |
|
|
|
168 |
|
|
C Reset averages to zero |
169 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
170 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
171 |
|
|
CALL TIMEAVE_RESET(OPPSconvectCountTave, Nr,bi,bj,myThid) |
172 |
|
|
DO k=1,Nr |
173 |
|
|
opps_TimeAve(k,bi,bj)=0. |
174 |
|
|
ENDDO |
175 |
|
|
ENDDO |
176 |
|
|
ENDDO |
177 |
|
|
|
178 |
|
|
C Time Average OPPS fields |
179 |
|
|
DDTT=0.5*deltaTclock |
180 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
181 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
182 |
|
|
CALL TIMEAVE_CUMULATE( |
183 |
|
|
& OPPSconvectCountTave, OPPSconvectCount, |
184 |
|
|
& Nr,DDTT,bi,bj,myThid) |
185 |
|
|
C Keep record of how much time has been integrated over |
186 |
|
|
DO k=1,Nr |
187 |
|
|
opps_TimeAve(k,bi,bj)=opps_TimeAve(k,bi,bj)+DDTT |
188 |
|
|
ENDDO |
189 |
|
|
ENDDO |
190 |
|
|
ENDDO |
191 |
|
|
ENDIF |
192 |
|
|
|
193 |
|
|
#endif /* ALLOW_TIMEAVE */ |
194 |
|
|
|
195 |
|
|
#endif /* ALLOW_OPPS */ |
196 |
|
|
|
197 |
|
|
RETURN |
198 |
|
|
END |