1 |
jmc |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/pp81/pp81_output.F,v 1.1 2009/06/17 14:24:06 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PP81_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: PP81_OUTPUT |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE PP81_OUTPUT( myTime, myIter, myThid ) |
10 |
jmc |
1.2 |
|
11 |
jmc |
1.1 |
C !DESCRIPTION: \bv |
12 |
|
|
C *==========================================================* |
13 |
|
|
C | SUBROUTINE PP81_OUTPUT |
14 |
|
|
C | o Do PP81 diagnostic output. |
15 |
|
|
C *========================================================== |
16 |
|
|
C | The following CPP flag (MULTIPLE_RECORD_PP81_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 "PP81.h" |
48 |
|
|
#include "PP81_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_PP81 |
60 |
|
|
|
61 |
jmc |
1.2 |
C !FUNCTIONS: |
62 |
|
|
LOGICAL DIFFERENT_MULTIPLE |
63 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
64 |
|
|
|
65 |
jmc |
1.1 |
C !LOCAL VARIABLES: |
66 |
|
|
C == Local variables == |
67 |
|
|
CHARACTER*(MAX_LEN_MBUF) suff |
68 |
jmc |
1.2 |
#ifdef ALLOW_TIMEAVE |
69 |
|
|
INTEGER bi, bj |
70 |
jmc |
1.1 |
_RL DDTT |
71 |
jmc |
1.2 |
#endif |
72 |
jmc |
1.1 |
CEOP |
73 |
|
|
|
74 |
|
|
C---------------------------------------------------------------- |
75 |
|
|
C Dump snapshot of PP variables. |
76 |
|
|
C---------------------------------------------------------------- |
77 |
|
|
|
78 |
jmc |
1.2 |
IF ( myIter.NE.nIter0 .AND. |
79 |
|
|
& DIFFERENT_MULTIPLE( PPdumpFreq, myTime, deltaTClock ) |
80 |
|
|
& ) THEN |
81 |
|
|
|
82 |
|
|
IF (PPwriteState) THEN |
83 |
jmc |
1.1 |
C Write each snap-shot as a new file |
84 |
|
|
WRITE(suff,'(I10.10)') myIter |
85 |
|
|
CALL WRITE_FLD_XYZ_RL('PPviscAr.',suff,PPviscAr, |
86 |
|
|
& myIter,myThid) |
87 |
|
|
CALL WRITE_FLD_XYZ_RL('PPdiffKr.',suff,PPdiffKr, |
88 |
|
|
& myIter,myThid) |
89 |
jmc |
1.2 |
ENDIF |
90 |
jmc |
1.1 |
|
91 |
|
|
ENDIF |
92 |
|
|
|
93 |
|
|
C---------------------------------------------------------------- |
94 |
|
|
C Do PP time averaging. |
95 |
|
|
C---------------------------------------------------------------- |
96 |
|
|
|
97 |
|
|
#ifdef ALLOW_TIMEAVE |
98 |
jmc |
1.2 |
IF ( PPtaveFreq.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( PPviscArtave, Nr, bi, bj, myThid ) |
105 |
|
|
CALL TIMEAVE_RESET( PPdiffKrtave, Nr, bi, bj, myThid ) |
106 |
|
|
PP_timeAve(bi,bj) = 0. |
107 |
jmc |
1.1 |
ENDDO |
108 |
|
|
ENDDO |
109 |
|
|
|
110 |
jmc |
1.2 |
ELSE |
111 |
|
|
C Cumulate PP fields (for Time Average) |
112 |
|
|
DDTT=deltaTclock |
113 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
114 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
115 |
|
|
CALL TIMEAVE_CUMULATE( PPviscArtave, PPviscAr, |
116 |
|
|
& Nr, DDTT, bi, bj, myThid ) |
117 |
|
|
CALL TIMEAVE_CUMULATE( PPdiffKrtave, PPdiffKr, |
118 |
|
|
& Nr, DDTT, bi, bj, myThid ) |
119 |
jmc |
1.1 |
C Keep record of how much time has been integrated over |
120 |
jmc |
1.2 |
PP_timeAve(bi,bj) = PP_timeAve(bi,bj)+DDTT |
121 |
|
|
ENDDO |
122 |
jmc |
1.1 |
ENDDO |
123 |
jmc |
1.2 |
ENDIF |
124 |
jmc |
1.1 |
|
125 |
|
|
C Dump files and restart average computation if needed |
126 |
jmc |
1.2 |
IF ( myIter.NE.nIter0 .AND. |
127 |
|
|
& DIFFERENT_MULTIPLE( PPtaveFreq, myTime, deltaTClock ) |
128 |
|
|
& ) THEN |
129 |
jmc |
1.1 |
|
130 |
|
|
C Normalize by integrated time |
131 |
jmc |
1.2 |
DO bj = myByLo(myThid), myByHi(myThid) |
132 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
133 |
|
|
CALL TIMEAVE_NORMALIZE( PPviscArtave, |
134 |
|
|
& PP_timeAve, Nr, bi, bj, myThid ) |
135 |
|
|
CALL TIMEAVE_NORMALIZE( PPdiffKrtave, |
136 |
|
|
& PP_timeAve, Nr, bi, bj, myThid ) |
137 |
|
|
ENDDO |
138 |
jmc |
1.1 |
ENDDO |
139 |
|
|
|
140 |
|
|
C Write each snap-shot as a new file |
141 |
jmc |
1.2 |
WRITE(suff,'(I10.10)') myIter |
142 |
|
|
CALL WRITE_FLD_XYZ_RL( 'PPviscAr-T.', suff, |
143 |
|
|
& PPviscArTave, myIter, myThid ) |
144 |
|
|
CALL WRITE_FLD_XYZ_RL( 'PPdiffKr-T.', suff, |
145 |
|
|
& PPdiffKrTave, myIter, myThid ) |
146 |
jmc |
1.1 |
|
147 |
|
|
C Reset averages to zero |
148 |
jmc |
1.2 |
DO bj = myByLo(myThid), myByHi(myThid) |
149 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
150 |
|
|
CALL TIMEAVE_RESET( PPviscArtave, Nr, bi, bj, myThid ) |
151 |
|
|
CALL TIMEAVE_RESET( PPdiffKrtave, Nr, bi, bj, myThid ) |
152 |
|
|
PP_timeAve(bi,bj) = 0. |
153 |
jmc |
1.1 |
ENDDO |
154 |
|
|
ENDDO |
155 |
|
|
|
156 |
jmc |
1.2 |
C- end dump-files block |
157 |
|
|
ENDIF |
158 |
|
|
|
159 |
|
|
C- end if PPtaveFreq > 0 |
160 |
jmc |
1.1 |
ENDIF |
161 |
|
|
#endif /* ALLOW_TIMEAVE */ |
162 |
|
|
|
163 |
|
|
#endif /* ALLOW_PP81 */ |
164 |
|
|
|
165 |
|
|
RETURN |
166 |
|
|
END |