/[MITgcm]/MITgcm/pkg/ggl90/ggl90_output.F
ViewVC logotype

Annotation of /MITgcm/pkg/ggl90/ggl90_output.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Sun Jan 3 18:55:06 2010 UTC (14 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62i, checkpoint62h
Changes since 1.1: +70 -122 lines
- use simpler (no level index) cumulative-time counter: GGL90_timeave(bi,bj)
- cumulate fields only if doing time-ave output (GGL90_taveFreq > 0)
- changed to only full time-step increment (no first & last "half time-step")
   this fix weird 1rst average after restart.

1 jmc 1.2 C $Header: /u/gcmpack/MITgcm/pkg/ggl90/ggl90_output.F,v 1.1 2009/06/17 14:15:34 jmc Exp $
2 jmc 1.1 C $Name: $
3    
4     #include "GGL90_OPTIONS.h"
5    
6     CBOP
7     C !ROUTINE: GGL90_OUTPUT
8     C !INTERFACE:
9     SUBROUTINE GGL90_OUTPUT( myTime, myIter, myThid )
10 jmc 1.2
11 jmc 1.1 C !DESCRIPTION: \bv
12     C *==========================================================*
13     C | SUBROUTINE GGL90_OUTPUT
14     C | o Do GGL90 diagnostic output.
15     C *==========================================================
16     C | The following CPP flag (MULTIPLE_RECORD_GGL90_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 "GGL90.h"
48     #include "GGL90_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_GGL90
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 GGL90 variables.
76     C----------------------------------------------------------------
77    
78     IF (
79     & DIFFERENT_MULTIPLE(GGL90dumpFreq,myTime,deltaTClock)
80     & ) THEN
81    
82     IF (GGL90writeState) THEN
83     C Write each snap-shot as a new file
84     WRITE(suff,'(I10.10)') myIter
85 jmc 1.2 IF ( myIter.NE.nIter0 ) THEN
86     CALL WRITE_FLD_XYZ_RL( 'GGL90viscAr.', suff,
87     & GGL90viscAr, myIter, myThid )
88     CALL WRITE_FLD_XYZ_RL( 'GGL90diffKr.', suff,
89     & GGL90diffKr, myIter, myThid )
90     ENDIF
91     CALL WRITE_FLD_XYZ_RL( 'GGL90TKE.', suff,
92     & GGL90TKE, myIter, myThid )
93 jmc 1.1 ENDIF
94    
95     ENDIF
96    
97     C----------------------------------------------------------------
98     C Do GGL90 time averaging.
99     C----------------------------------------------------------------
100    
101     #ifdef ALLOW_TIMEAVE
102 jmc 1.2 IF ( GGL90taveFreq .GT. 0. _d 0 ) THEN
103 jmc 1.1
104 jmc 1.2 IF ( myIter.EQ.nIter0 ) THEN
105 jmc 1.1 C Initialize averages to zero
106 jmc 1.2 DO bj = myByLo(myThid), myByHi(myThid)
107     DO bi = myBxLo(myThid), myBxHi(myThid)
108     CALL TIMEAVE_RESET( GGL90viscArtave, Nr, bi, bj, myThid )
109     CALL TIMEAVE_RESET( GGL90diffKrtave, Nr, bi, bj, myThid )
110     CALL TIMEAVE_RESET( GGL90TKEtave, Nr, bi, bj, myThid )
111     GGL90_timeAve(bi,bj) = 0.
112 jmc 1.1 ENDDO
113     ENDDO
114    
115 jmc 1.2 ELSE
116     C Cumulate GGL90 fields (for Time Average)
117     DDTT=deltaTclock
118     DO bj = myByLo(myThid), myByHi(myThid)
119     DO bi = myBxLo(myThid), myBxHi(myThid)
120     CALL TIMEAVE_CUMULATE( GGL90viscArtave, GGL90viscAr,
121     & Nr, DDTT, bi, bj, myThid )
122     CALL TIMEAVE_CUMULATE( GGL90diffKrtave, GGL90diffKr,
123     & Nr, DDTT, bi, bj, myThid )
124     CALL TIMEAVE_CUMULATE( GGL90TKEtave, GGL90TKE,
125     & Nr, DDTT, bi, bj, myThid )
126 jmc 1.1 C Keep record of how much time has been integrated over
127 jmc 1.2 GGL90_timeAve(bi,bj) = GGL90_timeAve(bi,bj)+DDTT
128     ENDDO
129 jmc 1.1 ENDDO
130 jmc 1.2 ENDIF
131 jmc 1.1
132     C Dump files and restart average computation if needed
133 jmc 1.2 IF ( myIter.NE.nIter0 .AND.
134     & DIFFERENT_MULTIPLE(GGL90taveFreq,myTime,deltaTClock)
135     & ) THEN
136 jmc 1.1
137     C Normalize by integrated time
138 jmc 1.2 DO bj = myByLo(myThid), myByHi(myThid)
139     DO bi = myBxLo(myThid), myBxHi(myThid)
140     CALL TIMEAVE_NORMALIZE( GGL90viscArtave,
141     & GGL90_timeAve, Nr, bi, bj, myThid )
142     CALL TIMEAVE_NORMALIZE( GGL90diffKrtave,
143     & GGL90_timeAve, Nr, bi, bj, myThid )
144     CALL TIMEAVE_NORMALIZE( GGL90TKEtave,
145     & GGL90_timeAve, Nr, bi, bj, myThid )
146     ENDDO
147 jmc 1.1 ENDDO
148    
149     C Write each snap-shot as a new file
150 jmc 1.2 WRITE(suff,'(I10.10)') myIter
151     CALL WRITE_FLD_XYZ_RL( 'GGL90viscAr-T.', suff,
152     & GGL90viscArTave, myIter, myThid )
153     CALL WRITE_FLD_XYZ_RL( 'GGL90diffKr-T.', suff,
154     & GGL90diffKrTave, myIter, myThid )
155     CALL WRITE_FLD_XYZ_RL( 'GGL90TKE-T.', suff,
156     & GGL90TKETave, myIter, myThid )
157 jmc 1.1
158     C Reset averages to zero
159 jmc 1.2 DO bj = myByLo(myThid), myByHi(myThid)
160     DO bi = myBxLo(myThid), myBxHi(myThid)
161     CALL TIMEAVE_RESET( GGL90viscArtave, Nr, bi, bj, myThid )
162     CALL TIMEAVE_RESET( GGL90diffKrtave, Nr, bi, bj, myThid )
163     CALL TIMEAVE_RESET( GGL90TKEtave, Nr, bi, bj, myThid )
164     GGL90_timeAve(bi,bj) = 0.
165 jmc 1.1 ENDDO
166     ENDDO
167    
168 jmc 1.2 C- end dump-files block
169     ENDIF
170    
171     C- end if GGL90taveFreq > 0
172 jmc 1.1 ENDIF
173 jmc 1.2 #endif /* ALLOW_TIMEAVE */
174 jmc 1.1
175 jmc 1.2 #endif /* ALLOW_GGL90 */
176 jmc 1.1
177     RETURN
178     END

  ViewVC Help
Powered by ViewVC 1.1.22