/[MITgcm]/MITgcm/model/src/write_state.F
ViewVC logotype

Contents of /MITgcm/model/src/write_state.F

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


Revision 1.21 - (show annotations) (download)
Tue Feb 18 15:25:09 2003 UTC (21 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint50c_post, checkpoint50c_pre, checkpoint48i_post, checkpoint50, checkpoint50d_post, checkpoint50b_pre, checkpoint48h_post, checkpoint50a_post, checkpoint50d_pre, checkpoint49, checkpoint48g_post, checkpoint50b_post
Changes since 1.20: +4 -9 lines
o compute locally the pressure for use in EOS: UNESCO, JMD95P or MDJWF
o store total Potential in totPhyHyd for diagnostic & EOS funct. of P
o fix restart and overlap Pb when using Z-coord and EOS funct. of P

1 C $Header: /u/gcmpack/MITgcm/model/src/write_state.F,v 1.20 2003/02/18 05:33:54 dimitri Exp $
2 C $Name: $
3 #include "CPP_OPTIONS.h"
4
5 #undef MULTIPLE_RECORD_STATE_FILES
6
7 CBOP
8 C !ROUTINE: WRITE_STATE
9 C !INTERFACE:
10 SUBROUTINE WRITE_STATE ( myTime, myIter, myThid )
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE WRITE_STATE
14 C | o Controlling routine for IO to dump model state.
15 C *==========================================================*
16 C | Write model state files for post-processing. This file
17 C | includes code for diagnosing W and RHO for output.
18 C | File write_state.F: Routines to handle mid-level I/O
19 C | interface.
20 C | o WRITE_STATE - Write out model state.
21 C | The following CPP flag (MULTIPLE_RECORD_STATE_FILES) is
22 C | #define/#undefed here since it is specific to this routine
23 C | and very user-preference specific.
24 C |
25 C | If #undefed (default) the state files are written as in all versions
26 C | prior to checkpoint32, where a file is created per variable, per time
27 C | and per tile. This *has* to be the default because most users use this
28 C | mode and all utilities and scripts (diagnostic) assume this form.
29 C | It is also robust, as explained below.
30 C |
31 C | If #defined, subsequent snap-shots are written as records in the
32 C | same file (no iteration number in filenames).
33 C | Advantages: - fewer files
34 C | - for small problems, is easy to copy the output around
35 C | Disadvantages:
36 C | - breaks a lot of diagnostic scripts
37 C | - for large or long problems this creates huge files
38 C | - is an unexpected, unsolicited change in behaviour which came
39 C | as a surprise (in c32) and inconvenience to several users
40 C | - can not accomodate changing the frequency of output
41 C | after a pickup (this is trivial in previous method
42 C | but needs new code and parameters in this new method)
43 C | Known Bugs:
44 C | - if the length of integration is not exactly an integer
45 C | times the output frequency then the last record written
46 C | (at end of integration) overwrites a previously written
47 C | record corresponding to an earier time. *BE WARNED*
48 C *==========================================================*
49 C \ev
50
51 C !USES:
52 IMPLICIT NONE
53 C == Global variables ===
54 #include "SIZE.h"
55 #include "EEPARAMS.h"
56 #include "PARAMS.h"
57 #include "DYNVARS.h"
58 #include "GRID.h"
59 #include "EOS.h"
60 #ifdef ALLOW_PASSIVE_TRACER
61 #include "TR1.h"
62 #endif
63 LOGICAL DIFFERENT_MULTIPLE
64 EXTERNAL DIFFERENT_MULTIPLE
65 INTEGER IO_ERRCOUNT
66 EXTERNAL IO_ERRCOUNT
67
68 C !INPUT/OUTPUT PARAMETERS:
69 C == Routine arguments ==
70 C myThid - Thread number for this instance of the routine.
71 C myIter - Iteration number
72 C myTime - Current time of simulation ( s )
73 _RL myTime
74 INTEGER myThid
75 INTEGER myIter
76
77 C !LOCAL VARIABLES:
78 C == Local variables ==
79 CHARACTER*(MAX_LEN_MBUF) suff
80 INTEGER iRec
81 CEOP
82
83 IF (
84 & DIFFERENT_MULTIPLE(dumpFreq,myTime,
85 & myTime-deltaTClock) .OR.
86 & myTime.EQ.endTime .OR.
87 & myTime.EQ.startTime
88 & ) THEN
89 IF ( dumpFreq .EQ. 0.0 ) THEN
90 iRec = 1
91 ELSE
92 iRec = int ( (myTime-startTime) / dumpFreq +1.5 )
93 ENDIF
94
95 C-- Going to really do some IO. Make everyone except master thread wait.
96 _BARRIER
97 _BEGIN_MASTER( myThid )
98
99 C-- Write model fields
100
101 #ifdef MULTIPLE_RECORD_STATE_FILES
102
103 C Write each snap-shot as a new record in one file per variable
104 C - creates relatively few files but these files can become huge
105 CALL WRITE_REC_XYZ_RL( 'U', uVel,iRec,myIter,myThid)
106 CALL WRITE_REC_XYZ_RL( 'V', vVel,iRec,myIter,myThid)
107 CALL WRITE_REC_XYZ_RL( 'T', theta,iRec,myIter,myThid)
108 CALL WRITE_REC_XYZ_RL( 'S', salt,iRec,myIter,myThid)
109 CALL WRITE_REC_XY_RL('Eta',etaN,iRec,myIter,myThid)
110 CALL WRITE_REC_XYZ_RL( 'W',wVel,iRec,myIter,myThid)
111 #ifdef ALLOW_PASSIVE_TRACER
112 CALL WRITE_REC_XYZ_RL( 'TR1',tr1,iRec,myIter,myThid)
113 #endif
114 #ifdef ALLOW_NONHYDROSTATIC
115 IF (nonHydroStatic) THEN
116 CALL WRITE_REC_XYZ_RL( 'PNH',phi_nh,iRec,myIter,myThid)
117 ENDIF
118 #endif /* ALLOW_NONHYDROSTATIC */
119 #ifdef NONLIN_FRSURF
120 CALL WRITE_REC_XYZ_RS('hFacC.',hFacC,iRec,myIter,myThid)
121 CALL WRITE_FLD_XYZ_RS('hFacW.',hFacW,iRec,myIter,myThid)
122 CALL WRITE_FLD_XYZ_RS('hFacS.',hFacS,iRec,myIter,myThid)
123 #endif /* NONLIN_FRSURF */
124
125 #else /* MULTIPLE_RECORD_STATE_FILES */
126
127 C Write each snap-shot as a new file (original and default method)
128 C - creates many files but for large configurations is easier to
129 C transfer analyse a particular snap-shots
130 WRITE(suff,'(I10.10)') myIter
131 CALL WRITE_FLD_XYZ_RL( 'U.',suff,uVel,myIter,myThid)
132 CALL WRITE_FLD_XYZ_RL( 'V.',suff,vVel,myIter,myThid)
133 CALL WRITE_FLD_XYZ_RL( 'T.',suff,theta,myIter,myThid)
134 CALL WRITE_FLD_XYZ_RL( 'S.',suff,salt,myIter,myThid)
135 CALL WRITE_FLD_XY_RL('Eta.',suff,etaN,myIter,myThid)
136 CALL WRITE_FLD_XYZ_RL( 'W.',suff,wVel,myIter,myThid)
137 CALL WRITE_FLD_XYZ_RL( 'PH.',suff,totPhiHyd,myIter,myThid)
138 IF ( buoyancyRelation .NE. 'ATMOSPHERIC' )
139 & CALL WRITE_FLD_XY_RL('PHL.',suff,phiHydLow,myIter,myThid)
140 #ifdef ALLOW_PASSIVE_TRACER
141 CALL WRITE_FLD_XYZ_RL( 'TR1.',suff,tr1,myIter,myThid)
142 #endif
143 #ifdef ALLOW_NONHYDROSTATIC
144 IF (nonHydroStatic) THEN
145 CALL WRITE_FLD_XYZ_RL( 'PNH.',suff,phi_nh,myIter,myThid)
146 ENDIF
147 #endif /* ALLOW_NONHYDROSTATIC */
148 #ifdef NONLIN_FRSURF
149 CALL WRITE_FLD_XYZ_RS('hFacC.',suff,hFacC,myIter,myThid)
150 CALL WRITE_FLD_XYZ_RS('hFacW.',suff,hFacW,myIter,myThid)
151 CALL WRITE_FLD_XYZ_RS('hFacS.',suff,hFacS,myIter,myThid)
152 #endif /* NONLIN_FRSURF */
153
154 #endif /* MULTIPLE_RECORD_STATE_FILES */
155
156 #ifdef ALLOW_PTRACERS
157 IF (usePTRACERS) CALL PTRACERS_WRITE_STATE(myIter,myTime,myThid)
158 #endif /* ALLOW_PTRACERS */
159 _END_MASTER( myThid )
160 _BARRIER
161
162 ENDIF
163
164 RETURN
165 END

  ViewVC Help
Powered by ViewVC 1.1.22