1 |
jmc |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/opps/opps_output.F,v 1.1 2009/06/17 14:20:54 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "OPPS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: OPPS_OUTPUT |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE OPPS_OUTPUT( myTime, myIter, myThid ) |
10 |
jmc |
1.2 |
|
11 |
jmc |
1.1 |
C !DESCRIPTION: \bv |
12 |
|
|
C *==========================================================* |
13 |
|
|
C | SUBROUTINE OPPS_OUTPUT |
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_TAVE.h" |
49 |
|
|
|
50 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
51 |
|
|
C == Routine arguments == |
52 |
|
|
C myTime :: my time in simulation ( s ) |
53 |
|
|
C myIter :: my Iteration number |
54 |
|
|
C myThid :: my Thread Id number |
55 |
|
|
_RL myTime |
56 |
|
|
INTEGER myIter |
57 |
|
|
INTEGER myThid |
58 |
|
|
|
59 |
|
|
#ifdef ALLOW_OPPS |
60 |
jmc |
1.2 |
#ifdef ALLOW_TIMEAVE |
61 |
|
|
|
62 |
|
|
C !FUNCTIONS: |
63 |
|
|
LOGICAL DIFFERENT_MULTIPLE |
64 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
65 |
jmc |
1.1 |
|
66 |
|
|
C !LOCAL VARIABLES: |
67 |
|
|
C == Local variables == |
68 |
|
|
CHARACTER*(MAX_LEN_MBUF) suff |
69 |
jmc |
1.2 |
INTEGER bi, bj |
70 |
jmc |
1.1 |
_RL DDTT |
71 |
jmc |
1.2 |
#endif /* ALLOW_TIMEAVE */ |
72 |
jmc |
1.1 |
CEOP |
73 |
|
|
|
74 |
|
|
CMLC---------------------------------------------------------------- |
75 |
|
|
CMLC Dump snapshot of OPPS variables. |
76 |
|
|
CMLC---------------------------------------------------------------- |
77 |
|
|
CML |
78 |
jmc |
1.2 |
CML IF ( myIter.NE.nIter0 .AND. |
79 |
|
|
CML & DIFFERENT_MULTIPLE( OPPSdumpFreq, myTime, deltaTClock ) |
80 |
jmc |
1.1 |
CML & ) THEN |
81 |
|
|
CML |
82 |
|
|
CML if (OPPSwriteState) then |
83 |
|
|
CMLC Write each snap-shot as a new file |
84 |
|
|
CMLC - creates many files but for large configurations is easier to |
85 |
|
|
CMLC transfer analyse a particular snap-shots |
86 |
|
|
CML WRITE(suff,'(I10.10)') myIter |
87 |
|
|
CML CALL WRITE_FLD_XYZ_RL('OPPSconv.',suff,OPPSconvectCount, |
88 |
|
|
CML & myIter,myThid) |
89 |
|
|
CML endif |
90 |
|
|
CML |
91 |
|
|
CML ENDIF |
92 |
|
|
|
93 |
|
|
C---------------------------------------------------------------- |
94 |
|
|
C Do OPPS time averaging. |
95 |
|
|
C---------------------------------------------------------------- |
96 |
|
|
|
97 |
|
|
#ifdef ALLOW_TIMEAVE |
98 |
jmc |
1.2 |
IF ( OPPStaveFreq.GT.0. _d 0 ) THEN |
99 |
jmc |
1.1 |
|
100 |
jmc |
1.2 |
IF ( myIter.EQ.nIter0 ) THEN |
101 |
jmc |
1.1 |
C Initialize averages to zero |
102 |
jmc |
1.2 |
DO bj = myByLo(myThid), myByHi(myThid) |
103 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
104 |
|
|
CALL TIMEAVE_RESET( OPPSconvCountTave, Nr, bi, bj, myThid ) |
105 |
|
|
OPPS_timeAve(bi,bj) = 0. |
106 |
jmc |
1.1 |
ENDDO |
107 |
|
|
ENDDO |
108 |
|
|
|
109 |
jmc |
1.2 |
ELSE |
110 |
|
|
C Cumulate OPPS fields (for Time Average) |
111 |
|
|
DDTT=deltaTclock |
112 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
113 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
114 |
|
|
CALL TIMEAVE_CUMULATE( OPPSconvCountTave, OPPSconvectCount, |
115 |
|
|
& Nr, DDTT, bi, bj, myThid ) |
116 |
jmc |
1.1 |
C Keep record of how much time has been integrated over |
117 |
jmc |
1.2 |
OPPS_timeAve(bi,bj) = OPPS_timeAve(bi,bj)+DDTT |
118 |
|
|
ENDDO |
119 |
jmc |
1.1 |
ENDDO |
120 |
jmc |
1.2 |
ENDIF |
121 |
jmc |
1.1 |
|
122 |
|
|
C Dump files and restart average computation if needed |
123 |
jmc |
1.2 |
IF ( myIter.NE.nIter0 .AND. |
124 |
|
|
& DIFFERENT_MULTIPLE( OPPStaveFreq, myTime, deltaTClock ) |
125 |
|
|
& ) THEN |
126 |
jmc |
1.1 |
|
127 |
|
|
C Normalize by integrated time |
128 |
jmc |
1.2 |
DO bj = myByLo(myThid), myByHi(myThid) |
129 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
130 |
|
|
CALL TIMEAVE_NORMALIZE( OPPSconvCountTave, |
131 |
|
|
& OPPS_timeAve, Nr, bi, bj, myThid ) |
132 |
|
|
ENDDO |
133 |
jmc |
1.1 |
ENDDO |
134 |
|
|
|
135 |
|
|
C Write each snap-shot as a new file |
136 |
jmc |
1.2 |
WRITE(suff,'(I10.10)') myIter |
137 |
|
|
CALL WRITE_FLD_XYZ_RL('OPPSconvtave.',suff,OPPSconvCountTave, |
138 |
jmc |
1.1 |
& myIter,myThid) |
139 |
|
|
|
140 |
|
|
C Reset averages to zero |
141 |
jmc |
1.2 |
DO bj = myByLo(myThid), myByHi(myThid) |
142 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
143 |
|
|
CALL TIMEAVE_RESET( OPPSconvCountTave, Nr, bi, bj, myThid ) |
144 |
|
|
OPPS_timeAve(bi,bj) = 0. |
145 |
jmc |
1.1 |
ENDDO |
146 |
|
|
ENDDO |
147 |
|
|
|
148 |
jmc |
1.2 |
C- end dump-files block |
149 |
|
|
ENDIF |
150 |
|
|
|
151 |
|
|
C- end if OPPStaveFreq > 0 |
152 |
jmc |
1.1 |
ENDIF |
153 |
|
|
#endif /* ALLOW_TIMEAVE */ |
154 |
|
|
|
155 |
|
|
#endif /* ALLOW_OPPS */ |
156 |
|
|
|
157 |
|
|
RETURN |
158 |
|
|
END |